amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version v4.2.4+314e4831
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  151. });
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve$1(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return resolve(promise, value);
  253. }, function (reason) {
  254. return reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(input)) {
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. return promise.then(function (value) {
  949. return constructor.resolve(callback()).then(function () {
  950. return value;
  951. });
  952. }, function (reason) {
  953. return constructor.resolve(callback()).then(function () {
  954. throw reason;
  955. });
  956. });
  957. };
  958. return Promise;
  959. }();
  960. Promise$1.prototype.then = then;
  961. Promise$1.all = all;
  962. Promise$1.race = race;
  963. Promise$1.resolve = resolve$1;
  964. Promise$1.reject = reject$1;
  965. Promise$1._setScheduler = setScheduler;
  966. Promise$1._setAsap = setAsap;
  967. Promise$1._asap = asap;
  968. /*global self*/
  969. function polyfill() {
  970. var local = void 0;
  971. if (typeof global !== 'undefined') {
  972. local = global;
  973. } else if (typeof self !== 'undefined') {
  974. local = self;
  975. } else {
  976. try {
  977. local = Function('return this')();
  978. } catch (e) {
  979. throw new Error('polyfill failed because global object is unavailable in this environment');
  980. }
  981. }
  982. var P = local.Promise;
  983. if (P) {
  984. var promiseToString = null;
  985. try {
  986. promiseToString = Object.prototype.toString.call(P.resolve());
  987. } catch (e) {
  988. // silently ignored
  989. }
  990. if (promiseToString === '[object Promise]' && !P.cast) {
  991. return;
  992. }
  993. }
  994. local.Promise = Promise$1;
  995. }
  996. // Strange compat..
  997. Promise$1.polyfill = polyfill;
  998. Promise$1.Promise = Promise$1;
  999. return Promise$1;
  1000. })));
  1001. //# sourceMappingURL=es6-promise.map
  1002. ;
  1003. (function () {
  1004. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  1005. promiseLib.polyfill();
  1006. return new Promise(function (resolve, reject) {
  1007. require(["__app__"], resolve, reject);
  1008. });
  1009. });
  1010. }());
  1011. //jshint eqnull:true
  1012. define('amber/kernel-runtime',[],function () {
  1013. "use strict";
  1014. function defineMethod (klass, name, method) {
  1015. Object.defineProperty(klass.prototype, name, {
  1016. value: method,
  1017. enumerable: false, configurable: true, writable: true
  1018. });
  1019. }
  1020. function installJSMethod (obj, jsSelector, fn) {
  1021. Object.defineProperty(obj, jsSelector, {
  1022. value: fn,
  1023. enumerable: false, configurable: true, writable: true
  1024. });
  1025. }
  1026. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1027. function RuntimeSelectorsBrik (brikz, st) {
  1028. var selectors = brikz.selectors.selectors;
  1029. var globals = brikz.smalltalkGlobals.globals;
  1030. var nilAsClass = brikz.classes.nilAsClass;
  1031. var st2js = brikz.selectorConversion.st2js;
  1032. var jsSelectors = this.jsSelectors = [];
  1033. /* Method not implemented handlers */
  1034. function installNewSelectors (newSelectors, targetClasses) {
  1035. newSelectors.forEach(function (selector) {
  1036. var jsSelector = st2js(selector);
  1037. jsSelectors.push(jsSelector);
  1038. var fn = createDnuHandler(selector);
  1039. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1040. targetClasses.forEach(function (target) {
  1041. installJSMethod(target.fn.prototype, jsSelector, fn);
  1042. });
  1043. });
  1044. }
  1045. this.installNewSelectors = installNewSelectors;
  1046. /* Dnu handler method */
  1047. function createDnuHandler (stSelector) {
  1048. return function () {
  1049. return globals.Message._selector_arguments_notUnderstoodBy_(
  1050. stSelector, [].slice.call(arguments), this
  1051. );
  1052. };
  1053. }
  1054. installNewSelectors(selectors, []);
  1055. }
  1056. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1057. function RuntimeClassesBrik (brikz, st) {
  1058. var globals = brikz.smalltalkGlobals.globals;
  1059. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1060. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1061. var installMethod = brikz.runtimeMethods.installMethod;
  1062. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1063. var wireKlass = brikz.classes.wireKlass;
  1064. var emit = brikz.event.emit;
  1065. var detachedRootClasses = [];
  1066. function markClassDetachedRoot (klass) {
  1067. klass.detachedRoot = true;
  1068. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1069. return klass.detachedRoot;
  1070. });
  1071. }
  1072. emit.selectorsAdded = function (newSelectors) {
  1073. installNewSelectors(newSelectors, detachedRootClasses);
  1074. };
  1075. /* Initialize a class in its class hierarchy. Handle both classes and
  1076. metaclasses. */
  1077. function initClassAndMetaclass (klass) {
  1078. initClass(klass);
  1079. if (klass.a$cls && !klass.meta) {
  1080. initClass(klass.a$cls);
  1081. }
  1082. }
  1083. traitsOrClasses.forEach(function (traitOrClass) {
  1084. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1085. });
  1086. emit.classAdded = function (klass) {
  1087. initClassAndMetaclass(klass);
  1088. klass._enterOrganization();
  1089. };
  1090. emit.traitAdded = function (trait) {
  1091. trait._enterOrganization();
  1092. };
  1093. emit.classRemoved = function (klass) {
  1094. klass._leaveOrganization();
  1095. };
  1096. emit.traitRemoved = function (trait) {
  1097. trait._leaveOrganization();
  1098. };
  1099. function initClass (klass) {
  1100. wireKlass(klass);
  1101. if (klass.detachedRoot) {
  1102. copySuperclass(klass);
  1103. }
  1104. installMethods(klass);
  1105. }
  1106. function copySuperclass (klass) {
  1107. var myproto = klass.fn.prototype,
  1108. superproto = klass.superclass.fn.prototype;
  1109. jsSelectors.forEach(function (jsSelector) {
  1110. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1111. });
  1112. }
  1113. function installMethods (klass) {
  1114. var methods = klass.methods;
  1115. Object.keys(methods).forEach(function (selector) {
  1116. installMethod(methods[selector], klass);
  1117. });
  1118. }
  1119. /* Create an alias for an existing class */
  1120. st.alias = function (traitOrClass, alias) {
  1121. globals[alias] = traitOrClass;
  1122. };
  1123. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1124. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1125. markClassDetachedRoot(klass);
  1126. klass.fn = constructor;
  1127. initClass(klass);
  1128. };
  1129. }
  1130. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1131. function FrameBindingBrik (brikz, st) {
  1132. var globals = brikz.smalltalkGlobals.globals;
  1133. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1134. setClassConstructor(globals.Number, Number);
  1135. setClassConstructor(globals.BlockClosure, Function);
  1136. setClassConstructor(globals.Boolean, Boolean);
  1137. setClassConstructor(globals.Date, Date);
  1138. setClassConstructor(globals.String, String);
  1139. setClassConstructor(globals.Array, Array);
  1140. setClassConstructor(globals.RegularExpression, RegExp);
  1141. setClassConstructor(globals.Error, Error);
  1142. setClassConstructor(globals.Promise, Promise);
  1143. this.__init__ = function () {
  1144. st.alias(globals.Array, "OrderedCollection");
  1145. st.alias(globals.Date, "Time");
  1146. }
  1147. }
  1148. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1149. function RuntimeMethodsBrik (brikz, st) {
  1150. var st2js = brikz.selectorConversion.st2js;
  1151. var emit = brikz.event.emit;
  1152. function installMethod (method, klass) {
  1153. var jsSelector = method.jsSelector;
  1154. if (!jsSelector) {
  1155. jsSelector = method.jsSelector = st2js(method.selector);
  1156. }
  1157. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1158. }
  1159. this.installMethod = installMethod;
  1160. emit.behaviorMethodAdded = function (method, klass) {
  1161. installMethod(method, klass);
  1162. propagateMethodChange(klass, method, klass);
  1163. };
  1164. emit.behaviorMethodRemoved = function (method, klass) {
  1165. delete klass.fn.prototype[method.jsSelector];
  1166. propagateMethodChange(klass, method, null);
  1167. };
  1168. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1169. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1170. };
  1171. function propagateMethodChange (klass, method, exclude) {
  1172. var selector = method.selector;
  1173. var jsSelector = method.jsSelector;
  1174. st.traverseClassTree(klass, function (subclass, sentinel) {
  1175. if (subclass === exclude) return;
  1176. if (subclass.methods[selector]) return sentinel;
  1177. if (subclass.detachedRoot) {
  1178. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1179. }
  1180. });
  1181. }
  1182. }
  1183. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1184. function PrimitivesBrik (brikz, st) {
  1185. var globals = brikz.smalltalkGlobals.globals;
  1186. /* Converts a JavaScript object to valid Smalltalk Object */
  1187. st.readJSObject = function (js) {
  1188. if (js == null) return null;
  1189. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1190. else if (js.constructor !== Object) return js;
  1191. var pairs = [];
  1192. for (var i in js) {
  1193. pairs.push(i, st.readJSObject(js[i]));
  1194. }
  1195. return globals.Dictionary._newFromPairs_(pairs);
  1196. };
  1197. /* Boolean assertion */
  1198. st.assert = function (shouldBeBoolean) {
  1199. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1200. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1201. shouldBeBoolean = shouldBeBoolean.valueOf();
  1202. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1203. }
  1204. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1205. };
  1206. }
  1207. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1208. function RuntimeBrik (brikz, st) {
  1209. var globals = brikz.smalltalkGlobals.globals;
  1210. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1211. function SmalltalkMethodContext (home, setup) {
  1212. // TODO lazy fill of .sendIdx
  1213. this.sendIdx = {};
  1214. // TODO very likely .senderContext, not .homeContext here
  1215. this.homeContext = home;
  1216. this.setup = setup;
  1217. }
  1218. // Fallbacks
  1219. SmalltalkMethodContext.prototype.supercall = false;
  1220. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1221. SmalltalkMethodContext.prototype.receiver = null;
  1222. SmalltalkMethodContext.prototype.selector = null;
  1223. SmalltalkMethodContext.prototype.lookupClass = null;
  1224. SmalltalkMethodContext.prototype.outerContext = null;
  1225. SmalltalkMethodContext.prototype.index = 0;
  1226. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1227. this.receiver = receiver;
  1228. this.selector = selector;
  1229. if (locals != null) this.locals = locals;
  1230. this.lookupClass = lookupClass;
  1231. if (this.homeContext) {
  1232. this.homeContext.evaluatedSelector = selector;
  1233. }
  1234. });
  1235. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1236. if (locals != null) this.locals = locals;
  1237. this.outerContext = ctx;
  1238. if (index) this.index = index;
  1239. });
  1240. defineMethod(SmalltalkMethodContext, "method", function () {
  1241. var method;
  1242. var lookup = this.lookupClass || this.receiver.a$cls;
  1243. while (!method && lookup) {
  1244. method = lookup.methods[st.js2st(this.selector)];
  1245. lookup = lookup.superclass;
  1246. }
  1247. return method;
  1248. });
  1249. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1250. /* This is the current call context object.
  1251. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1252. In JS code, use api.getThisContext() (see below).
  1253. */
  1254. var thisContext = null;
  1255. /*
  1256. Runs worker function so that error handler is not set up
  1257. if there isn't one. This is accomplished by unconditional
  1258. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1259. which then stops error handler setup (see st.withContext above).
  1260. The effect is, $core.seamless(fn)'s exceptions are not
  1261. handed into ST error handler and caller should process them.
  1262. */
  1263. st.seamless = function (worker) {
  1264. var oldContext = thisContext;
  1265. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1266. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1267. });
  1268. var result = worker(thisContext);
  1269. thisContext = oldContext;
  1270. return result;
  1271. };
  1272. function resultWithErrorHandling (worker) {
  1273. try {
  1274. return worker(thisContext);
  1275. } catch (error) {
  1276. globals.ErrorHandler._handleError_(error);
  1277. thisContext = null;
  1278. // Rethrow the error in any case.
  1279. throw error;
  1280. }
  1281. }
  1282. /*
  1283. Standard way to run within context.
  1284. Sets up error handler if entering first ST context in a stack.
  1285. */
  1286. st.withContext = function (worker, setup) {
  1287. var oldContext = thisContext;
  1288. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1289. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1290. thisContext = oldContext;
  1291. return result;
  1292. };
  1293. /* Handle thisContext pseudo variable */
  1294. st.getThisContext = function () {
  1295. if (!thisContext) return null;
  1296. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1297. frame.setup(frame);
  1298. }
  1299. return thisContext;
  1300. };
  1301. }
  1302. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1303. function MessageSendBrik (brikz, st) {
  1304. var globals = brikz.smalltalkGlobals.globals;
  1305. var nilAsReceiver = brikz.root.nilAsReceiver;
  1306. /* Send message programmatically. Used to implement #perform: & Co. */
  1307. st.send2 = function (self, selector, args, klass) {
  1308. if (self == null) {
  1309. self = nilAsReceiver;
  1310. }
  1311. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1312. return method != null ?
  1313. method.apply(self, args || []) :
  1314. globals.Message._selector_arguments_notUnderstoodBy_(
  1315. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1316. );
  1317. };
  1318. function wrapJavaScript (o) {
  1319. return globals.JSObjectProxy._on_(o);
  1320. }
  1321. st.wrapJavaScript = wrapJavaScript;
  1322. /* If the object property is a function, then call it, except if it starts with
  1323. an uppercase character (we probably want to answer the function itself in this
  1324. case and send it #new from Amber).
  1325. */
  1326. st.accessJavaScript = function (self, propertyName, args) {
  1327. var propertyValue = self[propertyName];
  1328. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1329. return propertyValue.apply(self, args || []);
  1330. } else if (args.length === 0) {
  1331. return propertyValue;
  1332. } else {
  1333. self[propertyName] = args[0];
  1334. return self;
  1335. }
  1336. };
  1337. }
  1338. function SelectorConversionBrik (brikz, st) {
  1339. var st2jsMemo = Object.create(null);
  1340. /* Convert a Smalltalk selector into a JS selector */
  1341. function st2js (string) {
  1342. return '_' + string
  1343. .replace(/:/g, '_')
  1344. .replace(/[\&]/g, '_and')
  1345. .replace(/[\|]/g, '_or')
  1346. .replace(/[+]/g, '_plus')
  1347. .replace(/-/g, '_minus')
  1348. .replace(/[*]/g, '_star')
  1349. .replace(/[\/]/g, '_slash')
  1350. .replace(/[\\]/g, '_backslash')
  1351. .replace(/[\~]/g, '_tild')
  1352. .replace(/%/g, '_percent')
  1353. .replace(/>/g, '_gt')
  1354. .replace(/</g, '_lt')
  1355. .replace(/=/g, '_eq')
  1356. .replace(/,/g, '_comma')
  1357. .replace(/[@]/g, '_at');
  1358. };
  1359. st.st2js = function (stSelector) {
  1360. return st2jsMemo[stSelector] || st2js(stSelector);
  1361. };
  1362. this.st2js = function (stSelector) {
  1363. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  1364. };
  1365. /* Convert a string to a valid smalltalk selector.
  1366. if you modify the following functions, also change st2js
  1367. accordingly */
  1368. st.js2st = function (selector) {
  1369. if (selector.match(/^__/)) {
  1370. return binaryJsToSt(selector);
  1371. } else {
  1372. return keywordJsToSt(selector);
  1373. }
  1374. };
  1375. function keywordJsToSt (selector) {
  1376. return selector.replace(/^_/, '').replace(/_/g, ':');
  1377. }
  1378. function binaryJsToSt (selector) {
  1379. return selector
  1380. .replace(/^_/, '')
  1381. .replace(/_and/g, '&')
  1382. .replace(/_or/g, '|')
  1383. .replace(/_plus/g, '+')
  1384. .replace(/_minus/g, '-')
  1385. .replace(/_star/g, '*')
  1386. .replace(/_slash/g, '/')
  1387. .replace(/_backslash/g, '\\')
  1388. .replace(/_tild/g, '~')
  1389. .replace(/_percent/g, '%')
  1390. .replace(/_gt/g, '>')
  1391. .replace(/_lt/g, '<')
  1392. .replace(/_eq/g, '=')
  1393. .replace(/_comma/g, ',')
  1394. .replace(/_at/g, '@');
  1395. }
  1396. st.st2prop = function (stSelector) {
  1397. var colonPosition = stSelector.indexOf(':');
  1398. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1399. };
  1400. }
  1401. StartImageBrik.deps = ["smalltalkGlobals"];
  1402. function StartImageBrik (brikz, st) {
  1403. var globals = brikz.smalltalkGlobals.globals;
  1404. this.run = function () {
  1405. return globals.AmberBootstrapInitialization._run();
  1406. };
  1407. }
  1408. /* Making smalltalk that can run */
  1409. function configureWithRuntime (brikz) {
  1410. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1411. brikz.runtimeClasses = RuntimeClassesBrik;
  1412. brikz.frameBinding = FrameBindingBrik;
  1413. brikz.runtimeMethods = RuntimeMethodsBrik;
  1414. brikz.messageSend = MessageSendBrik;
  1415. brikz.runtime = RuntimeBrik;
  1416. brikz.primitives = PrimitivesBrik;
  1417. brikz.selectorConversion = SelectorConversionBrik;
  1418. brikz.startImage = StartImageBrik;
  1419. brikz.rebuild();
  1420. }
  1421. return configureWithRuntime;
  1422. });
  1423. // Depend on each module that is loaded lazily.
  1424. // Add to packager tasks as dependency,
  1425. // so the lazy-loaded modules are included.
  1426. define('amber/lazypack',['./kernel-runtime'], {});
  1427. //jshint eqnull:true
  1428. define('amber/kernel-checks',[],function () {
  1429. "use strict";
  1430. function assert (fn) {
  1431. try {
  1432. if (fn()) return;
  1433. } catch (ex) {
  1434. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1435. }
  1436. throw new Error("Assertion failed:\n" + fn);
  1437. }
  1438. assert(function () {
  1439. return !("hasOwnProperty" in Object.create(null));
  1440. });
  1441. assert(function () {
  1442. return Object.getPrototypeOf(Object.create(null)) === null;
  1443. });
  1444. assert(function () {
  1445. var p = {};
  1446. return Object.getPrototypeOf(Object.create(p)) === p;
  1447. });
  1448. // assert(function () {
  1449. // return new Function("return this")().Object === Object;
  1450. // });
  1451. // assert(function () {
  1452. // return Object.create(new Function("return this")()).Object === Object;
  1453. // });
  1454. assert(function () {
  1455. return typeof global !== "undefined";
  1456. });
  1457. assert(function () {
  1458. return global.Object === Object;
  1459. });
  1460. assert(function () {
  1461. return Object.create(global).Object === Object;
  1462. });
  1463. assert(function () {
  1464. return (function () {
  1465. return this;
  1466. }).apply(void 0) === void 0;
  1467. });
  1468. assert(function () {
  1469. return (function () {
  1470. return this;
  1471. }).apply(null) === null;
  1472. });
  1473. assert(function () {
  1474. return (function () {
  1475. return this;
  1476. }).apply(3) === 3;
  1477. });
  1478. assert(function () {
  1479. return (function () {
  1480. return this;
  1481. }).apply("foo") === "foo";
  1482. });
  1483. assert(function () {
  1484. return (function () {
  1485. return this;
  1486. }).apply(true) === true;
  1487. });
  1488. assert(function () {
  1489. var o = Object.freeze({});
  1490. try {
  1491. o.foo = "bar";
  1492. } catch (ex) {
  1493. }
  1494. return o.foo == null;
  1495. });
  1496. assert(function () {
  1497. return typeof Promise === "function";
  1498. });
  1499. assert(function () {
  1500. return typeof Promise.resolve === "function";
  1501. });
  1502. assert(function () {
  1503. return typeof Promise.reject === "function";
  1504. });
  1505. assert(function () {
  1506. return typeof new Promise(function () {
  1507. }).then === "function";
  1508. });
  1509. });
  1510. define('amber/brikz',[], function () {
  1511. return function Brikz(api, apiKey, initKey) {
  1512. "use strict";
  1513. //jshint eqnull:true
  1514. var brikz = this,
  1515. backup = {};
  1516. apiKey = apiKey || 'exports';
  1517. initKey = initKey || '__init__';
  1518. function mixin(src, target, what) {
  1519. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1520. if (src == null) {
  1521. target[keys[i]] = undefined;
  1522. } else {
  1523. var value = src[keys[i]];
  1524. if (typeof value !== "undefined") {
  1525. target[keys[i]] = value;
  1526. }
  1527. }
  1528. }
  1529. return target;
  1530. }
  1531. Object.defineProperties(this, {
  1532. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1533. });
  1534. var exclude = mixin(this, {});
  1535. this.rebuild = function () {
  1536. Object.keys(backup).forEach(function (key) {
  1537. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1538. });
  1539. var oapi = mixin(api, {}),
  1540. order = [],
  1541. chk = {};
  1542. function ensure(key) {
  1543. if (key in exclude) {
  1544. return null;
  1545. }
  1546. var b = brikz[key],
  1547. bak = backup[key];
  1548. mixin(null, api, api);
  1549. while (typeof b === "function") {
  1550. (b.deps || []).forEach(ensure);
  1551. b = new b(brikz, api, bak);
  1552. }
  1553. brikz[key] = b;
  1554. if (b && !chk[key]) {
  1555. chk[key] = true;
  1556. order.push(b);
  1557. }
  1558. if (b && !b[apiKey]) {
  1559. b[apiKey] = mixin(api, {});
  1560. }
  1561. }
  1562. Object.keys(brikz).forEach(ensure);
  1563. mixin(oapi, mixin(null, api, api));
  1564. order.forEach(function (brik) {
  1565. mixin(brik[apiKey] || {}, api);
  1566. });
  1567. order.forEach(function (brik) {
  1568. if (brik[initKey]) {
  1569. brik[initKey]();
  1570. if (brik[initKey].once) {
  1571. delete brik[initKey];
  1572. }
  1573. }
  1574. });
  1575. backup = mixin(brikz, {});
  1576. };
  1577. };
  1578. });
  1579. /* ====================================================================
  1580. |
  1581. | Amber Smalltalk
  1582. | http://amber-lang.net
  1583. |
  1584. ======================================================================
  1585. ======================================================================
  1586. |
  1587. | Copyright (c) 2010-2014
  1588. | Nicolas Petton <petton.nicolas@gmail.com>
  1589. |
  1590. | Copyright (c) 2012-2017
  1591. | The Amber team https://lolg.it/org/amber/members
  1592. | Amber contributors (see /CONTRIBUTORS)
  1593. |
  1594. | Amber is released under the MIT license
  1595. |
  1596. | Permission is hereby granted, free of charge, to any person obtaining
  1597. | a copy of this software and associated documentation files (the
  1598. | 'Software'), to deal in the Software without restriction, including
  1599. | without limitation the rights to use, copy, modify, merge, publish,
  1600. | distribute, sublicense, and/or sell copies of the Software, and to
  1601. | permit persons to whom the Software is furnished to do so, subject to
  1602. | the following conditions:
  1603. |
  1604. | The above copyright notice and this permission notice shall be
  1605. | included in all copies or substantial portions of the Software.
  1606. |
  1607. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1608. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1609. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1610. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1611. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1612. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1613. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1614. |
  1615. ==================================================================== */
  1616. //jshint eqnull:true
  1617. define('amber/kernel-fundamentals',[],function () {
  1618. "use strict";
  1619. function inherits (child, parent) {
  1620. child.prototype = Object.create(parent.prototype, {
  1621. constructor: {
  1622. value: child,
  1623. enumerable: false, configurable: true, writable: true
  1624. }
  1625. });
  1626. return child;
  1627. }
  1628. function SmalltalkGlobalsBrik (brikz, st) {
  1629. var globals = Object.create(global);
  1630. globals.SmalltalkSettings = {};
  1631. this.globals = globals;
  1632. }
  1633. function EventBrik (brikz, st) {
  1634. var emit = {};
  1635. this.emit = emit;
  1636. this.declareEvent = function (event) {
  1637. if (!emit[event]) emit[event] = function () {
  1638. };
  1639. }
  1640. }
  1641. function RootBrik (brikz, st) {
  1642. /* Smalltalk foundational objects */
  1643. var coreFns = this.coreFns = {};
  1644. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1645. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1646. Detached roots (eg. wrapped JS classes like Number or Date)
  1647. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1648. function SmalltalkRoot () {
  1649. }
  1650. function SmalltalkProtoObject () {
  1651. }
  1652. function SmalltalkObject () {
  1653. }
  1654. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1655. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1656. this.Root = SmalltalkRoot;
  1657. this.Object = SmalltalkObject;
  1658. }
  1659. function SelectorsBrik (brikz, st) {
  1660. var selectorSet = Object.create(null);
  1661. var selectors = this.selectors = [];
  1662. this.registerSelector = function (stSelector) {
  1663. if (selectorSet[stSelector]) return false;
  1664. selectors.push(stSelector);
  1665. return selectorSet[stSelector] = true;
  1666. };
  1667. st.allSelectors = function () {
  1668. return selectors;
  1669. };
  1670. }
  1671. function PackagesBrik (brikz, st) {
  1672. st.packages = st.packageDescriptors = {};
  1673. /* Add a package load descriptor to the system */
  1674. st.addPackage = function (name, properties) {
  1675. if (!name) return null;
  1676. return st.packageDescriptors[name] = {properties: properties};
  1677. };
  1678. }
  1679. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1680. function BehaviorsBrik (brikz, st) {
  1681. var globals = brikz.smalltalkGlobals.globals;
  1682. var addElement = brikz.arraySet.addElement;
  1683. var removeElement = brikz.arraySet.removeElement;
  1684. /* Smalltalk classes and traits */
  1685. var traitsOrClasses = [];
  1686. this.buildTraitOrClass = function (category, builder) {
  1687. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1688. if (traitOrClass) {
  1689. builder.updateExisting(traitOrClass);
  1690. } else {
  1691. traitOrClass = builder.make();
  1692. traitOrClass.category = category;
  1693. addTraitOrClass(traitOrClass);
  1694. }
  1695. return traitOrClass;
  1696. };
  1697. function addTraitOrClass (traitOrClass) {
  1698. globals[traitOrClass.name] = traitOrClass;
  1699. addElement(traitsOrClasses, traitOrClass);
  1700. traitOrClass.added();
  1701. }
  1702. function removeTraitOrClass (traitOrClass) {
  1703. traitOrClass.removed();
  1704. removeElement(traitsOrClasses, traitOrClass);
  1705. delete globals[traitOrClass.name];
  1706. }
  1707. this.removeTraitOrClass = removeTraitOrClass;
  1708. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1709. }
  1710. MethodsBrik.deps = ["event", "selectors", "root"];
  1711. function MethodsBrik (brikz, st) {
  1712. var registerSelector = brikz.selectors.registerSelector;
  1713. var SmalltalkObject = brikz.root.Object;
  1714. var coreFns = brikz.root.coreFns;
  1715. var emit = brikz.event.emit;
  1716. var declareEvent = brikz.event.declareEvent;
  1717. function SmalltalkMethod () {
  1718. }
  1719. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1720. /* Smalltalk method object. To add a method to a class,
  1721. use api.addMethod() */
  1722. st.method = function (spec) {
  1723. var that = new SmalltalkMethod();
  1724. var selector = spec.selector;
  1725. that.selector = selector;
  1726. that.args = spec.args || [];
  1727. that.protocol = spec.protocol;
  1728. that.source = spec.source;
  1729. that.messageSends = spec.messageSends || [];
  1730. // TODO remove .referencedClasses, have .referencedGlobals
  1731. that.referencedClasses = spec.referencedClasses || [];
  1732. that.fn = spec.fn;
  1733. return that;
  1734. };
  1735. /* Add/remove a method to/from a class */
  1736. st.addMethod = function (method, traitOrBehavior) {
  1737. if (method.owner != null) {
  1738. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1739. }
  1740. method.owner = traitOrBehavior;
  1741. // TODO deprecation helper; remove
  1742. Object.defineProperty(method, "methodClass", {
  1743. get: function () {
  1744. console.warn("Use of .methodClass deprecated, use .owner");
  1745. return method.owner;
  1746. },
  1747. set: function (v) {
  1748. console.warn("Use of .methodClass= deprecated, use .owner=");
  1749. method.owner = v;
  1750. }
  1751. });
  1752. registerNewSelectors(method);
  1753. traitOrBehavior.localMethods[method.selector] = method;
  1754. updateMethod(method.selector, traitOrBehavior);
  1755. };
  1756. declareEvent("selectorsAdded");
  1757. function registerNewSelectors (method) {
  1758. var newSelectors = [];
  1759. function selectorInUse (stSelector) {
  1760. if (registerSelector(stSelector)) {
  1761. newSelectors.push(stSelector);
  1762. }
  1763. }
  1764. selectorInUse(method.selector);
  1765. method.messageSends.forEach(selectorInUse);
  1766. emit.selectorsAdded(newSelectors);
  1767. }
  1768. st.removeMethod = function (method, traitOrBehavior) {
  1769. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1770. delete traitOrBehavior.localMethods[method.selector];
  1771. updateMethod(method.selector, traitOrBehavior);
  1772. };
  1773. this.setupMethods = function (traitOrBehavior) {
  1774. traitOrBehavior.localMethods = Object.create(null);
  1775. traitOrBehavior.methods = Object.create(null);
  1776. };
  1777. declareEvent("methodReplaced");
  1778. function updateMethod (selector, traitOrBehavior) {
  1779. var oldMethod = traitOrBehavior.methods[selector],
  1780. newMethod = traitOrBehavior.localMethods[selector];
  1781. if (oldMethod == null && newMethod == null) {
  1782. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1783. return;
  1784. }
  1785. if (newMethod === oldMethod) return;
  1786. if (newMethod != null) {
  1787. traitOrBehavior.methods[selector] = newMethod;
  1788. traitOrBehavior.methodAdded(newMethod);
  1789. } else {
  1790. delete traitOrBehavior.methods[selector];
  1791. traitOrBehavior.methodRemoved(oldMethod);
  1792. }
  1793. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1794. }
  1795. this.updateMethod = updateMethod;
  1796. }
  1797. function ArraySetBrik (brikz, st) {
  1798. st.addElement = this.addElement = function (array, el) {
  1799. if (typeof el === 'undefined') {
  1800. return;
  1801. }
  1802. if (array.indexOf(el) === -1) {
  1803. array.push(el);
  1804. }
  1805. };
  1806. st.removeElement = this.removeElement = function (array, el) {
  1807. var i = array.indexOf(el);
  1808. if (i !== -1) {
  1809. array.splice(i, 1);
  1810. }
  1811. };
  1812. }
  1813. NilBrik.deps = ["root"];
  1814. function NilBrik (brikz, st) {
  1815. var SmalltalkObject = brikz.root.Object;
  1816. var coreFns = brikz.root.coreFns;
  1817. function SmalltalkNil () {
  1818. }
  1819. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1820. this.nilAsReceiver = new SmalltalkNil();
  1821. this.nilAsValue = this.nilAsReceiver; // TODO null
  1822. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1823. // nil objects from one environment to another, doing
  1824. // `anObject == nil` (in JavaScript) does not always answer
  1825. // true as the referenced nil object might come from the other
  1826. // environment.
  1827. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1828. value: true,
  1829. enumerable: false, configurable: false, writable: false
  1830. });
  1831. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1832. value: true,
  1833. enumerable: false, configurable: false, writable: false
  1834. });
  1835. }
  1836. /* Making smalltalk that has basic building blocks */
  1837. function configureWithFundamentals (brikz) {
  1838. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1839. brikz.root = RootBrik;
  1840. brikz.nil = NilBrik;
  1841. brikz.event = EventBrik;
  1842. brikz.arraySet = ArraySetBrik;
  1843. brikz.selectors = SelectorsBrik;
  1844. brikz.packages = PackagesBrik;
  1845. brikz.behaviors = BehaviorsBrik;
  1846. brikz.methods = MethodsBrik;
  1847. brikz.rebuild();
  1848. }
  1849. return configureWithFundamentals;
  1850. });
  1851. /* ====================================================================
  1852. |
  1853. | Amber Smalltalk
  1854. | http://amber-lang.net
  1855. |
  1856. ======================================================================
  1857. ======================================================================
  1858. |
  1859. | Copyright (c) 2010-2014
  1860. | Nicolas Petton <petton.nicolas@gmail.com>
  1861. |
  1862. | Copyright (c) 2012-2017
  1863. | The Amber team https://lolg.it/org/amber/members
  1864. | Amber contributors (see /CONTRIBUTORS)
  1865. |
  1866. | Amber is released under the MIT license
  1867. |
  1868. | Permission is hereby granted, free of charge, to any person obtaining
  1869. | a copy of this software and associated documentation files (the
  1870. | 'Software'), to deal in the Software without restriction, including
  1871. | without limitation the rights to use, copy, modify, merge, publish,
  1872. | distribute, sublicense, and/or sell copies of the Software, and to
  1873. | permit persons to whom the Software is furnished to do so, subject to
  1874. | the following conditions:
  1875. |
  1876. | The above copyright notice and this permission notice shall be
  1877. | included in all copies or substantial portions of the Software.
  1878. |
  1879. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1880. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1881. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1882. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1883. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1884. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1885. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1886. |
  1887. ==================================================================== */
  1888. //jshint eqnull:true
  1889. define('amber/kernel-language',[],function () {
  1890. "use strict";
  1891. function inherits (child, parent) {
  1892. child.prototype = Object.create(parent.prototype, {
  1893. constructor: {
  1894. value: child,
  1895. enumerable: false, configurable: true, writable: true
  1896. }
  1897. });
  1898. return child;
  1899. }
  1900. function defineMethod (klass, name, method) {
  1901. Object.defineProperty(klass.prototype, name, {
  1902. value: method,
  1903. enumerable: false, configurable: true, writable: true
  1904. });
  1905. }
  1906. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1907. function TraitsBrik (brikz, st) {
  1908. var coreFns = brikz.root.coreFns;
  1909. var SmalltalkObject = brikz.root.Object;
  1910. var setupMethods = brikz.methods.setupMethods;
  1911. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1912. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1913. var emit = brikz.event.emit;
  1914. var declareEvent = brikz.event.declareEvent;
  1915. function SmalltalkTrait () {
  1916. }
  1917. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1918. SmalltalkTrait.prototype.trait = true;
  1919. defineMethod(SmalltalkTrait, "toString", function () {
  1920. return 'Smalltalk Trait ' + this.name;
  1921. });
  1922. declareEvent("traitAdded");
  1923. defineMethod(SmalltalkTrait, "added", function () {
  1924. emit.traitAdded(this);
  1925. });
  1926. declareEvent("traitRemoved");
  1927. defineMethod(SmalltalkTrait, "removed", function () {
  1928. emit.traitRemoved(this);
  1929. });
  1930. declareEvent("traitMethodAdded");
  1931. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1932. var self = this;
  1933. this.traitUsers.forEach(function (each) {
  1934. traitMethodChanged(method.selector, method, self, each);
  1935. });
  1936. emit.traitMethodAdded(method, this);
  1937. });
  1938. declareEvent("traitMethodRemoved");
  1939. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1940. var self = this;
  1941. this.traitUsers.forEach(function (each) {
  1942. traitMethodChanged(method.selector, null, self, each);
  1943. });
  1944. emit.traitMethodRemoved(method, this);
  1945. });
  1946. function traitBuilder (traitName) {
  1947. return {
  1948. name: traitName,
  1949. make: function () {
  1950. var that = new SmalltalkTrait();
  1951. // TODO deprecation helper; remove
  1952. Object.defineProperty(that, "className", {
  1953. get: function () {
  1954. console.warn("Use of .className deprecated, use .name");
  1955. return that.name;
  1956. },
  1957. set: function (v) {
  1958. console.warn("Use of .className= deprecated, use .name=");
  1959. that.name = v;
  1960. }
  1961. });
  1962. that.name = traitName;
  1963. that.traitUsers = [];
  1964. setupMethods(that);
  1965. return that;
  1966. },
  1967. updateExisting: function (trait) {
  1968. }
  1969. };
  1970. }
  1971. st.addTrait = function (className, category) {
  1972. return buildTraitOrClass(category, traitBuilder(className));
  1973. };
  1974. }
  1975. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1976. function MethodCompositionBrik (brikz, st) {
  1977. var updateMethod = brikz.methods.updateMethod;
  1978. var addElement = brikz.arraySet.addElement;
  1979. var removeElement = brikz.arraySet.removeElement;
  1980. function aliased (selector, method) {
  1981. if (method.selector === selector) return method;
  1982. var result = st.method({
  1983. selector: selector,
  1984. args: method.args,
  1985. protocol: method.protocol,
  1986. source: '"Aliased as ' + selector + '"\n' + method.source,
  1987. messageSends: method.messageSends,
  1988. referencesClasses: method.referencedClasses,
  1989. fn: method.fn
  1990. });
  1991. result.owner = method.owner;
  1992. return result;
  1993. }
  1994. function deleteKeysFrom (keys, obj) {
  1995. keys.forEach(function (each) {
  1996. delete obj[each];
  1997. });
  1998. }
  1999. function fillTraitTransformation (traitTransformation, obj) {
  2000. // assert(Object.getOwnProperties(obj).length === 0)
  2001. var traitMethods = traitTransformation.trait.methods;
  2002. Object.keys(traitMethods).forEach(function (selector) {
  2003. obj[selector] = traitMethods[selector];
  2004. });
  2005. var traitAliases = traitTransformation.aliases;
  2006. if (traitAliases) {
  2007. Object.keys(traitAliases).forEach(function (aliasSelector) {
  2008. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  2009. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  2010. // else delete obj[aliasSelector]; // semantically correct; optimized away
  2011. });
  2012. }
  2013. var traitExclusions = traitTransformation.exclusions;
  2014. if (traitExclusions) {
  2015. deleteKeysFrom(traitExclusions, obj);
  2016. }
  2017. return obj;
  2018. }
  2019. function buildCompositionChain (traitComposition) {
  2020. return traitComposition.reduce(function (soFar, each) {
  2021. return fillTraitTransformation(each, Object.create(soFar));
  2022. }, null);
  2023. }
  2024. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  2025. var oldLocalMethods = traitOrBehavior.localMethods,
  2026. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  2027. Object.keys(oldLocalMethods).forEach(function (selector) {
  2028. newLocalMethods[selector] = oldLocalMethods[selector];
  2029. });
  2030. var selector;
  2031. traitOrBehavior.localMethods = newLocalMethods;
  2032. for (selector in newLocalMethods) {
  2033. updateMethod(selector, traitOrBehavior);
  2034. }
  2035. for (selector in oldLocalMethods) {
  2036. updateMethod(selector, traitOrBehavior);
  2037. }
  2038. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2039. removeElement(each.trait.traitUsers, traitOrBehavior);
  2040. });
  2041. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2042. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2043. addElement(each.trait.traitUsers, traitOrBehavior);
  2044. });
  2045. };
  2046. function aliasesOfSelector (selector, traitAliases) {
  2047. if (!traitAliases) return [selector];
  2048. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2049. return traitAliases[aliasSelector] === selector
  2050. });
  2051. if (!traitAliases[selector]) result.push(selector);
  2052. return result;
  2053. }
  2054. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2055. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2056. changes.forEach(function (aliasSelector) {
  2057. obj[aliasSelector] = aliased(aliasSelector, method);
  2058. });
  2059. var traitExclusions = traitTransformation.exclusions;
  2060. if (traitExclusions) {
  2061. deleteKeysFrom(traitExclusions, obj);
  2062. }
  2063. return changes;
  2064. }
  2065. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2066. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2067. deleteKeysFrom(changes, obj);
  2068. return changes;
  2069. }
  2070. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2071. var traitComposition = traitOrBehavior.traitComposition,
  2072. chain = traitOrBehavior.localMethods,
  2073. changes = [];
  2074. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2075. chain = Object.getPrototypeOf(chain);
  2076. var traitTransformation = traitComposition[i];
  2077. if (traitTransformation.trait !== trait) continue;
  2078. changes.push.apply(changes, method ?
  2079. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2080. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2081. }
  2082. // assert(chain === null);
  2083. changes.forEach(function (each) {
  2084. updateMethod(each, traitOrBehavior);
  2085. });
  2086. }
  2087. this.traitMethodChanged = traitMethodChanged;
  2088. }
  2089. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2090. function ClassesBrik (brikz, st) {
  2091. var SmalltalkRoot = brikz.root.Root;
  2092. var coreFns = brikz.root.coreFns;
  2093. var globals = brikz.smalltalkGlobals.globals;
  2094. var SmalltalkObject = brikz.root.Object;
  2095. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2096. var setupMethods = brikz.methods.setupMethods;
  2097. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2098. var addElement = brikz.arraySet.addElement;
  2099. var removeElement = brikz.arraySet.removeElement;
  2100. var emit = brikz.event.emit;
  2101. var declareEvent = brikz.event.declareEvent;
  2102. function SmalltalkBehavior () {
  2103. }
  2104. function SmalltalkClass () {
  2105. }
  2106. function SmalltalkMetaclass () {
  2107. }
  2108. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2109. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2110. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2111. // Fake root class of the system.
  2112. // Effective superclass of all classes created with `nil subclass: ...`.
  2113. var nilAsClass = this.nilAsClass = {
  2114. fn: SmalltalkRoot,
  2115. a$cls: {fn: SmalltalkClass},
  2116. klass: {fn: SmalltalkClass}
  2117. };
  2118. SmalltalkMetaclass.prototype.meta = true;
  2119. defineMethod(SmalltalkClass, "toString", function () {
  2120. return 'Smalltalk ' + this.name;
  2121. });
  2122. defineMethod(SmalltalkMetaclass, "toString", function () {
  2123. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2124. });
  2125. declareEvent("classAdded");
  2126. defineMethod(SmalltalkClass, "added", function () {
  2127. addSubclass(this);
  2128. emit.classAdded(this);
  2129. });
  2130. declareEvent("classRemoved");
  2131. defineMethod(SmalltalkClass, "removed", function () {
  2132. emit.classRemoved(this);
  2133. removeSubclass(this);
  2134. });
  2135. declareEvent("behaviorMethodAdded");
  2136. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2137. emit.behaviorMethodAdded(method, this);
  2138. });
  2139. declareEvent("behaviorMethodRemove");
  2140. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2141. emit.behaviorMethodRemoved(method, this);
  2142. });
  2143. this.bootstrapHierarchy = function () {
  2144. var nilSubclasses = [globals.ProtoObject];
  2145. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2146. nilSubclasses.forEach(function (each) {
  2147. each.a$cls.superclass = globals.Class;
  2148. addSubclass(each.a$cls);
  2149. });
  2150. };
  2151. /* Smalltalk class creation. A class is an instance of an automatically
  2152. created metaclass object. Newly created classes (not their metaclass)
  2153. should be added to the system, see smalltalk.addClass().
  2154. Superclass linking is *not* handled here, see api.initialize() */
  2155. function classBuilder (className, superclass, iVarNames, fn) {
  2156. var logicalSuperclass = superclass;
  2157. if (superclass == null || superclass.a$nil) {
  2158. superclass = nilAsClass;
  2159. logicalSuperclass = null;
  2160. }
  2161. function klass () {
  2162. var that = metaclass().instanceClass;
  2163. that.superclass = logicalSuperclass;
  2164. that.fn = fn || inherits(function () {
  2165. }, superclass.fn);
  2166. that.iVarNames = iVarNames || [];
  2167. // TODO deprecation helper; remove
  2168. Object.defineProperty(that, "className", {
  2169. get: function () {
  2170. console.warn("Use of .className deprecated, use .name");
  2171. return that.name;
  2172. },
  2173. set: function (v) {
  2174. console.warn("Use of .className= deprecated, use .name=");
  2175. that.name = v;
  2176. }
  2177. });
  2178. that.name = className;
  2179. that.subclasses = [];
  2180. setupMethods(that);
  2181. return that;
  2182. }
  2183. function metaclass () {
  2184. var that = new SmalltalkMetaclass();
  2185. that.superclass = superclass.a$cls;
  2186. that.fn = inherits(function () {
  2187. }, that.superclass.fn);
  2188. that.iVarNames = [];
  2189. that.instanceClass = new that.fn();
  2190. wireKlass(that);
  2191. setupMethods(that);
  2192. return that;
  2193. }
  2194. return {
  2195. name: className,
  2196. make: klass,
  2197. updateExisting: function (klass) {
  2198. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2199. if (iVarNames) klass.iVarNames = iVarNames;
  2200. } else throw new Error("Incompatible change of class: " + klass.name);
  2201. }
  2202. };
  2203. }
  2204. function wireKlass (klass) {
  2205. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2206. value: klass,
  2207. enumerable: false, configurable: true, writable: true
  2208. });
  2209. Object.defineProperty(klass.fn.prototype, "klass", {
  2210. value: klass,
  2211. enumerable: false, configurable: true, writable: true
  2212. });
  2213. }
  2214. this.wireKlass = wireKlass;
  2215. /* Add a class to the system, creating a new one if needed.
  2216. A Package is lazily created if one with given name does not exist. */
  2217. st.addClass = function (className, superclass, iVarNames, category) {
  2218. // While subclassing nil is allowed, it might be an error, so
  2219. // warn about it.
  2220. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2221. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2222. }
  2223. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2224. };
  2225. st.removeClass = removeTraitOrClass;
  2226. function addSubclass (klass) {
  2227. if (klass.superclass) {
  2228. addElement(klass.superclass.subclasses, klass);
  2229. }
  2230. }
  2231. function removeSubclass (klass) {
  2232. if (klass.superclass) {
  2233. removeElement(klass.superclass.subclasses, klass);
  2234. }
  2235. }
  2236. function metaSubclasses (metaclass) {
  2237. return metaclass.instanceClass.subclasses
  2238. .filter(function (each) {
  2239. return !each.meta;
  2240. })
  2241. .map(function (each) {
  2242. return each.a$cls;
  2243. });
  2244. }
  2245. st.metaSubclasses = metaSubclasses;
  2246. st.traverseClassTree = function (klass, fn) {
  2247. var queue = [klass], sentinel = {};
  2248. for (var i = 0; i < queue.length; ++i) {
  2249. var item = queue[i];
  2250. if (fn(item, sentinel) === sentinel) continue;
  2251. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2252. queue.push.apply(queue, subclasses);
  2253. }
  2254. };
  2255. }
  2256. /* Making smalltalk that can load */
  2257. function configureWithHierarchy (brikz) {
  2258. brikz.traits = TraitsBrik;
  2259. brikz.composition = MethodCompositionBrik;
  2260. brikz.classes = ClassesBrik;
  2261. brikz.rebuild();
  2262. }
  2263. return configureWithHierarchy;
  2264. });
  2265. /* ====================================================================
  2266. |
  2267. | Amber Smalltalk
  2268. | http://amber-lang.net
  2269. |
  2270. ======================================================================
  2271. ======================================================================
  2272. |
  2273. | Copyright (c) 2010-2014
  2274. | Nicolas Petton <petton.nicolas@gmail.com>
  2275. |
  2276. | Copyright (c) 2012-2017
  2277. | The Amber team https://lolg.it/org/amber/members
  2278. | Amber contributors (see /CONTRIBUTORS)
  2279. |
  2280. | Amber is released under the MIT license
  2281. |
  2282. | Permission is hereby granted, free of charge, to any person obtaining
  2283. | a copy of this software and associated documentation files (the
  2284. | 'Software'), to deal in the Software without restriction, including
  2285. | without limitation the rights to use, copy, modify, merge, publish,
  2286. | distribute, sublicense, and/or sell copies of the Software, and to
  2287. | permit persons to whom the Software is furnished to do so, subject to
  2288. | the following conditions:
  2289. |
  2290. | The above copyright notice and this permission notice shall be
  2291. | included in all copies or substantial portions of the Software.
  2292. |
  2293. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2294. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2295. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2296. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2297. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2298. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2299. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2300. |
  2301. ==================================================================== */
  2302. //jshint eqnull:true
  2303. define('amber/boot',[
  2304. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2305. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2306. "use strict";
  2307. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2308. require(['./kernel-runtime'], resolve, reject);
  2309. });
  2310. function SmalltalkInitBrik (brikz, st) {
  2311. var initialized = false;
  2312. /* Smalltalk initialization. Called on page load */
  2313. st.initialize = function () {
  2314. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2315. if (initialized) return;
  2316. brikz.classes.bootstrapHierarchy();
  2317. configureWithRuntime(brikz);
  2318. // TODO deprecation helper; remove
  2319. Object.defineProperty(st, "packages", {
  2320. get: function () {
  2321. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2322. return st.packageDescriptors;
  2323. },
  2324. set: function (v) {
  2325. console.trace();
  2326. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2327. }
  2328. });
  2329. return Promise.resolve(brikz.startImage.run())
  2330. .then(function () {
  2331. initialized = true;
  2332. });
  2333. });
  2334. };
  2335. }
  2336. /* Adds AMD and requirejs related methods to the api */
  2337. function AMDBrik (brikz, st) {
  2338. st.amdRequire = require;
  2339. st.defaultTransportType = st.defaultTransportType || "amd";
  2340. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2341. }
  2342. /* Defines asReceiver to be present at load time */
  2343. /* (logically it belongs more to PrimitiveBrik) */
  2344. AsReceiverBrik.deps = ["nil"];
  2345. function AsReceiverBrik (brikz, st) {
  2346. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2347. /**
  2348. * This function is used all over the compiled amber code.
  2349. * It takes any value (JavaScript or Smalltalk)
  2350. * and returns a proper Amber Smalltalk receiver.
  2351. *
  2352. * null or undefined -> nilAsReceiver,
  2353. * object having Smalltalk signature -> unchanged,
  2354. * otherwise wrapped foreign (JS) object
  2355. */
  2356. this.asReceiver = function (o) {
  2357. if (o == null) return nilAsReceiver;
  2358. else if (o.a$cls != null) return o;
  2359. else return st.wrapJavaScript(o);
  2360. };
  2361. }
  2362. var api = {};
  2363. var brikz = new Brikz(api);
  2364. configureWithFundamentals(brikz);
  2365. configureWithHierarchy(brikz);
  2366. brikz.asReceiver = AsReceiverBrik;
  2367. brikz.stInit = SmalltalkInitBrik;
  2368. brikz.amd = AMDBrik;
  2369. brikz.rebuild();
  2370. // TODO deprecated, remove
  2371. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2372. enumerable: true,
  2373. configurable: true,
  2374. get: function () {
  2375. return this.String;
  2376. }
  2377. });
  2378. return {
  2379. api: api,
  2380. nilAsReceiver: brikz.nil.nilAsReceiver,
  2381. nilAsValue: brikz.nil.nilAsValue,
  2382. nilAsClass: brikz.classes.nilAsClass,
  2383. globals: brikz.smalltalkGlobals.globals,
  2384. asReceiver: brikz.asReceiver.asReceiver
  2385. };
  2386. });
  2387. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2388. var globals = boot.globals,
  2389. exports = {},
  2390. api = boot.api,
  2391. nil = boot.nilAsReceiver;
  2392. // API
  2393. exports.popupHelios = function () {
  2394. require(['helios/index'], function (helios) {
  2395. helios.popup();
  2396. }, function (err) {
  2397. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2398. });
  2399. };
  2400. Object.defineProperty(exports, "api", {
  2401. value: api,
  2402. enumerable: true, configurable: true, writable: false
  2403. });
  2404. Object.defineProperty(exports, "globals", {
  2405. value: globals,
  2406. enumerable: true, configurable: true, writable: false
  2407. });
  2408. Object.defineProperty(exports, "nil", {
  2409. value: nil,
  2410. enumerable: true, configurable: true, writable: false
  2411. });
  2412. function mixinToSettings (source) {
  2413. var settings = globals.SmalltalkSettings;
  2414. Object.keys(source).forEach(function (key) {
  2415. settings[key] = source[key];
  2416. });
  2417. }
  2418. function settingsInLocalStorage () {
  2419. //jshint evil:true
  2420. var storage = 'localStorage' in global && global.localStorage;
  2421. if (storage) {
  2422. var fromStorage;
  2423. try {
  2424. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2425. } catch (ex) {
  2426. // pass
  2427. }
  2428. mixinToSettings(fromStorage || {});
  2429. if (typeof window !== "undefined") {
  2430. window.addEventListener('beforeunload', function () {
  2431. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2432. });
  2433. }
  2434. }
  2435. }
  2436. exports.initialize = function (options) {
  2437. return new Promise(function (resolve) {
  2438. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2439. settingsInLocalStorage();
  2440. mixinToSettings(options || {});
  2441. resolve(api.initialize());
  2442. });
  2443. };
  2444. exports.loadPackages = function (modules) {
  2445. return new Promise(function (resolve, reject) {
  2446. require(modules, resolve, reject);
  2447. }).then(function () {
  2448. return globals.Smalltalk._postLoad();
  2449. });
  2450. };
  2451. // Exports
  2452. return exports;
  2453. });
  2454. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2455. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2456. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2457. var $pkg = $core.addPackage("Kernel-Helpers");
  2458. $pkg.innerEval = function (expr) { return eval(expr); };
  2459. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2460. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2461. $core.addMethod(
  2462. $core.method({
  2463. selector: "subclass:",
  2464. protocol: "class creation",
  2465. fn: function (aString){
  2466. var self=this,$self=this;
  2467. return $core.withContext(function($ctx1) {
  2468. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2469. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2470. },
  2471. args: ["aString"],
  2472. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2473. referencedClasses: [],
  2474. messageSends: ["subclass:instanceVariableNames:package:"]
  2475. }),
  2476. $globals.TSubclassable);
  2477. $core.addMethod(
  2478. $core.method({
  2479. selector: "subclass:instanceVariableNames:",
  2480. protocol: "class creation",
  2481. fn: function (aString,anotherString){
  2482. var self=this,$self=this;
  2483. return $core.withContext(function($ctx1) {
  2484. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2485. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2486. },
  2487. args: ["aString", "anotherString"],
  2488. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2489. referencedClasses: [],
  2490. messageSends: ["subclass:instanceVariableNames:package:"]
  2491. }),
  2492. $globals.TSubclassable);
  2493. $core.addMethod(
  2494. $core.method({
  2495. selector: "subclass:instanceVariableNames:category:",
  2496. protocol: "class creation",
  2497. fn: function (aString,aString2,aString3){
  2498. var self=this,$self=this;
  2499. return $core.withContext(function($ctx1) {
  2500. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2501. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2502. },
  2503. args: ["aString", "aString2", "aString3"],
  2504. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2505. referencedClasses: [],
  2506. messageSends: ["subclass:instanceVariableNames:package:"]
  2507. }),
  2508. $globals.TSubclassable);
  2509. $core.addMethod(
  2510. $core.method({
  2511. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2512. protocol: "class creation",
  2513. fn: function (aString,aString2,classVars,pools,aString3){
  2514. var self=this,$self=this;
  2515. return $core.withContext(function($ctx1) {
  2516. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2517. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2518. },
  2519. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2520. 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",
  2521. referencedClasses: [],
  2522. messageSends: ["subclass:instanceVariableNames:package:"]
  2523. }),
  2524. $globals.TSubclassable);
  2525. $core.addMethod(
  2526. $core.method({
  2527. selector: "subclass:instanceVariableNames:package:",
  2528. protocol: "class creation",
  2529. fn: function (aString,aString2,aString3){
  2530. var self=this,$self=this;
  2531. return $core.withContext(function($ctx1) {
  2532. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2533. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2534. },
  2535. args: ["aString", "aString2", "aString3"],
  2536. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2537. referencedClasses: ["ClassBuilder"],
  2538. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2539. }),
  2540. $globals.TSubclassable);
  2541. $core.addMethod(
  2542. $core.method({
  2543. selector: "subclass:uses:",
  2544. protocol: "class creation",
  2545. fn: function (aString,aTraitCompositionDescription){
  2546. var self=this,$self=this;
  2547. return $core.withContext(function($ctx1) {
  2548. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2549. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2550. },
  2551. args: ["aString", "aTraitCompositionDescription"],
  2552. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2553. referencedClasses: [],
  2554. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2555. }),
  2556. $globals.TSubclassable);
  2557. $core.addMethod(
  2558. $core.method({
  2559. selector: "subclass:uses:instanceVariableNames:",
  2560. protocol: "class creation",
  2561. fn: function (aString,aTraitCompositionDescription,anotherString){
  2562. var self=this,$self=this;
  2563. return $core.withContext(function($ctx1) {
  2564. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2565. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2566. },
  2567. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2568. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  2569. referencedClasses: [],
  2570. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2571. }),
  2572. $globals.TSubclassable);
  2573. $core.addMethod(
  2574. $core.method({
  2575. selector: "subclass:uses:instanceVariableNames:category:",
  2576. protocol: "class creation",
  2577. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2578. var self=this,$self=this;
  2579. return $core.withContext(function($ctx1) {
  2580. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2581. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2582. },
  2583. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2584. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2585. referencedClasses: [],
  2586. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2587. }),
  2588. $globals.TSubclassable);
  2589. $core.addMethod(
  2590. $core.method({
  2591. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2592. protocol: "class creation",
  2593. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2594. var self=this,$self=this;
  2595. return $core.withContext(function($ctx1) {
  2596. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2597. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2598. },
  2599. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2600. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2601. referencedClasses: [],
  2602. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2603. }),
  2604. $globals.TSubclassable);
  2605. $core.addMethod(
  2606. $core.method({
  2607. selector: "subclass:uses:instanceVariableNames:package:",
  2608. protocol: "class creation",
  2609. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2610. var self=this,$self=this;
  2611. var cls;
  2612. return $core.withContext(function($ctx1) {
  2613. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2614. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2615. return cls;
  2616. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2617. },
  2618. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2619. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2620. referencedClasses: [],
  2621. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2622. }),
  2623. $globals.TSubclassable);
  2624. });
  2625. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2626. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2627. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2628. var $pkg = $core.addPackage("Kernel-Objects");
  2629. $pkg.innerEval = function (expr) { return eval(expr); };
  2630. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2631. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2632. $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.";
  2633. $core.addMethod(
  2634. $core.method({
  2635. selector: "=",
  2636. protocol: "comparing",
  2637. fn: function (anObject){
  2638. var self=this,$self=this;
  2639. return $core.withContext(function($ctx1) {
  2640. return $self.__eq_eq(anObject);
  2641. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2642. },
  2643. args: ["anObject"],
  2644. source: "= anObject\x0a\x09^ self == anObject",
  2645. referencedClasses: [],
  2646. messageSends: ["=="]
  2647. }),
  2648. $globals.ProtoObject);
  2649. $core.addMethod(
  2650. $core.method({
  2651. selector: "==",
  2652. protocol: "comparing",
  2653. fn: function (anObject){
  2654. var self=this,$self=this;
  2655. return $core.withContext(function($ctx1) {
  2656. return self === anObject;
  2657. return self;
  2658. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2659. },
  2660. args: ["anObject"],
  2661. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2662. referencedClasses: [],
  2663. messageSends: []
  2664. }),
  2665. $globals.ProtoObject);
  2666. $core.addMethod(
  2667. $core.method({
  2668. selector: "asString",
  2669. protocol: "converting",
  2670. fn: function (){
  2671. var self=this,$self=this;
  2672. return $core.withContext(function($ctx1) {
  2673. return $self._printString();
  2674. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2675. },
  2676. args: [],
  2677. source: "asString\x0a\x09^ self printString",
  2678. referencedClasses: [],
  2679. messageSends: ["printString"]
  2680. }),
  2681. $globals.ProtoObject);
  2682. $core.addMethod(
  2683. $core.method({
  2684. selector: "class",
  2685. protocol: "accessing",
  2686. fn: function (){
  2687. var self=this,$self=this;
  2688. return $core.withContext(function($ctx1) {
  2689. return $self.a$cls;
  2690. return self;
  2691. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2692. },
  2693. args: [],
  2694. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2695. referencedClasses: [],
  2696. messageSends: []
  2697. }),
  2698. $globals.ProtoObject);
  2699. $core.addMethod(
  2700. $core.method({
  2701. selector: "doesNotUnderstand:",
  2702. protocol: "error handling",
  2703. fn: function (aMessage){
  2704. var self=this,$self=this;
  2705. return $core.withContext(function($ctx1) {
  2706. var $1;
  2707. $1=$recv($globals.MessageNotUnderstood)._new();
  2708. $recv($1)._receiver_(self);
  2709. $recv($1)._message_(aMessage);
  2710. $recv($1)._signal();
  2711. return self;
  2712. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2713. },
  2714. args: ["aMessage"],
  2715. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2716. referencedClasses: ["MessageNotUnderstood"],
  2717. messageSends: ["receiver:", "new", "message:", "signal"]
  2718. }),
  2719. $globals.ProtoObject);
  2720. $core.addMethod(
  2721. $core.method({
  2722. selector: "evaluate:on:",
  2723. protocol: "evaluating",
  2724. fn: function (aString,anEvaluator){
  2725. var self=this,$self=this;
  2726. return $core.withContext(function($ctx1) {
  2727. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2728. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2729. },
  2730. args: ["aString", "anEvaluator"],
  2731. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2732. referencedClasses: [],
  2733. messageSends: ["evaluate:receiver:"]
  2734. }),
  2735. $globals.ProtoObject);
  2736. $core.addMethod(
  2737. $core.method({
  2738. selector: "identityHash",
  2739. protocol: "accessing",
  2740. fn: function (){
  2741. var self=this,$self=this;
  2742. return $core.withContext(function($ctx1) {
  2743. self._deprecatedAPI();
  2744. var hash=self.identityHash;
  2745. if (hash) return hash;
  2746. hash=$core.nextId();
  2747. Object.defineProperty(self, 'identityHash', {value:hash});
  2748. return hash;
  2749. ;
  2750. return self;
  2751. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2752. },
  2753. args: [],
  2754. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2755. referencedClasses: [],
  2756. messageSends: []
  2757. }),
  2758. $globals.ProtoObject);
  2759. $core.addMethod(
  2760. $core.method({
  2761. selector: "ifNil:",
  2762. protocol: "testing",
  2763. fn: function (aBlock){
  2764. var self=this,$self=this;
  2765. return self;
  2766. },
  2767. args: ["aBlock"],
  2768. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2769. referencedClasses: [],
  2770. messageSends: []
  2771. }),
  2772. $globals.ProtoObject);
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "ifNil:ifNotNil:",
  2776. protocol: "testing",
  2777. fn: function (aBlock,anotherBlock){
  2778. var self=this,$self=this;
  2779. return $core.withContext(function($ctx1) {
  2780. return $recv(anotherBlock)._value_(self);
  2781. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2782. },
  2783. args: ["aBlock", "anotherBlock"],
  2784. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2785. referencedClasses: [],
  2786. messageSends: ["value:"]
  2787. }),
  2788. $globals.ProtoObject);
  2789. $core.addMethod(
  2790. $core.method({
  2791. selector: "ifNotNil:",
  2792. protocol: "testing",
  2793. fn: function (aBlock){
  2794. var self=this,$self=this;
  2795. return $core.withContext(function($ctx1) {
  2796. return $recv(aBlock)._value_(self);
  2797. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2798. },
  2799. args: ["aBlock"],
  2800. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2801. referencedClasses: [],
  2802. messageSends: ["value:"]
  2803. }),
  2804. $globals.ProtoObject);
  2805. $core.addMethod(
  2806. $core.method({
  2807. selector: "ifNotNil:ifNil:",
  2808. protocol: "testing",
  2809. fn: function (aBlock,anotherBlock){
  2810. var self=this,$self=this;
  2811. return $core.withContext(function($ctx1) {
  2812. return $recv(aBlock)._value_(self);
  2813. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2814. },
  2815. args: ["aBlock", "anotherBlock"],
  2816. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2817. referencedClasses: [],
  2818. messageSends: ["value:"]
  2819. }),
  2820. $globals.ProtoObject);
  2821. $core.addMethod(
  2822. $core.method({
  2823. selector: "initialize",
  2824. protocol: "initialization",
  2825. fn: function (){
  2826. var self=this,$self=this;
  2827. return self;
  2828. },
  2829. args: [],
  2830. source: "initialize",
  2831. referencedClasses: [],
  2832. messageSends: []
  2833. }),
  2834. $globals.ProtoObject);
  2835. $core.addMethod(
  2836. $core.method({
  2837. selector: "inspect",
  2838. protocol: "inspecting",
  2839. fn: function (){
  2840. var self=this,$self=this;
  2841. return $core.withContext(function($ctx1) {
  2842. $recv($globals.Inspector)._inspect_(self);
  2843. return self;
  2844. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2845. },
  2846. args: [],
  2847. source: "inspect\x0a\x09Inspector inspect: self",
  2848. referencedClasses: ["Inspector"],
  2849. messageSends: ["inspect:"]
  2850. }),
  2851. $globals.ProtoObject);
  2852. $core.addMethod(
  2853. $core.method({
  2854. selector: "inspectOn:",
  2855. protocol: "inspecting",
  2856. fn: function (anInspector){
  2857. var self=this,$self=this;
  2858. return self;
  2859. },
  2860. args: ["anInspector"],
  2861. source: "inspectOn: anInspector",
  2862. referencedClasses: [],
  2863. messageSends: []
  2864. }),
  2865. $globals.ProtoObject);
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "instVarAt:",
  2869. protocol: "accessing",
  2870. fn: function (aString){
  2871. var self=this,$self=this;
  2872. return $core.withContext(function($ctx1) {
  2873. return $self['@'+aString];
  2874. return self;
  2875. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2876. },
  2877. args: ["aString"],
  2878. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2879. referencedClasses: [],
  2880. messageSends: []
  2881. }),
  2882. $globals.ProtoObject);
  2883. $core.addMethod(
  2884. $core.method({
  2885. selector: "instVarAt:put:",
  2886. protocol: "accessing",
  2887. fn: function (aString,anObject){
  2888. var self=this,$self=this;
  2889. return $core.withContext(function($ctx1) {
  2890. $self['@' + aString] = anObject;
  2891. return self;
  2892. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2893. },
  2894. args: ["aString", "anObject"],
  2895. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2896. referencedClasses: [],
  2897. messageSends: []
  2898. }),
  2899. $globals.ProtoObject);
  2900. $core.addMethod(
  2901. $core.method({
  2902. selector: "isKindOf:",
  2903. protocol: "testing",
  2904. fn: function (aClass){
  2905. var self=this,$self=this;
  2906. return $core.withContext(function($ctx1) {
  2907. var $1;
  2908. $1=$self._isMemberOf_(aClass);
  2909. if($core.assert($1)){
  2910. return true;
  2911. } else {
  2912. return $recv($self._class())._inheritsFrom_(aClass);
  2913. }
  2914. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2915. },
  2916. args: ["aClass"],
  2917. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2918. referencedClasses: [],
  2919. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2920. }),
  2921. $globals.ProtoObject);
  2922. $core.addMethod(
  2923. $core.method({
  2924. selector: "isNil",
  2925. protocol: "testing",
  2926. fn: function (){
  2927. var self=this,$self=this;
  2928. return false;
  2929. },
  2930. args: [],
  2931. source: "isNil\x0a\x09^ false",
  2932. referencedClasses: [],
  2933. messageSends: []
  2934. }),
  2935. $globals.ProtoObject);
  2936. $core.addMethod(
  2937. $core.method({
  2938. selector: "notNil",
  2939. protocol: "testing",
  2940. fn: function (){
  2941. var self=this,$self=this;
  2942. return $core.withContext(function($ctx1) {
  2943. return $recv($self._isNil())._not();
  2944. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2945. },
  2946. args: [],
  2947. source: "notNil\x0a\x09^ self isNil not",
  2948. referencedClasses: [],
  2949. messageSends: ["not", "isNil"]
  2950. }),
  2951. $globals.ProtoObject);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "perform:",
  2955. protocol: "message handling",
  2956. fn: function (aString){
  2957. var self=this,$self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. return $self._perform_withArguments_(aString,[]);
  2960. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2961. },
  2962. args: ["aString"],
  2963. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2964. referencedClasses: [],
  2965. messageSends: ["perform:withArguments:"]
  2966. }),
  2967. $globals.ProtoObject);
  2968. $core.addMethod(
  2969. $core.method({
  2970. selector: "perform:withArguments:",
  2971. protocol: "message handling",
  2972. fn: function (aString,aCollection){
  2973. var self=this,$self=this;
  2974. return $core.withContext(function($ctx1) {
  2975. return $core.send2(self, aString, aCollection);
  2976. return self;
  2977. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2978. },
  2979. args: ["aString", "aCollection"],
  2980. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2981. referencedClasses: [],
  2982. messageSends: []
  2983. }),
  2984. $globals.ProtoObject);
  2985. $core.addMethod(
  2986. $core.method({
  2987. selector: "printOn:",
  2988. protocol: "printing",
  2989. fn: function (aStream){
  2990. var self=this,$self=this;
  2991. return $core.withContext(function($ctx1) {
  2992. var $5,$4,$3,$2,$1;
  2993. $5=$self._class();
  2994. $ctx1.sendIdx["class"]=1;
  2995. $4=$recv($5)._name();
  2996. $ctx1.sendIdx["name"]=1;
  2997. $3=$recv($4)._first();
  2998. $2=$recv($3)._isVowel();
  2999. if($core.assert($2)){
  3000. $1="an ";
  3001. } else {
  3002. $1="a ";
  3003. }
  3004. $recv(aStream)._nextPutAll_($1);
  3005. $ctx1.sendIdx["nextPutAll:"]=1;
  3006. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3007. return self;
  3008. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  3009. },
  3010. args: ["aStream"],
  3011. 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",
  3012. referencedClasses: [],
  3013. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3014. }),
  3015. $globals.ProtoObject);
  3016. $core.addMethod(
  3017. $core.method({
  3018. selector: "printString",
  3019. protocol: "printing",
  3020. fn: function (){
  3021. var self=this,$self=this;
  3022. return $core.withContext(function($ctx1) {
  3023. return $recv($globals.String)._streamContents_((function(str){
  3024. return $core.withContext(function($ctx2) {
  3025. return $self._printOn_(str);
  3026. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3027. }));
  3028. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3029. },
  3030. args: [],
  3031. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3032. referencedClasses: ["String"],
  3033. messageSends: ["streamContents:", "printOn:"]
  3034. }),
  3035. $globals.ProtoObject);
  3036. $core.addMethod(
  3037. $core.method({
  3038. selector: "yourself",
  3039. protocol: "accessing",
  3040. fn: function (){
  3041. var self=this,$self=this;
  3042. return self;
  3043. },
  3044. args: [],
  3045. source: "yourself\x0a\x09^ self",
  3046. referencedClasses: [],
  3047. messageSends: []
  3048. }),
  3049. $globals.ProtoObject);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "~=",
  3053. protocol: "comparing",
  3054. fn: function (anObject){
  3055. var self=this,$self=this;
  3056. return $core.withContext(function($ctx1) {
  3057. var $1;
  3058. $1=$recv($self.__eq(anObject)).__eq(false);
  3059. $ctx1.sendIdx["="]=1;
  3060. return $1;
  3061. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3062. },
  3063. args: ["anObject"],
  3064. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3065. referencedClasses: [],
  3066. messageSends: ["="]
  3067. }),
  3068. $globals.ProtoObject);
  3069. $core.addMethod(
  3070. $core.method({
  3071. selector: "~~",
  3072. protocol: "comparing",
  3073. fn: function (anObject){
  3074. var self=this,$self=this;
  3075. return $core.withContext(function($ctx1) {
  3076. return $recv($self.__eq_eq(anObject)).__eq(false);
  3077. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3078. },
  3079. args: ["anObject"],
  3080. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3081. referencedClasses: [],
  3082. messageSends: ["=", "=="]
  3083. }),
  3084. $globals.ProtoObject);
  3085. $core.addMethod(
  3086. $core.method({
  3087. selector: "initialize",
  3088. protocol: "initialization",
  3089. fn: function (){
  3090. var self=this,$self=this;
  3091. return self;
  3092. },
  3093. args: [],
  3094. source: "initialize",
  3095. referencedClasses: [],
  3096. messageSends: []
  3097. }),
  3098. $globals.ProtoObject.a$cls);
  3099. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3100. $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.";
  3101. $core.addMethod(
  3102. $core.method({
  3103. selector: "->",
  3104. protocol: "converting",
  3105. fn: function (anObject){
  3106. var self=this,$self=this;
  3107. return $core.withContext(function($ctx1) {
  3108. return $recv($globals.Association)._key_value_(self,anObject);
  3109. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3110. },
  3111. args: ["anObject"],
  3112. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3113. referencedClasses: ["Association"],
  3114. messageSends: ["key:value:"]
  3115. }),
  3116. $globals.Object);
  3117. $core.addMethod(
  3118. $core.method({
  3119. selector: "asJSONString",
  3120. protocol: "converting",
  3121. fn: function (){
  3122. var self=this,$self=this;
  3123. return $core.withContext(function($ctx1) {
  3124. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3125. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3126. },
  3127. args: [],
  3128. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3129. referencedClasses: ["JSON"],
  3130. messageSends: ["stringify:", "asJavaScriptObject"]
  3131. }),
  3132. $globals.Object);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "asJavaScriptObject",
  3136. protocol: "converting",
  3137. fn: function (){
  3138. var self=this,$self=this;
  3139. var variables;
  3140. return $core.withContext(function($ctx1) {
  3141. variables=$recv($globals.HashedCollection)._new();
  3142. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3143. return $core.withContext(function($ctx2) {
  3144. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3146. }));
  3147. return variables;
  3148. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3149. },
  3150. args: [],
  3151. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  3152. referencedClasses: ["HashedCollection"],
  3153. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3154. }),
  3155. $globals.Object);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "asJavaScriptSource",
  3159. protocol: "converting",
  3160. fn: function (){
  3161. var self=this,$self=this;
  3162. return $core.withContext(function($ctx1) {
  3163. return $self._asString();
  3164. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3165. },
  3166. args: [],
  3167. source: "asJavaScriptSource\x0a\x09^ self asString",
  3168. referencedClasses: [],
  3169. messageSends: ["asString"]
  3170. }),
  3171. $globals.Object);
  3172. $core.addMethod(
  3173. $core.method({
  3174. selector: "basicAt:",
  3175. protocol: "accessing",
  3176. fn: function (aString){
  3177. var self=this,$self=this;
  3178. return $core.withContext(function($ctx1) {
  3179. return self[aString];
  3180. return self;
  3181. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3182. },
  3183. args: ["aString"],
  3184. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3185. referencedClasses: [],
  3186. messageSends: []
  3187. }),
  3188. $globals.Object);
  3189. $core.addMethod(
  3190. $core.method({
  3191. selector: "basicAt:put:",
  3192. protocol: "accessing",
  3193. fn: function (aString,anObject){
  3194. var self=this,$self=this;
  3195. return $core.withContext(function($ctx1) {
  3196. return self[aString] = anObject;
  3197. return self;
  3198. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3199. },
  3200. args: ["aString", "anObject"],
  3201. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3202. referencedClasses: [],
  3203. messageSends: []
  3204. }),
  3205. $globals.Object);
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "basicDelete:",
  3209. protocol: "accessing",
  3210. fn: function (aString){
  3211. var self=this,$self=this;
  3212. return $core.withContext(function($ctx1) {
  3213. delete self[aString]; return aString;
  3214. return self;
  3215. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3216. },
  3217. args: ["aString"],
  3218. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3219. referencedClasses: [],
  3220. messageSends: []
  3221. }),
  3222. $globals.Object);
  3223. $core.addMethod(
  3224. $core.method({
  3225. selector: "basicPerform:",
  3226. protocol: "message handling",
  3227. fn: function (aString){
  3228. var self=this,$self=this;
  3229. return $core.withContext(function($ctx1) {
  3230. return $self._basicPerform_withArguments_(aString,[]);
  3231. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3232. },
  3233. args: ["aString"],
  3234. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3235. referencedClasses: [],
  3236. messageSends: ["basicPerform:withArguments:"]
  3237. }),
  3238. $globals.Object);
  3239. $core.addMethod(
  3240. $core.method({
  3241. selector: "basicPerform:withArguments:",
  3242. protocol: "message handling",
  3243. fn: function (aString,aCollection){
  3244. var self=this,$self=this;
  3245. return $core.withContext(function($ctx1) {
  3246. return self[aString].apply(self, aCollection);;
  3247. return self;
  3248. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3249. },
  3250. args: ["aString", "aCollection"],
  3251. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3252. referencedClasses: [],
  3253. messageSends: []
  3254. }),
  3255. $globals.Object);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "browse",
  3259. protocol: "browsing",
  3260. fn: function (){
  3261. var self=this,$self=this;
  3262. return $core.withContext(function($ctx1) {
  3263. $recv($globals.Finder)._findClass_($self._class());
  3264. return self;
  3265. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3266. },
  3267. args: [],
  3268. source: "browse\x0a\x09Finder findClass: self class",
  3269. referencedClasses: ["Finder"],
  3270. messageSends: ["findClass:", "class"]
  3271. }),
  3272. $globals.Object);
  3273. $core.addMethod(
  3274. $core.method({
  3275. selector: "copy",
  3276. protocol: "copying",
  3277. fn: function (){
  3278. var self=this,$self=this;
  3279. return $core.withContext(function($ctx1) {
  3280. return $recv($self._shallowCopy())._postCopy();
  3281. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3282. },
  3283. args: [],
  3284. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3285. referencedClasses: [],
  3286. messageSends: ["postCopy", "shallowCopy"]
  3287. }),
  3288. $globals.Object);
  3289. $core.addMethod(
  3290. $core.method({
  3291. selector: "deepCopy",
  3292. protocol: "copying",
  3293. fn: function (){
  3294. var self=this,$self=this;
  3295. return $core.withContext(function($ctx1) {
  3296. var copy = self.a$cls._new();
  3297. Object.keys(self).forEach(function (i) {
  3298. if(/^@.+/.test(i)) {
  3299. copy[i] = $recv(self[i])._deepCopy();
  3300. }
  3301. });
  3302. return copy;
  3303. ;
  3304. return self;
  3305. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3306. },
  3307. args: [],
  3308. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3309. referencedClasses: [],
  3310. messageSends: []
  3311. }),
  3312. $globals.Object);
  3313. $core.addMethod(
  3314. $core.method({
  3315. selector: "deprecatedAPI",
  3316. protocol: "error handling",
  3317. fn: function (){
  3318. var self=this,$self=this;
  3319. return $core.withContext(function($ctx1) {
  3320. var $1,$6,$5,$4,$8,$7,$3,$2;
  3321. $1=console;
  3322. $6=$core.getThisContext()._home();
  3323. $ctx1.sendIdx["home"]=1;
  3324. $5=$recv($6)._asString();
  3325. $ctx1.sendIdx["asString"]=1;
  3326. $4=$recv($5).__comma(" is deprecated! (in ");
  3327. $8=$recv($core.getThisContext()._home())._home();
  3328. $ctx1.sendIdx["home"]=2;
  3329. $7=$recv($8)._asString();
  3330. $3=$recv($4).__comma($7);
  3331. $ctx1.sendIdx[","]=2;
  3332. $2=$recv($3).__comma(")");
  3333. $ctx1.sendIdx[","]=1;
  3334. $recv($1)._warn_($2);
  3335. return self;
  3336. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3337. },
  3338. args: [],
  3339. 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, ')'.",
  3340. referencedClasses: [],
  3341. messageSends: ["warn:", ",", "asString", "home"]
  3342. }),
  3343. $globals.Object);
  3344. $core.addMethod(
  3345. $core.method({
  3346. selector: "deprecatedAPI:",
  3347. protocol: "error handling",
  3348. fn: function (aString){
  3349. var self=this,$self=this;
  3350. return $core.withContext(function($ctx1) {
  3351. var $1,$6,$5,$4,$8,$7,$3,$2;
  3352. $1=console;
  3353. $6=$core.getThisContext()._home();
  3354. $ctx1.sendIdx["home"]=1;
  3355. $5=$recv($6)._asString();
  3356. $ctx1.sendIdx["asString"]=1;
  3357. $4=$recv($5).__comma(" is deprecated! (in ");
  3358. $8=$recv($core.getThisContext()._home())._home();
  3359. $ctx1.sendIdx["home"]=2;
  3360. $7=$recv($8)._asString();
  3361. $3=$recv($4).__comma($7);
  3362. $ctx1.sendIdx[","]=2;
  3363. $2=$recv($3).__comma(")");
  3364. $ctx1.sendIdx[","]=1;
  3365. $recv($1)._warn_($2);
  3366. $ctx1.sendIdx["warn:"]=1;
  3367. $recv(console)._warn_(aString);
  3368. return self;
  3369. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3370. },
  3371. args: ["aString"],
  3372. 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",
  3373. referencedClasses: [],
  3374. messageSends: ["warn:", ",", "asString", "home"]
  3375. }),
  3376. $globals.Object);
  3377. $core.addMethod(
  3378. $core.method({
  3379. selector: "error:",
  3380. protocol: "error handling",
  3381. fn: function (aString){
  3382. var self=this,$self=this;
  3383. return $core.withContext(function($ctx1) {
  3384. $recv($globals.Error)._signal_(aString);
  3385. return self;
  3386. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3387. },
  3388. args: ["aString"],
  3389. source: "error: aString\x0a\x09Error signal: aString",
  3390. referencedClasses: ["Error"],
  3391. messageSends: ["signal:"]
  3392. }),
  3393. $globals.Object);
  3394. $core.addMethod(
  3395. $core.method({
  3396. selector: "halt",
  3397. protocol: "error handling",
  3398. fn: function (){
  3399. var self=this,$self=this;
  3400. return $core.withContext(function($ctx1) {
  3401. $recv($globals.Halt)._signal();
  3402. return self;
  3403. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3404. },
  3405. args: [],
  3406. source: "halt\x0a\x09Halt signal",
  3407. referencedClasses: ["Halt"],
  3408. messageSends: ["signal"]
  3409. }),
  3410. $globals.Object);
  3411. $core.addMethod(
  3412. $core.method({
  3413. selector: "in:",
  3414. protocol: "evaluating",
  3415. fn: function (aValuable){
  3416. var self=this,$self=this;
  3417. return $core.withContext(function($ctx1) {
  3418. return $recv(aValuable)._value_(self);
  3419. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3420. },
  3421. args: ["aValuable"],
  3422. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3423. referencedClasses: [],
  3424. messageSends: ["value:"]
  3425. }),
  3426. $globals.Object);
  3427. $core.addMethod(
  3428. $core.method({
  3429. selector: "isBehavior",
  3430. protocol: "testing",
  3431. fn: function (){
  3432. var self=this,$self=this;
  3433. return false;
  3434. },
  3435. args: [],
  3436. source: "isBehavior\x0a\x09^ false",
  3437. referencedClasses: [],
  3438. messageSends: []
  3439. }),
  3440. $globals.Object);
  3441. $core.addMethod(
  3442. $core.method({
  3443. selector: "isBoolean",
  3444. protocol: "testing",
  3445. fn: function (){
  3446. var self=this,$self=this;
  3447. return false;
  3448. },
  3449. args: [],
  3450. source: "isBoolean\x0a\x09^ false",
  3451. referencedClasses: [],
  3452. messageSends: []
  3453. }),
  3454. $globals.Object);
  3455. $core.addMethod(
  3456. $core.method({
  3457. selector: "isClass",
  3458. protocol: "testing",
  3459. fn: function (){
  3460. var self=this,$self=this;
  3461. return false;
  3462. },
  3463. args: [],
  3464. source: "isClass\x0a\x09^ false",
  3465. referencedClasses: [],
  3466. messageSends: []
  3467. }),
  3468. $globals.Object);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "isCompiledMethod",
  3472. protocol: "testing",
  3473. fn: function (){
  3474. var self=this,$self=this;
  3475. return false;
  3476. },
  3477. args: [],
  3478. source: "isCompiledMethod\x0a\x09^ false",
  3479. referencedClasses: [],
  3480. messageSends: []
  3481. }),
  3482. $globals.Object);
  3483. $core.addMethod(
  3484. $core.method({
  3485. selector: "isImmutable",
  3486. protocol: "testing",
  3487. fn: function (){
  3488. var self=this,$self=this;
  3489. return false;
  3490. },
  3491. args: [],
  3492. source: "isImmutable\x0a\x09^ false",
  3493. referencedClasses: [],
  3494. messageSends: []
  3495. }),
  3496. $globals.Object);
  3497. $core.addMethod(
  3498. $core.method({
  3499. selector: "isMemberOf:",
  3500. protocol: "testing",
  3501. fn: function (aClass){
  3502. var self=this,$self=this;
  3503. return $core.withContext(function($ctx1) {
  3504. return $recv($self._class()).__eq(aClass);
  3505. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3506. },
  3507. args: ["aClass"],
  3508. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3509. referencedClasses: [],
  3510. messageSends: ["=", "class"]
  3511. }),
  3512. $globals.Object);
  3513. $core.addMethod(
  3514. $core.method({
  3515. selector: "isMetaclass",
  3516. protocol: "testing",
  3517. fn: function (){
  3518. var self=this,$self=this;
  3519. return false;
  3520. },
  3521. args: [],
  3522. source: "isMetaclass\x0a\x09^ false",
  3523. referencedClasses: [],
  3524. messageSends: []
  3525. }),
  3526. $globals.Object);
  3527. $core.addMethod(
  3528. $core.method({
  3529. selector: "isNumber",
  3530. protocol: "testing",
  3531. fn: function (){
  3532. var self=this,$self=this;
  3533. return false;
  3534. },
  3535. args: [],
  3536. source: "isNumber\x0a\x09^ false",
  3537. referencedClasses: [],
  3538. messageSends: []
  3539. }),
  3540. $globals.Object);
  3541. $core.addMethod(
  3542. $core.method({
  3543. selector: "isPackage",
  3544. protocol: "testing",
  3545. fn: function (){
  3546. var self=this,$self=this;
  3547. return false;
  3548. },
  3549. args: [],
  3550. source: "isPackage\x0a\x09^ false",
  3551. referencedClasses: [],
  3552. messageSends: []
  3553. }),
  3554. $globals.Object);
  3555. $core.addMethod(
  3556. $core.method({
  3557. selector: "isParseFailure",
  3558. protocol: "testing",
  3559. fn: function (){
  3560. var self=this,$self=this;
  3561. return false;
  3562. },
  3563. args: [],
  3564. source: "isParseFailure\x0a\x09^ false",
  3565. referencedClasses: [],
  3566. messageSends: []
  3567. }),
  3568. $globals.Object);
  3569. $core.addMethod(
  3570. $core.method({
  3571. selector: "isString",
  3572. protocol: "testing",
  3573. fn: function (){
  3574. var self=this,$self=this;
  3575. return false;
  3576. },
  3577. args: [],
  3578. source: "isString\x0a\x09^ false",
  3579. referencedClasses: [],
  3580. messageSends: []
  3581. }),
  3582. $globals.Object);
  3583. $core.addMethod(
  3584. $core.method({
  3585. selector: "isSymbol",
  3586. protocol: "testing",
  3587. fn: function (){
  3588. var self=this,$self=this;
  3589. return false;
  3590. },
  3591. args: [],
  3592. source: "isSymbol\x0a\x09^ false",
  3593. referencedClasses: [],
  3594. messageSends: []
  3595. }),
  3596. $globals.Object);
  3597. $core.addMethod(
  3598. $core.method({
  3599. selector: "postCopy",
  3600. protocol: "copying",
  3601. fn: function (){
  3602. var self=this,$self=this;
  3603. return self;
  3604. },
  3605. args: [],
  3606. source: "postCopy",
  3607. referencedClasses: [],
  3608. messageSends: []
  3609. }),
  3610. $globals.Object);
  3611. $core.addMethod(
  3612. $core.method({
  3613. selector: "putOn:",
  3614. protocol: "streaming",
  3615. fn: function (aStream){
  3616. var self=this,$self=this;
  3617. return $core.withContext(function($ctx1) {
  3618. $recv(aStream)._nextPut_(self);
  3619. return self;
  3620. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3621. },
  3622. args: ["aStream"],
  3623. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3624. referencedClasses: [],
  3625. messageSends: ["nextPut:"]
  3626. }),
  3627. $globals.Object);
  3628. $core.addMethod(
  3629. $core.method({
  3630. selector: "respondsTo:",
  3631. protocol: "testing",
  3632. fn: function (aSelector){
  3633. var self=this,$self=this;
  3634. return $core.withContext(function($ctx1) {
  3635. return $recv($self._class())._canUnderstand_(aSelector);
  3636. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3637. },
  3638. args: ["aSelector"],
  3639. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3640. referencedClasses: [],
  3641. messageSends: ["canUnderstand:", "class"]
  3642. }),
  3643. $globals.Object);
  3644. $core.addMethod(
  3645. $core.method({
  3646. selector: "shallowCopy",
  3647. protocol: "copying",
  3648. fn: function (){
  3649. var self=this,$self=this;
  3650. return $core.withContext(function($ctx1) {
  3651. var copy = self.a$cls._new();
  3652. Object.keys(self).forEach(function(i) {
  3653. if(/^@.+/.test(i)) {
  3654. copy[i] = self[i];
  3655. }
  3656. });
  3657. return copy;
  3658. ;
  3659. return self;
  3660. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3661. },
  3662. args: [],
  3663. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3664. referencedClasses: [],
  3665. messageSends: []
  3666. }),
  3667. $globals.Object);
  3668. $core.addMethod(
  3669. $core.method({
  3670. selector: "shouldNotImplement",
  3671. protocol: "error handling",
  3672. fn: function (){
  3673. var self=this,$self=this;
  3674. return $core.withContext(function($ctx1) {
  3675. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3676. return self;
  3677. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3678. },
  3679. args: [],
  3680. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3681. referencedClasses: [],
  3682. messageSends: ["error:", ",", "name", "class"]
  3683. }),
  3684. $globals.Object);
  3685. $core.addMethod(
  3686. $core.method({
  3687. selector: "size",
  3688. protocol: "accessing",
  3689. fn: function (){
  3690. var self=this,$self=this;
  3691. return $core.withContext(function($ctx1) {
  3692. $self._error_("Object not indexable");
  3693. return self;
  3694. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3695. },
  3696. args: [],
  3697. source: "size\x0a\x09self error: 'Object not indexable'",
  3698. referencedClasses: [],
  3699. messageSends: ["error:"]
  3700. }),
  3701. $globals.Object);
  3702. $core.addMethod(
  3703. $core.method({
  3704. selector: "subclassResponsibility",
  3705. protocol: "error handling",
  3706. fn: function (){
  3707. var self=this,$self=this;
  3708. return $core.withContext(function($ctx1) {
  3709. $self._error_("This method is a responsibility of a subclass");
  3710. return self;
  3711. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3712. },
  3713. args: [],
  3714. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3715. referencedClasses: [],
  3716. messageSends: ["error:"]
  3717. }),
  3718. $globals.Object);
  3719. $core.addMethod(
  3720. $core.method({
  3721. selector: "value",
  3722. protocol: "evaluating",
  3723. fn: function (){
  3724. var self=this,$self=this;
  3725. return $core.withContext(function($ctx1) {
  3726. return self.valueOf();
  3727. return self;
  3728. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3729. },
  3730. args: [],
  3731. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3732. referencedClasses: [],
  3733. messageSends: []
  3734. }),
  3735. $globals.Object);
  3736. $core.addMethod(
  3737. $core.method({
  3738. selector: "accessorProtocolWith:",
  3739. protocol: "helios",
  3740. fn: function (aGenerator){
  3741. var self=this,$self=this;
  3742. return $core.withContext(function($ctx1) {
  3743. $recv(aGenerator)._accessorProtocolForObject();
  3744. return self;
  3745. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3746. },
  3747. args: ["aGenerator"],
  3748. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3749. referencedClasses: [],
  3750. messageSends: ["accessorProtocolForObject"]
  3751. }),
  3752. $globals.Object.a$cls);
  3753. $core.addMethod(
  3754. $core.method({
  3755. selector: "accessorsSourceCodesWith:",
  3756. protocol: "helios",
  3757. fn: function (aGenerator){
  3758. var self=this,$self=this;
  3759. return $core.withContext(function($ctx1) {
  3760. $recv(aGenerator)._accessorsForObject();
  3761. return self;
  3762. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3763. },
  3764. args: ["aGenerator"],
  3765. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3766. referencedClasses: [],
  3767. messageSends: ["accessorsForObject"]
  3768. }),
  3769. $globals.Object.a$cls);
  3770. $core.addMethod(
  3771. $core.method({
  3772. selector: "initialize",
  3773. protocol: "initialization",
  3774. fn: function (){
  3775. var self=this,$self=this;
  3776. return self;
  3777. },
  3778. args: [],
  3779. source: "initialize\x0a\x09\x22no op\x22",
  3780. referencedClasses: [],
  3781. messageSends: []
  3782. }),
  3783. $globals.Object.a$cls);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "initializeProtocolWith:",
  3787. protocol: "helios",
  3788. fn: function (aGenerator){
  3789. var self=this,$self=this;
  3790. return $core.withContext(function($ctx1) {
  3791. $recv(aGenerator)._initializeProtocolForObject();
  3792. return self;
  3793. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3794. },
  3795. args: ["aGenerator"],
  3796. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3797. referencedClasses: [],
  3798. messageSends: ["initializeProtocolForObject"]
  3799. }),
  3800. $globals.Object.a$cls);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "initializeSourceCodesWith:",
  3804. protocol: "helios",
  3805. fn: function (aGenerator){
  3806. var self=this,$self=this;
  3807. return $core.withContext(function($ctx1) {
  3808. $recv(aGenerator)._initializeForObject();
  3809. return self;
  3810. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3811. },
  3812. args: ["aGenerator"],
  3813. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3814. referencedClasses: [],
  3815. messageSends: ["initializeForObject"]
  3816. }),
  3817. $globals.Object.a$cls);
  3818. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3819. $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: [ ... ]";
  3820. $core.addMethod(
  3821. $core.method({
  3822. selector: "&",
  3823. protocol: "controlling",
  3824. fn: function (aBoolean){
  3825. var self=this,$self=this;
  3826. return $core.withContext(function($ctx1) {
  3827. if(self == true) {
  3828. return aBoolean;
  3829. } else {
  3830. return false;
  3831. }
  3832. ;
  3833. return self;
  3834. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3835. },
  3836. args: ["aBoolean"],
  3837. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3838. referencedClasses: [],
  3839. messageSends: []
  3840. }),
  3841. $globals.Boolean);
  3842. $core.addMethod(
  3843. $core.method({
  3844. selector: "==",
  3845. protocol: "comparing",
  3846. fn: function (aBoolean){
  3847. var self=this,$self=this;
  3848. return $core.withContext(function($ctx1) {
  3849. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3850. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3851. else return false;;
  3852. return self;
  3853. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3854. },
  3855. args: ["aBoolean"],
  3856. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3857. referencedClasses: [],
  3858. messageSends: []
  3859. }),
  3860. $globals.Boolean);
  3861. $core.addMethod(
  3862. $core.method({
  3863. selector: "and:",
  3864. protocol: "controlling",
  3865. fn: function (aBlock){
  3866. var self=this,$self=this;
  3867. return $core.withContext(function($ctx1) {
  3868. if($core.assert(self)){
  3869. return $recv(aBlock)._value();
  3870. } else {
  3871. return false;
  3872. }
  3873. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3874. },
  3875. args: ["aBlock"],
  3876. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3877. referencedClasses: [],
  3878. messageSends: ["ifTrue:ifFalse:", "value"]
  3879. }),
  3880. $globals.Boolean);
  3881. $core.addMethod(
  3882. $core.method({
  3883. selector: "asBit",
  3884. protocol: "converting",
  3885. fn: function (){
  3886. var self=this,$self=this;
  3887. return $core.withContext(function($ctx1) {
  3888. if($core.assert(self)){
  3889. return (1);
  3890. } else {
  3891. return (0);
  3892. }
  3893. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3894. },
  3895. args: [],
  3896. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3897. referencedClasses: [],
  3898. messageSends: ["ifTrue:ifFalse:"]
  3899. }),
  3900. $globals.Boolean);
  3901. $core.addMethod(
  3902. $core.method({
  3903. selector: "asJavaScriptObject",
  3904. protocol: "converting",
  3905. fn: function (){
  3906. var self=this,$self=this;
  3907. return self;
  3908. },
  3909. args: [],
  3910. source: "asJavaScriptObject\x0a\x09^ self",
  3911. referencedClasses: [],
  3912. messageSends: []
  3913. }),
  3914. $globals.Boolean);
  3915. $core.addMethod(
  3916. $core.method({
  3917. selector: "asString",
  3918. protocol: "converting",
  3919. fn: function (){
  3920. var self=this,$self=this;
  3921. return $core.withContext(function($ctx1) {
  3922. return self.toString();
  3923. return self;
  3924. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3925. },
  3926. args: [],
  3927. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3928. referencedClasses: [],
  3929. messageSends: []
  3930. }),
  3931. $globals.Boolean);
  3932. $core.addMethod(
  3933. $core.method({
  3934. selector: "deepCopy",
  3935. protocol: "copying",
  3936. fn: function (){
  3937. var self=this,$self=this;
  3938. return self;
  3939. },
  3940. args: [],
  3941. source: "deepCopy\x0a\x09^ self",
  3942. referencedClasses: [],
  3943. messageSends: []
  3944. }),
  3945. $globals.Boolean);
  3946. $core.addMethod(
  3947. $core.method({
  3948. selector: "ifFalse:",
  3949. protocol: "controlling",
  3950. fn: function (aBlock){
  3951. var self=this,$self=this;
  3952. return $core.withContext(function($ctx1) {
  3953. return $self._ifTrue_ifFalse_((function(){
  3954. }),aBlock);
  3955. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3956. },
  3957. args: ["aBlock"],
  3958. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3959. referencedClasses: [],
  3960. messageSends: ["ifTrue:ifFalse:"]
  3961. }),
  3962. $globals.Boolean);
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "ifFalse:ifTrue:",
  3966. protocol: "controlling",
  3967. fn: function (aBlock,anotherBlock){
  3968. var self=this,$self=this;
  3969. return $core.withContext(function($ctx1) {
  3970. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3971. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3972. },
  3973. args: ["aBlock", "anotherBlock"],
  3974. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3975. referencedClasses: [],
  3976. messageSends: ["ifTrue:ifFalse:"]
  3977. }),
  3978. $globals.Boolean);
  3979. $core.addMethod(
  3980. $core.method({
  3981. selector: "ifTrue:",
  3982. protocol: "controlling",
  3983. fn: function (aBlock){
  3984. var self=this,$self=this;
  3985. return $core.withContext(function($ctx1) {
  3986. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3987. }));
  3988. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3989. },
  3990. args: ["aBlock"],
  3991. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3992. referencedClasses: [],
  3993. messageSends: ["ifTrue:ifFalse:"]
  3994. }),
  3995. $globals.Boolean);
  3996. $core.addMethod(
  3997. $core.method({
  3998. selector: "ifTrue:ifFalse:",
  3999. protocol: "controlling",
  4000. fn: function (aBlock,anotherBlock){
  4001. var self=this,$self=this;
  4002. return $core.withContext(function($ctx1) {
  4003. if(self == true) {
  4004. return aBlock._value();
  4005. } else {
  4006. return anotherBlock._value();
  4007. }
  4008. ;
  4009. return self;
  4010. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4011. },
  4012. args: ["aBlock", "anotherBlock"],
  4013. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  4014. referencedClasses: [],
  4015. messageSends: []
  4016. }),
  4017. $globals.Boolean);
  4018. $core.addMethod(
  4019. $core.method({
  4020. selector: "isBoolean",
  4021. protocol: "testing",
  4022. fn: function (){
  4023. var self=this,$self=this;
  4024. return true;
  4025. },
  4026. args: [],
  4027. source: "isBoolean\x0a\x09^ true",
  4028. referencedClasses: [],
  4029. messageSends: []
  4030. }),
  4031. $globals.Boolean);
  4032. $core.addMethod(
  4033. $core.method({
  4034. selector: "isImmutable",
  4035. protocol: "testing",
  4036. fn: function (){
  4037. var self=this,$self=this;
  4038. return true;
  4039. },
  4040. args: [],
  4041. source: "isImmutable\x0a\x09^ true",
  4042. referencedClasses: [],
  4043. messageSends: []
  4044. }),
  4045. $globals.Boolean);
  4046. $core.addMethod(
  4047. $core.method({
  4048. selector: "not",
  4049. protocol: "controlling",
  4050. fn: function (){
  4051. var self=this,$self=this;
  4052. return $core.withContext(function($ctx1) {
  4053. return $self.__eq(false);
  4054. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4055. },
  4056. args: [],
  4057. source: "not\x0a\x09^ self = false",
  4058. referencedClasses: [],
  4059. messageSends: ["="]
  4060. }),
  4061. $globals.Boolean);
  4062. $core.addMethod(
  4063. $core.method({
  4064. selector: "or:",
  4065. protocol: "controlling",
  4066. fn: function (aBlock){
  4067. var self=this,$self=this;
  4068. return $core.withContext(function($ctx1) {
  4069. if($core.assert(self)){
  4070. return true;
  4071. } else {
  4072. return $recv(aBlock)._value();
  4073. }
  4074. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4075. },
  4076. args: ["aBlock"],
  4077. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4078. referencedClasses: [],
  4079. messageSends: ["ifTrue:ifFalse:", "value"]
  4080. }),
  4081. $globals.Boolean);
  4082. $core.addMethod(
  4083. $core.method({
  4084. selector: "printOn:",
  4085. protocol: "printing",
  4086. fn: function (aStream){
  4087. var self=this,$self=this;
  4088. return $core.withContext(function($ctx1) {
  4089. $recv(aStream)._nextPutAll_($self._asString());
  4090. return self;
  4091. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4092. },
  4093. args: ["aStream"],
  4094. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4095. referencedClasses: [],
  4096. messageSends: ["nextPutAll:", "asString"]
  4097. }),
  4098. $globals.Boolean);
  4099. $core.addMethod(
  4100. $core.method({
  4101. selector: "shallowCopy",
  4102. protocol: "copying",
  4103. fn: function (){
  4104. var self=this,$self=this;
  4105. return self;
  4106. },
  4107. args: [],
  4108. source: "shallowCopy\x0a\x09^ self",
  4109. referencedClasses: [],
  4110. messageSends: []
  4111. }),
  4112. $globals.Boolean);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "|",
  4116. protocol: "controlling",
  4117. fn: function (aBoolean){
  4118. var self=this,$self=this;
  4119. return $core.withContext(function($ctx1) {
  4120. if(self == true) {
  4121. return true;
  4122. } else {
  4123. return aBoolean;
  4124. }
  4125. ;
  4126. return self;
  4127. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4128. },
  4129. args: ["aBoolean"],
  4130. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  4131. referencedClasses: [],
  4132. messageSends: []
  4133. }),
  4134. $globals.Boolean);
  4135. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4136. $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.).";
  4137. $core.addMethod(
  4138. $core.method({
  4139. selector: "+",
  4140. protocol: "arithmetic",
  4141. fn: function (aDate){
  4142. var self=this,$self=this;
  4143. return $core.withContext(function($ctx1) {
  4144. return self + aDate;
  4145. return self;
  4146. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4147. },
  4148. args: ["aDate"],
  4149. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4150. referencedClasses: [],
  4151. messageSends: []
  4152. }),
  4153. $globals.Date);
  4154. $core.addMethod(
  4155. $core.method({
  4156. selector: "-",
  4157. protocol: "arithmetic",
  4158. fn: function (aDate){
  4159. var self=this,$self=this;
  4160. return $core.withContext(function($ctx1) {
  4161. return self - aDate;
  4162. return self;
  4163. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4164. },
  4165. args: ["aDate"],
  4166. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4167. referencedClasses: [],
  4168. messageSends: []
  4169. }),
  4170. $globals.Date);
  4171. $core.addMethod(
  4172. $core.method({
  4173. selector: "<",
  4174. protocol: "comparing",
  4175. fn: function (aDate){
  4176. var self=this,$self=this;
  4177. return $core.withContext(function($ctx1) {
  4178. return self < aDate;
  4179. return self;
  4180. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4181. },
  4182. args: ["aDate"],
  4183. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4184. referencedClasses: [],
  4185. messageSends: []
  4186. }),
  4187. $globals.Date);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "<=",
  4191. protocol: "comparing",
  4192. fn: function (aDate){
  4193. var self=this,$self=this;
  4194. return $core.withContext(function($ctx1) {
  4195. return self <= aDate;
  4196. return self;
  4197. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4198. },
  4199. args: ["aDate"],
  4200. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4201. referencedClasses: [],
  4202. messageSends: []
  4203. }),
  4204. $globals.Date);
  4205. $core.addMethod(
  4206. $core.method({
  4207. selector: "=",
  4208. protocol: "comparing",
  4209. fn: function (aDate){
  4210. var self=this,$self=this;
  4211. return $core.withContext(function($ctx1) {
  4212. var $2,$1,$3;
  4213. $2=$recv(aDate)._class();
  4214. $ctx1.sendIdx["class"]=1;
  4215. $1=$recv($2).__eq_eq($self._class());
  4216. $ctx1.sendIdx["=="]=1;
  4217. return $recv($1)._and_((function(){
  4218. return $core.withContext(function($ctx2) {
  4219. $3=$self._asMilliseconds();
  4220. $ctx2.sendIdx["asMilliseconds"]=1;
  4221. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4223. }));
  4224. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4225. },
  4226. args: ["aDate"],
  4227. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4228. referencedClasses: [],
  4229. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4230. }),
  4231. $globals.Date);
  4232. $core.addMethod(
  4233. $core.method({
  4234. selector: ">",
  4235. protocol: "comparing",
  4236. fn: function (aDate){
  4237. var self=this,$self=this;
  4238. return $core.withContext(function($ctx1) {
  4239. return self > aDate;
  4240. return self;
  4241. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4242. },
  4243. args: ["aDate"],
  4244. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4245. referencedClasses: [],
  4246. messageSends: []
  4247. }),
  4248. $globals.Date);
  4249. $core.addMethod(
  4250. $core.method({
  4251. selector: ">=",
  4252. protocol: "comparing",
  4253. fn: function (aDate){
  4254. var self=this,$self=this;
  4255. return $core.withContext(function($ctx1) {
  4256. return self >= aDate;
  4257. return self;
  4258. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4259. },
  4260. args: ["aDate"],
  4261. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4262. referencedClasses: [],
  4263. messageSends: []
  4264. }),
  4265. $globals.Date);
  4266. $core.addMethod(
  4267. $core.method({
  4268. selector: "asDateString",
  4269. protocol: "converting",
  4270. fn: function (){
  4271. var self=this,$self=this;
  4272. return $core.withContext(function($ctx1) {
  4273. return self.toDateString();
  4274. return self;
  4275. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4276. },
  4277. args: [],
  4278. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4279. referencedClasses: [],
  4280. messageSends: []
  4281. }),
  4282. $globals.Date);
  4283. $core.addMethod(
  4284. $core.method({
  4285. selector: "asLocaleString",
  4286. protocol: "converting",
  4287. fn: function (){
  4288. var self=this,$self=this;
  4289. return $core.withContext(function($ctx1) {
  4290. return self.toLocaleString();
  4291. return self;
  4292. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4293. },
  4294. args: [],
  4295. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4296. referencedClasses: [],
  4297. messageSends: []
  4298. }),
  4299. $globals.Date);
  4300. $core.addMethod(
  4301. $core.method({
  4302. selector: "asMilliseconds",
  4303. protocol: "converting",
  4304. fn: function (){
  4305. var self=this,$self=this;
  4306. return $core.withContext(function($ctx1) {
  4307. return $self._time();
  4308. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4309. },
  4310. args: [],
  4311. source: "asMilliseconds\x0a\x09^ self time",
  4312. referencedClasses: [],
  4313. messageSends: ["time"]
  4314. }),
  4315. $globals.Date);
  4316. $core.addMethod(
  4317. $core.method({
  4318. selector: "asNumber",
  4319. protocol: "converting",
  4320. fn: function (){
  4321. var self=this,$self=this;
  4322. return $core.withContext(function($ctx1) {
  4323. return $self._asMilliseconds();
  4324. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4325. },
  4326. args: [],
  4327. source: "asNumber\x0a\x09^ self asMilliseconds",
  4328. referencedClasses: [],
  4329. messageSends: ["asMilliseconds"]
  4330. }),
  4331. $globals.Date);
  4332. $core.addMethod(
  4333. $core.method({
  4334. selector: "asString",
  4335. protocol: "converting",
  4336. fn: function (){
  4337. var self=this,$self=this;
  4338. return $core.withContext(function($ctx1) {
  4339. return self.toString();
  4340. return self;
  4341. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4342. },
  4343. args: [],
  4344. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4345. referencedClasses: [],
  4346. messageSends: []
  4347. }),
  4348. $globals.Date);
  4349. $core.addMethod(
  4350. $core.method({
  4351. selector: "asTimeString",
  4352. protocol: "converting",
  4353. fn: function (){
  4354. var self=this,$self=this;
  4355. return $core.withContext(function($ctx1) {
  4356. return self.toTimeString();
  4357. return self;
  4358. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4359. },
  4360. args: [],
  4361. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4362. referencedClasses: [],
  4363. messageSends: []
  4364. }),
  4365. $globals.Date);
  4366. $core.addMethod(
  4367. $core.method({
  4368. selector: "day",
  4369. protocol: "accessing",
  4370. fn: function (){
  4371. var self=this,$self=this;
  4372. return $core.withContext(function($ctx1) {
  4373. return $self._dayOfWeek();
  4374. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4375. },
  4376. args: [],
  4377. source: "day\x0a\x09^ self dayOfWeek",
  4378. referencedClasses: [],
  4379. messageSends: ["dayOfWeek"]
  4380. }),
  4381. $globals.Date);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "day:",
  4385. protocol: "accessing",
  4386. fn: function (aNumber){
  4387. var self=this,$self=this;
  4388. return $core.withContext(function($ctx1) {
  4389. $self._dayOfWeek_(aNumber);
  4390. return self;
  4391. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4392. },
  4393. args: ["aNumber"],
  4394. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4395. referencedClasses: [],
  4396. messageSends: ["dayOfWeek:"]
  4397. }),
  4398. $globals.Date);
  4399. $core.addMethod(
  4400. $core.method({
  4401. selector: "dayOfMonth",
  4402. protocol: "accessing",
  4403. fn: function (){
  4404. var self=this,$self=this;
  4405. return $core.withContext(function($ctx1) {
  4406. return self.getDate();
  4407. return self;
  4408. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4409. },
  4410. args: [],
  4411. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4412. referencedClasses: [],
  4413. messageSends: []
  4414. }),
  4415. $globals.Date);
  4416. $core.addMethod(
  4417. $core.method({
  4418. selector: "dayOfMonth:",
  4419. protocol: "accessing",
  4420. fn: function (aNumber){
  4421. var self=this,$self=this;
  4422. return $core.withContext(function($ctx1) {
  4423. self.setDate(aNumber);
  4424. return self;
  4425. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4426. },
  4427. args: ["aNumber"],
  4428. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4429. referencedClasses: [],
  4430. messageSends: []
  4431. }),
  4432. $globals.Date);
  4433. $core.addMethod(
  4434. $core.method({
  4435. selector: "dayOfWeek",
  4436. protocol: "accessing",
  4437. fn: function (){
  4438. var self=this,$self=this;
  4439. return $core.withContext(function($ctx1) {
  4440. return self.getDay() + 1;
  4441. return self;
  4442. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4443. },
  4444. args: [],
  4445. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4446. referencedClasses: [],
  4447. messageSends: []
  4448. }),
  4449. $globals.Date);
  4450. $core.addMethod(
  4451. $core.method({
  4452. selector: "dayOfWeek:",
  4453. protocol: "accessing",
  4454. fn: function (aNumber){
  4455. var self=this,$self=this;
  4456. return $core.withContext(function($ctx1) {
  4457. return self.setDay(aNumber - 1);
  4458. return self;
  4459. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4460. },
  4461. args: ["aNumber"],
  4462. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4463. referencedClasses: [],
  4464. messageSends: []
  4465. }),
  4466. $globals.Date);
  4467. $core.addMethod(
  4468. $core.method({
  4469. selector: "hours",
  4470. protocol: "accessing",
  4471. fn: function (){
  4472. var self=this,$self=this;
  4473. return $core.withContext(function($ctx1) {
  4474. return self.getHours();
  4475. return self;
  4476. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4477. },
  4478. args: [],
  4479. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4480. referencedClasses: [],
  4481. messageSends: []
  4482. }),
  4483. $globals.Date);
  4484. $core.addMethod(
  4485. $core.method({
  4486. selector: "hours:",
  4487. protocol: "accessing",
  4488. fn: function (aNumber){
  4489. var self=this,$self=this;
  4490. return $core.withContext(function($ctx1) {
  4491. self.setHours(aNumber);
  4492. return self;
  4493. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4494. },
  4495. args: ["aNumber"],
  4496. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4497. referencedClasses: [],
  4498. messageSends: []
  4499. }),
  4500. $globals.Date);
  4501. $core.addMethod(
  4502. $core.method({
  4503. selector: "milliseconds",
  4504. protocol: "accessing",
  4505. fn: function (){
  4506. var self=this,$self=this;
  4507. return $core.withContext(function($ctx1) {
  4508. return self.getMilliseconds();
  4509. return self;
  4510. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4511. },
  4512. args: [],
  4513. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4514. referencedClasses: [],
  4515. messageSends: []
  4516. }),
  4517. $globals.Date);
  4518. $core.addMethod(
  4519. $core.method({
  4520. selector: "milliseconds:",
  4521. protocol: "accessing",
  4522. fn: function (aNumber){
  4523. var self=this,$self=this;
  4524. return $core.withContext(function($ctx1) {
  4525. self.setMilliseconds(aNumber);
  4526. return self;
  4527. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4528. },
  4529. args: ["aNumber"],
  4530. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4531. referencedClasses: [],
  4532. messageSends: []
  4533. }),
  4534. $globals.Date);
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "minutes",
  4538. protocol: "accessing",
  4539. fn: function (){
  4540. var self=this,$self=this;
  4541. return $core.withContext(function($ctx1) {
  4542. return self.getMinutes();
  4543. return self;
  4544. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4545. },
  4546. args: [],
  4547. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4548. referencedClasses: [],
  4549. messageSends: []
  4550. }),
  4551. $globals.Date);
  4552. $core.addMethod(
  4553. $core.method({
  4554. selector: "minutes:",
  4555. protocol: "accessing",
  4556. fn: function (aNumber){
  4557. var self=this,$self=this;
  4558. return $core.withContext(function($ctx1) {
  4559. self.setMinutes(aNumber);
  4560. return self;
  4561. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4562. },
  4563. args: ["aNumber"],
  4564. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4565. referencedClasses: [],
  4566. messageSends: []
  4567. }),
  4568. $globals.Date);
  4569. $core.addMethod(
  4570. $core.method({
  4571. selector: "month",
  4572. protocol: "accessing",
  4573. fn: function (){
  4574. var self=this,$self=this;
  4575. return $core.withContext(function($ctx1) {
  4576. return self.getMonth() + 1;
  4577. return self;
  4578. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4579. },
  4580. args: [],
  4581. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4582. referencedClasses: [],
  4583. messageSends: []
  4584. }),
  4585. $globals.Date);
  4586. $core.addMethod(
  4587. $core.method({
  4588. selector: "month:",
  4589. protocol: "accessing",
  4590. fn: function (aNumber){
  4591. var self=this,$self=this;
  4592. return $core.withContext(function($ctx1) {
  4593. self.setMonth(aNumber - 1);
  4594. return self;
  4595. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4596. },
  4597. args: ["aNumber"],
  4598. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4599. referencedClasses: [],
  4600. messageSends: []
  4601. }),
  4602. $globals.Date);
  4603. $core.addMethod(
  4604. $core.method({
  4605. selector: "printOn:",
  4606. protocol: "printing",
  4607. fn: function (aStream){
  4608. var self=this,$self=this;
  4609. return $core.withContext(function($ctx1) {
  4610. $recv(aStream)._nextPutAll_($self._asString());
  4611. return self;
  4612. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4613. },
  4614. args: ["aStream"],
  4615. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4616. referencedClasses: [],
  4617. messageSends: ["nextPutAll:", "asString"]
  4618. }),
  4619. $globals.Date);
  4620. $core.addMethod(
  4621. $core.method({
  4622. selector: "seconds",
  4623. protocol: "accessing",
  4624. fn: function (){
  4625. var self=this,$self=this;
  4626. return $core.withContext(function($ctx1) {
  4627. return self.getSeconds();
  4628. return self;
  4629. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4630. },
  4631. args: [],
  4632. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4633. referencedClasses: [],
  4634. messageSends: []
  4635. }),
  4636. $globals.Date);
  4637. $core.addMethod(
  4638. $core.method({
  4639. selector: "seconds:",
  4640. protocol: "accessing",
  4641. fn: function (aNumber){
  4642. var self=this,$self=this;
  4643. return $core.withContext(function($ctx1) {
  4644. self.setSeconds(aNumber);
  4645. return self;
  4646. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4647. },
  4648. args: ["aNumber"],
  4649. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4650. referencedClasses: [],
  4651. messageSends: []
  4652. }),
  4653. $globals.Date);
  4654. $core.addMethod(
  4655. $core.method({
  4656. selector: "time",
  4657. protocol: "accessing",
  4658. fn: function (){
  4659. var self=this,$self=this;
  4660. return $core.withContext(function($ctx1) {
  4661. return self.getTime();
  4662. return self;
  4663. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4664. },
  4665. args: [],
  4666. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4667. referencedClasses: [],
  4668. messageSends: []
  4669. }),
  4670. $globals.Date);
  4671. $core.addMethod(
  4672. $core.method({
  4673. selector: "time:",
  4674. protocol: "accessing",
  4675. fn: function (aNumber){
  4676. var self=this,$self=this;
  4677. return $core.withContext(function($ctx1) {
  4678. self.setTime(aNumber);
  4679. return self;
  4680. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4681. },
  4682. args: ["aNumber"],
  4683. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4684. referencedClasses: [],
  4685. messageSends: []
  4686. }),
  4687. $globals.Date);
  4688. $core.addMethod(
  4689. $core.method({
  4690. selector: "year",
  4691. protocol: "accessing",
  4692. fn: function (){
  4693. var self=this,$self=this;
  4694. return $core.withContext(function($ctx1) {
  4695. return self.getFullYear();
  4696. return self;
  4697. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4698. },
  4699. args: [],
  4700. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4701. referencedClasses: [],
  4702. messageSends: []
  4703. }),
  4704. $globals.Date);
  4705. $core.addMethod(
  4706. $core.method({
  4707. selector: "year:",
  4708. protocol: "accessing",
  4709. fn: function (aNumber){
  4710. var self=this,$self=this;
  4711. return $core.withContext(function($ctx1) {
  4712. self.setFullYear(aNumber);
  4713. return self;
  4714. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4715. },
  4716. args: ["aNumber"],
  4717. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4718. referencedClasses: [],
  4719. messageSends: []
  4720. }),
  4721. $globals.Date);
  4722. $core.addMethod(
  4723. $core.method({
  4724. selector: "classTag",
  4725. protocol: "accessing",
  4726. fn: function (){
  4727. var self=this,$self=this;
  4728. return "magnitude";
  4729. },
  4730. args: [],
  4731. 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'",
  4732. referencedClasses: [],
  4733. messageSends: []
  4734. }),
  4735. $globals.Date.a$cls);
  4736. $core.addMethod(
  4737. $core.method({
  4738. selector: "fromMilliseconds:",
  4739. protocol: "instance creation",
  4740. fn: function (aNumber){
  4741. var self=this,$self=this;
  4742. return $core.withContext(function($ctx1) {
  4743. return $self._new_(aNumber);
  4744. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4745. },
  4746. args: ["aNumber"],
  4747. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4748. referencedClasses: [],
  4749. messageSends: ["new:"]
  4750. }),
  4751. $globals.Date.a$cls);
  4752. $core.addMethod(
  4753. $core.method({
  4754. selector: "fromSeconds:",
  4755. protocol: "instance creation",
  4756. fn: function (aNumber){
  4757. var self=this,$self=this;
  4758. return $core.withContext(function($ctx1) {
  4759. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4760. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4761. },
  4762. args: ["aNumber"],
  4763. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4764. referencedClasses: [],
  4765. messageSends: ["fromMilliseconds:", "*"]
  4766. }),
  4767. $globals.Date.a$cls);
  4768. $core.addMethod(
  4769. $core.method({
  4770. selector: "fromString:",
  4771. protocol: "instance creation",
  4772. fn: function (aString){
  4773. var self=this,$self=this;
  4774. return $core.withContext(function($ctx1) {
  4775. return $self._new_(aString);
  4776. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4777. },
  4778. args: ["aString"],
  4779. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4780. referencedClasses: [],
  4781. messageSends: ["new:"]
  4782. }),
  4783. $globals.Date.a$cls);
  4784. $core.addMethod(
  4785. $core.method({
  4786. selector: "millisecondsToRun:",
  4787. protocol: "instance creation",
  4788. fn: function (aBlock){
  4789. var self=this,$self=this;
  4790. var t;
  4791. return $core.withContext(function($ctx1) {
  4792. t=$recv($globals.Date)._now();
  4793. $ctx1.sendIdx["now"]=1;
  4794. $recv(aBlock)._value();
  4795. return $recv($recv($globals.Date)._now()).__minus(t);
  4796. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4797. },
  4798. args: ["aBlock"],
  4799. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4800. referencedClasses: ["Date"],
  4801. messageSends: ["now", "value", "-"]
  4802. }),
  4803. $globals.Date.a$cls);
  4804. $core.addMethod(
  4805. $core.method({
  4806. selector: "new:",
  4807. protocol: "instance creation",
  4808. fn: function (anObject){
  4809. var self=this,$self=this;
  4810. return $core.withContext(function($ctx1) {
  4811. return new Date(anObject);
  4812. return self;
  4813. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4814. },
  4815. args: ["anObject"],
  4816. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4817. referencedClasses: [],
  4818. messageSends: []
  4819. }),
  4820. $globals.Date.a$cls);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "now",
  4824. protocol: "instance creation",
  4825. fn: function (){
  4826. var self=this,$self=this;
  4827. return $core.withContext(function($ctx1) {
  4828. return $self._today();
  4829. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4830. },
  4831. args: [],
  4832. source: "now\x0a\x09^ self today",
  4833. referencedClasses: [],
  4834. messageSends: ["today"]
  4835. }),
  4836. $globals.Date.a$cls);
  4837. $core.addMethod(
  4838. $core.method({
  4839. selector: "today",
  4840. protocol: "instance creation",
  4841. fn: function (){
  4842. var self=this,$self=this;
  4843. return $core.withContext(function($ctx1) {
  4844. return $self._new();
  4845. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4846. },
  4847. args: [],
  4848. source: "today\x0a\x09^ self new",
  4849. referencedClasses: [],
  4850. messageSends: ["new"]
  4851. }),
  4852. $globals.Date.a$cls);
  4853. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4854. $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 ].";
  4855. $core.addMethod(
  4856. $core.method({
  4857. selector: "&",
  4858. protocol: "converting",
  4859. fn: function (aNumber){
  4860. var self=this,$self=this;
  4861. return $core.withContext(function($ctx1) {
  4862. return self & aNumber;
  4863. return self;
  4864. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4865. },
  4866. args: ["aNumber"],
  4867. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4868. referencedClasses: [],
  4869. messageSends: []
  4870. }),
  4871. $globals.Number);
  4872. $core.addMethod(
  4873. $core.method({
  4874. selector: "*",
  4875. protocol: "arithmetic",
  4876. fn: function (aNumber){
  4877. var self=this,$self=this;
  4878. return $core.withContext(function($ctx1) {
  4879. return self * aNumber;
  4880. return self;
  4881. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4882. },
  4883. args: ["aNumber"],
  4884. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4885. referencedClasses: [],
  4886. messageSends: []
  4887. }),
  4888. $globals.Number);
  4889. $core.addMethod(
  4890. $core.method({
  4891. selector: "**",
  4892. protocol: "mathematical functions",
  4893. fn: function (exponent){
  4894. var self=this,$self=this;
  4895. return $core.withContext(function($ctx1) {
  4896. return $self._raisedTo_(exponent);
  4897. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4898. },
  4899. args: ["exponent"],
  4900. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4901. referencedClasses: [],
  4902. messageSends: ["raisedTo:"]
  4903. }),
  4904. $globals.Number);
  4905. $core.addMethod(
  4906. $core.method({
  4907. selector: "+",
  4908. protocol: "arithmetic",
  4909. fn: function (aNumber){
  4910. var self=this,$self=this;
  4911. return $core.withContext(function($ctx1) {
  4912. return self + aNumber;
  4913. return self;
  4914. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4915. },
  4916. args: ["aNumber"],
  4917. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4918. referencedClasses: [],
  4919. messageSends: []
  4920. }),
  4921. $globals.Number);
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: "-",
  4925. protocol: "arithmetic",
  4926. fn: function (aNumber){
  4927. var self=this,$self=this;
  4928. return $core.withContext(function($ctx1) {
  4929. return self - aNumber;
  4930. return self;
  4931. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4932. },
  4933. args: ["aNumber"],
  4934. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4935. referencedClasses: [],
  4936. messageSends: []
  4937. }),
  4938. $globals.Number);
  4939. $core.addMethod(
  4940. $core.method({
  4941. selector: "/",
  4942. protocol: "arithmetic",
  4943. fn: function (aNumber){
  4944. var self=this,$self=this;
  4945. return $core.withContext(function($ctx1) {
  4946. return self / aNumber;
  4947. return self;
  4948. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4949. },
  4950. args: ["aNumber"],
  4951. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4952. referencedClasses: [],
  4953. messageSends: []
  4954. }),
  4955. $globals.Number);
  4956. $core.addMethod(
  4957. $core.method({
  4958. selector: "//",
  4959. protocol: "arithmetic",
  4960. fn: function (aNumber){
  4961. var self=this,$self=this;
  4962. return $core.withContext(function($ctx1) {
  4963. return $recv($self.__slash(aNumber))._floor();
  4964. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4965. },
  4966. args: ["aNumber"],
  4967. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4968. referencedClasses: [],
  4969. messageSends: ["floor", "/"]
  4970. }),
  4971. $globals.Number);
  4972. $core.addMethod(
  4973. $core.method({
  4974. selector: "<",
  4975. protocol: "comparing",
  4976. fn: function (aNumber){
  4977. var self=this,$self=this;
  4978. return $core.withContext(function($ctx1) {
  4979. return self < aNumber;
  4980. return self;
  4981. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4982. },
  4983. args: ["aNumber"],
  4984. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4985. referencedClasses: [],
  4986. messageSends: []
  4987. }),
  4988. $globals.Number);
  4989. $core.addMethod(
  4990. $core.method({
  4991. selector: "<=",
  4992. protocol: "comparing",
  4993. fn: function (aNumber){
  4994. var self=this,$self=this;
  4995. return $core.withContext(function($ctx1) {
  4996. return self <= aNumber;
  4997. return self;
  4998. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4999. },
  5000. args: ["aNumber"],
  5001. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5002. referencedClasses: [],
  5003. messageSends: []
  5004. }),
  5005. $globals.Number);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "==",
  5009. protocol: "comparing",
  5010. fn: function (aNumber){
  5011. var self=this,$self=this;
  5012. return $core.withContext(function($ctx1) {
  5013. if (typeof aNumber === "number") return Number(self) === aNumber;
  5014. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5015. else return false;;
  5016. return self;
  5017. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5018. },
  5019. args: ["aNumber"],
  5020. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  5021. referencedClasses: [],
  5022. messageSends: []
  5023. }),
  5024. $globals.Number);
  5025. $core.addMethod(
  5026. $core.method({
  5027. selector: ">",
  5028. protocol: "comparing",
  5029. fn: function (aNumber){
  5030. var self=this,$self=this;
  5031. return $core.withContext(function($ctx1) {
  5032. return self > aNumber;
  5033. return self;
  5034. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5035. },
  5036. args: ["aNumber"],
  5037. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5038. referencedClasses: [],
  5039. messageSends: []
  5040. }),
  5041. $globals.Number);
  5042. $core.addMethod(
  5043. $core.method({
  5044. selector: ">=",
  5045. protocol: "comparing",
  5046. fn: function (aNumber){
  5047. var self=this,$self=this;
  5048. return $core.withContext(function($ctx1) {
  5049. return self >= aNumber;
  5050. return self;
  5051. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5052. },
  5053. args: ["aNumber"],
  5054. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5055. referencedClasses: [],
  5056. messageSends: []
  5057. }),
  5058. $globals.Number);
  5059. $core.addMethod(
  5060. $core.method({
  5061. selector: "@",
  5062. protocol: "converting",
  5063. fn: function (aNumber){
  5064. var self=this,$self=this;
  5065. return $core.withContext(function($ctx1) {
  5066. return $recv($globals.Point)._x_y_(self,aNumber);
  5067. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5068. },
  5069. args: ["aNumber"],
  5070. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5071. referencedClasses: ["Point"],
  5072. messageSends: ["x:y:"]
  5073. }),
  5074. $globals.Number);
  5075. $core.addMethod(
  5076. $core.method({
  5077. selector: "\x5c\x5c",
  5078. protocol: "arithmetic",
  5079. fn: function (aNumber){
  5080. var self=this,$self=this;
  5081. return $core.withContext(function($ctx1) {
  5082. return self % aNumber;
  5083. return self;
  5084. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5085. },
  5086. args: ["aNumber"],
  5087. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5088. referencedClasses: [],
  5089. messageSends: []
  5090. }),
  5091. $globals.Number);
  5092. $core.addMethod(
  5093. $core.method({
  5094. selector: "abs",
  5095. protocol: "arithmetic",
  5096. fn: function (){
  5097. var self=this,$self=this;
  5098. return $core.withContext(function($ctx1) {
  5099. return Math.abs(self);;
  5100. return self;
  5101. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5102. },
  5103. args: [],
  5104. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5105. referencedClasses: [],
  5106. messageSends: []
  5107. }),
  5108. $globals.Number);
  5109. $core.addMethod(
  5110. $core.method({
  5111. selector: "arcCos",
  5112. protocol: "mathematical functions",
  5113. fn: function (){
  5114. var self=this,$self=this;
  5115. return $core.withContext(function($ctx1) {
  5116. return Math.acos(self);;
  5117. return self;
  5118. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5119. },
  5120. args: [],
  5121. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5122. referencedClasses: [],
  5123. messageSends: []
  5124. }),
  5125. $globals.Number);
  5126. $core.addMethod(
  5127. $core.method({
  5128. selector: "arcSin",
  5129. protocol: "mathematical functions",
  5130. fn: function (){
  5131. var self=this,$self=this;
  5132. return $core.withContext(function($ctx1) {
  5133. return Math.asin(self);;
  5134. return self;
  5135. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5136. },
  5137. args: [],
  5138. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5139. referencedClasses: [],
  5140. messageSends: []
  5141. }),
  5142. $globals.Number);
  5143. $core.addMethod(
  5144. $core.method({
  5145. selector: "arcTan",
  5146. protocol: "mathematical functions",
  5147. fn: function (){
  5148. var self=this,$self=this;
  5149. return $core.withContext(function($ctx1) {
  5150. return Math.atan(self);;
  5151. return self;
  5152. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5153. },
  5154. args: [],
  5155. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5156. referencedClasses: [],
  5157. messageSends: []
  5158. }),
  5159. $globals.Number);
  5160. $core.addMethod(
  5161. $core.method({
  5162. selector: "arcTan:",
  5163. protocol: "mathematical functions",
  5164. fn: function (aNumber){
  5165. var self=this,$self=this;
  5166. return $core.withContext(function($ctx1) {
  5167. return Math.atan2(self, aNumber);;
  5168. return self;
  5169. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5170. },
  5171. args: ["aNumber"],
  5172. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5173. referencedClasses: [],
  5174. messageSends: []
  5175. }),
  5176. $globals.Number);
  5177. $core.addMethod(
  5178. $core.method({
  5179. selector: "asJavaScriptObject",
  5180. protocol: "converting",
  5181. fn: function (){
  5182. var self=this,$self=this;
  5183. return self;
  5184. },
  5185. args: [],
  5186. source: "asJavaScriptObject\x0a\x09^ self",
  5187. referencedClasses: [],
  5188. messageSends: []
  5189. }),
  5190. $globals.Number);
  5191. $core.addMethod(
  5192. $core.method({
  5193. selector: "asJavaScriptSource",
  5194. protocol: "converting",
  5195. fn: function (){
  5196. var self=this,$self=this;
  5197. return $core.withContext(function($ctx1) {
  5198. var $1;
  5199. $1=$recv("(".__comma($self._printString())).__comma(")");
  5200. $ctx1.sendIdx[","]=1;
  5201. return $1;
  5202. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5203. },
  5204. args: [],
  5205. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5206. referencedClasses: [],
  5207. messageSends: [",", "printString"]
  5208. }),
  5209. $globals.Number);
  5210. $core.addMethod(
  5211. $core.method({
  5212. selector: "asNumber",
  5213. protocol: "converting",
  5214. fn: function (){
  5215. var self=this,$self=this;
  5216. return self;
  5217. },
  5218. args: [],
  5219. source: "asNumber\x0a\x09^ self",
  5220. referencedClasses: [],
  5221. messageSends: []
  5222. }),
  5223. $globals.Number);
  5224. $core.addMethod(
  5225. $core.method({
  5226. selector: "asPoint",
  5227. protocol: "converting",
  5228. fn: function (){
  5229. var self=this,$self=this;
  5230. return $core.withContext(function($ctx1) {
  5231. return $recv($globals.Point)._x_y_(self,self);
  5232. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5233. },
  5234. args: [],
  5235. source: "asPoint\x0a\x09^ Point x: self y: self",
  5236. referencedClasses: ["Point"],
  5237. messageSends: ["x:y:"]
  5238. }),
  5239. $globals.Number);
  5240. $core.addMethod(
  5241. $core.method({
  5242. selector: "asString",
  5243. protocol: "converting",
  5244. fn: function (){
  5245. var self=this,$self=this;
  5246. return $core.withContext(function($ctx1) {
  5247. return String(self);
  5248. return self;
  5249. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5250. },
  5251. args: [],
  5252. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5253. referencedClasses: [],
  5254. messageSends: []
  5255. }),
  5256. $globals.Number);
  5257. $core.addMethod(
  5258. $core.method({
  5259. selector: "atRandom",
  5260. protocol: "converting",
  5261. fn: function (){
  5262. var self=this,$self=this;
  5263. return $core.withContext(function($ctx1) {
  5264. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5265. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5266. },
  5267. args: [],
  5268. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5269. referencedClasses: ["Random"],
  5270. messageSends: ["+", "truncated", "*", "next", "new"]
  5271. }),
  5272. $globals.Number);
  5273. $core.addMethod(
  5274. $core.method({
  5275. selector: "between:and:",
  5276. protocol: "testing",
  5277. fn: function (min,max){
  5278. var self=this,$self=this;
  5279. return $core.withContext(function($ctx1) {
  5280. return $recv($self.__gt_eq(min))._and_((function(){
  5281. return $core.withContext(function($ctx2) {
  5282. return $self.__lt_eq(max);
  5283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5284. }));
  5285. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5286. },
  5287. args: ["min", "max"],
  5288. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5289. referencedClasses: [],
  5290. messageSends: ["and:", ">=", "<="]
  5291. }),
  5292. $globals.Number);
  5293. $core.addMethod(
  5294. $core.method({
  5295. selector: "bitAnd:",
  5296. protocol: "converting",
  5297. fn: function (aNumber){
  5298. var self=this,$self=this;
  5299. return $core.withContext(function($ctx1) {
  5300. return self & aNumber;
  5301. return self;
  5302. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5303. },
  5304. args: ["aNumber"],
  5305. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5306. referencedClasses: [],
  5307. messageSends: []
  5308. }),
  5309. $globals.Number);
  5310. $core.addMethod(
  5311. $core.method({
  5312. selector: "bitNot",
  5313. protocol: "converting",
  5314. fn: function (){
  5315. var self=this,$self=this;
  5316. return $core.withContext(function($ctx1) {
  5317. return ~self;
  5318. return self;
  5319. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5320. },
  5321. args: [],
  5322. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5323. referencedClasses: [],
  5324. messageSends: []
  5325. }),
  5326. $globals.Number);
  5327. $core.addMethod(
  5328. $core.method({
  5329. selector: "bitOr:",
  5330. protocol: "converting",
  5331. fn: function (aNumber){
  5332. var self=this,$self=this;
  5333. return $core.withContext(function($ctx1) {
  5334. return self | aNumber;
  5335. return self;
  5336. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5337. },
  5338. args: ["aNumber"],
  5339. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5340. referencedClasses: [],
  5341. messageSends: []
  5342. }),
  5343. $globals.Number);
  5344. $core.addMethod(
  5345. $core.method({
  5346. selector: "bitXor:",
  5347. protocol: "converting",
  5348. fn: function (aNumber){
  5349. var self=this,$self=this;
  5350. return $core.withContext(function($ctx1) {
  5351. return self ^ aNumber;
  5352. return self;
  5353. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5354. },
  5355. args: ["aNumber"],
  5356. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5357. referencedClasses: [],
  5358. messageSends: []
  5359. }),
  5360. $globals.Number);
  5361. $core.addMethod(
  5362. $core.method({
  5363. selector: "ceiling",
  5364. protocol: "converting",
  5365. fn: function (){
  5366. var self=this,$self=this;
  5367. return $core.withContext(function($ctx1) {
  5368. return Math.ceil(self);;
  5369. return self;
  5370. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5371. },
  5372. args: [],
  5373. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5374. referencedClasses: [],
  5375. messageSends: []
  5376. }),
  5377. $globals.Number);
  5378. $core.addMethod(
  5379. $core.method({
  5380. selector: "copy",
  5381. protocol: "copying",
  5382. fn: function (){
  5383. var self=this,$self=this;
  5384. return self;
  5385. },
  5386. args: [],
  5387. source: "copy\x0a\x09^ self",
  5388. referencedClasses: [],
  5389. messageSends: []
  5390. }),
  5391. $globals.Number);
  5392. $core.addMethod(
  5393. $core.method({
  5394. selector: "cos",
  5395. protocol: "mathematical functions",
  5396. fn: function (){
  5397. var self=this,$self=this;
  5398. return $core.withContext(function($ctx1) {
  5399. return Math.cos(self);;
  5400. return self;
  5401. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5402. },
  5403. args: [],
  5404. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5405. referencedClasses: [],
  5406. messageSends: []
  5407. }),
  5408. $globals.Number);
  5409. $core.addMethod(
  5410. $core.method({
  5411. selector: "deepCopy",
  5412. protocol: "copying",
  5413. fn: function (){
  5414. var self=this,$self=this;
  5415. return $core.withContext(function($ctx1) {
  5416. return $self._copy();
  5417. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5418. },
  5419. args: [],
  5420. source: "deepCopy\x0a\x09^ self copy",
  5421. referencedClasses: [],
  5422. messageSends: ["copy"]
  5423. }),
  5424. $globals.Number);
  5425. $core.addMethod(
  5426. $core.method({
  5427. selector: "degreesToRadians",
  5428. protocol: "converting",
  5429. fn: function (){
  5430. var self=this,$self=this;
  5431. return $core.withContext(function($ctx1) {
  5432. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5433. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5434. },
  5435. args: [],
  5436. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5437. referencedClasses: ["Number"],
  5438. messageSends: ["*", "radiansPerDegree"]
  5439. }),
  5440. $globals.Number);
  5441. $core.addMethod(
  5442. $core.method({
  5443. selector: "even",
  5444. protocol: "testing",
  5445. fn: function (){
  5446. var self=this,$self=this;
  5447. return $core.withContext(function($ctx1) {
  5448. return (0).__eq($self.__backslash_backslash((2)));
  5449. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5450. },
  5451. args: [],
  5452. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5453. referencedClasses: [],
  5454. messageSends: ["=", "\x5c\x5c"]
  5455. }),
  5456. $globals.Number);
  5457. $core.addMethod(
  5458. $core.method({
  5459. selector: "floor",
  5460. protocol: "converting",
  5461. fn: function (){
  5462. var self=this,$self=this;
  5463. return $core.withContext(function($ctx1) {
  5464. return Math.floor(self);;
  5465. return self;
  5466. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5467. },
  5468. args: [],
  5469. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5470. referencedClasses: [],
  5471. messageSends: []
  5472. }),
  5473. $globals.Number);
  5474. $core.addMethod(
  5475. $core.method({
  5476. selector: "isImmutable",
  5477. protocol: "testing",
  5478. fn: function (){
  5479. var self=this,$self=this;
  5480. return true;
  5481. },
  5482. args: [],
  5483. source: "isImmutable\x0a\x09^ true",
  5484. referencedClasses: [],
  5485. messageSends: []
  5486. }),
  5487. $globals.Number);
  5488. $core.addMethod(
  5489. $core.method({
  5490. selector: "isNumber",
  5491. protocol: "testing",
  5492. fn: function (){
  5493. var self=this,$self=this;
  5494. return true;
  5495. },
  5496. args: [],
  5497. source: "isNumber\x0a\x09^ true",
  5498. referencedClasses: [],
  5499. messageSends: []
  5500. }),
  5501. $globals.Number);
  5502. $core.addMethod(
  5503. $core.method({
  5504. selector: "isZero",
  5505. protocol: "testing",
  5506. fn: function (){
  5507. var self=this,$self=this;
  5508. return $core.withContext(function($ctx1) {
  5509. return $self.__eq((0));
  5510. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5511. },
  5512. args: [],
  5513. source: "isZero\x0a\x09^ self = 0",
  5514. referencedClasses: [],
  5515. messageSends: ["="]
  5516. }),
  5517. $globals.Number);
  5518. $core.addMethod(
  5519. $core.method({
  5520. selector: "ln",
  5521. protocol: "mathematical functions",
  5522. fn: function (){
  5523. var self=this,$self=this;
  5524. return $core.withContext(function($ctx1) {
  5525. return Math.log(self);;
  5526. return self;
  5527. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5528. },
  5529. args: [],
  5530. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5531. referencedClasses: [],
  5532. messageSends: []
  5533. }),
  5534. $globals.Number);
  5535. $core.addMethod(
  5536. $core.method({
  5537. selector: "ln1p",
  5538. protocol: "mathematical functions",
  5539. fn: function (){
  5540. var self=this,$self=this;
  5541. return $core.withContext(function($ctx1) {
  5542. return Math.log1p(self);;
  5543. return self;
  5544. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5545. },
  5546. args: [],
  5547. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5548. referencedClasses: [],
  5549. messageSends: []
  5550. }),
  5551. $globals.Number);
  5552. $core.addMethod(
  5553. $core.method({
  5554. selector: "log",
  5555. protocol: "mathematical functions",
  5556. fn: function (){
  5557. var self=this,$self=this;
  5558. return $core.withContext(function($ctx1) {
  5559. return Math.log(self) / Math.LN10;;
  5560. return self;
  5561. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5562. },
  5563. args: [],
  5564. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5565. referencedClasses: [],
  5566. messageSends: []
  5567. }),
  5568. $globals.Number);
  5569. $core.addMethod(
  5570. $core.method({
  5571. selector: "log:",
  5572. protocol: "mathematical functions",
  5573. fn: function (aNumber){
  5574. var self=this,$self=this;
  5575. return $core.withContext(function($ctx1) {
  5576. return Math.log(self) / Math.log(aNumber);;
  5577. return self;
  5578. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5579. },
  5580. args: ["aNumber"],
  5581. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5582. referencedClasses: [],
  5583. messageSends: []
  5584. }),
  5585. $globals.Number);
  5586. $core.addMethod(
  5587. $core.method({
  5588. selector: "max:",
  5589. protocol: "arithmetic",
  5590. fn: function (aNumber){
  5591. var self=this,$self=this;
  5592. return $core.withContext(function($ctx1) {
  5593. return Math.max(self, aNumber);;
  5594. return self;
  5595. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5596. },
  5597. args: ["aNumber"],
  5598. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5599. referencedClasses: [],
  5600. messageSends: []
  5601. }),
  5602. $globals.Number);
  5603. $core.addMethod(
  5604. $core.method({
  5605. selector: "min:",
  5606. protocol: "arithmetic",
  5607. fn: function (aNumber){
  5608. var self=this,$self=this;
  5609. return $core.withContext(function($ctx1) {
  5610. return Math.min(self, aNumber);;
  5611. return self;
  5612. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5613. },
  5614. args: ["aNumber"],
  5615. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5616. referencedClasses: [],
  5617. messageSends: []
  5618. }),
  5619. $globals.Number);
  5620. $core.addMethod(
  5621. $core.method({
  5622. selector: "min:max:",
  5623. protocol: "arithmetic",
  5624. fn: function (aMin,aMax){
  5625. var self=this,$self=this;
  5626. return $core.withContext(function($ctx1) {
  5627. return $recv($self._min_(aMin))._max_(aMax);
  5628. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5629. },
  5630. args: ["aMin", "aMax"],
  5631. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5632. referencedClasses: [],
  5633. messageSends: ["max:", "min:"]
  5634. }),
  5635. $globals.Number);
  5636. $core.addMethod(
  5637. $core.method({
  5638. selector: "negated",
  5639. protocol: "arithmetic",
  5640. fn: function (){
  5641. var self=this,$self=this;
  5642. return $core.withContext(function($ctx1) {
  5643. return (0).__minus(self);
  5644. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5645. },
  5646. args: [],
  5647. source: "negated\x0a\x09^ 0 - self",
  5648. referencedClasses: [],
  5649. messageSends: ["-"]
  5650. }),
  5651. $globals.Number);
  5652. $core.addMethod(
  5653. $core.method({
  5654. selector: "negative",
  5655. protocol: "testing",
  5656. fn: function (){
  5657. var self=this,$self=this;
  5658. return $core.withContext(function($ctx1) {
  5659. return $self.__lt((0));
  5660. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5661. },
  5662. args: [],
  5663. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5664. referencedClasses: [],
  5665. messageSends: ["<"]
  5666. }),
  5667. $globals.Number);
  5668. $core.addMethod(
  5669. $core.method({
  5670. selector: "odd",
  5671. protocol: "testing",
  5672. fn: function (){
  5673. var self=this,$self=this;
  5674. return $core.withContext(function($ctx1) {
  5675. return $recv($self._even())._not();
  5676. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5677. },
  5678. args: [],
  5679. source: "odd\x0a\x09^ self even not",
  5680. referencedClasses: [],
  5681. messageSends: ["not", "even"]
  5682. }),
  5683. $globals.Number);
  5684. $core.addMethod(
  5685. $core.method({
  5686. selector: "positive",
  5687. protocol: "testing",
  5688. fn: function (){
  5689. var self=this,$self=this;
  5690. return $core.withContext(function($ctx1) {
  5691. return $self.__gt_eq((0));
  5692. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5693. },
  5694. args: [],
  5695. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5696. referencedClasses: [],
  5697. messageSends: [">="]
  5698. }),
  5699. $globals.Number);
  5700. $core.addMethod(
  5701. $core.method({
  5702. selector: "printOn:",
  5703. protocol: "printing",
  5704. fn: function (aStream){
  5705. var self=this,$self=this;
  5706. return $core.withContext(function($ctx1) {
  5707. $recv(aStream)._nextPutAll_($self._asString());
  5708. return self;
  5709. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5710. },
  5711. args: ["aStream"],
  5712. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5713. referencedClasses: [],
  5714. messageSends: ["nextPutAll:", "asString"]
  5715. }),
  5716. $globals.Number);
  5717. $core.addMethod(
  5718. $core.method({
  5719. selector: "printShowingDecimalPlaces:",
  5720. protocol: "printing",
  5721. fn: function (placesDesired){
  5722. var self=this,$self=this;
  5723. return $core.withContext(function($ctx1) {
  5724. return self.toFixed(placesDesired);
  5725. return self;
  5726. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5727. },
  5728. args: ["placesDesired"],
  5729. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5730. referencedClasses: [],
  5731. messageSends: []
  5732. }),
  5733. $globals.Number);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "printStringBase:",
  5737. protocol: "converting",
  5738. fn: function (aBase){
  5739. var self=this,$self=this;
  5740. return $core.withContext(function($ctx1) {
  5741. return self.toString(aBase);
  5742. return self;
  5743. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5744. },
  5745. args: ["aBase"],
  5746. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5747. referencedClasses: [],
  5748. messageSends: []
  5749. }),
  5750. $globals.Number);
  5751. $core.addMethod(
  5752. $core.method({
  5753. selector: "radiansToDegrees",
  5754. protocol: "converting",
  5755. fn: function (){
  5756. var self=this,$self=this;
  5757. return $core.withContext(function($ctx1) {
  5758. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5759. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5760. },
  5761. args: [],
  5762. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5763. referencedClasses: ["Number"],
  5764. messageSends: ["/", "radiansPerDegree"]
  5765. }),
  5766. $globals.Number);
  5767. $core.addMethod(
  5768. $core.method({
  5769. selector: "raisedTo:",
  5770. protocol: "mathematical functions",
  5771. fn: function (exponent){
  5772. var self=this,$self=this;
  5773. return $core.withContext(function($ctx1) {
  5774. return Math.pow(self, exponent);;
  5775. return self;
  5776. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5777. },
  5778. args: ["exponent"],
  5779. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5780. referencedClasses: [],
  5781. messageSends: []
  5782. }),
  5783. $globals.Number);
  5784. $core.addMethod(
  5785. $core.method({
  5786. selector: "rounded",
  5787. protocol: "converting",
  5788. fn: function (){
  5789. var self=this,$self=this;
  5790. return $core.withContext(function($ctx1) {
  5791. return Math.round(self);;
  5792. return self;
  5793. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5794. },
  5795. args: [],
  5796. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5797. referencedClasses: [],
  5798. messageSends: []
  5799. }),
  5800. $globals.Number);
  5801. $core.addMethod(
  5802. $core.method({
  5803. selector: "sign",
  5804. protocol: "mathematical functions",
  5805. fn: function (){
  5806. var self=this,$self=this;
  5807. return $core.withContext(function($ctx1) {
  5808. var $1,$2;
  5809. $1=$self._isZero();
  5810. if($core.assert($1)){
  5811. return (0);
  5812. }
  5813. $2=$self._positive();
  5814. if($core.assert($2)){
  5815. return (1);
  5816. } else {
  5817. return (-1);
  5818. }
  5819. return self;
  5820. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5821. },
  5822. args: [],
  5823. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5824. referencedClasses: [],
  5825. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5826. }),
  5827. $globals.Number);
  5828. $core.addMethod(
  5829. $core.method({
  5830. selector: "sin",
  5831. protocol: "mathematical functions",
  5832. fn: function (){
  5833. var self=this,$self=this;
  5834. return $core.withContext(function($ctx1) {
  5835. return Math.sin(self);;
  5836. return self;
  5837. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5838. },
  5839. args: [],
  5840. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5841. referencedClasses: [],
  5842. messageSends: []
  5843. }),
  5844. $globals.Number);
  5845. $core.addMethod(
  5846. $core.method({
  5847. selector: "sqrt",
  5848. protocol: "mathematical functions",
  5849. fn: function (){
  5850. var self=this,$self=this;
  5851. return $core.withContext(function($ctx1) {
  5852. return Math.sqrt(self);
  5853. return self;
  5854. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5855. },
  5856. args: [],
  5857. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5858. referencedClasses: [],
  5859. messageSends: []
  5860. }),
  5861. $globals.Number);
  5862. $core.addMethod(
  5863. $core.method({
  5864. selector: "squared",
  5865. protocol: "mathematical functions",
  5866. fn: function (){
  5867. var self=this,$self=this;
  5868. return $core.withContext(function($ctx1) {
  5869. return $self.__star(self);
  5870. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5871. },
  5872. args: [],
  5873. source: "squared\x0a\x09^ self * self",
  5874. referencedClasses: [],
  5875. messageSends: ["*"]
  5876. }),
  5877. $globals.Number);
  5878. $core.addMethod(
  5879. $core.method({
  5880. selector: "tan",
  5881. protocol: "mathematical functions",
  5882. fn: function (){
  5883. var self=this,$self=this;
  5884. return $core.withContext(function($ctx1) {
  5885. return Math.tan(self);;
  5886. return self;
  5887. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5888. },
  5889. args: [],
  5890. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5891. referencedClasses: [],
  5892. messageSends: []
  5893. }),
  5894. $globals.Number);
  5895. $core.addMethod(
  5896. $core.method({
  5897. selector: "timesRepeat:",
  5898. protocol: "enumerating",
  5899. fn: function (aBlock){
  5900. var self=this,$self=this;
  5901. var count;
  5902. return $core.withContext(function($ctx1) {
  5903. count=(1);
  5904. $recv((function(){
  5905. return $core.withContext(function($ctx2) {
  5906. return $recv(count).__gt(self);
  5907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5908. }))._whileFalse_((function(){
  5909. return $core.withContext(function($ctx2) {
  5910. $recv(aBlock)._value();
  5911. count=$recv(count).__plus((1));
  5912. return count;
  5913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5914. }));
  5915. return self;
  5916. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5917. },
  5918. args: ["aBlock"],
  5919. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5920. referencedClasses: [],
  5921. messageSends: ["whileFalse:", ">", "value", "+"]
  5922. }),
  5923. $globals.Number);
  5924. $core.addMethod(
  5925. $core.method({
  5926. selector: "to:",
  5927. protocol: "converting",
  5928. fn: function (aNumber){
  5929. var self=this,$self=this;
  5930. var array,first,last,count;
  5931. return $core.withContext(function($ctx1) {
  5932. first=$self._truncated();
  5933. $ctx1.sendIdx["truncated"]=1;
  5934. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5935. $ctx1.sendIdx["+"]=1;
  5936. count=(1);
  5937. array=$recv($globals.Array)._new();
  5938. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5939. return $core.withContext(function($ctx2) {
  5940. $recv(array)._at_put_(count,first);
  5941. count=$recv(count).__plus((1));
  5942. $ctx2.sendIdx["+"]=2;
  5943. first=$recv(first).__plus((1));
  5944. return first;
  5945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5946. }));
  5947. return array;
  5948. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5949. },
  5950. args: ["aNumber"],
  5951. 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",
  5952. referencedClasses: ["Array"],
  5953. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5954. }),
  5955. $globals.Number);
  5956. $core.addMethod(
  5957. $core.method({
  5958. selector: "to:by:",
  5959. protocol: "converting",
  5960. fn: function (stop,step){
  5961. var self=this,$self=this;
  5962. var array,value,pos;
  5963. return $core.withContext(function($ctx1) {
  5964. var $1,$2;
  5965. value=self;
  5966. array=$recv($globals.Array)._new();
  5967. pos=(1);
  5968. $1=$recv(step).__eq((0));
  5969. if($core.assert($1)){
  5970. $self._error_("step must be non-zero");
  5971. }
  5972. $2=$recv(step).__lt((0));
  5973. if($core.assert($2)){
  5974. $recv((function(){
  5975. return $core.withContext(function($ctx2) {
  5976. return $recv(value).__gt_eq(stop);
  5977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5978. }))._whileTrue_((function(){
  5979. return $core.withContext(function($ctx2) {
  5980. $recv(array)._at_put_(pos,value);
  5981. $ctx2.sendIdx["at:put:"]=1;
  5982. pos=$recv(pos).__plus((1));
  5983. $ctx2.sendIdx["+"]=1;
  5984. value=$recv(value).__plus(step);
  5985. $ctx2.sendIdx["+"]=2;
  5986. return value;
  5987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5988. }));
  5989. $ctx1.sendIdx["whileTrue:"]=1;
  5990. } else {
  5991. $recv((function(){
  5992. return $core.withContext(function($ctx2) {
  5993. return $recv(value).__lt_eq(stop);
  5994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5995. }))._whileTrue_((function(){
  5996. return $core.withContext(function($ctx2) {
  5997. $recv(array)._at_put_(pos,value);
  5998. pos=$recv(pos).__plus((1));
  5999. $ctx2.sendIdx["+"]=3;
  6000. value=$recv(value).__plus(step);
  6001. return value;
  6002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6003. }));
  6004. }
  6005. return array;
  6006. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  6007. },
  6008. args: ["stop", "step"],
  6009. 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",
  6010. referencedClasses: ["Array"],
  6011. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6012. }),
  6013. $globals.Number);
  6014. $core.addMethod(
  6015. $core.method({
  6016. selector: "to:by:do:",
  6017. protocol: "enumerating",
  6018. fn: function (stop,step,aBlock){
  6019. var self=this,$self=this;
  6020. var value;
  6021. return $core.withContext(function($ctx1) {
  6022. var $1,$2;
  6023. value=self;
  6024. $1=$recv(step).__eq((0));
  6025. if($core.assert($1)){
  6026. $self._error_("step must be non-zero");
  6027. }
  6028. $2=$recv(step).__lt((0));
  6029. if($core.assert($2)){
  6030. $recv((function(){
  6031. return $core.withContext(function($ctx2) {
  6032. return $recv(value).__gt_eq(stop);
  6033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6034. }))._whileTrue_((function(){
  6035. return $core.withContext(function($ctx2) {
  6036. $recv(aBlock)._value_(value);
  6037. $ctx2.sendIdx["value:"]=1;
  6038. value=$recv(value).__plus(step);
  6039. $ctx2.sendIdx["+"]=1;
  6040. return value;
  6041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6042. }));
  6043. $ctx1.sendIdx["whileTrue:"]=1;
  6044. } else {
  6045. $recv((function(){
  6046. return $core.withContext(function($ctx2) {
  6047. return $recv(value).__lt_eq(stop);
  6048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6049. }))._whileTrue_((function(){
  6050. return $core.withContext(function($ctx2) {
  6051. $recv(aBlock)._value_(value);
  6052. value=$recv(value).__plus(step);
  6053. return value;
  6054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6055. }));
  6056. }
  6057. return self;
  6058. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6059. },
  6060. args: ["stop", "step", "aBlock"],
  6061. 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 ]]",
  6062. referencedClasses: [],
  6063. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6064. }),
  6065. $globals.Number);
  6066. $core.addMethod(
  6067. $core.method({
  6068. selector: "to:do:",
  6069. protocol: "enumerating",
  6070. fn: function (stop,aBlock){
  6071. var self=this,$self=this;
  6072. var nextValue;
  6073. return $core.withContext(function($ctx1) {
  6074. nextValue=self;
  6075. $recv((function(){
  6076. return $core.withContext(function($ctx2) {
  6077. return $recv(nextValue).__lt_eq(stop);
  6078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6079. }))._whileTrue_((function(){
  6080. return $core.withContext(function($ctx2) {
  6081. $recv(aBlock)._value_(nextValue);
  6082. nextValue=$recv(nextValue).__plus((1));
  6083. return nextValue;
  6084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6085. }));
  6086. return self;
  6087. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6088. },
  6089. args: ["stop", "aBlock"],
  6090. 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 ]",
  6091. referencedClasses: [],
  6092. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6093. }),
  6094. $globals.Number);
  6095. $core.addMethod(
  6096. $core.method({
  6097. selector: "truncated",
  6098. protocol: "converting",
  6099. fn: function (){
  6100. var self=this,$self=this;
  6101. return $core.withContext(function($ctx1) {
  6102. if(self >= 0) {
  6103. return Math.floor(self);
  6104. } else {
  6105. return Math.floor(self * (-1)) * (-1);
  6106. };
  6107. ;
  6108. return self;
  6109. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6110. },
  6111. args: [],
  6112. source: "truncated\x0a\x09<inlineJS: '\x0a\x09\x09if(self >= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09'>",
  6113. referencedClasses: [],
  6114. messageSends: []
  6115. }),
  6116. $globals.Number);
  6117. $core.addMethod(
  6118. $core.method({
  6119. selector: "|",
  6120. protocol: "converting",
  6121. fn: function (aNumber){
  6122. var self=this,$self=this;
  6123. return $core.withContext(function($ctx1) {
  6124. return self | aNumber;
  6125. return self;
  6126. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6127. },
  6128. args: ["aNumber"],
  6129. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6130. referencedClasses: [],
  6131. messageSends: []
  6132. }),
  6133. $globals.Number);
  6134. $core.addMethod(
  6135. $core.method({
  6136. selector: "classTag",
  6137. protocol: "accessing",
  6138. fn: function (){
  6139. var self=this,$self=this;
  6140. return "magnitude";
  6141. },
  6142. args: [],
  6143. 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'",
  6144. referencedClasses: [],
  6145. messageSends: []
  6146. }),
  6147. $globals.Number.a$cls);
  6148. $core.addMethod(
  6149. $core.method({
  6150. selector: "e",
  6151. protocol: "instance creation",
  6152. fn: function (){
  6153. var self=this,$self=this;
  6154. return $core.withContext(function($ctx1) {
  6155. return Math.E;;
  6156. return self;
  6157. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6158. },
  6159. args: [],
  6160. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6161. referencedClasses: [],
  6162. messageSends: []
  6163. }),
  6164. $globals.Number.a$cls);
  6165. $core.addMethod(
  6166. $core.method({
  6167. selector: "pi",
  6168. protocol: "instance creation",
  6169. fn: function (){
  6170. var self=this,$self=this;
  6171. return $core.withContext(function($ctx1) {
  6172. return Math.PI;
  6173. return self;
  6174. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6175. },
  6176. args: [],
  6177. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6178. referencedClasses: [],
  6179. messageSends: []
  6180. }),
  6181. $globals.Number.a$cls);
  6182. $core.addMethod(
  6183. $core.method({
  6184. selector: "radiansPerDegree",
  6185. protocol: "instance creation",
  6186. fn: function (){
  6187. var self=this,$self=this;
  6188. return $core.withContext(function($ctx1) {
  6189. return $recv($self._pi()).__slash((180));
  6190. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6191. },
  6192. args: [],
  6193. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6194. referencedClasses: [],
  6195. messageSends: ["/", "pi"]
  6196. }),
  6197. $globals.Number.a$cls);
  6198. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6199. $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";
  6200. $core.addMethod(
  6201. $core.method({
  6202. selector: "*",
  6203. protocol: "arithmetic",
  6204. fn: function (aPoint){
  6205. var self=this,$self=this;
  6206. return $core.withContext(function($ctx1) {
  6207. var $2,$4,$3,$1,$6,$5;
  6208. $2=$self._x();
  6209. $ctx1.sendIdx["x"]=1;
  6210. $4=$recv(aPoint)._asPoint();
  6211. $ctx1.sendIdx["asPoint"]=1;
  6212. $3=$recv($4)._x();
  6213. $1=$recv($2).__star($3);
  6214. $ctx1.sendIdx["*"]=1;
  6215. $6=$self._y();
  6216. $ctx1.sendIdx["y"]=1;
  6217. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6218. return $recv($globals.Point)._x_y_($1,$5);
  6219. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6220. },
  6221. args: ["aPoint"],
  6222. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6223. referencedClasses: ["Point"],
  6224. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6225. }),
  6226. $globals.Point);
  6227. $core.addMethod(
  6228. $core.method({
  6229. selector: "+",
  6230. protocol: "arithmetic",
  6231. fn: function (aPoint){
  6232. var self=this,$self=this;
  6233. return $core.withContext(function($ctx1) {
  6234. var $2,$4,$3,$1,$6,$5;
  6235. $2=$self._x();
  6236. $ctx1.sendIdx["x"]=1;
  6237. $4=$recv(aPoint)._asPoint();
  6238. $ctx1.sendIdx["asPoint"]=1;
  6239. $3=$recv($4)._x();
  6240. $1=$recv($2).__plus($3);
  6241. $ctx1.sendIdx["+"]=1;
  6242. $6=$self._y();
  6243. $ctx1.sendIdx["y"]=1;
  6244. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6245. return $recv($globals.Point)._x_y_($1,$5);
  6246. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6247. },
  6248. args: ["aPoint"],
  6249. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6250. referencedClasses: ["Point"],
  6251. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6252. }),
  6253. $globals.Point);
  6254. $core.addMethod(
  6255. $core.method({
  6256. selector: "-",
  6257. protocol: "arithmetic",
  6258. fn: function (aPoint){
  6259. var self=this,$self=this;
  6260. return $core.withContext(function($ctx1) {
  6261. var $2,$4,$3,$1,$6,$5;
  6262. $2=$self._x();
  6263. $ctx1.sendIdx["x"]=1;
  6264. $4=$recv(aPoint)._asPoint();
  6265. $ctx1.sendIdx["asPoint"]=1;
  6266. $3=$recv($4)._x();
  6267. $1=$recv($2).__minus($3);
  6268. $ctx1.sendIdx["-"]=1;
  6269. $6=$self._y();
  6270. $ctx1.sendIdx["y"]=1;
  6271. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6272. return $recv($globals.Point)._x_y_($1,$5);
  6273. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6274. },
  6275. args: ["aPoint"],
  6276. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6277. referencedClasses: ["Point"],
  6278. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6279. }),
  6280. $globals.Point);
  6281. $core.addMethod(
  6282. $core.method({
  6283. selector: "/",
  6284. protocol: "arithmetic",
  6285. fn: function (aPoint){
  6286. var self=this,$self=this;
  6287. return $core.withContext(function($ctx1) {
  6288. var $2,$4,$3,$1,$6,$5;
  6289. $2=$self._x();
  6290. $ctx1.sendIdx["x"]=1;
  6291. $4=$recv(aPoint)._asPoint();
  6292. $ctx1.sendIdx["asPoint"]=1;
  6293. $3=$recv($4)._x();
  6294. $1=$recv($2).__slash($3);
  6295. $ctx1.sendIdx["/"]=1;
  6296. $6=$self._y();
  6297. $ctx1.sendIdx["y"]=1;
  6298. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6299. return $recv($globals.Point)._x_y_($1,$5);
  6300. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6301. },
  6302. args: ["aPoint"],
  6303. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6304. referencedClasses: ["Point"],
  6305. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6306. }),
  6307. $globals.Point);
  6308. $core.addMethod(
  6309. $core.method({
  6310. selector: "<",
  6311. protocol: "comparing",
  6312. fn: function (aPoint){
  6313. var self=this,$self=this;
  6314. return $core.withContext(function($ctx1) {
  6315. var $2,$1,$3;
  6316. $2=$self._x();
  6317. $ctx1.sendIdx["x"]=1;
  6318. $1=$recv($2).__lt($recv(aPoint)._x());
  6319. $ctx1.sendIdx["<"]=1;
  6320. return $recv($1)._and_((function(){
  6321. return $core.withContext(function($ctx2) {
  6322. $3=$self._y();
  6323. $ctx2.sendIdx["y"]=1;
  6324. return $recv($3).__lt($recv(aPoint)._y());
  6325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6326. }));
  6327. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6328. },
  6329. args: ["aPoint"],
  6330. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6331. referencedClasses: [],
  6332. messageSends: ["and:", "<", "x", "y"]
  6333. }),
  6334. $globals.Point);
  6335. $core.addMethod(
  6336. $core.method({
  6337. selector: "<=",
  6338. protocol: "comparing",
  6339. fn: function (aPoint){
  6340. var self=this,$self=this;
  6341. return $core.withContext(function($ctx1) {
  6342. var $2,$1,$3;
  6343. $2=$self._x();
  6344. $ctx1.sendIdx["x"]=1;
  6345. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6346. $ctx1.sendIdx["<="]=1;
  6347. return $recv($1)._and_((function(){
  6348. return $core.withContext(function($ctx2) {
  6349. $3=$self._y();
  6350. $ctx2.sendIdx["y"]=1;
  6351. return $recv($3).__lt_eq($recv(aPoint)._y());
  6352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6353. }));
  6354. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6355. },
  6356. args: ["aPoint"],
  6357. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6358. referencedClasses: [],
  6359. messageSends: ["and:", "<=", "x", "y"]
  6360. }),
  6361. $globals.Point);
  6362. $core.addMethod(
  6363. $core.method({
  6364. selector: "=",
  6365. protocol: "comparing",
  6366. fn: function (aPoint){
  6367. var self=this,$self=this;
  6368. return $core.withContext(function($ctx1) {
  6369. var $2,$1,$4,$3,$6,$5;
  6370. $2=$recv(aPoint)._class();
  6371. $ctx1.sendIdx["class"]=1;
  6372. $1=$recv($2).__eq($self._class());
  6373. $ctx1.sendIdx["="]=1;
  6374. return $recv($1)._and_((function(){
  6375. return $core.withContext(function($ctx2) {
  6376. $4=$recv(aPoint)._x();
  6377. $ctx2.sendIdx["x"]=1;
  6378. $3=$recv($4).__eq($self._x());
  6379. $ctx2.sendIdx["="]=2;
  6380. $6=$recv(aPoint)._y();
  6381. $ctx2.sendIdx["y"]=1;
  6382. $5=$recv($6).__eq($self._y());
  6383. return $recv($3).__and($5);
  6384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6385. }));
  6386. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6387. },
  6388. args: ["aPoint"],
  6389. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6390. referencedClasses: [],
  6391. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6392. }),
  6393. $globals.Point);
  6394. $core.addMethod(
  6395. $core.method({
  6396. selector: ">",
  6397. protocol: "comparing",
  6398. fn: function (aPoint){
  6399. var self=this,$self=this;
  6400. return $core.withContext(function($ctx1) {
  6401. var $2,$1,$3;
  6402. $2=$self._x();
  6403. $ctx1.sendIdx["x"]=1;
  6404. $1=$recv($2).__gt($recv(aPoint)._x());
  6405. $ctx1.sendIdx[">"]=1;
  6406. return $recv($1)._and_((function(){
  6407. return $core.withContext(function($ctx2) {
  6408. $3=$self._y();
  6409. $ctx2.sendIdx["y"]=1;
  6410. return $recv($3).__gt($recv(aPoint)._y());
  6411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6412. }));
  6413. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6414. },
  6415. args: ["aPoint"],
  6416. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6417. referencedClasses: [],
  6418. messageSends: ["and:", ">", "x", "y"]
  6419. }),
  6420. $globals.Point);
  6421. $core.addMethod(
  6422. $core.method({
  6423. selector: ">=",
  6424. protocol: "comparing",
  6425. fn: function (aPoint){
  6426. var self=this,$self=this;
  6427. return $core.withContext(function($ctx1) {
  6428. var $2,$1,$3;
  6429. $2=$self._x();
  6430. $ctx1.sendIdx["x"]=1;
  6431. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6432. $ctx1.sendIdx[">="]=1;
  6433. return $recv($1)._and_((function(){
  6434. return $core.withContext(function($ctx2) {
  6435. $3=$self._y();
  6436. $ctx2.sendIdx["y"]=1;
  6437. return $recv($3).__gt_eq($recv(aPoint)._y());
  6438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6439. }));
  6440. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6441. },
  6442. args: ["aPoint"],
  6443. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6444. referencedClasses: [],
  6445. messageSends: ["and:", ">=", "x", "y"]
  6446. }),
  6447. $globals.Point);
  6448. $core.addMethod(
  6449. $core.method({
  6450. selector: "angle",
  6451. protocol: "geometry",
  6452. fn: function (){
  6453. var self=this,$self=this;
  6454. return $core.withContext(function($ctx1) {
  6455. return $recv($self._y())._arcTan_($self._x());
  6456. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6457. },
  6458. args: [],
  6459. source: "angle\x0a\x09^ self y arcTan: self x",
  6460. referencedClasses: [],
  6461. messageSends: ["arcTan:", "y", "x"]
  6462. }),
  6463. $globals.Point);
  6464. $core.addMethod(
  6465. $core.method({
  6466. selector: "asPoint",
  6467. protocol: "converting",
  6468. fn: function (){
  6469. var self=this,$self=this;
  6470. return self;
  6471. },
  6472. args: [],
  6473. source: "asPoint\x0a\x09^ self",
  6474. referencedClasses: [],
  6475. messageSends: []
  6476. }),
  6477. $globals.Point);
  6478. $core.addMethod(
  6479. $core.method({
  6480. selector: "corner:",
  6481. protocol: "rectangle creation",
  6482. fn: function (aPoint){
  6483. var self=this,$self=this;
  6484. return $core.withContext(function($ctx1) {
  6485. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6486. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6487. },
  6488. args: ["aPoint"],
  6489. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6490. referencedClasses: ["Rectangle"],
  6491. messageSends: ["origin:corner:"]
  6492. }),
  6493. $globals.Point);
  6494. $core.addMethod(
  6495. $core.method({
  6496. selector: "dist:",
  6497. protocol: "transforming",
  6498. fn: function (aPoint){
  6499. var self=this,$self=this;
  6500. var dx,dy;
  6501. return $core.withContext(function($ctx1) {
  6502. var $2,$1;
  6503. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6504. $ctx1.sendIdx["-"]=1;
  6505. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6506. $2=$recv(dx).__star(dx);
  6507. $ctx1.sendIdx["*"]=1;
  6508. $1=$recv($2).__plus($recv(dy).__star(dy));
  6509. return $recv($1)._sqrt();
  6510. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6511. },
  6512. args: ["aPoint"],
  6513. 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",
  6514. referencedClasses: [],
  6515. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6516. }),
  6517. $globals.Point);
  6518. $core.addMethod(
  6519. $core.method({
  6520. selector: "dotProduct:",
  6521. protocol: "point functions",
  6522. fn: function (aPoint){
  6523. var self=this,$self=this;
  6524. return $core.withContext(function($ctx1) {
  6525. var $1;
  6526. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6527. $ctx1.sendIdx["*"]=1;
  6528. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6529. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6530. },
  6531. args: ["aPoint"],
  6532. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6533. referencedClasses: [],
  6534. messageSends: ["+", "*", "x", "y"]
  6535. }),
  6536. $globals.Point);
  6537. $core.addMethod(
  6538. $core.method({
  6539. selector: "extent:",
  6540. protocol: "rectangle creation",
  6541. fn: function (aPoint){
  6542. var self=this,$self=this;
  6543. return $core.withContext(function($ctx1) {
  6544. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6545. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6546. },
  6547. args: ["aPoint"],
  6548. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6549. referencedClasses: ["Rectangle"],
  6550. messageSends: ["origin:extent:"]
  6551. }),
  6552. $globals.Point);
  6553. $core.addMethod(
  6554. $core.method({
  6555. selector: "normal",
  6556. protocol: "point functions",
  6557. fn: function (){
  6558. var self=this,$self=this;
  6559. var n,d;
  6560. return $core.withContext(function($ctx1) {
  6561. var $4,$3,$6,$5,$2,$1;
  6562. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6563. $ctx1.sendIdx["@"]=1;
  6564. $4=$recv(n)._x();
  6565. $ctx1.sendIdx["x"]=1;
  6566. $3=$recv($4).__star($recv(n)._x());
  6567. $ctx1.sendIdx["*"]=1;
  6568. $6=$recv(n)._y();
  6569. $ctx1.sendIdx["y"]=1;
  6570. $5=$recv($6).__star($recv(n)._y());
  6571. d=$recv($3).__plus($5);
  6572. $2=d;
  6573. $1=$recv($2).__eq((0));
  6574. if($core.assert($1)){
  6575. return (-1).__at((0));
  6576. }
  6577. return $recv(n).__slash($recv(d)._sqrt());
  6578. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6579. },
  6580. args: [],
  6581. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6582. referencedClasses: [],
  6583. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6584. }),
  6585. $globals.Point);
  6586. $core.addMethod(
  6587. $core.method({
  6588. selector: "normalized",
  6589. protocol: "point functions",
  6590. fn: function (){
  6591. var self=this,$self=this;
  6592. var r;
  6593. return $core.withContext(function($ctx1) {
  6594. var $1,$2,$3;
  6595. r=$self._r();
  6596. $1=$recv(r).__eq((0));
  6597. if($core.assert($1)){
  6598. $2=$recv($globals.Point)._x_y_((0),(0));
  6599. $ctx1.sendIdx["x:y:"]=1;
  6600. return $2;
  6601. } else {
  6602. $3=$recv($self["@x"]).__slash(r);
  6603. $ctx1.sendIdx["/"]=1;
  6604. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6605. }
  6606. return self;
  6607. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6608. },
  6609. args: [],
  6610. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6611. referencedClasses: ["Point"],
  6612. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6613. }),
  6614. $globals.Point);
  6615. $core.addMethod(
  6616. $core.method({
  6617. selector: "printOn:",
  6618. protocol: "printing",
  6619. fn: function (aStream){
  6620. var self=this,$self=this;
  6621. return $core.withContext(function($ctx1) {
  6622. var $1;
  6623. $recv($self["@x"])._printOn_(aStream);
  6624. $ctx1.sendIdx["printOn:"]=1;
  6625. $recv(aStream)._nextPutAll_("@");
  6626. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6627. return $core.withContext(function($ctx2) {
  6628. return $recv($self["@y"])._negative();
  6629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6630. }));
  6631. if($core.assert($1)){
  6632. $recv(aStream)._space();
  6633. }
  6634. $recv($self["@y"])._printOn_(aStream);
  6635. return self;
  6636. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6637. },
  6638. args: ["aStream"],
  6639. 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",
  6640. referencedClasses: [],
  6641. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6642. }),
  6643. $globals.Point);
  6644. $core.addMethod(
  6645. $core.method({
  6646. selector: "r",
  6647. protocol: "polar coordinates",
  6648. fn: function (){
  6649. var self=this,$self=this;
  6650. return $core.withContext(function($ctx1) {
  6651. var $2,$1;
  6652. $2=$recv($self["@x"]).__star($self["@x"]);
  6653. $ctx1.sendIdx["*"]=1;
  6654. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6655. return $recv($1)._sqrt();
  6656. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6657. },
  6658. args: [],
  6659. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6660. referencedClasses: [],
  6661. messageSends: ["sqrt", "+", "*"]
  6662. }),
  6663. $globals.Point);
  6664. $core.addMethod(
  6665. $core.method({
  6666. selector: "rectangle:",
  6667. protocol: "rectangle creation",
  6668. fn: function (aPoint){
  6669. var self=this,$self=this;
  6670. return $core.withContext(function($ctx1) {
  6671. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6672. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6673. },
  6674. args: ["aPoint"],
  6675. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6676. referencedClasses: ["Rectangle"],
  6677. messageSends: ["point:point:"]
  6678. }),
  6679. $globals.Point);
  6680. $core.addMethod(
  6681. $core.method({
  6682. selector: "translateBy:",
  6683. protocol: "transforming",
  6684. fn: function (delta){
  6685. var self=this,$self=this;
  6686. return $core.withContext(function($ctx1) {
  6687. var $1;
  6688. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6689. $ctx1.sendIdx["+"]=1;
  6690. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6691. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6692. },
  6693. args: ["delta"],
  6694. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6695. referencedClasses: [],
  6696. messageSends: ["@", "+", "x", "y"]
  6697. }),
  6698. $globals.Point);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: "x",
  6702. protocol: "accessing",
  6703. fn: function (){
  6704. var self=this,$self=this;
  6705. return $self["@x"];
  6706. },
  6707. args: [],
  6708. source: "x\x0a\x09^ x",
  6709. referencedClasses: [],
  6710. messageSends: []
  6711. }),
  6712. $globals.Point);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "x:",
  6716. protocol: "accessing",
  6717. fn: function (aNumber){
  6718. var self=this,$self=this;
  6719. $self["@x"]=aNumber;
  6720. return self;
  6721. },
  6722. args: ["aNumber"],
  6723. source: "x: aNumber\x0a\x09x := aNumber",
  6724. referencedClasses: [],
  6725. messageSends: []
  6726. }),
  6727. $globals.Point);
  6728. $core.addMethod(
  6729. $core.method({
  6730. selector: "y",
  6731. protocol: "accessing",
  6732. fn: function (){
  6733. var self=this,$self=this;
  6734. return $self["@y"];
  6735. },
  6736. args: [],
  6737. source: "y\x0a\x09^ y",
  6738. referencedClasses: [],
  6739. messageSends: []
  6740. }),
  6741. $globals.Point);
  6742. $core.addMethod(
  6743. $core.method({
  6744. selector: "y:",
  6745. protocol: "accessing",
  6746. fn: function (aNumber){
  6747. var self=this,$self=this;
  6748. $self["@y"]=aNumber;
  6749. return self;
  6750. },
  6751. args: ["aNumber"],
  6752. source: "y: aNumber\x0a\x09y := aNumber",
  6753. referencedClasses: [],
  6754. messageSends: []
  6755. }),
  6756. $globals.Point);
  6757. $core.addMethod(
  6758. $core.method({
  6759. selector: "classTag",
  6760. protocol: "accessing",
  6761. fn: function (){
  6762. var self=this,$self=this;
  6763. return "magnitude";
  6764. },
  6765. args: [],
  6766. 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'",
  6767. referencedClasses: [],
  6768. messageSends: []
  6769. }),
  6770. $globals.Point.a$cls);
  6771. $core.addMethod(
  6772. $core.method({
  6773. selector: "x:y:",
  6774. protocol: "instance creation",
  6775. fn: function (aNumber,anotherNumber){
  6776. var self=this,$self=this;
  6777. return $core.withContext(function($ctx1) {
  6778. var $1;
  6779. $1=$self._new();
  6780. $recv($1)._x_(aNumber);
  6781. $recv($1)._y_(anotherNumber);
  6782. return $recv($1)._yourself();
  6783. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6784. },
  6785. args: ["aNumber", "anotherNumber"],
  6786. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6787. referencedClasses: [],
  6788. messageSends: ["x:", "new", "y:", "yourself"]
  6789. }),
  6790. $globals.Point.a$cls);
  6791. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6792. $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'`.";
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "next",
  6796. protocol: "accessing",
  6797. fn: function (){
  6798. var self=this,$self=this;
  6799. return $core.withContext(function($ctx1) {
  6800. return Math.random();
  6801. return self;
  6802. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6803. },
  6804. args: [],
  6805. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6806. referencedClasses: [],
  6807. messageSends: []
  6808. }),
  6809. $globals.Random);
  6810. $core.addMethod(
  6811. $core.method({
  6812. selector: "next:",
  6813. protocol: "accessing",
  6814. fn: function (anInteger){
  6815. var self=this,$self=this;
  6816. return $core.withContext(function($ctx1) {
  6817. return $recv((1)._to_(anInteger))._collect_((function(each){
  6818. return $core.withContext(function($ctx2) {
  6819. return $self._next();
  6820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6821. }));
  6822. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6823. },
  6824. args: ["anInteger"],
  6825. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6826. referencedClasses: [],
  6827. messageSends: ["collect:", "to:", "next"]
  6828. }),
  6829. $globals.Random);
  6830. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6831. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6832. $core.addMethod(
  6833. $core.method({
  6834. selector: "=",
  6835. protocol: "testing",
  6836. fn: function (aRectangle){
  6837. var self=this,$self=this;
  6838. return $core.withContext(function($ctx1) {
  6839. var $1;
  6840. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6841. $ctx1.sendIdx["="]=1;
  6842. return $recv($1)._and_((function(){
  6843. return $core.withContext(function($ctx2) {
  6844. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6846. }));
  6847. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6848. },
  6849. args: ["aRectangle"],
  6850. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6851. referencedClasses: [],
  6852. messageSends: ["and:", "=", "origin", "corner"]
  6853. }),
  6854. $globals.Rectangle);
  6855. $core.addMethod(
  6856. $core.method({
  6857. selector: "containsPoint:",
  6858. protocol: "testing",
  6859. fn: function (aPoint){
  6860. var self=this,$self=this;
  6861. return $core.withContext(function($ctx1) {
  6862. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6863. return $core.withContext(function($ctx2) {
  6864. return $recv($self["@corner"]).__gt_eq(aPoint);
  6865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6866. }));
  6867. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6868. },
  6869. args: ["aPoint"],
  6870. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6871. referencedClasses: [],
  6872. messageSends: ["and:", "<=", ">="]
  6873. }),
  6874. $globals.Rectangle);
  6875. $core.addMethod(
  6876. $core.method({
  6877. selector: "containsRect:",
  6878. protocol: "testing",
  6879. fn: function (aRect){
  6880. var self=this,$self=this;
  6881. return $core.withContext(function($ctx1) {
  6882. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6883. return $core.withContext(function($ctx2) {
  6884. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6886. }));
  6887. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6888. },
  6889. args: ["aRect"],
  6890. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6891. referencedClasses: [],
  6892. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6893. }),
  6894. $globals.Rectangle);
  6895. $core.addMethod(
  6896. $core.method({
  6897. selector: "corner",
  6898. protocol: "accessing",
  6899. fn: function (){
  6900. var self=this,$self=this;
  6901. return $self["@corner"];
  6902. },
  6903. args: [],
  6904. source: "corner\x0a\x09^ corner",
  6905. referencedClasses: [],
  6906. messageSends: []
  6907. }),
  6908. $globals.Rectangle);
  6909. $core.addMethod(
  6910. $core.method({
  6911. selector: "origin",
  6912. protocol: "accessing",
  6913. fn: function (){
  6914. var self=this,$self=this;
  6915. return $self["@origin"];
  6916. },
  6917. args: [],
  6918. source: "origin\x0a\x09^ origin",
  6919. referencedClasses: [],
  6920. messageSends: []
  6921. }),
  6922. $globals.Rectangle);
  6923. $core.addMethod(
  6924. $core.method({
  6925. selector: "printOn:",
  6926. protocol: "testing",
  6927. fn: function (aStream){
  6928. var self=this,$self=this;
  6929. return $core.withContext(function($ctx1) {
  6930. $recv($self["@origin"])._printOn_(aStream);
  6931. $ctx1.sendIdx["printOn:"]=1;
  6932. $recv(aStream)._nextPutAll_(" corner: ");
  6933. $recv($self["@corner"])._printOn_(aStream);
  6934. return self;
  6935. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6936. },
  6937. args: ["aStream"],
  6938. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6939. referencedClasses: [],
  6940. messageSends: ["printOn:", "nextPutAll:"]
  6941. }),
  6942. $globals.Rectangle);
  6943. $core.addMethod(
  6944. $core.method({
  6945. selector: "setPoint:point:",
  6946. protocol: "private",
  6947. fn: function (pt1,pt2){
  6948. var self=this,$self=this;
  6949. return $core.withContext(function($ctx1) {
  6950. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6951. $2=$recv(pt1)._x();
  6952. $ctx1.sendIdx["x"]=1;
  6953. $3=$recv(pt2)._x();
  6954. $ctx1.sendIdx["x"]=2;
  6955. $1=$recv($2)._min_($3);
  6956. $ctx1.sendIdx["min:"]=1;
  6957. $5=$recv(pt1)._y();
  6958. $ctx1.sendIdx["y"]=1;
  6959. $6=$recv(pt2)._y();
  6960. $ctx1.sendIdx["y"]=2;
  6961. $4=$recv($5)._min_($6);
  6962. $self["@origin"]=$recv($1).__at($4);
  6963. $ctx1.sendIdx["@"]=1;
  6964. $8=$recv(pt1)._x();
  6965. $ctx1.sendIdx["x"]=3;
  6966. $7=$recv($8)._max_($recv(pt2)._x());
  6967. $ctx1.sendIdx["max:"]=1;
  6968. $10=$recv(pt1)._y();
  6969. $ctx1.sendIdx["y"]=3;
  6970. $9=$recv($10)._max_($recv(pt2)._y());
  6971. $self["@corner"]=$recv($7).__at($9);
  6972. return self;
  6973. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6974. },
  6975. args: ["pt1", "pt2"],
  6976. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6977. referencedClasses: [],
  6978. messageSends: ["@", "min:", "x", "y", "max:"]
  6979. }),
  6980. $globals.Rectangle);
  6981. $core.addMethod(
  6982. $core.method({
  6983. selector: "origin:corner:",
  6984. protocol: "instance creation",
  6985. fn: function (anOrigin,aCorner){
  6986. var self=this,$self=this;
  6987. return $core.withContext(function($ctx1) {
  6988. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6989. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6990. },
  6991. args: ["anOrigin", "aCorner"],
  6992. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6993. referencedClasses: [],
  6994. messageSends: ["setPoint:point:", "basicNew"]
  6995. }),
  6996. $globals.Rectangle.a$cls);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "origin:extent:",
  7000. protocol: "instance creation",
  7001. fn: function (anOrigin,anExtent){
  7002. var self=this,$self=this;
  7003. return $core.withContext(function($ctx1) {
  7004. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7005. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  7006. },
  7007. args: ["anOrigin", "anExtent"],
  7008. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7009. referencedClasses: [],
  7010. messageSends: ["setPoint:point:", "basicNew", "+"]
  7011. }),
  7012. $globals.Rectangle.a$cls);
  7013. $core.addMethod(
  7014. $core.method({
  7015. selector: "point:point:",
  7016. protocol: "instance creation",
  7017. fn: function (anOrigin,aCorner){
  7018. var self=this,$self=this;
  7019. return $core.withContext(function($ctx1) {
  7020. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7021. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7022. },
  7023. args: ["anOrigin", "aCorner"],
  7024. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7025. referencedClasses: [],
  7026. messageSends: ["setPoint:point:", "basicNew"]
  7027. }),
  7028. $globals.Rectangle.a$cls);
  7029. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7030. $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`.";
  7031. $core.addMethod(
  7032. $core.method({
  7033. selector: "==",
  7034. protocol: "testing",
  7035. fn: function (anObject){
  7036. var self=this,$self=this;
  7037. return $core.withContext(function($ctx1) {
  7038. return $recv(anObject)._isNil();
  7039. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7040. },
  7041. args: ["anObject"],
  7042. source: "== anObject\x0a\x09^ anObject isNil",
  7043. referencedClasses: [],
  7044. messageSends: ["isNil"]
  7045. }),
  7046. $globals.UndefinedObject);
  7047. $core.addMethod(
  7048. $core.method({
  7049. selector: "asJavaScriptObject",
  7050. protocol: "converting",
  7051. fn: function (){
  7052. var self=this,$self=this;
  7053. return null;
  7054. },
  7055. args: [],
  7056. source: "asJavaScriptObject\x0a\x09^ null",
  7057. referencedClasses: [],
  7058. messageSends: []
  7059. }),
  7060. $globals.UndefinedObject);
  7061. $core.addMethod(
  7062. $core.method({
  7063. selector: "deepCopy",
  7064. protocol: "copying",
  7065. fn: function (){
  7066. var self=this,$self=this;
  7067. return self;
  7068. },
  7069. args: [],
  7070. source: "deepCopy\x0a\x09^ self",
  7071. referencedClasses: [],
  7072. messageSends: []
  7073. }),
  7074. $globals.UndefinedObject);
  7075. $core.addMethod(
  7076. $core.method({
  7077. selector: "identityHash",
  7078. protocol: "accessing",
  7079. fn: function (){
  7080. var self=this,$self=this;
  7081. return "NIL";
  7082. },
  7083. args: [],
  7084. source: "identityHash\x0a\x09^ 'NIL'",
  7085. referencedClasses: [],
  7086. messageSends: []
  7087. }),
  7088. $globals.UndefinedObject);
  7089. $core.addMethod(
  7090. $core.method({
  7091. selector: "ifNil:",
  7092. protocol: "testing",
  7093. fn: function (aBlock){
  7094. var self=this,$self=this;
  7095. return $core.withContext(function($ctx1) {
  7096. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7097. }));
  7098. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7099. },
  7100. args: ["aBlock"],
  7101. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7102. referencedClasses: [],
  7103. messageSends: ["ifNil:ifNotNil:"]
  7104. }),
  7105. $globals.UndefinedObject);
  7106. $core.addMethod(
  7107. $core.method({
  7108. selector: "ifNil:ifNotNil:",
  7109. protocol: "testing",
  7110. fn: function (aBlock,anotherBlock){
  7111. var self=this,$self=this;
  7112. return $core.withContext(function($ctx1) {
  7113. return $recv(aBlock)._value();
  7114. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7115. },
  7116. args: ["aBlock", "anotherBlock"],
  7117. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7118. referencedClasses: [],
  7119. messageSends: ["value"]
  7120. }),
  7121. $globals.UndefinedObject);
  7122. $core.addMethod(
  7123. $core.method({
  7124. selector: "ifNotNil:",
  7125. protocol: "testing",
  7126. fn: function (aBlock){
  7127. var self=this,$self=this;
  7128. return self;
  7129. },
  7130. args: ["aBlock"],
  7131. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7132. referencedClasses: [],
  7133. messageSends: []
  7134. }),
  7135. $globals.UndefinedObject);
  7136. $core.addMethod(
  7137. $core.method({
  7138. selector: "ifNotNil:ifNil:",
  7139. protocol: "testing",
  7140. fn: function (aBlock,anotherBlock){
  7141. var self=this,$self=this;
  7142. return $core.withContext(function($ctx1) {
  7143. return $recv(anotherBlock)._value();
  7144. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7145. },
  7146. args: ["aBlock", "anotherBlock"],
  7147. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7148. referencedClasses: [],
  7149. messageSends: ["value"]
  7150. }),
  7151. $globals.UndefinedObject);
  7152. $core.addMethod(
  7153. $core.method({
  7154. selector: "isImmutable",
  7155. protocol: "testing",
  7156. fn: function (){
  7157. var self=this,$self=this;
  7158. return true;
  7159. },
  7160. args: [],
  7161. source: "isImmutable\x0a\x09^ true",
  7162. referencedClasses: [],
  7163. messageSends: []
  7164. }),
  7165. $globals.UndefinedObject);
  7166. $core.addMethod(
  7167. $core.method({
  7168. selector: "isNil",
  7169. protocol: "testing",
  7170. fn: function (){
  7171. var self=this,$self=this;
  7172. return true;
  7173. },
  7174. args: [],
  7175. source: "isNil\x0a\x09^ true",
  7176. referencedClasses: [],
  7177. messageSends: []
  7178. }),
  7179. $globals.UndefinedObject);
  7180. $core.addMethod(
  7181. $core.method({
  7182. selector: "notNil",
  7183. protocol: "testing",
  7184. fn: function (){
  7185. var self=this,$self=this;
  7186. return false;
  7187. },
  7188. args: [],
  7189. source: "notNil\x0a\x09^ false",
  7190. referencedClasses: [],
  7191. messageSends: []
  7192. }),
  7193. $globals.UndefinedObject);
  7194. $core.addMethod(
  7195. $core.method({
  7196. selector: "printOn:",
  7197. protocol: "printing",
  7198. fn: function (aStream){
  7199. var self=this,$self=this;
  7200. return $core.withContext(function($ctx1) {
  7201. $recv(aStream)._nextPutAll_("nil");
  7202. return self;
  7203. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7204. },
  7205. args: ["aStream"],
  7206. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7207. referencedClasses: [],
  7208. messageSends: ["nextPutAll:"]
  7209. }),
  7210. $globals.UndefinedObject);
  7211. $core.addMethod(
  7212. $core.method({
  7213. selector: "shallowCopy",
  7214. protocol: "copying",
  7215. fn: function (){
  7216. var self=this,$self=this;
  7217. return self;
  7218. },
  7219. args: [],
  7220. source: "shallowCopy\x0a\x09^ self",
  7221. referencedClasses: [],
  7222. messageSends: []
  7223. }),
  7224. $globals.UndefinedObject);
  7225. $core.addMethod(
  7226. $core.method({
  7227. selector: "value",
  7228. protocol: "evaluating",
  7229. fn: function (){
  7230. var self=this,$self=this;
  7231. return $core.withContext(function($ctx1) {
  7232. return null;
  7233. return self;
  7234. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7235. },
  7236. args: [],
  7237. source: "value\x0a\x09<inlineJS: 'return null'>",
  7238. referencedClasses: [],
  7239. messageSends: []
  7240. }),
  7241. $globals.UndefinedObject);
  7242. $core.addMethod(
  7243. $core.method({
  7244. selector: "new",
  7245. protocol: "instance creation",
  7246. fn: function (){
  7247. var self=this,$self=this;
  7248. return $core.withContext(function($ctx1) {
  7249. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7250. return self;
  7251. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7252. },
  7253. args: [],
  7254. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7255. referencedClasses: [],
  7256. messageSends: ["error:"]
  7257. }),
  7258. $globals.UndefinedObject.a$cls);
  7259. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7260. });
  7261. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7262. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7263. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7264. var $pkg = $core.addPackage("Kernel-Collections");
  7265. $pkg.innerEval = function (expr) { return eval(expr); };
  7266. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  7267. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7268. $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:`";
  7269. $core.addMethod(
  7270. $core.method({
  7271. selector: "=",
  7272. protocol: "comparing",
  7273. fn: function (anAssociation){
  7274. var self=this,$self=this;
  7275. return $core.withContext(function($ctx1) {
  7276. var $3,$2,$5,$4,$6,$1;
  7277. $3=$self._class();
  7278. $ctx1.sendIdx["class"]=1;
  7279. $2=$recv($3).__eq($recv(anAssociation)._class());
  7280. $ctx1.sendIdx["="]=1;
  7281. $1=$recv($2)._and_((function(){
  7282. return $core.withContext(function($ctx2) {
  7283. $5=$self._key();
  7284. $ctx2.sendIdx["key"]=1;
  7285. $4=$recv($5).__eq($recv(anAssociation)._key());
  7286. $ctx2.sendIdx["="]=2;
  7287. return $recv($4)._and_((function(){
  7288. return $core.withContext(function($ctx3) {
  7289. $6=$self._value();
  7290. $ctx3.sendIdx["value"]=1;
  7291. return $recv($6).__eq($recv(anAssociation)._value());
  7292. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7293. }));
  7294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7295. }));
  7296. $ctx1.sendIdx["and:"]=1;
  7297. return $1;
  7298. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7299. },
  7300. args: ["anAssociation"],
  7301. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7302. referencedClasses: [],
  7303. messageSends: ["and:", "=", "class", "key", "value"]
  7304. }),
  7305. $globals.Association);
  7306. $core.addMethod(
  7307. $core.method({
  7308. selector: "key",
  7309. protocol: "accessing",
  7310. fn: function (){
  7311. var self=this,$self=this;
  7312. return $self["@key"];
  7313. },
  7314. args: [],
  7315. source: "key\x0a\x09^ key",
  7316. referencedClasses: [],
  7317. messageSends: []
  7318. }),
  7319. $globals.Association);
  7320. $core.addMethod(
  7321. $core.method({
  7322. selector: "key:",
  7323. protocol: "accessing",
  7324. fn: function (aKey){
  7325. var self=this,$self=this;
  7326. $self["@key"]=aKey;
  7327. return self;
  7328. },
  7329. args: ["aKey"],
  7330. source: "key: aKey\x0a\x09key := aKey",
  7331. referencedClasses: [],
  7332. messageSends: []
  7333. }),
  7334. $globals.Association);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "printOn:",
  7338. protocol: "printing",
  7339. fn: function (aStream){
  7340. var self=this,$self=this;
  7341. return $core.withContext(function($ctx1) {
  7342. $recv($self._key())._printOn_(aStream);
  7343. $ctx1.sendIdx["printOn:"]=1;
  7344. $recv(aStream)._nextPutAll_(" -> ");
  7345. $recv($self._value())._printOn_(aStream);
  7346. return self;
  7347. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7348. },
  7349. args: ["aStream"],
  7350. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7351. referencedClasses: [],
  7352. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7353. }),
  7354. $globals.Association);
  7355. $core.addMethod(
  7356. $core.method({
  7357. selector: "value",
  7358. protocol: "accessing",
  7359. fn: function (){
  7360. var self=this,$self=this;
  7361. return $self["@value"];
  7362. },
  7363. args: [],
  7364. source: "value\x0a\x09^ value",
  7365. referencedClasses: [],
  7366. messageSends: []
  7367. }),
  7368. $globals.Association);
  7369. $core.addMethod(
  7370. $core.method({
  7371. selector: "value:",
  7372. protocol: "accessing",
  7373. fn: function (aValue){
  7374. var self=this,$self=this;
  7375. $self["@value"]=aValue;
  7376. return self;
  7377. },
  7378. args: ["aValue"],
  7379. source: "value: aValue\x0a\x09value := aValue",
  7380. referencedClasses: [],
  7381. messageSends: []
  7382. }),
  7383. $globals.Association);
  7384. $core.addMethod(
  7385. $core.method({
  7386. selector: "key:value:",
  7387. protocol: "instance creation",
  7388. fn: function (aKey,aValue){
  7389. var self=this,$self=this;
  7390. return $core.withContext(function($ctx1) {
  7391. var $1;
  7392. $1=$self._new();
  7393. $recv($1)._key_(aKey);
  7394. $recv($1)._value_(aValue);
  7395. return $recv($1)._yourself();
  7396. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7397. },
  7398. args: ["aKey", "aValue"],
  7399. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7400. referencedClasses: [],
  7401. messageSends: ["key:", "new", "value:", "yourself"]
  7402. }),
  7403. $globals.Association.a$cls);
  7404. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7405. $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`.";
  7406. $core.addMethod(
  7407. $core.method({
  7408. selector: "bucketOfElement:",
  7409. protocol: "accessing",
  7410. fn: function (anObject){
  7411. var self=this,$self=this;
  7412. return $core.withContext(function($ctx1) {
  7413. var hash = $self['@hashBlock'](anObject);
  7414. if (!hash) return null;
  7415. var buckets = $self['@buckets'],
  7416. bucket = buckets[hash];
  7417. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7418. return bucket;
  7419. ;
  7420. return self;
  7421. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7422. },
  7423. args: ["anObject"],
  7424. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  7425. referencedClasses: [],
  7426. messageSends: []
  7427. }),
  7428. $globals.BucketStore);
  7429. $core.addMethod(
  7430. $core.method({
  7431. selector: "do:",
  7432. protocol: "enumerating",
  7433. fn: function (aBlock){
  7434. var self=this,$self=this;
  7435. return $core.withContext(function($ctx1) {
  7436. var buckets = $self['@buckets'];
  7437. var keys = Object.keys(buckets);
  7438. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7439. ;
  7440. return self;
  7441. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7442. },
  7443. args: ["aBlock"],
  7444. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  7445. referencedClasses: [],
  7446. messageSends: []
  7447. }),
  7448. $globals.BucketStore);
  7449. $core.addMethod(
  7450. $core.method({
  7451. selector: "hashBlock:",
  7452. protocol: "accessing",
  7453. fn: function (aBlock){
  7454. var self=this,$self=this;
  7455. $self["@hashBlock"]=aBlock;
  7456. return self;
  7457. },
  7458. args: ["aBlock"],
  7459. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7460. referencedClasses: [],
  7461. messageSends: []
  7462. }),
  7463. $globals.BucketStore);
  7464. $core.addMethod(
  7465. $core.method({
  7466. selector: "initialize",
  7467. protocol: "initialization",
  7468. fn: function (){
  7469. var self=this,$self=this;
  7470. return $core.withContext(function($ctx1) {
  7471. (
  7472. $ctx1.supercall = true,
  7473. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7474. $ctx1.supercall = false;
  7475. $self._removeAll();
  7476. return self;
  7477. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7478. },
  7479. args: [],
  7480. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7481. referencedClasses: [],
  7482. messageSends: ["initialize", "removeAll"]
  7483. }),
  7484. $globals.BucketStore);
  7485. $core.addMethod(
  7486. $core.method({
  7487. selector: "newBucket",
  7488. protocol: "private",
  7489. fn: function (){
  7490. var self=this,$self=this;
  7491. return $core.withContext(function($ctx1) {
  7492. $self._subclassResponsibility();
  7493. return self;
  7494. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7495. },
  7496. args: [],
  7497. source: "newBucket\x0a\x09self subclassResponsibility",
  7498. referencedClasses: [],
  7499. messageSends: ["subclassResponsibility"]
  7500. }),
  7501. $globals.BucketStore);
  7502. $core.addMethod(
  7503. $core.method({
  7504. selector: "removeAll",
  7505. protocol: "adding/removing",
  7506. fn: function (){
  7507. var self=this,$self=this;
  7508. return $core.withContext(function($ctx1) {
  7509. $self['@buckets'] = Object.create(null);;
  7510. return self;
  7511. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7512. },
  7513. args: [],
  7514. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7515. referencedClasses: [],
  7516. messageSends: []
  7517. }),
  7518. $globals.BucketStore);
  7519. $core.addMethod(
  7520. $core.method({
  7521. selector: "hashBlock:",
  7522. protocol: "instance creation",
  7523. fn: function (aBlock){
  7524. var self=this,$self=this;
  7525. return $core.withContext(function($ctx1) {
  7526. var $1;
  7527. $1=$self._new();
  7528. $recv($1)._hashBlock_(aBlock);
  7529. return $recv($1)._yourself();
  7530. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7531. },
  7532. args: ["aBlock"],
  7533. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7534. referencedClasses: [],
  7535. messageSends: ["hashBlock:", "new", "yourself"]
  7536. }),
  7537. $globals.BucketStore.a$cls);
  7538. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7539. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7540. $core.addMethod(
  7541. $core.method({
  7542. selector: "newBucket",
  7543. protocol: "private",
  7544. fn: function (){
  7545. var self=this,$self=this;
  7546. return [];
  7547. },
  7548. args: [],
  7549. source: "newBucket\x0a\x09^ #()",
  7550. referencedClasses: [],
  7551. messageSends: []
  7552. }),
  7553. $globals.ArrayBucketStore);
  7554. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7555. $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.";
  7556. $core.addMethod(
  7557. $core.method({
  7558. selector: ",",
  7559. protocol: "copying",
  7560. fn: function (aCollection){
  7561. var self=this,$self=this;
  7562. return $core.withContext(function($ctx1) {
  7563. var $1;
  7564. $1=$self._copy();
  7565. $recv($1)._addAll_(aCollection);
  7566. return $recv($1)._yourself();
  7567. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7568. },
  7569. args: ["aCollection"],
  7570. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7571. referencedClasses: [],
  7572. messageSends: ["addAll:", "copy", "yourself"]
  7573. }),
  7574. $globals.Collection);
  7575. $core.addMethod(
  7576. $core.method({
  7577. selector: "add:",
  7578. protocol: "adding/removing",
  7579. fn: function (anObject){
  7580. var self=this,$self=this;
  7581. return $core.withContext(function($ctx1) {
  7582. $self._subclassResponsibility();
  7583. return self;
  7584. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7585. },
  7586. args: ["anObject"],
  7587. source: "add: anObject\x0a\x09self subclassResponsibility",
  7588. referencedClasses: [],
  7589. messageSends: ["subclassResponsibility"]
  7590. }),
  7591. $globals.Collection);
  7592. $core.addMethod(
  7593. $core.method({
  7594. selector: "addAll:",
  7595. protocol: "adding/removing",
  7596. fn: function (aCollection){
  7597. var self=this,$self=this;
  7598. return $core.withContext(function($ctx1) {
  7599. $recv(aCollection)._do_((function(each){
  7600. return $core.withContext(function($ctx2) {
  7601. return $self._add_(each);
  7602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7603. }));
  7604. return aCollection;
  7605. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7606. },
  7607. args: ["aCollection"],
  7608. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7609. referencedClasses: [],
  7610. messageSends: ["do:", "add:"]
  7611. }),
  7612. $globals.Collection);
  7613. $core.addMethod(
  7614. $core.method({
  7615. selector: "allSatisfy:",
  7616. protocol: "enumerating",
  7617. fn: function (aBlock){
  7618. var self=this,$self=this;
  7619. return $core.withContext(function($ctx1) {
  7620. var $1;
  7621. var $early={};
  7622. try {
  7623. $self._do_((function(each){
  7624. return $core.withContext(function($ctx2) {
  7625. $1=$recv(aBlock)._value_(each);
  7626. if(!$core.assert($1)){
  7627. throw $early=[false];
  7628. }
  7629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7630. }));
  7631. return true;
  7632. }
  7633. catch(e) {if(e===$early)return e[0]; throw e}
  7634. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7635. },
  7636. args: ["aBlock"],
  7637. 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",
  7638. referencedClasses: [],
  7639. messageSends: ["do:", "ifFalse:", "value:"]
  7640. }),
  7641. $globals.Collection);
  7642. $core.addMethod(
  7643. $core.method({
  7644. selector: "anyOne",
  7645. protocol: "accessing",
  7646. fn: function (){
  7647. var self=this,$self=this;
  7648. return $core.withContext(function($ctx1) {
  7649. var $early={};
  7650. try {
  7651. $self._ifEmpty_((function(){
  7652. return $core.withContext(function($ctx2) {
  7653. return $self._error_("Collection is empty");
  7654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7655. }));
  7656. $self._do_((function(each){
  7657. throw $early=[each];
  7658. }));
  7659. return self;
  7660. }
  7661. catch(e) {if(e===$early)return e[0]; throw e}
  7662. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7663. },
  7664. args: [],
  7665. 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 ]",
  7666. referencedClasses: [],
  7667. messageSends: ["ifEmpty:", "error:", "do:"]
  7668. }),
  7669. $globals.Collection);
  7670. $core.addMethod(
  7671. $core.method({
  7672. selector: "anySatisfy:",
  7673. protocol: "enumerating",
  7674. fn: function (aBlock){
  7675. var self=this,$self=this;
  7676. return $core.withContext(function($ctx1) {
  7677. var $1;
  7678. var $early={};
  7679. try {
  7680. $self._do_((function(each){
  7681. return $core.withContext(function($ctx2) {
  7682. $1=$recv(aBlock)._value_(each);
  7683. if($core.assert($1)){
  7684. throw $early=[true];
  7685. }
  7686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7687. }));
  7688. return false;
  7689. }
  7690. catch(e) {if(e===$early)return e[0]; throw e}
  7691. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7692. },
  7693. args: ["aBlock"],
  7694. 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",
  7695. referencedClasses: [],
  7696. messageSends: ["do:", "ifTrue:", "value:"]
  7697. }),
  7698. $globals.Collection);
  7699. $core.addMethod(
  7700. $core.method({
  7701. selector: "asArray",
  7702. protocol: "converting",
  7703. fn: function (){
  7704. var self=this,$self=this;
  7705. return $core.withContext(function($ctx1) {
  7706. return $recv($globals.Array)._withAll_(self);
  7707. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7708. },
  7709. args: [],
  7710. source: "asArray\x0a\x09^ Array withAll: self",
  7711. referencedClasses: ["Array"],
  7712. messageSends: ["withAll:"]
  7713. }),
  7714. $globals.Collection);
  7715. $core.addMethod(
  7716. $core.method({
  7717. selector: "asJavaScriptObject",
  7718. protocol: "converting",
  7719. fn: function (){
  7720. var self=this,$self=this;
  7721. return $core.withContext(function($ctx1) {
  7722. return $recv($self._asArray())._collect_((function(each){
  7723. return $core.withContext(function($ctx2) {
  7724. return $recv(each)._asJavaScriptObject();
  7725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7726. }));
  7727. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7728. },
  7729. args: [],
  7730. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7731. referencedClasses: [],
  7732. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7733. }),
  7734. $globals.Collection);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "asOrderedCollection",
  7738. protocol: "converting",
  7739. fn: function (){
  7740. var self=this,$self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. return $self._asArray();
  7743. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7744. },
  7745. args: [],
  7746. source: "asOrderedCollection\x0a\x09^ self asArray",
  7747. referencedClasses: [],
  7748. messageSends: ["asArray"]
  7749. }),
  7750. $globals.Collection);
  7751. $core.addMethod(
  7752. $core.method({
  7753. selector: "asSet",
  7754. protocol: "converting",
  7755. fn: function (){
  7756. var self=this,$self=this;
  7757. return $core.withContext(function($ctx1) {
  7758. return $recv($globals.Set)._withAll_(self);
  7759. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7760. },
  7761. args: [],
  7762. source: "asSet\x0a\x09^ Set withAll: self",
  7763. referencedClasses: ["Set"],
  7764. messageSends: ["withAll:"]
  7765. }),
  7766. $globals.Collection);
  7767. $core.addMethod(
  7768. $core.method({
  7769. selector: "collect:",
  7770. protocol: "enumerating",
  7771. fn: function (aBlock){
  7772. var self=this,$self=this;
  7773. var stream;
  7774. return $core.withContext(function($ctx1) {
  7775. stream=$recv($recv($self._class())._new())._writeStream();
  7776. $self._do_((function(each){
  7777. return $core.withContext(function($ctx2) {
  7778. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7780. }));
  7781. return $recv(stream)._contents();
  7782. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7783. },
  7784. args: ["aBlock"],
  7785. 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",
  7786. referencedClasses: [],
  7787. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7788. }),
  7789. $globals.Collection);
  7790. $core.addMethod(
  7791. $core.method({
  7792. selector: "copyWith:",
  7793. protocol: "copying",
  7794. fn: function (anObject){
  7795. var self=this,$self=this;
  7796. return $core.withContext(function($ctx1) {
  7797. var $1;
  7798. $1=$self._copy();
  7799. $recv($1)._add_(anObject);
  7800. return $recv($1)._yourself();
  7801. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7802. },
  7803. args: ["anObject"],
  7804. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7805. referencedClasses: [],
  7806. messageSends: ["add:", "copy", "yourself"]
  7807. }),
  7808. $globals.Collection);
  7809. $core.addMethod(
  7810. $core.method({
  7811. selector: "copyWithAll:",
  7812. protocol: "copying",
  7813. fn: function (aCollection){
  7814. var self=this,$self=this;
  7815. return $core.withContext(function($ctx1) {
  7816. $self._deprecatedAPI_("Use #, instead.");
  7817. return $self.__comma(aCollection);
  7818. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7819. },
  7820. args: ["aCollection"],
  7821. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7822. referencedClasses: [],
  7823. messageSends: ["deprecatedAPI:", ","]
  7824. }),
  7825. $globals.Collection);
  7826. $core.addMethod(
  7827. $core.method({
  7828. selector: "copyWithout:",
  7829. protocol: "copying",
  7830. fn: function (anObject){
  7831. var self=this,$self=this;
  7832. return $core.withContext(function($ctx1) {
  7833. return $self._reject_((function(each){
  7834. return $core.withContext(function($ctx2) {
  7835. return $recv(each).__eq(anObject);
  7836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7837. }));
  7838. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7839. },
  7840. args: ["anObject"],
  7841. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  7842. referencedClasses: [],
  7843. messageSends: ["reject:", "="]
  7844. }),
  7845. $globals.Collection);
  7846. $core.addMethod(
  7847. $core.method({
  7848. selector: "copyWithoutAll:",
  7849. protocol: "copying",
  7850. fn: function (aCollection){
  7851. var self=this,$self=this;
  7852. return $core.withContext(function($ctx1) {
  7853. return $self._reject_((function(each){
  7854. return $core.withContext(function($ctx2) {
  7855. return $recv(aCollection)._includes_(each);
  7856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7857. }));
  7858. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7859. },
  7860. args: ["aCollection"],
  7861. 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 ]",
  7862. referencedClasses: [],
  7863. messageSends: ["reject:", "includes:"]
  7864. }),
  7865. $globals.Collection);
  7866. $core.addMethod(
  7867. $core.method({
  7868. selector: "deepCopy",
  7869. protocol: "copying",
  7870. fn: function (){
  7871. var self=this,$self=this;
  7872. return $core.withContext(function($ctx1) {
  7873. return $self._collect_((function(each){
  7874. return $core.withContext(function($ctx2) {
  7875. return $recv(each)._deepCopy();
  7876. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7877. }));
  7878. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7879. },
  7880. args: [],
  7881. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7882. referencedClasses: [],
  7883. messageSends: ["collect:", "deepCopy"]
  7884. }),
  7885. $globals.Collection);
  7886. $core.addMethod(
  7887. $core.method({
  7888. selector: "detect:",
  7889. protocol: "enumerating",
  7890. fn: function (aBlock){
  7891. var self=this,$self=this;
  7892. return $core.withContext(function($ctx1) {
  7893. return $self._detect_ifNone_(aBlock,(function(){
  7894. return $core.withContext(function($ctx2) {
  7895. return $self._errorNotFound();
  7896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7897. }));
  7898. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7899. },
  7900. args: ["aBlock"],
  7901. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7902. referencedClasses: [],
  7903. messageSends: ["detect:ifNone:", "errorNotFound"]
  7904. }),
  7905. $globals.Collection);
  7906. $core.addMethod(
  7907. $core.method({
  7908. selector: "detect:ifNone:",
  7909. protocol: "enumerating",
  7910. fn: function (aBlock,anotherBlock){
  7911. var self=this,$self=this;
  7912. return $core.withContext(function($ctx1) {
  7913. var $1;
  7914. var $early={};
  7915. try {
  7916. $self._do_((function(each){
  7917. return $core.withContext(function($ctx2) {
  7918. $1=$recv(aBlock)._value_(each);
  7919. if($core.assert($1)){
  7920. throw $early=[each];
  7921. }
  7922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7923. }));
  7924. return $recv(anotherBlock)._value();
  7925. }
  7926. catch(e) {if(e===$early)return e[0]; throw e}
  7927. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7928. },
  7929. args: ["aBlock", "anotherBlock"],
  7930. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7931. referencedClasses: [],
  7932. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7933. }),
  7934. $globals.Collection);
  7935. $core.addMethod(
  7936. $core.method({
  7937. selector: "do:",
  7938. protocol: "enumerating",
  7939. fn: function (aBlock){
  7940. var self=this,$self=this;
  7941. return $core.withContext(function($ctx1) {
  7942. $self._subclassResponsibility();
  7943. return self;
  7944. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7945. },
  7946. args: ["aBlock"],
  7947. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7948. referencedClasses: [],
  7949. messageSends: ["subclassResponsibility"]
  7950. }),
  7951. $globals.Collection);
  7952. $core.addMethod(
  7953. $core.method({
  7954. selector: "do:separatedBy:",
  7955. protocol: "enumerating",
  7956. fn: function (aBlock,anotherBlock){
  7957. var self=this,$self=this;
  7958. var actionBeforeElement;
  7959. return $core.withContext(function($ctx1) {
  7960. actionBeforeElement=(function(){
  7961. actionBeforeElement=anotherBlock;
  7962. return actionBeforeElement;
  7963. });
  7964. $self._do_((function(each){
  7965. return $core.withContext(function($ctx2) {
  7966. $recv(actionBeforeElement)._value();
  7967. return $recv(aBlock)._value_(each);
  7968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7969. }));
  7970. return self;
  7971. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7972. },
  7973. args: ["aBlock", "anotherBlock"],
  7974. 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 ]",
  7975. referencedClasses: [],
  7976. messageSends: ["do:", "value", "value:"]
  7977. }),
  7978. $globals.Collection);
  7979. $core.addMethod(
  7980. $core.method({
  7981. selector: "errorNotFound",
  7982. protocol: "error handling",
  7983. fn: function (){
  7984. var self=this,$self=this;
  7985. return $core.withContext(function($ctx1) {
  7986. $self._error_("Object is not in the collection");
  7987. return self;
  7988. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7989. },
  7990. args: [],
  7991. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7992. referencedClasses: [],
  7993. messageSends: ["error:"]
  7994. }),
  7995. $globals.Collection);
  7996. $core.addMethod(
  7997. $core.method({
  7998. selector: "ifEmpty:",
  7999. protocol: "testing",
  8000. fn: function (aBlock){
  8001. var self=this,$self=this;
  8002. return $core.withContext(function($ctx1) {
  8003. var $1;
  8004. $1=$self._isEmpty();
  8005. if($core.assert($1)){
  8006. return $recv(aBlock)._value();
  8007. } else {
  8008. return self;
  8009. }
  8010. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  8011. },
  8012. args: ["aBlock"],
  8013. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  8014. referencedClasses: [],
  8015. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8016. }),
  8017. $globals.Collection);
  8018. $core.addMethod(
  8019. $core.method({
  8020. selector: "ifEmpty:ifNotEmpty:",
  8021. protocol: "testing",
  8022. fn: function (aBlock,anotherBlock){
  8023. var self=this,$self=this;
  8024. return $core.withContext(function($ctx1) {
  8025. var $1;
  8026. $1=$self._isEmpty();
  8027. if($core.assert($1)){
  8028. return $recv(aBlock)._value();
  8029. } else {
  8030. return $recv(anotherBlock)._value_(self);
  8031. }
  8032. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8033. },
  8034. args: ["aBlock", "anotherBlock"],
  8035. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8036. referencedClasses: [],
  8037. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8038. }),
  8039. $globals.Collection);
  8040. $core.addMethod(
  8041. $core.method({
  8042. selector: "ifNotEmpty:",
  8043. protocol: "testing",
  8044. fn: function (aBlock){
  8045. var self=this,$self=this;
  8046. return $core.withContext(function($ctx1) {
  8047. var $1;
  8048. $1=$self._notEmpty();
  8049. if($core.assert($1)){
  8050. return $recv(aBlock)._value_(self);
  8051. } else {
  8052. return self;
  8053. }
  8054. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8055. },
  8056. args: ["aBlock"],
  8057. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8058. referencedClasses: [],
  8059. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8060. }),
  8061. $globals.Collection);
  8062. $core.addMethod(
  8063. $core.method({
  8064. selector: "ifNotEmpty:ifEmpty:",
  8065. protocol: "testing",
  8066. fn: function (aBlock,anotherBlock){
  8067. var self=this,$self=this;
  8068. return $core.withContext(function($ctx1) {
  8069. var $1;
  8070. $1=$self._notEmpty();
  8071. if($core.assert($1)){
  8072. return $recv(aBlock)._value_(self);
  8073. } else {
  8074. return $recv(anotherBlock)._value();
  8075. }
  8076. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8077. },
  8078. args: ["aBlock", "anotherBlock"],
  8079. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8080. referencedClasses: [],
  8081. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8082. }),
  8083. $globals.Collection);
  8084. $core.addMethod(
  8085. $core.method({
  8086. selector: "includes:",
  8087. protocol: "testing",
  8088. fn: function (anObject){
  8089. var self=this,$self=this;
  8090. return $core.withContext(function($ctx1) {
  8091. return $self._anySatisfy_((function(each){
  8092. return $core.withContext(function($ctx2) {
  8093. return $recv(each).__eq(anObject);
  8094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8095. }));
  8096. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8097. },
  8098. args: ["anObject"],
  8099. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8100. referencedClasses: [],
  8101. messageSends: ["anySatisfy:", "="]
  8102. }),
  8103. $globals.Collection);
  8104. $core.addMethod(
  8105. $core.method({
  8106. selector: "inject:into:",
  8107. protocol: "enumerating",
  8108. fn: function (anObject,aBlock){
  8109. var self=this,$self=this;
  8110. var result;
  8111. return $core.withContext(function($ctx1) {
  8112. result=anObject;
  8113. $self._do_((function(each){
  8114. return $core.withContext(function($ctx2) {
  8115. result=$recv(aBlock)._value_value_(result,each);
  8116. return result;
  8117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8118. }));
  8119. return result;
  8120. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8121. },
  8122. args: ["anObject", "aBlock"],
  8123. 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",
  8124. referencedClasses: [],
  8125. messageSends: ["do:", "value:value:"]
  8126. }),
  8127. $globals.Collection);
  8128. $core.addMethod(
  8129. $core.method({
  8130. selector: "intersection:",
  8131. protocol: "enumerating",
  8132. fn: function (aCollection){
  8133. var self=this,$self=this;
  8134. var set,outputSet;
  8135. return $core.withContext(function($ctx1) {
  8136. var $2,$1;
  8137. set=$self._asSet();
  8138. outputSet=$recv($globals.Set)._new();
  8139. $recv(aCollection)._do_((function(each){
  8140. return $core.withContext(function($ctx2) {
  8141. $2=$recv(set)._includes_(each);
  8142. $ctx2.sendIdx["includes:"]=1;
  8143. $1=$recv($2)._and_((function(){
  8144. return $core.withContext(function($ctx3) {
  8145. return $recv($recv(outputSet)._includes_(each))._not();
  8146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8147. }));
  8148. if($core.assert($1)){
  8149. return $recv(outputSet)._add_(each);
  8150. }
  8151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8152. }));
  8153. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8154. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8155. },
  8156. args: ["aCollection"],
  8157. 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",
  8158. referencedClasses: ["Set"],
  8159. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8160. }),
  8161. $globals.Collection);
  8162. $core.addMethod(
  8163. $core.method({
  8164. selector: "isEmpty",
  8165. protocol: "testing",
  8166. fn: function (){
  8167. var self=this,$self=this;
  8168. return $core.withContext(function($ctx1) {
  8169. return $recv($self._size()).__eq((0));
  8170. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8171. },
  8172. args: [],
  8173. source: "isEmpty\x0a\x09^ self size = 0",
  8174. referencedClasses: [],
  8175. messageSends: ["=", "size"]
  8176. }),
  8177. $globals.Collection);
  8178. $core.addMethod(
  8179. $core.method({
  8180. selector: "noneSatisfy:",
  8181. protocol: "enumerating",
  8182. fn: function (aBlock){
  8183. var self=this,$self=this;
  8184. return $core.withContext(function($ctx1) {
  8185. var $1;
  8186. var $early={};
  8187. try {
  8188. $self._do_((function(item){
  8189. return $core.withContext(function($ctx2) {
  8190. $1=$recv(aBlock)._value_(item);
  8191. if($core.assert($1)){
  8192. throw $early=[false];
  8193. }
  8194. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8195. }));
  8196. return true;
  8197. }
  8198. catch(e) {if(e===$early)return e[0]; throw e}
  8199. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8200. },
  8201. args: ["aBlock"],
  8202. 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",
  8203. referencedClasses: [],
  8204. messageSends: ["do:", "ifTrue:", "value:"]
  8205. }),
  8206. $globals.Collection);
  8207. $core.addMethod(
  8208. $core.method({
  8209. selector: "notEmpty",
  8210. protocol: "testing",
  8211. fn: function (){
  8212. var self=this,$self=this;
  8213. return $core.withContext(function($ctx1) {
  8214. return $recv($self._isEmpty())._not();
  8215. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8216. },
  8217. args: [],
  8218. source: "notEmpty\x0a\x09^ self isEmpty not",
  8219. referencedClasses: [],
  8220. messageSends: ["not", "isEmpty"]
  8221. }),
  8222. $globals.Collection);
  8223. $core.addMethod(
  8224. $core.method({
  8225. selector: "occurrencesOf:",
  8226. protocol: "accessing",
  8227. fn: function (anObject){
  8228. var self=this,$self=this;
  8229. var tally;
  8230. return $core.withContext(function($ctx1) {
  8231. var $1;
  8232. tally=(0);
  8233. $self._do_((function(each){
  8234. return $core.withContext(function($ctx2) {
  8235. $1=$recv(anObject).__eq(each);
  8236. if($core.assert($1)){
  8237. tally=$recv(tally).__plus((1));
  8238. return tally;
  8239. }
  8240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8241. }));
  8242. return tally;
  8243. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8244. },
  8245. args: ["anObject"],
  8246. 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",
  8247. referencedClasses: [],
  8248. messageSends: ["do:", "ifTrue:", "=", "+"]
  8249. }),
  8250. $globals.Collection);
  8251. $core.addMethod(
  8252. $core.method({
  8253. selector: "putOn:",
  8254. protocol: "streaming",
  8255. fn: function (aStream){
  8256. var self=this,$self=this;
  8257. return $core.withContext(function($ctx1) {
  8258. $self._do_((function(each){
  8259. return $core.withContext(function($ctx2) {
  8260. return $recv(each)._putOn_(aStream);
  8261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8262. }));
  8263. return self;
  8264. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8265. },
  8266. args: ["aStream"],
  8267. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8268. referencedClasses: [],
  8269. messageSends: ["do:", "putOn:"]
  8270. }),
  8271. $globals.Collection);
  8272. $core.addMethod(
  8273. $core.method({
  8274. selector: "reject:",
  8275. protocol: "enumerating",
  8276. fn: function (aBlock){
  8277. var self=this,$self=this;
  8278. return $core.withContext(function($ctx1) {
  8279. return $self._select_((function(each){
  8280. return $core.withContext(function($ctx2) {
  8281. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8283. }));
  8284. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8285. },
  8286. args: ["aBlock"],
  8287. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8288. referencedClasses: [],
  8289. messageSends: ["select:", "=", "value:"]
  8290. }),
  8291. $globals.Collection);
  8292. $core.addMethod(
  8293. $core.method({
  8294. selector: "remove:",
  8295. protocol: "adding/removing",
  8296. fn: function (anObject){
  8297. var self=this,$self=this;
  8298. return $core.withContext(function($ctx1) {
  8299. return $self._remove_ifAbsent_(anObject,(function(){
  8300. return $core.withContext(function($ctx2) {
  8301. return $self._errorNotFound();
  8302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8303. }));
  8304. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8305. },
  8306. args: ["anObject"],
  8307. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8308. referencedClasses: [],
  8309. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8310. }),
  8311. $globals.Collection);
  8312. $core.addMethod(
  8313. $core.method({
  8314. selector: "remove:ifAbsent:",
  8315. protocol: "adding/removing",
  8316. fn: function (anObject,aBlock){
  8317. var self=this,$self=this;
  8318. return $core.withContext(function($ctx1) {
  8319. $self._subclassResponsibility();
  8320. return self;
  8321. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8322. },
  8323. args: ["anObject", "aBlock"],
  8324. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8325. referencedClasses: [],
  8326. messageSends: ["subclassResponsibility"]
  8327. }),
  8328. $globals.Collection);
  8329. $core.addMethod(
  8330. $core.method({
  8331. selector: "removeAll",
  8332. protocol: "adding/removing",
  8333. fn: function (){
  8334. var self=this,$self=this;
  8335. return $core.withContext(function($ctx1) {
  8336. $self._subclassResponsibility();
  8337. return self;
  8338. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8339. },
  8340. args: [],
  8341. source: "removeAll\x0a\x09self subclassResponsibility",
  8342. referencedClasses: [],
  8343. messageSends: ["subclassResponsibility"]
  8344. }),
  8345. $globals.Collection);
  8346. $core.addMethod(
  8347. $core.method({
  8348. selector: "select:",
  8349. protocol: "enumerating",
  8350. fn: function (aBlock){
  8351. var self=this,$self=this;
  8352. var stream;
  8353. return $core.withContext(function($ctx1) {
  8354. var $1;
  8355. stream=$recv($recv($self._class())._new())._writeStream();
  8356. $self._do_((function(each){
  8357. return $core.withContext(function($ctx2) {
  8358. $1=$recv(aBlock)._value_(each);
  8359. if($core.assert($1)){
  8360. return $recv(stream)._nextPut_(each);
  8361. }
  8362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8363. }));
  8364. return $recv(stream)._contents();
  8365. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8366. },
  8367. args: ["aBlock"],
  8368. 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",
  8369. referencedClasses: [],
  8370. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8371. }),
  8372. $globals.Collection);
  8373. $core.addMethod(
  8374. $core.method({
  8375. selector: "select:thenCollect:",
  8376. protocol: "enumerating",
  8377. fn: function (selectBlock,collectBlock){
  8378. var self=this,$self=this;
  8379. var stream;
  8380. return $core.withContext(function($ctx1) {
  8381. var $1;
  8382. stream=$recv($recv($self._class())._new())._writeStream();
  8383. $self._do_((function(each){
  8384. return $core.withContext(function($ctx2) {
  8385. $1=$recv(selectBlock)._value_(each);
  8386. $ctx2.sendIdx["value:"]=1;
  8387. if($core.assert($1)){
  8388. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8389. }
  8390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8391. }));
  8392. return $recv(stream)._contents();
  8393. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8394. },
  8395. args: ["selectBlock", "collectBlock"],
  8396. 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",
  8397. referencedClasses: [],
  8398. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8399. }),
  8400. $globals.Collection);
  8401. $core.addMethod(
  8402. $core.method({
  8403. selector: "shallowCopy",
  8404. protocol: "copying",
  8405. fn: function (){
  8406. var self=this,$self=this;
  8407. return $core.withContext(function($ctx1) {
  8408. return $self._collect_((function(each){
  8409. return each;
  8410. }));
  8411. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8412. },
  8413. args: [],
  8414. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8415. referencedClasses: [],
  8416. messageSends: ["collect:"]
  8417. }),
  8418. $globals.Collection);
  8419. $core.addMethod(
  8420. $core.method({
  8421. selector: "single",
  8422. protocol: "accessing",
  8423. fn: function (){
  8424. var self=this,$self=this;
  8425. return $core.withContext(function($ctx1) {
  8426. var $1;
  8427. $self._ifEmpty_((function(){
  8428. return $core.withContext(function($ctx2) {
  8429. return $self._error_("Collection is empty");
  8430. $ctx2.sendIdx["error:"]=1;
  8431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8432. }));
  8433. $1=$recv($self._size()).__gt((1));
  8434. if($core.assert($1)){
  8435. $self._error_("Collection holds more than one element");
  8436. }
  8437. return $self._anyOne();
  8438. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8439. },
  8440. args: [],
  8441. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  8442. referencedClasses: [],
  8443. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8444. }),
  8445. $globals.Collection);
  8446. $core.addMethod(
  8447. $core.method({
  8448. selector: "size",
  8449. protocol: "accessing",
  8450. fn: function (){
  8451. var self=this,$self=this;
  8452. return $core.withContext(function($ctx1) {
  8453. $self._subclassResponsibility();
  8454. return self;
  8455. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8456. },
  8457. args: [],
  8458. source: "size\x0a\x09self subclassResponsibility",
  8459. referencedClasses: [],
  8460. messageSends: ["subclassResponsibility"]
  8461. }),
  8462. $globals.Collection);
  8463. $core.addMethod(
  8464. $core.method({
  8465. selector: "classTag",
  8466. protocol: "accessing",
  8467. fn: function (){
  8468. var self=this,$self=this;
  8469. return "collection";
  8470. },
  8471. args: [],
  8472. 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'",
  8473. referencedClasses: [],
  8474. messageSends: []
  8475. }),
  8476. $globals.Collection.a$cls);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "new:",
  8480. protocol: "instance creation",
  8481. fn: function (anInteger){
  8482. var self=this,$self=this;
  8483. return $core.withContext(function($ctx1) {
  8484. return $self._new();
  8485. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8486. },
  8487. args: ["anInteger"],
  8488. source: "new: anInteger\x0a\x09^ self new",
  8489. referencedClasses: [],
  8490. messageSends: ["new"]
  8491. }),
  8492. $globals.Collection.a$cls);
  8493. $core.addMethod(
  8494. $core.method({
  8495. selector: "with:",
  8496. protocol: "instance creation",
  8497. fn: function (anObject){
  8498. var self=this,$self=this;
  8499. return $core.withContext(function($ctx1) {
  8500. var $1;
  8501. $1=$self._new();
  8502. $recv($1)._add_(anObject);
  8503. return $recv($1)._yourself();
  8504. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8505. },
  8506. args: ["anObject"],
  8507. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8508. referencedClasses: [],
  8509. messageSends: ["add:", "new", "yourself"]
  8510. }),
  8511. $globals.Collection.a$cls);
  8512. $core.addMethod(
  8513. $core.method({
  8514. selector: "with:with:",
  8515. protocol: "instance creation",
  8516. fn: function (anObject,anotherObject){
  8517. var self=this,$self=this;
  8518. return $core.withContext(function($ctx1) {
  8519. var $1;
  8520. $1=$self._new();
  8521. $recv($1)._add_(anObject);
  8522. $ctx1.sendIdx["add:"]=1;
  8523. $recv($1)._add_(anotherObject);
  8524. return $recv($1)._yourself();
  8525. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8526. },
  8527. args: ["anObject", "anotherObject"],
  8528. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8529. referencedClasses: [],
  8530. messageSends: ["add:", "new", "yourself"]
  8531. }),
  8532. $globals.Collection.a$cls);
  8533. $core.addMethod(
  8534. $core.method({
  8535. selector: "with:with:with:",
  8536. protocol: "instance creation",
  8537. fn: function (firstObject,secondObject,thirdObject){
  8538. var self=this,$self=this;
  8539. return $core.withContext(function($ctx1) {
  8540. var $1;
  8541. $1=$self._new();
  8542. $recv($1)._add_(firstObject);
  8543. $ctx1.sendIdx["add:"]=1;
  8544. $recv($1)._add_(secondObject);
  8545. $ctx1.sendIdx["add:"]=2;
  8546. $recv($1)._add_(thirdObject);
  8547. return $recv($1)._yourself();
  8548. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8549. },
  8550. args: ["firstObject", "secondObject", "thirdObject"],
  8551. 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",
  8552. referencedClasses: [],
  8553. messageSends: ["add:", "new", "yourself"]
  8554. }),
  8555. $globals.Collection.a$cls);
  8556. $core.addMethod(
  8557. $core.method({
  8558. selector: "withAll:",
  8559. protocol: "instance creation",
  8560. fn: function (aCollection){
  8561. var self=this,$self=this;
  8562. return $core.withContext(function($ctx1) {
  8563. var $1;
  8564. $1=$self._new();
  8565. $recv($1)._addAll_(aCollection);
  8566. return $recv($1)._yourself();
  8567. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8568. },
  8569. args: ["aCollection"],
  8570. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8571. referencedClasses: [],
  8572. messageSends: ["addAll:", "new", "yourself"]
  8573. }),
  8574. $globals.Collection.a$cls);
  8575. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8576. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8577. $core.addMethod(
  8578. $core.method({
  8579. selector: "=",
  8580. protocol: "comparing",
  8581. fn: function (anAssocitativeCollection){
  8582. var self=this,$self=this;
  8583. return $core.withContext(function($ctx1) {
  8584. var $2,$1,$4,$3,$5;
  8585. $2=$self._class();
  8586. $ctx1.sendIdx["class"]=1;
  8587. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8588. $ctx1.sendIdx["="]=1;
  8589. if(!$core.assert($1)){
  8590. return false;
  8591. }
  8592. $4=$self._size();
  8593. $ctx1.sendIdx["size"]=1;
  8594. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8595. $ctx1.sendIdx["="]=2;
  8596. if(!$core.assert($3)){
  8597. return false;
  8598. }
  8599. $5=$self._associations();
  8600. $ctx1.sendIdx["associations"]=1;
  8601. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8602. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8603. },
  8604. args: ["anAssocitativeCollection"],
  8605. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8606. referencedClasses: [],
  8607. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8608. }),
  8609. $globals.AssociativeCollection);
  8610. $core.addMethod(
  8611. $core.method({
  8612. selector: "add:",
  8613. protocol: "adding/removing",
  8614. fn: function (anAssociation){
  8615. var self=this,$self=this;
  8616. return $core.withContext(function($ctx1) {
  8617. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8618. return self;
  8619. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8620. },
  8621. args: ["anAssociation"],
  8622. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8623. referencedClasses: [],
  8624. messageSends: ["at:put:", "key", "value"]
  8625. }),
  8626. $globals.AssociativeCollection);
  8627. $core.addMethod(
  8628. $core.method({
  8629. selector: "addAll:",
  8630. protocol: "adding/removing",
  8631. fn: function (anAssociativeCollection){
  8632. var self=this,$self=this;
  8633. return $core.withContext(function($ctx1) {
  8634. (
  8635. $ctx1.supercall = true,
  8636. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8637. $ctx1.supercall = false;
  8638. return anAssociativeCollection;
  8639. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8640. },
  8641. args: ["anAssociativeCollection"],
  8642. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8643. referencedClasses: [],
  8644. messageSends: ["addAll:", "associations"]
  8645. }),
  8646. $globals.AssociativeCollection);
  8647. $core.addMethod(
  8648. $core.method({
  8649. selector: "asDictionary",
  8650. protocol: "converting",
  8651. fn: function (){
  8652. var self=this,$self=this;
  8653. return $core.withContext(function($ctx1) {
  8654. return $recv($globals.Dictionary)._from_($self._associations());
  8655. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8656. },
  8657. args: [],
  8658. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8659. referencedClasses: ["Dictionary"],
  8660. messageSends: ["from:", "associations"]
  8661. }),
  8662. $globals.AssociativeCollection);
  8663. $core.addMethod(
  8664. $core.method({
  8665. selector: "asHashedCollection",
  8666. protocol: "converting",
  8667. fn: function (){
  8668. var self=this,$self=this;
  8669. return $core.withContext(function($ctx1) {
  8670. return $recv($globals.HashedCollection)._from_($self._associations());
  8671. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8672. },
  8673. args: [],
  8674. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8675. referencedClasses: ["HashedCollection"],
  8676. messageSends: ["from:", "associations"]
  8677. }),
  8678. $globals.AssociativeCollection);
  8679. $core.addMethod(
  8680. $core.method({
  8681. selector: "asJavaScriptObject",
  8682. protocol: "converting",
  8683. fn: function (){
  8684. var self=this,$self=this;
  8685. var hash;
  8686. return $core.withContext(function($ctx1) {
  8687. hash=$recv($globals.HashedCollection)._new();
  8688. $self._keysAndValuesDo_((function(key,value){
  8689. return $core.withContext(function($ctx2) {
  8690. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8691. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8692. }));
  8693. return hash;
  8694. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8695. },
  8696. args: [],
  8697. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  8698. referencedClasses: ["HashedCollection"],
  8699. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8700. }),
  8701. $globals.AssociativeCollection);
  8702. $core.addMethod(
  8703. $core.method({
  8704. selector: "associations",
  8705. protocol: "accessing",
  8706. fn: function (){
  8707. var self=this,$self=this;
  8708. var associations;
  8709. return $core.withContext(function($ctx1) {
  8710. associations=[];
  8711. $self._associationsDo_((function(each){
  8712. return $core.withContext(function($ctx2) {
  8713. return $recv(associations)._add_(each);
  8714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8715. }));
  8716. return associations;
  8717. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8718. },
  8719. args: [],
  8720. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8721. referencedClasses: [],
  8722. messageSends: ["associationsDo:", "add:"]
  8723. }),
  8724. $globals.AssociativeCollection);
  8725. $core.addMethod(
  8726. $core.method({
  8727. selector: "associationsDo:",
  8728. protocol: "enumerating",
  8729. fn: function (aBlock){
  8730. var self=this,$self=this;
  8731. return $core.withContext(function($ctx1) {
  8732. $self._keysAndValuesDo_((function(key,value){
  8733. return $core.withContext(function($ctx2) {
  8734. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8735. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8736. }));
  8737. return self;
  8738. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8739. },
  8740. args: ["aBlock"],
  8741. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8742. referencedClasses: ["Association"],
  8743. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8744. }),
  8745. $globals.AssociativeCollection);
  8746. $core.addMethod(
  8747. $core.method({
  8748. selector: "at:ifPresent:ifAbsent:",
  8749. protocol: "accessing",
  8750. fn: function (aKey,aBlock,anotherBlock){
  8751. var self=this,$self=this;
  8752. return $core.withContext(function($ctx1) {
  8753. var $1;
  8754. $1=$self._includesKey_(aKey);
  8755. if($core.assert($1)){
  8756. return $recv(aBlock)._value_($self._at_(aKey));
  8757. } else {
  8758. return $recv(anotherBlock)._value();
  8759. }
  8760. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8761. },
  8762. args: ["aKey", "aBlock", "anotherBlock"],
  8763. 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 ]",
  8764. referencedClasses: [],
  8765. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8766. }),
  8767. $globals.AssociativeCollection);
  8768. $core.addMethod(
  8769. $core.method({
  8770. selector: "collect:",
  8771. protocol: "enumerating",
  8772. fn: function (aBlock){
  8773. var self=this,$self=this;
  8774. var newDict;
  8775. return $core.withContext(function($ctx1) {
  8776. newDict=$recv($self._class())._new();
  8777. $self._keysAndValuesDo_((function(key,value){
  8778. return $core.withContext(function($ctx2) {
  8779. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8780. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8781. }));
  8782. return newDict;
  8783. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8784. },
  8785. args: ["aBlock"],
  8786. 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",
  8787. referencedClasses: [],
  8788. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8789. }),
  8790. $globals.AssociativeCollection);
  8791. $core.addMethod(
  8792. $core.method({
  8793. selector: "deepCopy",
  8794. protocol: "copying",
  8795. fn: function (){
  8796. var self=this,$self=this;
  8797. var copy;
  8798. return $core.withContext(function($ctx1) {
  8799. copy=$recv($self._class())._new();
  8800. $self._keysAndValuesDo_((function(key,value){
  8801. return $core.withContext(function($ctx2) {
  8802. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8803. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8804. }));
  8805. return copy;
  8806. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8807. },
  8808. args: [],
  8809. 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",
  8810. referencedClasses: [],
  8811. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8812. }),
  8813. $globals.AssociativeCollection);
  8814. $core.addMethod(
  8815. $core.method({
  8816. selector: "detect:ifNone:",
  8817. protocol: "enumerating",
  8818. fn: function (aBlock,anotherBlock){
  8819. var self=this,$self=this;
  8820. return $core.withContext(function($ctx1) {
  8821. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8822. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8823. },
  8824. args: ["aBlock", "anotherBlock"],
  8825. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8826. referencedClasses: [],
  8827. messageSends: ["detect:ifNone:", "values"]
  8828. }),
  8829. $globals.AssociativeCollection);
  8830. $core.addMethod(
  8831. $core.method({
  8832. selector: "do:",
  8833. protocol: "enumerating",
  8834. fn: function (aBlock){
  8835. var self=this,$self=this;
  8836. return $core.withContext(function($ctx1) {
  8837. $self._valuesDo_(aBlock);
  8838. return self;
  8839. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8840. },
  8841. args: ["aBlock"],
  8842. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8843. referencedClasses: [],
  8844. messageSends: ["valuesDo:"]
  8845. }),
  8846. $globals.AssociativeCollection);
  8847. $core.addMethod(
  8848. $core.method({
  8849. selector: "includes:",
  8850. protocol: "enumerating",
  8851. fn: function (anObject){
  8852. var self=this,$self=this;
  8853. return $core.withContext(function($ctx1) {
  8854. return $recv($self._values())._includes_(anObject);
  8855. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8856. },
  8857. args: ["anObject"],
  8858. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8859. referencedClasses: [],
  8860. messageSends: ["includes:", "values"]
  8861. }),
  8862. $globals.AssociativeCollection);
  8863. $core.addMethod(
  8864. $core.method({
  8865. selector: "includesKey:",
  8866. protocol: "testing",
  8867. fn: function (aKey){
  8868. var self=this,$self=this;
  8869. return $core.withContext(function($ctx1) {
  8870. $self._subclassResponsibility();
  8871. return self;
  8872. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8873. },
  8874. args: ["aKey"],
  8875. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8876. referencedClasses: [],
  8877. messageSends: ["subclassResponsibility"]
  8878. }),
  8879. $globals.AssociativeCollection);
  8880. $core.addMethod(
  8881. $core.method({
  8882. selector: "indexOf:ifAbsent:",
  8883. protocol: "accessing",
  8884. fn: function (anObject,aBlock){
  8885. var self=this,$self=this;
  8886. return $core.withContext(function($ctx1) {
  8887. return $recv($self._keys())._detect_ifNone_((function(each){
  8888. return $core.withContext(function($ctx2) {
  8889. return $recv($self._at_(each)).__eq(anObject);
  8890. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8891. }),aBlock);
  8892. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8893. },
  8894. args: ["anObject", "aBlock"],
  8895. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8896. referencedClasses: [],
  8897. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8898. }),
  8899. $globals.AssociativeCollection);
  8900. $core.addMethod(
  8901. $core.method({
  8902. selector: "keyAtValue:",
  8903. protocol: "accessing",
  8904. fn: function (anObject){
  8905. var self=this,$self=this;
  8906. return $core.withContext(function($ctx1) {
  8907. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8908. return $core.withContext(function($ctx2) {
  8909. return $self._errorNotFound();
  8910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8911. }));
  8912. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8913. },
  8914. args: ["anObject"],
  8915. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8916. referencedClasses: [],
  8917. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8918. }),
  8919. $globals.AssociativeCollection);
  8920. $core.addMethod(
  8921. $core.method({
  8922. selector: "keyAtValue:ifAbsent:",
  8923. protocol: "accessing",
  8924. fn: function (anObject,aBlock){
  8925. var self=this,$self=this;
  8926. return $core.withContext(function($ctx1) {
  8927. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8928. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8929. },
  8930. args: ["anObject", "aBlock"],
  8931. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8932. referencedClasses: [],
  8933. messageSends: ["indexOf:ifAbsent:"]
  8934. }),
  8935. $globals.AssociativeCollection);
  8936. $core.addMethod(
  8937. $core.method({
  8938. selector: "keys",
  8939. protocol: "accessing",
  8940. fn: function (){
  8941. var self=this,$self=this;
  8942. return $core.withContext(function($ctx1) {
  8943. $self._subclassResponsibility();
  8944. return self;
  8945. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8946. },
  8947. args: [],
  8948. source: "keys\x0a\x09self subclassResponsibility",
  8949. referencedClasses: [],
  8950. messageSends: ["subclassResponsibility"]
  8951. }),
  8952. $globals.AssociativeCollection);
  8953. $core.addMethod(
  8954. $core.method({
  8955. selector: "keysAndValuesDo:",
  8956. protocol: "enumerating",
  8957. fn: function (aBlock){
  8958. var self=this,$self=this;
  8959. return $core.withContext(function($ctx1) {
  8960. $self._keysDo_((function(each){
  8961. return $core.withContext(function($ctx2) {
  8962. return $recv(aBlock)._value_value_(each,$self._at_(each));
  8963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8964. }));
  8965. return self;
  8966. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8967. },
  8968. args: ["aBlock"],
  8969. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8970. referencedClasses: [],
  8971. messageSends: ["keysDo:", "value:value:", "at:"]
  8972. }),
  8973. $globals.AssociativeCollection);
  8974. $core.addMethod(
  8975. $core.method({
  8976. selector: "keysDo:",
  8977. protocol: "enumerating",
  8978. fn: function (aBlock){
  8979. var self=this,$self=this;
  8980. return $core.withContext(function($ctx1) {
  8981. $self._subclassResponsibility();
  8982. return self;
  8983. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8984. },
  8985. args: ["aBlock"],
  8986. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  8987. referencedClasses: [],
  8988. messageSends: ["subclassResponsibility"]
  8989. }),
  8990. $globals.AssociativeCollection);
  8991. $core.addMethod(
  8992. $core.method({
  8993. selector: "printOn:",
  8994. protocol: "printing",
  8995. fn: function (aStream){
  8996. var self=this,$self=this;
  8997. return $core.withContext(function($ctx1) {
  8998. (
  8999. $ctx1.supercall = true,
  9000. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9001. $ctx1.supercall = false;
  9002. $ctx1.sendIdx["printOn:"]=1;
  9003. $recv(aStream)._nextPutAll_(" (");
  9004. $ctx1.sendIdx["nextPutAll:"]=1;
  9005. $recv($self._associations())._do_separatedBy_((function(each){
  9006. return $core.withContext(function($ctx2) {
  9007. return $recv(each)._printOn_(aStream);
  9008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9009. }),(function(){
  9010. return $core.withContext(function($ctx2) {
  9011. return $recv(aStream)._nextPutAll_(" , ");
  9012. $ctx2.sendIdx["nextPutAll:"]=2;
  9013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9014. }));
  9015. $recv(aStream)._nextPutAll_(")");
  9016. return self;
  9017. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9018. },
  9019. args: ["aStream"],
  9020. 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: ')'",
  9021. referencedClasses: [],
  9022. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9023. }),
  9024. $globals.AssociativeCollection);
  9025. $core.addMethod(
  9026. $core.method({
  9027. selector: "remove:ifAbsent:",
  9028. protocol: "adding/removing",
  9029. fn: function (aKey,aBlock){
  9030. var self=this,$self=this;
  9031. return $core.withContext(function($ctx1) {
  9032. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9033. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9034. },
  9035. args: ["aKey", "aBlock"],
  9036. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9037. referencedClasses: [],
  9038. messageSends: ["removeKey:ifAbsent:"]
  9039. }),
  9040. $globals.AssociativeCollection);
  9041. $core.addMethod(
  9042. $core.method({
  9043. selector: "removeAll",
  9044. protocol: "adding/removing",
  9045. fn: function (){
  9046. var self=this,$self=this;
  9047. return $core.withContext(function($ctx1) {
  9048. return $recv($self._keys())._do_((function(each){
  9049. return $core.withContext(function($ctx2) {
  9050. return $self._removeKey_(each);
  9051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9052. }));
  9053. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9054. },
  9055. args: [],
  9056. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9057. referencedClasses: [],
  9058. messageSends: ["do:", "keys", "removeKey:"]
  9059. }),
  9060. $globals.AssociativeCollection);
  9061. $core.addMethod(
  9062. $core.method({
  9063. selector: "removeKey:",
  9064. protocol: "adding/removing",
  9065. fn: function (aKey){
  9066. var self=this,$self=this;
  9067. return $core.withContext(function($ctx1) {
  9068. return $self._remove_(aKey);
  9069. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9070. },
  9071. args: ["aKey"],
  9072. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9073. referencedClasses: [],
  9074. messageSends: ["remove:"]
  9075. }),
  9076. $globals.AssociativeCollection);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "removeKey:ifAbsent:",
  9080. protocol: "adding/removing",
  9081. fn: function (aKey,aBlock){
  9082. var self=this,$self=this;
  9083. return $core.withContext(function($ctx1) {
  9084. $self._subclassResponsibility();
  9085. return self;
  9086. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9087. },
  9088. args: ["aKey", "aBlock"],
  9089. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9090. referencedClasses: [],
  9091. messageSends: ["subclassResponsibility"]
  9092. }),
  9093. $globals.AssociativeCollection);
  9094. $core.addMethod(
  9095. $core.method({
  9096. selector: "select:",
  9097. protocol: "enumerating",
  9098. fn: function (aBlock){
  9099. var self=this,$self=this;
  9100. var newDict;
  9101. return $core.withContext(function($ctx1) {
  9102. var $1;
  9103. newDict=$recv($self._class())._new();
  9104. $self._keysAndValuesDo_((function(key,value){
  9105. return $core.withContext(function($ctx2) {
  9106. $1=$recv(aBlock)._value_(value);
  9107. if($core.assert($1)){
  9108. return $recv(newDict)._at_put_(key,value);
  9109. }
  9110. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9111. }));
  9112. return newDict;
  9113. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9114. },
  9115. args: ["aBlock"],
  9116. 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",
  9117. referencedClasses: [],
  9118. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9119. }),
  9120. $globals.AssociativeCollection);
  9121. $core.addMethod(
  9122. $core.method({
  9123. selector: "select:thenCollect:",
  9124. protocol: "enumerating",
  9125. fn: function (selectBlock,collectBlock){
  9126. var self=this,$self=this;
  9127. var newDict;
  9128. return $core.withContext(function($ctx1) {
  9129. var $1;
  9130. newDict=$recv($self._class())._new();
  9131. $self._keysAndValuesDo_((function(key,value){
  9132. return $core.withContext(function($ctx2) {
  9133. $1=$recv(selectBlock)._value_(value);
  9134. $ctx2.sendIdx["value:"]=1;
  9135. if($core.assert($1)){
  9136. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9137. }
  9138. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9139. }));
  9140. return newDict;
  9141. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9142. },
  9143. args: ["selectBlock", "collectBlock"],
  9144. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  9145. referencedClasses: [],
  9146. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9147. }),
  9148. $globals.AssociativeCollection);
  9149. $core.addMethod(
  9150. $core.method({
  9151. selector: "shallowCopy",
  9152. protocol: "copying",
  9153. fn: function (){
  9154. var self=this,$self=this;
  9155. var copy;
  9156. return $core.withContext(function($ctx1) {
  9157. copy=$recv($self._class())._new();
  9158. $self._keysAndValuesDo_((function(key,value){
  9159. return $core.withContext(function($ctx2) {
  9160. return $recv(copy)._at_put_(key,value);
  9161. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9162. }));
  9163. return copy;
  9164. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9165. },
  9166. args: [],
  9167. 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",
  9168. referencedClasses: [],
  9169. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9170. }),
  9171. $globals.AssociativeCollection);
  9172. $core.addMethod(
  9173. $core.method({
  9174. selector: "size",
  9175. protocol: "accessing",
  9176. fn: function (){
  9177. var self=this,$self=this;
  9178. return $core.withContext(function($ctx1) {
  9179. return $recv($self._keys())._size();
  9180. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9181. },
  9182. args: [],
  9183. source: "size\x0a\x09^ self keys size",
  9184. referencedClasses: [],
  9185. messageSends: ["size", "keys"]
  9186. }),
  9187. $globals.AssociativeCollection);
  9188. $core.addMethod(
  9189. $core.method({
  9190. selector: "values",
  9191. protocol: "accessing",
  9192. fn: function (){
  9193. var self=this,$self=this;
  9194. return $core.withContext(function($ctx1) {
  9195. $self._subclassResponsibility();
  9196. return self;
  9197. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9198. },
  9199. args: [],
  9200. source: "values\x0a\x09self subclassResponsibility",
  9201. referencedClasses: [],
  9202. messageSends: ["subclassResponsibility"]
  9203. }),
  9204. $globals.AssociativeCollection);
  9205. $core.addMethod(
  9206. $core.method({
  9207. selector: "valuesDo:",
  9208. protocol: "enumerating",
  9209. fn: function (aBlock){
  9210. var self=this,$self=this;
  9211. return $core.withContext(function($ctx1) {
  9212. $self._subclassResponsibility();
  9213. return self;
  9214. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9215. },
  9216. args: ["aBlock"],
  9217. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9218. referencedClasses: [],
  9219. messageSends: ["subclassResponsibility"]
  9220. }),
  9221. $globals.AssociativeCollection);
  9222. $core.addMethod(
  9223. $core.method({
  9224. selector: "withIndexDo:",
  9225. protocol: "enumerating",
  9226. fn: function (aBlock){
  9227. var self=this,$self=this;
  9228. return $core.withContext(function($ctx1) {
  9229. $self._keysAndValuesDo_((function(key,value){
  9230. return $core.withContext(function($ctx2) {
  9231. return $recv(aBlock)._value_value_(value,key);
  9232. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9233. }));
  9234. return self;
  9235. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9236. },
  9237. args: ["aBlock"],
  9238. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9239. referencedClasses: [],
  9240. messageSends: ["keysAndValuesDo:", "value:value:"]
  9241. }),
  9242. $globals.AssociativeCollection);
  9243. $core.addMethod(
  9244. $core.method({
  9245. selector: "from:",
  9246. protocol: "instance creation",
  9247. fn: function (aCollection){
  9248. var self=this,$self=this;
  9249. var newCollection;
  9250. return $core.withContext(function($ctx1) {
  9251. newCollection=$self._new();
  9252. $recv(aCollection)._do_((function(each){
  9253. return $core.withContext(function($ctx2) {
  9254. return $recv(newCollection)._add_(each);
  9255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9256. }));
  9257. return newCollection;
  9258. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9259. },
  9260. args: ["aCollection"],
  9261. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9262. referencedClasses: [],
  9263. messageSends: ["new", "do:", "add:"]
  9264. }),
  9265. $globals.AssociativeCollection.a$cls);
  9266. $core.addMethod(
  9267. $core.method({
  9268. selector: "fromPairs:",
  9269. protocol: "instance creation",
  9270. fn: function (aCollection){
  9271. var self=this,$self=this;
  9272. return $core.withContext(function($ctx1) {
  9273. return $self._from_(aCollection);
  9274. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9275. },
  9276. args: ["aCollection"],
  9277. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9278. referencedClasses: [],
  9279. messageSends: ["from:"]
  9280. }),
  9281. $globals.AssociativeCollection.a$cls);
  9282. $core.addMethod(
  9283. $core.method({
  9284. selector: "newFromPairs:",
  9285. protocol: "instance creation",
  9286. fn: function (aCollection){
  9287. var self=this,$self=this;
  9288. var newCollection;
  9289. return $core.withContext(function($ctx1) {
  9290. var $2,$1,$3,$4;
  9291. $2=$recv(aCollection)._size();
  9292. $ctx1.sendIdx["size"]=1;
  9293. $1=$recv($2)._even();
  9294. if(!$core.assert($1)){
  9295. $self._error_("#newFromPairs only accepts arrays of an even length");
  9296. }
  9297. newCollection=$self._new();
  9298. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9299. return $core.withContext(function($ctx2) {
  9300. $3=newCollection;
  9301. $4=$recv(aCollection)._at_(each);
  9302. $ctx2.sendIdx["at:"]=1;
  9303. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9305. }));
  9306. return newCollection;
  9307. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9308. },
  9309. args: ["aCollection"],
  9310. 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",
  9311. referencedClasses: [],
  9312. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9313. }),
  9314. $globals.AssociativeCollection.a$cls);
  9315. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9316. $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.";
  9317. $core.addMethod(
  9318. $core.method({
  9319. selector: "at:ifAbsent:",
  9320. protocol: "accessing",
  9321. fn: function (aKey,aBlock){
  9322. var self=this,$self=this;
  9323. return $core.withContext(function($ctx1) {
  9324. var index = $self._positionOfKey_(aKey);
  9325. return index >=0 ? $self['@values'][index] : aBlock._value();
  9326. ;
  9327. return self;
  9328. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9329. },
  9330. args: ["aKey", "aBlock"],
  9331. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self[''@values''][index] : aBlock._value();\x0a\x09'>",
  9332. referencedClasses: [],
  9333. messageSends: []
  9334. }),
  9335. $globals.Dictionary);
  9336. $core.addMethod(
  9337. $core.method({
  9338. selector: "at:put:",
  9339. protocol: "accessing",
  9340. fn: function (aKey,aValue){
  9341. var self=this,$self=this;
  9342. return $core.withContext(function($ctx1) {
  9343. var index = $self._positionOfKey_(aKey);
  9344. if(index === -1) {
  9345. var keys = $self['@keys'];
  9346. index = keys.length;
  9347. keys.push(aKey);
  9348. }
  9349. return $self['@values'][index] = aValue;
  9350. ;
  9351. return self;
  9352. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9353. },
  9354. args: ["aKey", "aValue"],
  9355. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self[''@keys''];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self[''@values''][index] = aValue;\x0a\x09'>",
  9356. referencedClasses: [],
  9357. messageSends: []
  9358. }),
  9359. $globals.Dictionary);
  9360. $core.addMethod(
  9361. $core.method({
  9362. selector: "includesKey:",
  9363. protocol: "testing",
  9364. fn: function (aKey){
  9365. var self=this,$self=this;
  9366. return $core.withContext(function($ctx1) {
  9367. return $self._positionOfKey_(aKey) >= 0;;
  9368. return self;
  9369. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9370. },
  9371. args: ["aKey"],
  9372. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9373. referencedClasses: [],
  9374. messageSends: []
  9375. }),
  9376. $globals.Dictionary);
  9377. $core.addMethod(
  9378. $core.method({
  9379. selector: "indexOf:ifAbsent:",
  9380. protocol: "accessing",
  9381. fn: function (anObject,aBlock){
  9382. var self=this,$self=this;
  9383. var index;
  9384. return $core.withContext(function($ctx1) {
  9385. var $1;
  9386. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9387. return (0);
  9388. }));
  9389. $1=$recv(index).__eq((0));
  9390. if($core.assert($1)){
  9391. return $recv(aBlock)._value();
  9392. } else {
  9393. return $recv($self["@keys"])._at_(index);
  9394. }
  9395. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9396. },
  9397. args: ["anObject", "aBlock"],
  9398. 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 ]",
  9399. referencedClasses: [],
  9400. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9401. }),
  9402. $globals.Dictionary);
  9403. $core.addMethod(
  9404. $core.method({
  9405. selector: "initialize",
  9406. protocol: "initialization",
  9407. fn: function (){
  9408. var self=this,$self=this;
  9409. return $core.withContext(function($ctx1) {
  9410. (
  9411. $ctx1.supercall = true,
  9412. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9413. $ctx1.supercall = false;
  9414. $self["@keys"]=[];
  9415. $self["@values"]=[];
  9416. return self;
  9417. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9418. },
  9419. args: [],
  9420. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9421. referencedClasses: [],
  9422. messageSends: ["initialize"]
  9423. }),
  9424. $globals.Dictionary);
  9425. $core.addMethod(
  9426. $core.method({
  9427. selector: "keys",
  9428. protocol: "accessing",
  9429. fn: function (){
  9430. var self=this,$self=this;
  9431. return $core.withContext(function($ctx1) {
  9432. return $recv($self["@keys"])._copy();
  9433. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9434. },
  9435. args: [],
  9436. source: "keys\x0a\x09^ keys copy",
  9437. referencedClasses: [],
  9438. messageSends: ["copy"]
  9439. }),
  9440. $globals.Dictionary);
  9441. $core.addMethod(
  9442. $core.method({
  9443. selector: "keysAndValuesDo:",
  9444. protocol: "enumerating",
  9445. fn: function (aBlock){
  9446. var self=this,$self=this;
  9447. return $core.withContext(function($ctx1) {
  9448. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9449. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9450. },
  9451. args: ["aBlock"],
  9452. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9453. referencedClasses: [],
  9454. messageSends: ["with:do:"]
  9455. }),
  9456. $globals.Dictionary);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "keysDo:",
  9460. protocol: "enumerating",
  9461. fn: function (aBlock){
  9462. var self=this,$self=this;
  9463. return $core.withContext(function($ctx1) {
  9464. return $recv($self["@keys"])._do_(aBlock);
  9465. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9466. },
  9467. args: ["aBlock"],
  9468. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9469. referencedClasses: [],
  9470. messageSends: ["do:"]
  9471. }),
  9472. $globals.Dictionary);
  9473. $core.addMethod(
  9474. $core.method({
  9475. selector: "positionOfKey:",
  9476. protocol: "private",
  9477. fn: function (anObject){
  9478. var self=this,$self=this;
  9479. return $core.withContext(function($ctx1) {
  9480. var keys = $self['@keys'];
  9481. for(var i=0;i<keys.length;i++){
  9482. if(keys[i].__eq(anObject)) { return i;}
  9483. }
  9484. return -1;
  9485. ;
  9486. return self;
  9487. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9488. },
  9489. args: ["anObject"],
  9490. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self[''@keys''];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  9491. referencedClasses: [],
  9492. messageSends: []
  9493. }),
  9494. $globals.Dictionary);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "removeAll",
  9498. protocol: "adding/removing",
  9499. fn: function (){
  9500. var self=this,$self=this;
  9501. return $core.withContext(function($ctx1) {
  9502. $recv($self["@keys"])._removeAll();
  9503. $ctx1.sendIdx["removeAll"]=1;
  9504. $recv($self["@values"])._removeAll();
  9505. return self;
  9506. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9507. },
  9508. args: [],
  9509. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9510. referencedClasses: [],
  9511. messageSends: ["removeAll"]
  9512. }),
  9513. $globals.Dictionary);
  9514. $core.addMethod(
  9515. $core.method({
  9516. selector: "removeKey:ifAbsent:",
  9517. protocol: "adding/removing",
  9518. fn: function (aKey,aBlock){
  9519. var self=this,$self=this;
  9520. return $core.withContext(function($ctx1) {
  9521. var index = $self._positionOfKey_(aKey);
  9522. if(index === -1) {
  9523. return aBlock._value()
  9524. } else {
  9525. var keys = $self['@keys'], values = $self['@values'];
  9526. var value = values[index], l = keys.length;
  9527. keys[index] = keys[l-1];
  9528. keys.pop();
  9529. values[index] = values[l-1];
  9530. values.pop();
  9531. return value;
  9532. }
  9533. ;
  9534. return self;
  9535. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9536. },
  9537. args: ["aKey", "aBlock"],
  9538. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self[''@keys''], values = $self[''@values''];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  9539. referencedClasses: [],
  9540. messageSends: []
  9541. }),
  9542. $globals.Dictionary);
  9543. $core.addMethod(
  9544. $core.method({
  9545. selector: "values",
  9546. protocol: "accessing",
  9547. fn: function (){
  9548. var self=this,$self=this;
  9549. return $self["@values"];
  9550. },
  9551. args: [],
  9552. source: "values\x0a\x09^ values",
  9553. referencedClasses: [],
  9554. messageSends: []
  9555. }),
  9556. $globals.Dictionary);
  9557. $core.addMethod(
  9558. $core.method({
  9559. selector: "valuesDo:",
  9560. protocol: "enumerating",
  9561. fn: function (aBlock){
  9562. var self=this,$self=this;
  9563. return $core.withContext(function($ctx1) {
  9564. return $recv($self["@values"])._do_(aBlock);
  9565. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9566. },
  9567. args: ["aBlock"],
  9568. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9569. referencedClasses: [],
  9570. messageSends: ["do:"]
  9571. }),
  9572. $globals.Dictionary);
  9573. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9574. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9575. $core.addMethod(
  9576. $core.method({
  9577. selector: "at:ifAbsent:",
  9578. protocol: "accessing",
  9579. fn: function (aKey,aBlock){
  9580. var self=this,$self=this;
  9581. return $core.withContext(function($ctx1) {
  9582. var $1;
  9583. $1=$self._includesKey_(aKey);
  9584. if($core.assert($1)){
  9585. return $self._basicAt_(aKey);
  9586. } else {
  9587. return $recv(aBlock)._value();
  9588. }
  9589. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9590. },
  9591. args: ["aKey", "aBlock"],
  9592. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9593. referencedClasses: [],
  9594. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9595. }),
  9596. $globals.HashedCollection);
  9597. $core.addMethod(
  9598. $core.method({
  9599. selector: "at:put:",
  9600. protocol: "accessing",
  9601. fn: function (aKey,aValue){
  9602. var self=this,$self=this;
  9603. return $core.withContext(function($ctx1) {
  9604. return $self._basicAt_put_(aKey,aValue);
  9605. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9606. },
  9607. args: ["aKey", "aValue"],
  9608. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9609. referencedClasses: [],
  9610. messageSends: ["basicAt:put:"]
  9611. }),
  9612. $globals.HashedCollection);
  9613. $core.addMethod(
  9614. $core.method({
  9615. selector: "includesKey:",
  9616. protocol: "testing",
  9617. fn: function (aKey){
  9618. var self=this,$self=this;
  9619. return $core.withContext(function($ctx1) {
  9620. return self.hasOwnProperty(aKey);
  9621. return self;
  9622. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9623. },
  9624. args: ["aKey"],
  9625. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9626. referencedClasses: [],
  9627. messageSends: []
  9628. }),
  9629. $globals.HashedCollection);
  9630. $core.addMethod(
  9631. $core.method({
  9632. selector: "keys",
  9633. protocol: "accessing",
  9634. fn: function (){
  9635. var self=this,$self=this;
  9636. return $core.withContext(function($ctx1) {
  9637. return Object.keys(self);
  9638. return self;
  9639. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9640. },
  9641. args: [],
  9642. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9643. referencedClasses: [],
  9644. messageSends: []
  9645. }),
  9646. $globals.HashedCollection);
  9647. $core.addMethod(
  9648. $core.method({
  9649. selector: "keysDo:",
  9650. protocol: "enumerating",
  9651. fn: function (aBlock){
  9652. var self=this,$self=this;
  9653. return $core.withContext(function($ctx1) {
  9654. $recv($self._keys())._do_(aBlock);
  9655. return self;
  9656. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9657. },
  9658. args: ["aBlock"],
  9659. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9660. referencedClasses: [],
  9661. messageSends: ["do:", "keys"]
  9662. }),
  9663. $globals.HashedCollection);
  9664. $core.addMethod(
  9665. $core.method({
  9666. selector: "removeKey:ifAbsent:",
  9667. protocol: "adding/removing",
  9668. fn: function (aKey,aBlock){
  9669. var self=this,$self=this;
  9670. return $core.withContext(function($ctx1) {
  9671. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9672. return $core.withContext(function($ctx2) {
  9673. $self._basicDelete_(aKey);
  9674. return removed;
  9675. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9676. }),(function(){
  9677. return $core.withContext(function($ctx2) {
  9678. return $recv(aBlock)._value();
  9679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9680. }));
  9681. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9682. },
  9683. args: ["aKey", "aBlock"],
  9684. 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 ]",
  9685. referencedClasses: [],
  9686. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9687. }),
  9688. $globals.HashedCollection);
  9689. $core.addMethod(
  9690. $core.method({
  9691. selector: "values",
  9692. protocol: "accessing",
  9693. fn: function (){
  9694. var self=this,$self=this;
  9695. return $core.withContext(function($ctx1) {
  9696. return $self._keys().map(function(key){
  9697. return $self._at_(key);
  9698. });
  9699. ;
  9700. return self;
  9701. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9702. },
  9703. args: [],
  9704. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  9705. referencedClasses: [],
  9706. messageSends: []
  9707. }),
  9708. $globals.HashedCollection);
  9709. $core.addMethod(
  9710. $core.method({
  9711. selector: "valuesDo:",
  9712. protocol: "enumerating",
  9713. fn: function (aBlock){
  9714. var self=this,$self=this;
  9715. return $core.withContext(function($ctx1) {
  9716. $recv($self._values())._do_(aBlock);
  9717. return self;
  9718. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9719. },
  9720. args: ["aBlock"],
  9721. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9722. referencedClasses: [],
  9723. messageSends: ["do:", "values"]
  9724. }),
  9725. $globals.HashedCollection);
  9726. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9727. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9728. $core.addMethod(
  9729. $core.method({
  9730. selector: "=",
  9731. protocol: "comparing",
  9732. fn: function (aCollection){
  9733. var self=this,$self=this;
  9734. return $core.withContext(function($ctx1) {
  9735. var $3,$2,$4,$1,$5;
  9736. var $early={};
  9737. try {
  9738. $3=$self._class();
  9739. $ctx1.sendIdx["class"]=1;
  9740. $2=$recv($3).__eq($recv(aCollection)._class());
  9741. $ctx1.sendIdx["="]=1;
  9742. $1=$recv($2)._and_((function(){
  9743. return $core.withContext(function($ctx2) {
  9744. $4=$self._size();
  9745. $ctx2.sendIdx["size"]=1;
  9746. return $recv($4).__eq($recv(aCollection)._size());
  9747. $ctx2.sendIdx["="]=2;
  9748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9749. }));
  9750. if(!$core.assert($1)){
  9751. return false;
  9752. }
  9753. $self._withIndexDo_((function(each,i){
  9754. return $core.withContext(function($ctx2) {
  9755. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9756. if(!$core.assert($5)){
  9757. throw $early=[false];
  9758. }
  9759. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9760. }));
  9761. return true;
  9762. }
  9763. catch(e) {if(e===$early)return e[0]; throw e}
  9764. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9765. },
  9766. args: ["aCollection"],
  9767. 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",
  9768. referencedClasses: [],
  9769. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9770. }),
  9771. $globals.SequenceableCollection);
  9772. $core.addMethod(
  9773. $core.method({
  9774. selector: "addLast:",
  9775. protocol: "adding/removing",
  9776. fn: function (anObject){
  9777. var self=this,$self=this;
  9778. return $core.withContext(function($ctx1) {
  9779. $self._add_(anObject);
  9780. return self;
  9781. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9782. },
  9783. args: ["anObject"],
  9784. source: "addLast: anObject\x0a\x09self add: anObject",
  9785. referencedClasses: [],
  9786. messageSends: ["add:"]
  9787. }),
  9788. $globals.SequenceableCollection);
  9789. $core.addMethod(
  9790. $core.method({
  9791. selector: "allButFirst",
  9792. protocol: "accessing",
  9793. fn: function (){
  9794. var self=this,$self=this;
  9795. return $core.withContext(function($ctx1) {
  9796. return $self._copyFrom_to_((2),$self._size());
  9797. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9798. },
  9799. args: [],
  9800. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9801. referencedClasses: [],
  9802. messageSends: ["copyFrom:to:", "size"]
  9803. }),
  9804. $globals.SequenceableCollection);
  9805. $core.addMethod(
  9806. $core.method({
  9807. selector: "allButLast",
  9808. protocol: "accessing",
  9809. fn: function (){
  9810. var self=this,$self=this;
  9811. return $core.withContext(function($ctx1) {
  9812. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9813. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9814. },
  9815. args: [],
  9816. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9817. referencedClasses: [],
  9818. messageSends: ["copyFrom:to:", "-", "size"]
  9819. }),
  9820. $globals.SequenceableCollection);
  9821. $core.addMethod(
  9822. $core.method({
  9823. selector: "anyOne",
  9824. protocol: "accessing",
  9825. fn: function (){
  9826. var self=this,$self=this;
  9827. return $core.withContext(function($ctx1) {
  9828. return $self._at_((1));
  9829. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9830. },
  9831. args: [],
  9832. source: "anyOne\x0a\x09^ self at: 1",
  9833. referencedClasses: [],
  9834. messageSends: ["at:"]
  9835. }),
  9836. $globals.SequenceableCollection);
  9837. $core.addMethod(
  9838. $core.method({
  9839. selector: "atRandom",
  9840. protocol: "accessing",
  9841. fn: function (){
  9842. var self=this,$self=this;
  9843. return $core.withContext(function($ctx1) {
  9844. return $self._at_($recv($self._size())._atRandom());
  9845. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9846. },
  9847. args: [],
  9848. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9849. referencedClasses: [],
  9850. messageSends: ["at:", "atRandom", "size"]
  9851. }),
  9852. $globals.SequenceableCollection);
  9853. $core.addMethod(
  9854. $core.method({
  9855. selector: "beginsWith:",
  9856. protocol: "testing",
  9857. fn: function (prefix){
  9858. var self=this,$self=this;
  9859. return $core.withContext(function($ctx1) {
  9860. var $2,$3,$1;
  9861. $2=$self._size();
  9862. $ctx1.sendIdx["size"]=1;
  9863. $3=$recv(prefix)._size();
  9864. $ctx1.sendIdx["size"]=2;
  9865. $1=$recv($2).__lt($3);
  9866. if($core.assert($1)){
  9867. return false;
  9868. }
  9869. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9870. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9871. },
  9872. args: ["prefix"],
  9873. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9874. referencedClasses: [],
  9875. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9876. }),
  9877. $globals.SequenceableCollection);
  9878. $core.addMethod(
  9879. $core.method({
  9880. selector: "copyFrom:to:",
  9881. protocol: "copying",
  9882. fn: function (anIndex,anotherIndex){
  9883. var self=this,$self=this;
  9884. return $core.withContext(function($ctx1) {
  9885. $self._subclassResponsibility();
  9886. return self;
  9887. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9888. },
  9889. args: ["anIndex", "anotherIndex"],
  9890. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9891. referencedClasses: [],
  9892. messageSends: ["subclassResponsibility"]
  9893. }),
  9894. $globals.SequenceableCollection);
  9895. $core.addMethod(
  9896. $core.method({
  9897. selector: "endsWith:",
  9898. protocol: "testing",
  9899. fn: function (suffix){
  9900. var self=this,$self=this;
  9901. return $core.withContext(function($ctx1) {
  9902. var $2,$3,$1;
  9903. $2=$self._size();
  9904. $ctx1.sendIdx["size"]=1;
  9905. $3=$recv(suffix)._size();
  9906. $ctx1.sendIdx["size"]=2;
  9907. $1=$recv($2).__lt($3);
  9908. if($core.assert($1)){
  9909. return false;
  9910. }
  9911. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9912. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9913. },
  9914. args: ["suffix"],
  9915. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9916. referencedClasses: [],
  9917. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9918. }),
  9919. $globals.SequenceableCollection);
  9920. $core.addMethod(
  9921. $core.method({
  9922. selector: "first",
  9923. protocol: "accessing",
  9924. fn: function (){
  9925. var self=this,$self=this;
  9926. return $core.withContext(function($ctx1) {
  9927. return $self._at_((1));
  9928. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  9929. },
  9930. args: [],
  9931. source: "first\x0a\x09^ self at: 1",
  9932. referencedClasses: [],
  9933. messageSends: ["at:"]
  9934. }),
  9935. $globals.SequenceableCollection);
  9936. $core.addMethod(
  9937. $core.method({
  9938. selector: "first:",
  9939. protocol: "accessing",
  9940. fn: function (aNumber){
  9941. var self=this,$self=this;
  9942. return $core.withContext(function($ctx1) {
  9943. var $1;
  9944. $1=$recv($self._size()).__lt(aNumber);
  9945. if($core.assert($1)){
  9946. $self._error_("Invalid number of elements");
  9947. }
  9948. return $self._copyFrom_to_((1),aNumber);
  9949. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9950. },
  9951. args: ["aNumber"],
  9952. 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",
  9953. referencedClasses: [],
  9954. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  9955. }),
  9956. $globals.SequenceableCollection);
  9957. $core.addMethod(
  9958. $core.method({
  9959. selector: "fourth",
  9960. protocol: "accessing",
  9961. fn: function (){
  9962. var self=this,$self=this;
  9963. return $core.withContext(function($ctx1) {
  9964. return $self._at_((4));
  9965. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  9966. },
  9967. args: [],
  9968. source: "fourth\x0a\x09^ self at: 4",
  9969. referencedClasses: [],
  9970. messageSends: ["at:"]
  9971. }),
  9972. $globals.SequenceableCollection);
  9973. $core.addMethod(
  9974. $core.method({
  9975. selector: "includes:",
  9976. protocol: "testing",
  9977. fn: function (anObject){
  9978. var self=this,$self=this;
  9979. return $core.withContext(function($ctx1) {
  9980. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  9981. return nil;
  9982. })))._notNil();
  9983. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9984. },
  9985. args: ["anObject"],
  9986. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9987. referencedClasses: [],
  9988. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9989. }),
  9990. $globals.SequenceableCollection);
  9991. $core.addMethod(
  9992. $core.method({
  9993. selector: "indexOf:startingAt:",
  9994. protocol: "accessing",
  9995. fn: function (anObject,start){
  9996. var self=this,$self=this;
  9997. return $core.withContext(function($ctx1) {
  9998. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  9999. return (0);
  10000. }));
  10001. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10002. },
  10003. args: ["anObject", "start"],
  10004. 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 ]",
  10005. referencedClasses: [],
  10006. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10007. }),
  10008. $globals.SequenceableCollection);
  10009. $core.addMethod(
  10010. $core.method({
  10011. selector: "indexOf:startingAt:ifAbsent:",
  10012. protocol: "accessing",
  10013. fn: function (anObject,start,aBlock){
  10014. var self=this,$self=this;
  10015. return $core.withContext(function($ctx1) {
  10016. $self._subclassResponsibility();
  10017. return self;
  10018. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10019. },
  10020. args: ["anObject", "start", "aBlock"],
  10021. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10022. referencedClasses: [],
  10023. messageSends: ["subclassResponsibility"]
  10024. }),
  10025. $globals.SequenceableCollection);
  10026. $core.addMethod(
  10027. $core.method({
  10028. selector: "last",
  10029. protocol: "accessing",
  10030. fn: function (){
  10031. var self=this,$self=this;
  10032. return $core.withContext(function($ctx1) {
  10033. return $self._at_($self._size());
  10034. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10035. },
  10036. args: [],
  10037. source: "last\x0a\x09^ self at: self size",
  10038. referencedClasses: [],
  10039. messageSends: ["at:", "size"]
  10040. }),
  10041. $globals.SequenceableCollection);
  10042. $core.addMethod(
  10043. $core.method({
  10044. selector: "last:",
  10045. protocol: "accessing",
  10046. fn: function (aNumber){
  10047. var self=this,$self=this;
  10048. return $core.withContext(function($ctx1) {
  10049. var $2,$1,$5,$4,$3;
  10050. $2=$self._size();
  10051. $ctx1.sendIdx["size"]=1;
  10052. $1=$recv($2).__lt(aNumber);
  10053. if($core.assert($1)){
  10054. $self._error_("Invalid number of elements");
  10055. }
  10056. $5=$self._size();
  10057. $ctx1.sendIdx["size"]=2;
  10058. $4=$recv($5).__minus(aNumber);
  10059. $3=$recv($4).__plus((1));
  10060. return $self._copyFrom_to_($3,$self._size());
  10061. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10062. },
  10063. args: ["aNumber"],
  10064. 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",
  10065. referencedClasses: [],
  10066. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10067. }),
  10068. $globals.SequenceableCollection);
  10069. $core.addMethod(
  10070. $core.method({
  10071. selector: "newStream",
  10072. protocol: "streaming",
  10073. fn: function (){
  10074. var self=this,$self=this;
  10075. return $core.withContext(function($ctx1) {
  10076. return $recv($self._streamClass())._on_(self);
  10077. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10078. },
  10079. args: [],
  10080. source: "newStream\x0a\x09^ self streamClass on: self",
  10081. referencedClasses: [],
  10082. messageSends: ["on:", "streamClass"]
  10083. }),
  10084. $globals.SequenceableCollection);
  10085. $core.addMethod(
  10086. $core.method({
  10087. selector: "readStream",
  10088. protocol: "streaming",
  10089. fn: function (){
  10090. var self=this,$self=this;
  10091. return $core.withContext(function($ctx1) {
  10092. return $self._stream();
  10093. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10094. },
  10095. args: [],
  10096. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10097. referencedClasses: [],
  10098. messageSends: ["stream"]
  10099. }),
  10100. $globals.SequenceableCollection);
  10101. $core.addMethod(
  10102. $core.method({
  10103. selector: "removeLast",
  10104. protocol: "adding/removing",
  10105. fn: function (){
  10106. var self=this,$self=this;
  10107. return $core.withContext(function($ctx1) {
  10108. return $self._remove_($self._last());
  10109. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10110. },
  10111. args: [],
  10112. source: "removeLast\x0a\x09^ self remove: self last",
  10113. referencedClasses: [],
  10114. messageSends: ["remove:", "last"]
  10115. }),
  10116. $globals.SequenceableCollection);
  10117. $core.addMethod(
  10118. $core.method({
  10119. selector: "reverseDo:",
  10120. protocol: "enumerating",
  10121. fn: function (aBlock){
  10122. var self=this,$self=this;
  10123. return $core.withContext(function($ctx1) {
  10124. $recv($self._reversed())._do_(aBlock);
  10125. return self;
  10126. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10127. },
  10128. args: ["aBlock"],
  10129. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10130. referencedClasses: [],
  10131. messageSends: ["do:", "reversed"]
  10132. }),
  10133. $globals.SequenceableCollection);
  10134. $core.addMethod(
  10135. $core.method({
  10136. selector: "reversed",
  10137. protocol: "converting",
  10138. fn: function (){
  10139. var self=this,$self=this;
  10140. return $core.withContext(function($ctx1) {
  10141. $self._subclassResponsibility();
  10142. return self;
  10143. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10144. },
  10145. args: [],
  10146. source: "reversed\x0a\x09self subclassResponsibility",
  10147. referencedClasses: [],
  10148. messageSends: ["subclassResponsibility"]
  10149. }),
  10150. $globals.SequenceableCollection);
  10151. $core.addMethod(
  10152. $core.method({
  10153. selector: "second",
  10154. protocol: "accessing",
  10155. fn: function (){
  10156. var self=this,$self=this;
  10157. return $core.withContext(function($ctx1) {
  10158. return $self._at_((2));
  10159. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10160. },
  10161. args: [],
  10162. source: "second\x0a\x09^ self at: 2",
  10163. referencedClasses: [],
  10164. messageSends: ["at:"]
  10165. }),
  10166. $globals.SequenceableCollection);
  10167. $core.addMethod(
  10168. $core.method({
  10169. selector: "stream",
  10170. protocol: "streaming",
  10171. fn: function (){
  10172. var self=this,$self=this;
  10173. return $core.withContext(function($ctx1) {
  10174. return $self._newStream();
  10175. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10176. },
  10177. args: [],
  10178. source: "stream\x0a\x09^ self newStream",
  10179. referencedClasses: [],
  10180. messageSends: ["newStream"]
  10181. }),
  10182. $globals.SequenceableCollection);
  10183. $core.addMethod(
  10184. $core.method({
  10185. selector: "streamClass",
  10186. protocol: "streaming",
  10187. fn: function (){
  10188. var self=this,$self=this;
  10189. return $core.withContext(function($ctx1) {
  10190. return $recv($self._class())._streamClass();
  10191. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10192. },
  10193. args: [],
  10194. source: "streamClass\x0a\x09^ self class streamClass",
  10195. referencedClasses: [],
  10196. messageSends: ["streamClass", "class"]
  10197. }),
  10198. $globals.SequenceableCollection);
  10199. $core.addMethod(
  10200. $core.method({
  10201. selector: "third",
  10202. protocol: "accessing",
  10203. fn: function (){
  10204. var self=this,$self=this;
  10205. return $core.withContext(function($ctx1) {
  10206. return $self._at_((3));
  10207. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10208. },
  10209. args: [],
  10210. source: "third\x0a\x09^ self at: 3",
  10211. referencedClasses: [],
  10212. messageSends: ["at:"]
  10213. }),
  10214. $globals.SequenceableCollection);
  10215. $core.addMethod(
  10216. $core.method({
  10217. selector: "writeStream",
  10218. protocol: "streaming",
  10219. fn: function (){
  10220. var self=this,$self=this;
  10221. return $core.withContext(function($ctx1) {
  10222. return $self._stream();
  10223. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10224. },
  10225. args: [],
  10226. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10227. referencedClasses: [],
  10228. messageSends: ["stream"]
  10229. }),
  10230. $globals.SequenceableCollection);
  10231. $core.addMethod(
  10232. $core.method({
  10233. selector: "streamClass",
  10234. protocol: "accessing",
  10235. fn: function (){
  10236. var self=this,$self=this;
  10237. return $globals.Stream;
  10238. },
  10239. args: [],
  10240. source: "streamClass\x0a\x09\x09^ Stream",
  10241. referencedClasses: ["Stream"],
  10242. messageSends: []
  10243. }),
  10244. $globals.SequenceableCollection.a$cls);
  10245. $core.addMethod(
  10246. $core.method({
  10247. selector: "streamContents:",
  10248. protocol: "streaming",
  10249. fn: function (aBlock){
  10250. var self=this,$self=this;
  10251. var stream;
  10252. return $core.withContext(function($ctx1) {
  10253. stream=$recv($self._streamClass())._on_($self._new());
  10254. $recv(aBlock)._value_(stream);
  10255. return $recv(stream)._contents();
  10256. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10257. },
  10258. args: ["aBlock"],
  10259. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10260. referencedClasses: [],
  10261. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10262. }),
  10263. $globals.SequenceableCollection.a$cls);
  10264. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10265. $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`.";
  10266. $core.addMethod(
  10267. $core.method({
  10268. selector: "add:",
  10269. protocol: "adding/removing",
  10270. fn: function (anObject){
  10271. var self=this,$self=this;
  10272. return $core.withContext(function($ctx1) {
  10273. self.push(anObject); return anObject;;
  10274. return self;
  10275. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10276. },
  10277. args: ["anObject"],
  10278. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10279. referencedClasses: [],
  10280. messageSends: []
  10281. }),
  10282. $globals.Array);
  10283. $core.addMethod(
  10284. $core.method({
  10285. selector: "addAll:",
  10286. protocol: "adding/removing",
  10287. fn: function (aCollection){
  10288. var self=this,$self=this;
  10289. return $core.withContext(function($ctx1) {
  10290. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10291. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10292. return aCollection;;
  10293. return self;
  10294. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10295. },
  10296. args: ["aCollection"],
  10297. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;\x0a'>",
  10298. referencedClasses: [],
  10299. messageSends: []
  10300. }),
  10301. $globals.Array);
  10302. $core.addMethod(
  10303. $core.method({
  10304. selector: "addFirst:",
  10305. protocol: "adding/removing",
  10306. fn: function (anObject){
  10307. var self=this,$self=this;
  10308. return $core.withContext(function($ctx1) {
  10309. self.unshift(anObject); return anObject;;
  10310. return self;
  10311. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10312. },
  10313. args: ["anObject"],
  10314. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10315. referencedClasses: [],
  10316. messageSends: []
  10317. }),
  10318. $globals.Array);
  10319. $core.addMethod(
  10320. $core.method({
  10321. selector: "asJavaScriptSource",
  10322. protocol: "converting",
  10323. fn: function (){
  10324. var self=this,$self=this;
  10325. return $core.withContext(function($ctx1) {
  10326. var $1;
  10327. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10328. return $core.withContext(function($ctx2) {
  10329. return $recv(each)._asJavaScriptSource();
  10330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10331. })))._join_(", "))).__comma("]");
  10332. $ctx1.sendIdx[","]=1;
  10333. return $1;
  10334. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10335. },
  10336. args: [],
  10337. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10338. referencedClasses: [],
  10339. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10340. }),
  10341. $globals.Array);
  10342. $core.addMethod(
  10343. $core.method({
  10344. selector: "at:put:",
  10345. protocol: "accessing",
  10346. fn: function (anIndex,anObject){
  10347. var self=this,$self=this;
  10348. return $core.withContext(function($ctx1) {
  10349. return self[anIndex - 1] = anObject;
  10350. return self;
  10351. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10352. },
  10353. args: ["anIndex", "anObject"],
  10354. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10355. referencedClasses: [],
  10356. messageSends: []
  10357. }),
  10358. $globals.Array);
  10359. $core.addMethod(
  10360. $core.method({
  10361. selector: "collect:",
  10362. protocol: "enumerating",
  10363. fn: function (aBlock){
  10364. var self=this,$self=this;
  10365. return $core.withContext(function($ctx1) {
  10366. return self.map(function(each) {return aBlock._value_(each)});
  10367. return self;
  10368. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10369. },
  10370. args: ["aBlock"],
  10371. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10372. referencedClasses: [],
  10373. messageSends: []
  10374. }),
  10375. $globals.Array);
  10376. $core.addMethod(
  10377. $core.method({
  10378. selector: "copyFrom:to:",
  10379. protocol: "copying",
  10380. fn: function (anIndex,anotherIndex){
  10381. var self=this,$self=this;
  10382. return $core.withContext(function($ctx1) {
  10383. if (anIndex >= 1 && anotherIndex <= self.length) {
  10384. return self.slice(anIndex - 1, anotherIndex);
  10385. } else {
  10386. self._at_(anIndex);
  10387. self._at_(self.length + 1);
  10388. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10389. };
  10390. return self;
  10391. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10392. },
  10393. args: ["anIndex", "anotherIndex"],
  10394. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  10395. referencedClasses: [],
  10396. messageSends: []
  10397. }),
  10398. $globals.Array);
  10399. $core.addMethod(
  10400. $core.method({
  10401. selector: "join:",
  10402. protocol: "enumerating",
  10403. fn: function (aString){
  10404. var self=this,$self=this;
  10405. return $core.withContext(function($ctx1) {
  10406. return self.join(aString);
  10407. return self;
  10408. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10409. },
  10410. args: ["aString"],
  10411. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10412. referencedClasses: [],
  10413. messageSends: []
  10414. }),
  10415. $globals.Array);
  10416. $core.addMethod(
  10417. $core.method({
  10418. selector: "printOn:",
  10419. protocol: "printing",
  10420. fn: function (aStream){
  10421. var self=this,$self=this;
  10422. return $core.withContext(function($ctx1) {
  10423. (
  10424. $ctx1.supercall = true,
  10425. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10426. $ctx1.supercall = false;
  10427. $ctx1.sendIdx["printOn:"]=1;
  10428. $recv(aStream)._nextPutAll_(" (");
  10429. $ctx1.sendIdx["nextPutAll:"]=1;
  10430. $self._do_separatedBy_((function(each){
  10431. return $core.withContext(function($ctx2) {
  10432. return $recv(each)._printOn_(aStream);
  10433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10434. }),(function(){
  10435. return $core.withContext(function($ctx2) {
  10436. return $recv(aStream)._nextPutAll_(" ");
  10437. $ctx2.sendIdx["nextPutAll:"]=2;
  10438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10439. }));
  10440. $recv(aStream)._nextPutAll_(")");
  10441. return self;
  10442. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10443. },
  10444. args: ["aStream"],
  10445. 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: ')'",
  10446. referencedClasses: [],
  10447. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10448. }),
  10449. $globals.Array);
  10450. $core.addMethod(
  10451. $core.method({
  10452. selector: "remove:ifAbsent:",
  10453. protocol: "adding/removing",
  10454. fn: function (anObject,aBlock){
  10455. var self=this,$self=this;
  10456. var index;
  10457. return $core.withContext(function($ctx1) {
  10458. var $1;
  10459. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10460. return (0);
  10461. }));
  10462. $1=$recv(index).__eq((0));
  10463. if($core.assert($1)){
  10464. return $recv(aBlock)._value();
  10465. } else {
  10466. $self._removeIndex_(index);
  10467. return anObject;
  10468. }
  10469. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10470. },
  10471. args: ["anObject", "aBlock"],
  10472. 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 ]",
  10473. referencedClasses: [],
  10474. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10475. }),
  10476. $globals.Array);
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "removeAll",
  10480. protocol: "adding/removing",
  10481. fn: function (){
  10482. var self=this,$self=this;
  10483. return $core.withContext(function($ctx1) {
  10484. self.length = 0;
  10485. return self;
  10486. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10487. },
  10488. args: [],
  10489. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10490. referencedClasses: [],
  10491. messageSends: []
  10492. }),
  10493. $globals.Array);
  10494. $core.addMethod(
  10495. $core.method({
  10496. selector: "removeFrom:to:",
  10497. protocol: "adding/removing",
  10498. fn: function (aNumber,anotherNumber){
  10499. var self=this,$self=this;
  10500. return $core.withContext(function($ctx1) {
  10501. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10502. return self;
  10503. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10504. },
  10505. args: ["aNumber", "anotherNumber"],
  10506. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10507. referencedClasses: [],
  10508. messageSends: []
  10509. }),
  10510. $globals.Array);
  10511. $core.addMethod(
  10512. $core.method({
  10513. selector: "removeIndex:",
  10514. protocol: "adding/removing",
  10515. fn: function (anInteger){
  10516. var self=this,$self=this;
  10517. return $core.withContext(function($ctx1) {
  10518. self.splice(anInteger - 1, 1);
  10519. return self;
  10520. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10521. },
  10522. args: ["anInteger"],
  10523. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10524. referencedClasses: [],
  10525. messageSends: []
  10526. }),
  10527. $globals.Array);
  10528. $core.addMethod(
  10529. $core.method({
  10530. selector: "removeLast",
  10531. protocol: "adding/removing",
  10532. fn: function (){
  10533. var self=this,$self=this;
  10534. return $core.withContext(function($ctx1) {
  10535. return self.pop();;
  10536. return self;
  10537. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10538. },
  10539. args: [],
  10540. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10541. referencedClasses: [],
  10542. messageSends: []
  10543. }),
  10544. $globals.Array);
  10545. $core.addMethod(
  10546. $core.method({
  10547. selector: "reversed",
  10548. protocol: "converting",
  10549. fn: function (){
  10550. var self=this,$self=this;
  10551. return $core.withContext(function($ctx1) {
  10552. return self.slice().reverse();
  10553. return self;
  10554. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10555. },
  10556. args: [],
  10557. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10558. referencedClasses: [],
  10559. messageSends: []
  10560. }),
  10561. $globals.Array);
  10562. $core.addMethod(
  10563. $core.method({
  10564. selector: "select:",
  10565. protocol: "enumerating",
  10566. fn: function (aBlock){
  10567. var self=this,$self=this;
  10568. return $core.withContext(function($ctx1) {
  10569. return self.filter(function(each) {return aBlock._value_(each)});
  10570. return self;
  10571. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10572. },
  10573. args: ["aBlock"],
  10574. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10575. referencedClasses: [],
  10576. messageSends: []
  10577. }),
  10578. $globals.Array);
  10579. $core.addMethod(
  10580. $core.method({
  10581. selector: "shallowCopy",
  10582. protocol: "copying",
  10583. fn: function (){
  10584. var self=this,$self=this;
  10585. return $core.withContext(function($ctx1) {
  10586. return self.slice();
  10587. return self;
  10588. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10589. },
  10590. args: [],
  10591. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10592. referencedClasses: [],
  10593. messageSends: []
  10594. }),
  10595. $globals.Array);
  10596. $core.addMethod(
  10597. $core.method({
  10598. selector: "sort",
  10599. protocol: "enumerating",
  10600. fn: function (){
  10601. var self=this,$self=this;
  10602. return $core.withContext(function($ctx1) {
  10603. return $self._sort_((function(a,b){
  10604. return $core.withContext(function($ctx2) {
  10605. return $recv(a).__lt(b);
  10606. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10607. }));
  10608. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10609. },
  10610. args: [],
  10611. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10612. referencedClasses: [],
  10613. messageSends: ["sort:", "<"]
  10614. }),
  10615. $globals.Array);
  10616. $core.addMethod(
  10617. $core.method({
  10618. selector: "sort:",
  10619. protocol: "enumerating",
  10620. fn: function (aBlock){
  10621. var self=this,$self=this;
  10622. return $core.withContext(function($ctx1) {
  10623. return self.sort(function(a, b) {
  10624. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10625. })
  10626. ;
  10627. return self;
  10628. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10629. },
  10630. args: ["aBlock"],
  10631. source: "sort: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09'>",
  10632. referencedClasses: [],
  10633. messageSends: []
  10634. }),
  10635. $globals.Array);
  10636. $core.addMethod(
  10637. $core.method({
  10638. selector: "sorted",
  10639. protocol: "enumerating",
  10640. fn: function (){
  10641. var self=this,$self=this;
  10642. return $core.withContext(function($ctx1) {
  10643. return $recv($self._copy())._sort();
  10644. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10645. },
  10646. args: [],
  10647. source: "sorted\x0a\x09^ self copy sort",
  10648. referencedClasses: [],
  10649. messageSends: ["sort", "copy"]
  10650. }),
  10651. $globals.Array);
  10652. $core.addMethod(
  10653. $core.method({
  10654. selector: "sorted:",
  10655. protocol: "enumerating",
  10656. fn: function (aBlock){
  10657. var self=this,$self=this;
  10658. return $core.withContext(function($ctx1) {
  10659. return $recv($self._copy())._sort_(aBlock);
  10660. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10661. },
  10662. args: ["aBlock"],
  10663. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10664. referencedClasses: [],
  10665. messageSends: ["sort:", "copy"]
  10666. }),
  10667. $globals.Array);
  10668. $core.addMethod(
  10669. $core.method({
  10670. selector: "new:",
  10671. protocol: "instance creation",
  10672. fn: function (anInteger){
  10673. var self=this,$self=this;
  10674. return $core.withContext(function($ctx1) {
  10675. return new Array(anInteger);
  10676. return self;
  10677. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10678. },
  10679. args: ["anInteger"],
  10680. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10681. referencedClasses: [],
  10682. messageSends: []
  10683. }),
  10684. $globals.Array.a$cls);
  10685. $core.addMethod(
  10686. $core.method({
  10687. selector: "with:",
  10688. protocol: "instance creation",
  10689. fn: function (anObject){
  10690. var self=this,$self=this;
  10691. return $core.withContext(function($ctx1) {
  10692. var $1;
  10693. $1=$self._new_((1));
  10694. $recv($1)._at_put_((1),anObject);
  10695. return $recv($1)._yourself();
  10696. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10697. },
  10698. args: ["anObject"],
  10699. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10700. referencedClasses: [],
  10701. messageSends: ["at:put:", "new:", "yourself"]
  10702. }),
  10703. $globals.Array.a$cls);
  10704. $core.addMethod(
  10705. $core.method({
  10706. selector: "with:with:",
  10707. protocol: "instance creation",
  10708. fn: function (anObject,anObject2){
  10709. var self=this,$self=this;
  10710. return $core.withContext(function($ctx1) {
  10711. var $1;
  10712. $1=$self._new_((2));
  10713. $recv($1)._at_put_((1),anObject);
  10714. $ctx1.sendIdx["at:put:"]=1;
  10715. $recv($1)._at_put_((2),anObject2);
  10716. return $recv($1)._yourself();
  10717. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10718. },
  10719. args: ["anObject", "anObject2"],
  10720. 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",
  10721. referencedClasses: [],
  10722. messageSends: ["at:put:", "new:", "yourself"]
  10723. }),
  10724. $globals.Array.a$cls);
  10725. $core.addMethod(
  10726. $core.method({
  10727. selector: "with:with:with:",
  10728. protocol: "instance creation",
  10729. fn: function (anObject,anObject2,anObject3){
  10730. var self=this,$self=this;
  10731. return $core.withContext(function($ctx1) {
  10732. var $1;
  10733. $1=$self._new_((3));
  10734. $recv($1)._at_put_((1),anObject);
  10735. $ctx1.sendIdx["at:put:"]=1;
  10736. $recv($1)._at_put_((2),anObject2);
  10737. $ctx1.sendIdx["at:put:"]=2;
  10738. $recv($1)._at_put_((3),anObject3);
  10739. return $recv($1)._yourself();
  10740. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10741. },
  10742. args: ["anObject", "anObject2", "anObject3"],
  10743. 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",
  10744. referencedClasses: [],
  10745. messageSends: ["at:put:", "new:", "yourself"]
  10746. }),
  10747. $globals.Array.a$cls);
  10748. $core.addMethod(
  10749. $core.method({
  10750. selector: "withAll:",
  10751. protocol: "instance creation",
  10752. fn: function (aCollection){
  10753. var self=this,$self=this;
  10754. var instance,index;
  10755. return $core.withContext(function($ctx1) {
  10756. index=(1);
  10757. instance=$self._new_($recv(aCollection)._size());
  10758. $recv(aCollection)._do_((function(each){
  10759. return $core.withContext(function($ctx2) {
  10760. $recv(instance)._at_put_(index,each);
  10761. index=$recv(index).__plus((1));
  10762. return index;
  10763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10764. }));
  10765. return instance;
  10766. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10767. },
  10768. args: ["aCollection"],
  10769. 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",
  10770. referencedClasses: [],
  10771. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10772. }),
  10773. $globals.Array.a$cls);
  10774. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10775. $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 >> #,`";
  10776. $core.addMethod(
  10777. $core.method({
  10778. selector: ",",
  10779. protocol: "copying",
  10780. fn: function (aString){
  10781. var self=this,$self=this;
  10782. return $core.withContext(function($ctx1) {
  10783. return String(self) + aString;
  10784. return self;
  10785. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10786. },
  10787. args: ["aString"],
  10788. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10789. referencedClasses: [],
  10790. messageSends: []
  10791. }),
  10792. $globals.String);
  10793. $core.addMethod(
  10794. $core.method({
  10795. selector: "<",
  10796. protocol: "comparing",
  10797. fn: function (aString){
  10798. var self=this,$self=this;
  10799. return $core.withContext(function($ctx1) {
  10800. return String(self) < aString._asString();
  10801. return self;
  10802. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10803. },
  10804. args: ["aString"],
  10805. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10806. referencedClasses: [],
  10807. messageSends: []
  10808. }),
  10809. $globals.String);
  10810. $core.addMethod(
  10811. $core.method({
  10812. selector: "<=",
  10813. protocol: "comparing",
  10814. fn: function (aString){
  10815. var self=this,$self=this;
  10816. return $core.withContext(function($ctx1) {
  10817. return String(self) <= aString._asString();
  10818. return self;
  10819. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10820. },
  10821. args: ["aString"],
  10822. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10823. referencedClasses: [],
  10824. messageSends: []
  10825. }),
  10826. $globals.String);
  10827. $core.addMethod(
  10828. $core.method({
  10829. selector: "=",
  10830. protocol: "comparing",
  10831. fn: function (aString){
  10832. var self=this,$self=this;
  10833. return $core.withContext(function($ctx1) {
  10834. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10835. return self;
  10836. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10837. },
  10838. args: ["aString"],
  10839. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10840. referencedClasses: [],
  10841. messageSends: []
  10842. }),
  10843. $globals.String);
  10844. $core.addMethod(
  10845. $core.method({
  10846. selector: "==",
  10847. protocol: "comparing",
  10848. fn: function (aString){
  10849. var self=this,$self=this;
  10850. return $core.withContext(function($ctx1) {
  10851. if (typeof aString === "string") return String(self) === aString;
  10852. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10853. else return false;;
  10854. return self;
  10855. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10856. },
  10857. args: ["aString"],
  10858. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  10859. referencedClasses: [],
  10860. messageSends: []
  10861. }),
  10862. $globals.String);
  10863. $core.addMethod(
  10864. $core.method({
  10865. selector: ">",
  10866. protocol: "comparing",
  10867. fn: function (aString){
  10868. var self=this,$self=this;
  10869. return $core.withContext(function($ctx1) {
  10870. return String(self) > aString._asString();
  10871. return self;
  10872. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10873. },
  10874. args: ["aString"],
  10875. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10876. referencedClasses: [],
  10877. messageSends: []
  10878. }),
  10879. $globals.String);
  10880. $core.addMethod(
  10881. $core.method({
  10882. selector: ">=",
  10883. protocol: "comparing",
  10884. fn: function (aString){
  10885. var self=this,$self=this;
  10886. return $core.withContext(function($ctx1) {
  10887. return String(self) >= aString._asString();
  10888. return self;
  10889. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10890. },
  10891. args: ["aString"],
  10892. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10893. referencedClasses: [],
  10894. messageSends: []
  10895. }),
  10896. $globals.String);
  10897. $core.addMethod(
  10898. $core.method({
  10899. selector: "add:",
  10900. protocol: "adding/removing",
  10901. fn: function (anObject){
  10902. var self=this,$self=this;
  10903. return $core.withContext(function($ctx1) {
  10904. $self._errorReadOnly();
  10905. return self;
  10906. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  10907. },
  10908. args: ["anObject"],
  10909. source: "add: anObject\x0a\x09self errorReadOnly",
  10910. referencedClasses: [],
  10911. messageSends: ["errorReadOnly"]
  10912. }),
  10913. $globals.String);
  10914. $core.addMethod(
  10915. $core.method({
  10916. selector: "asJavaScriptMethodName",
  10917. protocol: "converting",
  10918. fn: function (){
  10919. var self=this,$self=this;
  10920. return $core.withContext(function($ctx1) {
  10921. return $core.st2js(self);
  10922. return self;
  10923. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10924. },
  10925. args: [],
  10926. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10927. referencedClasses: [],
  10928. messageSends: []
  10929. }),
  10930. $globals.String);
  10931. $core.addMethod(
  10932. $core.method({
  10933. selector: "asJavaScriptObject",
  10934. protocol: "converting",
  10935. fn: function (){
  10936. var self=this,$self=this;
  10937. return self;
  10938. },
  10939. args: [],
  10940. source: "asJavaScriptObject\x0a\x09^ self",
  10941. referencedClasses: [],
  10942. messageSends: []
  10943. }),
  10944. $globals.String);
  10945. $core.addMethod(
  10946. $core.method({
  10947. selector: "asJavaScriptSource",
  10948. protocol: "converting",
  10949. fn: function (){
  10950. var self=this,$self=this;
  10951. return $core.withContext(function($ctx1) {
  10952. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10953. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10954. else
  10955. return "\"" + self + "\"";
  10956. ;
  10957. return self;
  10958. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10959. },
  10960. args: [],
  10961. source: "asJavaScriptSource\x0a\x09<inlineJS: '\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09'>",
  10962. referencedClasses: [],
  10963. messageSends: []
  10964. }),
  10965. $globals.String);
  10966. $core.addMethod(
  10967. $core.method({
  10968. selector: "asLowercase",
  10969. protocol: "converting",
  10970. fn: function (){
  10971. var self=this,$self=this;
  10972. return $core.withContext(function($ctx1) {
  10973. return self.toLowerCase();
  10974. return self;
  10975. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10976. },
  10977. args: [],
  10978. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10979. referencedClasses: [],
  10980. messageSends: []
  10981. }),
  10982. $globals.String);
  10983. $core.addMethod(
  10984. $core.method({
  10985. selector: "asMutator",
  10986. protocol: "converting",
  10987. fn: function (){
  10988. var self=this,$self=this;
  10989. return $core.withContext(function($ctx1) {
  10990. var $1;
  10991. $1=$recv($self._last()).__eq(":");
  10992. if(!$core.assert($1)){
  10993. return $self.__comma(":");
  10994. }
  10995. return self;
  10996. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  10997. },
  10998. args: [],
  10999. 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",
  11000. referencedClasses: [],
  11001. messageSends: ["ifFalse:", "=", "last", ","]
  11002. }),
  11003. $globals.String);
  11004. $core.addMethod(
  11005. $core.method({
  11006. selector: "asNumber",
  11007. protocol: "converting",
  11008. fn: function (){
  11009. var self=this,$self=this;
  11010. return $core.withContext(function($ctx1) {
  11011. return Number(self);
  11012. return self;
  11013. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11014. },
  11015. args: [],
  11016. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11017. referencedClasses: [],
  11018. messageSends: []
  11019. }),
  11020. $globals.String);
  11021. $core.addMethod(
  11022. $core.method({
  11023. selector: "asRegexp",
  11024. protocol: "converting",
  11025. fn: function (){
  11026. var self=this,$self=this;
  11027. return $core.withContext(function($ctx1) {
  11028. return $recv($globals.RegularExpression)._fromString_(self);
  11029. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11030. },
  11031. args: [],
  11032. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11033. referencedClasses: ["RegularExpression"],
  11034. messageSends: ["fromString:"]
  11035. }),
  11036. $globals.String);
  11037. $core.addMethod(
  11038. $core.method({
  11039. selector: "asString",
  11040. protocol: "converting",
  11041. fn: function (){
  11042. var self=this,$self=this;
  11043. return self;
  11044. },
  11045. args: [],
  11046. source: "asString\x0a\x09^ self",
  11047. referencedClasses: [],
  11048. messageSends: []
  11049. }),
  11050. $globals.String);
  11051. $core.addMethod(
  11052. $core.method({
  11053. selector: "asSymbol",
  11054. protocol: "converting",
  11055. fn: function (){
  11056. var self=this,$self=this;
  11057. return self;
  11058. },
  11059. args: [],
  11060. source: "asSymbol\x0a\x09^ self",
  11061. referencedClasses: [],
  11062. messageSends: []
  11063. }),
  11064. $globals.String);
  11065. $core.addMethod(
  11066. $core.method({
  11067. selector: "asSymbolPrintOn:",
  11068. protocol: "printing",
  11069. fn: function (aStream){
  11070. var self=this,$self=this;
  11071. return $core.withContext(function($ctx1) {
  11072. var $1;
  11073. $recv(aStream)._nextPutAll_("#");
  11074. $1=$recv($self._asString())._isSelector();
  11075. if($core.assert($1)){
  11076. $recv(aStream)._nextPut_(self);
  11077. } else {
  11078. $self._printOn_(aStream);
  11079. }
  11080. return self;
  11081. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  11082. },
  11083. args: ["aStream"],
  11084. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11085. referencedClasses: [],
  11086. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11087. }),
  11088. $globals.String);
  11089. $core.addMethod(
  11090. $core.method({
  11091. selector: "asUppercase",
  11092. protocol: "converting",
  11093. fn: function (){
  11094. var self=this,$self=this;
  11095. return $core.withContext(function($ctx1) {
  11096. return self.toUpperCase();
  11097. return self;
  11098. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11099. },
  11100. args: [],
  11101. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11102. referencedClasses: [],
  11103. messageSends: []
  11104. }),
  11105. $globals.String);
  11106. $core.addMethod(
  11107. $core.method({
  11108. selector: "asciiValue",
  11109. protocol: "accessing",
  11110. fn: function (){
  11111. var self=this,$self=this;
  11112. return $core.withContext(function($ctx1) {
  11113. return self.charCodeAt(0);;
  11114. return self;
  11115. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11116. },
  11117. args: [],
  11118. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11119. referencedClasses: [],
  11120. messageSends: []
  11121. }),
  11122. $globals.String);
  11123. $core.addMethod(
  11124. $core.method({
  11125. selector: "at:ifAbsent:",
  11126. protocol: "accessing",
  11127. fn: function (anIndex,aBlock){
  11128. var self=this,$self=this;
  11129. return $core.withContext(function($ctx1) {
  11130. return String(self)[anIndex - 1] || aBlock._value();
  11131. return self;
  11132. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11133. },
  11134. args: ["anIndex", "aBlock"],
  11135. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11136. referencedClasses: [],
  11137. messageSends: []
  11138. }),
  11139. $globals.String);
  11140. $core.addMethod(
  11141. $core.method({
  11142. selector: "at:ifPresent:ifAbsent:",
  11143. protocol: "accessing",
  11144. fn: function (anIndex,aBlock,anotherBlock){
  11145. var self=this,$self=this;
  11146. return $core.withContext(function($ctx1) {
  11147. var result = String(self)[anIndex - 1];
  11148. return result ? aBlock._value_(result) : anotherBlock._value();
  11149. ;
  11150. return self;
  11151. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11152. },
  11153. args: ["anIndex", "aBlock", "anotherBlock"],
  11154. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  11155. referencedClasses: [],
  11156. messageSends: []
  11157. }),
  11158. $globals.String);
  11159. $core.addMethod(
  11160. $core.method({
  11161. selector: "at:put:",
  11162. protocol: "accessing",
  11163. fn: function (anIndex,anObject){
  11164. var self=this,$self=this;
  11165. return $core.withContext(function($ctx1) {
  11166. $self._errorReadOnly();
  11167. return self;
  11168. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  11169. },
  11170. args: ["anIndex", "anObject"],
  11171. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11172. referencedClasses: [],
  11173. messageSends: ["errorReadOnly"]
  11174. }),
  11175. $globals.String);
  11176. $core.addMethod(
  11177. $core.method({
  11178. selector: "capitalized",
  11179. protocol: "converting",
  11180. fn: function (){
  11181. var self=this,$self=this;
  11182. return $core.withContext(function($ctx1) {
  11183. return $self._ifNotEmpty_((function(){
  11184. return $core.withContext(function($ctx2) {
  11185. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11187. }));
  11188. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11189. },
  11190. args: [],
  11191. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11192. referencedClasses: [],
  11193. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11194. }),
  11195. $globals.String);
  11196. $core.addMethod(
  11197. $core.method({
  11198. selector: "charCodeAt:",
  11199. protocol: "accessing",
  11200. fn: function (anInteger){
  11201. var self=this,$self=this;
  11202. return $core.withContext(function($ctx1) {
  11203. return self.charCodeAt(anInteger - 1);
  11204. return self;
  11205. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11206. },
  11207. args: ["anInteger"],
  11208. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11209. referencedClasses: [],
  11210. messageSends: []
  11211. }),
  11212. $globals.String);
  11213. $core.addMethod(
  11214. $core.method({
  11215. selector: "copyFrom:to:",
  11216. protocol: "copying",
  11217. fn: function (anIndex,anotherIndex){
  11218. var self=this,$self=this;
  11219. return $core.withContext(function($ctx1) {
  11220. return self.substring(anIndex - 1, anotherIndex);
  11221. return self;
  11222. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11223. },
  11224. args: ["anIndex", "anotherIndex"],
  11225. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11226. referencedClasses: [],
  11227. messageSends: []
  11228. }),
  11229. $globals.String);
  11230. $core.addMethod(
  11231. $core.method({
  11232. selector: "crlfSanitized",
  11233. protocol: "converting",
  11234. fn: function (){
  11235. var self=this,$self=this;
  11236. return $core.withContext(function($ctx1) {
  11237. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11238. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11239. },
  11240. args: [],
  11241. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11242. referencedClasses: ["String"],
  11243. messageSends: ["join:", "lines", "lf"]
  11244. }),
  11245. $globals.String);
  11246. $core.addMethod(
  11247. $core.method({
  11248. selector: "deepCopy",
  11249. protocol: "copying",
  11250. fn: function (){
  11251. var self=this,$self=this;
  11252. return $core.withContext(function($ctx1) {
  11253. return $self._shallowCopy();
  11254. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11255. },
  11256. args: [],
  11257. source: "deepCopy\x0a\x09^ self shallowCopy",
  11258. referencedClasses: [],
  11259. messageSends: ["shallowCopy"]
  11260. }),
  11261. $globals.String);
  11262. $core.addMethod(
  11263. $core.method({
  11264. selector: "errorReadOnly",
  11265. protocol: "error handling",
  11266. fn: function (){
  11267. var self=this,$self=this;
  11268. return $core.withContext(function($ctx1) {
  11269. $self._error_("Object is read-only");
  11270. return self;
  11271. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  11272. },
  11273. args: [],
  11274. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11275. referencedClasses: [],
  11276. messageSends: ["error:"]
  11277. }),
  11278. $globals.String);
  11279. $core.addMethod(
  11280. $core.method({
  11281. selector: "escaped",
  11282. protocol: "converting",
  11283. fn: function (){
  11284. var self=this,$self=this;
  11285. return $core.withContext(function($ctx1) {
  11286. return escape(self);
  11287. return self;
  11288. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11289. },
  11290. args: [],
  11291. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11292. referencedClasses: [],
  11293. messageSends: []
  11294. }),
  11295. $globals.String);
  11296. $core.addMethod(
  11297. $core.method({
  11298. selector: "includesSubString:",
  11299. protocol: "testing",
  11300. fn: function (subString){
  11301. var self=this,$self=this;
  11302. return $core.withContext(function($ctx1) {
  11303. return self.indexOf(subString) != -1;
  11304. return self;
  11305. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11306. },
  11307. args: ["subString"],
  11308. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11309. referencedClasses: [],
  11310. messageSends: []
  11311. }),
  11312. $globals.String);
  11313. $core.addMethod(
  11314. $core.method({
  11315. selector: "isCapitalized",
  11316. protocol: "testing",
  11317. fn: function (){
  11318. var self=this,$self=this;
  11319. return $core.withContext(function($ctx1) {
  11320. var $2,$1;
  11321. $2=$self._first();
  11322. $ctx1.sendIdx["first"]=1;
  11323. $1=$recv($2)._asUppercase();
  11324. return $recv($1).__eq_eq($self._first());
  11325. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11326. },
  11327. args: [],
  11328. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11329. referencedClasses: [],
  11330. messageSends: ["==", "asUppercase", "first"]
  11331. }),
  11332. $globals.String);
  11333. $core.addMethod(
  11334. $core.method({
  11335. selector: "isImmutable",
  11336. protocol: "testing",
  11337. fn: function (){
  11338. var self=this,$self=this;
  11339. return true;
  11340. },
  11341. args: [],
  11342. source: "isImmutable\x0a\x09^ true",
  11343. referencedClasses: [],
  11344. messageSends: []
  11345. }),
  11346. $globals.String);
  11347. $core.addMethod(
  11348. $core.method({
  11349. selector: "isSelector",
  11350. protocol: "testing",
  11351. fn: function (){
  11352. var self=this,$self=this;
  11353. return $core.withContext(function($ctx1) {
  11354. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11355. return self;
  11356. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11357. },
  11358. args: [],
  11359. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  11360. referencedClasses: [],
  11361. messageSends: []
  11362. }),
  11363. $globals.String);
  11364. $core.addMethod(
  11365. $core.method({
  11366. selector: "isString",
  11367. protocol: "testing",
  11368. fn: function (){
  11369. var self=this,$self=this;
  11370. return true;
  11371. },
  11372. args: [],
  11373. source: "isString\x0a\x09^ true",
  11374. referencedClasses: [],
  11375. messageSends: []
  11376. }),
  11377. $globals.String);
  11378. $core.addMethod(
  11379. $core.method({
  11380. selector: "isVowel",
  11381. protocol: "testing",
  11382. fn: function (){
  11383. var self=this,$self=this;
  11384. return $core.withContext(function($ctx1) {
  11385. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11386. return $core.withContext(function($ctx2) {
  11387. return "aeiou"._includes_($self._asLowercase());
  11388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11389. }));
  11390. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11391. },
  11392. args: [],
  11393. 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 ]",
  11394. referencedClasses: [],
  11395. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11396. }),
  11397. $globals.String);
  11398. $core.addMethod(
  11399. $core.method({
  11400. selector: "join:",
  11401. protocol: "split join",
  11402. fn: function (aCollection){
  11403. var self=this,$self=this;
  11404. return $core.withContext(function($ctx1) {
  11405. return $recv($globals.String)._streamContents_((function(stream){
  11406. return $core.withContext(function($ctx2) {
  11407. return $recv(aCollection)._do_separatedBy_((function(each){
  11408. return $core.withContext(function($ctx3) {
  11409. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11410. $ctx3.sendIdx["nextPutAll:"]=1;
  11411. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11412. }),(function(){
  11413. return $core.withContext(function($ctx3) {
  11414. return $recv(stream)._nextPutAll_(self);
  11415. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11416. }));
  11417. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11418. }));
  11419. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11420. },
  11421. args: ["aCollection"],
  11422. 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 ]]",
  11423. referencedClasses: ["String"],
  11424. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11425. }),
  11426. $globals.String);
  11427. $core.addMethod(
  11428. $core.method({
  11429. selector: "lineIndicesDo:",
  11430. protocol: "split join",
  11431. fn: function (aBlock){
  11432. var self=this,$self=this;
  11433. var cr,lf,start,sz,nextLF,nextCR;
  11434. return $core.withContext(function($ctx1) {
  11435. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11436. var $early={};
  11437. try {
  11438. start=(1);
  11439. sz=$self._size();
  11440. cr=$recv($globals.String)._cr();
  11441. nextCR=$self._indexOf_startingAt_(cr,(1));
  11442. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11443. lf=$recv($globals.String)._lf();
  11444. nextLF=$self._indexOf_startingAt_(lf,(1));
  11445. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11446. $recv((function(){
  11447. return $core.withContext(function($ctx2) {
  11448. return $recv(start).__lt_eq(sz);
  11449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11450. }))._whileTrue_((function(){
  11451. return $core.withContext(function($ctx2) {
  11452. $2=$recv(nextLF).__eq((0));
  11453. $ctx2.sendIdx["="]=1;
  11454. $1=$recv($2)._and_((function(){
  11455. return $core.withContext(function($ctx3) {
  11456. return $recv(nextCR).__eq((0));
  11457. $ctx3.sendIdx["="]=2;
  11458. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11459. }));
  11460. $ctx2.sendIdx["and:"]=1;
  11461. if($core.assert($1)){
  11462. $recv(aBlock)._value_value_value_(start,sz,sz);
  11463. $ctx2.sendIdx["value:value:value:"]=1;
  11464. throw $early=[self];
  11465. }
  11466. $4=$recv(nextCR).__eq((0));
  11467. $ctx2.sendIdx["="]=3;
  11468. $3=$recv($4)._or_((function(){
  11469. return $core.withContext(function($ctx3) {
  11470. $5=(0).__lt(nextLF);
  11471. $ctx3.sendIdx["<"]=1;
  11472. return $recv($5)._and_((function(){
  11473. return $core.withContext(function($ctx4) {
  11474. return $recv(nextLF).__lt(nextCR);
  11475. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11476. }));
  11477. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11478. }));
  11479. if($core.assert($3)){
  11480. $6=start;
  11481. $7=$recv(nextLF).__minus((1));
  11482. $ctx2.sendIdx["-"]=1;
  11483. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11484. $ctx2.sendIdx["value:value:value:"]=2;
  11485. start=(1).__plus(nextLF);
  11486. $ctx2.sendIdx["+"]=1;
  11487. nextLF=$self._indexOf_startingAt_(lf,start);
  11488. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11489. return nextLF;
  11490. } else {
  11491. $9=(1).__plus(nextCR);
  11492. $ctx2.sendIdx["+"]=2;
  11493. $8=$recv($9).__eq(nextLF);
  11494. if($core.assert($8)){
  11495. $10=start;
  11496. $11=$recv(nextCR).__minus((1));
  11497. $ctx2.sendIdx["-"]=2;
  11498. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11499. $ctx2.sendIdx["value:value:value:"]=3;
  11500. start=(1).__plus(nextLF);
  11501. $ctx2.sendIdx["+"]=3;
  11502. nextCR=$self._indexOf_startingAt_(cr,start);
  11503. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11504. nextLF=$self._indexOf_startingAt_(lf,start);
  11505. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11506. return nextLF;
  11507. } else {
  11508. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11509. start=(1).__plus(nextCR);
  11510. nextCR=$self._indexOf_startingAt_(cr,start);
  11511. return nextCR;
  11512. }
  11513. }
  11514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11515. }));
  11516. return self;
  11517. }
  11518. catch(e) {if(e===$early)return e[0]; throw e}
  11519. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11520. },
  11521. args: ["aBlock"],
  11522. 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 ] ]]",
  11523. referencedClasses: ["String"],
  11524. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11525. }),
  11526. $globals.String);
  11527. $core.addMethod(
  11528. $core.method({
  11529. selector: "lineNumber:",
  11530. protocol: "split join",
  11531. fn: function (anIndex){
  11532. var self=this,$self=this;
  11533. var lineCount;
  11534. return $core.withContext(function($ctx1) {
  11535. var $2,$1;
  11536. var $early={};
  11537. try {
  11538. lineCount=(0);
  11539. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11540. return $core.withContext(function($ctx2) {
  11541. lineCount=$recv(lineCount).__plus((1));
  11542. $2=lineCount;
  11543. $1=$recv($2).__eq(anIndex);
  11544. if($core.assert($1)){
  11545. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11546. }
  11547. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11548. }));
  11549. return nil;
  11550. }
  11551. catch(e) {if(e===$early)return e[0]; throw e}
  11552. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11553. },
  11554. args: ["anIndex"],
  11555. 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",
  11556. referencedClasses: [],
  11557. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11558. }),
  11559. $globals.String);
  11560. $core.addMethod(
  11561. $core.method({
  11562. selector: "lines",
  11563. protocol: "split join",
  11564. fn: function (){
  11565. var self=this,$self=this;
  11566. return $core.withContext(function($ctx1) {
  11567. var result = self.split(/\r\n|\r|\n/);
  11568. if (!result[result.length-1]) result.pop();
  11569. return result;;
  11570. return self;
  11571. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11572. },
  11573. args: [],
  11574. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  11575. referencedClasses: [],
  11576. messageSends: []
  11577. }),
  11578. $globals.String);
  11579. $core.addMethod(
  11580. $core.method({
  11581. selector: "linesDo:",
  11582. protocol: "split join",
  11583. fn: function (aBlock){
  11584. var self=this,$self=this;
  11585. return $core.withContext(function($ctx1) {
  11586. $recv($self._lines())._do_(aBlock);
  11587. return self;
  11588. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11589. },
  11590. args: ["aBlock"],
  11591. 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",
  11592. referencedClasses: [],
  11593. messageSends: ["do:", "lines"]
  11594. }),
  11595. $globals.String);
  11596. $core.addMethod(
  11597. $core.method({
  11598. selector: "match:",
  11599. protocol: "regular expressions",
  11600. fn: function (aRegexp){
  11601. var self=this,$self=this;
  11602. return $core.withContext(function($ctx1) {
  11603. return self.search(aRegexp) != -1;
  11604. return self;
  11605. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11606. },
  11607. args: ["aRegexp"],
  11608. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11609. referencedClasses: [],
  11610. messageSends: []
  11611. }),
  11612. $globals.String);
  11613. $core.addMethod(
  11614. $core.method({
  11615. selector: "matchesOf:",
  11616. protocol: "regular expressions",
  11617. fn: function (aRegularExpression){
  11618. var self=this,$self=this;
  11619. return $core.withContext(function($ctx1) {
  11620. return self.match(aRegularExpression);
  11621. return self;
  11622. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11623. },
  11624. args: ["aRegularExpression"],
  11625. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11626. referencedClasses: [],
  11627. messageSends: []
  11628. }),
  11629. $globals.String);
  11630. $core.addMethod(
  11631. $core.method({
  11632. selector: "printNl",
  11633. protocol: "printing",
  11634. fn: function (){
  11635. var self=this,$self=this;
  11636. return $core.withContext(function($ctx1) {
  11637. console.log(self);
  11638. return self;
  11639. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11640. },
  11641. args: [],
  11642. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11643. referencedClasses: [],
  11644. messageSends: []
  11645. }),
  11646. $globals.String);
  11647. $core.addMethod(
  11648. $core.method({
  11649. selector: "printOn:",
  11650. protocol: "printing",
  11651. fn: function (aStream){
  11652. var self=this,$self=this;
  11653. return $core.withContext(function($ctx1) {
  11654. $recv(aStream)._nextPutAll_("'");
  11655. $ctx1.sendIdx["nextPutAll:"]=1;
  11656. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11657. $ctx1.sendIdx["nextPutAll:"]=2;
  11658. $recv(aStream)._nextPutAll_("'");
  11659. return self;
  11660. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11661. },
  11662. args: ["aStream"],
  11663. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11664. referencedClasses: [],
  11665. messageSends: ["nextPutAll:", "replace:with:"]
  11666. }),
  11667. $globals.String);
  11668. $core.addMethod(
  11669. $core.method({
  11670. selector: "putOn:",
  11671. protocol: "streaming",
  11672. fn: function (aStream){
  11673. var self=this,$self=this;
  11674. return $core.withContext(function($ctx1) {
  11675. $recv(aStream)._nextPutString_(self);
  11676. return self;
  11677. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  11678. },
  11679. args: ["aStream"],
  11680. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11681. referencedClasses: [],
  11682. messageSends: ["nextPutString:"]
  11683. }),
  11684. $globals.String);
  11685. $core.addMethod(
  11686. $core.method({
  11687. selector: "remove:",
  11688. protocol: "adding/removing",
  11689. fn: function (anObject){
  11690. var self=this,$self=this;
  11691. return $core.withContext(function($ctx1) {
  11692. $self._errorReadOnly();
  11693. return self;
  11694. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  11695. },
  11696. args: ["anObject"],
  11697. source: "remove: anObject\x0a\x09self errorReadOnly",
  11698. referencedClasses: [],
  11699. messageSends: ["errorReadOnly"]
  11700. }),
  11701. $globals.String);
  11702. $core.addMethod(
  11703. $core.method({
  11704. selector: "remove:ifAbsent:",
  11705. protocol: "adding/removing",
  11706. fn: function (anObject,aBlock){
  11707. var self=this,$self=this;
  11708. return $core.withContext(function($ctx1) {
  11709. $self._errorReadOnly();
  11710. return self;
  11711. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  11712. },
  11713. args: ["anObject", "aBlock"],
  11714. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11715. referencedClasses: [],
  11716. messageSends: ["errorReadOnly"]
  11717. }),
  11718. $globals.String);
  11719. $core.addMethod(
  11720. $core.method({
  11721. selector: "replace:with:",
  11722. protocol: "regular expressions",
  11723. fn: function (aString,anotherString){
  11724. var self=this,$self=this;
  11725. return $core.withContext(function($ctx1) {
  11726. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11727. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11728. },
  11729. args: ["aString", "anotherString"],
  11730. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11731. referencedClasses: ["RegularExpression"],
  11732. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11733. }),
  11734. $globals.String);
  11735. $core.addMethod(
  11736. $core.method({
  11737. selector: "replaceRegexp:with:",
  11738. protocol: "regular expressions",
  11739. fn: function (aRegexp,aString){
  11740. var self=this,$self=this;
  11741. return $core.withContext(function($ctx1) {
  11742. return self.replace(aRegexp, aString);
  11743. return self;
  11744. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11745. },
  11746. args: ["aRegexp", "aString"],
  11747. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11748. referencedClasses: [],
  11749. messageSends: []
  11750. }),
  11751. $globals.String);
  11752. $core.addMethod(
  11753. $core.method({
  11754. selector: "reversed",
  11755. protocol: "converting",
  11756. fn: function (){
  11757. var self=this,$self=this;
  11758. return $core.withContext(function($ctx1) {
  11759. return self.split("").reverse().join("");
  11760. return self;
  11761. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11762. },
  11763. args: [],
  11764. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11765. referencedClasses: [],
  11766. messageSends: []
  11767. }),
  11768. $globals.String);
  11769. $core.addMethod(
  11770. $core.method({
  11771. selector: "shallowCopy",
  11772. protocol: "copying",
  11773. fn: function (){
  11774. var self=this,$self=this;
  11775. return self;
  11776. },
  11777. args: [],
  11778. source: "shallowCopy\x0a\x09^ self",
  11779. referencedClasses: [],
  11780. messageSends: []
  11781. }),
  11782. $globals.String);
  11783. $core.addMethod(
  11784. $core.method({
  11785. selector: "subStrings:",
  11786. protocol: "split join",
  11787. fn: function (aString){
  11788. var self=this,$self=this;
  11789. return $core.withContext(function($ctx1) {
  11790. return $self._tokenize_(aString);
  11791. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11792. },
  11793. args: ["aString"],
  11794. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11795. referencedClasses: [],
  11796. messageSends: ["tokenize:"]
  11797. }),
  11798. $globals.String);
  11799. $core.addMethod(
  11800. $core.method({
  11801. selector: "symbolPrintString",
  11802. protocol: "printing",
  11803. fn: function (){
  11804. var self=this,$self=this;
  11805. return $core.withContext(function($ctx1) {
  11806. return $recv($globals.String)._streamContents_((function(str){
  11807. return $core.withContext(function($ctx2) {
  11808. return $self._asSymbolPrintOn_(str);
  11809. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11810. }));
  11811. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  11812. },
  11813. args: [],
  11814. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11815. referencedClasses: ["String"],
  11816. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11817. }),
  11818. $globals.String);
  11819. $core.addMethod(
  11820. $core.method({
  11821. selector: "tokenize:",
  11822. protocol: "split join",
  11823. fn: function (aString){
  11824. var self=this,$self=this;
  11825. return $core.withContext(function($ctx1) {
  11826. return self.split(aString);
  11827. return self;
  11828. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11829. },
  11830. args: ["aString"],
  11831. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11832. referencedClasses: [],
  11833. messageSends: []
  11834. }),
  11835. $globals.String);
  11836. $core.addMethod(
  11837. $core.method({
  11838. selector: "trimBoth",
  11839. protocol: "regular expressions",
  11840. fn: function (){
  11841. var self=this,$self=this;
  11842. return $core.withContext(function($ctx1) {
  11843. return $self._trimBoth_("\x5cs");
  11844. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11845. },
  11846. args: [],
  11847. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11848. referencedClasses: [],
  11849. messageSends: ["trimBoth:"]
  11850. }),
  11851. $globals.String);
  11852. $core.addMethod(
  11853. $core.method({
  11854. selector: "trimBoth:",
  11855. protocol: "regular expressions",
  11856. fn: function (separators){
  11857. var self=this,$self=this;
  11858. return $core.withContext(function($ctx1) {
  11859. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11860. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11861. },
  11862. args: ["separators"],
  11863. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11864. referencedClasses: [],
  11865. messageSends: ["trimRight:", "trimLeft:"]
  11866. }),
  11867. $globals.String);
  11868. $core.addMethod(
  11869. $core.method({
  11870. selector: "trimLeft",
  11871. protocol: "regular expressions",
  11872. fn: function (){
  11873. var self=this,$self=this;
  11874. return $core.withContext(function($ctx1) {
  11875. return $self._trimLeft_("\x5cs");
  11876. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11877. },
  11878. args: [],
  11879. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11880. referencedClasses: [],
  11881. messageSends: ["trimLeft:"]
  11882. }),
  11883. $globals.String);
  11884. $core.addMethod(
  11885. $core.method({
  11886. selector: "trimLeft:",
  11887. protocol: "regular expressions",
  11888. fn: function (separators){
  11889. var self=this,$self=this;
  11890. return $core.withContext(function($ctx1) {
  11891. var $2,$1;
  11892. $2=$recv("^[".__comma(separators)).__comma("]+");
  11893. $ctx1.sendIdx[","]=1;
  11894. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11895. return $self._replaceRegexp_with_($1,"");
  11896. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11897. },
  11898. args: ["separators"],
  11899. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11900. referencedClasses: ["RegularExpression"],
  11901. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11902. }),
  11903. $globals.String);
  11904. $core.addMethod(
  11905. $core.method({
  11906. selector: "trimRight",
  11907. protocol: "regular expressions",
  11908. fn: function (){
  11909. var self=this,$self=this;
  11910. return $core.withContext(function($ctx1) {
  11911. return $self._trimRight_("\x5cs");
  11912. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11913. },
  11914. args: [],
  11915. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11916. referencedClasses: [],
  11917. messageSends: ["trimRight:"]
  11918. }),
  11919. $globals.String);
  11920. $core.addMethod(
  11921. $core.method({
  11922. selector: "trimRight:",
  11923. protocol: "regular expressions",
  11924. fn: function (separators){
  11925. var self=this,$self=this;
  11926. return $core.withContext(function($ctx1) {
  11927. var $2,$1;
  11928. $2=$recv("[".__comma(separators)).__comma("]+$");
  11929. $ctx1.sendIdx[","]=1;
  11930. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11931. return $self._replaceRegexp_with_($1,"");
  11932. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11933. },
  11934. args: ["separators"],
  11935. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11936. referencedClasses: ["RegularExpression"],
  11937. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11938. }),
  11939. $globals.String);
  11940. $core.addMethod(
  11941. $core.method({
  11942. selector: "unescaped",
  11943. protocol: "converting",
  11944. fn: function (){
  11945. var self=this,$self=this;
  11946. return $core.withContext(function($ctx1) {
  11947. return unescape(self);
  11948. return self;
  11949. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11950. },
  11951. args: [],
  11952. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11953. referencedClasses: [],
  11954. messageSends: []
  11955. }),
  11956. $globals.String);
  11957. $core.addMethod(
  11958. $core.method({
  11959. selector: "uriComponentDecoded",
  11960. protocol: "converting",
  11961. fn: function (){
  11962. var self=this,$self=this;
  11963. return $core.withContext(function($ctx1) {
  11964. return decodeURIComponent(self);
  11965. return self;
  11966. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11967. },
  11968. args: [],
  11969. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11970. referencedClasses: [],
  11971. messageSends: []
  11972. }),
  11973. $globals.String);
  11974. $core.addMethod(
  11975. $core.method({
  11976. selector: "uriComponentEncoded",
  11977. protocol: "converting",
  11978. fn: function (){
  11979. var self=this,$self=this;
  11980. return $core.withContext(function($ctx1) {
  11981. return encodeURIComponent(self);
  11982. return self;
  11983. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11984. },
  11985. args: [],
  11986. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11987. referencedClasses: [],
  11988. messageSends: []
  11989. }),
  11990. $globals.String);
  11991. $core.addMethod(
  11992. $core.method({
  11993. selector: "uriDecoded",
  11994. protocol: "converting",
  11995. fn: function (){
  11996. var self=this,$self=this;
  11997. return $core.withContext(function($ctx1) {
  11998. return decodeURI(self);
  11999. return self;
  12000. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12001. },
  12002. args: [],
  12003. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12004. referencedClasses: [],
  12005. messageSends: []
  12006. }),
  12007. $globals.String);
  12008. $core.addMethod(
  12009. $core.method({
  12010. selector: "uriEncoded",
  12011. protocol: "converting",
  12012. fn: function (){
  12013. var self=this,$self=this;
  12014. return $core.withContext(function($ctx1) {
  12015. return encodeURI(self);
  12016. return self;
  12017. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12018. },
  12019. args: [],
  12020. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12021. referencedClasses: [],
  12022. messageSends: []
  12023. }),
  12024. $globals.String);
  12025. $core.addMethod(
  12026. $core.method({
  12027. selector: "value:",
  12028. protocol: "evaluating",
  12029. fn: function (anObject){
  12030. var self=this,$self=this;
  12031. return $core.withContext(function($ctx1) {
  12032. return $recv(anObject)._perform_(self);
  12033. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12034. },
  12035. args: ["anObject"],
  12036. source: "value: anObject \x0a\x09^ anObject perform: self",
  12037. referencedClasses: [],
  12038. messageSends: ["perform:"]
  12039. }),
  12040. $globals.String);
  12041. $core.addMethod(
  12042. $core.method({
  12043. selector: "cr",
  12044. protocol: "accessing",
  12045. fn: function (){
  12046. var self=this,$self=this;
  12047. return $core.withContext(function($ctx1) {
  12048. return "\r";
  12049. return self;
  12050. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12051. },
  12052. args: [],
  12053. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12054. referencedClasses: [],
  12055. messageSends: []
  12056. }),
  12057. $globals.String.a$cls);
  12058. $core.addMethod(
  12059. $core.method({
  12060. selector: "crlf",
  12061. protocol: "accessing",
  12062. fn: function (){
  12063. var self=this,$self=this;
  12064. return $core.withContext(function($ctx1) {
  12065. return "\r\n";
  12066. return self;
  12067. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12068. },
  12069. args: [],
  12070. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12071. referencedClasses: [],
  12072. messageSends: []
  12073. }),
  12074. $globals.String.a$cls);
  12075. $core.addMethod(
  12076. $core.method({
  12077. selector: "esc",
  12078. protocol: "accessing",
  12079. fn: function (){
  12080. var self=this,$self=this;
  12081. return $core.withContext(function($ctx1) {
  12082. return $self._fromCharCode_((27));
  12083. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12084. },
  12085. args: [],
  12086. source: "esc\x0a\x09^ self fromCharCode: 27",
  12087. referencedClasses: [],
  12088. messageSends: ["fromCharCode:"]
  12089. }),
  12090. $globals.String.a$cls);
  12091. $core.addMethod(
  12092. $core.method({
  12093. selector: "fromCharCode:",
  12094. protocol: "instance creation",
  12095. fn: function (anInteger){
  12096. var self=this,$self=this;
  12097. return $core.withContext(function($ctx1) {
  12098. return String.fromCharCode(anInteger);
  12099. return self;
  12100. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12101. },
  12102. args: ["anInteger"],
  12103. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12104. referencedClasses: [],
  12105. messageSends: []
  12106. }),
  12107. $globals.String.a$cls);
  12108. $core.addMethod(
  12109. $core.method({
  12110. selector: "fromString:",
  12111. protocol: "instance creation",
  12112. fn: function (aString){
  12113. var self=this,$self=this;
  12114. return $core.withContext(function($ctx1) {
  12115. return String(aString);
  12116. return self;
  12117. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12118. },
  12119. args: ["aString"],
  12120. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12121. referencedClasses: [],
  12122. messageSends: []
  12123. }),
  12124. $globals.String.a$cls);
  12125. $core.addMethod(
  12126. $core.method({
  12127. selector: "lf",
  12128. protocol: "accessing",
  12129. fn: function (){
  12130. var self=this,$self=this;
  12131. return $core.withContext(function($ctx1) {
  12132. return "\n";
  12133. return self;
  12134. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12135. },
  12136. args: [],
  12137. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12138. referencedClasses: [],
  12139. messageSends: []
  12140. }),
  12141. $globals.String.a$cls);
  12142. $core.addMethod(
  12143. $core.method({
  12144. selector: "random",
  12145. protocol: "random",
  12146. fn: function (){
  12147. var self=this,$self=this;
  12148. return $core.withContext(function($ctx1) {
  12149. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12150. return self;
  12151. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12152. },
  12153. args: [],
  12154. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12155. referencedClasses: [],
  12156. messageSends: []
  12157. }),
  12158. $globals.String.a$cls);
  12159. $core.addMethod(
  12160. $core.method({
  12161. selector: "randomNotIn:",
  12162. protocol: "random",
  12163. fn: function (aString){
  12164. var self=this,$self=this;
  12165. var result;
  12166. return $core.withContext(function($ctx1) {
  12167. $recv((function(){
  12168. return $core.withContext(function($ctx2) {
  12169. result=$self._random();
  12170. return $recv(aString)._includesSubString_(result);
  12171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12172. }))._whileTrue();
  12173. return result;
  12174. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12175. },
  12176. args: ["aString"],
  12177. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12178. referencedClasses: [],
  12179. messageSends: ["whileTrue", "random", "includesSubString:"]
  12180. }),
  12181. $globals.String.a$cls);
  12182. $core.addMethod(
  12183. $core.method({
  12184. selector: "space",
  12185. protocol: "accessing",
  12186. fn: function (){
  12187. var self=this,$self=this;
  12188. return $core.withContext(function($ctx1) {
  12189. return " ";
  12190. return self;
  12191. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12192. },
  12193. args: [],
  12194. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12195. referencedClasses: [],
  12196. messageSends: []
  12197. }),
  12198. $globals.String.a$cls);
  12199. $core.addMethod(
  12200. $core.method({
  12201. selector: "streamClass",
  12202. protocol: "accessing",
  12203. fn: function (){
  12204. var self=this,$self=this;
  12205. return $globals.StringStream;
  12206. },
  12207. args: [],
  12208. source: "streamClass\x0a\x09\x09^ StringStream",
  12209. referencedClasses: ["StringStream"],
  12210. messageSends: []
  12211. }),
  12212. $globals.String.a$cls);
  12213. $core.addMethod(
  12214. $core.method({
  12215. selector: "tab",
  12216. protocol: "accessing",
  12217. fn: function (){
  12218. var self=this,$self=this;
  12219. return $core.withContext(function($ctx1) {
  12220. return "\t";
  12221. return self;
  12222. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12223. },
  12224. args: [],
  12225. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12226. referencedClasses: [],
  12227. messageSends: []
  12228. }),
  12229. $globals.String.a$cls);
  12230. $core.addMethod(
  12231. $core.method({
  12232. selector: "value:",
  12233. protocol: "instance creation",
  12234. fn: function (aUTFCharCode){
  12235. var self=this,$self=this;
  12236. return $core.withContext(function($ctx1) {
  12237. return String.fromCharCode(aUTFCharCode);;
  12238. return self;
  12239. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12240. },
  12241. args: ["aUTFCharCode"],
  12242. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12243. referencedClasses: [],
  12244. messageSends: []
  12245. }),
  12246. $globals.String.a$cls);
  12247. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12248. $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`.";
  12249. $core.addMethod(
  12250. $core.method({
  12251. selector: "=",
  12252. protocol: "comparing",
  12253. fn: function (aCollection){
  12254. var self=this,$self=this;
  12255. return $core.withContext(function($ctx1) {
  12256. var $2,$1,$4,$3,$5;
  12257. var $early={};
  12258. try {
  12259. $2=$self._class();
  12260. $ctx1.sendIdx["class"]=1;
  12261. $1=$recv($2).__eq($recv(aCollection)._class());
  12262. $ctx1.sendIdx["="]=1;
  12263. if(!$core.assert($1)){
  12264. return false;
  12265. }
  12266. $4=$self._size();
  12267. $ctx1.sendIdx["size"]=1;
  12268. $3=$recv($4).__eq($recv(aCollection)._size());
  12269. if(!$core.assert($3)){
  12270. return false;
  12271. }
  12272. $self._do_((function(each){
  12273. return $core.withContext(function($ctx2) {
  12274. $5=$recv(aCollection)._includes_(each);
  12275. if(!$core.assert($5)){
  12276. throw $early=[false];
  12277. }
  12278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12279. }));
  12280. return true;
  12281. }
  12282. catch(e) {if(e===$early)return e[0]; throw e}
  12283. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12284. },
  12285. args: ["aCollection"],
  12286. 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",
  12287. referencedClasses: [],
  12288. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12289. }),
  12290. $globals.Set);
  12291. $core.addMethod(
  12292. $core.method({
  12293. selector: "add:",
  12294. protocol: "adding/removing",
  12295. fn: function (anObject){
  12296. var self=this,$self=this;
  12297. var bucket;
  12298. return $core.withContext(function($ctx1) {
  12299. var $1,$receiver;
  12300. bucket=$self._bucketsOfElement_(anObject);
  12301. $1=$recv(bucket)._second();
  12302. if(($receiver = $1) == null || $receiver.a$nil){
  12303. var object,slowBucket;
  12304. object=$recv(bucket)._first();
  12305. $ctx1.sendIdx["first"]=1;
  12306. slowBucket=$recv(bucket)._third();
  12307. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12308. return $core.withContext(function($ctx2) {
  12309. $recv(slowBucket)._add_(object);
  12310. $self["@size"]=$recv($self["@size"]).__plus((1));
  12311. return $self["@size"];
  12312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12313. }));
  12314. return object;
  12315. } else {
  12316. var primitiveBucket;
  12317. primitiveBucket=$receiver;
  12318. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12319. }
  12320. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12321. },
  12322. args: ["anObject"],
  12323. 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 ]",
  12324. referencedClasses: [],
  12325. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12326. }),
  12327. $globals.Set);
  12328. $core.addMethod(
  12329. $core.method({
  12330. selector: "add:in:",
  12331. protocol: "private",
  12332. fn: function (anObject,anotherObject){
  12333. var self=this,$self=this;
  12334. return $core.withContext(function($ctx1) {
  12335. if (anObject in anotherObject.store) { return anObject; }
  12336. $self['@size']++;
  12337. anotherObject.store[anObject] = true;
  12338. return anObject;
  12339. ;
  12340. return self;
  12341. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12342. },
  12343. args: ["anObject", "anotherObject"],
  12344. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12345. referencedClasses: [],
  12346. messageSends: []
  12347. }),
  12348. $globals.Set);
  12349. $core.addMethod(
  12350. $core.method({
  12351. selector: "bucketsOfElement:",
  12352. protocol: "private",
  12353. fn: function (anObject){
  12354. var self=this,$self=this;
  12355. return $core.withContext(function($ctx1) {
  12356. // include nil to well-known objects under "boolean" fastBucket
  12357. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12358. var prim = anObject.valueOf();
  12359. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12360. var bucket = null;
  12361. $self['@slowBucketStores'].some(function (store) {
  12362. return bucket = store._bucketOfElement_(anObject);
  12363. });
  12364. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12365. }
  12366. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12367. ;
  12368. return self;
  12369. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12370. },
  12371. args: ["anObject"],
  12372. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  12373. referencedClasses: [],
  12374. messageSends: []
  12375. }),
  12376. $globals.Set);
  12377. $core.addMethod(
  12378. $core.method({
  12379. selector: "classNameOf:",
  12380. protocol: "private",
  12381. fn: function (anObject){
  12382. var self=this,$self=this;
  12383. return $core.withContext(function($ctx1) {
  12384. return anObject.a$cls != null && anObject.a$cls.name;
  12385. return self;
  12386. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12387. },
  12388. args: ["anObject"],
  12389. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  12390. referencedClasses: [],
  12391. messageSends: []
  12392. }),
  12393. $globals.Set);
  12394. $core.addMethod(
  12395. $core.method({
  12396. selector: "collect:",
  12397. protocol: "enumerating",
  12398. fn: function (aBlock){
  12399. var self=this,$self=this;
  12400. var collection;
  12401. return $core.withContext(function($ctx1) {
  12402. collection=$recv($self._class())._new();
  12403. $self._do_((function(each){
  12404. return $core.withContext(function($ctx2) {
  12405. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12407. }));
  12408. return collection;
  12409. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12410. },
  12411. args: ["aBlock"],
  12412. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12413. referencedClasses: [],
  12414. messageSends: ["new", "class", "do:", "add:", "value:"]
  12415. }),
  12416. $globals.Set);
  12417. $core.addMethod(
  12418. $core.method({
  12419. selector: "do:",
  12420. protocol: "enumerating",
  12421. fn: function (aBlock){
  12422. var self=this,$self=this;
  12423. return $core.withContext(function($ctx1) {
  12424. var el, keys, i;
  12425. el = $self['@fastBuckets'];
  12426. keys = Object.keys(el);
  12427. for (i = 0; i < keys.length; ++i) {
  12428. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12429. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12430. else { store._do_(aBlock); }
  12431. }
  12432. el = $self['@slowBucketStores'];
  12433. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12434. $self['@defaultBucket']._do_(aBlock);
  12435. ;
  12436. return self;
  12437. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12438. },
  12439. args: ["aBlock"],
  12440. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  12441. referencedClasses: [],
  12442. messageSends: []
  12443. }),
  12444. $globals.Set);
  12445. $core.addMethod(
  12446. $core.method({
  12447. selector: "includes:",
  12448. protocol: "testing",
  12449. fn: function (anObject){
  12450. var self=this,$self=this;
  12451. var bucket;
  12452. return $core.withContext(function($ctx1) {
  12453. var $1,$2,$3,$receiver;
  12454. bucket=$self._bucketsOfElement_(anObject);
  12455. $1=$recv(bucket)._second();
  12456. if(($receiver = $1) == null || $receiver.a$nil){
  12457. $2=$recv(bucket)._third();
  12458. $3=$recv(bucket)._first();
  12459. $ctx1.sendIdx["first"]=1;
  12460. return $recv($2)._includes_($3);
  12461. } else {
  12462. var primitiveBucket;
  12463. primitiveBucket=$receiver;
  12464. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12465. }
  12466. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12467. },
  12468. args: ["anObject"],
  12469. 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 ]",
  12470. referencedClasses: [],
  12471. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12472. }),
  12473. $globals.Set);
  12474. $core.addMethod(
  12475. $core.method({
  12476. selector: "includes:in:",
  12477. protocol: "private",
  12478. fn: function (anObject,anotherObject){
  12479. var self=this,$self=this;
  12480. return $core.withContext(function($ctx1) {
  12481. return anObject in anotherObject.store;
  12482. return self;
  12483. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12484. },
  12485. args: ["anObject", "anotherObject"],
  12486. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12487. referencedClasses: [],
  12488. messageSends: []
  12489. }),
  12490. $globals.Set);
  12491. $core.addMethod(
  12492. $core.method({
  12493. selector: "initialize",
  12494. protocol: "initialization",
  12495. fn: function (){
  12496. var self=this,$self=this;
  12497. return $core.withContext(function($ctx1) {
  12498. (
  12499. $ctx1.supercall = true,
  12500. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12501. $ctx1.supercall = false;
  12502. $self["@defaultBucket"]=[];
  12503. $self._initializeSlowBucketStores();
  12504. $self._removeAll();
  12505. return self;
  12506. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12507. },
  12508. args: [],
  12509. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12510. referencedClasses: [],
  12511. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12512. }),
  12513. $globals.Set);
  12514. $core.addMethod(
  12515. $core.method({
  12516. selector: "initializeSlowBucketStores",
  12517. protocol: "initialization",
  12518. fn: function (){
  12519. var self=this,$self=this;
  12520. return $core.withContext(function($ctx1) {
  12521. var $1;
  12522. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12523. return $core.withContext(function($ctx2) {
  12524. return $self._classNameOf_(x);
  12525. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12526. }));
  12527. $ctx1.sendIdx["hashBlock:"]=1;
  12528. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12529. return $core.withContext(function($ctx2) {
  12530. return $self._jsConstructorNameOf_(x);
  12531. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12532. }))];
  12533. return self;
  12534. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12535. },
  12536. args: [],
  12537. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12538. referencedClasses: ["ArrayBucketStore"],
  12539. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12540. }),
  12541. $globals.Set);
  12542. $core.addMethod(
  12543. $core.method({
  12544. selector: "jsConstructorNameOf:",
  12545. protocol: "private",
  12546. fn: function (anObject){
  12547. var self=this,$self=this;
  12548. return $core.withContext(function($ctx1) {
  12549. return anObject.constructor && anObject.constructor.name;
  12550. return self;
  12551. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12552. },
  12553. args: ["anObject"],
  12554. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12555. referencedClasses: [],
  12556. messageSends: []
  12557. }),
  12558. $globals.Set);
  12559. $core.addMethod(
  12560. $core.method({
  12561. selector: "printOn:",
  12562. protocol: "printing",
  12563. fn: function (aStream){
  12564. var self=this,$self=this;
  12565. return $core.withContext(function($ctx1) {
  12566. (
  12567. $ctx1.supercall = true,
  12568. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12569. $ctx1.supercall = false;
  12570. $ctx1.sendIdx["printOn:"]=1;
  12571. $recv(aStream)._nextPutAll_(" (");
  12572. $ctx1.sendIdx["nextPutAll:"]=1;
  12573. $self._do_separatedBy_((function(each){
  12574. return $core.withContext(function($ctx2) {
  12575. return $recv(each)._printOn_(aStream);
  12576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12577. }),(function(){
  12578. return $core.withContext(function($ctx2) {
  12579. return $recv(aStream)._nextPutAll_(" ");
  12580. $ctx2.sendIdx["nextPutAll:"]=2;
  12581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12582. }));
  12583. $recv(aStream)._nextPutAll_(")");
  12584. return self;
  12585. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12586. },
  12587. args: ["aStream"],
  12588. 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: ')'",
  12589. referencedClasses: [],
  12590. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12591. }),
  12592. $globals.Set);
  12593. $core.addMethod(
  12594. $core.method({
  12595. selector: "remove:ifAbsent:",
  12596. protocol: "adding/removing",
  12597. fn: function (anObject,aBlock){
  12598. var self=this,$self=this;
  12599. var bucket;
  12600. return $core.withContext(function($ctx1) {
  12601. var $1,$2,$3,$receiver;
  12602. var $early={};
  12603. try {
  12604. bucket=$self._bucketsOfElement_(anObject);
  12605. $1=$recv(bucket)._second();
  12606. if(($receiver = $1) == null || $receiver.a$nil){
  12607. $2=$recv(bucket)._third();
  12608. $3=$recv(bucket)._first();
  12609. $ctx1.sendIdx["first"]=1;
  12610. $recv($2)._remove_ifAbsent_($3,(function(){
  12611. return $core.withContext(function($ctx2) {
  12612. throw $early=[$recv(aBlock)._value()];
  12613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12614. }));
  12615. $self["@size"]=$recv($self["@size"]).__minus((1));
  12616. return $self["@size"];
  12617. } else {
  12618. var primitiveBucket;
  12619. primitiveBucket=$receiver;
  12620. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12621. }
  12622. }
  12623. catch(e) {if(e===$early)return e[0]; throw e}
  12624. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12625. },
  12626. args: ["anObject", "aBlock"],
  12627. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  12628. referencedClasses: [],
  12629. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  12630. }),
  12631. $globals.Set);
  12632. $core.addMethod(
  12633. $core.method({
  12634. selector: "remove:in:ifAbsent:",
  12635. protocol: "private",
  12636. fn: function (anObject,anotherObject,aBlock){
  12637. var self=this,$self=this;
  12638. return $core.withContext(function($ctx1) {
  12639. if (anObject in anotherObject.store) {
  12640. delete anotherObject.store[anObject];
  12641. $self['@size']--;
  12642. return anObject;
  12643. } else {
  12644. return aBlock._value();
  12645. };
  12646. return self;
  12647. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  12648. },
  12649. args: ["anObject", "anotherObject", "aBlock"],
  12650. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self[''@size'']--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12651. referencedClasses: [],
  12652. messageSends: []
  12653. }),
  12654. $globals.Set);
  12655. $core.addMethod(
  12656. $core.method({
  12657. selector: "removeAll",
  12658. protocol: "adding/removing",
  12659. fn: function (){
  12660. var self=this,$self=this;
  12661. return $core.withContext(function($ctx1) {
  12662. $self['@fastBuckets'] = {
  12663. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12664. "number": { store: Object.create(null), fn: Number },
  12665. "string": { store: Object.create(null) }
  12666. };
  12667. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12668. $self['@defaultBucket']._removeAll();
  12669. $self['@size'] = 0;
  12670. ;
  12671. return self;
  12672. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12673. },
  12674. args: [],
  12675. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self[''@defaultBucket'']._removeAll();\x0a\x09\x09$self[''@size''] = 0;\x0a\x09'>",
  12676. referencedClasses: [],
  12677. messageSends: []
  12678. }),
  12679. $globals.Set);
  12680. $core.addMethod(
  12681. $core.method({
  12682. selector: "select:",
  12683. protocol: "enumerating",
  12684. fn: function (aBlock){
  12685. var self=this,$self=this;
  12686. var collection;
  12687. return $core.withContext(function($ctx1) {
  12688. var $1;
  12689. collection=$recv($self._class())._new();
  12690. $self._do_((function(each){
  12691. return $core.withContext(function($ctx2) {
  12692. $1=$recv(aBlock)._value_(each);
  12693. if($core.assert($1)){
  12694. return $recv(collection)._add_(each);
  12695. }
  12696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12697. }));
  12698. return collection;
  12699. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12700. },
  12701. args: ["aBlock"],
  12702. 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",
  12703. referencedClasses: [],
  12704. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12705. }),
  12706. $globals.Set);
  12707. $core.addMethod(
  12708. $core.method({
  12709. selector: "select:thenCollect:",
  12710. protocol: "enumerating",
  12711. fn: function (selectBlock,collectBlock){
  12712. var self=this,$self=this;
  12713. var collection;
  12714. return $core.withContext(function($ctx1) {
  12715. var $1;
  12716. collection=$recv($self._class())._new();
  12717. $self._do_((function(each){
  12718. return $core.withContext(function($ctx2) {
  12719. $1=$recv(selectBlock)._value_(each);
  12720. $ctx2.sendIdx["value:"]=1;
  12721. if($core.assert($1)){
  12722. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12723. }
  12724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12725. }));
  12726. return collection;
  12727. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12728. },
  12729. args: ["selectBlock", "collectBlock"],
  12730. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  12731. referencedClasses: [],
  12732. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12733. }),
  12734. $globals.Set);
  12735. $core.addMethod(
  12736. $core.method({
  12737. selector: "size",
  12738. protocol: "accessing",
  12739. fn: function (){
  12740. var self=this,$self=this;
  12741. return $self["@size"];
  12742. },
  12743. args: [],
  12744. source: "size\x0a\x09^ size",
  12745. referencedClasses: [],
  12746. messageSends: []
  12747. }),
  12748. $globals.Set);
  12749. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12750. $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.";
  12751. $core.addMethod(
  12752. $core.method({
  12753. selector: "<<",
  12754. protocol: "writing",
  12755. fn: function (anObject){
  12756. var self=this,$self=this;
  12757. return $core.withContext(function($ctx1) {
  12758. $self._write_(anObject);
  12759. return self;
  12760. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12761. },
  12762. args: ["anObject"],
  12763. source: "<< anObject\x0a\x09self write: anObject",
  12764. referencedClasses: [],
  12765. messageSends: ["write:"]
  12766. }),
  12767. $globals.ProtoStream);
  12768. $core.addMethod(
  12769. $core.method({
  12770. selector: "atEnd",
  12771. protocol: "testing",
  12772. fn: function (){
  12773. var self=this,$self=this;
  12774. return $core.withContext(function($ctx1) {
  12775. $self._subclassResponsibility();
  12776. return self;
  12777. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12778. },
  12779. args: [],
  12780. source: "atEnd\x0a\x09self subclassResponsibility",
  12781. referencedClasses: [],
  12782. messageSends: ["subclassResponsibility"]
  12783. }),
  12784. $globals.ProtoStream);
  12785. $core.addMethod(
  12786. $core.method({
  12787. selector: "atStart",
  12788. protocol: "testing",
  12789. fn: function (){
  12790. var self=this,$self=this;
  12791. return $core.withContext(function($ctx1) {
  12792. $self._subclassResponsibility();
  12793. return self;
  12794. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12795. },
  12796. args: [],
  12797. source: "atStart\x0a\x09self subclassResponsibility",
  12798. referencedClasses: [],
  12799. messageSends: ["subclassResponsibility"]
  12800. }),
  12801. $globals.ProtoStream);
  12802. $core.addMethod(
  12803. $core.method({
  12804. selector: "contents",
  12805. protocol: "accessing",
  12806. fn: function (){
  12807. var self=this,$self=this;
  12808. return $core.withContext(function($ctx1) {
  12809. $self._subclassResponsibility();
  12810. return self;
  12811. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12812. },
  12813. args: [],
  12814. source: "contents\x0a\x09self subclassResponsibility",
  12815. referencedClasses: [],
  12816. messageSends: ["subclassResponsibility"]
  12817. }),
  12818. $globals.ProtoStream);
  12819. $core.addMethod(
  12820. $core.method({
  12821. selector: "do:",
  12822. protocol: "enumerating",
  12823. fn: function (aBlock){
  12824. var self=this,$self=this;
  12825. return $core.withContext(function($ctx1) {
  12826. $recv((function(){
  12827. return $core.withContext(function($ctx2) {
  12828. return $self._atEnd();
  12829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12830. }))._whileFalse_((function(){
  12831. return $core.withContext(function($ctx2) {
  12832. return $recv(aBlock)._value_($self._next());
  12833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12834. }));
  12835. return self;
  12836. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12837. },
  12838. args: ["aBlock"],
  12839. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12840. referencedClasses: [],
  12841. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12842. }),
  12843. $globals.ProtoStream);
  12844. $core.addMethod(
  12845. $core.method({
  12846. selector: "isEmpty",
  12847. protocol: "testing",
  12848. fn: function (){
  12849. var self=this,$self=this;
  12850. return $core.withContext(function($ctx1) {
  12851. return $recv($self._atStart())._and_((function(){
  12852. return $core.withContext(function($ctx2) {
  12853. return $self._atEnd();
  12854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12855. }));
  12856. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12857. },
  12858. args: [],
  12859. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12860. referencedClasses: [],
  12861. messageSends: ["and:", "atStart", "atEnd"]
  12862. }),
  12863. $globals.ProtoStream);
  12864. $core.addMethod(
  12865. $core.method({
  12866. selector: "next",
  12867. protocol: "reading",
  12868. fn: function (){
  12869. var self=this,$self=this;
  12870. return $core.withContext(function($ctx1) {
  12871. var $1;
  12872. $1=$self._atEnd();
  12873. if($core.assert($1)){
  12874. return nil;
  12875. } else {
  12876. return $self._subclassResponsibility();
  12877. }
  12878. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12879. },
  12880. args: [],
  12881. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12882. referencedClasses: [],
  12883. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12884. }),
  12885. $globals.ProtoStream);
  12886. $core.addMethod(
  12887. $core.method({
  12888. selector: "nextPut:",
  12889. protocol: "writing",
  12890. fn: function (anObject){
  12891. var self=this,$self=this;
  12892. return $core.withContext(function($ctx1) {
  12893. $self._subclassResponsibility();
  12894. return self;
  12895. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12896. },
  12897. args: ["anObject"],
  12898. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12899. referencedClasses: [],
  12900. messageSends: ["subclassResponsibility"]
  12901. }),
  12902. $globals.ProtoStream);
  12903. $core.addMethod(
  12904. $core.method({
  12905. selector: "nextPutAll:",
  12906. protocol: "writing",
  12907. fn: function (aCollection){
  12908. var self=this,$self=this;
  12909. return $core.withContext(function($ctx1) {
  12910. $recv(aCollection)._do_((function(each){
  12911. return $core.withContext(function($ctx2) {
  12912. return $self._nextPut_(each);
  12913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12914. }));
  12915. return self;
  12916. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12917. },
  12918. args: ["aCollection"],
  12919. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12920. referencedClasses: [],
  12921. messageSends: ["do:", "nextPut:"]
  12922. }),
  12923. $globals.ProtoStream);
  12924. $core.addMethod(
  12925. $core.method({
  12926. selector: "nextPutString:",
  12927. protocol: "writing",
  12928. fn: function (aString){
  12929. var self=this,$self=this;
  12930. return $core.withContext(function($ctx1) {
  12931. $self._nextPut_(aString);
  12932. return self;
  12933. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12934. },
  12935. args: ["aString"],
  12936. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12937. referencedClasses: [],
  12938. messageSends: ["nextPut:"]
  12939. }),
  12940. $globals.ProtoStream);
  12941. $core.addMethod(
  12942. $core.method({
  12943. selector: "peek",
  12944. protocol: "reading",
  12945. fn: function (){
  12946. var self=this,$self=this;
  12947. return $core.withContext(function($ctx1) {
  12948. var $1;
  12949. $1=$self._atEnd();
  12950. if($core.assert($1)){
  12951. return nil;
  12952. } else {
  12953. return $self._subclassResponsibility();
  12954. }
  12955. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12956. },
  12957. args: [],
  12958. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12959. referencedClasses: [],
  12960. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12961. }),
  12962. $globals.ProtoStream);
  12963. $core.addMethod(
  12964. $core.method({
  12965. selector: "reset",
  12966. protocol: "actions",
  12967. fn: function (){
  12968. var self=this,$self=this;
  12969. return $core.withContext(function($ctx1) {
  12970. $self._subclassResponsibility();
  12971. return self;
  12972. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12973. },
  12974. args: [],
  12975. source: "reset\x0a\x09self subclassResponsibility",
  12976. referencedClasses: [],
  12977. messageSends: ["subclassResponsibility"]
  12978. }),
  12979. $globals.ProtoStream);
  12980. $core.addMethod(
  12981. $core.method({
  12982. selector: "resetContents",
  12983. protocol: "actions",
  12984. fn: function (){
  12985. var self=this,$self=this;
  12986. return $core.withContext(function($ctx1) {
  12987. $self._subclassResponsibility();
  12988. return self;
  12989. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12990. },
  12991. args: [],
  12992. source: "resetContents\x0a\x09self subclassResponsibility",
  12993. referencedClasses: [],
  12994. messageSends: ["subclassResponsibility"]
  12995. }),
  12996. $globals.ProtoStream);
  12997. $core.addMethod(
  12998. $core.method({
  12999. selector: "setToEnd",
  13000. protocol: "positioning",
  13001. fn: function (){
  13002. var self=this,$self=this;
  13003. return $core.withContext(function($ctx1) {
  13004. $self._subclassResponsibility();
  13005. return self;
  13006. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13007. },
  13008. args: [],
  13009. source: "setToEnd\x0a\x09self subclassResponsibility",
  13010. referencedClasses: [],
  13011. messageSends: ["subclassResponsibility"]
  13012. }),
  13013. $globals.ProtoStream);
  13014. $core.addMethod(
  13015. $core.method({
  13016. selector: "setToStart",
  13017. protocol: "positioning",
  13018. fn: function (){
  13019. var self=this,$self=this;
  13020. return $core.withContext(function($ctx1) {
  13021. $self._reset();
  13022. return self;
  13023. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13024. },
  13025. args: [],
  13026. source: "setToStart\x0a\x09self reset",
  13027. referencedClasses: [],
  13028. messageSends: ["reset"]
  13029. }),
  13030. $globals.ProtoStream);
  13031. $core.addMethod(
  13032. $core.method({
  13033. selector: "write:",
  13034. protocol: "writing",
  13035. fn: function (anObject){
  13036. var self=this,$self=this;
  13037. return $core.withContext(function($ctx1) {
  13038. $recv(anObject)._putOn_(self);
  13039. return self;
  13040. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13041. },
  13042. args: ["anObject"],
  13043. source: "write: anObject\x0a\x09anObject putOn: self",
  13044. referencedClasses: [],
  13045. messageSends: ["putOn:"]
  13046. }),
  13047. $globals.ProtoStream);
  13048. $core.addMethod(
  13049. $core.method({
  13050. selector: "on:",
  13051. protocol: "instance creation",
  13052. fn: function (aCollection){
  13053. var self=this,$self=this;
  13054. return $core.withContext(function($ctx1) {
  13055. var $1;
  13056. $1=$self._new();
  13057. $recv($1)._setCollection_(aCollection);
  13058. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13059. return $recv($1)._yourself();
  13060. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13061. },
  13062. args: ["aCollection"],
  13063. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13064. referencedClasses: [],
  13065. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13066. }),
  13067. $globals.ProtoStream.a$cls);
  13068. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13069. $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.";
  13070. $core.addMethod(
  13071. $core.method({
  13072. selector: "atEnd",
  13073. protocol: "testing",
  13074. fn: function (){
  13075. var self=this,$self=this;
  13076. return $core.withContext(function($ctx1) {
  13077. return $recv($self._position()).__eq($self._size());
  13078. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13079. },
  13080. args: [],
  13081. source: "atEnd\x0a\x09^ self position = self size",
  13082. referencedClasses: [],
  13083. messageSends: ["=", "position", "size"]
  13084. }),
  13085. $globals.Stream);
  13086. $core.addMethod(
  13087. $core.method({
  13088. selector: "atStart",
  13089. protocol: "testing",
  13090. fn: function (){
  13091. var self=this,$self=this;
  13092. return $core.withContext(function($ctx1) {
  13093. return $recv($self._position()).__eq((0));
  13094. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13095. },
  13096. args: [],
  13097. source: "atStart\x0a\x09^ self position = 0",
  13098. referencedClasses: [],
  13099. messageSends: ["=", "position"]
  13100. }),
  13101. $globals.Stream);
  13102. $core.addMethod(
  13103. $core.method({
  13104. selector: "close",
  13105. protocol: "actions",
  13106. fn: function (){
  13107. var self=this,$self=this;
  13108. return self;
  13109. },
  13110. args: [],
  13111. source: "close",
  13112. referencedClasses: [],
  13113. messageSends: []
  13114. }),
  13115. $globals.Stream);
  13116. $core.addMethod(
  13117. $core.method({
  13118. selector: "collection",
  13119. protocol: "accessing",
  13120. fn: function (){
  13121. var self=this,$self=this;
  13122. return $self["@collection"];
  13123. },
  13124. args: [],
  13125. source: "collection\x0a\x09^ collection",
  13126. referencedClasses: [],
  13127. messageSends: []
  13128. }),
  13129. $globals.Stream);
  13130. $core.addMethod(
  13131. $core.method({
  13132. selector: "contents",
  13133. protocol: "accessing",
  13134. fn: function (){
  13135. var self=this,$self=this;
  13136. return $core.withContext(function($ctx1) {
  13137. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13138. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13139. },
  13140. args: [],
  13141. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13142. referencedClasses: [],
  13143. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13144. }),
  13145. $globals.Stream);
  13146. $core.addMethod(
  13147. $core.method({
  13148. selector: "flush",
  13149. protocol: "actions",
  13150. fn: function (){
  13151. var self=this,$self=this;
  13152. return self;
  13153. },
  13154. args: [],
  13155. source: "flush",
  13156. referencedClasses: [],
  13157. messageSends: []
  13158. }),
  13159. $globals.Stream);
  13160. $core.addMethod(
  13161. $core.method({
  13162. selector: "isEmpty",
  13163. protocol: "testing",
  13164. fn: function (){
  13165. var self=this,$self=this;
  13166. return $core.withContext(function($ctx1) {
  13167. return $recv($self._size()).__eq((0));
  13168. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13169. },
  13170. args: [],
  13171. source: "isEmpty\x0a\x09^ self size = 0",
  13172. referencedClasses: [],
  13173. messageSends: ["=", "size"]
  13174. }),
  13175. $globals.Stream);
  13176. $core.addMethod(
  13177. $core.method({
  13178. selector: "next",
  13179. protocol: "reading",
  13180. fn: function (){
  13181. var self=this,$self=this;
  13182. return $core.withContext(function($ctx1) {
  13183. var $1,$3,$2;
  13184. $1=$self._atEnd();
  13185. if($core.assert($1)){
  13186. return nil;
  13187. } else {
  13188. $3=$self._position();
  13189. $ctx1.sendIdx["position"]=1;
  13190. $2=$recv($3).__plus((1));
  13191. $self._position_($2);
  13192. return $recv($self["@collection"])._at_($self._position());
  13193. }
  13194. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13195. },
  13196. args: [],
  13197. 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 ]",
  13198. referencedClasses: [],
  13199. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13200. }),
  13201. $globals.Stream);
  13202. $core.addMethod(
  13203. $core.method({
  13204. selector: "next:",
  13205. protocol: "reading",
  13206. fn: function (anInteger){
  13207. var self=this,$self=this;
  13208. var tempCollection;
  13209. return $core.withContext(function($ctx1) {
  13210. var $1;
  13211. tempCollection=$recv($recv($self._collection())._class())._new();
  13212. $recv(anInteger)._timesRepeat_((function(){
  13213. return $core.withContext(function($ctx2) {
  13214. $1=$self._atEnd();
  13215. if(!$core.assert($1)){
  13216. return $recv(tempCollection)._add_($self._next());
  13217. }
  13218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13219. }));
  13220. return tempCollection;
  13221. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13222. },
  13223. args: ["anInteger"],
  13224. 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",
  13225. referencedClasses: [],
  13226. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13227. }),
  13228. $globals.Stream);
  13229. $core.addMethod(
  13230. $core.method({
  13231. selector: "nextPut:",
  13232. protocol: "writing",
  13233. fn: function (anObject){
  13234. var self=this,$self=this;
  13235. return $core.withContext(function($ctx1) {
  13236. var $2,$1,$3,$4;
  13237. $2=$self._position();
  13238. $ctx1.sendIdx["position"]=1;
  13239. $1=$recv($2).__plus((1));
  13240. $self._position_($1);
  13241. $3=$self._collection();
  13242. $4=$self._position();
  13243. $ctx1.sendIdx["position"]=2;
  13244. $recv($3)._at_put_($4,anObject);
  13245. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13246. return self;
  13247. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13248. },
  13249. args: ["anObject"],
  13250. 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)",
  13251. referencedClasses: [],
  13252. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13253. }),
  13254. $globals.Stream);
  13255. $core.addMethod(
  13256. $core.method({
  13257. selector: "peek",
  13258. protocol: "reading",
  13259. fn: function (){
  13260. var self=this,$self=this;
  13261. return $core.withContext(function($ctx1) {
  13262. var $1;
  13263. $1=$self._atEnd();
  13264. if(!$core.assert($1)){
  13265. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13266. }
  13267. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13268. },
  13269. args: [],
  13270. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13271. referencedClasses: [],
  13272. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13273. }),
  13274. $globals.Stream);
  13275. $core.addMethod(
  13276. $core.method({
  13277. selector: "position",
  13278. protocol: "accessing",
  13279. fn: function (){
  13280. var self=this,$self=this;
  13281. return $core.withContext(function($ctx1) {
  13282. var $1,$receiver;
  13283. $1=$self["@position"];
  13284. if(($receiver = $1) == null || $receiver.a$nil){
  13285. $self["@position"]=(0);
  13286. return $self["@position"];
  13287. } else {
  13288. return $1;
  13289. }
  13290. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13291. },
  13292. args: [],
  13293. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13294. referencedClasses: [],
  13295. messageSends: ["ifNil:"]
  13296. }),
  13297. $globals.Stream);
  13298. $core.addMethod(
  13299. $core.method({
  13300. selector: "position:",
  13301. protocol: "accessing",
  13302. fn: function (anInteger){
  13303. var self=this,$self=this;
  13304. $self["@position"]=anInteger;
  13305. return self;
  13306. },
  13307. args: ["anInteger"],
  13308. source: "position: anInteger\x0a\x09position := anInteger",
  13309. referencedClasses: [],
  13310. messageSends: []
  13311. }),
  13312. $globals.Stream);
  13313. $core.addMethod(
  13314. $core.method({
  13315. selector: "reset",
  13316. protocol: "actions",
  13317. fn: function (){
  13318. var self=this,$self=this;
  13319. return $core.withContext(function($ctx1) {
  13320. $self._position_((0));
  13321. return self;
  13322. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13323. },
  13324. args: [],
  13325. source: "reset\x0a\x09self position: 0",
  13326. referencedClasses: [],
  13327. messageSends: ["position:"]
  13328. }),
  13329. $globals.Stream);
  13330. $core.addMethod(
  13331. $core.method({
  13332. selector: "resetContents",
  13333. protocol: "actions",
  13334. fn: function (){
  13335. var self=this,$self=this;
  13336. return $core.withContext(function($ctx1) {
  13337. $self._reset();
  13338. $self._setStreamSize_((0));
  13339. return self;
  13340. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13341. },
  13342. args: [],
  13343. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13344. referencedClasses: [],
  13345. messageSends: ["reset", "setStreamSize:"]
  13346. }),
  13347. $globals.Stream);
  13348. $core.addMethod(
  13349. $core.method({
  13350. selector: "setCollection:",
  13351. protocol: "accessing",
  13352. fn: function (aCollection){
  13353. var self=this,$self=this;
  13354. $self["@collection"]=aCollection;
  13355. return self;
  13356. },
  13357. args: ["aCollection"],
  13358. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13359. referencedClasses: [],
  13360. messageSends: []
  13361. }),
  13362. $globals.Stream);
  13363. $core.addMethod(
  13364. $core.method({
  13365. selector: "setStreamSize:",
  13366. protocol: "accessing",
  13367. fn: function (anInteger){
  13368. var self=this,$self=this;
  13369. $self["@streamSize"]=anInteger;
  13370. return self;
  13371. },
  13372. args: ["anInteger"],
  13373. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13374. referencedClasses: [],
  13375. messageSends: []
  13376. }),
  13377. $globals.Stream);
  13378. $core.addMethod(
  13379. $core.method({
  13380. selector: "setToEnd",
  13381. protocol: "positioning",
  13382. fn: function (){
  13383. var self=this,$self=this;
  13384. return $core.withContext(function($ctx1) {
  13385. $self._position_($self._size());
  13386. return self;
  13387. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13388. },
  13389. args: [],
  13390. source: "setToEnd\x0a\x09self position: self size",
  13391. referencedClasses: [],
  13392. messageSends: ["position:", "size"]
  13393. }),
  13394. $globals.Stream);
  13395. $core.addMethod(
  13396. $core.method({
  13397. selector: "size",
  13398. protocol: "accessing",
  13399. fn: function (){
  13400. var self=this,$self=this;
  13401. return $core.withContext(function($ctx1) {
  13402. return $self._streamSize();
  13403. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13404. },
  13405. args: [],
  13406. source: "size\x0a\x09^ self streamSize",
  13407. referencedClasses: [],
  13408. messageSends: ["streamSize"]
  13409. }),
  13410. $globals.Stream);
  13411. $core.addMethod(
  13412. $core.method({
  13413. selector: "skip:",
  13414. protocol: "positioning",
  13415. fn: function (anInteger){
  13416. var self=this,$self=this;
  13417. return $core.withContext(function($ctx1) {
  13418. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13419. return self;
  13420. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13421. },
  13422. args: ["anInteger"],
  13423. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13424. referencedClasses: [],
  13425. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13426. }),
  13427. $globals.Stream);
  13428. $core.addMethod(
  13429. $core.method({
  13430. selector: "streamSize",
  13431. protocol: "accessing",
  13432. fn: function (){
  13433. var self=this,$self=this;
  13434. return $self["@streamSize"];
  13435. },
  13436. args: [],
  13437. source: "streamSize\x0a\x09^ streamSize",
  13438. referencedClasses: [],
  13439. messageSends: []
  13440. }),
  13441. $globals.Stream);
  13442. $core.addMethod(
  13443. $core.method({
  13444. selector: "on:",
  13445. protocol: "instance creation",
  13446. fn: function (aCollection){
  13447. var self=this,$self=this;
  13448. return $core.withContext(function($ctx1) {
  13449. var $1;
  13450. $1=$self._new();
  13451. $recv($1)._setCollection_(aCollection);
  13452. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13453. return $recv($1)._yourself();
  13454. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13455. },
  13456. args: ["aCollection"],
  13457. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13458. referencedClasses: [],
  13459. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13460. }),
  13461. $globals.Stream.a$cls);
  13462. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13463. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13464. $core.addMethod(
  13465. $core.method({
  13466. selector: "cr",
  13467. protocol: "writing",
  13468. fn: function (){
  13469. var self=this,$self=this;
  13470. return $core.withContext(function($ctx1) {
  13471. return $self._nextPutAll_($recv($globals.String)._cr());
  13472. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13473. },
  13474. args: [],
  13475. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13476. referencedClasses: ["String"],
  13477. messageSends: ["nextPutAll:", "cr"]
  13478. }),
  13479. $globals.StringStream);
  13480. $core.addMethod(
  13481. $core.method({
  13482. selector: "crlf",
  13483. protocol: "writing",
  13484. fn: function (){
  13485. var self=this,$self=this;
  13486. return $core.withContext(function($ctx1) {
  13487. return $self._nextPutAll_($recv($globals.String)._crlf());
  13488. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13489. },
  13490. args: [],
  13491. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13492. referencedClasses: ["String"],
  13493. messageSends: ["nextPutAll:", "crlf"]
  13494. }),
  13495. $globals.StringStream);
  13496. $core.addMethod(
  13497. $core.method({
  13498. selector: "lf",
  13499. protocol: "writing",
  13500. fn: function (){
  13501. var self=this,$self=this;
  13502. return $core.withContext(function($ctx1) {
  13503. return $self._nextPutAll_($recv($globals.String)._lf());
  13504. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13505. },
  13506. args: [],
  13507. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13508. referencedClasses: ["String"],
  13509. messageSends: ["nextPutAll:", "lf"]
  13510. }),
  13511. $globals.StringStream);
  13512. $core.addMethod(
  13513. $core.method({
  13514. selector: "next:",
  13515. protocol: "reading",
  13516. fn: function (anInteger){
  13517. var self=this,$self=this;
  13518. var tempCollection;
  13519. return $core.withContext(function($ctx1) {
  13520. var $1;
  13521. tempCollection=$recv($recv($self._collection())._class())._new();
  13522. $recv(anInteger)._timesRepeat_((function(){
  13523. return $core.withContext(function($ctx2) {
  13524. $1=$self._atEnd();
  13525. if(!$core.assert($1)){
  13526. tempCollection=$recv(tempCollection).__comma($self._next());
  13527. return tempCollection;
  13528. }
  13529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13530. }));
  13531. return tempCollection;
  13532. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13533. },
  13534. args: ["anInteger"],
  13535. 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",
  13536. referencedClasses: [],
  13537. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13538. }),
  13539. $globals.StringStream);
  13540. $core.addMethod(
  13541. $core.method({
  13542. selector: "nextPut:",
  13543. protocol: "writing",
  13544. fn: function (aString){
  13545. var self=this,$self=this;
  13546. return $core.withContext(function($ctx1) {
  13547. $self._nextPutAll_(aString);
  13548. return self;
  13549. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13550. },
  13551. args: ["aString"],
  13552. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13553. referencedClasses: [],
  13554. messageSends: ["nextPutAll:"]
  13555. }),
  13556. $globals.StringStream);
  13557. $core.addMethod(
  13558. $core.method({
  13559. selector: "nextPutAll:",
  13560. protocol: "writing",
  13561. fn: function (aString){
  13562. var self=this,$self=this;
  13563. var pre,post;
  13564. return $core.withContext(function($ctx1) {
  13565. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13566. $1=$self._atEnd();
  13567. if($core.assert($1)){
  13568. $3=$self._collection();
  13569. $ctx1.sendIdx["collection"]=1;
  13570. $2=$recv($3).__comma(aString);
  13571. $ctx1.sendIdx[","]=1;
  13572. $self._setCollection_($2);
  13573. $ctx1.sendIdx["setCollection:"]=1;
  13574. } else {
  13575. $4=$self._collection();
  13576. $ctx1.sendIdx["collection"]=2;
  13577. $5=$self._position();
  13578. $ctx1.sendIdx["position"]=1;
  13579. pre=$recv($4)._copyFrom_to_((1),$5);
  13580. $ctx1.sendIdx["copyFrom:to:"]=1;
  13581. $6=$self._collection();
  13582. $ctx1.sendIdx["collection"]=3;
  13583. $9=$self._position();
  13584. $ctx1.sendIdx["position"]=2;
  13585. $8=$recv($9).__plus((1));
  13586. $ctx1.sendIdx["+"]=2;
  13587. $10=$recv(aString)._size();
  13588. $ctx1.sendIdx["size"]=1;
  13589. $7=$recv($8).__plus($10);
  13590. $ctx1.sendIdx["+"]=1;
  13591. $11=$recv($self._collection())._size();
  13592. $ctx1.sendIdx["size"]=2;
  13593. post=$recv($6)._copyFrom_to_($7,$11);
  13594. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13595. $ctx1.sendIdx[","]=2;
  13596. $self._setCollection_($12);
  13597. }
  13598. $14=$self._position();
  13599. $ctx1.sendIdx["position"]=3;
  13600. $13=$recv($14).__plus($recv(aString)._size());
  13601. $self._position_($13);
  13602. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13603. return self;
  13604. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13605. },
  13606. args: ["aString"],
  13607. 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)",
  13608. referencedClasses: [],
  13609. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13610. }),
  13611. $globals.StringStream);
  13612. $core.addMethod(
  13613. $core.method({
  13614. selector: "nextPutString:",
  13615. protocol: "writing",
  13616. fn: function (aString){
  13617. var self=this,$self=this;
  13618. return $core.withContext(function($ctx1) {
  13619. $self._nextPutAll_(aString);
  13620. return self;
  13621. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13622. },
  13623. args: ["aString"],
  13624. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13625. referencedClasses: [],
  13626. messageSends: ["nextPutAll:"]
  13627. }),
  13628. $globals.StringStream);
  13629. $core.addMethod(
  13630. $core.method({
  13631. selector: "print:",
  13632. protocol: "writing",
  13633. fn: function (anObject){
  13634. var self=this,$self=this;
  13635. return $core.withContext(function($ctx1) {
  13636. $recv(anObject)._printOn_(self);
  13637. return self;
  13638. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13639. },
  13640. args: ["anObject"],
  13641. source: "print: anObject\x0a\x09anObject printOn: self",
  13642. referencedClasses: [],
  13643. messageSends: ["printOn:"]
  13644. }),
  13645. $globals.StringStream);
  13646. $core.addMethod(
  13647. $core.method({
  13648. selector: "printSymbol:",
  13649. protocol: "writing",
  13650. fn: function (anObject){
  13651. var self=this,$self=this;
  13652. return $core.withContext(function($ctx1) {
  13653. $recv(anObject)._asSymbolPrintOn_(self);
  13654. return self;
  13655. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13656. },
  13657. args: ["anObject"],
  13658. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13659. referencedClasses: [],
  13660. messageSends: ["asSymbolPrintOn:"]
  13661. }),
  13662. $globals.StringStream);
  13663. $core.addMethod(
  13664. $core.method({
  13665. selector: "space",
  13666. protocol: "writing",
  13667. fn: function (){
  13668. var self=this,$self=this;
  13669. return $core.withContext(function($ctx1) {
  13670. $self._nextPut_(" ");
  13671. return self;
  13672. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13673. },
  13674. args: [],
  13675. source: "space\x0a\x09self nextPut: ' '",
  13676. referencedClasses: [],
  13677. messageSends: ["nextPut:"]
  13678. }),
  13679. $globals.StringStream);
  13680. $core.addMethod(
  13681. $core.method({
  13682. selector: "tab",
  13683. protocol: "writing",
  13684. fn: function (){
  13685. var self=this,$self=this;
  13686. return $core.withContext(function($ctx1) {
  13687. return $self._nextPutAll_($recv($globals.String)._tab());
  13688. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13689. },
  13690. args: [],
  13691. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13692. referencedClasses: ["String"],
  13693. messageSends: ["nextPutAll:", "tab"]
  13694. }),
  13695. $globals.StringStream);
  13696. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13697. $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.";
  13698. $core.addMethod(
  13699. $core.method({
  13700. selector: "initialize",
  13701. protocol: "initialization",
  13702. fn: function (){
  13703. var self=this,$self=this;
  13704. return $core.withContext(function($ctx1) {
  13705. (
  13706. $ctx1.supercall = true,
  13707. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13708. $ctx1.supercall = false;
  13709. $self["@read"]=$recv($globals.OrderedCollection)._new();
  13710. $ctx1.sendIdx["new"]=1;
  13711. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13712. $self["@readIndex"]=(1);
  13713. return self;
  13714. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13715. },
  13716. args: [],
  13717. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13718. referencedClasses: ["OrderedCollection"],
  13719. messageSends: ["initialize", "new"]
  13720. }),
  13721. $globals.Queue);
  13722. $core.addMethod(
  13723. $core.method({
  13724. selector: "next",
  13725. protocol: "accessing",
  13726. fn: function (){
  13727. var self=this,$self=this;
  13728. return $core.withContext(function($ctx1) {
  13729. return $self._nextIfAbsent_((function(){
  13730. return $core.withContext(function($ctx2) {
  13731. return $self._error_("Cannot read from empty Queue.");
  13732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13733. }));
  13734. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13735. },
  13736. args: [],
  13737. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13738. referencedClasses: [],
  13739. messageSends: ["nextIfAbsent:", "error:"]
  13740. }),
  13741. $globals.Queue);
  13742. $core.addMethod(
  13743. $core.method({
  13744. selector: "nextIfAbsent:",
  13745. protocol: "accessing",
  13746. fn: function (aBlock){
  13747. var self=this,$self=this;
  13748. var result;
  13749. return $core.withContext(function($ctx1) {
  13750. var $1;
  13751. var $early={};
  13752. try {
  13753. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  13754. return $core.withContext(function($ctx2) {
  13755. $recv($self["@write"])._ifEmpty_((function(){
  13756. return $core.withContext(function($ctx3) {
  13757. $1=$recv($self["@readIndex"]).__gt((1));
  13758. if($core.assert($1)){
  13759. $self["@read"]=[];
  13760. $self["@readIndex"]=(1);
  13761. $self["@readIndex"];
  13762. }
  13763. throw $early=[$recv(aBlock)._value()];
  13764. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13765. }));
  13766. $self["@read"]=$self["@write"];
  13767. $self["@readIndex"]=(1);
  13768. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13769. return $recv($self["@read"])._first();
  13770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13771. }));
  13772. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  13773. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  13774. return result;
  13775. }
  13776. catch(e) {if(e===$early)return e[0]; throw e}
  13777. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13778. },
  13779. args: ["aBlock"],
  13780. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  13781. referencedClasses: ["OrderedCollection"],
  13782. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13783. }),
  13784. $globals.Queue);
  13785. $core.addMethod(
  13786. $core.method({
  13787. selector: "nextPut:",
  13788. protocol: "accessing",
  13789. fn: function (anObject){
  13790. var self=this,$self=this;
  13791. return $core.withContext(function($ctx1) {
  13792. $recv($self["@write"])._add_(anObject);
  13793. return self;
  13794. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13795. },
  13796. args: ["anObject"],
  13797. source: "nextPut: anObject\x0a\x09write add: anObject",
  13798. referencedClasses: [],
  13799. messageSends: ["add:"]
  13800. }),
  13801. $globals.Queue);
  13802. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13803. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13804. $core.addMethod(
  13805. $core.method({
  13806. selector: "compile:",
  13807. protocol: "evaluating",
  13808. fn: function (aString){
  13809. var self=this,$self=this;
  13810. return $core.withContext(function($ctx1) {
  13811. return self.compile(aString);
  13812. return self;
  13813. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13814. },
  13815. args: ["aString"],
  13816. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13817. referencedClasses: [],
  13818. messageSends: []
  13819. }),
  13820. $globals.RegularExpression);
  13821. $core.addMethod(
  13822. $core.method({
  13823. selector: "exec:",
  13824. protocol: "evaluating",
  13825. fn: function (aString){
  13826. var self=this,$self=this;
  13827. return $core.withContext(function($ctx1) {
  13828. return self.exec(aString) || nil;
  13829. return self;
  13830. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13831. },
  13832. args: ["aString"],
  13833. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13834. referencedClasses: [],
  13835. messageSends: []
  13836. }),
  13837. $globals.RegularExpression);
  13838. $core.addMethod(
  13839. $core.method({
  13840. selector: "test:",
  13841. protocol: "evaluating",
  13842. fn: function (aString){
  13843. var self=this,$self=this;
  13844. return $core.withContext(function($ctx1) {
  13845. return self.test(aString);
  13846. return self;
  13847. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13848. },
  13849. args: ["aString"],
  13850. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13851. referencedClasses: [],
  13852. messageSends: []
  13853. }),
  13854. $globals.RegularExpression);
  13855. $core.addMethod(
  13856. $core.method({
  13857. selector: "fromString:",
  13858. protocol: "instance creation",
  13859. fn: function (aString){
  13860. var self=this,$self=this;
  13861. return $core.withContext(function($ctx1) {
  13862. return $self._fromString_flag_(aString,"");
  13863. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13864. },
  13865. args: ["aString"],
  13866. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13867. referencedClasses: [],
  13868. messageSends: ["fromString:flag:"]
  13869. }),
  13870. $globals.RegularExpression.a$cls);
  13871. $core.addMethod(
  13872. $core.method({
  13873. selector: "fromString:flag:",
  13874. protocol: "instance creation",
  13875. fn: function (aString,anotherString){
  13876. var self=this,$self=this;
  13877. return $core.withContext(function($ctx1) {
  13878. return new RegExp(aString, anotherString);
  13879. return self;
  13880. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13881. },
  13882. args: ["aString", "anotherString"],
  13883. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13884. referencedClasses: [],
  13885. messageSends: []
  13886. }),
  13887. $globals.RegularExpression.a$cls);
  13888. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  13889. $core.addMethod(
  13890. $core.method({
  13891. selector: "at:",
  13892. protocol: "accessing",
  13893. fn: function (anIndex){
  13894. var self=this,$self=this;
  13895. return $core.withContext(function($ctx1) {
  13896. return $self._at_ifAbsent_(anIndex,(function(){
  13897. return $core.withContext(function($ctx2) {
  13898. return $self._errorNotFound();
  13899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13900. }));
  13901. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  13902. },
  13903. args: ["anIndex"],
  13904. 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 ]",
  13905. referencedClasses: [],
  13906. messageSends: ["at:ifAbsent:", "errorNotFound"]
  13907. }),
  13908. $globals.TKeyValueCollection);
  13909. $core.addMethod(
  13910. $core.method({
  13911. selector: "at:ifAbsent:",
  13912. protocol: "accessing",
  13913. fn: function (anIndex,aBlock){
  13914. var self=this,$self=this;
  13915. return $core.withContext(function($ctx1) {
  13916. $self._subclassResponsibility();
  13917. return self;
  13918. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13919. },
  13920. args: ["anIndex", "aBlock"],
  13921. 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",
  13922. referencedClasses: [],
  13923. messageSends: ["subclassResponsibility"]
  13924. }),
  13925. $globals.TKeyValueCollection);
  13926. $core.addMethod(
  13927. $core.method({
  13928. selector: "at:ifAbsentPut:",
  13929. protocol: "accessing",
  13930. fn: function (aKey,aBlock){
  13931. var self=this,$self=this;
  13932. return $core.withContext(function($ctx1) {
  13933. return $self._at_ifAbsent_(aKey,(function(){
  13934. return $core.withContext(function($ctx2) {
  13935. return $self._at_put_(aKey,$recv(aBlock)._value());
  13936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13937. }));
  13938. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  13939. },
  13940. args: ["aKey", "aBlock"],
  13941. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  13942. referencedClasses: [],
  13943. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  13944. }),
  13945. $globals.TKeyValueCollection);
  13946. $core.addMethod(
  13947. $core.method({
  13948. selector: "at:ifPresent:",
  13949. protocol: "accessing",
  13950. fn: function (anIndex,aBlock){
  13951. var self=this,$self=this;
  13952. return $core.withContext(function($ctx1) {
  13953. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  13954. return nil;
  13955. }));
  13956. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13957. },
  13958. args: ["anIndex", "aBlock"],
  13959. 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 ]",
  13960. referencedClasses: [],
  13961. messageSends: ["at:ifPresent:ifAbsent:"]
  13962. }),
  13963. $globals.TKeyValueCollection);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "at:ifPresent:ifAbsent:",
  13967. protocol: "accessing",
  13968. fn: function (anIndex,aBlock,anotherBlock){
  13969. var self=this,$self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. $self._subclassResponsibility();
  13972. return self;
  13973. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  13974. },
  13975. args: ["anIndex", "aBlock", "anotherBlock"],
  13976. 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",
  13977. referencedClasses: [],
  13978. messageSends: ["subclassResponsibility"]
  13979. }),
  13980. $globals.TKeyValueCollection);
  13981. $core.addMethod(
  13982. $core.method({
  13983. selector: "at:put:",
  13984. protocol: "accessing",
  13985. fn: function (anIndex,anObject){
  13986. var self=this,$self=this;
  13987. return $core.withContext(function($ctx1) {
  13988. $self._subclassResponsibility();
  13989. return self;
  13990. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  13991. },
  13992. args: ["anIndex", "anObject"],
  13993. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  13994. referencedClasses: [],
  13995. messageSends: ["subclassResponsibility"]
  13996. }),
  13997. $globals.TKeyValueCollection);
  13998. $core.addMethod(
  13999. $core.method({
  14000. selector: "indexOf:",
  14001. protocol: "accessing",
  14002. fn: function (anObject){
  14003. var self=this,$self=this;
  14004. return $core.withContext(function($ctx1) {
  14005. return $self._indexOf_ifAbsent_(anObject,(function(){
  14006. return $core.withContext(function($ctx2) {
  14007. return $self._errorNotFound();
  14008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14009. }));
  14010. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  14011. },
  14012. args: ["anObject"],
  14013. 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 ]",
  14014. referencedClasses: [],
  14015. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14016. }),
  14017. $globals.TKeyValueCollection);
  14018. $core.addMethod(
  14019. $core.method({
  14020. selector: "indexOf:ifAbsent:",
  14021. protocol: "accessing",
  14022. fn: function (anObject,aBlock){
  14023. var self=this,$self=this;
  14024. return $core.withContext(function($ctx1) {
  14025. $self._subclassResponsibility();
  14026. return self;
  14027. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  14028. },
  14029. args: ["anObject", "aBlock"],
  14030. 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",
  14031. referencedClasses: [],
  14032. messageSends: ["subclassResponsibility"]
  14033. }),
  14034. $globals.TKeyValueCollection);
  14035. $core.addMethod(
  14036. $core.method({
  14037. selector: "with:do:",
  14038. protocol: "enumerating",
  14039. fn: function (anotherCollection,aBlock){
  14040. var self=this,$self=this;
  14041. return $core.withContext(function($ctx1) {
  14042. $self._withIndexDo_((function(each,index){
  14043. return $core.withContext(function($ctx2) {
  14044. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14045. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14046. }));
  14047. return self;
  14048. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  14049. },
  14050. args: ["anotherCollection", "aBlock"],
  14051. 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) ]",
  14052. referencedClasses: [],
  14053. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14054. }),
  14055. $globals.TKeyValueCollection);
  14056. $core.addMethod(
  14057. $core.method({
  14058. selector: "withIndexDo:",
  14059. protocol: "enumerating",
  14060. fn: function (aBlock){
  14061. var self=this,$self=this;
  14062. return $core.withContext(function($ctx1) {
  14063. $self._subclassResponsibility();
  14064. return self;
  14065. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  14066. },
  14067. args: ["aBlock"],
  14068. 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",
  14069. referencedClasses: [],
  14070. messageSends: ["subclassResponsibility"]
  14071. }),
  14072. $globals.TKeyValueCollection);
  14073. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14074. $core.addMethod(
  14075. $core.method({
  14076. selector: "at:ifAbsent:",
  14077. protocol: "accessing",
  14078. fn: function (anIndex,aBlock){
  14079. var self=this,$self=this;
  14080. return $core.withContext(function($ctx1) {
  14081. return anIndex >= 1 && anIndex <= self.length
  14082. ? self[anIndex - 1]
  14083. : aBlock._value()
  14084. ;
  14085. return self;
  14086. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14087. },
  14088. args: ["anIndex", "aBlock"],
  14089. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  14090. referencedClasses: [],
  14091. messageSends: []
  14092. }),
  14093. $globals.TNativeZeroBasedCollection);
  14094. $core.addMethod(
  14095. $core.method({
  14096. selector: "at:ifPresent:ifAbsent:",
  14097. protocol: "accessing",
  14098. fn: function (anIndex,aBlock,anotherBlock){
  14099. var self=this,$self=this;
  14100. return $core.withContext(function($ctx1) {
  14101. return anIndex >= 1 && anIndex <= self.length
  14102. ? aBlock._value_(self[anIndex - 1])
  14103. : anotherBlock._value()
  14104. ;
  14105. return self;
  14106. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14107. },
  14108. args: ["anIndex", "aBlock", "anotherBlock"],
  14109. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  14110. referencedClasses: [],
  14111. messageSends: []
  14112. }),
  14113. $globals.TNativeZeroBasedCollection);
  14114. $core.addMethod(
  14115. $core.method({
  14116. selector: "detect:ifNone:",
  14117. protocol: "enumerating",
  14118. fn: function (aBlock,anotherBlock){
  14119. var self=this,$self=this;
  14120. return $core.withContext(function($ctx1) {
  14121. for(var i = 0; i < self.length; i++)
  14122. if(aBlock._value_(self[i]))
  14123. return self[i];
  14124. return anotherBlock._value();
  14125. ;
  14126. return self;
  14127. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14128. },
  14129. args: ["aBlock", "anotherBlock"],
  14130. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14131. referencedClasses: [],
  14132. messageSends: []
  14133. }),
  14134. $globals.TNativeZeroBasedCollection);
  14135. $core.addMethod(
  14136. $core.method({
  14137. selector: "do:",
  14138. protocol: "enumerating",
  14139. fn: function (aBlock){
  14140. var self=this,$self=this;
  14141. return $core.withContext(function($ctx1) {
  14142. for(var i=0; i < self.length; i++) {
  14143. aBlock._value_(self[i]);
  14144. }
  14145. ;
  14146. return self;
  14147. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14148. },
  14149. args: ["aBlock"],
  14150. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14151. referencedClasses: [],
  14152. messageSends: []
  14153. }),
  14154. $globals.TNativeZeroBasedCollection);
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "indexOf:ifAbsent:",
  14158. protocol: "accessing",
  14159. fn: function (anObject,aBlock){
  14160. var self=this,$self=this;
  14161. return $core.withContext(function($ctx1) {
  14162. for(var i=0; i < self.length; i++) {
  14163. if($recv(self[i]).__eq(anObject)) {return i+1}
  14164. };
  14165. return aBlock._value();
  14166. ;
  14167. return self;
  14168. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14169. },
  14170. args: ["anObject", "aBlock"],
  14171. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14172. referencedClasses: [],
  14173. messageSends: []
  14174. }),
  14175. $globals.TNativeZeroBasedCollection);
  14176. $core.addMethod(
  14177. $core.method({
  14178. selector: "indexOf:startingAt:ifAbsent:",
  14179. protocol: "accessing",
  14180. fn: function (anObject,start,aBlock){
  14181. var self=this,$self=this;
  14182. return $core.withContext(function($ctx1) {
  14183. for(var i=start - 1; i < self.length; i++){
  14184. if($recv(self[i]).__eq(anObject)) {return i+1}
  14185. }
  14186. return aBlock._value();
  14187. ;
  14188. return self;
  14189. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14190. },
  14191. args: ["anObject", "start", "aBlock"],
  14192. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14193. referencedClasses: [],
  14194. messageSends: []
  14195. }),
  14196. $globals.TNativeZeroBasedCollection);
  14197. $core.addMethod(
  14198. $core.method({
  14199. selector: "single",
  14200. protocol: "accessing",
  14201. fn: function (){
  14202. var self=this,$self=this;
  14203. return $core.withContext(function($ctx1) {
  14204. if (self.length == 0) throw new Error("Collection is empty");
  14205. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14206. return self[0];;
  14207. return self;
  14208. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  14209. },
  14210. args: [],
  14211. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  14212. referencedClasses: [],
  14213. messageSends: []
  14214. }),
  14215. $globals.TNativeZeroBasedCollection);
  14216. $core.addMethod(
  14217. $core.method({
  14218. selector: "size",
  14219. protocol: "accessing",
  14220. fn: function (){
  14221. var self=this,$self=this;
  14222. return $core.withContext(function($ctx1) {
  14223. return self.length;
  14224. return self;
  14225. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  14226. },
  14227. args: [],
  14228. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14229. referencedClasses: [],
  14230. messageSends: []
  14231. }),
  14232. $globals.TNativeZeroBasedCollection);
  14233. $core.addMethod(
  14234. $core.method({
  14235. selector: "with:do:",
  14236. protocol: "enumerating",
  14237. fn: function (anotherCollection,aBlock){
  14238. var self=this,$self=this;
  14239. return $core.withContext(function($ctx1) {
  14240. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14241. for(var i=0; i<self.length; i++) {
  14242. aBlock._value_value_(self[i], anotherCollection[i]);
  14243. }
  14244. ;
  14245. return self;
  14246. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14247. },
  14248. args: ["anotherCollection", "aBlock"],
  14249. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14250. referencedClasses: [],
  14251. messageSends: []
  14252. }),
  14253. $globals.TNativeZeroBasedCollection);
  14254. $core.addMethod(
  14255. $core.method({
  14256. selector: "withIndexDo:",
  14257. protocol: "enumerating",
  14258. fn: function (aBlock){
  14259. var self=this,$self=this;
  14260. return $core.withContext(function($ctx1) {
  14261. for(var i=0; i < self.length; i++) {
  14262. aBlock._value_value_(self[i], i+1);
  14263. }
  14264. ;
  14265. return self;
  14266. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14267. },
  14268. args: ["aBlock"],
  14269. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14270. referencedClasses: [],
  14271. messageSends: []
  14272. }),
  14273. $globals.TNativeZeroBasedCollection);
  14274. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14275. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14276. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14277. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14278. });
  14279. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14280. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14281. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14282. var $pkg = $core.addPackage("Kernel-Classes");
  14283. $pkg.innerEval = function (expr) { return eval(expr); };
  14284. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  14285. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14286. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  14287. $core.addMethod(
  14288. $core.method({
  14289. selector: "allInstanceVariableNames",
  14290. protocol: "accessing",
  14291. fn: function (){
  14292. var self=this,$self=this;
  14293. var result;
  14294. return $core.withContext(function($ctx1) {
  14295. var $1,$receiver;
  14296. result=$recv($self._instanceVariableNames())._copy();
  14297. $1=$self._superclass();
  14298. $ctx1.sendIdx["superclass"]=1;
  14299. if(($receiver = $1) == null || $receiver.a$nil){
  14300. $1;
  14301. } else {
  14302. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14303. }
  14304. return result;
  14305. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14306. },
  14307. args: [],
  14308. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14309. referencedClasses: [],
  14310. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14311. }),
  14312. $globals.Behavior);
  14313. $core.addMethod(
  14314. $core.method({
  14315. selector: "allSelectors",
  14316. protocol: "accessing",
  14317. fn: function (){
  14318. var self=this,$self=this;
  14319. return $core.withContext(function($ctx1) {
  14320. var $1,$2;
  14321. $1=$self._allSuperclasses();
  14322. $2=$self._selectors();
  14323. $ctx1.sendIdx["selectors"]=1;
  14324. return $recv($1)._inject_into_($2,(function(acc,each){
  14325. return $core.withContext(function($ctx2) {
  14326. $recv(acc)._addAll_($recv(each)._selectors());
  14327. return $recv(acc)._yourself();
  14328. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14329. }));
  14330. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14331. },
  14332. args: [],
  14333. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14334. referencedClasses: [],
  14335. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14336. }),
  14337. $globals.Behavior);
  14338. $core.addMethod(
  14339. $core.method({
  14340. selector: "allSubclasses",
  14341. protocol: "accessing",
  14342. fn: function (){
  14343. var self=this,$self=this;
  14344. return $core.withContext(function($ctx1) {
  14345. return $recv($globals.Array)._streamContents_((function(str){
  14346. return $core.withContext(function($ctx2) {
  14347. return $self._allSubclassesDo_((function(each){
  14348. return $core.withContext(function($ctx3) {
  14349. return $recv(str)._nextPut_(each);
  14350. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14351. }));
  14352. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14353. }));
  14354. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14355. },
  14356. args: [],
  14357. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  14358. referencedClasses: ["Array"],
  14359. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14360. }),
  14361. $globals.Behavior);
  14362. $core.addMethod(
  14363. $core.method({
  14364. selector: "allSubclassesDo:",
  14365. protocol: "enumerating",
  14366. fn: function (aBlock){
  14367. var self=this,$self=this;
  14368. return $core.withContext(function($ctx1) {
  14369. $core.traverseClassTree(self, function(subclass) {
  14370. if (subclass !== self) aBlock._value_(subclass);
  14371. });
  14372. return self;
  14373. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14374. },
  14375. args: ["aBlock"],
  14376. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  14377. referencedClasses: [],
  14378. messageSends: []
  14379. }),
  14380. $globals.Behavior);
  14381. $core.addMethod(
  14382. $core.method({
  14383. selector: "allSuperclasses",
  14384. protocol: "accessing",
  14385. fn: function (){
  14386. var self=this,$self=this;
  14387. return $core.withContext(function($ctx1) {
  14388. var $1,$3,$2,$receiver;
  14389. $1=$self._superclass();
  14390. $ctx1.sendIdx["superclass"]=1;
  14391. if(($receiver = $1) == null || $receiver.a$nil){
  14392. return [];
  14393. } else {
  14394. $1;
  14395. }
  14396. $3=$self._superclass();
  14397. $ctx1.sendIdx["superclass"]=2;
  14398. $2=$recv($globals.OrderedCollection)._with_($3);
  14399. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14400. return $recv($2)._yourself();
  14401. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14402. },
  14403. args: [],
  14404. 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",
  14405. referencedClasses: ["OrderedCollection"],
  14406. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14407. }),
  14408. $globals.Behavior);
  14409. $core.addMethod(
  14410. $core.method({
  14411. selector: "basicNew",
  14412. protocol: "instance creation",
  14413. fn: function (){
  14414. var self=this,$self=this;
  14415. return $core.withContext(function($ctx1) {
  14416. return new self.fn();
  14417. return self;
  14418. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14419. },
  14420. args: [],
  14421. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14422. referencedClasses: [],
  14423. messageSends: []
  14424. }),
  14425. $globals.Behavior);
  14426. $core.addMethod(
  14427. $core.method({
  14428. selector: "basicOrganization",
  14429. protocol: "accessing",
  14430. fn: function (){
  14431. var self=this,$self=this;
  14432. return $self["@organization"];
  14433. },
  14434. args: [],
  14435. source: "basicOrganization\x0a\x09^ organization",
  14436. referencedClasses: [],
  14437. messageSends: []
  14438. }),
  14439. $globals.Behavior);
  14440. $core.addMethod(
  14441. $core.method({
  14442. selector: "basicOrganization:",
  14443. protocol: "accessing",
  14444. fn: function (aClassOrganizer){
  14445. var self=this,$self=this;
  14446. $self["@organization"]=aClassOrganizer;
  14447. return self;
  14448. },
  14449. args: ["aClassOrganizer"],
  14450. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14451. referencedClasses: [],
  14452. messageSends: []
  14453. }),
  14454. $globals.Behavior);
  14455. $core.addMethod(
  14456. $core.method({
  14457. selector: "canUnderstand:",
  14458. protocol: "testing",
  14459. fn: function (aSelector){
  14460. var self=this,$self=this;
  14461. return $core.withContext(function($ctx1) {
  14462. var $2,$1;
  14463. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14464. return $core.withContext(function($ctx2) {
  14465. $2=$self._superclass();
  14466. $ctx2.sendIdx["superclass"]=1;
  14467. $1=$recv($2)._notNil();
  14468. return $recv($1)._and_((function(){
  14469. return $core.withContext(function($ctx3) {
  14470. return $recv($self._superclass())._canUnderstand_(aSelector);
  14471. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14472. }));
  14473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14474. }));
  14475. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14476. },
  14477. args: ["aSelector"],
  14478. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14479. referencedClasses: [],
  14480. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14481. }),
  14482. $globals.Behavior);
  14483. $core.addMethod(
  14484. $core.method({
  14485. selector: "includesBehavior:",
  14486. protocol: "testing",
  14487. fn: function (aClass){
  14488. var self=this,$self=this;
  14489. return $core.withContext(function($ctx1) {
  14490. return $recv($self.__eq_eq(aClass))._or_((function(){
  14491. return $core.withContext(function($ctx2) {
  14492. return $self._inheritsFrom_(aClass);
  14493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14494. }));
  14495. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14496. },
  14497. args: ["aClass"],
  14498. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14499. referencedClasses: [],
  14500. messageSends: ["or:", "==", "inheritsFrom:"]
  14501. }),
  14502. $globals.Behavior);
  14503. $core.addMethod(
  14504. $core.method({
  14505. selector: "inheritsFrom:",
  14506. protocol: "testing",
  14507. fn: function (aClass){
  14508. var self=this,$self=this;
  14509. return $core.withContext(function($ctx1) {
  14510. var $1,$3,$2,$receiver;
  14511. $1=$self._superclass();
  14512. $ctx1.sendIdx["superclass"]=1;
  14513. if(($receiver = $1) == null || $receiver.a$nil){
  14514. return false;
  14515. } else {
  14516. $1;
  14517. }
  14518. $3=$self._superclass();
  14519. $ctx1.sendIdx["superclass"]=2;
  14520. $2=$recv(aClass).__eq_eq($3);
  14521. return $recv($2)._or_((function(){
  14522. return $core.withContext(function($ctx2) {
  14523. return $recv($self._superclass())._inheritsFrom_(aClass);
  14524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14525. }));
  14526. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14527. },
  14528. args: ["aClass"],
  14529. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14530. referencedClasses: [],
  14531. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14532. }),
  14533. $globals.Behavior);
  14534. $core.addMethod(
  14535. $core.method({
  14536. selector: "instanceVariableNames",
  14537. protocol: "accessing",
  14538. fn: function (){
  14539. var self=this,$self=this;
  14540. return $core.withContext(function($ctx1) {
  14541. return self.iVarNames;
  14542. return self;
  14543. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14544. },
  14545. args: [],
  14546. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14547. referencedClasses: [],
  14548. messageSends: []
  14549. }),
  14550. $globals.Behavior);
  14551. $core.addMethod(
  14552. $core.method({
  14553. selector: "isBehavior",
  14554. protocol: "testing",
  14555. fn: function (){
  14556. var self=this,$self=this;
  14557. return true;
  14558. },
  14559. args: [],
  14560. source: "isBehavior\x0a\x09^ true",
  14561. referencedClasses: [],
  14562. messageSends: []
  14563. }),
  14564. $globals.Behavior);
  14565. $core.addMethod(
  14566. $core.method({
  14567. selector: "javascriptConstructor",
  14568. protocol: "accessing",
  14569. fn: function (){
  14570. var self=this,$self=this;
  14571. return $core.withContext(function($ctx1) {
  14572. return self.fn;
  14573. return self;
  14574. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14575. },
  14576. args: [],
  14577. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14578. referencedClasses: [],
  14579. messageSends: []
  14580. }),
  14581. $globals.Behavior);
  14582. $core.addMethod(
  14583. $core.method({
  14584. selector: "javascriptConstructor:",
  14585. protocol: "accessing",
  14586. fn: function (aJavaScriptFunction){
  14587. var self=this,$self=this;
  14588. return $core.withContext(function($ctx1) {
  14589. $core.setClassConstructor(self, aJavaScriptFunction);;
  14590. return self;
  14591. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14592. },
  14593. args: ["aJavaScriptFunction"],
  14594. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  14595. referencedClasses: [],
  14596. messageSends: []
  14597. }),
  14598. $globals.Behavior);
  14599. $core.addMethod(
  14600. $core.method({
  14601. selector: "lookupSelector:",
  14602. protocol: "accessing",
  14603. fn: function (selector){
  14604. var self=this,$self=this;
  14605. var lookupClass;
  14606. return $core.withContext(function($ctx1) {
  14607. var $1;
  14608. var $early={};
  14609. try {
  14610. lookupClass=self;
  14611. $recv((function(){
  14612. return $core.withContext(function($ctx2) {
  14613. return $recv(lookupClass).__eq(nil);
  14614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14615. }))._whileFalse_((function(){
  14616. return $core.withContext(function($ctx2) {
  14617. $1=$recv(lookupClass)._includesSelector_(selector);
  14618. if($core.assert($1)){
  14619. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14620. }
  14621. lookupClass=$recv(lookupClass)._superclass();
  14622. return lookupClass;
  14623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14624. }));
  14625. return nil;
  14626. }
  14627. catch(e) {if(e===$early)return e[0]; throw e}
  14628. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14629. },
  14630. args: ["selector"],
  14631. 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",
  14632. referencedClasses: [],
  14633. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14634. }),
  14635. $globals.Behavior);
  14636. $core.addMethod(
  14637. $core.method({
  14638. selector: "new",
  14639. protocol: "instance creation",
  14640. fn: function (){
  14641. var self=this,$self=this;
  14642. return $core.withContext(function($ctx1) {
  14643. return $recv($self._basicNew())._initialize();
  14644. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14645. },
  14646. args: [],
  14647. source: "new\x0a\x09^ self basicNew initialize",
  14648. referencedClasses: [],
  14649. messageSends: ["initialize", "basicNew"]
  14650. }),
  14651. $globals.Behavior);
  14652. $core.addMethod(
  14653. $core.method({
  14654. selector: "prototype",
  14655. protocol: "accessing",
  14656. fn: function (){
  14657. var self=this,$self=this;
  14658. return $core.withContext(function($ctx1) {
  14659. return self.fn.prototype;
  14660. return self;
  14661. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14662. },
  14663. args: [],
  14664. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14665. referencedClasses: [],
  14666. messageSends: []
  14667. }),
  14668. $globals.Behavior);
  14669. $core.addMethod(
  14670. $core.method({
  14671. selector: "subclasses",
  14672. protocol: "accessing",
  14673. fn: function (){
  14674. var self=this,$self=this;
  14675. return $core.withContext(function($ctx1) {
  14676. $self._subclassResponsibility();
  14677. return self;
  14678. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14679. },
  14680. args: [],
  14681. source: "subclasses\x0a\x09self subclassResponsibility",
  14682. referencedClasses: [],
  14683. messageSends: ["subclassResponsibility"]
  14684. }),
  14685. $globals.Behavior);
  14686. $core.addMethod(
  14687. $core.method({
  14688. selector: "superclass",
  14689. protocol: "accessing",
  14690. fn: function (){
  14691. var self=this,$self=this;
  14692. return $core.withContext(function($ctx1) {
  14693. return self.superclass;
  14694. return self;
  14695. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14696. },
  14697. args: [],
  14698. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14699. referencedClasses: [],
  14700. messageSends: []
  14701. }),
  14702. $globals.Behavior);
  14703. $core.addMethod(
  14704. $core.method({
  14705. selector: "theMetaClass",
  14706. protocol: "accessing",
  14707. fn: function (){
  14708. var self=this,$self=this;
  14709. return $core.withContext(function($ctx1) {
  14710. $self._subclassResponsibility();
  14711. return self;
  14712. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14713. },
  14714. args: [],
  14715. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14716. referencedClasses: [],
  14717. messageSends: ["subclassResponsibility"]
  14718. }),
  14719. $globals.Behavior);
  14720. $core.addMethod(
  14721. $core.method({
  14722. selector: "theNonMetaClass",
  14723. protocol: "accessing",
  14724. fn: function (){
  14725. var self=this,$self=this;
  14726. return $core.withContext(function($ctx1) {
  14727. $self._subclassResponsibility();
  14728. return self;
  14729. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14730. },
  14731. args: [],
  14732. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14733. referencedClasses: [],
  14734. messageSends: ["subclassResponsibility"]
  14735. }),
  14736. $globals.Behavior);
  14737. $core.addMethod(
  14738. $core.method({
  14739. selector: "withAllSubclasses",
  14740. protocol: "accessing",
  14741. fn: function (){
  14742. var self=this,$self=this;
  14743. return $core.withContext(function($ctx1) {
  14744. var $1;
  14745. $1=$recv($globals.Array)._with_(self);
  14746. $recv($1)._addAll_($self._allSubclasses());
  14747. return $recv($1)._yourself();
  14748. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14749. },
  14750. args: [],
  14751. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14752. referencedClasses: ["Array"],
  14753. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14754. }),
  14755. $globals.Behavior);
  14756. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14757. $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.";
  14758. $core.addMethod(
  14759. $core.method({
  14760. selector: "basicPackage:",
  14761. protocol: "accessing",
  14762. fn: function (aPackage){
  14763. var self=this,$self=this;
  14764. $self["@package"]=aPackage;
  14765. return self;
  14766. },
  14767. args: ["aPackage"],
  14768. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14769. referencedClasses: [],
  14770. messageSends: []
  14771. }),
  14772. $globals.Class);
  14773. $core.addMethod(
  14774. $core.method({
  14775. selector: "classTag",
  14776. protocol: "accessing",
  14777. fn: function (){
  14778. var self=this,$self=this;
  14779. return "class";
  14780. },
  14781. args: [],
  14782. 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'",
  14783. referencedClasses: [],
  14784. messageSends: []
  14785. }),
  14786. $globals.Class);
  14787. $core.addMethod(
  14788. $core.method({
  14789. selector: "definition",
  14790. protocol: "accessing",
  14791. fn: function (){
  14792. var self=this,$self=this;
  14793. return $core.withContext(function($ctx1) {
  14794. var $1,$2;
  14795. return $recv($globals.String)._streamContents_((function(stream){
  14796. return $core.withContext(function($ctx2) {
  14797. $recv(stream)._print_($self._superclass());
  14798. $ctx2.sendIdx["print:"]=1;
  14799. $recv(stream)._write_(" subclass: ");
  14800. $ctx2.sendIdx["write:"]=1;
  14801. $recv(stream)._printSymbol_($self._name());
  14802. $recv(stream)._lf();
  14803. $ctx2.sendIdx["lf"]=1;
  14804. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14805. return $core.withContext(function($ctx3) {
  14806. $1=$recv($globals.String)._tab();
  14807. $ctx3.sendIdx["tab"]=1;
  14808. $2=$recv($globals.String)._lf();
  14809. $ctx3.sendIdx["lf"]=2;
  14810. return [$1,"uses: ",tcd,$2];
  14811. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14812. })));
  14813. $ctx2.sendIdx["write:"]=2;
  14814. $recv(stream)._tab();
  14815. $ctx2.sendIdx["tab"]=2;
  14816. $recv(stream)._write_("instanceVariableNames: ");
  14817. $ctx2.sendIdx["write:"]=3;
  14818. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14819. $ctx2.sendIdx["print:"]=2;
  14820. $recv(stream)._lf();
  14821. $recv(stream)._tab();
  14822. $recv(stream)._write_("package: ");
  14823. return $recv(stream)._print_($self._category());
  14824. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14825. }));
  14826. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14827. },
  14828. args: [],
  14829. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14830. referencedClasses: ["String"],
  14831. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14832. }),
  14833. $globals.Class);
  14834. $core.addMethod(
  14835. $core.method({
  14836. selector: "isClass",
  14837. protocol: "testing",
  14838. fn: function (){
  14839. var self=this,$self=this;
  14840. return true;
  14841. },
  14842. args: [],
  14843. source: "isClass\x0a\x09^ true",
  14844. referencedClasses: [],
  14845. messageSends: []
  14846. }),
  14847. $globals.Class);
  14848. $core.addMethod(
  14849. $core.method({
  14850. selector: "package",
  14851. protocol: "accessing",
  14852. fn: function (){
  14853. var self=this,$self=this;
  14854. return $self["@package"];
  14855. },
  14856. args: [],
  14857. source: "package\x0a\x09^ package",
  14858. referencedClasses: [],
  14859. messageSends: []
  14860. }),
  14861. $globals.Class);
  14862. $core.addMethod(
  14863. $core.method({
  14864. selector: "provided",
  14865. protocol: "converting",
  14866. fn: function (){
  14867. var self=this,$self=this;
  14868. return $core.withContext(function($ctx1) {
  14869. return $recv($self._javascriptConstructor())._provided();
  14870. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  14871. },
  14872. args: [],
  14873. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  14874. referencedClasses: [],
  14875. messageSends: ["provided", "javascriptConstructor"]
  14876. }),
  14877. $globals.Class);
  14878. $core.addMethod(
  14879. $core.method({
  14880. selector: "rename:",
  14881. protocol: "accessing",
  14882. fn: function (aString){
  14883. var self=this,$self=this;
  14884. return $core.withContext(function($ctx1) {
  14885. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14886. return self;
  14887. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14888. },
  14889. args: ["aString"],
  14890. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14891. referencedClasses: ["ClassBuilder"],
  14892. messageSends: ["renameClass:to:", "new"]
  14893. }),
  14894. $globals.Class);
  14895. $core.addMethod(
  14896. $core.method({
  14897. selector: "subclasses",
  14898. protocol: "accessing",
  14899. fn: function (){
  14900. var self=this,$self=this;
  14901. return $core.withContext(function($ctx1) {
  14902. return self.subclasses._copy();
  14903. return self;
  14904. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14905. },
  14906. args: [],
  14907. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14908. referencedClasses: [],
  14909. messageSends: []
  14910. }),
  14911. $globals.Class);
  14912. $core.addMethod(
  14913. $core.method({
  14914. selector: "theMetaClass",
  14915. protocol: "accessing",
  14916. fn: function (){
  14917. var self=this,$self=this;
  14918. return $core.withContext(function($ctx1) {
  14919. return $self._class();
  14920. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14921. },
  14922. args: [],
  14923. source: "theMetaClass\x0a\x09^ self class",
  14924. referencedClasses: [],
  14925. messageSends: ["class"]
  14926. }),
  14927. $globals.Class);
  14928. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14929. $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.";
  14930. $core.addMethod(
  14931. $core.method({
  14932. selector: "asJavaScriptSource",
  14933. protocol: "converting",
  14934. fn: function (){
  14935. var self=this,$self=this;
  14936. return $core.withContext(function($ctx1) {
  14937. var $1;
  14938. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14939. $ctx1.sendIdx[","]=1;
  14940. return $1;
  14941. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14942. },
  14943. args: [],
  14944. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14945. referencedClasses: [],
  14946. messageSends: [",", "name", "instanceClass"]
  14947. }),
  14948. $globals.Metaclass);
  14949. $core.addMethod(
  14950. $core.method({
  14951. selector: "definition",
  14952. protocol: "accessing",
  14953. fn: function (){
  14954. var self=this,$self=this;
  14955. return $core.withContext(function($ctx1) {
  14956. var $1,$2;
  14957. return $recv($globals.String)._streamContents_((function(stream){
  14958. return $core.withContext(function($ctx2) {
  14959. $recv(stream)._print_(self);
  14960. $ctx2.sendIdx["print:"]=1;
  14961. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14962. return " ";
  14963. }),(function(tcd){
  14964. return $core.withContext(function($ctx3) {
  14965. $1=$recv($globals.String)._lf();
  14966. $ctx3.sendIdx["lf"]=1;
  14967. $2=$recv($globals.String)._tab();
  14968. $ctx3.sendIdx["tab"]=1;
  14969. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14970. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14971. })));
  14972. $ctx2.sendIdx["write:"]=1;
  14973. $recv(stream)._write_("instanceVariableNames: ");
  14974. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14975. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14976. }));
  14977. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14978. },
  14979. args: [],
  14980. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  14981. referencedClasses: ["String"],
  14982. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14983. }),
  14984. $globals.Metaclass);
  14985. $core.addMethod(
  14986. $core.method({
  14987. selector: "instanceClass",
  14988. protocol: "accessing",
  14989. fn: function (){
  14990. var self=this,$self=this;
  14991. return $core.withContext(function($ctx1) {
  14992. return self.instanceClass;
  14993. return self;
  14994. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14995. },
  14996. args: [],
  14997. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  14998. referencedClasses: [],
  14999. messageSends: []
  15000. }),
  15001. $globals.Metaclass);
  15002. $core.addMethod(
  15003. $core.method({
  15004. selector: "instanceVariableNames:",
  15005. protocol: "accessing",
  15006. fn: function (aCollection){
  15007. var self=this,$self=this;
  15008. return $core.withContext(function($ctx1) {
  15009. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15010. return self;
  15011. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15012. },
  15013. args: ["aCollection"],
  15014. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15015. referencedClasses: ["ClassBuilder"],
  15016. messageSends: ["class:instanceVariableNames:", "new"]
  15017. }),
  15018. $globals.Metaclass);
  15019. $core.addMethod(
  15020. $core.method({
  15021. selector: "isMetaclass",
  15022. protocol: "testing",
  15023. fn: function (){
  15024. var self=this,$self=this;
  15025. return true;
  15026. },
  15027. args: [],
  15028. source: "isMetaclass\x0a\x09^ true",
  15029. referencedClasses: [],
  15030. messageSends: []
  15031. }),
  15032. $globals.Metaclass);
  15033. $core.addMethod(
  15034. $core.method({
  15035. selector: "name",
  15036. protocol: "accessing",
  15037. fn: function (){
  15038. var self=this,$self=this;
  15039. return $core.withContext(function($ctx1) {
  15040. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15041. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15042. },
  15043. args: [],
  15044. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15045. referencedClasses: [],
  15046. messageSends: [",", "name", "instanceClass"]
  15047. }),
  15048. $globals.Metaclass);
  15049. $core.addMethod(
  15050. $core.method({
  15051. selector: "package",
  15052. protocol: "accessing",
  15053. fn: function (){
  15054. var self=this,$self=this;
  15055. return $core.withContext(function($ctx1) {
  15056. return $recv($self._instanceClass())._package();
  15057. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15058. },
  15059. args: [],
  15060. source: "package\x0a\x09^ self instanceClass package",
  15061. referencedClasses: [],
  15062. messageSends: ["package", "instanceClass"]
  15063. }),
  15064. $globals.Metaclass);
  15065. $core.addMethod(
  15066. $core.method({
  15067. selector: "subclasses",
  15068. protocol: "accessing",
  15069. fn: function (){
  15070. var self=this,$self=this;
  15071. return $core.withContext(function($ctx1) {
  15072. return $core.metaSubclasses(self);
  15073. return self;
  15074. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15075. },
  15076. args: [],
  15077. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15078. referencedClasses: [],
  15079. messageSends: []
  15080. }),
  15081. $globals.Metaclass);
  15082. $core.addMethod(
  15083. $core.method({
  15084. selector: "theMetaClass",
  15085. protocol: "accessing",
  15086. fn: function (){
  15087. var self=this,$self=this;
  15088. return self;
  15089. },
  15090. args: [],
  15091. source: "theMetaClass\x0a\x09^ self",
  15092. referencedClasses: [],
  15093. messageSends: []
  15094. }),
  15095. $globals.Metaclass);
  15096. $core.addMethod(
  15097. $core.method({
  15098. selector: "theNonMetaClass",
  15099. protocol: "accessing",
  15100. fn: function (){
  15101. var self=this,$self=this;
  15102. return $core.withContext(function($ctx1) {
  15103. return $self._instanceClass();
  15104. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15105. },
  15106. args: [],
  15107. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15108. referencedClasses: [],
  15109. messageSends: ["instanceClass"]
  15110. }),
  15111. $globals.Metaclass);
  15112. $core.addMethod(
  15113. $core.method({
  15114. selector: "uses:instanceVariableNames:",
  15115. protocol: "accessing",
  15116. fn: function (aTraitCompositionDescription,aCollection){
  15117. var self=this,$self=this;
  15118. var metaclass;
  15119. return $core.withContext(function($ctx1) {
  15120. metaclass=$self._instanceVariableNames_(aCollection);
  15121. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15122. return metaclass;
  15123. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15124. },
  15125. args: ["aTraitCompositionDescription", "aCollection"],
  15126. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15127. referencedClasses: [],
  15128. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15129. }),
  15130. $globals.Metaclass);
  15131. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15132. $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:`.";
  15133. $core.addMethod(
  15134. $core.method({
  15135. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15136. protocol: "class definition",
  15137. fn: function (aClass,className,aCollection,packageName){
  15138. var self=this,$self=this;
  15139. var theClass,thePackage;
  15140. return $core.withContext(function($ctx1) {
  15141. var $1,$2,$3,$receiver;
  15142. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15143. thePackage=$recv($globals.Package)._named_(packageName);
  15144. $1=theClass;
  15145. if(($receiver = $1) == null || $receiver.a$nil){
  15146. $1;
  15147. } else {
  15148. $recv(theClass)._package_(thePackage);
  15149. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15150. if(!$core.assert($2)){
  15151. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15152. }
  15153. }
  15154. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15155. $recv($3)._recompile();
  15156. return $recv($3)._yourself();
  15157. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15158. },
  15159. args: ["aClass", "className", "aCollection", "packageName"],
  15160. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  15161. referencedClasses: ["Smalltalk", "Package"],
  15162. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15163. }),
  15164. $globals.ClassBuilder);
  15165. $core.addMethod(
  15166. $core.method({
  15167. selector: "addTraitNamed:package:",
  15168. protocol: "class definition",
  15169. fn: function (traitName,packageName){
  15170. var self=this,$self=this;
  15171. var theTrait,thePackage;
  15172. return $core.withContext(function($ctx1) {
  15173. var $1,$2,$receiver;
  15174. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15175. thePackage=$recv($globals.Package)._named_(packageName);
  15176. $1=theTrait;
  15177. if(($receiver = $1) == null || $receiver.a$nil){
  15178. $1;
  15179. } else {
  15180. $2=theTrait;
  15181. $recv($2)._package_(thePackage);
  15182. $recv($2)._recompile();
  15183. return $recv($2)._yourself();
  15184. }
  15185. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15186. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15187. },
  15188. args: ["traitName", "packageName"],
  15189. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  15190. referencedClasses: ["Smalltalk", "Package"],
  15191. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15192. }),
  15193. $globals.ClassBuilder);
  15194. $core.addMethod(
  15195. $core.method({
  15196. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15197. protocol: "private",
  15198. fn: function (aClass,aString,aCollection,packageName){
  15199. var self=this,$self=this;
  15200. return $core.withContext(function($ctx1) {
  15201. return $core.addClass(aString, aClass, aCollection, packageName);
  15202. ;
  15203. return self;
  15204. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15205. },
  15206. args: ["aClass", "aString", "aCollection", "packageName"],
  15207. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15208. referencedClasses: [],
  15209. messageSends: []
  15210. }),
  15211. $globals.ClassBuilder);
  15212. $core.addMethod(
  15213. $core.method({
  15214. selector: "basicAddTraitNamed:package:",
  15215. protocol: "private",
  15216. fn: function (aString,anotherString){
  15217. var self=this,$self=this;
  15218. return $core.withContext(function($ctx1) {
  15219. return $core.addTrait(aString, anotherString);
  15220. return self;
  15221. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15222. },
  15223. args: ["aString", "anotherString"],
  15224. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15225. referencedClasses: [],
  15226. messageSends: []
  15227. }),
  15228. $globals.ClassBuilder);
  15229. $core.addMethod(
  15230. $core.method({
  15231. selector: "basicClass:instanceVariables:",
  15232. protocol: "private",
  15233. fn: function (aClass,aCollection){
  15234. var self=this,$self=this;
  15235. return $core.withContext(function($ctx1) {
  15236. var $1;
  15237. $1=$recv(aClass)._isMetaclass();
  15238. if(!$core.assert($1)){
  15239. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15240. }
  15241. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15242. return self;
  15243. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15244. },
  15245. args: ["aClass", "aCollection"],
  15246. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15247. referencedClasses: [],
  15248. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15249. }),
  15250. $globals.ClassBuilder);
  15251. $core.addMethod(
  15252. $core.method({
  15253. selector: "basicRemoveClass:",
  15254. protocol: "private",
  15255. fn: function (aClass){
  15256. var self=this,$self=this;
  15257. return $core.withContext(function($ctx1) {
  15258. $core.removeClass(aClass);
  15259. return self;
  15260. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15261. },
  15262. args: ["aClass"],
  15263. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15264. referencedClasses: [],
  15265. messageSends: []
  15266. }),
  15267. $globals.ClassBuilder);
  15268. $core.addMethod(
  15269. $core.method({
  15270. selector: "basicRenameClass:to:",
  15271. protocol: "private",
  15272. fn: function (aClass,aString){
  15273. var self=this,$self=this;
  15274. return $core.withContext(function($ctx1) {
  15275. $globals[aString] = aClass;
  15276. delete $globals[aClass.name];
  15277. aClass.name = aString;
  15278. ;
  15279. return self;
  15280. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15281. },
  15282. args: ["aClass", "aString"],
  15283. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15284. referencedClasses: [],
  15285. messageSends: []
  15286. }),
  15287. $globals.ClassBuilder);
  15288. $core.addMethod(
  15289. $core.method({
  15290. selector: "basicSwapClassNames:with:",
  15291. protocol: "private",
  15292. fn: function (aClass,anotherClass){
  15293. var self=this,$self=this;
  15294. return $core.withContext(function($ctx1) {
  15295. var tmp = aClass.name;
  15296. aClass.name = anotherClass.name;
  15297. anotherClass.name = tmp;
  15298. ;
  15299. return self;
  15300. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15301. },
  15302. args: ["aClass", "anotherClass"],
  15303. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15304. referencedClasses: [],
  15305. messageSends: []
  15306. }),
  15307. $globals.ClassBuilder);
  15308. $core.addMethod(
  15309. $core.method({
  15310. selector: "class:instanceVariableNames:",
  15311. protocol: "class definition",
  15312. fn: function (aClass,ivarNames){
  15313. var self=this,$self=this;
  15314. return $core.withContext(function($ctx1) {
  15315. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15316. return self;
  15317. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15318. },
  15319. args: ["aClass", "ivarNames"],
  15320. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15321. referencedClasses: [],
  15322. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15323. }),
  15324. $globals.ClassBuilder);
  15325. $core.addMethod(
  15326. $core.method({
  15327. selector: "class:instanceVariables:",
  15328. protocol: "class definition",
  15329. fn: function (aClass,aCollection){
  15330. var self=this,$self=this;
  15331. return $core.withContext(function($ctx1) {
  15332. var $1,$3,$2;
  15333. $self._basicClass_instanceVariables_(aClass,aCollection);
  15334. $1=$recv($globals.SystemAnnouncer)._current();
  15335. $3=$recv($globals.ClassDefinitionChanged)._new();
  15336. $recv($3)._theClass_(aClass);
  15337. $2=$recv($3)._yourself();
  15338. $recv($1)._announce_($2);
  15339. return self;
  15340. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15341. },
  15342. args: ["aClass", "aCollection"],
  15343. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15344. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15345. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15346. }),
  15347. $globals.ClassBuilder);
  15348. $core.addMethod(
  15349. $core.method({
  15350. selector: "copyClass:named:",
  15351. protocol: "copying",
  15352. fn: function (aClass,className){
  15353. var self=this,$self=this;
  15354. var newClass;
  15355. return $core.withContext(function($ctx1) {
  15356. var $1,$3,$2;
  15357. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15358. $self._copyClass_to_(aClass,newClass);
  15359. $1=$recv($globals.SystemAnnouncer)._current();
  15360. $3=$recv($globals.ClassAdded)._new();
  15361. $recv($3)._theClass_(newClass);
  15362. $2=$recv($3)._yourself();
  15363. $recv($1)._announce_($2);
  15364. return newClass;
  15365. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15366. },
  15367. args: ["aClass", "className"],
  15368. 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",
  15369. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15370. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15371. }),
  15372. $globals.ClassBuilder);
  15373. $core.addMethod(
  15374. $core.method({
  15375. selector: "copyClass:to:",
  15376. protocol: "copying",
  15377. fn: function (aClass,anotherClass){
  15378. var self=this,$self=this;
  15379. return $core.withContext(function($ctx1) {
  15380. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15381. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15382. $1=$recv(aClass)._methodDictionary();
  15383. $ctx1.sendIdx["methodDictionary"]=1;
  15384. $recv($1)._valuesDo_((function(each){
  15385. return $core.withContext(function($ctx2) {
  15386. $3=$recv(each)._methodClass();
  15387. $ctx2.sendIdx["methodClass"]=1;
  15388. $2=$recv($3).__eq(aClass);
  15389. $ctx2.sendIdx["="]=1;
  15390. if($core.assert($2)){
  15391. $4=$recv($globals.Compiler)._new();
  15392. $ctx2.sendIdx["new"]=1;
  15393. $5=$recv(each)._source();
  15394. $ctx2.sendIdx["source"]=1;
  15395. $6=$recv(each)._protocol();
  15396. $ctx2.sendIdx["protocol"]=1;
  15397. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15398. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15399. }
  15400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15401. }));
  15402. $ctx1.sendIdx["valuesDo:"]=1;
  15403. $7=$recv(aClass)._traitComposition();
  15404. $ctx1.sendIdx["traitComposition"]=1;
  15405. $recv(anotherClass)._setTraitComposition_($7);
  15406. $ctx1.sendIdx["setTraitComposition:"]=1;
  15407. $8=$recv(anotherClass)._class();
  15408. $ctx1.sendIdx["class"]=1;
  15409. $10=$recv(aClass)._class();
  15410. $ctx1.sendIdx["class"]=2;
  15411. $9=$recv($10)._instanceVariableNames();
  15412. $self._basicClass_instanceVariables_($8,$9);
  15413. $12=$recv(aClass)._class();
  15414. $ctx1.sendIdx["class"]=3;
  15415. $11=$recv($12)._methodDictionary();
  15416. $recv($11)._valuesDo_((function(each){
  15417. return $core.withContext(function($ctx2) {
  15418. $14=$recv(each)._methodClass();
  15419. $15=$recv(aClass)._class();
  15420. $ctx2.sendIdx["class"]=4;
  15421. $13=$recv($14).__eq($15);
  15422. if($core.assert($13)){
  15423. $16=$recv($globals.Compiler)._new();
  15424. $17=$recv(each)._source();
  15425. $18=$recv(anotherClass)._class();
  15426. $ctx2.sendIdx["class"]=5;
  15427. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15428. }
  15429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15430. }));
  15431. $19=$recv(anotherClass)._class();
  15432. $ctx1.sendIdx["class"]=6;
  15433. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15434. return self;
  15435. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15436. },
  15437. args: ["aClass", "anotherClass"],
  15438. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  15439. referencedClasses: ["Compiler"],
  15440. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15441. }),
  15442. $globals.ClassBuilder);
  15443. $core.addMethod(
  15444. $core.method({
  15445. selector: "installMethod:forClass:protocol:",
  15446. protocol: "method definition",
  15447. fn: function (aCompiledMethod,aBehavior,aString){
  15448. var self=this,$self=this;
  15449. return $core.withContext(function($ctx1) {
  15450. $recv(aCompiledMethod)._protocol_(aString);
  15451. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15452. return aCompiledMethod;
  15453. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15454. },
  15455. args: ["aCompiledMethod", "aBehavior", "aString"],
  15456. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15457. referencedClasses: [],
  15458. messageSends: ["protocol:", "addCompiledMethod:"]
  15459. }),
  15460. $globals.ClassBuilder);
  15461. $core.addMethod(
  15462. $core.method({
  15463. selector: "instanceVariableNamesFor:",
  15464. protocol: "accessing",
  15465. fn: function (aString){
  15466. var self=this,$self=this;
  15467. return $core.withContext(function($ctx1) {
  15468. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15469. return $core.withContext(function($ctx2) {
  15470. return $recv(each)._isEmpty();
  15471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15472. }));
  15473. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15474. },
  15475. args: ["aString"],
  15476. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15477. referencedClasses: [],
  15478. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15479. }),
  15480. $globals.ClassBuilder);
  15481. $core.addMethod(
  15482. $core.method({
  15483. selector: "migrateClass:superclass:",
  15484. protocol: "class migration",
  15485. fn: function (aClass,anotherClass){
  15486. var self=this,$self=this;
  15487. return $core.withContext(function($ctx1) {
  15488. var $1;
  15489. $1=$recv(aClass)._name();
  15490. $ctx1.sendIdx["name"]=1;
  15491. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15492. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15493. },
  15494. args: ["aClass", "anotherClass"],
  15495. 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",
  15496. referencedClasses: [],
  15497. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15498. }),
  15499. $globals.ClassBuilder);
  15500. $core.addMethod(
  15501. $core.method({
  15502. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15503. protocol: "class migration",
  15504. fn: function (className,aClass,aCollection,packageName){
  15505. var self=this,$self=this;
  15506. var oldClass,newClass,tmp;
  15507. return $core.withContext(function($ctx1) {
  15508. var $1,$2,$4,$3;
  15509. tmp="new*".__comma(className);
  15510. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15511. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15512. $self._basicSwapClassNames_with_(oldClass,newClass);
  15513. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15514. $recv((function(){
  15515. return $core.withContext(function($ctx2) {
  15516. return $self._copyClass_to_(oldClass,newClass);
  15517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15518. }))._on_do_($globals.Error,(function(exception){
  15519. return $core.withContext(function($ctx2) {
  15520. $self._basicSwapClassNames_with_(oldClass,newClass);
  15521. $1=$self._basicRemoveClass_(newClass);
  15522. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15523. return $recv(exception)._pass();
  15524. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15525. }));
  15526. $self._rawRenameClass_to_(oldClass,tmp);
  15527. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15528. $self._rawRenameClass_to_(newClass,className);
  15529. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15530. return $core.withContext(function($ctx2) {
  15531. return $self._migrateClass_superclass_(each,newClass);
  15532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15533. }));
  15534. $self._basicRemoveClass_(oldClass);
  15535. $2=$recv($globals.SystemAnnouncer)._current();
  15536. $4=$recv($globals.ClassMigrated)._new();
  15537. $recv($4)._theClass_(newClass);
  15538. $recv($4)._oldClass_(oldClass);
  15539. $3=$recv($4)._yourself();
  15540. $recv($2)._announce_($3);
  15541. return newClass;
  15542. }, 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)});
  15543. },
  15544. args: ["className", "aClass", "aCollection", "packageName"],
  15545. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15546. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15547. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15548. }),
  15549. $globals.ClassBuilder);
  15550. $core.addMethod(
  15551. $core.method({
  15552. selector: "rawRenameClass:to:",
  15553. protocol: "private",
  15554. fn: function (aClass,aString){
  15555. var self=this,$self=this;
  15556. return $core.withContext(function($ctx1) {
  15557. $globals[aString] = aClass;
  15558. ;
  15559. return self;
  15560. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15561. },
  15562. args: ["aClass", "aString"],
  15563. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15564. referencedClasses: [],
  15565. messageSends: []
  15566. }),
  15567. $globals.ClassBuilder);
  15568. $core.addMethod(
  15569. $core.method({
  15570. selector: "renameClass:to:",
  15571. protocol: "class migration",
  15572. fn: function (aClass,className){
  15573. var self=this,$self=this;
  15574. return $core.withContext(function($ctx1) {
  15575. var $1,$3,$2;
  15576. $self._basicRenameClass_to_(aClass,className);
  15577. $recv(aClass)._recompile();
  15578. $1=$recv($globals.SystemAnnouncer)._current();
  15579. $3=$recv($globals.ClassRenamed)._new();
  15580. $recv($3)._theClass_(aClass);
  15581. $2=$recv($3)._yourself();
  15582. $recv($1)._announce_($2);
  15583. return self;
  15584. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15585. },
  15586. args: ["aClass", "className"],
  15587. 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)",
  15588. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15589. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15590. }),
  15591. $globals.ClassBuilder);
  15592. $core.addMethod(
  15593. $core.method({
  15594. selector: "superclass:subclass:",
  15595. protocol: "class definition",
  15596. fn: function (aClass,className){
  15597. var self=this,$self=this;
  15598. return $core.withContext(function($ctx1) {
  15599. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15600. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15601. },
  15602. args: ["aClass", "className"],
  15603. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15604. referencedClasses: [],
  15605. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15606. }),
  15607. $globals.ClassBuilder);
  15608. $core.addMethod(
  15609. $core.method({
  15610. selector: "superclass:subclass:instanceVariableNames:package:",
  15611. protocol: "class definition",
  15612. fn: function (aClass,className,ivarNames,packageName){
  15613. var self=this,$self=this;
  15614. var newClass;
  15615. return $core.withContext(function($ctx1) {
  15616. var $1,$2,$3,$5,$4,$receiver;
  15617. $1=$self._instanceVariableNamesFor_(ivarNames);
  15618. if(($receiver = packageName) == null || $receiver.a$nil){
  15619. $2="unclassified";
  15620. } else {
  15621. $2=packageName;
  15622. }
  15623. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15624. $3=$recv($globals.SystemAnnouncer)._current();
  15625. $5=$recv($globals.ClassAdded)._new();
  15626. $recv($5)._theClass_(newClass);
  15627. $4=$recv($5)._yourself();
  15628. $recv($3)._announce_($4);
  15629. return newClass;
  15630. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15631. },
  15632. args: ["aClass", "className", "ivarNames", "packageName"],
  15633. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15634. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15635. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15636. }),
  15637. $globals.ClassBuilder);
  15638. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15639. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15640. $core.addMethod(
  15641. $core.method({
  15642. selector: "getNodesFrom:",
  15643. protocol: "accessing",
  15644. fn: function (aCollection){
  15645. var self=this,$self=this;
  15646. var children,others;
  15647. return $core.withContext(function($ctx1) {
  15648. var $1;
  15649. children=[];
  15650. others=[];
  15651. $recv(aCollection)._do_((function(each){
  15652. return $core.withContext(function($ctx2) {
  15653. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15654. if($core.assert($1)){
  15655. return $recv(children)._add_(each);
  15656. $ctx2.sendIdx["add:"]=1;
  15657. } else {
  15658. return $recv(others)._add_(each);
  15659. }
  15660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15661. }));
  15662. $self["@nodes"]=$recv(children)._collect_((function(each){
  15663. return $core.withContext(function($ctx2) {
  15664. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15666. }));
  15667. return self;
  15668. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15669. },
  15670. args: ["aCollection"],
  15671. 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 ]",
  15672. referencedClasses: ["ClassSorterNode"],
  15673. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15674. }),
  15675. $globals.ClassSorterNode);
  15676. $core.addMethod(
  15677. $core.method({
  15678. selector: "level",
  15679. protocol: "accessing",
  15680. fn: function (){
  15681. var self=this,$self=this;
  15682. return $self["@level"];
  15683. },
  15684. args: [],
  15685. source: "level\x0a\x09^ level",
  15686. referencedClasses: [],
  15687. messageSends: []
  15688. }),
  15689. $globals.ClassSorterNode);
  15690. $core.addMethod(
  15691. $core.method({
  15692. selector: "level:",
  15693. protocol: "accessing",
  15694. fn: function (anInteger){
  15695. var self=this,$self=this;
  15696. $self["@level"]=anInteger;
  15697. return self;
  15698. },
  15699. args: ["anInteger"],
  15700. source: "level: anInteger\x0a\x09level := anInteger",
  15701. referencedClasses: [],
  15702. messageSends: []
  15703. }),
  15704. $globals.ClassSorterNode);
  15705. $core.addMethod(
  15706. $core.method({
  15707. selector: "nodes",
  15708. protocol: "accessing",
  15709. fn: function (){
  15710. var self=this,$self=this;
  15711. return $self["@nodes"];
  15712. },
  15713. args: [],
  15714. source: "nodes\x0a\x09^ nodes",
  15715. referencedClasses: [],
  15716. messageSends: []
  15717. }),
  15718. $globals.ClassSorterNode);
  15719. $core.addMethod(
  15720. $core.method({
  15721. selector: "theClass",
  15722. protocol: "accessing",
  15723. fn: function (){
  15724. var self=this,$self=this;
  15725. return $self["@theClass"];
  15726. },
  15727. args: [],
  15728. source: "theClass\x0a\x09^ theClass",
  15729. referencedClasses: [],
  15730. messageSends: []
  15731. }),
  15732. $globals.ClassSorterNode);
  15733. $core.addMethod(
  15734. $core.method({
  15735. selector: "theClass:",
  15736. protocol: "accessing",
  15737. fn: function (aClass){
  15738. var self=this,$self=this;
  15739. $self["@theClass"]=aClass;
  15740. return self;
  15741. },
  15742. args: ["aClass"],
  15743. source: "theClass: aClass\x0a\x09theClass := aClass",
  15744. referencedClasses: [],
  15745. messageSends: []
  15746. }),
  15747. $globals.ClassSorterNode);
  15748. $core.addMethod(
  15749. $core.method({
  15750. selector: "traverseClassesWith:",
  15751. protocol: "visiting",
  15752. fn: function (aCollection){
  15753. var self=this,$self=this;
  15754. return $core.withContext(function($ctx1) {
  15755. var $1,$3,$2;
  15756. $1=$self._theClass();
  15757. $ctx1.sendIdx["theClass"]=1;
  15758. $recv(aCollection)._add_($1);
  15759. $recv($recv($self._nodes())._sorted_((function(a,b){
  15760. return $core.withContext(function($ctx2) {
  15761. $3=$recv(a)._theClass();
  15762. $ctx2.sendIdx["theClass"]=2;
  15763. $2=$recv($3)._name();
  15764. $ctx2.sendIdx["name"]=1;
  15765. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15766. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15767. })))._do_((function(aNode){
  15768. return $core.withContext(function($ctx2) {
  15769. return $recv(aNode)._traverseClassesWith_(aCollection);
  15770. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15771. }));
  15772. return self;
  15773. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15774. },
  15775. args: ["aCollection"],
  15776. 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 ].",
  15777. referencedClasses: [],
  15778. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15779. }),
  15780. $globals.ClassSorterNode);
  15781. $core.addMethod(
  15782. $core.method({
  15783. selector: "on:classes:level:",
  15784. protocol: "instance creation",
  15785. fn: function (aClass,aCollection,anInteger){
  15786. var self=this,$self=this;
  15787. return $core.withContext(function($ctx1) {
  15788. var $1;
  15789. $1=$self._new();
  15790. $recv($1)._theClass_(aClass);
  15791. $recv($1)._level_(anInteger);
  15792. $recv($1)._getNodesFrom_(aCollection);
  15793. return $recv($1)._yourself();
  15794. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15795. },
  15796. args: ["aClass", "aCollection", "anInteger"],
  15797. 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",
  15798. referencedClasses: [],
  15799. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15800. }),
  15801. $globals.ClassSorterNode.a$cls);
  15802. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15803. $core.addMethod(
  15804. $core.method({
  15805. selector: "allInstanceVariableNames",
  15806. protocol: "accessing",
  15807. fn: function (){
  15808. var self=this,$self=this;
  15809. return [];
  15810. },
  15811. args: [],
  15812. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15813. referencedClasses: [],
  15814. messageSends: []
  15815. }),
  15816. $globals.TBehaviorDefaults);
  15817. $core.addMethod(
  15818. $core.method({
  15819. selector: "allSubclassesDo:",
  15820. protocol: "enumerating",
  15821. fn: function (aBlock){
  15822. var self=this,$self=this;
  15823. return self;
  15824. },
  15825. args: ["aBlock"],
  15826. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15827. referencedClasses: [],
  15828. messageSends: []
  15829. }),
  15830. $globals.TBehaviorDefaults);
  15831. $core.addMethod(
  15832. $core.method({
  15833. selector: "name",
  15834. protocol: "accessing",
  15835. fn: function (){
  15836. var self=this,$self=this;
  15837. return nil;
  15838. },
  15839. args: [],
  15840. source: "name\x0a\x09^ nil",
  15841. referencedClasses: [],
  15842. messageSends: []
  15843. }),
  15844. $globals.TBehaviorDefaults);
  15845. $core.addMethod(
  15846. $core.method({
  15847. selector: "printOn:",
  15848. protocol: "printing",
  15849. fn: function (aStream){
  15850. var self=this,$self=this;
  15851. return $core.withContext(function($ctx1) {
  15852. var $1,$receiver;
  15853. $1=$self._name();
  15854. if(($receiver = $1) == null || $receiver.a$nil){
  15855. (
  15856. $ctx1.supercall = true,
  15857. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15858. $ctx1.supercall = false;
  15859. } else {
  15860. var name;
  15861. name=$receiver;
  15862. $recv(aStream)._nextPutAll_(name);
  15863. }
  15864. return self;
  15865. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15866. },
  15867. args: ["aStream"],
  15868. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15869. referencedClasses: [],
  15870. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15871. }),
  15872. $globals.TBehaviorDefaults);
  15873. $core.addMethod(
  15874. $core.method({
  15875. selector: "superclass",
  15876. protocol: "accessing",
  15877. fn: function (){
  15878. var self=this,$self=this;
  15879. return nil;
  15880. },
  15881. args: [],
  15882. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15883. referencedClasses: [],
  15884. messageSends: []
  15885. }),
  15886. $globals.TBehaviorDefaults);
  15887. $core.addMethod(
  15888. $core.method({
  15889. selector: "traitUsers",
  15890. protocol: "accessing",
  15891. fn: function (){
  15892. var self=this,$self=this;
  15893. return [];
  15894. },
  15895. args: [],
  15896. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15897. referencedClasses: [],
  15898. messageSends: []
  15899. }),
  15900. $globals.TBehaviorDefaults);
  15901. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15902. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15903. $core.addMethod(
  15904. $core.method({
  15905. selector: ">>",
  15906. protocol: "accessing",
  15907. fn: function (aString){
  15908. var self=this,$self=this;
  15909. return $core.withContext(function($ctx1) {
  15910. return $self._methodAt_(aString);
  15911. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15912. },
  15913. args: ["aString"],
  15914. source: ">> aString\x0a\x09^ self methodAt: aString",
  15915. referencedClasses: [],
  15916. messageSends: ["methodAt:"]
  15917. }),
  15918. $globals.TBehaviorProvider);
  15919. $core.addMethod(
  15920. $core.method({
  15921. selector: "addCompiledMethod:",
  15922. protocol: "compiling",
  15923. fn: function (aMethod){
  15924. var self=this,$self=this;
  15925. var oldMethod,announcement;
  15926. return $core.withContext(function($ctx1) {
  15927. var $1,$2,$3,$4,$receiver;
  15928. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15929. return nil;
  15930. }));
  15931. $self._basicAddCompiledMethod_(aMethod);
  15932. $1=oldMethod;
  15933. if(($receiver = $1) == null || $receiver.a$nil){
  15934. $2=$recv($globals.MethodAdded)._new();
  15935. $ctx1.sendIdx["new"]=1;
  15936. $recv($2)._method_(aMethod);
  15937. $ctx1.sendIdx["method:"]=1;
  15938. $3=$recv($2)._yourself();
  15939. $ctx1.sendIdx["yourself"]=1;
  15940. announcement=$3;
  15941. } else {
  15942. $4=$recv($globals.MethodModified)._new();
  15943. $recv($4)._oldMethod_(oldMethod);
  15944. $recv($4)._method_(aMethod);
  15945. announcement=$recv($4)._yourself();
  15946. }
  15947. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15948. return self;
  15949. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15950. },
  15951. args: ["aMethod"],
  15952. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  15953. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  15954. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  15955. }),
  15956. $globals.TBehaviorProvider);
  15957. $core.addMethod(
  15958. $core.method({
  15959. selector: "basicAddCompiledMethod:",
  15960. protocol: "private",
  15961. fn: function (aMethod){
  15962. var self=this,$self=this;
  15963. return $core.withContext(function($ctx1) {
  15964. $core.addMethod(aMethod, self);
  15965. return self;
  15966. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15967. },
  15968. args: ["aMethod"],
  15969. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  15970. referencedClasses: [],
  15971. messageSends: []
  15972. }),
  15973. $globals.TBehaviorProvider);
  15974. $core.addMethod(
  15975. $core.method({
  15976. selector: "basicRemoveCompiledMethod:",
  15977. protocol: "private",
  15978. fn: function (aMethod){
  15979. var self=this,$self=this;
  15980. return $core.withContext(function($ctx1) {
  15981. $core.removeMethod(aMethod,self);
  15982. return self;
  15983. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15984. },
  15985. args: ["aMethod"],
  15986. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  15987. referencedClasses: [],
  15988. messageSends: []
  15989. }),
  15990. $globals.TBehaviorProvider);
  15991. $core.addMethod(
  15992. $core.method({
  15993. selector: "compile:protocol:",
  15994. protocol: "compiling",
  15995. fn: function (aString,anotherString){
  15996. var self=this,$self=this;
  15997. return $core.withContext(function($ctx1) {
  15998. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  15999. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16000. },
  16001. args: ["aString", "anotherString"],
  16002. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16003. referencedClasses: ["Compiler"],
  16004. messageSends: ["install:forClass:protocol:", "new"]
  16005. }),
  16006. $globals.TBehaviorProvider);
  16007. $core.addMethod(
  16008. $core.method({
  16009. selector: "includesSelector:",
  16010. protocol: "testing",
  16011. fn: function (aString){
  16012. var self=this,$self=this;
  16013. return $core.withContext(function($ctx1) {
  16014. return $recv($self._methodDictionary())._includesKey_(aString);
  16015. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16016. },
  16017. args: ["aString"],
  16018. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16019. referencedClasses: [],
  16020. messageSends: ["includesKey:", "methodDictionary"]
  16021. }),
  16022. $globals.TBehaviorProvider);
  16023. $core.addMethod(
  16024. $core.method({
  16025. selector: "methodAt:",
  16026. protocol: "accessing",
  16027. fn: function (aString){
  16028. var self=this,$self=this;
  16029. return $core.withContext(function($ctx1) {
  16030. return $recv($self._methodDictionary())._at_(aString);
  16031. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16032. },
  16033. args: ["aString"],
  16034. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16035. referencedClasses: [],
  16036. messageSends: ["at:", "methodDictionary"]
  16037. }),
  16038. $globals.TBehaviorProvider);
  16039. $core.addMethod(
  16040. $core.method({
  16041. selector: "methodDictionary",
  16042. protocol: "accessing",
  16043. fn: function (){
  16044. var self=this,$self=this;
  16045. return $core.withContext(function($ctx1) {
  16046. var dict = $globals.HashedCollection._new();
  16047. var methods = self.methods;
  16048. Object.keys(methods).forEach(function(i) {
  16049. if(methods[i].selector) {
  16050. dict._at_put_(methods[i].selector, methods[i]);
  16051. }
  16052. });
  16053. return dict;
  16054. return self;
  16055. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16056. },
  16057. args: [],
  16058. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  16059. referencedClasses: [],
  16060. messageSends: []
  16061. }),
  16062. $globals.TBehaviorProvider);
  16063. $core.addMethod(
  16064. $core.method({
  16065. selector: "methodOrganizationEnter:andLeave:",
  16066. protocol: "accessing",
  16067. fn: function (aMethod,oldMethod){
  16068. var self=this,$self=this;
  16069. return $core.withContext(function($ctx1) {
  16070. var $1,$2,$receiver;
  16071. if(($receiver = aMethod) == null || $receiver.a$nil){
  16072. aMethod;
  16073. } else {
  16074. $1=$self._organization();
  16075. $2=$recv(aMethod)._protocol();
  16076. $ctx1.sendIdx["protocol"]=1;
  16077. $recv($1)._addElement_($2);
  16078. }
  16079. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16080. oldMethod;
  16081. } else {
  16082. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16083. }
  16084. return self;
  16085. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16086. },
  16087. args: ["aMethod", "oldMethod"],
  16088. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16089. referencedClasses: [],
  16090. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16091. }),
  16092. $globals.TBehaviorProvider);
  16093. $core.addMethod(
  16094. $core.method({
  16095. selector: "methodTemplate",
  16096. protocol: "accessing",
  16097. fn: function (){
  16098. var self=this,$self=this;
  16099. return $core.withContext(function($ctx1) {
  16100. return $recv($globals.String)._streamContents_((function(stream){
  16101. return $core.withContext(function($ctx2) {
  16102. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16103. $ctx2.sendIdx["write:"]=1;
  16104. $recv(stream)._lf();
  16105. $ctx2.sendIdx["lf"]=1;
  16106. $recv(stream)._tab();
  16107. $ctx2.sendIdx["tab"]=1;
  16108. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16109. $ctx2.sendIdx["write:"]=2;
  16110. $recv(stream)._lf();
  16111. $ctx2.sendIdx["lf"]=2;
  16112. $recv(stream)._lf();
  16113. $ctx2.sendIdx["lf"]=3;
  16114. $recv(stream)._tab();
  16115. $ctx2.sendIdx["tab"]=2;
  16116. $recv(stream)._write_("| temporary variable names |");
  16117. $ctx2.sendIdx["write:"]=3;
  16118. $recv(stream)._lf();
  16119. $recv(stream)._tab();
  16120. return $recv(stream)._write_("statements");
  16121. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16122. }));
  16123. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16124. },
  16125. args: [],
  16126. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  16127. referencedClasses: ["String"],
  16128. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16129. }),
  16130. $globals.TBehaviorProvider);
  16131. $core.addMethod(
  16132. $core.method({
  16133. selector: "methods",
  16134. protocol: "accessing",
  16135. fn: function (){
  16136. var self=this,$self=this;
  16137. return $core.withContext(function($ctx1) {
  16138. return $recv($self._methodDictionary())._values();
  16139. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16140. },
  16141. args: [],
  16142. source: "methods\x0a\x09^ self methodDictionary values",
  16143. referencedClasses: [],
  16144. messageSends: ["values", "methodDictionary"]
  16145. }),
  16146. $globals.TBehaviorProvider);
  16147. $core.addMethod(
  16148. $core.method({
  16149. selector: "methodsInProtocol:",
  16150. protocol: "accessing",
  16151. fn: function (aString){
  16152. var self=this,$self=this;
  16153. return $core.withContext(function($ctx1) {
  16154. return $recv($self._methods())._select_((function(each){
  16155. return $core.withContext(function($ctx2) {
  16156. return $recv($recv(each)._protocol()).__eq(aString);
  16157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16158. }));
  16159. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16160. },
  16161. args: ["aString"],
  16162. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16163. referencedClasses: [],
  16164. messageSends: ["select:", "methods", "=", "protocol"]
  16165. }),
  16166. $globals.TBehaviorProvider);
  16167. $core.addMethod(
  16168. $core.method({
  16169. selector: "organization",
  16170. protocol: "accessing",
  16171. fn: function (){
  16172. var self=this,$self=this;
  16173. return $core.withContext(function($ctx1) {
  16174. var $1,$receiver;
  16175. $1=$self._basicOrganization();
  16176. $ctx1.sendIdx["basicOrganization"]=1;
  16177. if(($receiver = $1) == null || $receiver.a$nil){
  16178. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16179. return $self._basicOrganization();
  16180. } else {
  16181. return $1;
  16182. }
  16183. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16184. },
  16185. args: [],
  16186. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16187. referencedClasses: ["ClassOrganizer"],
  16188. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16189. }),
  16190. $globals.TBehaviorProvider);
  16191. $core.addMethod(
  16192. $core.method({
  16193. selector: "ownMethods",
  16194. protocol: "accessing",
  16195. fn: function (){
  16196. var self=this,$self=this;
  16197. return $core.withContext(function($ctx1) {
  16198. var $1;
  16199. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16200. return $core.withContext(function($ctx2) {
  16201. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16202. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16203. })))._sorted_((function(a,b){
  16204. return $core.withContext(function($ctx2) {
  16205. $1=$recv(a)._selector();
  16206. $ctx2.sendIdx["selector"]=1;
  16207. return $recv($1).__lt_eq($recv(b)._selector());
  16208. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16209. }));
  16210. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16211. },
  16212. args: [],
  16213. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  16214. referencedClasses: ["OrderedCollection"],
  16215. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16216. }),
  16217. $globals.TBehaviorProvider);
  16218. $core.addMethod(
  16219. $core.method({
  16220. selector: "ownMethodsInProtocol:",
  16221. protocol: "accessing",
  16222. fn: function (aString){
  16223. var self=this,$self=this;
  16224. return $core.withContext(function($ctx1) {
  16225. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16226. return $core.withContext(function($ctx2) {
  16227. return $recv($recv(each)._methodClass()).__eq(self);
  16228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16229. }));
  16230. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16231. },
  16232. args: ["aString"],
  16233. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16234. referencedClasses: [],
  16235. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16236. }),
  16237. $globals.TBehaviorProvider);
  16238. $core.addMethod(
  16239. $core.method({
  16240. selector: "ownProtocols",
  16241. protocol: "accessing",
  16242. fn: function (){
  16243. var self=this,$self=this;
  16244. return $core.withContext(function($ctx1) {
  16245. return $recv($self._protocols())._reject_((function(each){
  16246. return $core.withContext(function($ctx2) {
  16247. return $recv(each)._match_("^\x5c*");
  16248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16249. }));
  16250. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16251. },
  16252. args: [],
  16253. 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*' ]",
  16254. referencedClasses: [],
  16255. messageSends: ["reject:", "protocols", "match:"]
  16256. }),
  16257. $globals.TBehaviorProvider);
  16258. $core.addMethod(
  16259. $core.method({
  16260. selector: "packageOfProtocol:",
  16261. protocol: "accessing",
  16262. fn: function (aString){
  16263. var self=this,$self=this;
  16264. return $core.withContext(function($ctx1) {
  16265. var $1;
  16266. $1=$recv(aString)._beginsWith_("*");
  16267. if(!$core.assert($1)){
  16268. return $self._package();
  16269. }
  16270. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16271. return nil;
  16272. }));
  16273. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16274. },
  16275. args: ["aString"],
  16276. 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 ]",
  16277. referencedClasses: ["Package"],
  16278. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16279. }),
  16280. $globals.TBehaviorProvider);
  16281. $core.addMethod(
  16282. $core.method({
  16283. selector: "protocols",
  16284. protocol: "accessing",
  16285. fn: function (){
  16286. var self=this,$self=this;
  16287. return $core.withContext(function($ctx1) {
  16288. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16289. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16290. },
  16291. args: [],
  16292. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16293. referencedClasses: [],
  16294. messageSends: ["sorted", "asArray", "elements", "organization"]
  16295. }),
  16296. $globals.TBehaviorProvider);
  16297. $core.addMethod(
  16298. $core.method({
  16299. selector: "protocolsDo:",
  16300. protocol: "enumerating",
  16301. fn: function (aBlock){
  16302. var self=this,$self=this;
  16303. var methodsByProtocol;
  16304. return $core.withContext(function($ctx1) {
  16305. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16306. $ctx1.sendIdx["new"]=1;
  16307. $recv($self._methodDictionary())._valuesDo_((function(m){
  16308. return $core.withContext(function($ctx2) {
  16309. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16310. return $core.withContext(function($ctx3) {
  16311. return $recv($globals.Array)._new();
  16312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16313. })))._add_(m);
  16314. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16315. }));
  16316. $recv($self._protocols())._do_((function(protocol){
  16317. return $core.withContext(function($ctx2) {
  16318. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16319. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16320. }));
  16321. return self;
  16322. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16323. },
  16324. args: ["aBlock"],
  16325. 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) ]",
  16326. referencedClasses: ["HashedCollection", "Array"],
  16327. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16328. }),
  16329. $globals.TBehaviorProvider);
  16330. $core.addMethod(
  16331. $core.method({
  16332. selector: "recompile",
  16333. protocol: "compiling",
  16334. fn: function (){
  16335. var self=this,$self=this;
  16336. return $core.withContext(function($ctx1) {
  16337. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16338. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16339. },
  16340. args: [],
  16341. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16342. referencedClasses: ["Compiler"],
  16343. messageSends: ["recompile:", "new"]
  16344. }),
  16345. $globals.TBehaviorProvider);
  16346. $core.addMethod(
  16347. $core.method({
  16348. selector: "removeCompiledMethod:",
  16349. protocol: "compiling",
  16350. fn: function (aMethod){
  16351. var self=this,$self=this;
  16352. return $core.withContext(function($ctx1) {
  16353. var $1,$3,$2;
  16354. $self._basicRemoveCompiledMethod_(aMethod);
  16355. $1=$recv($globals.SystemAnnouncer)._current();
  16356. $3=$recv($globals.MethodRemoved)._new();
  16357. $recv($3)._method_(aMethod);
  16358. $2=$recv($3)._yourself();
  16359. $recv($1)._announce_($2);
  16360. return self;
  16361. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16362. },
  16363. args: ["aMethod"],
  16364. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16365. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16366. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16367. }),
  16368. $globals.TBehaviorProvider);
  16369. $core.addMethod(
  16370. $core.method({
  16371. selector: "removeProtocolIfEmpty:",
  16372. protocol: "accessing",
  16373. fn: function (aString){
  16374. var self=this,$self=this;
  16375. return $core.withContext(function($ctx1) {
  16376. $recv($self._methods())._detect_ifNone_((function(each){
  16377. return $core.withContext(function($ctx2) {
  16378. return $recv($recv(each)._protocol()).__eq(aString);
  16379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16380. }),(function(){
  16381. return $core.withContext(function($ctx2) {
  16382. return $recv($self._organization())._removeElement_(aString);
  16383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16384. }));
  16385. return self;
  16386. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16387. },
  16388. args: ["aString"],
  16389. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16390. referencedClasses: [],
  16391. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16392. }),
  16393. $globals.TBehaviorProvider);
  16394. $core.addMethod(
  16395. $core.method({
  16396. selector: "selectors",
  16397. protocol: "accessing",
  16398. fn: function (){
  16399. var self=this,$self=this;
  16400. return $core.withContext(function($ctx1) {
  16401. return $recv($self._methodDictionary())._keys();
  16402. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16403. },
  16404. args: [],
  16405. source: "selectors\x0a\x09^ self methodDictionary keys",
  16406. referencedClasses: [],
  16407. messageSends: ["keys", "methodDictionary"]
  16408. }),
  16409. $globals.TBehaviorProvider);
  16410. $core.addMethod(
  16411. $core.method({
  16412. selector: "setTraitComposition:",
  16413. protocol: "compiling",
  16414. fn: function (aTraitComposition){
  16415. var self=this,$self=this;
  16416. return $core.withContext(function($ctx1) {
  16417. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16418. return self;
  16419. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16420. },
  16421. args: ["aTraitComposition"],
  16422. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16423. referencedClasses: [],
  16424. messageSends: []
  16425. }),
  16426. $globals.TBehaviorProvider);
  16427. $core.addMethod(
  16428. $core.method({
  16429. selector: "traitComposition",
  16430. protocol: "accessing",
  16431. fn: function (){
  16432. var self=this,$self=this;
  16433. return $core.withContext(function($ctx1) {
  16434. var $1,$receiver;
  16435. $1=$self._basicAt_("traitComposition");
  16436. if(($receiver = $1) == null || $receiver.a$nil){
  16437. return [];
  16438. } else {
  16439. var aCollection;
  16440. aCollection=$receiver;
  16441. return $recv(aCollection)._collect_((function(each){
  16442. return $core.withContext(function($ctx2) {
  16443. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16445. }));
  16446. }
  16447. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16448. },
  16449. args: [],
  16450. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16451. referencedClasses: ["TraitTransformation"],
  16452. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16453. }),
  16454. $globals.TBehaviorProvider);
  16455. $core.addMethod(
  16456. $core.method({
  16457. selector: "traitCompositionDefinition",
  16458. protocol: "accessing",
  16459. fn: function (){
  16460. var self=this,$self=this;
  16461. return $core.withContext(function($ctx1) {
  16462. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16463. return $core.withContext(function($ctx2) {
  16464. return $recv($globals.String)._streamContents_((function(str){
  16465. return $core.withContext(function($ctx3) {
  16466. $recv(str)._write_("{");
  16467. $ctx3.sendIdx["write:"]=1;
  16468. $recv(traitComposition)._do_separatedBy_((function(each){
  16469. return $core.withContext(function($ctx4) {
  16470. return $recv(str)._write_($recv(each)._definition());
  16471. $ctx4.sendIdx["write:"]=2;
  16472. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16473. }),(function(){
  16474. return $core.withContext(function($ctx4) {
  16475. return $recv(str)._write_(". ");
  16476. $ctx4.sendIdx["write:"]=3;
  16477. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16478. }));
  16479. return $recv(str)._write_("}");
  16480. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16481. }));
  16482. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16483. }));
  16484. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16485. },
  16486. args: [],
  16487. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  16488. referencedClasses: ["String"],
  16489. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16490. }),
  16491. $globals.TBehaviorProvider);
  16492. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16493. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  16494. $core.addMethod(
  16495. $core.method({
  16496. selector: "asJavaScriptSource",
  16497. protocol: "converting",
  16498. fn: function (){
  16499. var self=this,$self=this;
  16500. return $core.withContext(function($ctx1) {
  16501. return "$globals.".__comma($self._name());
  16502. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16503. },
  16504. args: [],
  16505. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16506. referencedClasses: [],
  16507. messageSends: [",", "name"]
  16508. }),
  16509. $globals.TMasterBehavior);
  16510. $core.addMethod(
  16511. $core.method({
  16512. selector: "browse",
  16513. protocol: "browsing",
  16514. fn: function (){
  16515. var self=this,$self=this;
  16516. return $core.withContext(function($ctx1) {
  16517. $recv($globals.Finder)._findClass_(self);
  16518. return self;
  16519. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16520. },
  16521. args: [],
  16522. source: "browse\x0a\x09Finder findClass: self",
  16523. referencedClasses: ["Finder"],
  16524. messageSends: ["findClass:"]
  16525. }),
  16526. $globals.TMasterBehavior);
  16527. $core.addMethod(
  16528. $core.method({
  16529. selector: "category",
  16530. protocol: "accessing",
  16531. fn: function (){
  16532. var self=this,$self=this;
  16533. return $core.withContext(function($ctx1) {
  16534. var $1,$receiver;
  16535. $1=$self._package();
  16536. $ctx1.sendIdx["package"]=1;
  16537. if(($receiver = $1) == null || $receiver.a$nil){
  16538. return "Unclassified";
  16539. } else {
  16540. return $recv($self._package())._name();
  16541. }
  16542. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16543. },
  16544. args: [],
  16545. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16546. referencedClasses: [],
  16547. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16548. }),
  16549. $globals.TMasterBehavior);
  16550. $core.addMethod(
  16551. $core.method({
  16552. selector: "classTag",
  16553. protocol: "accessing",
  16554. fn: function (){
  16555. var self=this,$self=this;
  16556. return $core.withContext(function($ctx1) {
  16557. return $self._subclassResponsibility();
  16558. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16559. },
  16560. args: [],
  16561. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16562. referencedClasses: [],
  16563. messageSends: ["subclassResponsibility"]
  16564. }),
  16565. $globals.TMasterBehavior);
  16566. $core.addMethod(
  16567. $core.method({
  16568. selector: "comment",
  16569. protocol: "accessing",
  16570. fn: function (){
  16571. var self=this,$self=this;
  16572. return $core.withContext(function($ctx1) {
  16573. var $1,$receiver;
  16574. $1=$self._basicAt_("comment");
  16575. if(($receiver = $1) == null || $receiver.a$nil){
  16576. return "";
  16577. } else {
  16578. return $1;
  16579. }
  16580. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16581. },
  16582. args: [],
  16583. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16584. referencedClasses: [],
  16585. messageSends: ["ifNil:", "basicAt:"]
  16586. }),
  16587. $globals.TMasterBehavior);
  16588. $core.addMethod(
  16589. $core.method({
  16590. selector: "comment:",
  16591. protocol: "accessing",
  16592. fn: function (aString){
  16593. var self=this,$self=this;
  16594. return $core.withContext(function($ctx1) {
  16595. var $1,$3,$2;
  16596. $self._basicAt_put_("comment",aString);
  16597. $1=$recv($globals.SystemAnnouncer)._current();
  16598. $3=$recv($globals.ClassCommentChanged)._new();
  16599. $recv($3)._theClass_(self);
  16600. $2=$recv($3)._yourself();
  16601. $recv($1)._announce_($2);
  16602. return self;
  16603. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16604. },
  16605. args: ["aString"],
  16606. 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)",
  16607. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16608. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16609. }),
  16610. $globals.TMasterBehavior);
  16611. $core.addMethod(
  16612. $core.method({
  16613. selector: "definedMethods",
  16614. protocol: "accessing",
  16615. fn: function (){
  16616. var self=this,$self=this;
  16617. var methods;
  16618. return $core.withContext(function($ctx1) {
  16619. var $1,$receiver;
  16620. methods=$self._methods();
  16621. $ctx1.sendIdx["methods"]=1;
  16622. $1=$self._theMetaClass();
  16623. if(($receiver = $1) == null || $receiver.a$nil){
  16624. return methods;
  16625. } else {
  16626. var meta;
  16627. meta=$receiver;
  16628. return $recv(methods).__comma($recv(meta)._methods());
  16629. }
  16630. return self;
  16631. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16632. },
  16633. args: [],
  16634. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16635. referencedClasses: [],
  16636. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16637. }),
  16638. $globals.TMasterBehavior);
  16639. $core.addMethod(
  16640. $core.method({
  16641. selector: "enterOrganization",
  16642. protocol: "accessing",
  16643. fn: function (){
  16644. var self=this,$self=this;
  16645. return $core.withContext(function($ctx1) {
  16646. var $1,$receiver;
  16647. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16648. $globals.Smalltalk;
  16649. } else {
  16650. $1=$self._basicAt_("category");
  16651. if(($receiver = $1) == null || $receiver.a$nil){
  16652. $self._basicPackage_(nil);
  16653. $ctx1.sendIdx["basicPackage:"]=1;
  16654. } else {
  16655. var category;
  16656. category=$receiver;
  16657. $self._basicPackage_($recv($globals.Package)._named_(category));
  16658. $recv($recv($self._package())._organization())._addElement_(self);
  16659. }
  16660. }
  16661. return self;
  16662. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16663. },
  16664. args: [],
  16665. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16666. referencedClasses: ["Smalltalk", "Package"],
  16667. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16668. }),
  16669. $globals.TMasterBehavior);
  16670. $core.addMethod(
  16671. $core.method({
  16672. selector: "leaveOrganization",
  16673. protocol: "accessing",
  16674. fn: function (){
  16675. var self=this,$self=this;
  16676. return $core.withContext(function($ctx1) {
  16677. var $receiver;
  16678. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16679. $globals.Smalltalk;
  16680. } else {
  16681. $recv($recv($self._package())._organization())._removeElement_(self);
  16682. }
  16683. return self;
  16684. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16685. },
  16686. args: [],
  16687. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16688. referencedClasses: ["Smalltalk"],
  16689. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16690. }),
  16691. $globals.TMasterBehavior);
  16692. $core.addMethod(
  16693. $core.method({
  16694. selector: "name",
  16695. protocol: "accessing",
  16696. fn: function (){
  16697. var self=this,$self=this;
  16698. return $core.withContext(function($ctx1) {
  16699. return self.name;
  16700. return self;
  16701. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16702. },
  16703. args: [],
  16704. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16705. referencedClasses: [],
  16706. messageSends: []
  16707. }),
  16708. $globals.TMasterBehavior);
  16709. $core.addMethod(
  16710. $core.method({
  16711. selector: "package:",
  16712. protocol: "accessing",
  16713. fn: function (aPackage){
  16714. var self=this,$self=this;
  16715. var oldPackage;
  16716. return $core.withContext(function($ctx1) {
  16717. var $2,$1,$3,$5,$4;
  16718. $2=$self._package();
  16719. $ctx1.sendIdx["package"]=1;
  16720. $1=$recv($2).__eq(aPackage);
  16721. if($core.assert($1)){
  16722. return self;
  16723. }
  16724. oldPackage=$self._package();
  16725. $self._leaveOrganization();
  16726. $self._basicAt_put_("category",$recv(aPackage)._name());
  16727. $self._enterOrganization();
  16728. $3=$recv($globals.SystemAnnouncer)._current();
  16729. $5=$recv($globals.ClassMoved)._new();
  16730. $recv($5)._theClass_(self);
  16731. $recv($5)._oldPackage_(oldPackage);
  16732. $4=$recv($5)._yourself();
  16733. $recv($3)._announce_($4);
  16734. return self;
  16735. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16736. },
  16737. args: ["aPackage"],
  16738. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16739. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16740. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16741. }),
  16742. $globals.TMasterBehavior);
  16743. $core.addMethod(
  16744. $core.method({
  16745. selector: "theNonMetaClass",
  16746. protocol: "accessing",
  16747. fn: function (){
  16748. var self=this,$self=this;
  16749. return self;
  16750. },
  16751. args: [],
  16752. source: "theNonMetaClass\x0a\x09^ self",
  16753. referencedClasses: [],
  16754. messageSends: []
  16755. }),
  16756. $globals.TMasterBehavior);
  16757. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16758. $core.addMethod(
  16759. $core.method({
  16760. selector: "-",
  16761. protocol: "composition",
  16762. fn: function (anArray){
  16763. var self=this,$self=this;
  16764. return $core.withContext(function($ctx1) {
  16765. return $recv($self._asTraitTransformation()).__minus(anArray);
  16766. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16767. },
  16768. args: ["anArray"],
  16769. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16770. referencedClasses: [],
  16771. messageSends: ["-", "asTraitTransformation"]
  16772. }),
  16773. $globals.Trait);
  16774. $core.addMethod(
  16775. $core.method({
  16776. selector: "@",
  16777. protocol: "composition",
  16778. fn: function (anArrayOfAssociations){
  16779. var self=this,$self=this;
  16780. return $core.withContext(function($ctx1) {
  16781. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16782. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16783. },
  16784. args: ["anArrayOfAssociations"],
  16785. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16786. referencedClasses: [],
  16787. messageSends: ["@", "asTraitTransformation"]
  16788. }),
  16789. $globals.Trait);
  16790. $core.addMethod(
  16791. $core.method({
  16792. selector: "asTraitComposition",
  16793. protocol: "converting",
  16794. fn: function (){
  16795. var self=this,$self=this;
  16796. return $core.withContext(function($ctx1) {
  16797. return $recv($self._asTraitTransformation())._asTraitComposition();
  16798. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16799. },
  16800. args: [],
  16801. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16802. referencedClasses: [],
  16803. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16804. }),
  16805. $globals.Trait);
  16806. $core.addMethod(
  16807. $core.method({
  16808. selector: "asTraitTransformation",
  16809. protocol: "converting",
  16810. fn: function (){
  16811. var self=this,$self=this;
  16812. return $core.withContext(function($ctx1) {
  16813. return $recv($globals.TraitTransformation)._on_(self);
  16814. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16815. },
  16816. args: [],
  16817. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16818. referencedClasses: ["TraitTransformation"],
  16819. messageSends: ["on:"]
  16820. }),
  16821. $globals.Trait);
  16822. $core.addMethod(
  16823. $core.method({
  16824. selector: "basicOrganization",
  16825. protocol: "accessing",
  16826. fn: function (){
  16827. var self=this,$self=this;
  16828. return $self["@organization"];
  16829. },
  16830. args: [],
  16831. source: "basicOrganization\x0a\x09^ organization",
  16832. referencedClasses: [],
  16833. messageSends: []
  16834. }),
  16835. $globals.Trait);
  16836. $core.addMethod(
  16837. $core.method({
  16838. selector: "basicOrganization:",
  16839. protocol: "accessing",
  16840. fn: function (aClassOrganizer){
  16841. var self=this,$self=this;
  16842. $self["@organization"]=aClassOrganizer;
  16843. return self;
  16844. },
  16845. args: ["aClassOrganizer"],
  16846. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16847. referencedClasses: [],
  16848. messageSends: []
  16849. }),
  16850. $globals.Trait);
  16851. $core.addMethod(
  16852. $core.method({
  16853. selector: "basicPackage:",
  16854. protocol: "accessing",
  16855. fn: function (aPackage){
  16856. var self=this,$self=this;
  16857. $self["@package"]=aPackage;
  16858. return self;
  16859. },
  16860. args: ["aPackage"],
  16861. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16862. referencedClasses: [],
  16863. messageSends: []
  16864. }),
  16865. $globals.Trait);
  16866. $core.addMethod(
  16867. $core.method({
  16868. selector: "classTag",
  16869. protocol: "accessing",
  16870. fn: function (){
  16871. var self=this,$self=this;
  16872. return "trait";
  16873. },
  16874. args: [],
  16875. source: "classTag\x0a\x09^ 'trait'",
  16876. referencedClasses: [],
  16877. messageSends: []
  16878. }),
  16879. $globals.Trait);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "definition",
  16883. protocol: "accessing",
  16884. fn: function (){
  16885. var self=this,$self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. var $1;
  16888. return $recv($globals.String)._streamContents_((function(stream){
  16889. return $core.withContext(function($ctx2) {
  16890. $recv(stream)._write_("Trait named: ");
  16891. $ctx2.sendIdx["write:"]=1;
  16892. $recv(stream)._printSymbol_($self._name());
  16893. $recv(stream)._lf();
  16894. $ctx2.sendIdx["lf"]=1;
  16895. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16896. return $core.withContext(function($ctx3) {
  16897. $1=$recv($globals.String)._tab();
  16898. $ctx3.sendIdx["tab"]=1;
  16899. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16900. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16901. })));
  16902. $ctx2.sendIdx["write:"]=2;
  16903. $recv(stream)._tab();
  16904. $recv(stream)._write_("package: ");
  16905. return $recv(stream)._print_($self._category());
  16906. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16907. }));
  16908. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16909. },
  16910. args: [],
  16911. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  16912. referencedClasses: ["String"],
  16913. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16914. }),
  16915. $globals.Trait);
  16916. $core.addMethod(
  16917. $core.method({
  16918. selector: "package",
  16919. protocol: "accessing",
  16920. fn: function (){
  16921. var self=this,$self=this;
  16922. return $self["@package"];
  16923. },
  16924. args: [],
  16925. source: "package\x0a\x09^ package",
  16926. referencedClasses: [],
  16927. messageSends: []
  16928. }),
  16929. $globals.Trait);
  16930. $core.addMethod(
  16931. $core.method({
  16932. selector: "theMetaClass",
  16933. protocol: "accessing",
  16934. fn: function (){
  16935. var self=this,$self=this;
  16936. return nil;
  16937. },
  16938. args: [],
  16939. source: "theMetaClass\x0a\x09^ nil",
  16940. referencedClasses: [],
  16941. messageSends: []
  16942. }),
  16943. $globals.Trait);
  16944. $core.addMethod(
  16945. $core.method({
  16946. selector: "traitUsers",
  16947. protocol: "accessing",
  16948. fn: function (){
  16949. var self=this,$self=this;
  16950. return $core.withContext(function($ctx1) {
  16951. return $recv($self._basicAt_("traitUsers"))._copy();
  16952. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  16953. },
  16954. args: [],
  16955. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  16956. referencedClasses: [],
  16957. messageSends: ["copy", "basicAt:"]
  16958. }),
  16959. $globals.Trait);
  16960. $core.addMethod(
  16961. $core.method({
  16962. selector: "named:package:",
  16963. protocol: "instance creation",
  16964. fn: function (aString,anotherString){
  16965. var self=this,$self=this;
  16966. return $core.withContext(function($ctx1) {
  16967. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  16968. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  16969. },
  16970. args: ["aString", "anotherString"],
  16971. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  16972. referencedClasses: ["ClassBuilder"],
  16973. messageSends: ["addTraitNamed:package:", "new"]
  16974. }),
  16975. $globals.Trait.a$cls);
  16976. $core.addMethod(
  16977. $core.method({
  16978. selector: "named:uses:package:",
  16979. protocol: "instance creation",
  16980. fn: function (aString,aTraitCompositionDescription,anotherString){
  16981. var self=this,$self=this;
  16982. var trait;
  16983. return $core.withContext(function($ctx1) {
  16984. trait=$self._named_package_(aString,anotherString);
  16985. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16986. return trait;
  16987. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  16988. },
  16989. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16990. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  16991. referencedClasses: [],
  16992. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  16993. }),
  16994. $globals.Trait.a$cls);
  16995. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16996. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  16997. $core.addMethod(
  16998. $core.method({
  16999. selector: "-",
  17000. protocol: "composition",
  17001. fn: function (anArray){
  17002. var self=this,$self=this;
  17003. return $core.withContext(function($ctx1) {
  17004. var $1;
  17005. $1=$self._copy();
  17006. $recv($1)._addExclusions_(anArray);
  17007. return $recv($1)._yourself();
  17008. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17009. },
  17010. args: ["anArray"],
  17011. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17012. referencedClasses: [],
  17013. messageSends: ["addExclusions:", "copy", "yourself"]
  17014. }),
  17015. $globals.TraitTransformation);
  17016. $core.addMethod(
  17017. $core.method({
  17018. selector: "@",
  17019. protocol: "composition",
  17020. fn: function (anArrayOfAssociations){
  17021. var self=this,$self=this;
  17022. return $core.withContext(function($ctx1) {
  17023. var $1;
  17024. $1=$self._copy();
  17025. $recv($1)._addAliases_(anArrayOfAssociations);
  17026. return $recv($1)._yourself();
  17027. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17028. },
  17029. args: ["anArrayOfAssociations"],
  17030. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17031. referencedClasses: [],
  17032. messageSends: ["addAliases:", "copy", "yourself"]
  17033. }),
  17034. $globals.TraitTransformation);
  17035. $core.addMethod(
  17036. $core.method({
  17037. selector: "addAliases:",
  17038. protocol: "accessing",
  17039. fn: function (anArrayOfAssociations){
  17040. var self=this,$self=this;
  17041. return $core.withContext(function($ctx1) {
  17042. $recv(anArrayOfAssociations)._do_((function(each){
  17043. var key;
  17044. return $core.withContext(function($ctx2) {
  17045. key=$recv(each)._key();
  17046. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17047. return $core.withContext(function($ctx3) {
  17048. return $self._error_("Cannot use same alias name twice.");
  17049. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17050. }),(function(){
  17051. return $core.withContext(function($ctx3) {
  17052. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17053. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17054. }));
  17055. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17056. }));
  17057. return anArrayOfAssociations;
  17058. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17059. },
  17060. args: ["anArrayOfAssociations"],
  17061. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  17062. referencedClasses: [],
  17063. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17064. }),
  17065. $globals.TraitTransformation);
  17066. $core.addMethod(
  17067. $core.method({
  17068. selector: "addExclusions:",
  17069. protocol: "accessing",
  17070. fn: function (anArray){
  17071. var self=this,$self=this;
  17072. return $core.withContext(function($ctx1) {
  17073. $recv($self["@exclusions"])._addAll_(anArray);
  17074. return anArray;
  17075. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17076. },
  17077. args: ["anArray"],
  17078. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17079. referencedClasses: [],
  17080. messageSends: ["addAll:"]
  17081. }),
  17082. $globals.TraitTransformation);
  17083. $core.addMethod(
  17084. $core.method({
  17085. selector: "aliases",
  17086. protocol: "accessing",
  17087. fn: function (){
  17088. var self=this,$self=this;
  17089. return $self["@aliases"];
  17090. },
  17091. args: [],
  17092. source: "aliases\x0a\x09^ aliases",
  17093. referencedClasses: [],
  17094. messageSends: []
  17095. }),
  17096. $globals.TraitTransformation);
  17097. $core.addMethod(
  17098. $core.method({
  17099. selector: "asJavaScriptObject",
  17100. protocol: "converting",
  17101. fn: function (){
  17102. var self=this,$self=this;
  17103. return $core.withContext(function($ctx1) {
  17104. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17105. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17106. },
  17107. args: [],
  17108. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17109. referencedClasses: [],
  17110. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17111. }),
  17112. $globals.TraitTransformation);
  17113. $core.addMethod(
  17114. $core.method({
  17115. selector: "asJavaScriptSource",
  17116. protocol: "converting",
  17117. fn: function (){
  17118. var self=this,$self=this;
  17119. return $core.withContext(function($ctx1) {
  17120. var $2,$3,$1;
  17121. return $recv($globals.String)._streamContents_((function(str){
  17122. return $core.withContext(function($ctx2) {
  17123. $2=$recv($self._trait())._asJavaScriptSource();
  17124. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17125. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17126. return $core.withContext(function($ctx3) {
  17127. return [", aliases: ",$recv(al)._asJSONString()];
  17128. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17129. }));
  17130. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17131. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17132. return $core.withContext(function($ctx3) {
  17133. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17134. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17135. })),"}"];
  17136. return $recv(str)._write_($1);
  17137. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17138. }));
  17139. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17140. },
  17141. args: [],
  17142. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  17143. referencedClasses: ["String"],
  17144. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17145. }),
  17146. $globals.TraitTransformation);
  17147. $core.addMethod(
  17148. $core.method({
  17149. selector: "asTraitComposition",
  17150. protocol: "converting",
  17151. fn: function (){
  17152. var self=this,$self=this;
  17153. return [self];
  17154. },
  17155. args: [],
  17156. source: "asTraitComposition\x0a\x09^ { self }",
  17157. referencedClasses: [],
  17158. messageSends: []
  17159. }),
  17160. $globals.TraitTransformation);
  17161. $core.addMethod(
  17162. $core.method({
  17163. selector: "asTraitTransformation",
  17164. protocol: "converting",
  17165. fn: function (){
  17166. var self=this,$self=this;
  17167. return self;
  17168. },
  17169. args: [],
  17170. source: "asTraitTransformation\x0a\x09^ self",
  17171. referencedClasses: [],
  17172. messageSends: []
  17173. }),
  17174. $globals.TraitTransformation);
  17175. $core.addMethod(
  17176. $core.method({
  17177. selector: "definition",
  17178. protocol: "accessing",
  17179. fn: function (){
  17180. var self=this,$self=this;
  17181. return $core.withContext(function($ctx1) {
  17182. return $recv($globals.String)._streamContents_((function(str){
  17183. return $core.withContext(function($ctx2) {
  17184. $recv(str)._print_($self._trait());
  17185. $recv($self._aliases())._ifNotEmpty_((function(al){
  17186. return $core.withContext(function($ctx3) {
  17187. $recv(str)._write_(" @ {");
  17188. $ctx3.sendIdx["write:"]=1;
  17189. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17190. return $core.withContext(function($ctx4) {
  17191. $recv(str)._printSymbol_($recv(each)._key());
  17192. $ctx4.sendIdx["printSymbol:"]=1;
  17193. $recv(str)._write_(" -> ");
  17194. $ctx4.sendIdx["write:"]=2;
  17195. return $recv(str)._printSymbol_($recv(each)._value());
  17196. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17197. }),(function(){
  17198. return $core.withContext(function($ctx4) {
  17199. return $recv(str)._write_(". ");
  17200. $ctx4.sendIdx["write:"]=3;
  17201. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17202. }));
  17203. $ctx3.sendIdx["do:separatedBy:"]=1;
  17204. return $recv(str)._write_("}");
  17205. $ctx3.sendIdx["write:"]=4;
  17206. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17207. }));
  17208. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17209. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17210. return $core.withContext(function($ctx3) {
  17211. $recv(str)._write_(" - #(");
  17212. $ctx3.sendIdx["write:"]=5;
  17213. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17214. return $core.withContext(function($ctx4) {
  17215. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17216. $ctx4.sendIdx["write:"]=6;
  17217. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17218. }),(function(){
  17219. return $core.withContext(function($ctx4) {
  17220. return $recv(str)._space();
  17221. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17222. }));
  17223. return $recv(str)._write_(")");
  17224. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17225. }));
  17226. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17227. }));
  17228. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17229. },
  17230. args: [],
  17231. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  17232. referencedClasses: ["String"],
  17233. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17234. }),
  17235. $globals.TraitTransformation);
  17236. $core.addMethod(
  17237. $core.method({
  17238. selector: "exclusions",
  17239. protocol: "accessing",
  17240. fn: function (){
  17241. var self=this,$self=this;
  17242. return $self["@exclusions"];
  17243. },
  17244. args: [],
  17245. source: "exclusions\x0a\x09^ exclusions",
  17246. referencedClasses: [],
  17247. messageSends: []
  17248. }),
  17249. $globals.TraitTransformation);
  17250. $core.addMethod(
  17251. $core.method({
  17252. selector: "initialize",
  17253. protocol: "initialization",
  17254. fn: function (){
  17255. var self=this,$self=this;
  17256. return $core.withContext(function($ctx1) {
  17257. (
  17258. $ctx1.supercall = true,
  17259. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17260. $ctx1.supercall = false;
  17261. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17262. $self["@exclusions"]=$recv($globals.Set)._new();
  17263. $self["@trait"]=nil;
  17264. return self;
  17265. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17266. },
  17267. args: [],
  17268. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17269. referencedClasses: ["Set"],
  17270. messageSends: ["initialize", "new"]
  17271. }),
  17272. $globals.TraitTransformation);
  17273. $core.addMethod(
  17274. $core.method({
  17275. selector: "postCopy",
  17276. protocol: "copying",
  17277. fn: function (){
  17278. var self=this,$self=this;
  17279. return $core.withContext(function($ctx1) {
  17280. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17281. $ctx1.sendIdx["copy"]=1;
  17282. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17283. return self;
  17284. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17285. },
  17286. args: [],
  17287. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17288. referencedClasses: [],
  17289. messageSends: ["copy"]
  17290. }),
  17291. $globals.TraitTransformation);
  17292. $core.addMethod(
  17293. $core.method({
  17294. selector: "trait",
  17295. protocol: "accessing",
  17296. fn: function (){
  17297. var self=this,$self=this;
  17298. return $self["@trait"];
  17299. },
  17300. args: [],
  17301. source: "trait\x0a\x09^ trait",
  17302. referencedClasses: [],
  17303. messageSends: []
  17304. }),
  17305. $globals.TraitTransformation);
  17306. $core.addMethod(
  17307. $core.method({
  17308. selector: "trait:",
  17309. protocol: "accessing",
  17310. fn: function (anObject){
  17311. var self=this,$self=this;
  17312. $self["@trait"]=anObject;
  17313. return self;
  17314. },
  17315. args: ["anObject"],
  17316. source: "trait: anObject\x0a\x09trait := anObject",
  17317. referencedClasses: [],
  17318. messageSends: []
  17319. }),
  17320. $globals.TraitTransformation);
  17321. $core.addMethod(
  17322. $core.method({
  17323. selector: "fromJSON:",
  17324. protocol: "instance creation",
  17325. fn: function (aJSObject){
  17326. var self=this,$self=this;
  17327. return $core.withContext(function($ctx1) {
  17328. var $1,$4,$3,$2;
  17329. $1=(
  17330. $ctx1.supercall = true,
  17331. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17332. $ctx1.supercall = false;
  17333. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17334. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17335. return $globals.HashedCollection._newFromPairs_([]);
  17336. }));
  17337. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17338. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17339. $2=$recv($3)._associations();
  17340. $recv($1)._addAliases_($2);
  17341. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17342. return [];
  17343. })));
  17344. return $recv($1)._yourself();
  17345. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17346. },
  17347. args: ["aJSObject"],
  17348. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  17349. referencedClasses: ["Smalltalk"],
  17350. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17351. }),
  17352. $globals.TraitTransformation.a$cls);
  17353. $core.addMethod(
  17354. $core.method({
  17355. selector: "on:",
  17356. protocol: "instance creation",
  17357. fn: function (aTrait){
  17358. var self=this,$self=this;
  17359. return $core.withContext(function($ctx1) {
  17360. var $1;
  17361. $1=(
  17362. $ctx1.supercall = true,
  17363. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17364. $ctx1.supercall = false;
  17365. $recv($1)._trait_(aTrait);
  17366. return $recv($1)._yourself();
  17367. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17368. },
  17369. args: ["aTrait"],
  17370. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17371. referencedClasses: [],
  17372. messageSends: ["trait:", "new", "yourself"]
  17373. }),
  17374. $globals.TraitTransformation.a$cls);
  17375. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17376. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17377. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17378. $core.addMethod(
  17379. $core.method({
  17380. selector: "asTraitComposition",
  17381. protocol: "*Kernel-Classes",
  17382. fn: function (){
  17383. var self=this,$self=this;
  17384. return $core.withContext(function($ctx1) {
  17385. return $self._collect_((function(each){
  17386. return $core.withContext(function($ctx2) {
  17387. return $recv(each)._asTraitTransformation();
  17388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17389. }));
  17390. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17391. },
  17392. args: [],
  17393. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17394. referencedClasses: [],
  17395. messageSends: ["collect:", "asTraitTransformation"]
  17396. }),
  17397. $globals.Array);
  17398. });
  17399. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17400. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17401. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17402. var $pkg = $core.addPackage("Kernel-Methods");
  17403. $pkg.innerEval = function (expr) { return eval(expr); };
  17404. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  17405. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17406. $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 | ... ] `";
  17407. $core.addMethod(
  17408. $core.method({
  17409. selector: "applyTo:arguments:",
  17410. protocol: "evaluating",
  17411. fn: function (anObject,aCollection){
  17412. var self=this,$self=this;
  17413. return $core.withContext(function($ctx1) {
  17414. return self.apply(anObject, aCollection);
  17415. return self;
  17416. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17417. },
  17418. args: ["anObject", "aCollection"],
  17419. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17420. referencedClasses: [],
  17421. messageSends: []
  17422. }),
  17423. $globals.BlockClosure);
  17424. $core.addMethod(
  17425. $core.method({
  17426. selector: "asCompiledMethod:",
  17427. protocol: "converting",
  17428. fn: function (aString){
  17429. var self=this,$self=this;
  17430. return $core.withContext(function($ctx1) {
  17431. return $core.method({selector:aString, fn:self});;
  17432. return self;
  17433. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17434. },
  17435. args: ["aString"],
  17436. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17437. referencedClasses: [],
  17438. messageSends: []
  17439. }),
  17440. $globals.BlockClosure);
  17441. $core.addMethod(
  17442. $core.method({
  17443. selector: "compiledSource",
  17444. protocol: "accessing",
  17445. fn: function (){
  17446. var self=this,$self=this;
  17447. return $core.withContext(function($ctx1) {
  17448. return self.toString();
  17449. return self;
  17450. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17451. },
  17452. args: [],
  17453. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17454. referencedClasses: [],
  17455. messageSends: []
  17456. }),
  17457. $globals.BlockClosure);
  17458. $core.addMethod(
  17459. $core.method({
  17460. selector: "currySelf",
  17461. protocol: "converting",
  17462. fn: function (){
  17463. var self=this,$self=this;
  17464. return $core.withContext(function($ctx1) {
  17465. return function () {
  17466. var args = [ this ];
  17467. args.push.apply(args, arguments);
  17468. return self.apply(null, args);
  17469. }
  17470. ;
  17471. return self;
  17472. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17473. },
  17474. args: [],
  17475. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09'>",
  17476. referencedClasses: [],
  17477. messageSends: []
  17478. }),
  17479. $globals.BlockClosure);
  17480. $core.addMethod(
  17481. $core.method({
  17482. selector: "ensure:",
  17483. protocol: "evaluating",
  17484. fn: function (aBlock){
  17485. var self=this,$self=this;
  17486. return $core.withContext(function($ctx1) {
  17487. try{return $self._value()}finally{aBlock._value()};
  17488. return self;
  17489. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17490. },
  17491. args: ["aBlock"],
  17492. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17493. referencedClasses: [],
  17494. messageSends: []
  17495. }),
  17496. $globals.BlockClosure);
  17497. $core.addMethod(
  17498. $core.method({
  17499. selector: "fork",
  17500. protocol: "timeout/interval",
  17501. fn: function (){
  17502. var self=this,$self=this;
  17503. return $core.withContext(function($ctx1) {
  17504. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17505. return self;
  17506. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17507. },
  17508. args: [],
  17509. source: "fork\x0a\x09ForkPool default fork: self",
  17510. referencedClasses: ["ForkPool"],
  17511. messageSends: ["fork:", "default"]
  17512. }),
  17513. $globals.BlockClosure);
  17514. $core.addMethod(
  17515. $core.method({
  17516. selector: "new",
  17517. protocol: "evaluating",
  17518. fn: function (){
  17519. var self=this,$self=this;
  17520. return $core.withContext(function($ctx1) {
  17521. return new self();
  17522. return self;
  17523. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17524. },
  17525. args: [],
  17526. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<inlineJS: 'return new self()'>",
  17527. referencedClasses: [],
  17528. messageSends: []
  17529. }),
  17530. $globals.BlockClosure);
  17531. $core.addMethod(
  17532. $core.method({
  17533. selector: "newValue:",
  17534. protocol: "evaluating",
  17535. fn: function (anObject){
  17536. var self=this,$self=this;
  17537. return $core.withContext(function($ctx1) {
  17538. return $self._newWithValues_([anObject]);
  17539. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17540. },
  17541. args: ["anObject"],
  17542. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17543. referencedClasses: [],
  17544. messageSends: ["newWithValues:"]
  17545. }),
  17546. $globals.BlockClosure);
  17547. $core.addMethod(
  17548. $core.method({
  17549. selector: "newValue:value:",
  17550. protocol: "evaluating",
  17551. fn: function (anObject,anObject2){
  17552. var self=this,$self=this;
  17553. return $core.withContext(function($ctx1) {
  17554. return $self._newWithValues_([anObject,anObject2]);
  17555. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17556. },
  17557. args: ["anObject", "anObject2"],
  17558. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17559. referencedClasses: [],
  17560. messageSends: ["newWithValues:"]
  17561. }),
  17562. $globals.BlockClosure);
  17563. $core.addMethod(
  17564. $core.method({
  17565. selector: "newValue:value:value:",
  17566. protocol: "evaluating",
  17567. fn: function (anObject,anObject2,anObject3){
  17568. var self=this,$self=this;
  17569. return $core.withContext(function($ctx1) {
  17570. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17571. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17572. },
  17573. args: ["anObject", "anObject2", "anObject3"],
  17574. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17575. referencedClasses: [],
  17576. messageSends: ["newWithValues:"]
  17577. }),
  17578. $globals.BlockClosure);
  17579. $core.addMethod(
  17580. $core.method({
  17581. selector: "newWithValues:",
  17582. protocol: "evaluating",
  17583. fn: function (aCollection){
  17584. var self=this,$self=this;
  17585. return $core.withContext(function($ctx1) {
  17586. var object = Object.create(self.prototype);
  17587. var result = self.apply(object, aCollection);
  17588. return typeof result === "object" ? result : object;
  17589. ;
  17590. return self;
  17591. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17592. },
  17593. args: ["aCollection"],
  17594. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
  17595. referencedClasses: [],
  17596. messageSends: []
  17597. }),
  17598. $globals.BlockClosure);
  17599. $core.addMethod(
  17600. $core.method({
  17601. selector: "numArgs",
  17602. protocol: "accessing",
  17603. fn: function (){
  17604. var self=this,$self=this;
  17605. return $core.withContext(function($ctx1) {
  17606. return self.length;
  17607. return self;
  17608. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17609. },
  17610. args: [],
  17611. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17612. referencedClasses: [],
  17613. messageSends: []
  17614. }),
  17615. $globals.BlockClosure);
  17616. $core.addMethod(
  17617. $core.method({
  17618. selector: "on:do:",
  17619. protocol: "error handling",
  17620. fn: function (anErrorClass,aBlock){
  17621. var self=this,$self=this;
  17622. return $core.withContext(function($ctx1) {
  17623. var $1;
  17624. return $self._tryCatch_((function(error){
  17625. var smalltalkError;
  17626. return $core.withContext(function($ctx2) {
  17627. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17628. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17629. if($core.assert($1)){
  17630. return $recv(aBlock)._value_(smalltalkError);
  17631. } else {
  17632. return $recv(smalltalkError)._pass();
  17633. }
  17634. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17635. }));
  17636. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17637. },
  17638. args: ["anErrorClass", "aBlock"],
  17639. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  17640. referencedClasses: ["Smalltalk"],
  17641. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17642. }),
  17643. $globals.BlockClosure);
  17644. $core.addMethod(
  17645. $core.method({
  17646. selector: "provided",
  17647. protocol: "converting",
  17648. fn: function (){
  17649. var self=this,$self=this;
  17650. return $core.withContext(function($ctx1) {
  17651. return $recv($globals.JSObjectProxy)._on_(self);
  17652. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17653. },
  17654. args: [],
  17655. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17656. referencedClasses: ["JSObjectProxy"],
  17657. messageSends: ["on:"]
  17658. }),
  17659. $globals.BlockClosure);
  17660. $core.addMethod(
  17661. $core.method({
  17662. selector: "receiver",
  17663. protocol: "accessing",
  17664. fn: function (){
  17665. var self=this,$self=this;
  17666. return nil;
  17667. },
  17668. args: [],
  17669. source: "receiver\x0a\x09^ nil",
  17670. referencedClasses: [],
  17671. messageSends: []
  17672. }),
  17673. $globals.BlockClosure);
  17674. $core.addMethod(
  17675. $core.method({
  17676. selector: "timeToRun",
  17677. protocol: "evaluating",
  17678. fn: function (){
  17679. var self=this,$self=this;
  17680. return $core.withContext(function($ctx1) {
  17681. return $recv($globals.Date)._millisecondsToRun_(self);
  17682. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17683. },
  17684. args: [],
  17685. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17686. referencedClasses: ["Date"],
  17687. messageSends: ["millisecondsToRun:"]
  17688. }),
  17689. $globals.BlockClosure);
  17690. $core.addMethod(
  17691. $core.method({
  17692. selector: "tryCatch:",
  17693. protocol: "error handling",
  17694. fn: function (aBlock){
  17695. var self=this,$self=this;
  17696. return $core.withContext(function($ctx1) {
  17697. try {
  17698. return $self._value();
  17699. } catch(error) {
  17700. // pass non-local returns undetected
  17701. if (Array.isArray(error) && error.length === 1) throw error;
  17702. return aBlock._value_(error);
  17703. }
  17704. ;
  17705. return self;
  17706. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17707. },
  17708. args: ["aBlock"],
  17709. source: "tryCatch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  17710. referencedClasses: [],
  17711. messageSends: []
  17712. }),
  17713. $globals.BlockClosure);
  17714. $core.addMethod(
  17715. $core.method({
  17716. selector: "value",
  17717. protocol: "evaluating",
  17718. fn: function (){
  17719. var self=this,$self=this;
  17720. return $core.withContext(function($ctx1) {
  17721. return self();;
  17722. return self;
  17723. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17724. },
  17725. args: [],
  17726. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17727. referencedClasses: [],
  17728. messageSends: []
  17729. }),
  17730. $globals.BlockClosure);
  17731. $core.addMethod(
  17732. $core.method({
  17733. selector: "value:",
  17734. protocol: "evaluating",
  17735. fn: function (anArg){
  17736. var self=this,$self=this;
  17737. return $core.withContext(function($ctx1) {
  17738. return self(anArg);;
  17739. return self;
  17740. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17741. },
  17742. args: ["anArg"],
  17743. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17744. referencedClasses: [],
  17745. messageSends: []
  17746. }),
  17747. $globals.BlockClosure);
  17748. $core.addMethod(
  17749. $core.method({
  17750. selector: "value:value:",
  17751. protocol: "evaluating",
  17752. fn: function (firstArg,secondArg){
  17753. var self=this,$self=this;
  17754. return $core.withContext(function($ctx1) {
  17755. return self(firstArg, secondArg);;
  17756. return self;
  17757. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17758. },
  17759. args: ["firstArg", "secondArg"],
  17760. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17761. referencedClasses: [],
  17762. messageSends: []
  17763. }),
  17764. $globals.BlockClosure);
  17765. $core.addMethod(
  17766. $core.method({
  17767. selector: "value:value:value:",
  17768. protocol: "evaluating",
  17769. fn: function (firstArg,secondArg,thirdArg){
  17770. var self=this,$self=this;
  17771. return $core.withContext(function($ctx1) {
  17772. return self(firstArg, secondArg, thirdArg);;
  17773. return self;
  17774. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17775. },
  17776. args: ["firstArg", "secondArg", "thirdArg"],
  17777. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17778. referencedClasses: [],
  17779. messageSends: []
  17780. }),
  17781. $globals.BlockClosure);
  17782. $core.addMethod(
  17783. $core.method({
  17784. selector: "valueWithInterval:",
  17785. protocol: "timeout/interval",
  17786. fn: function (aNumber){
  17787. var self=this,$self=this;
  17788. return $core.withContext(function($ctx1) {
  17789. var interval = setInterval(self, aNumber);
  17790. return $globals.Timeout._on_(interval);
  17791. ;
  17792. return self;
  17793. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17794. },
  17795. args: ["aNumber"],
  17796. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17797. referencedClasses: [],
  17798. messageSends: []
  17799. }),
  17800. $globals.BlockClosure);
  17801. $core.addMethod(
  17802. $core.method({
  17803. selector: "valueWithPossibleArguments:",
  17804. protocol: "evaluating",
  17805. fn: function (aCollection){
  17806. var self=this,$self=this;
  17807. return $core.withContext(function($ctx1) {
  17808. return self.apply(null, aCollection);;
  17809. return self;
  17810. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17811. },
  17812. args: ["aCollection"],
  17813. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17814. referencedClasses: [],
  17815. messageSends: []
  17816. }),
  17817. $globals.BlockClosure);
  17818. $core.addMethod(
  17819. $core.method({
  17820. selector: "valueWithTimeout:",
  17821. protocol: "timeout/interval",
  17822. fn: function (aNumber){
  17823. var self=this,$self=this;
  17824. return $core.withContext(function($ctx1) {
  17825. var timeout = setTimeout(self, aNumber);
  17826. return $globals.Timeout._on_(timeout);
  17827. ;
  17828. return self;
  17829. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17830. },
  17831. args: ["aNumber"],
  17832. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17833. referencedClasses: [],
  17834. messageSends: []
  17835. }),
  17836. $globals.BlockClosure);
  17837. $core.addMethod(
  17838. $core.method({
  17839. selector: "whileFalse",
  17840. protocol: "controlling",
  17841. fn: function (){
  17842. var self=this,$self=this;
  17843. return $core.withContext(function($ctx1) {
  17844. $self._whileFalse_((function(){
  17845. }));
  17846. return self;
  17847. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17848. },
  17849. args: [],
  17850. source: "whileFalse\x0a\x09self whileFalse: []",
  17851. referencedClasses: [],
  17852. messageSends: ["whileFalse:"]
  17853. }),
  17854. $globals.BlockClosure);
  17855. $core.addMethod(
  17856. $core.method({
  17857. selector: "whileFalse:",
  17858. protocol: "controlling",
  17859. fn: function (aBlock){
  17860. var self=this,$self=this;
  17861. return $core.withContext(function($ctx1) {
  17862. while(!$core.assert($self._value())) {aBlock._value()};
  17863. return self;
  17864. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17865. },
  17866. args: ["aBlock"],
  17867. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17868. referencedClasses: [],
  17869. messageSends: []
  17870. }),
  17871. $globals.BlockClosure);
  17872. $core.addMethod(
  17873. $core.method({
  17874. selector: "whileTrue",
  17875. protocol: "controlling",
  17876. fn: function (){
  17877. var self=this,$self=this;
  17878. return $core.withContext(function($ctx1) {
  17879. $self._whileTrue_((function(){
  17880. }));
  17881. return self;
  17882. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17883. },
  17884. args: [],
  17885. source: "whileTrue\x0a\x09self whileTrue: []",
  17886. referencedClasses: [],
  17887. messageSends: ["whileTrue:"]
  17888. }),
  17889. $globals.BlockClosure);
  17890. $core.addMethod(
  17891. $core.method({
  17892. selector: "whileTrue:",
  17893. protocol: "controlling",
  17894. fn: function (aBlock){
  17895. var self=this,$self=this;
  17896. return $core.withContext(function($ctx1) {
  17897. while($core.assert($self._value())) {aBlock._value()};
  17898. return self;
  17899. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17900. },
  17901. args: ["aBlock"],
  17902. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17903. referencedClasses: [],
  17904. messageSends: []
  17905. }),
  17906. $globals.BlockClosure);
  17907. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17908. $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";
  17909. $core.addMethod(
  17910. $core.method({
  17911. selector: "arguments",
  17912. protocol: "accessing",
  17913. fn: function (){
  17914. var self=this,$self=this;
  17915. return $core.withContext(function($ctx1) {
  17916. return self.args || [];
  17917. return self;
  17918. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17919. },
  17920. args: [],
  17921. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17922. referencedClasses: [],
  17923. messageSends: []
  17924. }),
  17925. $globals.CompiledMethod);
  17926. $core.addMethod(
  17927. $core.method({
  17928. selector: "browse",
  17929. protocol: "browsing",
  17930. fn: function (){
  17931. var self=this,$self=this;
  17932. return $core.withContext(function($ctx1) {
  17933. $recv($globals.Finder)._findMethod_(self);
  17934. return self;
  17935. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17936. },
  17937. args: [],
  17938. source: "browse\x0a\x09Finder findMethod: self",
  17939. referencedClasses: ["Finder"],
  17940. messageSends: ["findMethod:"]
  17941. }),
  17942. $globals.CompiledMethod);
  17943. $core.addMethod(
  17944. $core.method({
  17945. selector: "category",
  17946. protocol: "accessing",
  17947. fn: function (){
  17948. var self=this,$self=this;
  17949. return $core.withContext(function($ctx1) {
  17950. return $self._protocol();
  17951. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17952. },
  17953. args: [],
  17954. source: "category\x0a\x09^ self protocol",
  17955. referencedClasses: [],
  17956. messageSends: ["protocol"]
  17957. }),
  17958. $globals.CompiledMethod);
  17959. $core.addMethod(
  17960. $core.method({
  17961. selector: "defaultProtocol",
  17962. protocol: "defaults",
  17963. fn: function (){
  17964. var self=this,$self=this;
  17965. return "as yet unclassified";
  17966. },
  17967. args: [],
  17968. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17969. referencedClasses: [],
  17970. messageSends: []
  17971. }),
  17972. $globals.CompiledMethod);
  17973. $core.addMethod(
  17974. $core.method({
  17975. selector: "fn",
  17976. protocol: "accessing",
  17977. fn: function (){
  17978. var self=this,$self=this;
  17979. return $core.withContext(function($ctx1) {
  17980. return $self._basicAt_("fn");
  17981. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17982. },
  17983. args: [],
  17984. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17985. referencedClasses: [],
  17986. messageSends: ["basicAt:"]
  17987. }),
  17988. $globals.CompiledMethod);
  17989. $core.addMethod(
  17990. $core.method({
  17991. selector: "fn:",
  17992. protocol: "accessing",
  17993. fn: function (aBlock){
  17994. var self=this,$self=this;
  17995. return $core.withContext(function($ctx1) {
  17996. $self._basicAt_put_("fn",aBlock);
  17997. return self;
  17998. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  17999. },
  18000. args: ["aBlock"],
  18001. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18002. referencedClasses: [],
  18003. messageSends: ["basicAt:put:"]
  18004. }),
  18005. $globals.CompiledMethod);
  18006. $core.addMethod(
  18007. $core.method({
  18008. selector: "isCompiledMethod",
  18009. protocol: "testing",
  18010. fn: function (){
  18011. var self=this,$self=this;
  18012. return true;
  18013. },
  18014. args: [],
  18015. source: "isCompiledMethod\x0a\x09^ true",
  18016. referencedClasses: [],
  18017. messageSends: []
  18018. }),
  18019. $globals.CompiledMethod);
  18020. $core.addMethod(
  18021. $core.method({
  18022. selector: "isOverridden",
  18023. protocol: "testing",
  18024. fn: function (){
  18025. var self=this,$self=this;
  18026. var selector;
  18027. return $core.withContext(function($ctx1) {
  18028. var $1;
  18029. var $early={};
  18030. try {
  18031. selector=$self._selector();
  18032. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18033. return $core.withContext(function($ctx2) {
  18034. $1=$recv(each)._includesSelector_(selector);
  18035. if($core.assert($1)){
  18036. throw $early=[true];
  18037. }
  18038. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18039. }));
  18040. return false;
  18041. }
  18042. catch(e) {if(e===$early)return e[0]; throw e}
  18043. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18044. },
  18045. args: [],
  18046. 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",
  18047. referencedClasses: [],
  18048. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18049. }),
  18050. $globals.CompiledMethod);
  18051. $core.addMethod(
  18052. $core.method({
  18053. selector: "isOverride",
  18054. protocol: "testing",
  18055. fn: function (){
  18056. var self=this,$self=this;
  18057. var superclass;
  18058. return $core.withContext(function($ctx1) {
  18059. var $1,$2,$receiver;
  18060. $1=$self._methodClass();
  18061. $ctx1.sendIdx["methodClass"]=1;
  18062. superclass=$recv($1)._superclass();
  18063. $ctx1.sendIdx["superclass"]=1;
  18064. $2=superclass;
  18065. if(($receiver = $2) == null || $receiver.a$nil){
  18066. return false;
  18067. } else {
  18068. $2;
  18069. }
  18070. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18071. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18072. },
  18073. args: [],
  18074. 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",
  18075. referencedClasses: [],
  18076. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18077. }),
  18078. $globals.CompiledMethod);
  18079. $core.addMethod(
  18080. $core.method({
  18081. selector: "messageSends",
  18082. protocol: "accessing",
  18083. fn: function (){
  18084. var self=this,$self=this;
  18085. return $core.withContext(function($ctx1) {
  18086. return $self._basicAt_("messageSends");
  18087. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18088. },
  18089. args: [],
  18090. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18091. referencedClasses: [],
  18092. messageSends: ["basicAt:"]
  18093. }),
  18094. $globals.CompiledMethod);
  18095. $core.addMethod(
  18096. $core.method({
  18097. selector: "methodClass",
  18098. protocol: "accessing",
  18099. fn: function (){
  18100. var self=this,$self=this;
  18101. return $core.withContext(function($ctx1) {
  18102. return $self._basicAt_("owner");
  18103. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18104. },
  18105. args: [],
  18106. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18107. referencedClasses: [],
  18108. messageSends: ["basicAt:"]
  18109. }),
  18110. $globals.CompiledMethod);
  18111. $core.addMethod(
  18112. $core.method({
  18113. selector: "package",
  18114. protocol: "accessing",
  18115. fn: function (){
  18116. var self=this,$self=this;
  18117. return $core.withContext(function($ctx1) {
  18118. var $1,$receiver;
  18119. $1=$self._methodClass();
  18120. if(($receiver = $1) == null || $receiver.a$nil){
  18121. return $1;
  18122. } else {
  18123. var class_;
  18124. class_=$receiver;
  18125. return $recv(class_)._packageOfProtocol_($self._protocol());
  18126. }
  18127. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18128. },
  18129. args: [],
  18130. 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 ]",
  18131. referencedClasses: [],
  18132. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18133. }),
  18134. $globals.CompiledMethod);
  18135. $core.addMethod(
  18136. $core.method({
  18137. selector: "protocol",
  18138. protocol: "accessing",
  18139. fn: function (){
  18140. var self=this,$self=this;
  18141. return $core.withContext(function($ctx1) {
  18142. var $1,$receiver;
  18143. $1=$self._basicAt_("protocol");
  18144. if(($receiver = $1) == null || $receiver.a$nil){
  18145. return $self._defaultProtocol();
  18146. } else {
  18147. return $1;
  18148. }
  18149. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18150. },
  18151. args: [],
  18152. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18153. referencedClasses: [],
  18154. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18155. }),
  18156. $globals.CompiledMethod);
  18157. $core.addMethod(
  18158. $core.method({
  18159. selector: "protocol:",
  18160. protocol: "accessing",
  18161. fn: function (aString){
  18162. var self=this,$self=this;
  18163. var oldProtocol;
  18164. return $core.withContext(function($ctx1) {
  18165. var $1,$3,$2,$4,$receiver;
  18166. oldProtocol=$self._protocol();
  18167. $self._basicAt_put_("protocol",aString);
  18168. $1=$recv($globals.SystemAnnouncer)._current();
  18169. $3=$recv($globals.MethodMoved)._new();
  18170. $recv($3)._method_(self);
  18171. $recv($3)._oldProtocol_(oldProtocol);
  18172. $2=$recv($3)._yourself();
  18173. $recv($1)._announce_($2);
  18174. $4=$self._methodClass();
  18175. if(($receiver = $4) == null || $receiver.a$nil){
  18176. $4;
  18177. } else {
  18178. var methodClass;
  18179. methodClass=$receiver;
  18180. $recv($recv(methodClass)._organization())._addElement_(aString);
  18181. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18182. }
  18183. return self;
  18184. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18185. },
  18186. args: ["aString"],
  18187. 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 ]",
  18188. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18189. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18190. }),
  18191. $globals.CompiledMethod);
  18192. $core.addMethod(
  18193. $core.method({
  18194. selector: "referencedClasses",
  18195. protocol: "accessing",
  18196. fn: function (){
  18197. var self=this,$self=this;
  18198. return $core.withContext(function($ctx1) {
  18199. return $self._basicAt_("referencedClasses");
  18200. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18201. },
  18202. args: [],
  18203. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18204. referencedClasses: [],
  18205. messageSends: ["basicAt:"]
  18206. }),
  18207. $globals.CompiledMethod);
  18208. $core.addMethod(
  18209. $core.method({
  18210. selector: "selector",
  18211. protocol: "accessing",
  18212. fn: function (){
  18213. var self=this,$self=this;
  18214. return $core.withContext(function($ctx1) {
  18215. return $self._basicAt_("selector");
  18216. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18217. },
  18218. args: [],
  18219. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18220. referencedClasses: [],
  18221. messageSends: ["basicAt:"]
  18222. }),
  18223. $globals.CompiledMethod);
  18224. $core.addMethod(
  18225. $core.method({
  18226. selector: "selector:",
  18227. protocol: "accessing",
  18228. fn: function (aString){
  18229. var self=this,$self=this;
  18230. return $core.withContext(function($ctx1) {
  18231. $self._basicAt_put_("selector",aString);
  18232. return self;
  18233. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18234. },
  18235. args: ["aString"],
  18236. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18237. referencedClasses: [],
  18238. messageSends: ["basicAt:put:"]
  18239. }),
  18240. $globals.CompiledMethod);
  18241. $core.addMethod(
  18242. $core.method({
  18243. selector: "sendTo:arguments:",
  18244. protocol: "evaluating",
  18245. fn: function (anObject,aCollection){
  18246. var self=this,$self=this;
  18247. return $core.withContext(function($ctx1) {
  18248. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18249. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18250. },
  18251. args: ["anObject", "aCollection"],
  18252. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18253. referencedClasses: [],
  18254. messageSends: ["applyTo:arguments:", "fn"]
  18255. }),
  18256. $globals.CompiledMethod);
  18257. $core.addMethod(
  18258. $core.method({
  18259. selector: "source",
  18260. protocol: "accessing",
  18261. fn: function (){
  18262. var self=this,$self=this;
  18263. return $core.withContext(function($ctx1) {
  18264. var $1,$receiver;
  18265. $1=$self._basicAt_("source");
  18266. if(($receiver = $1) == null || $receiver.a$nil){
  18267. return "";
  18268. } else {
  18269. return $1;
  18270. }
  18271. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18272. },
  18273. args: [],
  18274. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18275. referencedClasses: [],
  18276. messageSends: ["ifNil:", "basicAt:"]
  18277. }),
  18278. $globals.CompiledMethod);
  18279. $core.addMethod(
  18280. $core.method({
  18281. selector: "source:",
  18282. protocol: "accessing",
  18283. fn: function (aString){
  18284. var self=this,$self=this;
  18285. return $core.withContext(function($ctx1) {
  18286. $self._basicAt_put_("source",aString);
  18287. return self;
  18288. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18289. },
  18290. args: ["aString"],
  18291. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18292. referencedClasses: [],
  18293. messageSends: ["basicAt:put:"]
  18294. }),
  18295. $globals.CompiledMethod);
  18296. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18297. $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`";
  18298. $core.addMethod(
  18299. $core.method({
  18300. selector: "addWorker",
  18301. protocol: "private",
  18302. fn: function (){
  18303. var self=this,$self=this;
  18304. return $core.withContext(function($ctx1) {
  18305. $recv($self["@worker"])._valueWithTimeout_((0));
  18306. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18307. return self;
  18308. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18309. },
  18310. args: [],
  18311. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18312. referencedClasses: [],
  18313. messageSends: ["valueWithTimeout:", "+"]
  18314. }),
  18315. $globals.ForkPool);
  18316. $core.addMethod(
  18317. $core.method({
  18318. selector: "defaultMaxPoolSize",
  18319. protocol: "defaults",
  18320. fn: function (){
  18321. var self=this,$self=this;
  18322. return $core.withContext(function($ctx1) {
  18323. return $recv($self._class())._defaultMaxPoolSize();
  18324. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18325. },
  18326. args: [],
  18327. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18328. referencedClasses: [],
  18329. messageSends: ["defaultMaxPoolSize", "class"]
  18330. }),
  18331. $globals.ForkPool);
  18332. $core.addMethod(
  18333. $core.method({
  18334. selector: "fork:",
  18335. protocol: "actions",
  18336. fn: function (aBlock){
  18337. var self=this,$self=this;
  18338. return $core.withContext(function($ctx1) {
  18339. var $1;
  18340. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18341. if($core.assert($1)){
  18342. $self._addWorker();
  18343. }
  18344. $recv($self["@queue"])._nextPut_(aBlock);
  18345. return self;
  18346. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18347. },
  18348. args: ["aBlock"],
  18349. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18350. referencedClasses: [],
  18351. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18352. }),
  18353. $globals.ForkPool);
  18354. $core.addMethod(
  18355. $core.method({
  18356. selector: "initialize",
  18357. protocol: "initialization",
  18358. fn: function (){
  18359. var self=this,$self=this;
  18360. return $core.withContext(function($ctx1) {
  18361. (
  18362. $ctx1.supercall = true,
  18363. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18364. $ctx1.supercall = false;
  18365. $self["@poolSize"]=(0);
  18366. $self["@queue"]=$recv($globals.Queue)._new();
  18367. $self["@worker"]=$self._makeWorker();
  18368. return self;
  18369. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18370. },
  18371. args: [],
  18372. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18373. referencedClasses: ["Queue"],
  18374. messageSends: ["initialize", "new", "makeWorker"]
  18375. }),
  18376. $globals.ForkPool);
  18377. $core.addMethod(
  18378. $core.method({
  18379. selector: "makeWorker",
  18380. protocol: "initialization",
  18381. fn: function (){
  18382. var self=this,$self=this;
  18383. var sentinel;
  18384. return $core.withContext(function($ctx1) {
  18385. var $1;
  18386. sentinel=$recv($globals.Object)._new();
  18387. return (function(){
  18388. var block;
  18389. return $core.withContext(function($ctx2) {
  18390. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18391. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18392. return sentinel;
  18393. }));
  18394. $1=$recv(block).__eq_eq(sentinel);
  18395. if(!$core.assert($1)){
  18396. return $recv((function(){
  18397. return $core.withContext(function($ctx3) {
  18398. return $recv(block)._value();
  18399. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18400. }))._ensure_((function(){
  18401. return $core.withContext(function($ctx3) {
  18402. return $self._addWorker();
  18403. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18404. }));
  18405. }
  18406. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18407. });
  18408. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18409. },
  18410. args: [],
  18411. 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 ] ]]",
  18412. referencedClasses: ["Object"],
  18413. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18414. }),
  18415. $globals.ForkPool);
  18416. $core.addMethod(
  18417. $core.method({
  18418. selector: "maxPoolSize",
  18419. protocol: "accessing",
  18420. fn: function (){
  18421. var self=this,$self=this;
  18422. return $core.withContext(function($ctx1) {
  18423. var $1,$receiver;
  18424. $1=$self["@maxPoolSize"];
  18425. if(($receiver = $1) == null || $receiver.a$nil){
  18426. return $self._defaultMaxPoolSize();
  18427. } else {
  18428. return $1;
  18429. }
  18430. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18431. },
  18432. args: [],
  18433. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18434. referencedClasses: [],
  18435. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18436. }),
  18437. $globals.ForkPool);
  18438. $core.addMethod(
  18439. $core.method({
  18440. selector: "maxPoolSize:",
  18441. protocol: "accessing",
  18442. fn: function (anInteger){
  18443. var self=this,$self=this;
  18444. $self["@maxPoolSize"]=anInteger;
  18445. return self;
  18446. },
  18447. args: ["anInteger"],
  18448. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18449. referencedClasses: [],
  18450. messageSends: []
  18451. }),
  18452. $globals.ForkPool);
  18453. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18454. $core.addMethod(
  18455. $core.method({
  18456. selector: "default",
  18457. protocol: "accessing",
  18458. fn: function (){
  18459. var self=this,$self=this;
  18460. return $core.withContext(function($ctx1) {
  18461. var $1,$receiver;
  18462. $1=$self["@default"];
  18463. if(($receiver = $1) == null || $receiver.a$nil){
  18464. $self["@default"]=$self._new();
  18465. return $self["@default"];
  18466. } else {
  18467. return $1;
  18468. }
  18469. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18470. },
  18471. args: [],
  18472. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18473. referencedClasses: [],
  18474. messageSends: ["ifNil:", "new"]
  18475. }),
  18476. $globals.ForkPool.a$cls);
  18477. $core.addMethod(
  18478. $core.method({
  18479. selector: "defaultMaxPoolSize",
  18480. protocol: "accessing",
  18481. fn: function (){
  18482. var self=this,$self=this;
  18483. return (100);
  18484. },
  18485. args: [],
  18486. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18487. referencedClasses: [],
  18488. messageSends: []
  18489. }),
  18490. $globals.ForkPool.a$cls);
  18491. $core.addMethod(
  18492. $core.method({
  18493. selector: "resetDefault",
  18494. protocol: "accessing",
  18495. fn: function (){
  18496. var self=this,$self=this;
  18497. $self["@default"]=nil;
  18498. return self;
  18499. },
  18500. args: [],
  18501. source: "resetDefault\x0a\x09default := nil",
  18502. referencedClasses: [],
  18503. messageSends: []
  18504. }),
  18505. $globals.ForkPool.a$cls);
  18506. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18507. $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.";
  18508. $core.addMethod(
  18509. $core.method({
  18510. selector: "arguments",
  18511. protocol: "accessing",
  18512. fn: function (){
  18513. var self=this,$self=this;
  18514. return $self["@arguments"];
  18515. },
  18516. args: [],
  18517. source: "arguments\x0a\x09^ arguments",
  18518. referencedClasses: [],
  18519. messageSends: []
  18520. }),
  18521. $globals.Message);
  18522. $core.addMethod(
  18523. $core.method({
  18524. selector: "arguments:",
  18525. protocol: "accessing",
  18526. fn: function (anArray){
  18527. var self=this,$self=this;
  18528. $self["@arguments"]=anArray;
  18529. return self;
  18530. },
  18531. args: ["anArray"],
  18532. source: "arguments: anArray\x0a\x09arguments := anArray",
  18533. referencedClasses: [],
  18534. messageSends: []
  18535. }),
  18536. $globals.Message);
  18537. $core.addMethod(
  18538. $core.method({
  18539. selector: "printOn:",
  18540. protocol: "printing",
  18541. fn: function (aStream){
  18542. var self=this,$self=this;
  18543. return $core.withContext(function($ctx1) {
  18544. (
  18545. $ctx1.supercall = true,
  18546. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18547. $ctx1.supercall = false;
  18548. $recv(aStream)._nextPutAll_("(");
  18549. $ctx1.sendIdx["nextPutAll:"]=1;
  18550. $recv(aStream)._nextPutAll_($self._selector());
  18551. $ctx1.sendIdx["nextPutAll:"]=2;
  18552. $recv(aStream)._nextPutAll_(")");
  18553. return self;
  18554. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18555. },
  18556. args: ["aStream"],
  18557. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18558. referencedClasses: [],
  18559. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18560. }),
  18561. $globals.Message);
  18562. $core.addMethod(
  18563. $core.method({
  18564. selector: "selector",
  18565. protocol: "accessing",
  18566. fn: function (){
  18567. var self=this,$self=this;
  18568. return $self["@selector"];
  18569. },
  18570. args: [],
  18571. source: "selector\x0a\x09^ selector",
  18572. referencedClasses: [],
  18573. messageSends: []
  18574. }),
  18575. $globals.Message);
  18576. $core.addMethod(
  18577. $core.method({
  18578. selector: "selector:",
  18579. protocol: "accessing",
  18580. fn: function (aString){
  18581. var self=this,$self=this;
  18582. $self["@selector"]=aString;
  18583. return self;
  18584. },
  18585. args: ["aString"],
  18586. source: "selector: aString\x0a\x09selector := aString",
  18587. referencedClasses: [],
  18588. messageSends: []
  18589. }),
  18590. $globals.Message);
  18591. $core.addMethod(
  18592. $core.method({
  18593. selector: "sendTo:",
  18594. protocol: "actions",
  18595. fn: function (anObject){
  18596. var self=this,$self=this;
  18597. return $core.withContext(function($ctx1) {
  18598. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18599. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18600. },
  18601. args: ["anObject"],
  18602. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18603. referencedClasses: [],
  18604. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18605. }),
  18606. $globals.Message);
  18607. $core.addMethod(
  18608. $core.method({
  18609. selector: "selector:arguments:",
  18610. protocol: "instance creation",
  18611. fn: function (aString,anArray){
  18612. var self=this,$self=this;
  18613. return $core.withContext(function($ctx1) {
  18614. var $1;
  18615. $1=$self._new();
  18616. $recv($1)._selector_(aString);
  18617. $recv($1)._arguments_(anArray);
  18618. return $recv($1)._yourself();
  18619. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18620. },
  18621. args: ["aString", "anArray"],
  18622. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18623. referencedClasses: [],
  18624. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18625. }),
  18626. $globals.Message.a$cls);
  18627. $core.addMethod(
  18628. $core.method({
  18629. selector: "selector:arguments:notUnderstoodBy:",
  18630. protocol: "dnu handling",
  18631. fn: function (aString,anArray,anObject){
  18632. var self=this,$self=this;
  18633. return $core.withContext(function($ctx1) {
  18634. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18635. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18636. },
  18637. args: ["aString", "anArray", "anObject"],
  18638. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  18639. referencedClasses: [],
  18640. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18641. }),
  18642. $globals.Message.a$cls);
  18643. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18644. $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.";
  18645. $core.addMethod(
  18646. $core.method({
  18647. selector: "arguments",
  18648. protocol: "accessing",
  18649. fn: function (){
  18650. var self=this,$self=this;
  18651. return $core.withContext(function($ctx1) {
  18652. return $recv($self["@message"])._arguments();
  18653. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18654. },
  18655. args: [],
  18656. source: "arguments\x0a\x09^ message arguments",
  18657. referencedClasses: [],
  18658. messageSends: ["arguments"]
  18659. }),
  18660. $globals.MessageSend);
  18661. $core.addMethod(
  18662. $core.method({
  18663. selector: "arguments:",
  18664. protocol: "accessing",
  18665. fn: function (aCollection){
  18666. var self=this,$self=this;
  18667. return $core.withContext(function($ctx1) {
  18668. $recv($self["@message"])._arguments_(aCollection);
  18669. return self;
  18670. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18671. },
  18672. args: ["aCollection"],
  18673. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18674. referencedClasses: [],
  18675. messageSends: ["arguments:"]
  18676. }),
  18677. $globals.MessageSend);
  18678. $core.addMethod(
  18679. $core.method({
  18680. selector: "initialize",
  18681. protocol: "initialization",
  18682. fn: function (){
  18683. var self=this,$self=this;
  18684. return $core.withContext(function($ctx1) {
  18685. (
  18686. $ctx1.supercall = true,
  18687. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18688. $ctx1.supercall = false;
  18689. $self["@message"]=$recv($globals.Message)._new();
  18690. return self;
  18691. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18692. },
  18693. args: [],
  18694. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18695. referencedClasses: ["Message"],
  18696. messageSends: ["initialize", "new"]
  18697. }),
  18698. $globals.MessageSend);
  18699. $core.addMethod(
  18700. $core.method({
  18701. selector: "printOn:",
  18702. protocol: "printing",
  18703. fn: function (aStream){
  18704. var self=this,$self=this;
  18705. return $core.withContext(function($ctx1) {
  18706. (
  18707. $ctx1.supercall = true,
  18708. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18709. $ctx1.supercall = false;
  18710. $recv(aStream)._nextPutAll_("(");
  18711. $ctx1.sendIdx["nextPutAll:"]=1;
  18712. $recv(aStream)._nextPutAll_($self._receiver());
  18713. $ctx1.sendIdx["nextPutAll:"]=2;
  18714. $recv(aStream)._nextPutAll_(" >> ");
  18715. $ctx1.sendIdx["nextPutAll:"]=3;
  18716. $recv(aStream)._nextPutAll_($self._selector());
  18717. $ctx1.sendIdx["nextPutAll:"]=4;
  18718. $recv(aStream)._nextPutAll_(")");
  18719. return self;
  18720. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18721. },
  18722. args: ["aStream"],
  18723. 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: ')'",
  18724. referencedClasses: [],
  18725. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18726. }),
  18727. $globals.MessageSend);
  18728. $core.addMethod(
  18729. $core.method({
  18730. selector: "receiver",
  18731. protocol: "accessing",
  18732. fn: function (){
  18733. var self=this,$self=this;
  18734. return $self["@receiver"];
  18735. },
  18736. args: [],
  18737. source: "receiver\x0a\x09^ receiver",
  18738. referencedClasses: [],
  18739. messageSends: []
  18740. }),
  18741. $globals.MessageSend);
  18742. $core.addMethod(
  18743. $core.method({
  18744. selector: "receiver:",
  18745. protocol: "accessing",
  18746. fn: function (anObject){
  18747. var self=this,$self=this;
  18748. $self["@receiver"]=anObject;
  18749. return self;
  18750. },
  18751. args: ["anObject"],
  18752. source: "receiver: anObject\x0a\x09receiver := anObject",
  18753. referencedClasses: [],
  18754. messageSends: []
  18755. }),
  18756. $globals.MessageSend);
  18757. $core.addMethod(
  18758. $core.method({
  18759. selector: "selector",
  18760. protocol: "accessing",
  18761. fn: function (){
  18762. var self=this,$self=this;
  18763. return $core.withContext(function($ctx1) {
  18764. return $recv($self["@message"])._selector();
  18765. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18766. },
  18767. args: [],
  18768. source: "selector\x0a\x09^ message selector",
  18769. referencedClasses: [],
  18770. messageSends: ["selector"]
  18771. }),
  18772. $globals.MessageSend);
  18773. $core.addMethod(
  18774. $core.method({
  18775. selector: "selector:",
  18776. protocol: "accessing",
  18777. fn: function (aString){
  18778. var self=this,$self=this;
  18779. return $core.withContext(function($ctx1) {
  18780. $recv($self["@message"])._selector_(aString);
  18781. return self;
  18782. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18783. },
  18784. args: ["aString"],
  18785. source: "selector: aString\x0a\x09message selector: aString",
  18786. referencedClasses: [],
  18787. messageSends: ["selector:"]
  18788. }),
  18789. $globals.MessageSend);
  18790. $core.addMethod(
  18791. $core.method({
  18792. selector: "value",
  18793. protocol: "evaluating",
  18794. fn: function (){
  18795. var self=this,$self=this;
  18796. return $core.withContext(function($ctx1) {
  18797. return $recv($self["@message"])._sendTo_($self._receiver());
  18798. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18799. },
  18800. args: [],
  18801. source: "value\x0a\x09^ message sendTo: self receiver",
  18802. referencedClasses: [],
  18803. messageSends: ["sendTo:", "receiver"]
  18804. }),
  18805. $globals.MessageSend);
  18806. $core.addMethod(
  18807. $core.method({
  18808. selector: "value:",
  18809. protocol: "evaluating",
  18810. fn: function (anObject){
  18811. var self=this,$self=this;
  18812. return $core.withContext(function($ctx1) {
  18813. var $1;
  18814. $1=$self["@message"];
  18815. $recv($1)._arguments_([anObject]);
  18816. return $recv($1)._sendTo_($self._receiver());
  18817. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18818. },
  18819. args: ["anObject"],
  18820. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18821. referencedClasses: [],
  18822. messageSends: ["arguments:", "sendTo:", "receiver"]
  18823. }),
  18824. $globals.MessageSend);
  18825. $core.addMethod(
  18826. $core.method({
  18827. selector: "value:value:",
  18828. protocol: "evaluating",
  18829. fn: function (firstArgument,secondArgument){
  18830. var self=this,$self=this;
  18831. return $core.withContext(function($ctx1) {
  18832. var $1;
  18833. $1=$self["@message"];
  18834. $recv($1)._arguments_([firstArgument,secondArgument]);
  18835. return $recv($1)._sendTo_($self._receiver());
  18836. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18837. },
  18838. args: ["firstArgument", "secondArgument"],
  18839. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18840. referencedClasses: [],
  18841. messageSends: ["arguments:", "sendTo:", "receiver"]
  18842. }),
  18843. $globals.MessageSend);
  18844. $core.addMethod(
  18845. $core.method({
  18846. selector: "value:value:value:",
  18847. protocol: "evaluating",
  18848. fn: function (firstArgument,secondArgument,thirdArgument){
  18849. var self=this,$self=this;
  18850. return $core.withContext(function($ctx1) {
  18851. var $1;
  18852. $1=$self["@message"];
  18853. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18854. return $recv($1)._sendTo_($self._receiver());
  18855. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18856. },
  18857. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18858. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18859. referencedClasses: [],
  18860. messageSends: ["arguments:", "sendTo:", "receiver"]
  18861. }),
  18862. $globals.MessageSend);
  18863. $core.addMethod(
  18864. $core.method({
  18865. selector: "valueWithPossibleArguments:",
  18866. protocol: "evaluating",
  18867. fn: function (aCollection){
  18868. var self=this,$self=this;
  18869. return $core.withContext(function($ctx1) {
  18870. $self._arguments_(aCollection);
  18871. return $self._value();
  18872. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18873. },
  18874. args: ["aCollection"],
  18875. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18876. referencedClasses: [],
  18877. messageSends: ["arguments:", "value"]
  18878. }),
  18879. $globals.MessageSend);
  18880. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18881. $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`.";
  18882. $core.addMethod(
  18883. $core.method({
  18884. selector: "asString",
  18885. protocol: "converting",
  18886. fn: function (){
  18887. var self=this,$self=this;
  18888. return $core.withContext(function($ctx1) {
  18889. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18890. $2=$self._isBlockContext();
  18891. if($core.assert($2)){
  18892. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18893. $ctx1.sendIdx[","]=2;
  18894. $1=$recv($3).__comma(")");
  18895. $ctx1.sendIdx[","]=1;
  18896. } else {
  18897. var methodClass;
  18898. methodClass=$recv($self._method())._methodClass();
  18899. $5=methodClass;
  18900. $7=$self._receiver();
  18901. $ctx1.sendIdx["receiver"]=1;
  18902. $6=$recv($7)._class();
  18903. $ctx1.sendIdx["class"]=1;
  18904. $4=$recv($5).__eq($6);
  18905. if($core.assert($4)){
  18906. $11=$self._receiver();
  18907. $ctx1.sendIdx["receiver"]=2;
  18908. $10=$recv($11)._class();
  18909. $ctx1.sendIdx["class"]=2;
  18910. $9=$recv($10)._name();
  18911. $ctx1.sendIdx["name"]=1;
  18912. $8=$recv($9).__comma(" >> ");
  18913. $ctx1.sendIdx[","]=4;
  18914. $12=$self._selector();
  18915. $ctx1.sendIdx["selector"]=1;
  18916. $1=$recv($8).__comma($12);
  18917. $ctx1.sendIdx[","]=3;
  18918. } else {
  18919. $16=$recv($recv($self._receiver())._class())._name();
  18920. $ctx1.sendIdx["name"]=2;
  18921. $15=$recv($16).__comma("(");
  18922. $14=$recv($15).__comma($recv(methodClass)._name());
  18923. $ctx1.sendIdx[","]=7;
  18924. $13=$recv($14).__comma(") >> ");
  18925. $ctx1.sendIdx[","]=6;
  18926. $1=$recv($13).__comma($self._selector());
  18927. $ctx1.sendIdx[","]=5;
  18928. }
  18929. }
  18930. return $1;
  18931. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18932. },
  18933. args: [],
  18934. 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 ] ]",
  18935. referencedClasses: [],
  18936. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18937. }),
  18938. $globals.MethodContext);
  18939. $core.addMethod(
  18940. $core.method({
  18941. selector: "basicReceiver",
  18942. protocol: "accessing",
  18943. fn: function (){
  18944. var self=this,$self=this;
  18945. return $core.withContext(function($ctx1) {
  18946. return self.receiver;
  18947. return self;
  18948. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18949. },
  18950. args: [],
  18951. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18952. referencedClasses: [],
  18953. messageSends: []
  18954. }),
  18955. $globals.MethodContext);
  18956. $core.addMethod(
  18957. $core.method({
  18958. selector: "evaluatedSelector",
  18959. protocol: "accessing",
  18960. fn: function (){
  18961. var self=this,$self=this;
  18962. return $core.withContext(function($ctx1) {
  18963. return self.evaluatedSelector;
  18964. return self;
  18965. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18966. },
  18967. args: [],
  18968. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18969. referencedClasses: [],
  18970. messageSends: []
  18971. }),
  18972. $globals.MethodContext);
  18973. $core.addMethod(
  18974. $core.method({
  18975. selector: "findContextSuchThat:",
  18976. protocol: "accessing",
  18977. fn: function (testBlock){
  18978. var self=this,$self=this;
  18979. var context;
  18980. return $core.withContext(function($ctx1) {
  18981. var $1;
  18982. var $early={};
  18983. try {
  18984. context=self;
  18985. $recv((function(){
  18986. return $core.withContext(function($ctx2) {
  18987. return $recv(context)._isNil();
  18988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18989. }))._whileFalse_((function(){
  18990. return $core.withContext(function($ctx2) {
  18991. $1=$recv(testBlock)._value_(context);
  18992. if($core.assert($1)){
  18993. throw $early=[context];
  18994. }
  18995. context=$recv(context)._outerContext();
  18996. return context;
  18997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  18998. }));
  18999. return nil;
  19000. }
  19001. catch(e) {if(e===$early)return e[0]; throw e}
  19002. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19003. },
  19004. args: ["testBlock"],
  19005. 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",
  19006. referencedClasses: [],
  19007. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19008. }),
  19009. $globals.MethodContext);
  19010. $core.addMethod(
  19011. $core.method({
  19012. selector: "home",
  19013. protocol: "accessing",
  19014. fn: function (){
  19015. var self=this,$self=this;
  19016. return $core.withContext(function($ctx1) {
  19017. return self.homeContext;
  19018. return self;
  19019. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19020. },
  19021. args: [],
  19022. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19023. referencedClasses: [],
  19024. messageSends: []
  19025. }),
  19026. $globals.MethodContext);
  19027. $core.addMethod(
  19028. $core.method({
  19029. selector: "index",
  19030. protocol: "accessing",
  19031. fn: function (){
  19032. var self=this,$self=this;
  19033. return $core.withContext(function($ctx1) {
  19034. return self.index || 0;
  19035. return self;
  19036. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19037. },
  19038. args: [],
  19039. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19040. referencedClasses: [],
  19041. messageSends: []
  19042. }),
  19043. $globals.MethodContext);
  19044. $core.addMethod(
  19045. $core.method({
  19046. selector: "isBlockContext",
  19047. protocol: "testing",
  19048. fn: function (){
  19049. var self=this,$self=this;
  19050. return $core.withContext(function($ctx1) {
  19051. return $recv($self._selector())._isNil();
  19052. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19053. },
  19054. args: [],
  19055. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19056. referencedClasses: [],
  19057. messageSends: ["isNil", "selector"]
  19058. }),
  19059. $globals.MethodContext);
  19060. $core.addMethod(
  19061. $core.method({
  19062. selector: "locals",
  19063. protocol: "accessing",
  19064. fn: function (){
  19065. var self=this,$self=this;
  19066. return $core.withContext(function($ctx1) {
  19067. return self.locals || {};
  19068. return self;
  19069. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19070. },
  19071. args: [],
  19072. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19073. referencedClasses: [],
  19074. messageSends: []
  19075. }),
  19076. $globals.MethodContext);
  19077. $core.addMethod(
  19078. $core.method({
  19079. selector: "method",
  19080. protocol: "accessing",
  19081. fn: function (){
  19082. var self=this,$self=this;
  19083. var method,lookupClass,receiverClass,supercall;
  19084. return $core.withContext(function($ctx1) {
  19085. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19086. $1=$self._methodContext();
  19087. $ctx1.sendIdx["methodContext"]=1;
  19088. if(($receiver = $1) == null || $receiver.a$nil){
  19089. return nil;
  19090. } else {
  19091. $1;
  19092. }
  19093. $3=$self._methodContext();
  19094. $ctx1.sendIdx["methodContext"]=2;
  19095. $2=$recv($3)._receiver();
  19096. receiverClass=$recv($2)._class();
  19097. $4=receiverClass;
  19098. $6=$self._methodContext();
  19099. $ctx1.sendIdx["methodContext"]=3;
  19100. $5=$recv($6)._selector();
  19101. $ctx1.sendIdx["selector"]=1;
  19102. method=$recv($4)._lookupSelector_($5);
  19103. $ctx1.sendIdx["lookupSelector:"]=1;
  19104. $7=$self._outerContext();
  19105. if(($receiver = $7) == null || $receiver.a$nil){
  19106. supercall=false;
  19107. } else {
  19108. var outer;
  19109. outer=$receiver;
  19110. supercall=$recv(outer)._supercall();
  19111. }
  19112. $8=supercall;
  19113. if($core.assert($8)){
  19114. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19115. } else {
  19116. return method;
  19117. }
  19118. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19119. },
  19120. args: [],
  19121. 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 ]",
  19122. referencedClasses: [],
  19123. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19124. }),
  19125. $globals.MethodContext);
  19126. $core.addMethod(
  19127. $core.method({
  19128. selector: "methodContext",
  19129. protocol: "accessing",
  19130. fn: function (){
  19131. var self=this,$self=this;
  19132. return $core.withContext(function($ctx1) {
  19133. var $1,$2,$receiver;
  19134. $1=$self._isBlockContext();
  19135. if(!$core.assert($1)){
  19136. return self;
  19137. }
  19138. $2=$self._outerContext();
  19139. if(($receiver = $2) == null || $receiver.a$nil){
  19140. return $2;
  19141. } else {
  19142. var outer;
  19143. outer=$receiver;
  19144. return $recv(outer)._methodContext();
  19145. }
  19146. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19147. },
  19148. args: [],
  19149. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19150. referencedClasses: [],
  19151. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19152. }),
  19153. $globals.MethodContext);
  19154. $core.addMethod(
  19155. $core.method({
  19156. selector: "outerContext",
  19157. protocol: "accessing",
  19158. fn: function (){
  19159. var self=this,$self=this;
  19160. return $core.withContext(function($ctx1) {
  19161. return self.outerContext || self.homeContext;
  19162. return self;
  19163. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19164. },
  19165. args: [],
  19166. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19167. referencedClasses: [],
  19168. messageSends: []
  19169. }),
  19170. $globals.MethodContext);
  19171. $core.addMethod(
  19172. $core.method({
  19173. selector: "printOn:",
  19174. protocol: "printing",
  19175. fn: function (aStream){
  19176. var self=this,$self=this;
  19177. return $core.withContext(function($ctx1) {
  19178. (
  19179. $ctx1.supercall = true,
  19180. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19181. $ctx1.supercall = false;
  19182. $recv(aStream)._nextPutAll_("(");
  19183. $ctx1.sendIdx["nextPutAll:"]=1;
  19184. $recv(aStream)._nextPutAll_($self._asString());
  19185. $ctx1.sendIdx["nextPutAll:"]=2;
  19186. $recv(aStream)._nextPutAll_(")");
  19187. return self;
  19188. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19189. },
  19190. args: ["aStream"],
  19191. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19192. referencedClasses: [],
  19193. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19194. }),
  19195. $globals.MethodContext);
  19196. $core.addMethod(
  19197. $core.method({
  19198. selector: "receiver",
  19199. protocol: "accessing",
  19200. fn: function (){
  19201. var self=this,$self=this;
  19202. return $core.withContext(function($ctx1) {
  19203. var $2,$1;
  19204. $1=$recv($self._isBlockContext())._and_((function(){
  19205. return $core.withContext(function($ctx2) {
  19206. $2=$self._outerContext();
  19207. $ctx2.sendIdx["outerContext"]=1;
  19208. return $recv($2)._notNil();
  19209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19210. }));
  19211. if($core.assert($1)){
  19212. return $recv($self._outerContext())._receiver();
  19213. } else {
  19214. return $self._basicReceiver();
  19215. }
  19216. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19217. },
  19218. args: [],
  19219. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19220. referencedClasses: [],
  19221. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19222. }),
  19223. $globals.MethodContext);
  19224. $core.addMethod(
  19225. $core.method({
  19226. selector: "selector",
  19227. protocol: "accessing",
  19228. fn: function (){
  19229. var self=this,$self=this;
  19230. return $core.withContext(function($ctx1) {
  19231. if(self.selector) {
  19232. return $core.js2st(self.selector);
  19233. } else {
  19234. return nil;
  19235. }
  19236. ;
  19237. return self;
  19238. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19239. },
  19240. args: [],
  19241. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  19242. referencedClasses: [],
  19243. messageSends: []
  19244. }),
  19245. $globals.MethodContext);
  19246. $core.addMethod(
  19247. $core.method({
  19248. selector: "sendIndexAt:",
  19249. protocol: "accessing",
  19250. fn: function (aSelector){
  19251. var self=this,$self=this;
  19252. return $core.withContext(function($ctx1) {
  19253. return self.sendIdx[aSelector] || 0;
  19254. return self;
  19255. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19256. },
  19257. args: ["aSelector"],
  19258. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19259. referencedClasses: [],
  19260. messageSends: []
  19261. }),
  19262. $globals.MethodContext);
  19263. $core.addMethod(
  19264. $core.method({
  19265. selector: "sendIndexes",
  19266. protocol: "accessing",
  19267. fn: function (){
  19268. var self=this,$self=this;
  19269. return $core.withContext(function($ctx1) {
  19270. return self.sendIdx;
  19271. return self;
  19272. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19273. },
  19274. args: [],
  19275. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19276. referencedClasses: [],
  19277. messageSends: []
  19278. }),
  19279. $globals.MethodContext);
  19280. $core.addMethod(
  19281. $core.method({
  19282. selector: "stubHere",
  19283. protocol: "accessing",
  19284. fn: function (){
  19285. var self=this,$self=this;
  19286. return $core.withContext(function($ctx1) {
  19287. self.homeContext = undefined;
  19288. return self;
  19289. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19290. },
  19291. args: [],
  19292. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19293. referencedClasses: [],
  19294. messageSends: []
  19295. }),
  19296. $globals.MethodContext);
  19297. $core.addMethod(
  19298. $core.method({
  19299. selector: "stubToAtMost:",
  19300. protocol: "error handling",
  19301. fn: function (anInteger){
  19302. var self=this,$self=this;
  19303. var context;
  19304. return $core.withContext(function($ctx1) {
  19305. var $1,$2,$receiver;
  19306. context=self;
  19307. $recv(anInteger)._timesRepeat_((function(){
  19308. return $core.withContext(function($ctx2) {
  19309. $1=context;
  19310. if(($receiver = $1) == null || $receiver.a$nil){
  19311. context=$1;
  19312. } else {
  19313. context=$recv(context)._home();
  19314. }
  19315. return context;
  19316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19317. }));
  19318. $2=context;
  19319. if(($receiver = $2) == null || $receiver.a$nil){
  19320. $2;
  19321. } else {
  19322. $recv(context)._stubHere();
  19323. }
  19324. return self;
  19325. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19326. },
  19327. args: ["anInteger"],
  19328. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19329. referencedClasses: [],
  19330. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19331. }),
  19332. $globals.MethodContext);
  19333. $core.addMethod(
  19334. $core.method({
  19335. selector: "supercall",
  19336. protocol: "accessing",
  19337. fn: function (){
  19338. var self=this,$self=this;
  19339. return $core.withContext(function($ctx1) {
  19340. return self.supercall == true;
  19341. return self;
  19342. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19343. },
  19344. args: [],
  19345. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19346. referencedClasses: [],
  19347. messageSends: []
  19348. }),
  19349. $globals.MethodContext);
  19350. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19351. $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' ]";
  19352. $core.addMethod(
  19353. $core.method({
  19354. selector: "constructorNamed:",
  19355. protocol: "instance creation",
  19356. fn: function (aString){
  19357. var self=this,$self=this;
  19358. return $core.withContext(function($ctx1) {
  19359. var nativeFunc=$globals.Platform._globals()[aString];
  19360. return new nativeFunc();
  19361. ;
  19362. return self;
  19363. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19364. },
  19365. args: ["aString"],
  19366. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19367. referencedClasses: [],
  19368. messageSends: []
  19369. }),
  19370. $globals.NativeFunction.a$cls);
  19371. $core.addMethod(
  19372. $core.method({
  19373. selector: "constructorNamed:value:",
  19374. protocol: "instance creation",
  19375. fn: function (aString,anObject){
  19376. var self=this,$self=this;
  19377. return $core.withContext(function($ctx1) {
  19378. var nativeFunc=$globals.Platform._globals()[aString];
  19379. return new nativeFunc(anObject);
  19380. ;
  19381. return self;
  19382. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19383. },
  19384. args: ["aString", "anObject"],
  19385. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19386. referencedClasses: [],
  19387. messageSends: []
  19388. }),
  19389. $globals.NativeFunction.a$cls);
  19390. $core.addMethod(
  19391. $core.method({
  19392. selector: "constructorNamed:value:value:",
  19393. protocol: "instance creation",
  19394. fn: function (aString,anObject,anObject2){
  19395. var self=this,$self=this;
  19396. return $core.withContext(function($ctx1) {
  19397. var nativeFunc=$globals.Platform._globals[aString];
  19398. return new nativeFunc(anObject,anObject2);
  19399. ;
  19400. return self;
  19401. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19402. },
  19403. args: ["aString", "anObject", "anObject2"],
  19404. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19405. referencedClasses: [],
  19406. messageSends: []
  19407. }),
  19408. $globals.NativeFunction.a$cls);
  19409. $core.addMethod(
  19410. $core.method({
  19411. selector: "constructorNamed:value:value:value:",
  19412. protocol: "instance creation",
  19413. fn: function (aString,anObject,anObject2,anObject3){
  19414. var self=this,$self=this;
  19415. return $core.withContext(function($ctx1) {
  19416. var nativeFunc=$globals.Platform._globals[aString];
  19417. return new nativeFunc(anObject,anObject2, anObject3);
  19418. ;
  19419. return self;
  19420. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19421. },
  19422. args: ["aString", "anObject", "anObject2", "anObject3"],
  19423. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19424. referencedClasses: [],
  19425. messageSends: []
  19426. }),
  19427. $globals.NativeFunction.a$cls);
  19428. $core.addMethod(
  19429. $core.method({
  19430. selector: "constructorOf:",
  19431. protocol: "instance creation",
  19432. fn: function (nativeFunc){
  19433. var self=this,$self=this;
  19434. return $core.withContext(function($ctx1) {
  19435. return new nativeFunc();
  19436. ;
  19437. return self;
  19438. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19439. },
  19440. args: ["nativeFunc"],
  19441. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19442. referencedClasses: [],
  19443. messageSends: []
  19444. }),
  19445. $globals.NativeFunction.a$cls);
  19446. $core.addMethod(
  19447. $core.method({
  19448. selector: "constructorOf:value:",
  19449. protocol: "instance creation",
  19450. fn: function (nativeFunc,anObject){
  19451. var self=this,$self=this;
  19452. return $core.withContext(function($ctx1) {
  19453. return new nativeFunc(anObject);
  19454. ;
  19455. return self;
  19456. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19457. },
  19458. args: ["nativeFunc", "anObject"],
  19459. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19460. referencedClasses: [],
  19461. messageSends: []
  19462. }),
  19463. $globals.NativeFunction.a$cls);
  19464. $core.addMethod(
  19465. $core.method({
  19466. selector: "constructorOf:value:value:",
  19467. protocol: "instance creation",
  19468. fn: function (nativeFunc,anObject,anObject2){
  19469. var self=this,$self=this;
  19470. return $core.withContext(function($ctx1) {
  19471. return new nativeFunc(anObject,anObject2);
  19472. ;
  19473. return self;
  19474. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19475. },
  19476. args: ["nativeFunc", "anObject", "anObject2"],
  19477. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19478. referencedClasses: [],
  19479. messageSends: []
  19480. }),
  19481. $globals.NativeFunction.a$cls);
  19482. $core.addMethod(
  19483. $core.method({
  19484. selector: "constructorOf:value:value:value:",
  19485. protocol: "instance creation",
  19486. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19487. var self=this,$self=this;
  19488. return $core.withContext(function($ctx1) {
  19489. return new nativeFunc(anObject,anObject2, anObject3);
  19490. ;
  19491. return self;
  19492. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19493. },
  19494. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19495. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19496. referencedClasses: [],
  19497. messageSends: []
  19498. }),
  19499. $globals.NativeFunction.a$cls);
  19500. $core.addMethod(
  19501. $core.method({
  19502. selector: "exists:",
  19503. protocol: "testing",
  19504. fn: function (aString){
  19505. var self=this,$self=this;
  19506. return $core.withContext(function($ctx1) {
  19507. return $recv($globals.Platform)._includesGlobal_(aString);
  19508. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19509. },
  19510. args: ["aString"],
  19511. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19512. referencedClasses: ["Platform"],
  19513. messageSends: ["includesGlobal:"]
  19514. }),
  19515. $globals.NativeFunction.a$cls);
  19516. $core.addMethod(
  19517. $core.method({
  19518. selector: "functionNamed:",
  19519. protocol: "function calling",
  19520. fn: function (aString){
  19521. var self=this,$self=this;
  19522. return $core.withContext(function($ctx1) {
  19523. var nativeFunc=$globals.Platform._globals[aString];
  19524. return nativeFunc();
  19525. ;
  19526. return self;
  19527. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19528. },
  19529. args: ["aString"],
  19530. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19531. referencedClasses: [],
  19532. messageSends: []
  19533. }),
  19534. $globals.NativeFunction.a$cls);
  19535. $core.addMethod(
  19536. $core.method({
  19537. selector: "functionNamed:value:",
  19538. protocol: "function calling",
  19539. fn: function (aString,anObject){
  19540. var self=this,$self=this;
  19541. return $core.withContext(function($ctx1) {
  19542. var nativeFunc=$globals.Platform._globals()[aString];
  19543. return nativeFunc(anObject);
  19544. ;
  19545. return self;
  19546. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19547. },
  19548. args: ["aString", "anObject"],
  19549. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19550. referencedClasses: [],
  19551. messageSends: []
  19552. }),
  19553. $globals.NativeFunction.a$cls);
  19554. $core.addMethod(
  19555. $core.method({
  19556. selector: "functionNamed:value:value:",
  19557. protocol: "function calling",
  19558. fn: function (aString,anObject,anObject2){
  19559. var self=this,$self=this;
  19560. return $core.withContext(function($ctx1) {
  19561. var nativeFunc=$globals.Platform._globals()[aString];
  19562. return nativeFunc(anObject,anObject2);
  19563. ;
  19564. return self;
  19565. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19566. },
  19567. args: ["aString", "anObject", "anObject2"],
  19568. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19569. referencedClasses: [],
  19570. messageSends: []
  19571. }),
  19572. $globals.NativeFunction.a$cls);
  19573. $core.addMethod(
  19574. $core.method({
  19575. selector: "functionNamed:value:value:value:",
  19576. protocol: "function calling",
  19577. fn: function (aString,anObject,anObject2,anObject3){
  19578. var self=this,$self=this;
  19579. return $core.withContext(function($ctx1) {
  19580. var nativeFunc=$globals.Platform._globals()[aString];
  19581. return nativeFunc(anObject,anObject2, anObject3);
  19582. ;
  19583. return self;
  19584. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19585. },
  19586. args: ["aString", "anObject", "anObject2", "anObject3"],
  19587. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19588. referencedClasses: [],
  19589. messageSends: []
  19590. }),
  19591. $globals.NativeFunction.a$cls);
  19592. $core.addMethod(
  19593. $core.method({
  19594. selector: "functionNamed:valueWithArgs:",
  19595. protocol: "function calling",
  19596. fn: function (aString,args){
  19597. var self=this,$self=this;
  19598. return $core.withContext(function($ctx1) {
  19599. var nativeFunc=$globals.Platform._globals()[aString];
  19600. return Function.prototype.apply.call(nativeFunc, null, args);
  19601. ;
  19602. return self;
  19603. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19604. },
  19605. args: ["aString", "args"],
  19606. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19607. referencedClasses: [],
  19608. messageSends: []
  19609. }),
  19610. $globals.NativeFunction.a$cls);
  19611. $core.addMethod(
  19612. $core.method({
  19613. selector: "functionOf:",
  19614. protocol: "function calling",
  19615. fn: function (nativeFunc){
  19616. var self=this,$self=this;
  19617. return $core.withContext(function($ctx1) {
  19618. return nativeFunc();
  19619. ;
  19620. return self;
  19621. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19622. },
  19623. args: ["nativeFunc"],
  19624. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19625. referencedClasses: [],
  19626. messageSends: []
  19627. }),
  19628. $globals.NativeFunction.a$cls);
  19629. $core.addMethod(
  19630. $core.method({
  19631. selector: "functionOf:value:",
  19632. protocol: "function calling",
  19633. fn: function (nativeFunc,anObject){
  19634. var self=this,$self=this;
  19635. return $core.withContext(function($ctx1) {
  19636. return nativeFunc(anObject);
  19637. ;
  19638. return self;
  19639. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19640. },
  19641. args: ["nativeFunc", "anObject"],
  19642. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19643. referencedClasses: [],
  19644. messageSends: []
  19645. }),
  19646. $globals.NativeFunction.a$cls);
  19647. $core.addMethod(
  19648. $core.method({
  19649. selector: "functionOf:value:value:",
  19650. protocol: "function calling",
  19651. fn: function (nativeFunc,anObject,anObject2){
  19652. var self=this,$self=this;
  19653. return $core.withContext(function($ctx1) {
  19654. return nativeFunc(anObject,anObject2);
  19655. ;
  19656. return self;
  19657. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19658. },
  19659. args: ["nativeFunc", "anObject", "anObject2"],
  19660. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19661. referencedClasses: [],
  19662. messageSends: []
  19663. }),
  19664. $globals.NativeFunction.a$cls);
  19665. $core.addMethod(
  19666. $core.method({
  19667. selector: "functionOf:value:value:value:",
  19668. protocol: "function calling",
  19669. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19670. var self=this,$self=this;
  19671. return $core.withContext(function($ctx1) {
  19672. return nativeFunc(anObject,anObject2, anObject3);
  19673. ;
  19674. return self;
  19675. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19676. },
  19677. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19678. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19679. referencedClasses: [],
  19680. messageSends: []
  19681. }),
  19682. $globals.NativeFunction.a$cls);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "functionOf:valueWithArgs:",
  19686. protocol: "function calling",
  19687. fn: function (nativeFunc,args){
  19688. var self=this,$self=this;
  19689. return $core.withContext(function($ctx1) {
  19690. return Function.prototype.apply.call(nativeFunc, null, args);
  19691. ;
  19692. return self;
  19693. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19694. },
  19695. args: ["nativeFunc", "args"],
  19696. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19697. referencedClasses: [],
  19698. messageSends: []
  19699. }),
  19700. $globals.NativeFunction.a$cls);
  19701. $core.addMethod(
  19702. $core.method({
  19703. selector: "isNativeFunction:",
  19704. protocol: "testing",
  19705. fn: function (anObject){
  19706. var self=this,$self=this;
  19707. return $core.withContext(function($ctx1) {
  19708. return typeof anObject === "function";
  19709. return self;
  19710. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19711. },
  19712. args: ["anObject"],
  19713. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19714. referencedClasses: [],
  19715. messageSends: []
  19716. }),
  19717. $globals.NativeFunction.a$cls);
  19718. $core.addMethod(
  19719. $core.method({
  19720. selector: "methodOf:this:",
  19721. protocol: "method calling",
  19722. fn: function (nativeFunc,thisObject){
  19723. var self=this,$self=this;
  19724. return $core.withContext(function($ctx1) {
  19725. return Function.prototype.call.call(nativeFunc, thisObject);
  19726. ;
  19727. return self;
  19728. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19729. },
  19730. args: ["nativeFunc", "thisObject"],
  19731. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19732. referencedClasses: [],
  19733. messageSends: []
  19734. }),
  19735. $globals.NativeFunction.a$cls);
  19736. $core.addMethod(
  19737. $core.method({
  19738. selector: "methodOf:this:value:",
  19739. protocol: "method calling",
  19740. fn: function (nativeFunc,thisObject,anObject){
  19741. var self=this,$self=this;
  19742. return $core.withContext(function($ctx1) {
  19743. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19744. ;
  19745. return self;
  19746. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19747. },
  19748. args: ["nativeFunc", "thisObject", "anObject"],
  19749. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19750. referencedClasses: [],
  19751. messageSends: []
  19752. }),
  19753. $globals.NativeFunction.a$cls);
  19754. $core.addMethod(
  19755. $core.method({
  19756. selector: "methodOf:this:value:value:",
  19757. protocol: "method calling",
  19758. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19759. var self=this,$self=this;
  19760. return $core.withContext(function($ctx1) {
  19761. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19762. ;
  19763. return self;
  19764. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19765. },
  19766. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19767. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
  19768. referencedClasses: [],
  19769. messageSends: []
  19770. }),
  19771. $globals.NativeFunction.a$cls);
  19772. $core.addMethod(
  19773. $core.method({
  19774. selector: "methodOf:this:value:value:value:",
  19775. protocol: "method calling",
  19776. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19777. var self=this,$self=this;
  19778. return $core.withContext(function($ctx1) {
  19779. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19780. ;
  19781. return self;
  19782. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19783. },
  19784. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19785. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
  19786. referencedClasses: [],
  19787. messageSends: []
  19788. }),
  19789. $globals.NativeFunction.a$cls);
  19790. $core.addMethod(
  19791. $core.method({
  19792. selector: "methodOf:this:valueWithArgs:",
  19793. protocol: "method calling",
  19794. fn: function (nativeFunc,thisObject,args){
  19795. var self=this,$self=this;
  19796. return $core.withContext(function($ctx1) {
  19797. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19798. ;
  19799. return self;
  19800. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19801. },
  19802. args: ["nativeFunc", "thisObject", "args"],
  19803. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19804. referencedClasses: [],
  19805. messageSends: []
  19806. }),
  19807. $globals.NativeFunction.a$cls);
  19808. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19809. $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.";
  19810. $core.addMethod(
  19811. $core.method({
  19812. selector: "clearInterval",
  19813. protocol: "timeout/interval",
  19814. fn: function (){
  19815. var self=this,$self=this;
  19816. return $core.withContext(function($ctx1) {
  19817. var interval = $self["@rawTimeout"];
  19818. clearInterval(interval);
  19819. ;
  19820. return self;
  19821. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19822. },
  19823. args: [],
  19824. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19825. referencedClasses: [],
  19826. messageSends: []
  19827. }),
  19828. $globals.Timeout);
  19829. $core.addMethod(
  19830. $core.method({
  19831. selector: "clearTimeout",
  19832. protocol: "timeout/interval",
  19833. fn: function (){
  19834. var self=this,$self=this;
  19835. return $core.withContext(function($ctx1) {
  19836. var timeout = $self["@rawTimeout"];
  19837. clearTimeout(timeout);
  19838. ;
  19839. return self;
  19840. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19841. },
  19842. args: [],
  19843. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19844. referencedClasses: [],
  19845. messageSends: []
  19846. }),
  19847. $globals.Timeout);
  19848. $core.addMethod(
  19849. $core.method({
  19850. selector: "rawTimeout:",
  19851. protocol: "accessing",
  19852. fn: function (anObject){
  19853. var self=this,$self=this;
  19854. $self["@rawTimeout"]=anObject;
  19855. return self;
  19856. },
  19857. args: ["anObject"],
  19858. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19859. referencedClasses: [],
  19860. messageSends: []
  19861. }),
  19862. $globals.Timeout);
  19863. $core.addMethod(
  19864. $core.method({
  19865. selector: "on:",
  19866. protocol: "instance creation",
  19867. fn: function (anObject){
  19868. var self=this,$self=this;
  19869. return $core.withContext(function($ctx1) {
  19870. var $1;
  19871. $1=$self._new();
  19872. $recv($1)._rawTimeout_(anObject);
  19873. return $recv($1)._yourself();
  19874. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19875. },
  19876. args: ["anObject"],
  19877. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19878. referencedClasses: [],
  19879. messageSends: ["rawTimeout:", "new", "yourself"]
  19880. }),
  19881. $globals.Timeout.a$cls);
  19882. });
  19883. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19884. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19885. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19886. var $pkg = $core.addPackage("Kernel-Dag");
  19887. $pkg.innerEval = function (expr) { return eval(expr); };
  19888. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  19889. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19890. $globals.AbstractDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aConcrete classes should implement `visitDagNode:`,\x0athey can reuse possible variants of implementation\x0aoffered directly: `visitDagNodeVariantSimple:`\x0aand `visitDagNodeVariantRedux:`.";
  19891. $core.addMethod(
  19892. $core.method({
  19893. selector: "value:",
  19894. protocol: "evaluating",
  19895. fn: function (anObject){
  19896. var self=this,$self=this;
  19897. return $core.withContext(function($ctx1) {
  19898. return $self._visit_(anObject);
  19899. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19900. },
  19901. args: ["anObject"],
  19902. source: "value: anObject\x0a\x09^ self visit: anObject",
  19903. referencedClasses: [],
  19904. messageSends: ["visit:"]
  19905. }),
  19906. $globals.AbstractDagVisitor);
  19907. $core.addMethod(
  19908. $core.method({
  19909. selector: "visit:",
  19910. protocol: "visiting",
  19911. fn: function (aNode){
  19912. var self=this,$self=this;
  19913. return $core.withContext(function($ctx1) {
  19914. return $recv(aNode)._acceptDagVisitor_(self);
  19915. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19916. },
  19917. args: ["aNode"],
  19918. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19919. referencedClasses: [],
  19920. messageSends: ["acceptDagVisitor:"]
  19921. }),
  19922. $globals.AbstractDagVisitor);
  19923. $core.addMethod(
  19924. $core.method({
  19925. selector: "visitAll:",
  19926. protocol: "visiting",
  19927. fn: function (aCollection){
  19928. var self=this,$self=this;
  19929. return $core.withContext(function($ctx1) {
  19930. return $recv(aCollection)._collect_((function(each){
  19931. return $core.withContext(function($ctx2) {
  19932. return $self._visit_(each);
  19933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19934. }));
  19935. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19936. },
  19937. args: ["aCollection"],
  19938. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19939. referencedClasses: [],
  19940. messageSends: ["collect:", "visit:"]
  19941. }),
  19942. $globals.AbstractDagVisitor);
  19943. $core.addMethod(
  19944. $core.method({
  19945. selector: "visitAllChildren:",
  19946. protocol: "visiting",
  19947. fn: function (aDagNode){
  19948. var self=this,$self=this;
  19949. return $core.withContext(function($ctx1) {
  19950. return $self._visitAll_($recv(aDagNode)._dagChildren());
  19951. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19952. },
  19953. args: ["aDagNode"],
  19954. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19955. referencedClasses: [],
  19956. messageSends: ["visitAll:", "dagChildren"]
  19957. }),
  19958. $globals.AbstractDagVisitor);
  19959. $core.addMethod(
  19960. $core.method({
  19961. selector: "visitDagNode:",
  19962. protocol: "visiting",
  19963. fn: function (aNode){
  19964. var self=this,$self=this;
  19965. return $core.withContext(function($ctx1) {
  19966. $self._subclassResponsibility();
  19967. return self;
  19968. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19969. },
  19970. args: ["aNode"],
  19971. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19972. referencedClasses: [],
  19973. messageSends: ["subclassResponsibility"]
  19974. }),
  19975. $globals.AbstractDagVisitor);
  19976. $core.addMethod(
  19977. $core.method({
  19978. selector: "visitDagNodeVariantRedux:",
  19979. protocol: "visiting",
  19980. fn: function (aNode){
  19981. var self=this,$self=this;
  19982. var newChildren,oldChildren;
  19983. return $core.withContext(function($ctx1) {
  19984. var $2,$3,$1,$4,$5;
  19985. var $early={};
  19986. try {
  19987. oldChildren=$recv(aNode)._dagChildren();
  19988. newChildren=$self._visitAllChildren_(aNode);
  19989. $2=$recv(oldChildren)._size();
  19990. $ctx1.sendIdx["size"]=1;
  19991. $3=$recv(newChildren)._size();
  19992. $ctx1.sendIdx["size"]=2;
  19993. $1=$recv($2).__eq($3);
  19994. if($core.assert($1)){
  19995. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19996. return $core.withContext(function($ctx2) {
  19997. $4=$recv(oldChildren)._at_(i);
  19998. $ctx2.sendIdx["at:"]=1;
  19999. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20000. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20001. }),(function(){
  20002. throw $early=[aNode];
  20003. }));
  20004. }
  20005. $5=$recv(aNode)._copy();
  20006. $recv($5)._dagChildren_(newChildren);
  20007. return $recv($5)._yourself();
  20008. }
  20009. catch(e) {if(e===$early)return e[0]; throw e}
  20010. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20011. },
  20012. args: ["aNode"],
  20013. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  20014. referencedClasses: [],
  20015. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20016. }),
  20017. $globals.AbstractDagVisitor);
  20018. $core.addMethod(
  20019. $core.method({
  20020. selector: "visitDagNodeVariantSimple:",
  20021. protocol: "visiting",
  20022. fn: function (aNode){
  20023. var self=this,$self=this;
  20024. return $core.withContext(function($ctx1) {
  20025. $self._visitAllChildren_(aNode);
  20026. return aNode;
  20027. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20028. },
  20029. args: ["aNode"],
  20030. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20031. referencedClasses: [],
  20032. messageSends: ["visitAllChildren:"]
  20033. }),
  20034. $globals.AbstractDagVisitor);
  20035. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20036. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20037. $core.addMethod(
  20038. $core.method({
  20039. selector: "initialize",
  20040. protocol: "initialization",
  20041. fn: function (){
  20042. var self=this,$self=this;
  20043. return $core.withContext(function($ctx1) {
  20044. (
  20045. $ctx1.supercall = true,
  20046. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20047. $ctx1.supercall = false;
  20048. $self["@path"]=[];
  20049. return self;
  20050. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20051. },
  20052. args: [],
  20053. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20054. referencedClasses: [],
  20055. messageSends: ["initialize"]
  20056. }),
  20057. $globals.PathDagVisitor);
  20058. $core.addMethod(
  20059. $core.method({
  20060. selector: "path",
  20061. protocol: "accessing",
  20062. fn: function (){
  20063. var self=this,$self=this;
  20064. return $self["@path"];
  20065. },
  20066. args: [],
  20067. source: "path\x0a\x09^ path",
  20068. referencedClasses: [],
  20069. messageSends: []
  20070. }),
  20071. $globals.PathDagVisitor);
  20072. $core.addMethod(
  20073. $core.method({
  20074. selector: "visit:",
  20075. protocol: "visiting",
  20076. fn: function (aNode){
  20077. var self=this,$self=this;
  20078. var oldPath,result;
  20079. return $core.withContext(function($ctx1) {
  20080. result=aNode;
  20081. oldPath=$self["@path"];
  20082. $recv((function(){
  20083. return $core.withContext(function($ctx2) {
  20084. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20085. result=(
  20086. $ctx2.supercall = true,
  20087. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20088. $ctx2.supercall = false;
  20089. return result;
  20090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20091. }))._ensure_((function(){
  20092. $self["@path"]=oldPath;
  20093. return $self["@path"];
  20094. }));
  20095. return result;
  20096. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20097. },
  20098. args: ["aNode"],
  20099. source: "visit: aNode\x0a\x09| oldPath result |\x0a\x09result := aNode.\x0a\x09oldPath := path.\x0a\x09[\x0a\x09\x09path := path, {aNode}.\x0a\x09\x09result := super visit: aNode\x0a\x09] ensure: [ path := oldPath ].\x0a\x09^ result",
  20100. referencedClasses: [],
  20101. messageSends: ["ensure:", ",", "visit:"]
  20102. }),
  20103. $globals.PathDagVisitor);
  20104. $core.addMethod(
  20105. $core.method({
  20106. selector: "visitDagNodeVariantRedux:",
  20107. protocol: "visiting",
  20108. fn: function (aNode){
  20109. var self=this,$self=this;
  20110. var newNode;
  20111. return $core.withContext(function($ctx1) {
  20112. var $1;
  20113. newNode=(
  20114. $ctx1.supercall = true,
  20115. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20116. $ctx1.supercall = false;
  20117. $1=$recv(aNode).__eq_eq(newNode);
  20118. if(!$core.assert($1)){
  20119. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20120. }
  20121. return newNode;
  20122. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20123. },
  20124. args: ["aNode"],
  20125. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20126. referencedClasses: [],
  20127. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20128. }),
  20129. $globals.PathDagVisitor);
  20130. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20131. $globals.DagNode.comment="I am the abstract root class of any directed acyclic graph.\x0a\x0aConcrete classes should implement `dagChildren` and `dagChildren:`\x0ato get / set direct successor nodes (aka child nodes / subnodes).";
  20132. $core.addMethod(
  20133. $core.method({
  20134. selector: "acceptDagVisitor:",
  20135. protocol: "visiting",
  20136. fn: function (aVisitor){
  20137. var self=this,$self=this;
  20138. return $core.withContext(function($ctx1) {
  20139. return $recv(aVisitor)._visitDagNode_(self);
  20140. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20141. },
  20142. args: ["aVisitor"],
  20143. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20144. referencedClasses: [],
  20145. messageSends: ["visitDagNode:"]
  20146. }),
  20147. $globals.DagNode);
  20148. $core.addMethod(
  20149. $core.method({
  20150. selector: "allDagChildren",
  20151. protocol: "accessing",
  20152. fn: function (){
  20153. var self=this,$self=this;
  20154. var allNodes;
  20155. return $core.withContext(function($ctx1) {
  20156. var $1;
  20157. $1=$self._dagChildren();
  20158. $ctx1.sendIdx["dagChildren"]=1;
  20159. allNodes=$recv($1)._asSet();
  20160. $recv($self._dagChildren())._do_((function(each){
  20161. return $core.withContext(function($ctx2) {
  20162. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20164. }));
  20165. return allNodes;
  20166. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20167. },
  20168. args: [],
  20169. source: "allDagChildren\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self dagChildren asSet.\x0a\x09self dagChildren do: [ :each | \x0a\x09\x09allNodes addAll: each allDagChildren ].\x0a\x09\x0a\x09^ allNodes",
  20170. referencedClasses: [],
  20171. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20172. }),
  20173. $globals.DagNode);
  20174. $core.addMethod(
  20175. $core.method({
  20176. selector: "dagChildren",
  20177. protocol: "accessing",
  20178. fn: function (){
  20179. var self=this,$self=this;
  20180. return $core.withContext(function($ctx1) {
  20181. $self._subclassResponsibility();
  20182. return self;
  20183. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20184. },
  20185. args: [],
  20186. source: "dagChildren\x0a\x09self subclassResponsibility",
  20187. referencedClasses: [],
  20188. messageSends: ["subclassResponsibility"]
  20189. }),
  20190. $globals.DagNode);
  20191. $core.addMethod(
  20192. $core.method({
  20193. selector: "dagChildren:",
  20194. protocol: "accessing",
  20195. fn: function (aCollection){
  20196. var self=this,$self=this;
  20197. return $core.withContext(function($ctx1) {
  20198. $self._subclassResponsibility();
  20199. return self;
  20200. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20201. },
  20202. args: ["aCollection"],
  20203. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20204. referencedClasses: [],
  20205. messageSends: ["subclassResponsibility"]
  20206. }),
  20207. $globals.DagNode);
  20208. $core.addMethod(
  20209. $core.method({
  20210. selector: "isDagNode",
  20211. protocol: "testing",
  20212. fn: function (){
  20213. var self=this,$self=this;
  20214. return true;
  20215. },
  20216. args: [],
  20217. source: "isDagNode\x0a\x09^ true",
  20218. referencedClasses: [],
  20219. messageSends: []
  20220. }),
  20221. $globals.DagNode);
  20222. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20223. $globals.DagParentNode.comment="I am `DagNode` that stores a collection of its children,\x0alazy initialized to empty array.\x0a\x0aI can `addDagChild:` to add a child.";
  20224. $core.addMethod(
  20225. $core.method({
  20226. selector: "addDagChild:",
  20227. protocol: "accessing",
  20228. fn: function (aDagNode){
  20229. var self=this,$self=this;
  20230. return $core.withContext(function($ctx1) {
  20231. $recv($self._dagChildren())._add_(aDagNode);
  20232. return self;
  20233. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20234. },
  20235. args: ["aDagNode"],
  20236. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20237. referencedClasses: [],
  20238. messageSends: ["add:", "dagChildren"]
  20239. }),
  20240. $globals.DagParentNode);
  20241. $core.addMethod(
  20242. $core.method({
  20243. selector: "dagChildren",
  20244. protocol: "accessing",
  20245. fn: function (){
  20246. var self=this,$self=this;
  20247. return $core.withContext(function($ctx1) {
  20248. var $1,$receiver;
  20249. $1=$self["@nodes"];
  20250. if(($receiver = $1) == null || $receiver.a$nil){
  20251. $self["@nodes"]=$recv($globals.Array)._new();
  20252. return $self["@nodes"];
  20253. } else {
  20254. return $1;
  20255. }
  20256. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20257. },
  20258. args: [],
  20259. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20260. referencedClasses: ["Array"],
  20261. messageSends: ["ifNil:", "new"]
  20262. }),
  20263. $globals.DagParentNode);
  20264. $core.addMethod(
  20265. $core.method({
  20266. selector: "dagChildren:",
  20267. protocol: "accessing",
  20268. fn: function (aCollection){
  20269. var self=this,$self=this;
  20270. $self["@nodes"]=aCollection;
  20271. return self;
  20272. },
  20273. args: ["aCollection"],
  20274. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20275. referencedClasses: [],
  20276. messageSends: []
  20277. }),
  20278. $globals.DagParentNode);
  20279. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20280. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20281. $core.addMethod(
  20282. $core.method({
  20283. selector: "dagChildren",
  20284. protocol: "accessing",
  20285. fn: function (){
  20286. var self=this,$self=this;
  20287. return [];
  20288. },
  20289. args: [],
  20290. source: "dagChildren\x0a\x09^ #()",
  20291. referencedClasses: [],
  20292. messageSends: []
  20293. }),
  20294. $globals.DagSink);
  20295. $core.addMethod(
  20296. $core.method({
  20297. selector: "dagChildren:",
  20298. protocol: "accessing",
  20299. fn: function (aCollection){
  20300. var self=this,$self=this;
  20301. return $core.withContext(function($ctx1) {
  20302. $recv(aCollection)._ifNotEmpty_((function(){
  20303. return $core.withContext(function($ctx2) {
  20304. return $self._error_("A DagSink cannot have children.");
  20305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20306. }));
  20307. return self;
  20308. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20309. },
  20310. args: ["aCollection"],
  20311. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20312. referencedClasses: [],
  20313. messageSends: ["ifNotEmpty:", "error:"]
  20314. }),
  20315. $globals.DagSink);
  20316. $core.addMethod(
  20317. $core.method({
  20318. selector: "isDagNode",
  20319. protocol: "*Kernel-Dag",
  20320. fn: function (){
  20321. var self=this,$self=this;
  20322. return false;
  20323. },
  20324. args: [],
  20325. source: "isDagNode\x0a\x09^ false",
  20326. referencedClasses: [],
  20327. messageSends: []
  20328. }),
  20329. $globals.Object);
  20330. });
  20331. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20332. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20333. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20334. var $pkg = $core.addPackage("Kernel-Exceptions");
  20335. $pkg.innerEval = function (expr) { return eval(expr); };
  20336. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  20337. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20338. $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.";
  20339. $core.addMethod(
  20340. $core.method({
  20341. selector: "beHandled",
  20342. protocol: "accessing",
  20343. fn: function (){
  20344. var self=this,$self=this;
  20345. return $core.withContext(function($ctx1) {
  20346. self.amberHandled = true;
  20347. return self;
  20348. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20349. },
  20350. args: [],
  20351. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20352. referencedClasses: [],
  20353. messageSends: []
  20354. }),
  20355. $globals.Error);
  20356. $core.addMethod(
  20357. $core.method({
  20358. selector: "beUnhandled",
  20359. protocol: "accessing",
  20360. fn: function (){
  20361. var self=this,$self=this;
  20362. return $core.withContext(function($ctx1) {
  20363. self.amberHandled = false;
  20364. return self;
  20365. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20366. },
  20367. args: [],
  20368. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20369. referencedClasses: [],
  20370. messageSends: []
  20371. }),
  20372. $globals.Error);
  20373. $core.addMethod(
  20374. $core.method({
  20375. selector: "context",
  20376. protocol: "accessing",
  20377. fn: function (){
  20378. var self=this,$self=this;
  20379. return $core.withContext(function($ctx1) {
  20380. return self.context;
  20381. return self;
  20382. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20383. },
  20384. args: [],
  20385. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20386. referencedClasses: [],
  20387. messageSends: []
  20388. }),
  20389. $globals.Error);
  20390. $core.addMethod(
  20391. $core.method({
  20392. selector: "initialize",
  20393. protocol: "initialization",
  20394. fn: function (){
  20395. var self=this,$self=this;
  20396. return $core.withContext(function($ctx1) {
  20397. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20398. return self;
  20399. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20400. },
  20401. args: [],
  20402. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20403. referencedClasses: [],
  20404. messageSends: ["messageText:", ",", "name", "class"]
  20405. }),
  20406. $globals.Error);
  20407. $core.addMethod(
  20408. $core.method({
  20409. selector: "isSmalltalkError",
  20410. protocol: "testing",
  20411. fn: function (){
  20412. var self=this,$self=this;
  20413. return $core.withContext(function($ctx1) {
  20414. return self.smalltalkError === true;
  20415. return self;
  20416. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20417. },
  20418. args: [],
  20419. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20420. referencedClasses: [],
  20421. messageSends: []
  20422. }),
  20423. $globals.Error);
  20424. $core.addMethod(
  20425. $core.method({
  20426. selector: "jsStack",
  20427. protocol: "accessing",
  20428. fn: function (){
  20429. var self=this,$self=this;
  20430. return $core.withContext(function($ctx1) {
  20431. return self.stack;
  20432. return self;
  20433. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20434. },
  20435. args: [],
  20436. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20437. referencedClasses: [],
  20438. messageSends: []
  20439. }),
  20440. $globals.Error);
  20441. $core.addMethod(
  20442. $core.method({
  20443. selector: "messageText",
  20444. protocol: "accessing",
  20445. fn: function (){
  20446. var self=this,$self=this;
  20447. return $self["@messageText"];
  20448. },
  20449. args: [],
  20450. source: "messageText\x0a\x09^ messageText",
  20451. referencedClasses: [],
  20452. messageSends: []
  20453. }),
  20454. $globals.Error);
  20455. $core.addMethod(
  20456. $core.method({
  20457. selector: "messageText:",
  20458. protocol: "accessing",
  20459. fn: function (aString){
  20460. var self=this,$self=this;
  20461. $self["@messageText"]=aString;
  20462. return self;
  20463. },
  20464. args: ["aString"],
  20465. source: "messageText: aString\x0a\x09messageText := aString",
  20466. referencedClasses: [],
  20467. messageSends: []
  20468. }),
  20469. $globals.Error);
  20470. $core.addMethod(
  20471. $core.method({
  20472. selector: "outer",
  20473. protocol: "signaling",
  20474. fn: function (){
  20475. var self=this,$self=this;
  20476. return $core.withContext(function($ctx1) {
  20477. return $self._pass();
  20478. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20479. },
  20480. args: [],
  20481. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20482. referencedClasses: [],
  20483. messageSends: ["pass"]
  20484. }),
  20485. $globals.Error);
  20486. $core.addMethod(
  20487. $core.method({
  20488. selector: "pass",
  20489. protocol: "signaling",
  20490. fn: function (){
  20491. var self=this,$self=this;
  20492. return $core.withContext(function($ctx1) {
  20493. self.amberHandled = false;
  20494. throw self;
  20495. ;
  20496. return self;
  20497. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20498. },
  20499. args: [],
  20500. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20501. referencedClasses: [],
  20502. messageSends: []
  20503. }),
  20504. $globals.Error);
  20505. $core.addMethod(
  20506. $core.method({
  20507. selector: "resignal",
  20508. protocol: "signaling",
  20509. fn: function (){
  20510. var self=this,$self=this;
  20511. return $core.withContext(function($ctx1) {
  20512. $self._deprecatedAPI_("Use #pass.");
  20513. return $self._pass();
  20514. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20515. },
  20516. args: [],
  20517. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20518. referencedClasses: [],
  20519. messageSends: ["deprecatedAPI:", "pass"]
  20520. }),
  20521. $globals.Error);
  20522. $core.addMethod(
  20523. $core.method({
  20524. selector: "signal",
  20525. protocol: "signaling",
  20526. fn: function (){
  20527. var self=this,$self=this;
  20528. return $core.withContext(function($ctx1) {
  20529. self.amberHandled = false;
  20530. self.context = $core.getThisContext();
  20531. self.smalltalkError = true;
  20532. throw self;
  20533. ;
  20534. return self;
  20535. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20536. },
  20537. args: [],
  20538. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  20539. referencedClasses: [],
  20540. messageSends: []
  20541. }),
  20542. $globals.Error);
  20543. $core.addMethod(
  20544. $core.method({
  20545. selector: "signal:",
  20546. protocol: "signaling",
  20547. fn: function (aString){
  20548. var self=this,$self=this;
  20549. return $core.withContext(function($ctx1) {
  20550. $self._messageText_(aString);
  20551. $self._signal();
  20552. return self;
  20553. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20554. },
  20555. args: ["aString"],
  20556. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20557. referencedClasses: [],
  20558. messageSends: ["messageText:", "signal"]
  20559. }),
  20560. $globals.Error);
  20561. $core.addMethod(
  20562. $core.method({
  20563. selector: "signalerContext",
  20564. protocol: "accessing",
  20565. fn: function (){
  20566. var self=this,$self=this;
  20567. return $core.withContext(function($ctx1) {
  20568. return $self._signalerContextFrom_($self._context());
  20569. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20570. },
  20571. args: [],
  20572. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20573. referencedClasses: [],
  20574. messageSends: ["signalerContextFrom:", "context"]
  20575. }),
  20576. $globals.Error);
  20577. $core.addMethod(
  20578. $core.method({
  20579. selector: "signalerContextFrom:",
  20580. protocol: "accessing",
  20581. fn: function (aContext){
  20582. var self=this,$self=this;
  20583. return $core.withContext(function($ctx1) {
  20584. var $3,$2,$1;
  20585. return $recv(aContext)._findContextSuchThat_((function(context){
  20586. return $core.withContext(function($ctx2) {
  20587. $3=$recv(context)._receiver();
  20588. $ctx2.sendIdx["receiver"]=1;
  20589. $2=$recv($3).__eq_eq(self);
  20590. $ctx2.sendIdx["=="]=1;
  20591. $1=$recv($2)._or_((function(){
  20592. return $core.withContext(function($ctx3) {
  20593. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20594. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20595. }));
  20596. return $recv($1)._not();
  20597. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20598. }));
  20599. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20600. },
  20601. args: ["aContext"],
  20602. 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 ]",
  20603. referencedClasses: [],
  20604. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20605. }),
  20606. $globals.Error);
  20607. $core.addMethod(
  20608. $core.method({
  20609. selector: "wasHandled",
  20610. protocol: "testing",
  20611. fn: function (){
  20612. var self=this,$self=this;
  20613. return $core.withContext(function($ctx1) {
  20614. return self.amberHandled || false;
  20615. return self;
  20616. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20617. },
  20618. args: [],
  20619. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20620. referencedClasses: [],
  20621. messageSends: []
  20622. }),
  20623. $globals.Error);
  20624. $core.addMethod(
  20625. $core.method({
  20626. selector: "classTag",
  20627. protocol: "accessing",
  20628. fn: function (){
  20629. var self=this,$self=this;
  20630. return "exception";
  20631. },
  20632. args: [],
  20633. 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'",
  20634. referencedClasses: [],
  20635. messageSends: []
  20636. }),
  20637. $globals.Error.a$cls);
  20638. $core.addMethod(
  20639. $core.method({
  20640. selector: "signal",
  20641. protocol: "instance creation",
  20642. fn: function (){
  20643. var self=this,$self=this;
  20644. return $core.withContext(function($ctx1) {
  20645. return $recv($self._new())._signal();
  20646. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20647. },
  20648. args: [],
  20649. source: "signal\x0a\x09^ self new signal",
  20650. referencedClasses: [],
  20651. messageSends: ["signal", "new"]
  20652. }),
  20653. $globals.Error.a$cls);
  20654. $core.addMethod(
  20655. $core.method({
  20656. selector: "signal:",
  20657. protocol: "instance creation",
  20658. fn: function (aString){
  20659. var self=this,$self=this;
  20660. return $core.withContext(function($ctx1) {
  20661. return $recv($self._new())._signal_(aString);
  20662. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20663. },
  20664. args: ["aString"],
  20665. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20666. referencedClasses: [],
  20667. messageSends: ["signal:", "new"]
  20668. }),
  20669. $globals.Error.a$cls);
  20670. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20671. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20672. $core.addMethod(
  20673. $core.method({
  20674. selector: "messageText",
  20675. protocol: "accessing",
  20676. fn: function (){
  20677. var self=this,$self=this;
  20678. return "Halt encountered";
  20679. },
  20680. args: [],
  20681. source: "messageText\x0a\x09^ 'Halt encountered'",
  20682. referencedClasses: [],
  20683. messageSends: []
  20684. }),
  20685. $globals.Halt);
  20686. $core.addMethod(
  20687. $core.method({
  20688. selector: "signalerContextFrom:",
  20689. protocol: "accessing",
  20690. fn: function (aContext){
  20691. var self=this,$self=this;
  20692. return $core.withContext(function($ctx1) {
  20693. var $3,$2,$1;
  20694. return $recv(aContext)._findContextSuchThat_((function(context){
  20695. return $core.withContext(function($ctx2) {
  20696. $3=$recv(context)._receiver();
  20697. $ctx2.sendIdx["receiver"]=1;
  20698. $2=$recv($3).__eq_eq(self);
  20699. $ctx2.sendIdx["=="]=1;
  20700. $1=$recv($2)._or_((function(){
  20701. return $core.withContext(function($ctx3) {
  20702. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20703. return $core.withContext(function($ctx4) {
  20704. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20705. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20706. }));
  20707. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20708. }));
  20709. $ctx2.sendIdx["or:"]=1;
  20710. return $recv($1)._not();
  20711. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20712. }));
  20713. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20714. },
  20715. args: ["aContext"],
  20716. 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 ]",
  20717. referencedClasses: [],
  20718. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20719. }),
  20720. $globals.Halt);
  20721. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20722. $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:`";
  20723. $core.addMethod(
  20724. $core.method({
  20725. selector: "context:",
  20726. protocol: "accessing",
  20727. fn: function (aMethodContext){
  20728. var self=this,$self=this;
  20729. return $core.withContext(function($ctx1) {
  20730. self.context = aMethodContext;
  20731. return self;
  20732. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20733. },
  20734. args: ["aMethodContext"],
  20735. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  20736. referencedClasses: [],
  20737. messageSends: []
  20738. }),
  20739. $globals.JavaScriptException);
  20740. $core.addMethod(
  20741. $core.method({
  20742. selector: "exception",
  20743. protocol: "accessing",
  20744. fn: function (){
  20745. var self=this,$self=this;
  20746. return $self["@exception"];
  20747. },
  20748. args: [],
  20749. source: "exception\x0a\x09^ exception",
  20750. referencedClasses: [],
  20751. messageSends: []
  20752. }),
  20753. $globals.JavaScriptException);
  20754. $core.addMethod(
  20755. $core.method({
  20756. selector: "exception:",
  20757. protocol: "accessing",
  20758. fn: function (anException){
  20759. var self=this,$self=this;
  20760. $self["@exception"]=anException;
  20761. return self;
  20762. },
  20763. args: ["anException"],
  20764. source: "exception: anException\x0a\x09exception := anException",
  20765. referencedClasses: [],
  20766. messageSends: []
  20767. }),
  20768. $globals.JavaScriptException);
  20769. $core.addMethod(
  20770. $core.method({
  20771. selector: "messageText",
  20772. protocol: "accessing",
  20773. fn: function (){
  20774. var self=this,$self=this;
  20775. return $core.withContext(function($ctx1) {
  20776. return "JavaScript exception: " + $self["@exception"].toString();
  20777. return self;
  20778. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20779. },
  20780. args: [],
  20781. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20782. referencedClasses: [],
  20783. messageSends: []
  20784. }),
  20785. $globals.JavaScriptException);
  20786. $core.addMethod(
  20787. $core.method({
  20788. selector: "shouldBeStubbed",
  20789. protocol: "testing",
  20790. fn: function (){
  20791. var self=this,$self=this;
  20792. return $core.withContext(function($ctx1) {
  20793. return $self["@exception"] instanceof RangeError;
  20794. return self;
  20795. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20796. },
  20797. args: [],
  20798. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20799. referencedClasses: [],
  20800. messageSends: []
  20801. }),
  20802. $globals.JavaScriptException);
  20803. $core.addMethod(
  20804. $core.method({
  20805. selector: "wrap",
  20806. protocol: "error handling",
  20807. fn: function (){
  20808. var self=this,$self=this;
  20809. return $core.withContext(function($ctx1) {
  20810. var $1;
  20811. $recv((function(){
  20812. return $core.withContext(function($ctx2) {
  20813. return $self._signal();
  20814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20815. }))._tryCatch_((function(){
  20816. return $core.withContext(function($ctx2) {
  20817. $1=$self._shouldBeStubbed();
  20818. if($core.assert($1)){
  20819. return $recv($self._context())._stubToAtMost_((100));
  20820. }
  20821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20822. }));
  20823. return self;
  20824. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20825. },
  20826. args: [],
  20827. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20828. referencedClasses: [],
  20829. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20830. }),
  20831. $globals.JavaScriptException);
  20832. $core.addMethod(
  20833. $core.method({
  20834. selector: "on:",
  20835. protocol: "instance creation",
  20836. fn: function (anException){
  20837. var self=this,$self=this;
  20838. return $core.withContext(function($ctx1) {
  20839. var $1;
  20840. $1=$self._new();
  20841. $recv($1)._exception_(anException);
  20842. return $recv($1)._yourself();
  20843. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20844. },
  20845. args: ["anException"],
  20846. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20847. referencedClasses: [],
  20848. messageSends: ["exception:", "new", "yourself"]
  20849. }),
  20850. $globals.JavaScriptException.a$cls);
  20851. $core.addMethod(
  20852. $core.method({
  20853. selector: "on:context:",
  20854. protocol: "instance creation",
  20855. fn: function (anException,aMethodContext){
  20856. var self=this,$self=this;
  20857. return $core.withContext(function($ctx1) {
  20858. var $1;
  20859. $1=$self._new();
  20860. $recv($1)._exception_(anException);
  20861. $recv($1)._context_(aMethodContext);
  20862. return $recv($1)._yourself();
  20863. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20864. },
  20865. args: ["anException", "aMethodContext"],
  20866. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20867. referencedClasses: [],
  20868. messageSends: ["exception:", "new", "context:", "yourself"]
  20869. }),
  20870. $globals.JavaScriptException.a$cls);
  20871. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20872. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20873. $core.addMethod(
  20874. $core.method({
  20875. selector: "message",
  20876. protocol: "accessing",
  20877. fn: function (){
  20878. var self=this,$self=this;
  20879. return $self["@message"];
  20880. },
  20881. args: [],
  20882. source: "message\x0a\x09^ message",
  20883. referencedClasses: [],
  20884. messageSends: []
  20885. }),
  20886. $globals.MessageNotUnderstood);
  20887. $core.addMethod(
  20888. $core.method({
  20889. selector: "message:",
  20890. protocol: "accessing",
  20891. fn: function (aMessage){
  20892. var self=this,$self=this;
  20893. $self["@message"]=aMessage;
  20894. return self;
  20895. },
  20896. args: ["aMessage"],
  20897. source: "message: aMessage\x0a\x09message := aMessage",
  20898. referencedClasses: [],
  20899. messageSends: []
  20900. }),
  20901. $globals.MessageNotUnderstood);
  20902. $core.addMethod(
  20903. $core.method({
  20904. selector: "messageText",
  20905. protocol: "accessing",
  20906. fn: function (){
  20907. var self=this,$self=this;
  20908. return $core.withContext(function($ctx1) {
  20909. var $1;
  20910. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20911. $ctx1.sendIdx[","]=1;
  20912. return $1;
  20913. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20914. },
  20915. args: [],
  20916. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20917. referencedClasses: [],
  20918. messageSends: [",", "asString", "receiver", "selector", "message"]
  20919. }),
  20920. $globals.MessageNotUnderstood);
  20921. $core.addMethod(
  20922. $core.method({
  20923. selector: "receiver",
  20924. protocol: "accessing",
  20925. fn: function (){
  20926. var self=this,$self=this;
  20927. return $self["@receiver"];
  20928. },
  20929. args: [],
  20930. source: "receiver\x0a\x09^ receiver",
  20931. referencedClasses: [],
  20932. messageSends: []
  20933. }),
  20934. $globals.MessageNotUnderstood);
  20935. $core.addMethod(
  20936. $core.method({
  20937. selector: "receiver:",
  20938. protocol: "accessing",
  20939. fn: function (anObject){
  20940. var self=this,$self=this;
  20941. $self["@receiver"]=anObject;
  20942. return self;
  20943. },
  20944. args: ["anObject"],
  20945. source: "receiver: anObject\x0a\x09receiver := anObject",
  20946. referencedClasses: [],
  20947. messageSends: []
  20948. }),
  20949. $globals.MessageNotUnderstood);
  20950. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20951. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20952. $core.addMethod(
  20953. $core.method({
  20954. selector: "object",
  20955. protocol: "accessing",
  20956. fn: function (){
  20957. var self=this,$self=this;
  20958. return $self["@object"];
  20959. },
  20960. args: [],
  20961. source: "object\x0a\x09^ object",
  20962. referencedClasses: [],
  20963. messageSends: []
  20964. }),
  20965. $globals.NonBooleanReceiver);
  20966. $core.addMethod(
  20967. $core.method({
  20968. selector: "object:",
  20969. protocol: "accessing",
  20970. fn: function (anObject){
  20971. var self=this,$self=this;
  20972. $self["@object"]=anObject;
  20973. return self;
  20974. },
  20975. args: ["anObject"],
  20976. source: "object: anObject\x0a\x09object := anObject",
  20977. referencedClasses: [],
  20978. messageSends: []
  20979. }),
  20980. $globals.NonBooleanReceiver);
  20981. $core.addMethod(
  20982. $core.method({
  20983. selector: "signalOn:",
  20984. protocol: "instance creation",
  20985. fn: function (anObject){
  20986. var self=this,$self=this;
  20987. return $core.withContext(function($ctx1) {
  20988. var $1;
  20989. $1=$self._new();
  20990. $recv($1)._object_(anObject);
  20991. return $recv($1)._signal();
  20992. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  20993. },
  20994. args: ["anObject"],
  20995. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  20996. referencedClasses: [],
  20997. messageSends: ["object:", "new", "signal"]
  20998. }),
  20999. $globals.NonBooleanReceiver.a$cls);
  21000. });
  21001. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21002. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21003. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21004. var $pkg = $core.addPackage("Kernel-Promises");
  21005. $pkg.innerEval = function (expr) { return eval(expr); };
  21006. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21007. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21008. $core.addMethod(
  21009. $core.method({
  21010. selector: "all:",
  21011. protocol: "composites",
  21012. fn: function (aCollection){
  21013. var self=this,$self=this;
  21014. return $core.withContext(function($ctx1) {
  21015. return Promise.all($recv(aCollection)._asArray());
  21016. return self;
  21017. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21018. },
  21019. args: ["aCollection"],
  21020. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21021. referencedClasses: [],
  21022. messageSends: []
  21023. }),
  21024. $globals.Promise.a$cls);
  21025. $core.addMethod(
  21026. $core.method({
  21027. selector: "any:",
  21028. protocol: "composites",
  21029. fn: function (aCollection){
  21030. var self=this,$self=this;
  21031. return $core.withContext(function($ctx1) {
  21032. return Promise.race($recv(aCollection)._asArray());
  21033. return self;
  21034. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21035. },
  21036. args: ["aCollection"],
  21037. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21038. referencedClasses: [],
  21039. messageSends: []
  21040. }),
  21041. $globals.Promise.a$cls);
  21042. $core.addMethod(
  21043. $core.method({
  21044. selector: "forBlock:",
  21045. protocol: "instance creation",
  21046. fn: function (aBlock){
  21047. var self=this,$self=this;
  21048. return $core.withContext(function($ctx1) {
  21049. return $recv($self._new())._then_(aBlock);
  21050. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21051. },
  21052. args: ["aBlock"],
  21053. source: "forBlock: aBlock\x0a\x22Returns a Promise that is resolved with the value of aBlock,\x0aand rejected if error happens while evaluating aBlock.\x22\x0a\x09^ self new then: aBlock",
  21054. referencedClasses: [],
  21055. messageSends: ["then:", "new"]
  21056. }),
  21057. $globals.Promise.a$cls);
  21058. $core.addMethod(
  21059. $core.method({
  21060. selector: "new",
  21061. protocol: "instance creation",
  21062. fn: function (){
  21063. var self=this,$self=this;
  21064. return $core.withContext(function($ctx1) {
  21065. return Promise.resolve();
  21066. return self;
  21067. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21068. },
  21069. args: [],
  21070. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21071. referencedClasses: [],
  21072. messageSends: []
  21073. }),
  21074. $globals.Promise.a$cls);
  21075. $core.addMethod(
  21076. $core.method({
  21077. selector: "new:",
  21078. protocol: "instance creation",
  21079. fn: function (aBlock){
  21080. var self=this,$self=this;
  21081. return $core.withContext(function($ctx1) {
  21082. return new Promise(function (resolve, reject) {
  21083. var model = {value: resolve, signal: reject};
  21084. aBlock._value_(model);
  21085. });
  21086. return self;
  21087. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21088. },
  21089. args: ["aBlock"],
  21090. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})'>",
  21091. referencedClasses: [],
  21092. messageSends: []
  21093. }),
  21094. $globals.Promise.a$cls);
  21095. $core.addMethod(
  21096. $core.method({
  21097. selector: "signal:",
  21098. protocol: "instance creation",
  21099. fn: function (anObject){
  21100. var self=this,$self=this;
  21101. return $core.withContext(function($ctx1) {
  21102. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21103. return self;
  21104. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21105. },
  21106. args: ["anObject"],
  21107. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21108. referencedClasses: [],
  21109. messageSends: []
  21110. }),
  21111. $globals.Promise.a$cls);
  21112. $core.addMethod(
  21113. $core.method({
  21114. selector: "value:",
  21115. protocol: "instance creation",
  21116. fn: function (anObject){
  21117. var self=this,$self=this;
  21118. return $core.withContext(function($ctx1) {
  21119. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21120. return self;
  21121. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21122. },
  21123. args: ["anObject"],
  21124. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21125. referencedClasses: [],
  21126. messageSends: []
  21127. }),
  21128. $globals.Promise.a$cls);
  21129. $core.addTrait("TThenable", "Kernel-Promises");
  21130. $core.addMethod(
  21131. $core.method({
  21132. selector: "catch:",
  21133. protocol: "promises",
  21134. fn: function (aBlock){
  21135. var self=this,$self=this;
  21136. return $core.withContext(function($ctx1) {
  21137. return self.then(null, function (err) {return $core.seamless(function () {
  21138. return aBlock._value_(err);
  21139. })});
  21140. return self;
  21141. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21142. },
  21143. args: ["aBlock"],
  21144. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21145. referencedClasses: [],
  21146. messageSends: []
  21147. }),
  21148. $globals.TThenable);
  21149. $core.addMethod(
  21150. $core.method({
  21151. selector: "on:do:",
  21152. protocol: "promises",
  21153. fn: function (aClass,aBlock){
  21154. var self=this,$self=this;
  21155. return $core.withContext(function($ctx1) {
  21156. return self.then(null, function (err) {return $core.seamless(function () {
  21157. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21158. else throw err;
  21159. })});
  21160. return self;
  21161. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21162. },
  21163. args: ["aClass", "aBlock"],
  21164. source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
  21165. referencedClasses: [],
  21166. messageSends: []
  21167. }),
  21168. $globals.TThenable);
  21169. $core.addMethod(
  21170. $core.method({
  21171. selector: "on:do:catch:",
  21172. protocol: "promises",
  21173. fn: function (aClass,aBlock,anotherBlock){
  21174. var self=this,$self=this;
  21175. return $core.withContext(function($ctx1) {
  21176. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21177. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21178. },
  21179. args: ["aClass", "aBlock", "anotherBlock"],
  21180. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21181. referencedClasses: [],
  21182. messageSends: ["catch:", "on:do:"]
  21183. }),
  21184. $globals.TThenable);
  21185. $core.addMethod(
  21186. $core.method({
  21187. selector: "then:",
  21188. protocol: "promises",
  21189. fn: function (aBlockOrArray){
  21190. var self=this,$self=this;
  21191. return $core.withContext(function($ctx1) {
  21192. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21193. return array.reduce(function (soFar, aBlock) {
  21194. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21195. function (result) {return $core.seamless(function () {
  21196. if (Array.isArray(result)) {
  21197. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21198. } else {
  21199. return aBlock._value_(result);
  21200. }
  21201. })} :
  21202. function (result) {return $core.seamless(function () {
  21203. return aBlock._value_(result);
  21204. })}
  21205. );
  21206. }, self);
  21207. return self;
  21208. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21209. },
  21210. args: ["aBlockOrArray"],
  21211. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
  21212. referencedClasses: [],
  21213. messageSends: []
  21214. }),
  21215. $globals.TThenable);
  21216. $core.addMethod(
  21217. $core.method({
  21218. selector: "then:catch:",
  21219. protocol: "promises",
  21220. fn: function (aBlockOrArray,anotherBlock){
  21221. var self=this,$self=this;
  21222. return $core.withContext(function($ctx1) {
  21223. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21224. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21225. },
  21226. args: ["aBlockOrArray", "anotherBlock"],
  21227. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21228. referencedClasses: [],
  21229. messageSends: ["catch:", "then:"]
  21230. }),
  21231. $globals.TThenable);
  21232. $core.addMethod(
  21233. $core.method({
  21234. selector: "then:on:do:",
  21235. protocol: "promises",
  21236. fn: function (aBlockOrArray,aClass,aBlock){
  21237. var self=this,$self=this;
  21238. return $core.withContext(function($ctx1) {
  21239. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21240. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21241. },
  21242. args: ["aBlockOrArray", "aClass", "aBlock"],
  21243. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21244. referencedClasses: [],
  21245. messageSends: ["on:do:", "then:"]
  21246. }),
  21247. $globals.TThenable);
  21248. $core.addMethod(
  21249. $core.method({
  21250. selector: "then:on:do:catch:",
  21251. protocol: "promises",
  21252. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21253. var self=this,$self=this;
  21254. return $core.withContext(function($ctx1) {
  21255. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21256. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21257. },
  21258. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21259. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21260. referencedClasses: [],
  21261. messageSends: ["catch:", "on:do:", "then:"]
  21262. }),
  21263. $globals.TThenable);
  21264. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21265. });
  21266. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
  21267. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21268. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21269. var $pkg = $core.addPackage("Kernel-Infrastructure");
  21270. $pkg.innerEval = function (expr) { return eval(expr); };
  21271. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21272. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21273. $core.addMethod(
  21274. $core.method({
  21275. selector: "organizeClasses",
  21276. protocol: "organization",
  21277. fn: function (){
  21278. var self=this,$self=this;
  21279. return $core.withContext(function($ctx1) {
  21280. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21281. return $core.withContext(function($ctx2) {
  21282. return $recv(each)._enterOrganization();
  21283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21284. }));
  21285. return self;
  21286. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21287. },
  21288. args: [],
  21289. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21290. referencedClasses: ["Smalltalk"],
  21291. messageSends: ["do:", "classes", "enterOrganization"]
  21292. }),
  21293. $globals.AmberBootstrapInitialization.a$cls);
  21294. $core.addMethod(
  21295. $core.method({
  21296. selector: "organizeMethods",
  21297. protocol: "organization",
  21298. fn: function (){
  21299. var self=this,$self=this;
  21300. return $core.withContext(function($ctx1) {
  21301. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21302. return $core.withContext(function($ctx2) {
  21303. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21304. return $core.withContext(function($ctx3) {
  21305. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21306. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21307. }));
  21308. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21309. }));
  21310. $ctx1.sendIdx["do:"]=1;
  21311. return self;
  21312. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21313. },
  21314. args: [],
  21315. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21316. referencedClasses: ["Smalltalk"],
  21317. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21318. }),
  21319. $globals.AmberBootstrapInitialization.a$cls);
  21320. $core.addMethod(
  21321. $core.method({
  21322. selector: "run",
  21323. protocol: "public api",
  21324. fn: function (){
  21325. var self=this,$self=this;
  21326. return $core.withContext(function($ctx1) {
  21327. $recv($globals.SmalltalkImage)._initialize();
  21328. $self._organizeClasses();
  21329. $self._organizeMethods();
  21330. return $recv($globals.Smalltalk)._postLoad();
  21331. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21332. },
  21333. args: [],
  21334. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21335. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21336. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21337. }),
  21338. $globals.AmberBootstrapInitialization.a$cls);
  21339. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21340. $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`.";
  21341. $core.addMethod(
  21342. $core.method({
  21343. selector: "=",
  21344. protocol: "comparing",
  21345. fn: function (anObject){
  21346. var self=this,$self=this;
  21347. return $core.withContext(function($ctx1) {
  21348. var $2,$1;
  21349. $2=$recv(anObject)._class();
  21350. $ctx1.sendIdx["class"]=1;
  21351. $1=$recv($2).__eq_eq($self._class());
  21352. if(!$core.assert($1)){
  21353. return false;
  21354. }
  21355. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21356. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21357. },
  21358. args: ["anObject"],
  21359. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21360. referencedClasses: ["JSObjectProxy"],
  21361. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21362. }),
  21363. $globals.JSObjectProxy);
  21364. $core.addMethod(
  21365. $core.method({
  21366. selector: "asJavaScriptObject",
  21367. protocol: "converting",
  21368. fn: function (){
  21369. var self=this,$self=this;
  21370. return $self["@jsObject"];
  21371. },
  21372. args: [],
  21373. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21374. referencedClasses: [],
  21375. messageSends: []
  21376. }),
  21377. $globals.JSObjectProxy);
  21378. $core.addMethod(
  21379. $core.method({
  21380. selector: "at:",
  21381. protocol: "accessing",
  21382. fn: function (aString){
  21383. var self=this,$self=this;
  21384. return $core.withContext(function($ctx1) {
  21385. return $self['@jsObject'][aString];
  21386. return self;
  21387. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21388. },
  21389. args: ["aString"],
  21390. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21391. referencedClasses: [],
  21392. messageSends: []
  21393. }),
  21394. $globals.JSObjectProxy);
  21395. $core.addMethod(
  21396. $core.method({
  21397. selector: "at:ifAbsent:",
  21398. protocol: "accessing",
  21399. fn: function (aString,aBlock){
  21400. var self=this,$self=this;
  21401. return $core.withContext(function($ctx1) {
  21402. var obj = $self['@jsObject'];
  21403. return aString in obj ? obj[aString] : aBlock._value();
  21404. ;
  21405. return self;
  21406. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21407. },
  21408. args: ["aString", "aBlock"],
  21409. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  21410. referencedClasses: [],
  21411. messageSends: []
  21412. }),
  21413. $globals.JSObjectProxy);
  21414. $core.addMethod(
  21415. $core.method({
  21416. selector: "at:ifPresent:",
  21417. protocol: "accessing",
  21418. fn: function (aString,aBlock){
  21419. var self=this,$self=this;
  21420. return $core.withContext(function($ctx1) {
  21421. var obj = $self['@jsObject'];
  21422. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21423. ;
  21424. return self;
  21425. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21426. },
  21427. args: ["aString", "aBlock"],
  21428. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  21429. referencedClasses: [],
  21430. messageSends: []
  21431. }),
  21432. $globals.JSObjectProxy);
  21433. $core.addMethod(
  21434. $core.method({
  21435. selector: "at:ifPresent:ifAbsent:",
  21436. protocol: "accessing",
  21437. fn: function (aString,aBlock,anotherBlock){
  21438. var self=this,$self=this;
  21439. return $core.withContext(function($ctx1) {
  21440. var obj = $self['@jsObject'];
  21441. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21442. ;
  21443. return self;
  21444. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21445. },
  21446. args: ["aString", "aBlock", "anotherBlock"],
  21447. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  21448. referencedClasses: [],
  21449. messageSends: []
  21450. }),
  21451. $globals.JSObjectProxy);
  21452. $core.addMethod(
  21453. $core.method({
  21454. selector: "at:put:",
  21455. protocol: "accessing",
  21456. fn: function (aString,anObject){
  21457. var self=this,$self=this;
  21458. return $core.withContext(function($ctx1) {
  21459. return $self['@jsObject'][aString] = anObject;
  21460. return self;
  21461. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21462. },
  21463. args: ["aString", "anObject"],
  21464. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21465. referencedClasses: [],
  21466. messageSends: []
  21467. }),
  21468. $globals.JSObjectProxy);
  21469. $core.addMethod(
  21470. $core.method({
  21471. selector: "catch:",
  21472. protocol: "promises",
  21473. fn: function (aBlock){
  21474. var self=this,$self=this;
  21475. return $core.withContext(function($ctx1) {
  21476. var $1,$2;
  21477. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21478. if($core.assert($1)){
  21479. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21480. } else {
  21481. $2=(
  21482. $ctx1.supercall = true,
  21483. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21484. $ctx1.supercall = false;
  21485. return $2;
  21486. }
  21487. return self;
  21488. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21489. },
  21490. args: ["aBlock"],
  21491. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21492. referencedClasses: ["NativeFunction", "TThenable"],
  21493. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21494. }),
  21495. $globals.JSObjectProxy);
  21496. $core.addMethod(
  21497. $core.method({
  21498. selector: "doesNotUnderstand:",
  21499. protocol: "proxy",
  21500. fn: function (aMessage){
  21501. var self=this,$self=this;
  21502. return $core.withContext(function($ctx1) {
  21503. var $1,$receiver;
  21504. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21505. if(($receiver = $1) == null || $receiver.a$nil){
  21506. return (
  21507. $ctx1.supercall = true,
  21508. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21509. $ctx1.supercall = false;
  21510. } else {
  21511. var jsSelector;
  21512. jsSelector=$receiver;
  21513. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21514. }
  21515. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21516. },
  21517. args: ["aMessage"],
  21518. 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 ]",
  21519. referencedClasses: ["JSObjectProxy"],
  21520. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21521. }),
  21522. $globals.JSObjectProxy);
  21523. $core.addMethod(
  21524. $core.method({
  21525. selector: "in:",
  21526. protocol: "accessing",
  21527. fn: function (aValuable){
  21528. var self=this,$self=this;
  21529. return $core.withContext(function($ctx1) {
  21530. return $recv(aValuable)._value_($self["@jsObject"]);
  21531. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21532. },
  21533. args: ["aValuable"],
  21534. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21535. referencedClasses: [],
  21536. messageSends: ["value:"]
  21537. }),
  21538. $globals.JSObjectProxy);
  21539. $core.addMethod(
  21540. $core.method({
  21541. selector: "jsObject",
  21542. protocol: "accessing",
  21543. fn: function (){
  21544. var self=this,$self=this;
  21545. return $self["@jsObject"];
  21546. },
  21547. args: [],
  21548. source: "jsObject\x0a\x09^ jsObject",
  21549. referencedClasses: [],
  21550. messageSends: []
  21551. }),
  21552. $globals.JSObjectProxy);
  21553. $core.addMethod(
  21554. $core.method({
  21555. selector: "keysAndValuesDo:",
  21556. protocol: "enumerating",
  21557. fn: function (aBlock){
  21558. var self=this,$self=this;
  21559. return $core.withContext(function($ctx1) {
  21560. var o = $self['@jsObject'];
  21561. for(var i in o) {
  21562. aBlock._value_value_(i, o[i]);
  21563. }
  21564. ;
  21565. return self;
  21566. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21567. },
  21568. args: ["aBlock"],
  21569. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>",
  21570. referencedClasses: [],
  21571. messageSends: []
  21572. }),
  21573. $globals.JSObjectProxy);
  21574. $core.addMethod(
  21575. $core.method({
  21576. selector: "on:do:",
  21577. protocol: "promises",
  21578. fn: function (aClass,aBlock){
  21579. var self=this,$self=this;
  21580. return $core.withContext(function($ctx1) {
  21581. var $1,$2;
  21582. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21583. if($core.assert($1)){
  21584. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21585. } else {
  21586. $2=(
  21587. $ctx1.supercall = true,
  21588. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21589. $ctx1.supercall = false;
  21590. return $2;
  21591. }
  21592. return self;
  21593. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21594. },
  21595. args: ["aClass", "aBlock"],
  21596. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  21597. referencedClasses: ["NativeFunction", "TThenable"],
  21598. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21599. }),
  21600. $globals.JSObjectProxy);
  21601. $core.addMethod(
  21602. $core.method({
  21603. selector: "printOn:",
  21604. protocol: "printing",
  21605. fn: function (aStream){
  21606. var self=this,$self=this;
  21607. return $core.withContext(function($ctx1) {
  21608. $recv(aStream)._nextPutAll_($self._printString());
  21609. return self;
  21610. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21611. },
  21612. args: ["aStream"],
  21613. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21614. referencedClasses: [],
  21615. messageSends: ["nextPutAll:", "printString"]
  21616. }),
  21617. $globals.JSObjectProxy);
  21618. $core.addMethod(
  21619. $core.method({
  21620. selector: "printString",
  21621. protocol: "printing",
  21622. fn: function (){
  21623. var self=this,$self=this;
  21624. return $core.withContext(function($ctx1) {
  21625. var js = $self['@jsObject'];
  21626. return js.toString
  21627. ? js.toString()
  21628. : Object.prototype.toString.call(js)
  21629. ;
  21630. return self;
  21631. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21632. },
  21633. args: [],
  21634. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  21635. referencedClasses: [],
  21636. messageSends: []
  21637. }),
  21638. $globals.JSObjectProxy);
  21639. $core.addMethod(
  21640. $core.method({
  21641. selector: "putOn:",
  21642. protocol: "streaming",
  21643. fn: function (aStream){
  21644. var self=this,$self=this;
  21645. return $core.withContext(function($ctx1) {
  21646. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21647. return self;
  21648. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21649. },
  21650. args: ["aStream"],
  21651. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21652. referencedClasses: [],
  21653. messageSends: ["nextPutJSObject:"]
  21654. }),
  21655. $globals.JSObjectProxy);
  21656. $core.addMethod(
  21657. $core.method({
  21658. selector: "removeKey:",
  21659. protocol: "accessing",
  21660. fn: function (aString){
  21661. var self=this,$self=this;
  21662. return $core.withContext(function($ctx1) {
  21663. delete $self['@jsObject'][aString]; return aString;
  21664. return self;
  21665. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21666. },
  21667. args: ["aString"],
  21668. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21669. referencedClasses: [],
  21670. messageSends: []
  21671. }),
  21672. $globals.JSObjectProxy);
  21673. $core.addMethod(
  21674. $core.method({
  21675. selector: "then:",
  21676. protocol: "promises",
  21677. fn: function (aBlockOrArray){
  21678. var self=this,$self=this;
  21679. return $core.withContext(function($ctx1) {
  21680. var $1,$2;
  21681. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21682. if($core.assert($1)){
  21683. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21684. } else {
  21685. $2=(
  21686. $ctx1.supercall = true,
  21687. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21688. $ctx1.supercall = false;
  21689. return $2;
  21690. }
  21691. return self;
  21692. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21693. },
  21694. args: ["aBlockOrArray"],
  21695. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21696. referencedClasses: ["NativeFunction", "TThenable"],
  21697. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21698. }),
  21699. $globals.JSObjectProxy);
  21700. $core.addMethod(
  21701. $core.method({
  21702. selector: "addObjectVariablesTo:ofProxy:",
  21703. protocol: "proxy",
  21704. fn: function (aDictionary,aProxy){
  21705. var self=this,$self=this;
  21706. return $core.withContext(function($ctx1) {
  21707. var jsObject = aProxy['@jsObject'];
  21708. for(var i in jsObject) {
  21709. aDictionary._at_put_(i, jsObject[i]);
  21710. }
  21711. ;
  21712. return self;
  21713. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21714. },
  21715. args: ["aDictionary", "aProxy"],
  21716. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  21717. referencedClasses: [],
  21718. messageSends: []
  21719. }),
  21720. $globals.JSObjectProxy.a$cls);
  21721. $core.addMethod(
  21722. $core.method({
  21723. selector: "compareJSObjectOfProxy:withProxy:",
  21724. protocol: "proxy",
  21725. fn: function (aProxy,anotherProxy){
  21726. var self=this,$self=this;
  21727. return $core.withContext(function($ctx1) {
  21728. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21729. return aProxy["@jsObject"] === anotherJSObject;
  21730. return self;
  21731. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21732. },
  21733. args: ["aProxy", "anotherProxy"],
  21734. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  21735. referencedClasses: [],
  21736. messageSends: []
  21737. }),
  21738. $globals.JSObjectProxy.a$cls);
  21739. $core.addMethod(
  21740. $core.method({
  21741. selector: "forwardMessage:withArguments:ofProxy:",
  21742. protocol: "proxy",
  21743. fn: function (aString,anArray,aProxy){
  21744. var self=this,$self=this;
  21745. return $core.withContext(function($ctx1) {
  21746. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21747. ;
  21748. return self;
  21749. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21750. },
  21751. args: ["aString", "anArray", "aProxy"],
  21752. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21753. referencedClasses: [],
  21754. messageSends: []
  21755. }),
  21756. $globals.JSObjectProxy.a$cls);
  21757. $core.addMethod(
  21758. $core.method({
  21759. selector: "jsObject:ofProxy:",
  21760. protocol: "proxy",
  21761. fn: function (aJSObject,aProxy){
  21762. var self=this,$self=this;
  21763. return $core.withContext(function($ctx1) {
  21764. aProxy['@jsObject'] = aJSObject;
  21765. return self;
  21766. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21767. },
  21768. args: ["aJSObject", "aProxy"],
  21769. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21770. referencedClasses: [],
  21771. messageSends: []
  21772. }),
  21773. $globals.JSObjectProxy.a$cls);
  21774. $core.addMethod(
  21775. $core.method({
  21776. selector: "lookupProperty:ofProxy:",
  21777. protocol: "proxy",
  21778. fn: function (aString,aProxy){
  21779. var self=this,$self=this;
  21780. return $core.withContext(function($ctx1) {
  21781. return aString in aProxy._jsObject() ? aString : nil;
  21782. return self;
  21783. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21784. },
  21785. args: ["aString", "aProxy"],
  21786. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  21787. referencedClasses: [],
  21788. messageSends: []
  21789. }),
  21790. $globals.JSObjectProxy.a$cls);
  21791. $core.addMethod(
  21792. $core.method({
  21793. selector: "null",
  21794. protocol: "accessing",
  21795. fn: function (){
  21796. var self=this,$self=this;
  21797. return $core.withContext(function($ctx1) {
  21798. return null;
  21799. return self;
  21800. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21801. },
  21802. args: [],
  21803. source: "null\x0a\x09<inlineJS: 'return null'>",
  21804. referencedClasses: [],
  21805. messageSends: []
  21806. }),
  21807. $globals.JSObjectProxy.a$cls);
  21808. $core.addMethod(
  21809. $core.method({
  21810. selector: "on:",
  21811. protocol: "instance creation",
  21812. fn: function (aJSObject){
  21813. var self=this,$self=this;
  21814. var instance;
  21815. return $core.withContext(function($ctx1) {
  21816. instance=$self._new();
  21817. $self._jsObject_ofProxy_(aJSObject,instance);
  21818. return instance;
  21819. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21820. },
  21821. args: ["aJSObject"],
  21822. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21823. referencedClasses: [],
  21824. messageSends: ["new", "jsObject:ofProxy:"]
  21825. }),
  21826. $globals.JSObjectProxy.a$cls);
  21827. $core.addMethod(
  21828. $core.method({
  21829. selector: "undefined",
  21830. protocol: "accessing",
  21831. fn: function (){
  21832. var self=this,$self=this;
  21833. return $core.withContext(function($ctx1) {
  21834. return undefined;
  21835. return self;
  21836. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21837. },
  21838. args: [],
  21839. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21840. referencedClasses: [],
  21841. messageSends: []
  21842. }),
  21843. $globals.JSObjectProxy.a$cls);
  21844. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21845. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21846. $core.addMethod(
  21847. $core.method({
  21848. selector: "addElement:",
  21849. protocol: "accessing",
  21850. fn: function (anObject){
  21851. var self=this,$self=this;
  21852. return $core.withContext(function($ctx1) {
  21853. $recv($self._elements())._add_(anObject);
  21854. return self;
  21855. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21856. },
  21857. args: ["anObject"],
  21858. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21859. referencedClasses: [],
  21860. messageSends: ["add:", "elements"]
  21861. }),
  21862. $globals.Organizer);
  21863. $core.addMethod(
  21864. $core.method({
  21865. selector: "elements",
  21866. protocol: "accessing",
  21867. fn: function (){
  21868. var self=this,$self=this;
  21869. return $self["@elements"];
  21870. },
  21871. args: [],
  21872. source: "elements\x0a\x09^ elements",
  21873. referencedClasses: [],
  21874. messageSends: []
  21875. }),
  21876. $globals.Organizer);
  21877. $core.addMethod(
  21878. $core.method({
  21879. selector: "initialize",
  21880. protocol: "initialization",
  21881. fn: function (){
  21882. var self=this,$self=this;
  21883. return $core.withContext(function($ctx1) {
  21884. (
  21885. $ctx1.supercall = true,
  21886. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21887. $ctx1.supercall = false;
  21888. $self["@elements"]=$recv($globals.Set)._new();
  21889. return self;
  21890. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21891. },
  21892. args: [],
  21893. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21894. referencedClasses: ["Set"],
  21895. messageSends: ["initialize", "new"]
  21896. }),
  21897. $globals.Organizer);
  21898. $core.addMethod(
  21899. $core.method({
  21900. selector: "removeElement:",
  21901. protocol: "accessing",
  21902. fn: function (anObject){
  21903. var self=this,$self=this;
  21904. return $core.withContext(function($ctx1) {
  21905. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21906. }));
  21907. return self;
  21908. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21909. },
  21910. args: ["anObject"],
  21911. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21912. referencedClasses: [],
  21913. messageSends: ["remove:ifAbsent:", "elements"]
  21914. }),
  21915. $globals.Organizer);
  21916. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21917. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21918. $core.addMethod(
  21919. $core.method({
  21920. selector: "addElement:",
  21921. protocol: "accessing",
  21922. fn: function (aString){
  21923. var self=this,$self=this;
  21924. return $core.withContext(function($ctx1) {
  21925. var $1,$3,$2;
  21926. (
  21927. $ctx1.supercall = true,
  21928. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21929. $ctx1.supercall = false;
  21930. $1=$recv($globals.SystemAnnouncer)._current();
  21931. $3=$recv($globals.ProtocolAdded)._new();
  21932. $recv($3)._protocol_(aString);
  21933. $recv($3)._theClass_($self._theClass());
  21934. $2=$recv($3)._yourself();
  21935. $recv($1)._announce_($2);
  21936. return self;
  21937. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21938. },
  21939. args: ["aString"],
  21940. 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)",
  21941. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21942. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21943. }),
  21944. $globals.ClassOrganizer);
  21945. $core.addMethod(
  21946. $core.method({
  21947. selector: "removeElement:",
  21948. protocol: "accessing",
  21949. fn: function (aString){
  21950. var self=this,$self=this;
  21951. return $core.withContext(function($ctx1) {
  21952. var $1,$3,$2;
  21953. (
  21954. $ctx1.supercall = true,
  21955. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21956. $ctx1.supercall = false;
  21957. $1=$recv($globals.SystemAnnouncer)._current();
  21958. $3=$recv($globals.ProtocolRemoved)._new();
  21959. $recv($3)._protocol_(aString);
  21960. $recv($3)._theClass_($self._theClass());
  21961. $2=$recv($3)._yourself();
  21962. $recv($1)._announce_($2);
  21963. return self;
  21964. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21965. },
  21966. args: ["aString"],
  21967. 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)",
  21968. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21969. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21970. }),
  21971. $globals.ClassOrganizer);
  21972. $core.addMethod(
  21973. $core.method({
  21974. selector: "theClass",
  21975. protocol: "accessing",
  21976. fn: function (){
  21977. var self=this,$self=this;
  21978. return $self["@traitOrBehavior"];
  21979. },
  21980. args: [],
  21981. source: "theClass\x0a\x09^ traitOrBehavior",
  21982. referencedClasses: [],
  21983. messageSends: []
  21984. }),
  21985. $globals.ClassOrganizer);
  21986. $core.addMethod(
  21987. $core.method({
  21988. selector: "theClass:",
  21989. protocol: "accessing",
  21990. fn: function (aClass){
  21991. var self=this,$self=this;
  21992. $self["@traitOrBehavior"]=aClass;
  21993. return self;
  21994. },
  21995. args: ["aClass"],
  21996. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  21997. referencedClasses: [],
  21998. messageSends: []
  21999. }),
  22000. $globals.ClassOrganizer);
  22001. $core.addMethod(
  22002. $core.method({
  22003. selector: "on:",
  22004. protocol: "instance creation",
  22005. fn: function (aClass){
  22006. var self=this,$self=this;
  22007. return $core.withContext(function($ctx1) {
  22008. var $1;
  22009. $1=$self._new();
  22010. $recv($1)._theClass_(aClass);
  22011. return $recv($1)._yourself();
  22012. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22013. },
  22014. args: ["aClass"],
  22015. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22016. referencedClasses: [],
  22017. messageSends: ["theClass:", "new", "yourself"]
  22018. }),
  22019. $globals.ClassOrganizer.a$cls);
  22020. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22021. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22022. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  22023. $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'";
  22024. $core.addMethod(
  22025. $core.method({
  22026. selector: "basicTransport",
  22027. protocol: "private",
  22028. fn: function (){
  22029. var self=this,$self=this;
  22030. return $self["@basicTransport"];
  22031. },
  22032. args: [],
  22033. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22034. referencedClasses: [],
  22035. messageSends: []
  22036. }),
  22037. $globals.Package);
  22038. $core.addMethod(
  22039. $core.method({
  22040. selector: "beClean",
  22041. protocol: "accessing",
  22042. fn: function (){
  22043. var self=this,$self=this;
  22044. return $core.withContext(function($ctx1) {
  22045. var $1,$3,$2;
  22046. $self["@dirty"]=false;
  22047. $1=$recv($globals.SystemAnnouncer)._current();
  22048. $3=$recv($globals.PackageClean)._new();
  22049. $recv($3)._package_(self);
  22050. $2=$recv($3)._yourself();
  22051. $recv($1)._announce_($2);
  22052. return self;
  22053. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22054. },
  22055. args: [],
  22056. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22057. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22058. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22059. }),
  22060. $globals.Package);
  22061. $core.addMethod(
  22062. $core.method({
  22063. selector: "beDirty",
  22064. protocol: "accessing",
  22065. fn: function (){
  22066. var self=this,$self=this;
  22067. return $core.withContext(function($ctx1) {
  22068. var $1,$3,$2;
  22069. $self["@dirty"]=true;
  22070. $1=$recv($globals.SystemAnnouncer)._current();
  22071. $3=$recv($globals.PackageDirty)._new();
  22072. $recv($3)._package_(self);
  22073. $2=$recv($3)._yourself();
  22074. $recv($1)._announce_($2);
  22075. return self;
  22076. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22077. },
  22078. args: [],
  22079. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22080. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22081. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22082. }),
  22083. $globals.Package);
  22084. $core.addMethod(
  22085. $core.method({
  22086. selector: "classTemplate",
  22087. protocol: "accessing",
  22088. fn: function (){
  22089. var self=this,$self=this;
  22090. return $core.withContext(function($ctx1) {
  22091. return $recv($globals.String)._streamContents_((function(stream){
  22092. return $core.withContext(function($ctx2) {
  22093. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22094. $ctx2.sendIdx["write:"]=1;
  22095. $recv(stream)._lf();
  22096. $ctx2.sendIdx["lf"]=1;
  22097. $recv(stream)._tab();
  22098. $ctx2.sendIdx["tab"]=1;
  22099. $recv(stream)._write_("instanceVariableNames: ''");
  22100. $ctx2.sendIdx["write:"]=2;
  22101. $recv(stream)._lf();
  22102. $recv(stream)._tab();
  22103. $recv(stream)._write_("package: ");
  22104. return $recv(stream)._print_($self._name());
  22105. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22106. }));
  22107. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22108. },
  22109. args: [],
  22110. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  22111. referencedClasses: ["String"],
  22112. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22113. }),
  22114. $globals.Package);
  22115. $core.addMethod(
  22116. $core.method({
  22117. selector: "classes",
  22118. protocol: "classes",
  22119. fn: function (){
  22120. var self=this,$self=this;
  22121. return $core.withContext(function($ctx1) {
  22122. return $recv($recv($self._organization())._elements())._copy();
  22123. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22124. },
  22125. args: [],
  22126. source: "classes\x0a\x09^ self organization elements copy",
  22127. referencedClasses: [],
  22128. messageSends: ["copy", "elements", "organization"]
  22129. }),
  22130. $globals.Package);
  22131. $core.addMethod(
  22132. $core.method({
  22133. selector: "definition",
  22134. protocol: "accessing",
  22135. fn: function (){
  22136. var self=this,$self=this;
  22137. return $core.withContext(function($ctx1) {
  22138. var $1;
  22139. return $recv($globals.String)._streamContents_((function(stream){
  22140. return $core.withContext(function($ctx2) {
  22141. $1=$recv($self._class())._name();
  22142. $ctx2.sendIdx["name"]=1;
  22143. $recv(stream)._write_($1);
  22144. $ctx2.sendIdx["write:"]=1;
  22145. $recv(stream)._lf();
  22146. $ctx2.sendIdx["lf"]=1;
  22147. $recv(stream)._tab();
  22148. $ctx2.sendIdx["tab"]=1;
  22149. $recv(stream)._write_("named: ");
  22150. $ctx2.sendIdx["write:"]=2;
  22151. $recv(stream)._print_($self._name());
  22152. $recv(stream)._lf();
  22153. $ctx2.sendIdx["lf"]=2;
  22154. $recv(stream)._tab();
  22155. $ctx2.sendIdx["tab"]=2;
  22156. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22157. $ctx2.sendIdx["write:"]=3;
  22158. $recv(stream)._lf();
  22159. $recv(stream)._tab();
  22160. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22161. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22162. }));
  22163. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22164. },
  22165. args: [],
  22166. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  22167. referencedClasses: ["String"],
  22168. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22169. }),
  22170. $globals.Package);
  22171. $core.addMethod(
  22172. $core.method({
  22173. selector: "eval:",
  22174. protocol: "evaluating",
  22175. fn: function (aString){
  22176. var self=this,$self=this;
  22177. return $core.withContext(function($ctx1) {
  22178. var $1,$receiver;
  22179. $1=$self["@evalBlock"];
  22180. if(($receiver = $1) == null || $receiver.a$nil){
  22181. return $recv($globals.Compiler)._eval_(aString);
  22182. } else {
  22183. return $recv($self["@evalBlock"])._value_(aString);
  22184. }
  22185. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22186. },
  22187. args: ["aString"],
  22188. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22189. referencedClasses: ["Compiler"],
  22190. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22191. }),
  22192. $globals.Package);
  22193. $core.addMethod(
  22194. $core.method({
  22195. selector: "evalBlock",
  22196. protocol: "accessing",
  22197. fn: function (){
  22198. var self=this,$self=this;
  22199. return $self["@evalBlock"];
  22200. },
  22201. args: [],
  22202. source: "evalBlock\x0a\x09^ evalBlock",
  22203. referencedClasses: [],
  22204. messageSends: []
  22205. }),
  22206. $globals.Package);
  22207. $core.addMethod(
  22208. $core.method({
  22209. selector: "evalBlock:",
  22210. protocol: "accessing",
  22211. fn: function (aBlock){
  22212. var self=this,$self=this;
  22213. $self["@evalBlock"]=aBlock;
  22214. return self;
  22215. },
  22216. args: ["aBlock"],
  22217. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22218. referencedClasses: [],
  22219. messageSends: []
  22220. }),
  22221. $globals.Package);
  22222. $core.addMethod(
  22223. $core.method({
  22224. selector: "imports",
  22225. protocol: "accessing",
  22226. fn: function (){
  22227. var self=this,$self=this;
  22228. return $core.withContext(function($ctx1) {
  22229. var $1,$receiver;
  22230. $1=$self["@imports"];
  22231. if(($receiver = $1) == null || $receiver.a$nil){
  22232. $self._imports_([]);
  22233. return $self["@imports"];
  22234. } else {
  22235. return $1;
  22236. }
  22237. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22238. },
  22239. args: [],
  22240. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22241. referencedClasses: [],
  22242. messageSends: ["ifNil:", "imports:"]
  22243. }),
  22244. $globals.Package);
  22245. $core.addMethod(
  22246. $core.method({
  22247. selector: "imports:",
  22248. protocol: "accessing",
  22249. fn: function (anArray){
  22250. var self=this,$self=this;
  22251. return $core.withContext(function($ctx1) {
  22252. $self._validateImports_(anArray);
  22253. $self["@imports"]=$recv(anArray)._asSet();
  22254. return self;
  22255. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22256. },
  22257. args: ["anArray"],
  22258. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22259. referencedClasses: [],
  22260. messageSends: ["validateImports:", "asSet"]
  22261. }),
  22262. $globals.Package);
  22263. $core.addMethod(
  22264. $core.method({
  22265. selector: "importsAsJson",
  22266. protocol: "converting",
  22267. fn: function (){
  22268. var self=this,$self=this;
  22269. return $core.withContext(function($ctx1) {
  22270. var $1;
  22271. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22272. return $core.withContext(function($ctx2) {
  22273. $1=$recv(each)._isString();
  22274. if($core.assert($1)){
  22275. return each;
  22276. } else {
  22277. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22278. $ctx2.sendIdx[","]=1;
  22279. }
  22280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22281. }));
  22282. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22283. },
  22284. args: [],
  22285. 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 ]]",
  22286. referencedClasses: [],
  22287. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22288. }),
  22289. $globals.Package);
  22290. $core.addMethod(
  22291. $core.method({
  22292. selector: "importsDefinition",
  22293. protocol: "accessing",
  22294. fn: function (){
  22295. var self=this,$self=this;
  22296. return $core.withContext(function($ctx1) {
  22297. return $recv($globals.String)._streamContents_((function(stream){
  22298. return $core.withContext(function($ctx2) {
  22299. $recv(stream)._write_("{");
  22300. $ctx2.sendIdx["write:"]=1;
  22301. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22302. return $core.withContext(function($ctx3) {
  22303. return $recv(stream)._print_(each);
  22304. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22305. }),(function(){
  22306. return $core.withContext(function($ctx3) {
  22307. return $recv(stream)._write_(". ");
  22308. $ctx3.sendIdx["write:"]=2;
  22309. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22310. }));
  22311. return $recv(stream)._write_("}");
  22312. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22313. }));
  22314. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22315. },
  22316. args: [],
  22317. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  22318. referencedClasses: ["String"],
  22319. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22320. }),
  22321. $globals.Package);
  22322. $core.addMethod(
  22323. $core.method({
  22324. selector: "importsFromJson:",
  22325. protocol: "converting",
  22326. fn: function (anArray){
  22327. var self=this,$self=this;
  22328. return $core.withContext(function($ctx1) {
  22329. var $1;
  22330. return $recv(anArray)._collect_((function(each){
  22331. var split;
  22332. return $core.withContext(function($ctx2) {
  22333. split=$recv(each)._tokenize_("=");
  22334. $1=$recv($recv(split)._size()).__eq((1));
  22335. if($core.assert($1)){
  22336. return $recv(split)._first();
  22337. $ctx2.sendIdx["first"]=1;
  22338. } else {
  22339. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22340. }
  22341. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22342. }));
  22343. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22344. },
  22345. args: ["anArray"],
  22346. 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 ]]",
  22347. referencedClasses: [],
  22348. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22349. }),
  22350. $globals.Package);
  22351. $core.addMethod(
  22352. $core.method({
  22353. selector: "initialize",
  22354. protocol: "initialization",
  22355. fn: function (){
  22356. var self=this,$self=this;
  22357. return $core.withContext(function($ctx1) {
  22358. (
  22359. $ctx1.supercall = true,
  22360. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22361. $ctx1.supercall = false;
  22362. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22363. $ctx1.sendIdx["new"]=1;
  22364. $self["@evalBlock"]=nil;
  22365. $self["@dirty"]=nil;
  22366. $self["@imports"]=nil;
  22367. $self["@isReady"]=$recv($globals.Promise)._new();
  22368. $self["@transport"]=nil;
  22369. return self;
  22370. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22371. },
  22372. args: [],
  22373. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09isReady := Promise new.\x0a\x09transport := nil",
  22374. referencedClasses: ["PackageOrganizer", "Promise"],
  22375. messageSends: ["initialize", "new"]
  22376. }),
  22377. $globals.Package);
  22378. $core.addMethod(
  22379. $core.method({
  22380. selector: "isDirty",
  22381. protocol: "testing",
  22382. fn: function (){
  22383. var self=this,$self=this;
  22384. return $core.withContext(function($ctx1) {
  22385. var $1,$receiver;
  22386. $1=$self["@dirty"];
  22387. if(($receiver = $1) == null || $receiver.a$nil){
  22388. return false;
  22389. } else {
  22390. return $1;
  22391. }
  22392. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22393. },
  22394. args: [],
  22395. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22396. referencedClasses: [],
  22397. messageSends: ["ifNil:"]
  22398. }),
  22399. $globals.Package);
  22400. $core.addMethod(
  22401. $core.method({
  22402. selector: "isPackage",
  22403. protocol: "testing",
  22404. fn: function (){
  22405. var self=this,$self=this;
  22406. return true;
  22407. },
  22408. args: [],
  22409. source: "isPackage\x0a\x09^ true",
  22410. referencedClasses: [],
  22411. messageSends: []
  22412. }),
  22413. $globals.Package);
  22414. $core.addMethod(
  22415. $core.method({
  22416. selector: "isReady",
  22417. protocol: "accessing",
  22418. fn: function (){
  22419. var self=this,$self=this;
  22420. return $self["@isReady"];
  22421. },
  22422. args: [],
  22423. source: "isReady\x0a\x09^ isReady",
  22424. referencedClasses: [],
  22425. messageSends: []
  22426. }),
  22427. $globals.Package);
  22428. $core.addMethod(
  22429. $core.method({
  22430. selector: "isReady:",
  22431. protocol: "accessing",
  22432. fn: function (aPromise){
  22433. var self=this,$self=this;
  22434. $self["@isReady"]=aPromise;
  22435. return self;
  22436. },
  22437. args: ["aPromise"],
  22438. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  22439. referencedClasses: [],
  22440. messageSends: []
  22441. }),
  22442. $globals.Package);
  22443. $core.addMethod(
  22444. $core.method({
  22445. selector: "javaScriptDescriptor:",
  22446. protocol: "accessing",
  22447. fn: function (anObject){
  22448. var self=this,$self=this;
  22449. var basicEval,basicImports,basicIsReady;
  22450. return $core.withContext(function($ctx1) {
  22451. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22452. return $core.withContext(function($ctx2) {
  22453. return nil._asJavaScriptObject();
  22454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22455. }));
  22456. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22457. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22458. return [];
  22459. }));
  22460. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22461. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22462. }));
  22463. $ctx1.sendIdx["at:ifAbsent:"]=3;
  22464. basicIsReady=$recv(anObject)._at_ifAbsent_("isReady",$recv($globals.Promise)._new());
  22465. $self._evalBlock_(basicEval);
  22466. $self._imports_($self._importsFromJson_(basicImports));
  22467. return self;
  22468. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports,basicIsReady:basicIsReady},$globals.Package)});
  22469. },
  22470. args: ["anObject"],
  22471. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports basicIsReady |\x0a\x0a\x09basicEval := anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ].\x0a\x09basicImports := anObject at: 'imports' ifAbsent: [ #() ].\x0a\x09basicTransport := anObject at: 'transport' ifAbsent: [].\x0a\x09basicIsReady := anObject at: 'isReady' ifAbsent: Promise new.\x0a\x09\x09\x09\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22472. referencedClasses: ["Promise"],
  22473. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "new", "evalBlock:", "imports:", "importsFromJson:"]
  22474. }),
  22475. $globals.Package);
  22476. $core.addMethod(
  22477. $core.method({
  22478. selector: "loadDependencies",
  22479. protocol: "dependencies",
  22480. fn: function (){
  22481. var self=this,$self=this;
  22482. var classes,packages;
  22483. return $core.withContext(function($ctx1) {
  22484. var $1;
  22485. classes=$self._loadDependencyClasses();
  22486. $1=$recv($recv(classes)._collect_((function(each){
  22487. return $core.withContext(function($ctx2) {
  22488. return $recv(each)._package();
  22489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22490. })))._asSet();
  22491. $recv($1)._remove_ifAbsent_(self,(function(){
  22492. }));
  22493. return $recv($1)._yourself();
  22494. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22495. },
  22496. args: [],
  22497. 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",
  22498. referencedClasses: [],
  22499. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22500. }),
  22501. $globals.Package);
  22502. $core.addMethod(
  22503. $core.method({
  22504. selector: "loadDependencyClasses",
  22505. protocol: "dependencies",
  22506. fn: function (){
  22507. var self=this,$self=this;
  22508. var starCategoryName;
  22509. return $core.withContext(function($ctx1) {
  22510. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22511. starCategoryName="*".__comma($self._name());
  22512. $ctx1.sendIdx[","]=1;
  22513. $3=$self._classes();
  22514. $ctx1.sendIdx["classes"]=1;
  22515. $2=$recv($3)._collect_((function(each){
  22516. return $core.withContext(function($ctx2) {
  22517. return $recv(each)._superclass();
  22518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22519. }));
  22520. $ctx1.sendIdx["collect:"]=1;
  22521. $1=$recv($2)._asSet();
  22522. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22523. return $core.withContext(function($ctx2) {
  22524. $5=$recv(each)._protocols();
  22525. $ctx2.sendIdx["protocols"]=1;
  22526. $7=$recv(each)._theMetaClass();
  22527. if(($receiver = $7) == null || $receiver.a$nil){
  22528. $6=[];
  22529. } else {
  22530. var meta;
  22531. meta=$receiver;
  22532. $6=$recv(meta)._protocols();
  22533. }
  22534. $4=$recv($5).__comma($6);
  22535. return $recv($4)._includes_(starCategoryName);
  22536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22537. })));
  22538. $ctx1.sendIdx["addAll:"]=1;
  22539. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22540. return $core.withContext(function($ctx2) {
  22541. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22542. return $core.withContext(function($ctx3) {
  22543. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22544. return $core.withContext(function($ctx4) {
  22545. return $recv(eachTT)._trait();
  22546. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22547. })));
  22548. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22549. }));
  22550. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22551. })));
  22552. $recv($1)._remove_ifAbsent_(nil,(function(){
  22553. }));
  22554. return $recv($1)._yourself();
  22555. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22556. },
  22557. args: [],
  22558. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x0a\x09as well as all traits used\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09addAll: (Array streamContents: [ :as | self traitCompositions valuesDo: [ :each | as write: (each collect: [ :eachTT | eachTT trait ])]]);\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09yourself",
  22559. referencedClasses: ["Smalltalk", "Array"],
  22560. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22561. }),
  22562. $globals.Package);
  22563. $core.addMethod(
  22564. $core.method({
  22565. selector: "name",
  22566. protocol: "accessing",
  22567. fn: function (){
  22568. var self=this,$self=this;
  22569. return $self["@name"];
  22570. },
  22571. args: [],
  22572. source: "name\x0a\x09^ name",
  22573. referencedClasses: [],
  22574. messageSends: []
  22575. }),
  22576. $globals.Package);
  22577. $core.addMethod(
  22578. $core.method({
  22579. selector: "name:",
  22580. protocol: "accessing",
  22581. fn: function (aString){
  22582. var self=this,$self=this;
  22583. $self["@name"]=aString;
  22584. return self;
  22585. },
  22586. args: ["aString"],
  22587. source: "name: aString\x0a\x09name := aString",
  22588. referencedClasses: [],
  22589. messageSends: []
  22590. }),
  22591. $globals.Package);
  22592. $core.addMethod(
  22593. $core.method({
  22594. selector: "organization",
  22595. protocol: "accessing",
  22596. fn: function (){
  22597. var self=this,$self=this;
  22598. return $self["@organization"];
  22599. },
  22600. args: [],
  22601. source: "organization\x0a\x09^ organization",
  22602. referencedClasses: [],
  22603. messageSends: []
  22604. }),
  22605. $globals.Package);
  22606. $core.addMethod(
  22607. $core.method({
  22608. selector: "printOn:",
  22609. protocol: "printing",
  22610. fn: function (aStream){
  22611. var self=this,$self=this;
  22612. return $core.withContext(function($ctx1) {
  22613. (
  22614. $ctx1.supercall = true,
  22615. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22616. $ctx1.supercall = false;
  22617. $recv(aStream)._nextPutAll_(" (");
  22618. $ctx1.sendIdx["nextPutAll:"]=1;
  22619. $recv(aStream)._nextPutAll_($self._name());
  22620. $ctx1.sendIdx["nextPutAll:"]=2;
  22621. $recv(aStream)._nextPutAll_(")");
  22622. return self;
  22623. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22624. },
  22625. args: ["aStream"],
  22626. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22627. referencedClasses: [],
  22628. messageSends: ["printOn:", "nextPutAll:", "name"]
  22629. }),
  22630. $globals.Package);
  22631. $core.addMethod(
  22632. $core.method({
  22633. selector: "setupClasses",
  22634. protocol: "classes",
  22635. fn: function (){
  22636. var self=this,$self=this;
  22637. return $core.withContext(function($ctx1) {
  22638. $recv($self._classes())._do_((function(each){
  22639. return $core.withContext(function($ctx2) {
  22640. return $recv(each)._initialize();
  22641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22642. }));
  22643. return self;
  22644. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22645. },
  22646. args: [],
  22647. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22648. referencedClasses: [],
  22649. messageSends: ["do:", "classes", "initialize"]
  22650. }),
  22651. $globals.Package);
  22652. $core.addMethod(
  22653. $core.method({
  22654. selector: "sortedClasses",
  22655. protocol: "classes",
  22656. fn: function (){
  22657. var self=this,$self=this;
  22658. return $core.withContext(function($ctx1) {
  22659. return $recv($self._class())._sortedClasses_($self._classes());
  22660. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22661. },
  22662. args: [],
  22663. 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",
  22664. referencedClasses: [],
  22665. messageSends: ["sortedClasses:", "class", "classes"]
  22666. }),
  22667. $globals.Package);
  22668. $core.addMethod(
  22669. $core.method({
  22670. selector: "sortedImportsAsArray",
  22671. protocol: "private",
  22672. fn: function (){
  22673. var self=this,$self=this;
  22674. return $core.withContext(function($ctx1) {
  22675. var $3,$2,$4,$1,$6,$5,$7;
  22676. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22677. return $core.withContext(function($ctx2) {
  22678. $3=$recv(a)._isString();
  22679. $ctx2.sendIdx["isString"]=1;
  22680. $2=$recv($3)._not();
  22681. $4=$recv(b)._isString();
  22682. $ctx2.sendIdx["isString"]=2;
  22683. $1=$recv($2).__and($4);
  22684. return $recv($1)._or_((function(){
  22685. return $core.withContext(function($ctx3) {
  22686. $6=$recv(a)._isString();
  22687. $ctx3.sendIdx["isString"]=3;
  22688. $5=$recv($6).__eq($recv(b)._isString());
  22689. return $recv($5)._and_((function(){
  22690. return $core.withContext(function($ctx4) {
  22691. $7=$recv(a)._value();
  22692. $ctx4.sendIdx["value"]=1;
  22693. return $recv($7).__lt_eq($recv(b)._value());
  22694. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22695. }));
  22696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22697. }));
  22698. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22699. }));
  22700. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22701. },
  22702. args: [],
  22703. 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 ]]]",
  22704. referencedClasses: [],
  22705. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22706. }),
  22707. $globals.Package);
  22708. $core.addMethod(
  22709. $core.method({
  22710. selector: "traitCompositions",
  22711. protocol: "dependencies",
  22712. fn: function (){
  22713. var self=this,$self=this;
  22714. var traitCompositions;
  22715. return $core.withContext(function($ctx1) {
  22716. var $1,$2,$3,$receiver;
  22717. traitCompositions=$recv($globals.Dictionary)._new();
  22718. $recv($self._classes())._do_((function(each){
  22719. return $core.withContext(function($ctx2) {
  22720. $1=traitCompositions;
  22721. $2=$recv(each)._traitComposition();
  22722. $ctx2.sendIdx["traitComposition"]=1;
  22723. $recv($1)._at_put_(each,$2);
  22724. $ctx2.sendIdx["at:put:"]=1;
  22725. $3=$recv(each)._theMetaClass();
  22726. if(($receiver = $3) == null || $receiver.a$nil){
  22727. return $3;
  22728. } else {
  22729. var meta;
  22730. meta=$receiver;
  22731. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22732. }
  22733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22734. }));
  22735. return $recv(traitCompositions)._reject_((function(each){
  22736. return $core.withContext(function($ctx2) {
  22737. return $recv(each)._isEmpty();
  22738. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22739. }));
  22740. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22741. },
  22742. args: [],
  22743. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | traitCompositions at: meta put: meta traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  22744. referencedClasses: ["Dictionary"],
  22745. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22746. }),
  22747. $globals.Package);
  22748. $core.addMethod(
  22749. $core.method({
  22750. selector: "transport",
  22751. protocol: "accessing",
  22752. fn: function (){
  22753. var self=this,$self=this;
  22754. return $core.withContext(function($ctx1) {
  22755. var $1,$receiver;
  22756. $1=$self["@transport"];
  22757. if(($receiver = $1) == null || $receiver.a$nil){
  22758. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22759. return $self["@transport"];
  22760. } else {
  22761. return $1;
  22762. }
  22763. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22764. },
  22765. args: [],
  22766. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22767. referencedClasses: ["PackageTransport"],
  22768. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22769. }),
  22770. $globals.Package);
  22771. $core.addMethod(
  22772. $core.method({
  22773. selector: "transport:",
  22774. protocol: "accessing",
  22775. fn: function (aPackageTransport){
  22776. var self=this,$self=this;
  22777. return $core.withContext(function($ctx1) {
  22778. $self["@transport"]=aPackageTransport;
  22779. $recv(aPackageTransport)._package_(self);
  22780. return self;
  22781. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22782. },
  22783. args: ["aPackageTransport"],
  22784. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22785. referencedClasses: [],
  22786. messageSends: ["package:"]
  22787. }),
  22788. $globals.Package);
  22789. $core.addMethod(
  22790. $core.method({
  22791. selector: "validateImports:",
  22792. protocol: "validation",
  22793. fn: function (aCollection){
  22794. var self=this,$self=this;
  22795. return $core.withContext(function($ctx1) {
  22796. var $1,$2,$5,$4,$3,$6;
  22797. $recv(aCollection)._do_((function(import_){
  22798. return $core.withContext(function($ctx2) {
  22799. $1=$recv(import_)._isString();
  22800. $ctx2.sendIdx["isString"]=1;
  22801. if(!$core.assert($1)){
  22802. $2=$recv(import_)._respondsTo_("key");
  22803. if(!$core.assert($2)){
  22804. $self._error_("Imports must be Strings or Associations");
  22805. $ctx2.sendIdx["error:"]=1;
  22806. }
  22807. $5=$recv(import_)._key();
  22808. $ctx2.sendIdx["key"]=1;
  22809. $4=$recv($5)._isString();
  22810. $ctx2.sendIdx["isString"]=2;
  22811. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22812. if(!$core.assert($3)){
  22813. $self._error_("Key and value must be Strings");
  22814. $ctx2.sendIdx["error:"]=2;
  22815. }
  22816. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22817. if(!$core.assert($6)){
  22818. return $self._error_("Keys must be identifiers");
  22819. }
  22820. }
  22821. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22822. }));
  22823. return self;
  22824. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22825. },
  22826. args: ["aCollection"],
  22827. 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' ]]]",
  22828. referencedClasses: [],
  22829. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22830. }),
  22831. $globals.Package);
  22832. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22833. $core.addMethod(
  22834. $core.method({
  22835. selector: "named:",
  22836. protocol: "accessing",
  22837. fn: function (aPackageName){
  22838. var self=this,$self=this;
  22839. return $core.withContext(function($ctx1) {
  22840. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22841. return $core.withContext(function($ctx2) {
  22842. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22844. }));
  22845. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22846. },
  22847. args: ["aPackageName"],
  22848. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22849. referencedClasses: ["Smalltalk"],
  22850. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22851. }),
  22852. $globals.Package.a$cls);
  22853. $core.addMethod(
  22854. $core.method({
  22855. selector: "named:ifAbsent:",
  22856. protocol: "accessing",
  22857. fn: function (aPackageName,aBlock){
  22858. var self=this,$self=this;
  22859. return $core.withContext(function($ctx1) {
  22860. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22861. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22862. },
  22863. args: ["aPackageName", "aBlock"],
  22864. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22865. referencedClasses: ["Smalltalk"],
  22866. messageSends: ["packageAt:ifAbsent:"]
  22867. }),
  22868. $globals.Package.a$cls);
  22869. $core.addMethod(
  22870. $core.method({
  22871. selector: "named:imports:transport:",
  22872. protocol: "accessing",
  22873. fn: function (aPackageName,anArray,aTransport){
  22874. var self=this,$self=this;
  22875. var pkg;
  22876. return $core.withContext(function($ctx1) {
  22877. pkg=$self._named_(aPackageName);
  22878. $recv(pkg)._imports_(anArray);
  22879. $recv(pkg)._transport_(aTransport);
  22880. return pkg;
  22881. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22882. },
  22883. args: ["aPackageName", "anArray", "aTransport"],
  22884. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22885. referencedClasses: [],
  22886. messageSends: ["named:", "imports:", "transport:"]
  22887. }),
  22888. $globals.Package.a$cls);
  22889. $core.addMethod(
  22890. $core.method({
  22891. selector: "named:javaScriptDescriptor:",
  22892. protocol: "instance creation",
  22893. fn: function (aString,anObject){
  22894. var self=this,$self=this;
  22895. var pkg;
  22896. return $core.withContext(function($ctx1) {
  22897. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22898. $recv(pkg)._javaScriptDescriptor_(anObject);
  22899. return pkg;
  22900. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22901. },
  22902. args: ["aString", "anObject"],
  22903. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22904. referencedClasses: ["Smalltalk"],
  22905. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22906. }),
  22907. $globals.Package.a$cls);
  22908. $core.addMethod(
  22909. $core.method({
  22910. selector: "named:transport:",
  22911. protocol: "accessing",
  22912. fn: function (aPackageName,aTransport){
  22913. var self=this,$self=this;
  22914. var pkg;
  22915. return $core.withContext(function($ctx1) {
  22916. pkg=$self._named_(aPackageName);
  22917. $recv(pkg)._transport_(aTransport);
  22918. return pkg;
  22919. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22920. },
  22921. args: ["aPackageName", "aTransport"],
  22922. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22923. referencedClasses: [],
  22924. messageSends: ["named:", "transport:"]
  22925. }),
  22926. $globals.Package.a$cls);
  22927. $core.addMethod(
  22928. $core.method({
  22929. selector: "new:",
  22930. protocol: "instance creation",
  22931. fn: function (aString){
  22932. var self=this,$self=this;
  22933. return $core.withContext(function($ctx1) {
  22934. var $1;
  22935. $1=$recv($globals.Package)._new();
  22936. $recv($1)._name_(aString);
  22937. return $recv($1)._yourself();
  22938. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22939. },
  22940. args: ["aString"],
  22941. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22942. referencedClasses: ["Package"],
  22943. messageSends: ["name:", "new", "yourself"]
  22944. }),
  22945. $globals.Package.a$cls);
  22946. $core.addMethod(
  22947. $core.method({
  22948. selector: "sortedClasses:",
  22949. protocol: "sorting",
  22950. fn: function (classes){
  22951. var self=this,$self=this;
  22952. var children,others,nodes,expandedClasses;
  22953. return $core.withContext(function($ctx1) {
  22954. var $1,$3,$2;
  22955. children=[];
  22956. others=[];
  22957. $recv(classes)._do_((function(each){
  22958. return $core.withContext(function($ctx2) {
  22959. $1=$recv(classes)._includes_($recv(each)._superclass());
  22960. if($core.assert($1)){
  22961. return $recv(others)._add_(each);
  22962. } else {
  22963. return $recv(children)._add_(each);
  22964. $ctx2.sendIdx["add:"]=1;
  22965. }
  22966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22967. }));
  22968. $ctx1.sendIdx["do:"]=1;
  22969. nodes=$recv(children)._collect_((function(each){
  22970. return $core.withContext(function($ctx2) {
  22971. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22973. }));
  22974. nodes=$recv(nodes)._sorted_((function(a,b){
  22975. return $core.withContext(function($ctx2) {
  22976. $3=$recv(a)._theClass();
  22977. $ctx2.sendIdx["theClass"]=1;
  22978. $2=$recv($3)._name();
  22979. $ctx2.sendIdx["name"]=1;
  22980. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22981. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22982. }));
  22983. expandedClasses=$recv($globals.Array)._new();
  22984. $recv(nodes)._do_((function(aNode){
  22985. return $core.withContext(function($ctx2) {
  22986. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22987. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22988. }));
  22989. return expandedClasses;
  22990. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22991. },
  22992. args: ["classes"],
  22993. 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",
  22994. referencedClasses: ["ClassSorterNode", "Array"],
  22995. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  22996. }),
  22997. $globals.Package.a$cls);
  22998. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  22999. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23000. $core.addMethod(
  23001. $core.method({
  23002. selector: "announcer",
  23003. protocol: "accessing",
  23004. fn: function (){
  23005. var self=this,$self=this;
  23006. return $core.withContext(function($ctx1) {
  23007. return $recv($globals.SystemAnnouncer)._current();
  23008. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23009. },
  23010. args: [],
  23011. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23012. referencedClasses: ["SystemAnnouncer"],
  23013. messageSends: ["current"]
  23014. }),
  23015. $globals.PackageStateObserver);
  23016. $core.addMethod(
  23017. $core.method({
  23018. selector: "observeSystem",
  23019. protocol: "actions",
  23020. fn: function (){
  23021. var self=this,$self=this;
  23022. return $core.withContext(function($ctx1) {
  23023. var $1;
  23024. $1=$self._announcer();
  23025. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23026. $ctx1.sendIdx["on:send:to:"]=1;
  23027. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23028. $ctx1.sendIdx["on:send:to:"]=2;
  23029. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23030. $ctx1.sendIdx["on:send:to:"]=3;
  23031. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23032. return self;
  23033. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23034. },
  23035. args: [],
  23036. 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",
  23037. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23038. messageSends: ["on:send:to:", "announcer"]
  23039. }),
  23040. $globals.PackageStateObserver);
  23041. $core.addMethod(
  23042. $core.method({
  23043. selector: "onClassModification:",
  23044. protocol: "reactions",
  23045. fn: function (anAnnouncement){
  23046. var self=this,$self=this;
  23047. return $core.withContext(function($ctx1) {
  23048. var $1,$receiver;
  23049. $1=$recv(anAnnouncement)._theClass();
  23050. if(($receiver = $1) == null || $receiver.a$nil){
  23051. $1;
  23052. } else {
  23053. var theClass;
  23054. theClass=$receiver;
  23055. $recv($recv(theClass)._package())._beDirty();
  23056. }
  23057. return self;
  23058. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23059. },
  23060. args: ["anAnnouncement"],
  23061. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23062. referencedClasses: [],
  23063. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23064. }),
  23065. $globals.PackageStateObserver);
  23066. $core.addMethod(
  23067. $core.method({
  23068. selector: "onMethodModification:",
  23069. protocol: "reactions",
  23070. fn: function (anAnnouncement){
  23071. var self=this,$self=this;
  23072. return $core.withContext(function($ctx1) {
  23073. var $1,$receiver;
  23074. $1=$recv($recv(anAnnouncement)._method())._package();
  23075. if(($receiver = $1) == null || $receiver.a$nil){
  23076. $1;
  23077. } else {
  23078. var package_;
  23079. package_=$receiver;
  23080. $recv(package_)._beDirty();
  23081. }
  23082. return self;
  23083. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23084. },
  23085. args: ["anAnnouncement"],
  23086. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23087. referencedClasses: [],
  23088. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23089. }),
  23090. $globals.PackageStateObserver);
  23091. $core.addMethod(
  23092. $core.method({
  23093. selector: "onPackageAdded:",
  23094. protocol: "reactions",
  23095. fn: function (anAnnouncement){
  23096. var self=this,$self=this;
  23097. return $core.withContext(function($ctx1) {
  23098. $recv($recv(anAnnouncement)._package())._beDirty();
  23099. return self;
  23100. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23101. },
  23102. args: ["anAnnouncement"],
  23103. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23104. referencedClasses: [],
  23105. messageSends: ["beDirty", "package"]
  23106. }),
  23107. $globals.PackageStateObserver);
  23108. $core.addMethod(
  23109. $core.method({
  23110. selector: "onProtocolModification:",
  23111. protocol: "reactions",
  23112. fn: function (anAnnouncement){
  23113. var self=this,$self=this;
  23114. return $core.withContext(function($ctx1) {
  23115. var $1,$receiver;
  23116. $1=$recv(anAnnouncement)._package();
  23117. if(($receiver = $1) == null || $receiver.a$nil){
  23118. $1;
  23119. } else {
  23120. var package_;
  23121. package_=$receiver;
  23122. $recv(package_)._beDirty();
  23123. }
  23124. return self;
  23125. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23126. },
  23127. args: ["anAnnouncement"],
  23128. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23129. referencedClasses: [],
  23130. messageSends: ["ifNotNil:", "package", "beDirty"]
  23131. }),
  23132. $globals.PackageStateObserver);
  23133. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23134. $core.addMethod(
  23135. $core.method({
  23136. selector: "current",
  23137. protocol: "accessing",
  23138. fn: function (){
  23139. var self=this,$self=this;
  23140. return $core.withContext(function($ctx1) {
  23141. var $1,$receiver;
  23142. $1=$self["@current"];
  23143. if(($receiver = $1) == null || $receiver.a$nil){
  23144. $self["@current"]=$self._new();
  23145. return $self["@current"];
  23146. } else {
  23147. return $1;
  23148. }
  23149. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23150. },
  23151. args: [],
  23152. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23153. referencedClasses: [],
  23154. messageSends: ["ifNil:", "new"]
  23155. }),
  23156. $globals.PackageStateObserver.a$cls);
  23157. $core.addMethod(
  23158. $core.method({
  23159. selector: "initialize",
  23160. protocol: "initialization",
  23161. fn: function (){
  23162. var self=this,$self=this;
  23163. return $core.withContext(function($ctx1) {
  23164. $recv($self._current())._observeSystem();
  23165. return self;
  23166. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23167. },
  23168. args: [],
  23169. source: "initialize\x0a\x09self current observeSystem",
  23170. referencedClasses: [],
  23171. messageSends: ["observeSystem", "current"]
  23172. }),
  23173. $globals.PackageStateObserver.a$cls);
  23174. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23175. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23176. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23177. $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`";
  23178. $core.addMethod(
  23179. $core.method({
  23180. selector: "defaultValue",
  23181. protocol: "accessing",
  23182. fn: function (){
  23183. var self=this,$self=this;
  23184. return $self["@defaultValue"];
  23185. },
  23186. args: [],
  23187. source: "defaultValue\x0a\x09^ defaultValue",
  23188. referencedClasses: [],
  23189. messageSends: []
  23190. }),
  23191. $globals.Setting);
  23192. $core.addMethod(
  23193. $core.method({
  23194. selector: "defaultValue:",
  23195. protocol: "accessing",
  23196. fn: function (aStringifiableObject){
  23197. var self=this,$self=this;
  23198. $self["@defaultValue"]=aStringifiableObject;
  23199. return self;
  23200. },
  23201. args: ["aStringifiableObject"],
  23202. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23203. referencedClasses: [],
  23204. messageSends: []
  23205. }),
  23206. $globals.Setting);
  23207. $core.addMethod(
  23208. $core.method({
  23209. selector: "key",
  23210. protocol: "accessing",
  23211. fn: function (){
  23212. var self=this,$self=this;
  23213. return $self["@key"];
  23214. },
  23215. args: [],
  23216. source: "key\x0a\x09^ key",
  23217. referencedClasses: [],
  23218. messageSends: []
  23219. }),
  23220. $globals.Setting);
  23221. $core.addMethod(
  23222. $core.method({
  23223. selector: "key:",
  23224. protocol: "accessing",
  23225. fn: function (aString){
  23226. var self=this,$self=this;
  23227. $self["@key"]=aString;
  23228. return self;
  23229. },
  23230. args: ["aString"],
  23231. source: "key: aString\x0a\x09key := aString",
  23232. referencedClasses: [],
  23233. messageSends: []
  23234. }),
  23235. $globals.Setting);
  23236. $core.addMethod(
  23237. $core.method({
  23238. selector: "value",
  23239. protocol: "accessing",
  23240. fn: function (){
  23241. var self=this,$self=this;
  23242. return $core.withContext(function($ctx1) {
  23243. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23244. return $core.withContext(function($ctx2) {
  23245. return $self._defaultValue();
  23246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23247. }));
  23248. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23249. },
  23250. args: [],
  23251. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23252. referencedClasses: ["Smalltalk"],
  23253. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23254. }),
  23255. $globals.Setting);
  23256. $core.addMethod(
  23257. $core.method({
  23258. selector: "value:",
  23259. protocol: "accessing",
  23260. fn: function (aStringifiableObject){
  23261. var self=this,$self=this;
  23262. return $core.withContext(function($ctx1) {
  23263. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23264. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23265. },
  23266. args: ["aStringifiableObject"],
  23267. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23268. referencedClasses: ["Smalltalk"],
  23269. messageSends: ["at:put:", "settings", "key"]
  23270. }),
  23271. $globals.Setting);
  23272. $core.addMethod(
  23273. $core.method({
  23274. selector: "at:ifAbsent:",
  23275. protocol: "instance creation",
  23276. fn: function (aString,aDefaultValue){
  23277. var self=this,$self=this;
  23278. return $core.withContext(function($ctx1) {
  23279. var $1;
  23280. $1=(
  23281. $ctx1.supercall = true,
  23282. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23283. $ctx1.supercall = false;
  23284. $recv($1)._key_(aString);
  23285. $recv($1)._defaultValue_(aDefaultValue);
  23286. return $recv($1)._yourself();
  23287. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23288. },
  23289. args: ["aString", "aDefaultValue"],
  23290. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23291. referencedClasses: [],
  23292. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23293. }),
  23294. $globals.Setting.a$cls);
  23295. $core.addMethod(
  23296. $core.method({
  23297. selector: "new",
  23298. protocol: "instance creation",
  23299. fn: function (){
  23300. var self=this,$self=this;
  23301. return $core.withContext(function($ctx1) {
  23302. $self._shouldNotImplement();
  23303. return self;
  23304. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23305. },
  23306. args: [],
  23307. source: "new\x0a\x09self shouldNotImplement",
  23308. referencedClasses: [],
  23309. messageSends: ["shouldNotImplement"]
  23310. }),
  23311. $globals.Setting.a$cls);
  23312. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23313. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `base/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `base/parser.js` parser file in order to work.";
  23314. $core.addMethod(
  23315. $core.method({
  23316. selector: "addGlobalJsVariable:",
  23317. protocol: "globals",
  23318. fn: function (aString){
  23319. var self=this,$self=this;
  23320. return $core.withContext(function($ctx1) {
  23321. $recv($self._globalJsVariables())._add_(aString);
  23322. return self;
  23323. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23324. },
  23325. args: ["aString"],
  23326. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23327. referencedClasses: [],
  23328. messageSends: ["add:", "globalJsVariables"]
  23329. }),
  23330. $globals.SmalltalkImage);
  23331. $core.addMethod(
  23332. $core.method({
  23333. selector: "adoptPackageDescriptors",
  23334. protocol: "private",
  23335. fn: function (){
  23336. var self=this,$self=this;
  23337. var pkgs;
  23338. return $core.withContext(function($ctx1) {
  23339. pkgs=$recv($globals.Set)._new();
  23340. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23341. return $core.withContext(function($ctx2) {
  23342. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23343. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23344. }));
  23345. return pkgs;
  23346. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23347. },
  23348. args: [],
  23349. source: "adoptPackageDescriptors\x0a\x09| pkgs |\x0a\x09pkgs := Set new.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09pkgs add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ pkgs",
  23350. referencedClasses: ["Set", "Package"],
  23351. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23352. }),
  23353. $globals.SmalltalkImage);
  23354. $core.addMethod(
  23355. $core.method({
  23356. selector: "amdRequire",
  23357. protocol: "accessing amd",
  23358. fn: function (){
  23359. var self=this,$self=this;
  23360. return $core.withContext(function($ctx1) {
  23361. return $recv($self._core())._at_("amdRequire");
  23362. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23363. },
  23364. args: [],
  23365. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23366. referencedClasses: [],
  23367. messageSends: ["at:", "core"]
  23368. }),
  23369. $globals.SmalltalkImage);
  23370. $core.addMethod(
  23371. $core.method({
  23372. selector: "asSmalltalkException:",
  23373. protocol: "error handling",
  23374. fn: function (anObject){
  23375. var self=this,$self=this;
  23376. return $core.withContext(function($ctx1) {
  23377. var $1;
  23378. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23379. return $core.withContext(function($ctx2) {
  23380. return $recv(anObject)._isKindOf_($globals.Error);
  23381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23382. }));
  23383. if($core.assert($1)){
  23384. return anObject;
  23385. } else {
  23386. return $recv($globals.JavaScriptException)._on_(anObject);
  23387. }
  23388. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23389. },
  23390. args: ["anObject"],
  23391. 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 ]",
  23392. referencedClasses: ["Error", "JavaScriptException"],
  23393. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23394. }),
  23395. $globals.SmalltalkImage);
  23396. $core.addMethod(
  23397. $core.method({
  23398. selector: "basicCreatePackage:",
  23399. protocol: "private",
  23400. fn: function (packageName){
  23401. var self=this,$self=this;
  23402. return $core.withContext(function($ctx1) {
  23403. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23404. return $core.withContext(function($ctx2) {
  23405. return $recv($globals.Package)._new_(packageName);
  23406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23407. }));
  23408. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23409. },
  23410. args: ["packageName"],
  23411. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09^ self packageDictionary at: packageName ifAbsentPut: [ Package new: packageName ]",
  23412. referencedClasses: ["Package"],
  23413. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23414. }),
  23415. $globals.SmalltalkImage);
  23416. $core.addMethod(
  23417. $core.method({
  23418. selector: "basicParse:",
  23419. protocol: "private",
  23420. fn: function (aString){
  23421. var self=this,$self=this;
  23422. return $core.withContext(function($ctx1) {
  23423. return $recv($globals.SmalltalkParser)._parse_(aString);
  23424. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23425. },
  23426. args: ["aString"],
  23427. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23428. referencedClasses: ["SmalltalkParser"],
  23429. messageSends: ["parse:"]
  23430. }),
  23431. $globals.SmalltalkImage);
  23432. $core.addMethod(
  23433. $core.method({
  23434. selector: "cancelOptOut:",
  23435. protocol: "accessing",
  23436. fn: function (anObject){
  23437. var self=this,$self=this;
  23438. return $core.withContext(function($ctx1) {
  23439. delete anObject.klass; delete anObject.a$cls;;
  23440. return self;
  23441. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23442. },
  23443. args: ["anObject"],
  23444. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
  23445. referencedClasses: [],
  23446. messageSends: []
  23447. }),
  23448. $globals.SmalltalkImage);
  23449. $core.addMethod(
  23450. $core.method({
  23451. selector: "classes",
  23452. protocol: "classes",
  23453. fn: function (){
  23454. var self=this,$self=this;
  23455. return $core.withContext(function($ctx1) {
  23456. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23457. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23458. },
  23459. args: [],
  23460. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23461. referencedClasses: [],
  23462. messageSends: ["copy", "traitsOrClasses", "core"]
  23463. }),
  23464. $globals.SmalltalkImage);
  23465. $core.addMethod(
  23466. $core.method({
  23467. selector: "core",
  23468. protocol: "accessing",
  23469. fn: function (){
  23470. var self=this,$self=this;
  23471. return $core.withContext(function($ctx1) {
  23472. return $core;
  23473. return self;
  23474. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23475. },
  23476. args: [],
  23477. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23478. referencedClasses: [],
  23479. messageSends: []
  23480. }),
  23481. $globals.SmalltalkImage);
  23482. $core.addMethod(
  23483. $core.method({
  23484. selector: "createPackage:",
  23485. protocol: "packages",
  23486. fn: function (packageName){
  23487. var self=this,$self=this;
  23488. var package_,announcement;
  23489. return $core.withContext(function($ctx1) {
  23490. var $1;
  23491. package_=$self._basicCreatePackage_(packageName);
  23492. $1=$recv($globals.PackageAdded)._new();
  23493. $recv($1)._package_(package_);
  23494. announcement=$recv($1)._yourself();
  23495. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23496. return package_;
  23497. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23498. },
  23499. args: ["packageName"],
  23500. 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",
  23501. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23502. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23503. }),
  23504. $globals.SmalltalkImage);
  23505. $core.addMethod(
  23506. $core.method({
  23507. selector: "defaultAmdNamespace",
  23508. protocol: "accessing amd",
  23509. fn: function (){
  23510. var self=this,$self=this;
  23511. return $core.withContext(function($ctx1) {
  23512. return "transport.defaultAmdNamespace"._settingValue();
  23513. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23514. },
  23515. args: [],
  23516. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23517. referencedClasses: [],
  23518. messageSends: ["settingValue"]
  23519. }),
  23520. $globals.SmalltalkImage);
  23521. $core.addMethod(
  23522. $core.method({
  23523. selector: "defaultAmdNamespace:",
  23524. protocol: "accessing amd",
  23525. fn: function (aString){
  23526. var self=this,$self=this;
  23527. return $core.withContext(function($ctx1) {
  23528. "transport.defaultAmdNamespace"._settingValue_(aString);
  23529. return self;
  23530. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23531. },
  23532. args: ["aString"],
  23533. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23534. referencedClasses: [],
  23535. messageSends: ["settingValue:"]
  23536. }),
  23537. $globals.SmalltalkImage);
  23538. $core.addMethod(
  23539. $core.method({
  23540. selector: "deleteClass:",
  23541. protocol: "private",
  23542. fn: function (aClass){
  23543. var self=this,$self=this;
  23544. return $core.withContext(function($ctx1) {
  23545. $core.removeClass(aClass);
  23546. return self;
  23547. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23548. },
  23549. args: ["aClass"],
  23550. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  23551. referencedClasses: [],
  23552. messageSends: []
  23553. }),
  23554. $globals.SmalltalkImage);
  23555. $core.addMethod(
  23556. $core.method({
  23557. selector: "deleteGlobalJsVariable:",
  23558. protocol: "globals",
  23559. fn: function (aString){
  23560. var self=this,$self=this;
  23561. return $core.withContext(function($ctx1) {
  23562. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23563. }));
  23564. return self;
  23565. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23566. },
  23567. args: ["aString"],
  23568. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23569. referencedClasses: [],
  23570. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23571. }),
  23572. $globals.SmalltalkImage);
  23573. $core.addMethod(
  23574. $core.method({
  23575. selector: "existsJsGlobal:",
  23576. protocol: "testing",
  23577. fn: function (aString){
  23578. var self=this,$self=this;
  23579. return $core.withContext(function($ctx1) {
  23580. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23581. return $recv($globals.Platform)._includesGlobal_(aString);
  23582. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23583. },
  23584. args: ["aString"],
  23585. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23586. referencedClasses: ["Platform"],
  23587. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23588. }),
  23589. $globals.SmalltalkImage);
  23590. $core.addMethod(
  23591. $core.method({
  23592. selector: "globalJsVariables",
  23593. protocol: "globals",
  23594. fn: function (){
  23595. var self=this,$self=this;
  23596. return $core.withContext(function($ctx1) {
  23597. var $1,$receiver;
  23598. $1=$self["@globalJsVariables"];
  23599. if(($receiver = $1) == null || $receiver.a$nil){
  23600. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23601. return $self["@globalJsVariables"];
  23602. } else {
  23603. return $1;
  23604. }
  23605. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23606. },
  23607. args: [],
  23608. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23609. referencedClasses: [],
  23610. messageSends: ["ifNil:"]
  23611. }),
  23612. $globals.SmalltalkImage);
  23613. $core.addMethod(
  23614. $core.method({
  23615. selector: "globals",
  23616. protocol: "accessing",
  23617. fn: function (){
  23618. var self=this,$self=this;
  23619. return $core.withContext(function($ctx1) {
  23620. return $globals;
  23621. return self;
  23622. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23623. },
  23624. args: [],
  23625. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23626. referencedClasses: [],
  23627. messageSends: []
  23628. }),
  23629. $globals.SmalltalkImage);
  23630. $core.addMethod(
  23631. $core.method({
  23632. selector: "includesKey:",
  23633. protocol: "accessing",
  23634. fn: function (aKey){
  23635. var self=this,$self=this;
  23636. return $core.withContext(function($ctx1) {
  23637. return $core.hasOwnProperty(aKey);
  23638. return self;
  23639. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23640. },
  23641. args: ["aKey"],
  23642. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23643. referencedClasses: [],
  23644. messageSends: []
  23645. }),
  23646. $globals.SmalltalkImage);
  23647. $core.addMethod(
  23648. $core.method({
  23649. selector: "isSmalltalkObject:",
  23650. protocol: "testing",
  23651. fn: function (anObject){
  23652. var self=this,$self=this;
  23653. return $core.withContext(function($ctx1) {
  23654. return anObject.a$cls != null;
  23655. return self;
  23656. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23657. },
  23658. args: ["anObject"],
  23659. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'a$cls' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null'>",
  23660. referencedClasses: [],
  23661. messageSends: []
  23662. }),
  23663. $globals.SmalltalkImage);
  23664. $core.addMethod(
  23665. $core.method({
  23666. selector: "optOut:",
  23667. protocol: "accessing",
  23668. fn: function (anObject){
  23669. var self=this,$self=this;
  23670. return $core.withContext(function($ctx1) {
  23671. anObject.klass = null; anObject.a$cls = null;
  23672. return self;
  23673. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23674. },
  23675. args: ["anObject"],
  23676. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
  23677. referencedClasses: [],
  23678. messageSends: []
  23679. }),
  23680. $globals.SmalltalkImage);
  23681. $core.addMethod(
  23682. $core.method({
  23683. selector: "packageAt:ifAbsent:",
  23684. protocol: "packages",
  23685. fn: function (packageName,aBlock){
  23686. var self=this,$self=this;
  23687. return $core.withContext(function($ctx1) {
  23688. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23689. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23690. },
  23691. args: ["packageName", "aBlock"],
  23692. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23693. referencedClasses: [],
  23694. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23695. }),
  23696. $globals.SmalltalkImage);
  23697. $core.addMethod(
  23698. $core.method({
  23699. selector: "packageAt:ifPresent:",
  23700. protocol: "packages",
  23701. fn: function (packageName,aBlock){
  23702. var self=this,$self=this;
  23703. return $core.withContext(function($ctx1) {
  23704. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23705. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23706. },
  23707. args: ["packageName", "aBlock"],
  23708. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23709. referencedClasses: [],
  23710. messageSends: ["at:ifPresent:", "packageDictionary"]
  23711. }),
  23712. $globals.SmalltalkImage);
  23713. $core.addMethod(
  23714. $core.method({
  23715. selector: "packageDictionary",
  23716. protocol: "packages",
  23717. fn: function (){
  23718. var self=this,$self=this;
  23719. return $core.withContext(function($ctx1) {
  23720. var $1,$receiver;
  23721. $1=$self["@packageDictionary"];
  23722. if(($receiver = $1) == null || $receiver.a$nil){
  23723. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23724. return $self["@packageDictionary"];
  23725. } else {
  23726. return $1;
  23727. }
  23728. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23729. },
  23730. args: [],
  23731. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23732. referencedClasses: ["Dictionary"],
  23733. messageSends: ["ifNil:", "new"]
  23734. }),
  23735. $globals.SmalltalkImage);
  23736. $core.addMethod(
  23737. $core.method({
  23738. selector: "packages",
  23739. protocol: "packages",
  23740. fn: function (){
  23741. var self=this,$self=this;
  23742. return $core.withContext(function($ctx1) {
  23743. return $recv($recv($self._packageDictionary())._values())._copy();
  23744. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23745. },
  23746. args: [],
  23747. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23748. referencedClasses: [],
  23749. messageSends: ["copy", "values", "packageDictionary"]
  23750. }),
  23751. $globals.SmalltalkImage);
  23752. $core.addMethod(
  23753. $core.method({
  23754. selector: "parse:",
  23755. protocol: "accessing",
  23756. fn: function (aString){
  23757. var self=this,$self=this;
  23758. var result;
  23759. return $core.withContext(function($ctx1) {
  23760. var $1;
  23761. $recv((function(){
  23762. return $core.withContext(function($ctx2) {
  23763. result=$self._basicParse_(aString);
  23764. return result;
  23765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23766. }))._tryCatch_((function(ex){
  23767. return $core.withContext(function($ctx2) {
  23768. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23769. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23770. }));
  23771. $1=result;
  23772. $recv($1)._source_(aString);
  23773. return $recv($1)._yourself();
  23774. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23775. },
  23776. args: ["aString"],
  23777. 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",
  23778. referencedClasses: [],
  23779. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23780. }),
  23781. $globals.SmalltalkImage);
  23782. $core.addMethod(
  23783. $core.method({
  23784. selector: "parseError:parsing:",
  23785. protocol: "error handling",
  23786. fn: function (anException,aString){
  23787. var self=this,$self=this;
  23788. return $core.withContext(function($ctx1) {
  23789. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23790. $1=$recv(anException)._basicAt_("location");
  23791. $ctx1.sendIdx["basicAt:"]=1;
  23792. if(($receiver = $1) == null || $receiver.a$nil){
  23793. return $recv(anException)._pass();
  23794. } else {
  23795. var loc;
  23796. loc=$receiver;
  23797. $2=$recv($globals.ParseError)._new();
  23798. $9=$recv(loc)._start();
  23799. $ctx1.sendIdx["start"]=1;
  23800. $8=$recv($9)._line();
  23801. $7="Parse error on line ".__comma($8);
  23802. $6=$recv($7).__comma(" column ");
  23803. $ctx1.sendIdx[","]=4;
  23804. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23805. $ctx1.sendIdx[","]=3;
  23806. $4=$recv($5).__comma(" : Unexpected character ");
  23807. $ctx1.sendIdx[","]=2;
  23808. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23809. $ctx1.sendIdx[","]=1;
  23810. $recv($2)._messageText_($3);
  23811. return $recv($2)._yourself();
  23812. }
  23813. return self;
  23814. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23815. },
  23816. args: ["anException", "aString"],
  23817. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  23818. referencedClasses: ["ParseError"],
  23819. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23820. }),
  23821. $globals.SmalltalkImage);
  23822. $core.addMethod(
  23823. $core.method({
  23824. selector: "postLoad",
  23825. protocol: "image",
  23826. fn: function (){
  23827. var self=this,$self=this;
  23828. var pkgs,classes;
  23829. return $core.withContext(function($ctx1) {
  23830. var $1;
  23831. pkgs=$self._adoptPackageDescriptors();
  23832. $recv($recv($globals.Promise)._all_($recv(pkgs)._collect_("isReady")))._then_((function(){
  23833. return $core.withContext(function($ctx2) {
  23834. $recv(pkgs)._do_("beClean");
  23835. $ctx2.sendIdx["do:"]=1;
  23836. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23837. return $core.withContext(function($ctx3) {
  23838. return $recv(pkgs)._includes_($recv(each)._package());
  23839. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  23840. }));
  23841. $recv(classes)._do_((function(each){
  23842. return $core.withContext(function($ctx3) {
  23843. $1=$recv(each).__eq($self._class());
  23844. if(!$core.assert($1)){
  23845. return $recv(each)._initialize();
  23846. }
  23847. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  23848. }));
  23849. return $self._sweepPackageDescriptors_(pkgs);
  23850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23851. }));
  23852. return self;
  23853. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  23854. },
  23855. args: [],
  23856. source: "postLoad\x0a\x09| pkgs classes |\x0a\x09pkgs := self adoptPackageDescriptors.\x0a\x09(Promise all: (pkgs collect: #isReady)) then: [\x0a\x09\x09pkgs do: #beClean.\x0a\x09\x09classes := Smalltalk classes select:\x0a\x09\x09\x09[ :each | pkgs includes: each package ].\x0a\x09\x09classes do: [ :each |\x0a\x09\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09\x09self sweepPackageDescriptors: pkgs ]",
  23857. referencedClasses: ["Promise", "Smalltalk"],
  23858. messageSends: ["adoptPackageDescriptors", "then:", "all:", "collect:", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23859. }),
  23860. $globals.SmalltalkImage);
  23861. $core.addMethod(
  23862. $core.method({
  23863. selector: "pseudoVariableNames",
  23864. protocol: "accessing",
  23865. fn: function (){
  23866. var self=this,$self=this;
  23867. return ["self", "super", "nil", "true", "false", "thisContext"];
  23868. },
  23869. args: [],
  23870. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23871. referencedClasses: [],
  23872. messageSends: []
  23873. }),
  23874. $globals.SmalltalkImage);
  23875. $core.addMethod(
  23876. $core.method({
  23877. selector: "readJSObject:",
  23878. protocol: "accessing",
  23879. fn: function (anObject){
  23880. var self=this,$self=this;
  23881. return $core.withContext(function($ctx1) {
  23882. return $core.readJSObject(anObject);
  23883. return self;
  23884. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23885. },
  23886. args: ["anObject"],
  23887. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23888. referencedClasses: [],
  23889. messageSends: []
  23890. }),
  23891. $globals.SmalltalkImage);
  23892. $core.addMethod(
  23893. $core.method({
  23894. selector: "removeClass:",
  23895. protocol: "classes",
  23896. fn: function (aClass){
  23897. var self=this,$self=this;
  23898. return $core.withContext(function($ctx1) {
  23899. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23900. $1=$recv(aClass)._isMetaclass();
  23901. if($core.assert($1)){
  23902. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23903. $ctx1.sendIdx[","]=1;
  23904. $self._error_($2);
  23905. $ctx1.sendIdx["error:"]=1;
  23906. }
  23907. $recv(aClass)._allSubclassesDo_((function(subclass){
  23908. return $core.withContext(function($ctx2) {
  23909. $5=$recv(aClass)._name();
  23910. $ctx2.sendIdx["name"]=1;
  23911. $4=$recv($5).__comma(" has a subclass: ");
  23912. $ctx2.sendIdx[","]=3;
  23913. $6=$recv(subclass)._name();
  23914. $ctx2.sendIdx["name"]=2;
  23915. $3=$recv($4).__comma($6);
  23916. $ctx2.sendIdx[","]=2;
  23917. return $self._error_($3);
  23918. $ctx2.sendIdx["error:"]=2;
  23919. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23920. }));
  23921. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23922. return $core.withContext(function($ctx2) {
  23923. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23925. }));
  23926. $self._deleteClass_(aClass);
  23927. $recv(aClass)._setTraitComposition_([]);
  23928. $ctx1.sendIdx["setTraitComposition:"]=1;
  23929. $7=$recv(aClass)._theMetaClass();
  23930. if(($receiver = $7) == null || $receiver.a$nil){
  23931. $7;
  23932. } else {
  23933. var meta;
  23934. meta=$receiver;
  23935. $recv(meta)._setTraitComposition_([]);
  23936. }
  23937. $8=$recv($globals.SystemAnnouncer)._current();
  23938. $10=$recv($globals.ClassRemoved)._new();
  23939. $recv($10)._theClass_(aClass);
  23940. $9=$recv($10)._yourself();
  23941. $recv($8)._announce_($9);
  23942. return self;
  23943. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23944. },
  23945. args: ["aClass"],
  23946. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass theMetaClass ifNotNil: [ :meta | meta setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  23947. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23948. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23949. }),
  23950. $globals.SmalltalkImage);
  23951. $core.addMethod(
  23952. $core.method({
  23953. selector: "removePackage:",
  23954. protocol: "packages",
  23955. fn: function (packageName){
  23956. var self=this,$self=this;
  23957. var pkg;
  23958. return $core.withContext(function($ctx1) {
  23959. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23960. return $core.withContext(function($ctx2) {
  23961. return $self._error_("Missing package: ".__comma(packageName));
  23962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23963. }));
  23964. $recv($recv(pkg)._classes())._do_((function(each){
  23965. return $core.withContext(function($ctx2) {
  23966. return $self._removeClass_(each);
  23967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23968. }));
  23969. $recv($self._packageDictionary())._removeKey_(packageName);
  23970. return self;
  23971. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23972. },
  23973. args: ["packageName"],
  23974. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self packageDictionary removeKey: packageName",
  23975. referencedClasses: [],
  23976. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23977. }),
  23978. $globals.SmalltalkImage);
  23979. $core.addMethod(
  23980. $core.method({
  23981. selector: "renamePackage:to:",
  23982. protocol: "packages",
  23983. fn: function (packageName,newName){
  23984. var self=this,$self=this;
  23985. var pkg;
  23986. return $core.withContext(function($ctx1) {
  23987. var $1,$2,$3;
  23988. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23989. return $core.withContext(function($ctx2) {
  23990. $1="Missing package: ".__comma(packageName);
  23991. $ctx2.sendIdx[","]=1;
  23992. return $self._error_($1);
  23993. $ctx2.sendIdx["error:"]=1;
  23994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23995. }));
  23996. $self._packageAt_ifPresent_(newName,(function(){
  23997. return $core.withContext(function($ctx2) {
  23998. return $self._error_("Already exists a package called: ".__comma(newName));
  23999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24000. }));
  24001. $2=pkg;
  24002. $recv($2)._name_(newName);
  24003. $recv($2)._beDirty();
  24004. $3=$self._packageDictionary();
  24005. $recv($3)._at_put_(newName,pkg);
  24006. $recv($3)._removeKey_(packageName);
  24007. return self;
  24008. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24009. },
  24010. args: ["packageName", "newName"],
  24011. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09self packageAt: newName ifPresent: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName; beDirty.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  24012. referencedClasses: [],
  24013. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24014. }),
  24015. $globals.SmalltalkImage);
  24016. $core.addMethod(
  24017. $core.method({
  24018. selector: "reservedWords",
  24019. protocol: "accessing",
  24020. fn: function (){
  24021. var self=this,$self=this;
  24022. return ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "arguments", "await", "enum", "implements", "interface", "package", "private", "protected", "public"];
  24023. },
  24024. args: [],
  24025. source: "reservedWords\x0a\x09^ #(\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-keywords\x22\x0a\x09\x09break case catch class const continue debugger\x0a\x09\x09default delete do else export extends finally\x0a\x09\x09for function if import in instanceof new\x0a\x09\x09return super switch this throw try typeof\x0a\x09\x09var void while with yield\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09let static\x0a\x09\x09\x22Amber protected words: these should not be compiled as-is when in code\x22\x0a\x09\x09arguments\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words\x22\x0a\x09\x09await enum\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09implements interface package private protected public\x0a\x09)",
  24026. referencedClasses: [],
  24027. messageSends: []
  24028. }),
  24029. $globals.SmalltalkImage);
  24030. $core.addMethod(
  24031. $core.method({
  24032. selector: "settings",
  24033. protocol: "accessing",
  24034. fn: function (){
  24035. var self=this,$self=this;
  24036. return $globals.SmalltalkSettings;
  24037. },
  24038. args: [],
  24039. source: "settings\x0a\x09^ SmalltalkSettings",
  24040. referencedClasses: ["SmalltalkSettings"],
  24041. messageSends: []
  24042. }),
  24043. $globals.SmalltalkImage);
  24044. $core.addMethod(
  24045. $core.method({
  24046. selector: "sweepPackageDescriptors:",
  24047. protocol: "private",
  24048. fn: function (pkgs){
  24049. var self=this,$self=this;
  24050. var pd;
  24051. return $core.withContext(function($ctx1) {
  24052. pd=$recv($self._core())._packageDescriptors();
  24053. $recv(pkgs)._do_((function(each){
  24054. return $core.withContext(function($ctx2) {
  24055. return $recv(pd)._removeKey_($recv(each)._name());
  24056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24057. }));
  24058. return self;
  24059. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24060. },
  24061. args: ["pkgs"],
  24062. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24063. referencedClasses: [],
  24064. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24065. }),
  24066. $globals.SmalltalkImage);
  24067. $core.addMethod(
  24068. $core.method({
  24069. selector: "version",
  24070. protocol: "accessing",
  24071. fn: function (){
  24072. var self=this,$self=this;
  24073. return "0.23.0-pre";
  24074. },
  24075. args: [],
  24076. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.0-pre'",
  24077. referencedClasses: [],
  24078. messageSends: []
  24079. }),
  24080. $globals.SmalltalkImage);
  24081. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24082. $core.addMethod(
  24083. $core.method({
  24084. selector: "current",
  24085. protocol: "instance creation",
  24086. fn: function (){
  24087. var self=this,$self=this;
  24088. return $core.withContext(function($ctx1) {
  24089. var $1,$receiver;
  24090. $1=$self["@current"];
  24091. if(($receiver = $1) == null || $receiver.a$nil){
  24092. $self["@current"]=(
  24093. $ctx1.supercall = true,
  24094. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24095. $ctx1.supercall = false;
  24096. return $self["@current"];
  24097. } else {
  24098. $self._deprecatedAPI();
  24099. return $self["@current"];
  24100. }
  24101. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24102. },
  24103. args: [],
  24104. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24105. referencedClasses: [],
  24106. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24107. }),
  24108. $globals.SmalltalkImage.a$cls);
  24109. $core.addMethod(
  24110. $core.method({
  24111. selector: "initialize",
  24112. protocol: "initialization",
  24113. fn: function (){
  24114. var self=this,$self=this;
  24115. var st;
  24116. return $core.withContext(function($ctx1) {
  24117. st=$self._current();
  24118. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24119. return self;
  24120. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24121. },
  24122. args: [],
  24123. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24124. referencedClasses: [],
  24125. messageSends: ["current", "at:put:", "globals"]
  24126. }),
  24127. $globals.SmalltalkImage.a$cls);
  24128. $core.addMethod(
  24129. $core.method({
  24130. selector: "new",
  24131. protocol: "instance creation",
  24132. fn: function (){
  24133. var self=this,$self=this;
  24134. return $core.withContext(function($ctx1) {
  24135. $self._shouldNotImplement();
  24136. return self;
  24137. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24138. },
  24139. args: [],
  24140. source: "new\x0a\x09self shouldNotImplement",
  24141. referencedClasses: [],
  24142. messageSends: ["shouldNotImplement"]
  24143. }),
  24144. $globals.SmalltalkImage.a$cls);
  24145. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24146. $core.addMethod(
  24147. $core.method({
  24148. selector: "nextPutJSObject:",
  24149. protocol: "*Kernel-Infrastructure",
  24150. fn: function (aJSObject){
  24151. var self=this,$self=this;
  24152. return $core.withContext(function($ctx1) {
  24153. $self._nextPut_(aJSObject);
  24154. return self;
  24155. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24156. },
  24157. args: ["aJSObject"],
  24158. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24159. referencedClasses: [],
  24160. messageSends: ["nextPut:"]
  24161. }),
  24162. $globals.ProtoStream);
  24163. $core.addMethod(
  24164. $core.method({
  24165. selector: "asJavaScriptPropertyName",
  24166. protocol: "*Kernel-Infrastructure",
  24167. fn: function (){
  24168. var self=this,$self=this;
  24169. return $core.withContext(function($ctx1) {
  24170. return $core.st2prop(self);
  24171. return self;
  24172. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24173. },
  24174. args: [],
  24175. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24176. referencedClasses: [],
  24177. messageSends: []
  24178. }),
  24179. $globals.String);
  24180. $core.addMethod(
  24181. $core.method({
  24182. selector: "asSetting",
  24183. protocol: "*Kernel-Infrastructure",
  24184. fn: function (){
  24185. var self=this,$self=this;
  24186. return $core.withContext(function($ctx1) {
  24187. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24188. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24189. },
  24190. args: [],
  24191. 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",
  24192. referencedClasses: ["Setting"],
  24193. messageSends: ["at:ifAbsent:"]
  24194. }),
  24195. $globals.String);
  24196. $core.addMethod(
  24197. $core.method({
  24198. selector: "asSettingIfAbsent:",
  24199. protocol: "*Kernel-Infrastructure",
  24200. fn: function (aDefaultValue){
  24201. var self=this,$self=this;
  24202. return $core.withContext(function($ctx1) {
  24203. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24204. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24205. },
  24206. args: ["aDefaultValue"],
  24207. 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",
  24208. referencedClasses: ["Setting"],
  24209. messageSends: ["at:ifAbsent:"]
  24210. }),
  24211. $globals.String);
  24212. $core.addMethod(
  24213. $core.method({
  24214. selector: "settingValue",
  24215. protocol: "*Kernel-Infrastructure",
  24216. fn: function (){
  24217. var self=this,$self=this;
  24218. return $core.withContext(function($ctx1) {
  24219. return $recv($self._asSetting())._value();
  24220. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24221. },
  24222. args: [],
  24223. source: "settingValue\x0a\x09^ self asSetting value",
  24224. referencedClasses: [],
  24225. messageSends: ["value", "asSetting"]
  24226. }),
  24227. $globals.String);
  24228. $core.addMethod(
  24229. $core.method({
  24230. selector: "settingValue:",
  24231. protocol: "*Kernel-Infrastructure",
  24232. fn: function (aValue){
  24233. var self=this,$self=this;
  24234. return $core.withContext(function($ctx1) {
  24235. return $recv($self._asSetting())._value_(aValue);
  24236. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24237. },
  24238. args: ["aValue"],
  24239. 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",
  24240. referencedClasses: [],
  24241. messageSends: ["value:", "asSetting"]
  24242. }),
  24243. $globals.String);
  24244. $core.addMethod(
  24245. $core.method({
  24246. selector: "settingValueIfAbsent:",
  24247. protocol: "*Kernel-Infrastructure",
  24248. fn: function (aDefaultValue){
  24249. var self=this,$self=this;
  24250. return $core.withContext(function($ctx1) {
  24251. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24252. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24253. },
  24254. args: ["aDefaultValue"],
  24255. 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",
  24256. referencedClasses: [],
  24257. messageSends: ["value", "asSettingIfAbsent:"]
  24258. }),
  24259. $globals.String);
  24260. });
  24261. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24262. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24263. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24264. var $pkg = $core.addPackage("Kernel-Announcements");
  24265. $pkg.innerEval = function (expr) { return eval(expr); };
  24266. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  24267. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24268. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24269. $core.addMethod(
  24270. $core.method({
  24271. selector: "announcementClass",
  24272. protocol: "accessing",
  24273. fn: function (){
  24274. var self=this,$self=this;
  24275. return $self["@announcementClass"];
  24276. },
  24277. args: [],
  24278. source: "announcementClass\x0a\x09^ announcementClass",
  24279. referencedClasses: [],
  24280. messageSends: []
  24281. }),
  24282. $globals.AnnouncementSubscription);
  24283. $core.addMethod(
  24284. $core.method({
  24285. selector: "announcementClass:",
  24286. protocol: "accessing",
  24287. fn: function (aClass){
  24288. var self=this,$self=this;
  24289. return $core.withContext(function($ctx1) {
  24290. $self["@announcementClass"]=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24291. return self;
  24292. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},$globals.AnnouncementSubscription)});
  24293. },
  24294. args: ["aClass"],
  24295. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24296. referencedClasses: ["Smalltalk"],
  24297. messageSends: ["at:", "globals", "name"]
  24298. }),
  24299. $globals.AnnouncementSubscription);
  24300. $core.addMethod(
  24301. $core.method({
  24302. selector: "deliver:",
  24303. protocol: "announcing",
  24304. fn: function (anAnnouncement){
  24305. var self=this,$self=this;
  24306. return $core.withContext(function($ctx1) {
  24307. var $1;
  24308. $1=$self._handlesAnnouncement_(anAnnouncement);
  24309. if($core.assert($1)){
  24310. $recv($self._valuable())._value_(anAnnouncement);
  24311. }
  24312. return self;
  24313. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24314. },
  24315. args: ["anAnnouncement"],
  24316. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24317. referencedClasses: [],
  24318. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24319. }),
  24320. $globals.AnnouncementSubscription);
  24321. $core.addMethod(
  24322. $core.method({
  24323. selector: "handlesAnnouncement:",
  24324. protocol: "announcing",
  24325. fn: function (anAnnouncement){
  24326. var self=this,$self=this;
  24327. return $core.withContext(function($ctx1) {
  24328. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24329. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24330. },
  24331. args: ["anAnnouncement"],
  24332. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: anAnnouncement class name) includesBehavior: self announcementClass",
  24333. referencedClasses: ["Smalltalk"],
  24334. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24335. }),
  24336. $globals.AnnouncementSubscription);
  24337. $core.addMethod(
  24338. $core.method({
  24339. selector: "receiver",
  24340. protocol: "accessing",
  24341. fn: function (){
  24342. var self=this,$self=this;
  24343. return $core.withContext(function($ctx1) {
  24344. return $recv($self._valuable())._receiver();
  24345. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24346. },
  24347. args: [],
  24348. source: "receiver\x0a\x09^ self valuable receiver",
  24349. referencedClasses: [],
  24350. messageSends: ["receiver", "valuable"]
  24351. }),
  24352. $globals.AnnouncementSubscription);
  24353. $core.addMethod(
  24354. $core.method({
  24355. selector: "valuable",
  24356. protocol: "accessing",
  24357. fn: function (){
  24358. var self=this,$self=this;
  24359. return $self["@valuable"];
  24360. },
  24361. args: [],
  24362. source: "valuable\x0a\x09^ valuable",
  24363. referencedClasses: [],
  24364. messageSends: []
  24365. }),
  24366. $globals.AnnouncementSubscription);
  24367. $core.addMethod(
  24368. $core.method({
  24369. selector: "valuable:",
  24370. protocol: "accessing",
  24371. fn: function (aValuable){
  24372. var self=this,$self=this;
  24373. $self["@valuable"]=aValuable;
  24374. return self;
  24375. },
  24376. args: ["aValuable"],
  24377. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24378. referencedClasses: [],
  24379. messageSends: []
  24380. }),
  24381. $globals.AnnouncementSubscription);
  24382. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24383. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24384. $core.addMethod(
  24385. $core.method({
  24386. selector: "receiver",
  24387. protocol: "accessing",
  24388. fn: function (){
  24389. var self=this,$self=this;
  24390. return $self["@receiver"];
  24391. },
  24392. args: [],
  24393. source: "receiver\x0a\x09^ receiver",
  24394. referencedClasses: [],
  24395. messageSends: []
  24396. }),
  24397. $globals.AnnouncementValuable);
  24398. $core.addMethod(
  24399. $core.method({
  24400. selector: "receiver:",
  24401. protocol: "accessing",
  24402. fn: function (anObject){
  24403. var self=this,$self=this;
  24404. $self["@receiver"]=anObject;
  24405. return self;
  24406. },
  24407. args: ["anObject"],
  24408. source: "receiver: anObject\x0a\x09receiver := anObject",
  24409. referencedClasses: [],
  24410. messageSends: []
  24411. }),
  24412. $globals.AnnouncementValuable);
  24413. $core.addMethod(
  24414. $core.method({
  24415. selector: "valuable",
  24416. protocol: "accessing",
  24417. fn: function (){
  24418. var self=this,$self=this;
  24419. return $self["@valuable"];
  24420. },
  24421. args: [],
  24422. source: "valuable\x0a\x09^ valuable",
  24423. referencedClasses: [],
  24424. messageSends: []
  24425. }),
  24426. $globals.AnnouncementValuable);
  24427. $core.addMethod(
  24428. $core.method({
  24429. selector: "valuable:",
  24430. protocol: "accessing",
  24431. fn: function (anObject){
  24432. var self=this,$self=this;
  24433. $self["@valuable"]=anObject;
  24434. return self;
  24435. },
  24436. args: ["anObject"],
  24437. source: "valuable: anObject\x0a\x09valuable := anObject",
  24438. referencedClasses: [],
  24439. messageSends: []
  24440. }),
  24441. $globals.AnnouncementValuable);
  24442. $core.addMethod(
  24443. $core.method({
  24444. selector: "value",
  24445. protocol: "evaluating",
  24446. fn: function (){
  24447. var self=this,$self=this;
  24448. return $core.withContext(function($ctx1) {
  24449. return $recv($self._valuable())._value();
  24450. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24451. },
  24452. args: [],
  24453. source: "value\x0a\x09^ self valuable value",
  24454. referencedClasses: [],
  24455. messageSends: ["value", "valuable"]
  24456. }),
  24457. $globals.AnnouncementValuable);
  24458. $core.addMethod(
  24459. $core.method({
  24460. selector: "value:",
  24461. protocol: "evaluating",
  24462. fn: function (anObject){
  24463. var self=this,$self=this;
  24464. return $core.withContext(function($ctx1) {
  24465. return $recv($self._valuable())._value_(anObject);
  24466. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24467. },
  24468. args: ["anObject"],
  24469. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24470. referencedClasses: [],
  24471. messageSends: ["value:", "valuable"]
  24472. }),
  24473. $globals.AnnouncementValuable);
  24474. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24475. $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' ].";
  24476. $core.addMethod(
  24477. $core.method({
  24478. selector: "announce:",
  24479. protocol: "announcing",
  24480. fn: function (anAnnouncement){
  24481. var self=this,$self=this;
  24482. return $core.withContext(function($ctx1) {
  24483. $recv($self["@subscriptions"])._do_((function(each){
  24484. return $core.withContext(function($ctx2) {
  24485. return $recv(each)._deliver_(anAnnouncement);
  24486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24487. }));
  24488. return self;
  24489. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24490. },
  24491. args: ["anAnnouncement"],
  24492. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24493. referencedClasses: [],
  24494. messageSends: ["do:", "deliver:"]
  24495. }),
  24496. $globals.Announcer);
  24497. $core.addMethod(
  24498. $core.method({
  24499. selector: "initialize",
  24500. protocol: "initialization",
  24501. fn: function (){
  24502. var self=this,$self=this;
  24503. return $core.withContext(function($ctx1) {
  24504. (
  24505. $ctx1.supercall = true,
  24506. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24507. $ctx1.supercall = false;
  24508. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24509. return self;
  24510. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24511. },
  24512. args: [],
  24513. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24514. referencedClasses: ["OrderedCollection"],
  24515. messageSends: ["initialize", "new"]
  24516. }),
  24517. $globals.Announcer);
  24518. $core.addMethod(
  24519. $core.method({
  24520. selector: "on:do:",
  24521. protocol: "subscribing",
  24522. fn: function (aClass,aBlock){
  24523. var self=this,$self=this;
  24524. return $core.withContext(function($ctx1) {
  24525. $self._on_do_for_(aClass,aBlock,nil);
  24526. return self;
  24527. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24528. },
  24529. args: ["aClass", "aBlock"],
  24530. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24531. referencedClasses: [],
  24532. messageSends: ["on:do:for:"]
  24533. }),
  24534. $globals.Announcer);
  24535. $core.addMethod(
  24536. $core.method({
  24537. selector: "on:do:for:",
  24538. protocol: "subscribing",
  24539. fn: function (aClass,aBlock,aReceiver){
  24540. var self=this,$self=this;
  24541. return $core.withContext(function($ctx1) {
  24542. var $1,$3,$5,$6,$4,$2;
  24543. $1=$self["@subscriptions"];
  24544. $3=$recv($globals.AnnouncementSubscription)._new();
  24545. $ctx1.sendIdx["new"]=1;
  24546. $5=$recv($globals.AnnouncementValuable)._new();
  24547. $recv($5)._valuable_(aBlock);
  24548. $recv($5)._receiver_(aReceiver);
  24549. $6=$recv($5)._yourself();
  24550. $ctx1.sendIdx["yourself"]=1;
  24551. $4=$6;
  24552. $recv($3)._valuable_($4);
  24553. $ctx1.sendIdx["valuable:"]=1;
  24554. $recv($3)._announcementClass_(aClass);
  24555. $2=$recv($3)._yourself();
  24556. $recv($1)._add_($2);
  24557. return self;
  24558. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24559. },
  24560. args: ["aClass", "aBlock", "aReceiver"],
  24561. 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)",
  24562. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24563. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24564. }),
  24565. $globals.Announcer);
  24566. $core.addMethod(
  24567. $core.method({
  24568. selector: "on:doOnce:",
  24569. protocol: "subscribing",
  24570. fn: function (aClass,aBlock){
  24571. var self=this,$self=this;
  24572. var subscription;
  24573. return $core.withContext(function($ctx1) {
  24574. var $1;
  24575. $1=$recv($globals.AnnouncementSubscription)._new();
  24576. $recv($1)._announcementClass_(aClass);
  24577. subscription=$recv($1)._yourself();
  24578. $recv(subscription)._valuable_((function(ann){
  24579. return $core.withContext(function($ctx2) {
  24580. $recv($self["@subscriptions"])._remove_(subscription);
  24581. return $recv(aBlock)._value_(ann);
  24582. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24583. }));
  24584. $recv($self["@subscriptions"])._add_(subscription);
  24585. return self;
  24586. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24587. },
  24588. args: ["aClass", "aBlock"],
  24589. 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",
  24590. referencedClasses: ["AnnouncementSubscription"],
  24591. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24592. }),
  24593. $globals.Announcer);
  24594. $core.addMethod(
  24595. $core.method({
  24596. selector: "on:send:to:",
  24597. protocol: "subscribing",
  24598. fn: function (aClass,aSelector,anObject){
  24599. var self=this,$self=this;
  24600. return $core.withContext(function($ctx1) {
  24601. var $1,$3,$5,$6,$4,$2;
  24602. $1=$self["@subscriptions"];
  24603. $3=$recv($globals.AnnouncementSubscription)._new();
  24604. $ctx1.sendIdx["new"]=1;
  24605. $5=$recv($globals.MessageSend)._new();
  24606. $recv($5)._receiver_(anObject);
  24607. $recv($5)._selector_(aSelector);
  24608. $6=$recv($5)._yourself();
  24609. $ctx1.sendIdx["yourself"]=1;
  24610. $4=$6;
  24611. $recv($3)._valuable_($4);
  24612. $recv($3)._announcementClass_(aClass);
  24613. $2=$recv($3)._yourself();
  24614. $recv($1)._add_($2);
  24615. return self;
  24616. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24617. },
  24618. args: ["aClass", "aSelector", "anObject"],
  24619. 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)",
  24620. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24621. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24622. }),
  24623. $globals.Announcer);
  24624. $core.addMethod(
  24625. $core.method({
  24626. selector: "unsubscribe:",
  24627. protocol: "subscribing",
  24628. fn: function (anObject){
  24629. var self=this,$self=this;
  24630. return $core.withContext(function($ctx1) {
  24631. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24632. return $core.withContext(function($ctx2) {
  24633. return $recv($recv(each)._receiver()).__eq(anObject);
  24634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24635. }));
  24636. return self;
  24637. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24638. },
  24639. args: ["anObject"],
  24640. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24641. referencedClasses: [],
  24642. messageSends: ["reject:", "=", "receiver"]
  24643. }),
  24644. $globals.Announcer);
  24645. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24646. $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`";
  24647. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24648. $core.addMethod(
  24649. $core.method({
  24650. selector: "current",
  24651. protocol: "accessing",
  24652. fn: function (){
  24653. var self=this,$self=this;
  24654. return $core.withContext(function($ctx1) {
  24655. var $1,$receiver;
  24656. $1=$self["@current"];
  24657. if(($receiver = $1) == null || $receiver.a$nil){
  24658. $self["@current"]=(
  24659. $ctx1.supercall = true,
  24660. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24661. $ctx1.supercall = false;
  24662. return $self["@current"];
  24663. } else {
  24664. return $1;
  24665. }
  24666. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24667. },
  24668. args: [],
  24669. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24670. referencedClasses: [],
  24671. messageSends: ["ifNil:", "new"]
  24672. }),
  24673. $globals.SystemAnnouncer.a$cls);
  24674. $core.addMethod(
  24675. $core.method({
  24676. selector: "new",
  24677. protocol: "instance creation",
  24678. fn: function (){
  24679. var self=this,$self=this;
  24680. return $core.withContext(function($ctx1) {
  24681. $self._shouldNotImplement();
  24682. return self;
  24683. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24684. },
  24685. args: [],
  24686. source: "new\x0a\x09self shouldNotImplement",
  24687. referencedClasses: [],
  24688. messageSends: ["shouldNotImplement"]
  24689. }),
  24690. $globals.SystemAnnouncer.a$cls);
  24691. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24692. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24693. $core.addMethod(
  24694. $core.method({
  24695. selector: "classTag",
  24696. protocol: "accessing",
  24697. fn: function (){
  24698. var self=this,$self=this;
  24699. return "announcement";
  24700. },
  24701. args: [],
  24702. 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'",
  24703. referencedClasses: [],
  24704. messageSends: []
  24705. }),
  24706. $globals.SystemAnnouncement.a$cls);
  24707. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24708. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24709. $core.addMethod(
  24710. $core.method({
  24711. selector: "theClass",
  24712. protocol: "accessing",
  24713. fn: function (){
  24714. var self=this,$self=this;
  24715. return $self["@theClass"];
  24716. },
  24717. args: [],
  24718. source: "theClass\x0a\x09^ theClass",
  24719. referencedClasses: [],
  24720. messageSends: []
  24721. }),
  24722. $globals.ClassAnnouncement);
  24723. $core.addMethod(
  24724. $core.method({
  24725. selector: "theClass:",
  24726. protocol: "accessing",
  24727. fn: function (aClass){
  24728. var self=this,$self=this;
  24729. $self["@theClass"]=aClass;
  24730. return self;
  24731. },
  24732. args: ["aClass"],
  24733. source: "theClass: aClass\x0a\x09theClass := aClass",
  24734. referencedClasses: [],
  24735. messageSends: []
  24736. }),
  24737. $globals.ClassAnnouncement);
  24738. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24739. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24740. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24741. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24742. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24743. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24744. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24745. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24746. $core.addMethod(
  24747. $core.method({
  24748. selector: "oldClass",
  24749. protocol: "accessing",
  24750. fn: function (){
  24751. var self=this,$self=this;
  24752. return $self["@oldClass"];
  24753. },
  24754. args: [],
  24755. source: "oldClass\x0a\x09^ oldClass",
  24756. referencedClasses: [],
  24757. messageSends: []
  24758. }),
  24759. $globals.ClassMigrated);
  24760. $core.addMethod(
  24761. $core.method({
  24762. selector: "oldClass:",
  24763. protocol: "accessing",
  24764. fn: function (aClass){
  24765. var self=this,$self=this;
  24766. $self["@oldClass"]=aClass;
  24767. return self;
  24768. },
  24769. args: ["aClass"],
  24770. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24771. referencedClasses: [],
  24772. messageSends: []
  24773. }),
  24774. $globals.ClassMigrated);
  24775. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24776. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24777. $core.addMethod(
  24778. $core.method({
  24779. selector: "oldPackage",
  24780. protocol: "accessing",
  24781. fn: function (){
  24782. var self=this,$self=this;
  24783. return $self["@oldPackage"];
  24784. },
  24785. args: [],
  24786. source: "oldPackage\x0a\x09^ oldPackage",
  24787. referencedClasses: [],
  24788. messageSends: []
  24789. }),
  24790. $globals.ClassMoved);
  24791. $core.addMethod(
  24792. $core.method({
  24793. selector: "oldPackage:",
  24794. protocol: "accessing",
  24795. fn: function (aPackage){
  24796. var self=this,$self=this;
  24797. $self["@oldPackage"]=aPackage;
  24798. return self;
  24799. },
  24800. args: ["aPackage"],
  24801. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24802. referencedClasses: [],
  24803. messageSends: []
  24804. }),
  24805. $globals.ClassMoved);
  24806. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24807. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24808. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24809. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24810. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24811. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24812. $core.addMethod(
  24813. $core.method({
  24814. selector: "method",
  24815. protocol: "accessing",
  24816. fn: function (){
  24817. var self=this,$self=this;
  24818. return $self["@method"];
  24819. },
  24820. args: [],
  24821. source: "method\x0a\x09^ method",
  24822. referencedClasses: [],
  24823. messageSends: []
  24824. }),
  24825. $globals.MethodAnnouncement);
  24826. $core.addMethod(
  24827. $core.method({
  24828. selector: "method:",
  24829. protocol: "accessing",
  24830. fn: function (aCompiledMethod){
  24831. var self=this,$self=this;
  24832. $self["@method"]=aCompiledMethod;
  24833. return self;
  24834. },
  24835. args: ["aCompiledMethod"],
  24836. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24837. referencedClasses: [],
  24838. messageSends: []
  24839. }),
  24840. $globals.MethodAnnouncement);
  24841. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24842. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24843. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24844. $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.";
  24845. $core.addMethod(
  24846. $core.method({
  24847. selector: "oldMethod",
  24848. protocol: "accessing",
  24849. fn: function (){
  24850. var self=this,$self=this;
  24851. return $self["@oldMethod"];
  24852. },
  24853. args: [],
  24854. source: "oldMethod\x0a\x09^ oldMethod",
  24855. referencedClasses: [],
  24856. messageSends: []
  24857. }),
  24858. $globals.MethodModified);
  24859. $core.addMethod(
  24860. $core.method({
  24861. selector: "oldMethod:",
  24862. protocol: "accessing",
  24863. fn: function (aMethod){
  24864. var self=this,$self=this;
  24865. $self["@oldMethod"]=aMethod;
  24866. return self;
  24867. },
  24868. args: ["aMethod"],
  24869. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24870. referencedClasses: [],
  24871. messageSends: []
  24872. }),
  24873. $globals.MethodModified);
  24874. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24875. $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.";
  24876. $core.addMethod(
  24877. $core.method({
  24878. selector: "oldProtocol",
  24879. protocol: "accessing",
  24880. fn: function (){
  24881. var self=this,$self=this;
  24882. return $self["@oldProtocol"];
  24883. },
  24884. args: [],
  24885. source: "oldProtocol\x0a\x09^ oldProtocol",
  24886. referencedClasses: [],
  24887. messageSends: []
  24888. }),
  24889. $globals.MethodMoved);
  24890. $core.addMethod(
  24891. $core.method({
  24892. selector: "oldProtocol:",
  24893. protocol: "accessing",
  24894. fn: function (aString){
  24895. var self=this,$self=this;
  24896. $self["@oldProtocol"]=aString;
  24897. return self;
  24898. },
  24899. args: ["aString"],
  24900. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24901. referencedClasses: [],
  24902. messageSends: []
  24903. }),
  24904. $globals.MethodMoved);
  24905. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24906. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24907. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24908. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24909. $core.addMethod(
  24910. $core.method({
  24911. selector: "package",
  24912. protocol: "accessing",
  24913. fn: function (){
  24914. var self=this,$self=this;
  24915. return $self["@package"];
  24916. },
  24917. args: [],
  24918. source: "package\x0a\x09^ package",
  24919. referencedClasses: [],
  24920. messageSends: []
  24921. }),
  24922. $globals.PackageAnnouncement);
  24923. $core.addMethod(
  24924. $core.method({
  24925. selector: "package:",
  24926. protocol: "accessing",
  24927. fn: function (aPackage){
  24928. var self=this,$self=this;
  24929. $self["@package"]=aPackage;
  24930. return self;
  24931. },
  24932. args: ["aPackage"],
  24933. source: "package: aPackage\x0a\x09package := aPackage",
  24934. referencedClasses: [],
  24935. messageSends: []
  24936. }),
  24937. $globals.PackageAnnouncement);
  24938. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24939. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24940. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24941. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24942. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24943. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24944. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24945. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24946. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24947. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24948. $core.addMethod(
  24949. $core.method({
  24950. selector: "package",
  24951. protocol: "accessing",
  24952. fn: function (){
  24953. var self=this,$self=this;
  24954. return $core.withContext(function($ctx1) {
  24955. var $1,$receiver;
  24956. $1=$self._theClass();
  24957. if(($receiver = $1) == null || $receiver.a$nil){
  24958. return $1;
  24959. } else {
  24960. var class_;
  24961. class_=$receiver;
  24962. return $recv(class_)._packageOfProtocol_($self._protocol());
  24963. }
  24964. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24965. },
  24966. args: [],
  24967. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  24968. referencedClasses: [],
  24969. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  24970. }),
  24971. $globals.ProtocolAnnouncement);
  24972. $core.addMethod(
  24973. $core.method({
  24974. selector: "protocol",
  24975. protocol: "accessing",
  24976. fn: function (){
  24977. var self=this,$self=this;
  24978. return $self["@protocol"];
  24979. },
  24980. args: [],
  24981. source: "protocol\x0a\x09^ protocol",
  24982. referencedClasses: [],
  24983. messageSends: []
  24984. }),
  24985. $globals.ProtocolAnnouncement);
  24986. $core.addMethod(
  24987. $core.method({
  24988. selector: "protocol:",
  24989. protocol: "accessing",
  24990. fn: function (aString){
  24991. var self=this,$self=this;
  24992. $self["@protocol"]=aString;
  24993. return self;
  24994. },
  24995. args: ["aString"],
  24996. source: "protocol: aString\x0a\x09protocol := aString",
  24997. referencedClasses: [],
  24998. messageSends: []
  24999. }),
  25000. $globals.ProtocolAnnouncement);
  25001. $core.addMethod(
  25002. $core.method({
  25003. selector: "theClass",
  25004. protocol: "accessing",
  25005. fn: function (){
  25006. var self=this,$self=this;
  25007. return $self["@theClass"];
  25008. },
  25009. args: [],
  25010. source: "theClass\x0a\x09^ theClass",
  25011. referencedClasses: [],
  25012. messageSends: []
  25013. }),
  25014. $globals.ProtocolAnnouncement);
  25015. $core.addMethod(
  25016. $core.method({
  25017. selector: "theClass:",
  25018. protocol: "accessing",
  25019. fn: function (aClass){
  25020. var self=this,$self=this;
  25021. $self["@theClass"]=aClass;
  25022. return self;
  25023. },
  25024. args: ["aClass"],
  25025. source: "theClass: aClass\x0a\x09theClass := aClass",
  25026. referencedClasses: [],
  25027. messageSends: []
  25028. }),
  25029. $globals.ProtocolAnnouncement);
  25030. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25031. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25032. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25033. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25034. });
  25035. define('amber_core/Platform-Services',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25036. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25037. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25038. var $pkg = $core.addPackage("Platform-Services");
  25039. $pkg.innerEval = function (expr) { return eval(expr); };
  25040. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  25041. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25042. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25043. $core.addMethod(
  25044. $core.method({
  25045. selector: "handleError:",
  25046. protocol: "error handling",
  25047. fn: function (anError){
  25048. var self=this,$self=this;
  25049. return $core.withContext(function($ctx1) {
  25050. var $1,$receiver;
  25051. $1=$recv(anError)._context();
  25052. $ctx1.sendIdx["context"]=1;
  25053. if(($receiver = $1) == null || $receiver.a$nil){
  25054. $1;
  25055. } else {
  25056. $self._logErrorContext_($recv(anError)._context());
  25057. }
  25058. $self._logError_(anError);
  25059. return self;
  25060. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25061. },
  25062. args: ["anError"],
  25063. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25064. referencedClasses: [],
  25065. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25066. }),
  25067. $globals.ConsoleErrorHandler);
  25068. $core.addMethod(
  25069. $core.method({
  25070. selector: "log:",
  25071. protocol: "private",
  25072. fn: function (aString){
  25073. var self=this,$self=this;
  25074. return $core.withContext(function($ctx1) {
  25075. $recv(console)._log_(aString);
  25076. return self;
  25077. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25078. },
  25079. args: ["aString"],
  25080. source: "log: aString\x0a\x09console log: aString",
  25081. referencedClasses: [],
  25082. messageSends: ["log:"]
  25083. }),
  25084. $globals.ConsoleErrorHandler);
  25085. $core.addMethod(
  25086. $core.method({
  25087. selector: "logContext:",
  25088. protocol: "private",
  25089. fn: function (aContext){
  25090. var self=this,$self=this;
  25091. return $core.withContext(function($ctx1) {
  25092. var $1,$receiver;
  25093. $1=$recv(aContext)._home();
  25094. $ctx1.sendIdx["home"]=1;
  25095. if(($receiver = $1) == null || $receiver.a$nil){
  25096. $1;
  25097. } else {
  25098. $self._logContext_($recv(aContext)._home());
  25099. }
  25100. $self._log_($recv(aContext)._asString());
  25101. return self;
  25102. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25103. },
  25104. args: ["aContext"],
  25105. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25106. referencedClasses: [],
  25107. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25108. }),
  25109. $globals.ConsoleErrorHandler);
  25110. $core.addMethod(
  25111. $core.method({
  25112. selector: "logError:",
  25113. protocol: "private",
  25114. fn: function (anError){
  25115. var self=this,$self=this;
  25116. return $core.withContext(function($ctx1) {
  25117. $self._log_($recv(anError)._messageText());
  25118. return self;
  25119. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25120. },
  25121. args: ["anError"],
  25122. source: "logError: anError\x0a\x09self log: anError messageText",
  25123. referencedClasses: [],
  25124. messageSends: ["log:", "messageText"]
  25125. }),
  25126. $globals.ConsoleErrorHandler);
  25127. $core.addMethod(
  25128. $core.method({
  25129. selector: "logErrorContext:",
  25130. protocol: "private",
  25131. fn: function (aContext){
  25132. var self=this,$self=this;
  25133. return $core.withContext(function($ctx1) {
  25134. var $1,$receiver;
  25135. if(($receiver = aContext) == null || $receiver.a$nil){
  25136. aContext;
  25137. } else {
  25138. $1=$recv(aContext)._home();
  25139. $ctx1.sendIdx["home"]=1;
  25140. if(($receiver = $1) == null || $receiver.a$nil){
  25141. $1;
  25142. } else {
  25143. $self._logContext_($recv(aContext)._home());
  25144. }
  25145. }
  25146. return self;
  25147. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25148. },
  25149. args: ["aContext"],
  25150. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25151. referencedClasses: [],
  25152. messageSends: ["ifNotNil:", "home", "logContext:"]
  25153. }),
  25154. $globals.ConsoleErrorHandler);
  25155. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25156. $core.addMethod(
  25157. $core.method({
  25158. selector: "initialize",
  25159. protocol: "initialization",
  25160. fn: function (){
  25161. var self=this,$self=this;
  25162. return $core.withContext(function($ctx1) {
  25163. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25164. return self;
  25165. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25166. },
  25167. args: [],
  25168. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25169. referencedClasses: ["ErrorHandler"],
  25170. messageSends: ["registerIfNone:", "new"]
  25171. }),
  25172. $globals.ConsoleErrorHandler.a$cls);
  25173. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25174. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25175. $core.addMethod(
  25176. $core.method({
  25177. selector: "clear",
  25178. protocol: "printing",
  25179. fn: function (){
  25180. var self=this,$self=this;
  25181. return self;
  25182. },
  25183. args: [],
  25184. source: "clear\x0a\x09\x22no op\x22",
  25185. referencedClasses: [],
  25186. messageSends: []
  25187. }),
  25188. $globals.ConsoleTranscript);
  25189. $core.addMethod(
  25190. $core.method({
  25191. selector: "cr",
  25192. protocol: "printing",
  25193. fn: function (){
  25194. var self=this,$self=this;
  25195. return self;
  25196. },
  25197. args: [],
  25198. source: "cr\x0a\x09\x22no op\x22",
  25199. referencedClasses: [],
  25200. messageSends: []
  25201. }),
  25202. $globals.ConsoleTranscript);
  25203. $core.addMethod(
  25204. $core.method({
  25205. selector: "open",
  25206. protocol: "actions",
  25207. fn: function (){
  25208. var self=this,$self=this;
  25209. return self;
  25210. },
  25211. args: [],
  25212. source: "open",
  25213. referencedClasses: [],
  25214. messageSends: []
  25215. }),
  25216. $globals.ConsoleTranscript);
  25217. $core.addMethod(
  25218. $core.method({
  25219. selector: "show:",
  25220. protocol: "printing",
  25221. fn: function (anObject){
  25222. var self=this,$self=this;
  25223. return $core.withContext(function($ctx1) {
  25224. console.log(String($recv(anObject)._asString()));
  25225. return self;
  25226. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25227. },
  25228. args: ["anObject"],
  25229. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<inlineJS: 'console.log(String($recv(anObject)._asString()))'>",
  25230. referencedClasses: [],
  25231. messageSends: []
  25232. }),
  25233. $globals.ConsoleTranscript);
  25234. $core.addMethod(
  25235. $core.method({
  25236. selector: "initialize",
  25237. protocol: "initialization",
  25238. fn: function (){
  25239. var self=this,$self=this;
  25240. return $core.withContext(function($ctx1) {
  25241. $recv($globals.Transcript)._registerIfNone_($self._new());
  25242. return self;
  25243. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25244. },
  25245. args: [],
  25246. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25247. referencedClasses: ["Transcript"],
  25248. messageSends: ["registerIfNone:", "new"]
  25249. }),
  25250. $globals.ConsoleTranscript.a$cls);
  25251. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25252. $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.";
  25253. $core.addMethod(
  25254. $core.method({
  25255. selector: "addInstVarNamed:to:",
  25256. protocol: "compiling",
  25257. fn: function (aString,aClass){
  25258. var self=this,$self=this;
  25259. var newInstVars;
  25260. return $core.withContext(function($ctx1) {
  25261. var $1,$2,$3,$4,$5;
  25262. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25263. $1=$recv(aClass)._isMetaclass();
  25264. if($core.assert($1)){
  25265. $2=$self._classBuilder();
  25266. $ctx1.sendIdx["classBuilder"]=1;
  25267. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25268. } else {
  25269. $3=$self._classBuilder();
  25270. $4=$recv(aClass)._superclass();
  25271. $5=$recv(aClass)._name();
  25272. $ctx1.sendIdx["name"]=1;
  25273. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25274. }
  25275. return self;
  25276. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25277. },
  25278. args: ["aString", "aClass"],
  25279. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25280. referencedClasses: [],
  25281. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25282. }),
  25283. $globals.Environment);
  25284. $core.addMethod(
  25285. $core.method({
  25286. selector: "allSelectors",
  25287. protocol: "accessing",
  25288. fn: function (){
  25289. var self=this,$self=this;
  25290. return $core.withContext(function($ctx1) {
  25291. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25292. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25293. },
  25294. args: [],
  25295. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25296. referencedClasses: ["Smalltalk"],
  25297. messageSends: ["allSelectors", "core"]
  25298. }),
  25299. $globals.Environment);
  25300. $core.addMethod(
  25301. $core.method({
  25302. selector: "availableClassNames",
  25303. protocol: "accessing",
  25304. fn: function (){
  25305. var self=this,$self=this;
  25306. return $core.withContext(function($ctx1) {
  25307. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25308. return $core.withContext(function($ctx2) {
  25309. return $recv(each)._name();
  25310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25311. }));
  25312. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25313. },
  25314. args: [],
  25315. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25316. referencedClasses: ["Smalltalk"],
  25317. messageSends: ["collect:", "classes", "name"]
  25318. }),
  25319. $globals.Environment);
  25320. $core.addMethod(
  25321. $core.method({
  25322. selector: "availablePackageNames",
  25323. protocol: "accessing",
  25324. fn: function (){
  25325. var self=this,$self=this;
  25326. return $core.withContext(function($ctx1) {
  25327. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25328. return $core.withContext(function($ctx2) {
  25329. return $recv(each)._name();
  25330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25331. }));
  25332. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25333. },
  25334. args: [],
  25335. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25336. referencedClasses: ["Smalltalk"],
  25337. messageSends: ["collect:", "packages", "name"]
  25338. }),
  25339. $globals.Environment);
  25340. $core.addMethod(
  25341. $core.method({
  25342. selector: "availableProtocolsFor:",
  25343. protocol: "accessing",
  25344. fn: function (aClass){
  25345. var self=this,$self=this;
  25346. var protocols;
  25347. return $core.withContext(function($ctx1) {
  25348. var $1,$receiver;
  25349. protocols=$recv(aClass)._protocols();
  25350. $1=$recv(aClass)._superclass();
  25351. $ctx1.sendIdx["superclass"]=1;
  25352. if(($receiver = $1) == null || $receiver.a$nil){
  25353. $1;
  25354. } else {
  25355. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25356. }
  25357. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25358. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25359. },
  25360. args: ["aClass"],
  25361. 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",
  25362. referencedClasses: [],
  25363. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25364. }),
  25365. $globals.Environment);
  25366. $core.addMethod(
  25367. $core.method({
  25368. selector: "classBuilder",
  25369. protocol: "accessing",
  25370. fn: function (){
  25371. var self=this,$self=this;
  25372. return $core.withContext(function($ctx1) {
  25373. return $recv($globals.ClassBuilder)._new();
  25374. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25375. },
  25376. args: [],
  25377. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25378. referencedClasses: ["ClassBuilder"],
  25379. messageSends: ["new"]
  25380. }),
  25381. $globals.Environment);
  25382. $core.addMethod(
  25383. $core.method({
  25384. selector: "classNamed:",
  25385. protocol: "accessing",
  25386. fn: function (aString){
  25387. var self=this,$self=this;
  25388. return $core.withContext(function($ctx1) {
  25389. var $1,$receiver;
  25390. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25391. if(($receiver = $1) == null || $receiver.a$nil){
  25392. return $self._error_("Invalid class name");
  25393. } else {
  25394. return $1;
  25395. }
  25396. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25397. },
  25398. args: ["aString"],
  25399. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25400. referencedClasses: ["Smalltalk"],
  25401. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25402. }),
  25403. $globals.Environment);
  25404. $core.addMethod(
  25405. $core.method({
  25406. selector: "classes",
  25407. protocol: "accessing",
  25408. fn: function (){
  25409. var self=this,$self=this;
  25410. return $core.withContext(function($ctx1) {
  25411. return $recv($globals.Smalltalk)._classes();
  25412. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25413. },
  25414. args: [],
  25415. source: "classes\x0a\x09^ Smalltalk classes",
  25416. referencedClasses: ["Smalltalk"],
  25417. messageSends: ["classes"]
  25418. }),
  25419. $globals.Environment);
  25420. $core.addMethod(
  25421. $core.method({
  25422. selector: "commitPackage:onSuccess:onError:",
  25423. protocol: "actions",
  25424. fn: function (aPackage,aBlock,anotherBlock){
  25425. var self=this,$self=this;
  25426. return $core.withContext(function($ctx1) {
  25427. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25428. return self;
  25429. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25430. },
  25431. args: ["aPackage", "aBlock", "anotherBlock"],
  25432. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25433. referencedClasses: [],
  25434. messageSends: ["commitOnSuccess:onError:", "transport"]
  25435. }),
  25436. $globals.Environment);
  25437. $core.addMethod(
  25438. $core.method({
  25439. selector: "compileClassComment:for:",
  25440. protocol: "compiling",
  25441. fn: function (aString,aClass){
  25442. var self=this,$self=this;
  25443. return $core.withContext(function($ctx1) {
  25444. $recv(aClass)._comment_(aString);
  25445. return self;
  25446. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25447. },
  25448. args: ["aString", "aClass"],
  25449. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25450. referencedClasses: [],
  25451. messageSends: ["comment:"]
  25452. }),
  25453. $globals.Environment);
  25454. $core.addMethod(
  25455. $core.method({
  25456. selector: "compileClassDefinition:",
  25457. protocol: "compiling",
  25458. fn: function (aString){
  25459. var self=this,$self=this;
  25460. return $core.withContext(function($ctx1) {
  25461. $recv((function(){
  25462. return $core.withContext(function($ctx2) {
  25463. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25465. }))._on_do_($globals.Error,(function(error){
  25466. return $core.withContext(function($ctx2) {
  25467. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25468. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25469. }));
  25470. return self;
  25471. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25472. },
  25473. args: ["aString"],
  25474. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25475. referencedClasses: ["DoIt", "Error", "Terminal"],
  25476. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25477. }),
  25478. $globals.Environment);
  25479. $core.addMethod(
  25480. $core.method({
  25481. selector: "compileMethod:for:protocol:",
  25482. protocol: "compiling",
  25483. fn: function (sourceCode,class_,protocol){
  25484. var self=this,$self=this;
  25485. return $core.withContext(function($ctx1) {
  25486. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25487. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25488. },
  25489. args: ["sourceCode", "class", "protocol"],
  25490. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25491. referencedClasses: [],
  25492. messageSends: ["compile:protocol:"]
  25493. }),
  25494. $globals.Environment);
  25495. $core.addMethod(
  25496. $core.method({
  25497. selector: "copyClass:to:",
  25498. protocol: "actions",
  25499. fn: function (aClass,aClassName){
  25500. var self=this,$self=this;
  25501. return $core.withContext(function($ctx1) {
  25502. var $1,$2,$receiver;
  25503. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25504. if(($receiver = $1) == null || $receiver.a$nil){
  25505. $1;
  25506. } else {
  25507. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25508. $ctx1.sendIdx[","]=1;
  25509. $self._error_($2);
  25510. }
  25511. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25512. return self;
  25513. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25514. },
  25515. args: ["aClass", "aClassName"],
  25516. 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",
  25517. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25518. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25519. }),
  25520. $globals.Environment);
  25521. $core.addMethod(
  25522. $core.method({
  25523. selector: "doItReceiver",
  25524. protocol: "accessing",
  25525. fn: function (){
  25526. var self=this,$self=this;
  25527. return $core.withContext(function($ctx1) {
  25528. return $recv($globals.DoIt)._new();
  25529. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25530. },
  25531. args: [],
  25532. source: "doItReceiver\x0a\x09^ DoIt new",
  25533. referencedClasses: ["DoIt"],
  25534. messageSends: ["new"]
  25535. }),
  25536. $globals.Environment);
  25537. $core.addMethod(
  25538. $core.method({
  25539. selector: "evaluate:for:",
  25540. protocol: "evaluating",
  25541. fn: function (aString,anObject){
  25542. var self=this,$self=this;
  25543. return $core.withContext(function($ctx1) {
  25544. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25545. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25546. },
  25547. args: ["aString", "anObject"],
  25548. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25549. referencedClasses: ["Evaluator"],
  25550. messageSends: ["evaluate:for:"]
  25551. }),
  25552. $globals.Environment);
  25553. $core.addMethod(
  25554. $core.method({
  25555. selector: "evaluate:on:do:",
  25556. protocol: "error handling",
  25557. fn: function (aBlock,anErrorClass,exceptionBlock){
  25558. var self=this,$self=this;
  25559. return $core.withContext(function($ctx1) {
  25560. var $1;
  25561. $recv(aBlock)._tryCatch_((function(exception){
  25562. return $core.withContext(function($ctx2) {
  25563. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25564. if($core.assert($1)){
  25565. return $recv(exceptionBlock)._value_(exception);
  25566. } else {
  25567. return $recv(exception)._pass();
  25568. }
  25569. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25570. }));
  25571. return self;
  25572. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25573. },
  25574. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25575. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception pass ] ]",
  25576. referencedClasses: [],
  25577. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25578. }),
  25579. $globals.Environment);
  25580. $core.addMethod(
  25581. $core.method({
  25582. selector: "inspect:",
  25583. protocol: "actions",
  25584. fn: function (anObject){
  25585. var self=this,$self=this;
  25586. return $core.withContext(function($ctx1) {
  25587. $recv($globals.Inspector)._inspect_(anObject);
  25588. return self;
  25589. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25590. },
  25591. args: ["anObject"],
  25592. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25593. referencedClasses: ["Inspector"],
  25594. messageSends: ["inspect:"]
  25595. }),
  25596. $globals.Environment);
  25597. $core.addMethod(
  25598. $core.method({
  25599. selector: "moveClass:toPackage:",
  25600. protocol: "actions",
  25601. fn: function (aClass,aPackageName){
  25602. var self=this,$self=this;
  25603. var package_;
  25604. return $core.withContext(function($ctx1) {
  25605. var $1,$2,$receiver;
  25606. package_=$recv($globals.Package)._named_(aPackageName);
  25607. $1=package_;
  25608. if(($receiver = $1) == null || $receiver.a$nil){
  25609. $self._error_("Invalid package name");
  25610. } else {
  25611. $1;
  25612. }
  25613. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25614. if($core.assert($2)){
  25615. return self;
  25616. }
  25617. $recv(aClass)._package_(package_);
  25618. $recv(aClass)._recompile();
  25619. return self;
  25620. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25621. },
  25622. args: ["aClass", "aPackageName"],
  25623. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package.\x0a\x09aClass recompile",
  25624. referencedClasses: ["Package"],
  25625. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25626. }),
  25627. $globals.Environment);
  25628. $core.addMethod(
  25629. $core.method({
  25630. selector: "moveMethod:toClass:",
  25631. protocol: "actions",
  25632. fn: function (aMethod,aClassName){
  25633. var self=this,$self=this;
  25634. var destinationClass;
  25635. return $core.withContext(function($ctx1) {
  25636. var $2,$3,$1,$5,$4;
  25637. destinationClass=$self._classNamed_(aClassName);
  25638. $2=destinationClass;
  25639. $3=$recv(aMethod)._methodClass();
  25640. $ctx1.sendIdx["methodClass"]=1;
  25641. $1=$recv($2).__eq_eq($3);
  25642. if($core.assert($1)){
  25643. return self;
  25644. }
  25645. $5=$recv(aMethod)._methodClass();
  25646. $ctx1.sendIdx["methodClass"]=2;
  25647. $4=$recv($5)._isMetaclass();
  25648. if($core.assert($4)){
  25649. destinationClass=$recv(destinationClass)._theMetaClass();
  25650. destinationClass;
  25651. }
  25652. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25653. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25654. return self;
  25655. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25656. },
  25657. args: ["aMethod", "aClassName"],
  25658. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  25659. referencedClasses: [],
  25660. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25661. }),
  25662. $globals.Environment);
  25663. $core.addMethod(
  25664. $core.method({
  25665. selector: "moveMethod:toProtocol:",
  25666. protocol: "actions",
  25667. fn: function (aMethod,aProtocol){
  25668. var self=this,$self=this;
  25669. return $core.withContext(function($ctx1) {
  25670. $recv(aMethod)._protocol_(aProtocol);
  25671. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25672. return self;
  25673. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25674. },
  25675. args: ["aMethod", "aProtocol"],
  25676. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25677. referencedClasses: [],
  25678. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25679. }),
  25680. $globals.Environment);
  25681. $core.addMethod(
  25682. $core.method({
  25683. selector: "packages",
  25684. protocol: "accessing",
  25685. fn: function (){
  25686. var self=this,$self=this;
  25687. return $core.withContext(function($ctx1) {
  25688. return $recv($globals.Smalltalk)._packages();
  25689. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25690. },
  25691. args: [],
  25692. source: "packages\x0a\x09^ Smalltalk packages",
  25693. referencedClasses: ["Smalltalk"],
  25694. messageSends: ["packages"]
  25695. }),
  25696. $globals.Environment);
  25697. $core.addMethod(
  25698. $core.method({
  25699. selector: "registerErrorHandler:",
  25700. protocol: "services",
  25701. fn: function (anErrorHandler){
  25702. var self=this,$self=this;
  25703. return $core.withContext(function($ctx1) {
  25704. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25705. return self;
  25706. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25707. },
  25708. args: ["anErrorHandler"],
  25709. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25710. referencedClasses: ["ErrorHandler"],
  25711. messageSends: ["register:"]
  25712. }),
  25713. $globals.Environment);
  25714. $core.addMethod(
  25715. $core.method({
  25716. selector: "registerFinder:",
  25717. protocol: "services",
  25718. fn: function (aFinder){
  25719. var self=this,$self=this;
  25720. return $core.withContext(function($ctx1) {
  25721. $recv($globals.Finder)._register_(aFinder);
  25722. return self;
  25723. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25724. },
  25725. args: ["aFinder"],
  25726. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25727. referencedClasses: ["Finder"],
  25728. messageSends: ["register:"]
  25729. }),
  25730. $globals.Environment);
  25731. $core.addMethod(
  25732. $core.method({
  25733. selector: "registerInspector:",
  25734. protocol: "services",
  25735. fn: function (anInspector){
  25736. var self=this,$self=this;
  25737. return $core.withContext(function($ctx1) {
  25738. $recv($globals.Inspector)._register_(anInspector);
  25739. return self;
  25740. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25741. },
  25742. args: ["anInspector"],
  25743. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25744. referencedClasses: ["Inspector"],
  25745. messageSends: ["register:"]
  25746. }),
  25747. $globals.Environment);
  25748. $core.addMethod(
  25749. $core.method({
  25750. selector: "registerProgressHandler:",
  25751. protocol: "services",
  25752. fn: function (aProgressHandler){
  25753. var self=this,$self=this;
  25754. return $core.withContext(function($ctx1) {
  25755. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25756. return self;
  25757. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25758. },
  25759. args: ["aProgressHandler"],
  25760. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25761. referencedClasses: ["ProgressHandler"],
  25762. messageSends: ["register:"]
  25763. }),
  25764. $globals.Environment);
  25765. $core.addMethod(
  25766. $core.method({
  25767. selector: "registerTranscript:",
  25768. protocol: "services",
  25769. fn: function (aTranscript){
  25770. var self=this,$self=this;
  25771. return $core.withContext(function($ctx1) {
  25772. $recv($globals.Transcript)._register_(aTranscript);
  25773. return self;
  25774. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25775. },
  25776. args: ["aTranscript"],
  25777. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25778. referencedClasses: ["Transcript"],
  25779. messageSends: ["register:"]
  25780. }),
  25781. $globals.Environment);
  25782. $core.addMethod(
  25783. $core.method({
  25784. selector: "removeClass:",
  25785. protocol: "actions",
  25786. fn: function (aClass){
  25787. var self=this,$self=this;
  25788. return $core.withContext(function($ctx1) {
  25789. $recv($globals.Smalltalk)._removeClass_(aClass);
  25790. return self;
  25791. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25792. },
  25793. args: ["aClass"],
  25794. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25795. referencedClasses: ["Smalltalk"],
  25796. messageSends: ["removeClass:"]
  25797. }),
  25798. $globals.Environment);
  25799. $core.addMethod(
  25800. $core.method({
  25801. selector: "removeMethod:",
  25802. protocol: "actions",
  25803. fn: function (aMethod){
  25804. var self=this,$self=this;
  25805. return $core.withContext(function($ctx1) {
  25806. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25807. return self;
  25808. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25809. },
  25810. args: ["aMethod"],
  25811. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25812. referencedClasses: [],
  25813. messageSends: ["removeCompiledMethod:", "methodClass"]
  25814. }),
  25815. $globals.Environment);
  25816. $core.addMethod(
  25817. $core.method({
  25818. selector: "removeProtocol:from:",
  25819. protocol: "actions",
  25820. fn: function (aString,aClass){
  25821. var self=this,$self=this;
  25822. return $core.withContext(function($ctx1) {
  25823. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25824. return $core.withContext(function($ctx2) {
  25825. return $recv(aClass)._removeCompiledMethod_(each);
  25826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25827. }));
  25828. return self;
  25829. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25830. },
  25831. args: ["aString", "aClass"],
  25832. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25833. referencedClasses: [],
  25834. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25835. }),
  25836. $globals.Environment);
  25837. $core.addMethod(
  25838. $core.method({
  25839. selector: "renameClass:to:",
  25840. protocol: "actions",
  25841. fn: function (aClass,aClassName){
  25842. var self=this,$self=this;
  25843. return $core.withContext(function($ctx1) {
  25844. var $1,$2,$receiver;
  25845. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25846. if(($receiver = $1) == null || $receiver.a$nil){
  25847. $1;
  25848. } else {
  25849. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25850. $ctx1.sendIdx[","]=1;
  25851. $self._error_($2);
  25852. }
  25853. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25854. return self;
  25855. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25856. },
  25857. args: ["aClass", "aClassName"],
  25858. 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",
  25859. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25860. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25861. }),
  25862. $globals.Environment);
  25863. $core.addMethod(
  25864. $core.method({
  25865. selector: "renamePackage:to:",
  25866. protocol: "actions",
  25867. fn: function (aPackageName,aNewPackageName){
  25868. var self=this,$self=this;
  25869. return $core.withContext(function($ctx1) {
  25870. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25871. return self;
  25872. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25873. },
  25874. args: ["aPackageName", "aNewPackageName"],
  25875. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25876. referencedClasses: ["Smalltalk"],
  25877. messageSends: ["renamePackage:to:"]
  25878. }),
  25879. $globals.Environment);
  25880. $core.addMethod(
  25881. $core.method({
  25882. selector: "renameProtocol:to:in:",
  25883. protocol: "actions",
  25884. fn: function (aString,anotherString,aClass){
  25885. var self=this,$self=this;
  25886. return $core.withContext(function($ctx1) {
  25887. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25888. return $core.withContext(function($ctx2) {
  25889. return $recv(each)._protocol_(anotherString);
  25890. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25891. }));
  25892. return self;
  25893. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25894. },
  25895. args: ["aString", "anotherString", "aClass"],
  25896. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25897. referencedClasses: [],
  25898. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25899. }),
  25900. $globals.Environment);
  25901. $core.addMethod(
  25902. $core.method({
  25903. selector: "setClassCommentOf:to:",
  25904. protocol: "actions",
  25905. fn: function (aClass,aString){
  25906. var self=this,$self=this;
  25907. return $core.withContext(function($ctx1) {
  25908. $recv(aClass)._comment_(aString);
  25909. return self;
  25910. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25911. },
  25912. args: ["aClass", "aString"],
  25913. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25914. referencedClasses: [],
  25915. messageSends: ["comment:"]
  25916. }),
  25917. $globals.Environment);
  25918. $core.addMethod(
  25919. $core.method({
  25920. selector: "systemAnnouncer",
  25921. protocol: "accessing",
  25922. fn: function (){
  25923. var self=this,$self=this;
  25924. return $core.withContext(function($ctx1) {
  25925. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25926. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25927. },
  25928. args: [],
  25929. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25930. referencedClasses: ["Smalltalk"],
  25931. messageSends: ["current", "at:", "globals"]
  25932. }),
  25933. $globals.Environment);
  25934. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25935. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25936. $core.addMethod(
  25937. $core.method({
  25938. selector: "do:on:displaying:",
  25939. protocol: "progress handling",
  25940. fn: function (aBlock,aCollection,aString){
  25941. var self=this,$self=this;
  25942. return $core.withContext(function($ctx1) {
  25943. $recv(aCollection)._do_(aBlock);
  25944. return self;
  25945. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25946. },
  25947. args: ["aBlock", "aCollection", "aString"],
  25948. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25949. referencedClasses: [],
  25950. messageSends: ["do:"]
  25951. }),
  25952. $globals.NullProgressHandler);
  25953. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25954. $core.addMethod(
  25955. $core.method({
  25956. selector: "initialize",
  25957. protocol: "initialization",
  25958. fn: function (){
  25959. var self=this,$self=this;
  25960. return $core.withContext(function($ctx1) {
  25961. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25962. return self;
  25963. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25964. },
  25965. args: [],
  25966. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  25967. referencedClasses: ["ProgressHandler"],
  25968. messageSends: ["registerIfNone:", "new"]
  25969. }),
  25970. $globals.NullProgressHandler.a$cls);
  25971. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  25972. $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.";
  25973. $globals.Service.a$cls.iVarNames = ["current"];
  25974. $core.addMethod(
  25975. $core.method({
  25976. selector: "current",
  25977. protocol: "accessing",
  25978. fn: function (){
  25979. var self=this,$self=this;
  25980. return $self["@current"];
  25981. },
  25982. args: [],
  25983. source: "current\x0a\x09^ current",
  25984. referencedClasses: [],
  25985. messageSends: []
  25986. }),
  25987. $globals.Service.a$cls);
  25988. $core.addMethod(
  25989. $core.method({
  25990. selector: "new",
  25991. protocol: "instance creation",
  25992. fn: function (){
  25993. var self=this,$self=this;
  25994. return $core.withContext(function($ctx1) {
  25995. $self._shouldNotImplement();
  25996. return self;
  25997. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  25998. },
  25999. args: [],
  26000. source: "new\x0a\x09self shouldNotImplement",
  26001. referencedClasses: [],
  26002. messageSends: ["shouldNotImplement"]
  26003. }),
  26004. $globals.Service.a$cls);
  26005. $core.addMethod(
  26006. $core.method({
  26007. selector: "register:",
  26008. protocol: "registration",
  26009. fn: function (anObject){
  26010. var self=this,$self=this;
  26011. $self["@current"]=anObject;
  26012. return self;
  26013. },
  26014. args: ["anObject"],
  26015. source: "register: anObject\x0a\x09current := anObject",
  26016. referencedClasses: [],
  26017. messageSends: []
  26018. }),
  26019. $globals.Service.a$cls);
  26020. $core.addMethod(
  26021. $core.method({
  26022. selector: "registerIfNone:",
  26023. protocol: "registration",
  26024. fn: function (anObject){
  26025. var self=this,$self=this;
  26026. return $core.withContext(function($ctx1) {
  26027. var $1,$receiver;
  26028. $1=$self._current();
  26029. if(($receiver = $1) == null || $receiver.a$nil){
  26030. $self._register_(anObject);
  26031. } else {
  26032. $1;
  26033. }
  26034. return self;
  26035. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26036. },
  26037. args: ["anObject"],
  26038. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26039. referencedClasses: [],
  26040. messageSends: ["ifNil:", "current", "register:"]
  26041. }),
  26042. $globals.Service.a$cls);
  26043. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26044. $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.";
  26045. $core.addMethod(
  26046. $core.method({
  26047. selector: "handleError:",
  26048. protocol: "error handling",
  26049. fn: function (anError){
  26050. var self=this,$self=this;
  26051. return $core.withContext(function($ctx1) {
  26052. var $1;
  26053. $1=$recv((function(){
  26054. return $core.withContext(function($ctx2) {
  26055. return $recv(anError)._isSmalltalkError();
  26056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26057. }))._tryCatch_((function(){
  26058. return false;
  26059. }));
  26060. if($core.assert($1)){
  26061. $self._handleUnhandledError_(anError);
  26062. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26063. } else {
  26064. var smalltalkError;
  26065. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26066. $recv(smalltalkError)._wrap();
  26067. $self._handleUnhandledError_(smalltalkError);
  26068. }
  26069. return self;
  26070. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26071. },
  26072. args: ["anError"],
  26073. source: "handleError: anError\x0a\x09([ anError isSmalltalkError ] tryCatch: [ false ])\x0a\x09\x09ifTrue: [ self handleUnhandledError: anError ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| smalltalkError |\x0a\x09\x09\x09smalltalkError := JavaScriptException on: anError.\x0a\x09\x09\x09smalltalkError wrap.\x0a\x09\x09\x09self handleUnhandledError: smalltalkError ]",
  26074. referencedClasses: ["JavaScriptException"],
  26075. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26076. }),
  26077. $globals.ErrorHandler.a$cls);
  26078. $core.addMethod(
  26079. $core.method({
  26080. selector: "handleUnhandledError:",
  26081. protocol: "error handling",
  26082. fn: function (anError){
  26083. var self=this,$self=this;
  26084. return $core.withContext(function($ctx1) {
  26085. var $1;
  26086. $1=$recv(anError)._wasHandled();
  26087. if(!$core.assert($1)){
  26088. $recv($self._current())._handleError_(anError);
  26089. $recv(anError)._beHandled();
  26090. }
  26091. return self;
  26092. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26093. },
  26094. args: ["anError"],
  26095. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26096. referencedClasses: [],
  26097. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26098. }),
  26099. $globals.ErrorHandler.a$cls);
  26100. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26101. $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.";
  26102. $core.addMethod(
  26103. $core.method({
  26104. selector: "findClass:",
  26105. protocol: "finding",
  26106. fn: function (aClass){
  26107. var self=this,$self=this;
  26108. return $core.withContext(function($ctx1) {
  26109. return $recv($self._current())._findClass_(aClass);
  26110. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26111. },
  26112. args: ["aClass"],
  26113. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26114. referencedClasses: [],
  26115. messageSends: ["findClass:", "current"]
  26116. }),
  26117. $globals.Finder.a$cls);
  26118. $core.addMethod(
  26119. $core.method({
  26120. selector: "findMethod:",
  26121. protocol: "finding",
  26122. fn: function (aCompiledMethod){
  26123. var self=this,$self=this;
  26124. return $core.withContext(function($ctx1) {
  26125. return $recv($self._current())._findMethod_(aCompiledMethod);
  26126. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26127. },
  26128. args: ["aCompiledMethod"],
  26129. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26130. referencedClasses: [],
  26131. messageSends: ["findMethod:", "current"]
  26132. }),
  26133. $globals.Finder.a$cls);
  26134. $core.addMethod(
  26135. $core.method({
  26136. selector: "findString:",
  26137. protocol: "finding",
  26138. fn: function (aString){
  26139. var self=this,$self=this;
  26140. return $core.withContext(function($ctx1) {
  26141. return $recv($self._current())._findString_(aString);
  26142. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26143. },
  26144. args: ["aString"],
  26145. source: "findString: aString\x0a\x09^ self current findString: aString",
  26146. referencedClasses: [],
  26147. messageSends: ["findString:", "current"]
  26148. }),
  26149. $globals.Finder.a$cls);
  26150. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26151. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26152. $core.addMethod(
  26153. $core.method({
  26154. selector: "inspect:",
  26155. protocol: "inspecting",
  26156. fn: function (anObject){
  26157. var self=this,$self=this;
  26158. return $core.withContext(function($ctx1) {
  26159. return $recv($self._current())._inspect_(anObject);
  26160. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26161. },
  26162. args: ["anObject"],
  26163. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26164. referencedClasses: [],
  26165. messageSends: ["inspect:", "current"]
  26166. }),
  26167. $globals.Inspector.a$cls);
  26168. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26169. $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";
  26170. $core.addMethod(
  26171. $core.method({
  26172. selector: "globals",
  26173. protocol: "accessing",
  26174. fn: function (){
  26175. var self=this,$self=this;
  26176. return $core.withContext(function($ctx1) {
  26177. return $recv($self._current())._globals();
  26178. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26179. },
  26180. args: [],
  26181. source: "globals\x0a\x09^ self current globals",
  26182. referencedClasses: [],
  26183. messageSends: ["globals", "current"]
  26184. }),
  26185. $globals.Platform.a$cls);
  26186. $core.addMethod(
  26187. $core.method({
  26188. selector: "includesGlobal:",
  26189. protocol: "testing",
  26190. fn: function (aString){
  26191. var self=this,$self=this;
  26192. return $core.withContext(function($ctx1) {
  26193. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26194. return true;
  26195. }),(function(){
  26196. return false;
  26197. }));
  26198. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26199. },
  26200. args: ["aString"],
  26201. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26202. referencedClasses: [],
  26203. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26204. }),
  26205. $globals.Platform.a$cls);
  26206. $core.addMethod(
  26207. $core.method({
  26208. selector: "newXhr",
  26209. protocol: "accessing",
  26210. fn: function (){
  26211. var self=this,$self=this;
  26212. return $core.withContext(function($ctx1) {
  26213. return $recv($self._current())._newXhr();
  26214. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26215. },
  26216. args: [],
  26217. source: "newXhr\x0a\x09^ self current newXhr",
  26218. referencedClasses: [],
  26219. messageSends: ["newXhr", "current"]
  26220. }),
  26221. $globals.Platform.a$cls);
  26222. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26223. $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`.";
  26224. $core.addMethod(
  26225. $core.method({
  26226. selector: "do:on:displaying:",
  26227. protocol: "progress handling",
  26228. fn: function (aBlock,aCollection,aString){
  26229. var self=this,$self=this;
  26230. return $core.withContext(function($ctx1) {
  26231. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26232. return self;
  26233. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26234. },
  26235. args: ["aBlock", "aCollection", "aString"],
  26236. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26237. referencedClasses: [],
  26238. messageSends: ["do:on:displaying:", "current"]
  26239. }),
  26240. $globals.ProgressHandler.a$cls);
  26241. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26242. $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:'.";
  26243. $core.addMethod(
  26244. $core.method({
  26245. selector: "alert:",
  26246. protocol: "dialogs",
  26247. fn: function (aString){
  26248. var self=this,$self=this;
  26249. return $core.withContext(function($ctx1) {
  26250. return $recv($self._current())._alert_(aString);
  26251. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26252. },
  26253. args: ["aString"],
  26254. source: "alert: aString\x0a\x09^ self current alert: aString",
  26255. referencedClasses: [],
  26256. messageSends: ["alert:", "current"]
  26257. }),
  26258. $globals.Terminal.a$cls);
  26259. $core.addMethod(
  26260. $core.method({
  26261. selector: "confirm:",
  26262. protocol: "dialogs",
  26263. fn: function (aString){
  26264. var self=this,$self=this;
  26265. return $core.withContext(function($ctx1) {
  26266. return $recv($self._current())._confirm_(aString);
  26267. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26268. },
  26269. args: ["aString"],
  26270. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26271. referencedClasses: [],
  26272. messageSends: ["confirm:", "current"]
  26273. }),
  26274. $globals.Terminal.a$cls);
  26275. $core.addMethod(
  26276. $core.method({
  26277. selector: "prompt:",
  26278. protocol: "dialogs",
  26279. fn: function (aString){
  26280. var self=this,$self=this;
  26281. return $core.withContext(function($ctx1) {
  26282. return $recv($self._current())._prompt_(aString);
  26283. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26284. },
  26285. args: ["aString"],
  26286. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26287. referencedClasses: [],
  26288. messageSends: ["prompt:", "current"]
  26289. }),
  26290. $globals.Terminal.a$cls);
  26291. $core.addMethod(
  26292. $core.method({
  26293. selector: "prompt:default:",
  26294. protocol: "dialogs",
  26295. fn: function (aString,defaultString){
  26296. var self=this,$self=this;
  26297. return $core.withContext(function($ctx1) {
  26298. return $recv($self._current())._prompt_default_(aString,defaultString);
  26299. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26300. },
  26301. args: ["aString", "defaultString"],
  26302. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26303. referencedClasses: [],
  26304. messageSends: ["prompt:default:", "current"]
  26305. }),
  26306. $globals.Terminal.a$cls);
  26307. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26308. $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.";
  26309. $core.addMethod(
  26310. $core.method({
  26311. selector: "clear",
  26312. protocol: "printing",
  26313. fn: function (){
  26314. var self=this,$self=this;
  26315. return $core.withContext(function($ctx1) {
  26316. $recv($self._current())._clear();
  26317. return self;
  26318. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26319. },
  26320. args: [],
  26321. source: "clear\x0a\x09self current clear",
  26322. referencedClasses: [],
  26323. messageSends: ["clear", "current"]
  26324. }),
  26325. $globals.Transcript.a$cls);
  26326. $core.addMethod(
  26327. $core.method({
  26328. selector: "cr",
  26329. protocol: "printing",
  26330. fn: function (){
  26331. var self=this,$self=this;
  26332. return $core.withContext(function($ctx1) {
  26333. $recv($self._current())._show_($recv($globals.String)._cr());
  26334. return self;
  26335. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26336. },
  26337. args: [],
  26338. source: "cr\x0a\x09self current show: String cr",
  26339. referencedClasses: ["String"],
  26340. messageSends: ["show:", "current", "cr"]
  26341. }),
  26342. $globals.Transcript.a$cls);
  26343. $core.addMethod(
  26344. $core.method({
  26345. selector: "inspect:",
  26346. protocol: "printing",
  26347. fn: function (anObject){
  26348. var self=this,$self=this;
  26349. return $core.withContext(function($ctx1) {
  26350. $self._show_(anObject);
  26351. return self;
  26352. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26353. },
  26354. args: ["anObject"],
  26355. source: "inspect: anObject\x0a\x09self show: anObject",
  26356. referencedClasses: [],
  26357. messageSends: ["show:"]
  26358. }),
  26359. $globals.Transcript.a$cls);
  26360. $core.addMethod(
  26361. $core.method({
  26362. selector: "open",
  26363. protocol: "instance creation",
  26364. fn: function (){
  26365. var self=this,$self=this;
  26366. return $core.withContext(function($ctx1) {
  26367. $recv($self._current())._open();
  26368. return self;
  26369. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26370. },
  26371. args: [],
  26372. source: "open\x0a\x09self current open",
  26373. referencedClasses: [],
  26374. messageSends: ["open", "current"]
  26375. }),
  26376. $globals.Transcript.a$cls);
  26377. $core.addMethod(
  26378. $core.method({
  26379. selector: "show:",
  26380. protocol: "printing",
  26381. fn: function (anObject){
  26382. var self=this,$self=this;
  26383. return $core.withContext(function($ctx1) {
  26384. $recv($self._current())._show_(anObject);
  26385. return self;
  26386. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26387. },
  26388. args: ["anObject"],
  26389. source: "show: anObject\x0a\x09self current show: anObject",
  26390. referencedClasses: [],
  26391. messageSends: ["show:", "current"]
  26392. }),
  26393. $globals.Transcript.a$cls);
  26394. $core.addMethod(
  26395. $core.method({
  26396. selector: "inspectOn:",
  26397. protocol: "*Platform-Services",
  26398. fn: function (anInspector){
  26399. var self=this,$self=this;
  26400. var variables;
  26401. return $core.withContext(function($ctx1) {
  26402. variables=$recv($globals.Dictionary)._new();
  26403. $recv(variables)._at_put_("#self",self);
  26404. $ctx1.sendIdx["at:put:"]=1;
  26405. $recv(variables)._at_put_("#keys",$self._keys());
  26406. $ctx1.sendIdx["at:put:"]=2;
  26407. $self._keysAndValuesDo_((function(key,value){
  26408. return $core.withContext(function($ctx2) {
  26409. return $recv(variables)._at_put_(key,value);
  26410. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26411. }));
  26412. $recv(anInspector)._setLabel_($self._printString());
  26413. $recv(anInspector)._setVariables_(variables);
  26414. return self;
  26415. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26416. },
  26417. args: ["anInspector"],
  26418. 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",
  26419. referencedClasses: ["Dictionary"],
  26420. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26421. }),
  26422. $globals.AssociativeCollection);
  26423. $core.addMethod(
  26424. $core.method({
  26425. selector: "inspectOn:",
  26426. protocol: "*Platform-Services",
  26427. fn: function (anInspector){
  26428. var self=this,$self=this;
  26429. var variables;
  26430. return $core.withContext(function($ctx1) {
  26431. variables=$recv($globals.Dictionary)._new();
  26432. $recv(variables)._at_put_("#self",self);
  26433. $ctx1.sendIdx["at:put:"]=1;
  26434. $self._withIndexDo_((function(each,i){
  26435. return $core.withContext(function($ctx2) {
  26436. return $recv(variables)._at_put_(i,each);
  26437. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26438. }));
  26439. $recv(anInspector)._setLabel_($self._printString());
  26440. $recv(anInspector)._setVariables_(variables);
  26441. return self;
  26442. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26443. },
  26444. args: ["anInspector"],
  26445. 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",
  26446. referencedClasses: ["Dictionary"],
  26447. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26448. }),
  26449. $globals.Collection);
  26450. $core.addMethod(
  26451. $core.method({
  26452. selector: "inspectOn:",
  26453. protocol: "*Platform-Services",
  26454. fn: function (anInspector){
  26455. var self=this,$self=this;
  26456. var variables;
  26457. return $core.withContext(function($ctx1) {
  26458. variables=$recv($globals.Dictionary)._new();
  26459. $recv(variables)._at_put_("#self",self);
  26460. $ctx1.sendIdx["at:put:"]=1;
  26461. $recv(variables)._at_put_("#year",$self._year());
  26462. $ctx1.sendIdx["at:put:"]=2;
  26463. $recv(variables)._at_put_("#month",$self._month());
  26464. $ctx1.sendIdx["at:put:"]=3;
  26465. $recv(variables)._at_put_("#day",$self._day());
  26466. $ctx1.sendIdx["at:put:"]=4;
  26467. $recv(variables)._at_put_("#hours",$self._hours());
  26468. $ctx1.sendIdx["at:put:"]=5;
  26469. $recv(variables)._at_put_("#minutes",$self._minutes());
  26470. $ctx1.sendIdx["at:put:"]=6;
  26471. $recv(variables)._at_put_("#seconds",$self._seconds());
  26472. $ctx1.sendIdx["at:put:"]=7;
  26473. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26474. $recv(anInspector)._setLabel_($self._printString());
  26475. $recv(anInspector)._setVariables_(variables);
  26476. return self;
  26477. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26478. },
  26479. args: ["anInspector"],
  26480. 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",
  26481. referencedClasses: ["Dictionary"],
  26482. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26483. }),
  26484. $globals.Date);
  26485. $core.addMethod(
  26486. $core.method({
  26487. selector: "inspectOn:",
  26488. protocol: "*Platform-Services",
  26489. fn: function (anInspector){
  26490. var self=this,$self=this;
  26491. var variables;
  26492. return $core.withContext(function($ctx1) {
  26493. variables=$recv($globals.Dictionary)._new();
  26494. $recv(variables)._at_put_("#self",$self._jsObject());
  26495. $recv(anInspector)._setLabel_($self._printString());
  26496. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26497. $recv(anInspector)._setVariables_(variables);
  26498. return self;
  26499. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26500. },
  26501. args: ["anInspector"],
  26502. 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",
  26503. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26504. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26505. }),
  26506. $globals.JSObjectProxy);
  26507. $core.addMethod(
  26508. $core.method({
  26509. selector: "inspectOn:",
  26510. protocol: "*Platform-Services",
  26511. fn: function (anInspector){
  26512. var self=this,$self=this;
  26513. var variables;
  26514. return $core.withContext(function($ctx1) {
  26515. variables=$recv($globals.Dictionary)._new();
  26516. $recv(variables)._at_put_("#self",self);
  26517. $ctx1.sendIdx["at:put:"]=1;
  26518. $recv(variables)._at_put_("#home",$self._home());
  26519. $ctx1.sendIdx["at:put:"]=2;
  26520. $recv(variables)._at_put_("#receiver",$self._receiver());
  26521. $ctx1.sendIdx["at:put:"]=3;
  26522. $recv(variables)._at_put_("#selector",$self._selector());
  26523. $ctx1.sendIdx["at:put:"]=4;
  26524. $recv(variables)._at_put_("#locals",$self._locals());
  26525. $ctx1.sendIdx["at:put:"]=5;
  26526. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26527. return $core.withContext(function($ctx2) {
  26528. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26530. }));
  26531. $recv(anInspector)._setLabel_($self._printString());
  26532. $recv(anInspector)._setVariables_(variables);
  26533. return self;
  26534. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26535. },
  26536. args: ["anInspector"],
  26537. 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",
  26538. referencedClasses: ["Dictionary"],
  26539. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26540. }),
  26541. $globals.MethodContext);
  26542. $core.addMethod(
  26543. $core.method({
  26544. selector: "inspectOn:",
  26545. protocol: "*Platform-Services",
  26546. fn: function (anInspector){
  26547. var self=this,$self=this;
  26548. var variables;
  26549. return $core.withContext(function($ctx1) {
  26550. variables=$recv($globals.Dictionary)._new();
  26551. $recv(variables)._at_put_("#self",self);
  26552. $ctx1.sendIdx["at:put:"]=1;
  26553. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26554. return $core.withContext(function($ctx2) {
  26555. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26557. }));
  26558. $recv(anInspector)._setLabel_($self._printString());
  26559. $recv(anInspector)._setVariables_(variables);
  26560. return self;
  26561. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26562. },
  26563. args: ["anInspector"],
  26564. 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",
  26565. referencedClasses: ["Dictionary"],
  26566. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26567. }),
  26568. $globals.Object);
  26569. $core.addMethod(
  26570. $core.method({
  26571. selector: "do:displayingProgress:",
  26572. protocol: "*Platform-Services",
  26573. fn: function (aBlock,aString){
  26574. var self=this,$self=this;
  26575. return $core.withContext(function($ctx1) {
  26576. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26577. return self;
  26578. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26579. },
  26580. args: ["aBlock", "aString"],
  26581. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26582. referencedClasses: ["ProgressHandler"],
  26583. messageSends: ["do:on:displaying:"]
  26584. }),
  26585. $globals.SequenceableCollection);
  26586. $core.addMethod(
  26587. $core.method({
  26588. selector: "inspectOn:",
  26589. protocol: "*Platform-Services",
  26590. fn: function (anInspector){
  26591. var self=this,$self=this;
  26592. var variables,i;
  26593. return $core.withContext(function($ctx1) {
  26594. variables=$recv($globals.Dictionary)._new();
  26595. $recv(variables)._at_put_("#self",self);
  26596. $ctx1.sendIdx["at:put:"]=1;
  26597. i=(1);
  26598. $self._do_((function(each){
  26599. return $core.withContext(function($ctx2) {
  26600. $recv(variables)._at_put_(i,each);
  26601. i=$recv(i).__plus((1));
  26602. return i;
  26603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26604. }));
  26605. $recv(anInspector)._setLabel_($self._printString());
  26606. $recv(anInspector)._setVariables_(variables);
  26607. return self;
  26608. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26609. },
  26610. args: ["anInspector"],
  26611. 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",
  26612. referencedClasses: ["Dictionary"],
  26613. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26614. }),
  26615. $globals.Set);
  26616. $core.addMethod(
  26617. $core.method({
  26618. selector: "inspectOn:",
  26619. protocol: "*Platform-Services",
  26620. fn: function (anInspector){
  26621. var self=this,$self=this;
  26622. var label;
  26623. return $core.withContext(function($ctx1) {
  26624. var $3,$2,$1,$5,$4;
  26625. (
  26626. $ctx1.supercall = true,
  26627. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26628. $ctx1.supercall = false;
  26629. $3=$self._printString();
  26630. $ctx1.sendIdx["printString"]=1;
  26631. $2=$recv($3)._size();
  26632. $1=$recv($2).__gt((30));
  26633. if($core.assert($1)){
  26634. $5=$self._printString();
  26635. $ctx1.sendIdx["printString"]=2;
  26636. $4=$recv($5)._copyFrom_to_((1),(30));
  26637. label=$recv($4).__comma("...'");
  26638. label;
  26639. } else {
  26640. label=$self._printString();
  26641. label;
  26642. }
  26643. $recv(anInspector)._setLabel_(label);
  26644. return self;
  26645. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26646. },
  26647. args: ["anInspector"],
  26648. 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",
  26649. referencedClasses: [],
  26650. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26651. }),
  26652. $globals.String);
  26653. });
  26654. define('amber/deploy',[
  26655. './helpers',
  26656. './boot', // pre-fetch, dep of ./helpers
  26657. // --- packages of the core Amber begin here ---
  26658. 'amber_core/Kernel-Helpers',
  26659. 'amber_core/Kernel-Objects',
  26660. 'amber_core/Kernel-Classes',
  26661. 'amber_core/Kernel-Methods',
  26662. 'amber_core/Kernel-Collections',
  26663. 'amber_core/Kernel-Dag',
  26664. 'amber_core/Kernel-Infrastructure',
  26665. 'amber_core/Kernel-Promises',
  26666. 'amber_core/Kernel-Exceptions',
  26667. 'amber_core/Kernel-Announcements',
  26668. 'amber_core/Platform-Services',
  26669. // --- packages of the core Amber end here ---
  26670. ], function (amber) {
  26671. return amber;
  26672. });
  26673. // jshint ignore:start
  26674. define('amber/parser',['./boot'], function($boot) {
  26675. var $globals = $boot.globals;
  26676. $globals.SmalltalkParser = (function() {
  26677. "use strict";
  26678. /*
  26679. * Generated by PEG.js 0.9.0.
  26680. *
  26681. * http://pegjs.org/
  26682. */
  26683. function peg$subclass(child, parent) {
  26684. function ctor() { this.constructor = child; }
  26685. ctor.prototype = parent.prototype;
  26686. child.prototype = new ctor();
  26687. }
  26688. function peg$SyntaxError(message, expected, found, location) {
  26689. this.message = message;
  26690. this.expected = expected;
  26691. this.found = found;
  26692. this.location = location;
  26693. this.name = "SyntaxError";
  26694. if (typeof Error.captureStackTrace === "function") {
  26695. Error.captureStackTrace(this, peg$SyntaxError);
  26696. }
  26697. }
  26698. peg$subclass(peg$SyntaxError, Error);
  26699. function peg$parse(input) {
  26700. var options = arguments.length > 1 ? arguments[1] : {},
  26701. parser = this,
  26702. peg$FAILED = {},
  26703. peg$startRuleFunctions = { start: peg$parsestart },
  26704. peg$startRuleFunction = peg$parsestart,
  26705. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26706. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]" },
  26707. peg$c2 = "\"",
  26708. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26709. peg$c4 = /^[^"]/,
  26710. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26711. peg$c6 = ".",
  26712. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26713. peg$c8 = /^[a-zA-Z]/,
  26714. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26715. peg$c10 = /^[a-zA-Z0-9]/,
  26716. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26717. peg$c12 = ":",
  26718. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26719. peg$c14 = /^[A-Z]/,
  26720. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26721. peg$c16 = function(val) {
  26722. return $globals.ValueNode._new()
  26723. ._location_(location())
  26724. ._source_(text())
  26725. ._value_(val);
  26726. },
  26727. peg$c17 = "'",
  26728. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26729. peg$c19 = "''",
  26730. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26731. peg$c21 = function() {return '\'';},
  26732. peg$c22 = /^[^']/,
  26733. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26734. peg$c24 = function(val) {return val.join('');},
  26735. peg$c25 = "$",
  26736. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26737. peg$c27 = { type: "any", description: "any character" },
  26738. peg$c28 = function(char) {
  26739. return $globals.ValueNode._new()
  26740. ._location_(location())
  26741. ._source_(text())
  26742. ._value_(char);
  26743. },
  26744. peg$c29 = "#",
  26745. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26746. peg$c31 = function(rest) {return rest;},
  26747. peg$c32 = "e",
  26748. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26749. peg$c34 = function(n) {return parseFloat(n);},
  26750. peg$c35 = "-",
  26751. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26752. peg$c37 = "16r",
  26753. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26754. peg$c39 = /^[0-9a-fA-F]/,
  26755. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26756. peg$c41 = function(neg, num) {
  26757. return parseInt(((neg || '') + num), 16);
  26758. },
  26759. peg$c42 = /^[0-9]/,
  26760. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26761. peg$c44 = function(n) {return parseFloat(n, 10);},
  26762. peg$c45 = function(n) {return parseInt(n, 10);},
  26763. peg$c46 = "#(",
  26764. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26765. peg$c48 = ")",
  26766. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26767. peg$c50 = function(rest) {
  26768. return rest
  26769. ._location_(location())
  26770. ._source_(text());
  26771. },
  26772. peg$c51 = "(",
  26773. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26774. peg$c53 = function(lit) {return lit._value();},
  26775. peg$c54 = function(lits) {
  26776. return $globals.ValueNode._new()
  26777. ._value_(lits);
  26778. },
  26779. peg$c55 = "{",
  26780. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26781. peg$c57 = "}",
  26782. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26783. peg$c59 = function(expressions) {
  26784. return $globals.DynamicArrayNode._new()
  26785. ._location_(location())
  26786. ._source_(text())
  26787. ._dagChildren_(expressions || []);
  26788. },
  26789. peg$c60 = "#{",
  26790. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26791. peg$c62 = function(expressions) {
  26792. return $globals.DynamicDictionaryNode._new()
  26793. ._location_(location())
  26794. ._source_(text())
  26795. ._dagChildren_(expressions || []);
  26796. },
  26797. peg$c63 = "true",
  26798. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26799. peg$c65 = function() {return true;},
  26800. peg$c66 = "false",
  26801. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26802. peg$c68 = function() {return false;},
  26803. peg$c69 = "nil",
  26804. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26805. peg$c71 = function() {return null;},
  26806. peg$c72 = function(identifier) {
  26807. return $globals.VariableNode._new()
  26808. ._location_(location())
  26809. ._source_(text())
  26810. ._value_(identifier);
  26811. },
  26812. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26813. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26814. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26815. peg$c76 = function(pairs) {
  26816. var selector = '';
  26817. var params = [];
  26818. for(var i = 0; i < pairs.length; i++) {
  26819. selector += pairs[i].key;
  26820. params.push(pairs[i].arg);
  26821. }
  26822. return [selector, params];
  26823. },
  26824. peg$c77 = function(selector, arg) {
  26825. return [selector, [arg]];
  26826. },
  26827. peg$c78 = function(selector) {return [selector, []];},
  26828. peg$c79 = function(expression) {
  26829. return expression;
  26830. },
  26831. peg$c80 = function(first, others) {
  26832. return [first].concat(others);
  26833. },
  26834. peg$c81 = function(selector) {
  26835. return $globals.Message._selector_arguments_(selector, []);
  26836. },
  26837. peg$c82 = function(pairs) {
  26838. var selector = '';
  26839. var args = [];
  26840. for(var i = 0; i < pairs.length; i++) {
  26841. selector += pairs[i].key;
  26842. args.push(pairs[i].arg._value());
  26843. }
  26844. return $globals.Message._selector_arguments_(selector, args)
  26845. },
  26846. peg$c83 = "<",
  26847. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26848. peg$c85 = ">",
  26849. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26850. peg$c87 = function(message) {return message;},
  26851. peg$c88 = ":=",
  26852. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26853. peg$c90 = function(variable, expression) {
  26854. return $globals.AssignmentNode._new()
  26855. ._location_(location())
  26856. ._source_(text())
  26857. ._left_(variable)
  26858. ._right_(expression);
  26859. },
  26860. peg$c91 = "^",
  26861. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26862. peg$c93 = function(expression) {
  26863. return $globals.ReturnNode._new()
  26864. ._location_(location())
  26865. ._source_(text())
  26866. ._dagChildren_([expression]);
  26867. },
  26868. peg$c94 = "|",
  26869. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26870. peg$c96 = function(variable) {return variable;},
  26871. peg$c97 = function(vars) {
  26872. return vars;
  26873. },
  26874. peg$c98 = function(param) {return param;},
  26875. peg$c99 = function(params) {
  26876. return params;
  26877. },
  26878. peg$c100 = function(ret) {return [ret];},
  26879. peg$c101 = function(exps, ret) {
  26880. var expressions = exps;
  26881. expressions.push(ret);
  26882. return expressions;
  26883. },
  26884. peg$c102 = function(expressions) {return expressions || [];},
  26885. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26886. return $globals.SequenceNode._new()
  26887. ._location_(location())
  26888. ._source_(text())
  26889. ._temps_(temps || [])
  26890. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26891. ._dagChildren_(statements || []);
  26892. },
  26893. peg$c104 = "[",
  26894. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26895. peg$c106 = "]",
  26896. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26897. peg$c108 = function(params, sequence) {
  26898. return $globals.BlockNode._new()
  26899. ._location_(location())
  26900. ._source_(text())
  26901. ._parameters_(params || [])
  26902. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26903. },
  26904. peg$c109 = function(selector) {
  26905. return $globals.SendNode._new()
  26906. ._location_(location())
  26907. ._source_(text())
  26908. ._selector_(selector);
  26909. },
  26910. peg$c110 = function(receiver, tail) {
  26911. return receiver._withTail_(tail);
  26912. },
  26913. peg$c111 = function(selector, arg) {
  26914. return $globals.SendNode._new()
  26915. ._location_(location())
  26916. ._source_(text())
  26917. ._selector_(selector)
  26918. ._arguments_([arg]);
  26919. },
  26920. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  26921. peg$c113 = function(pairs) {
  26922. var selector = '';
  26923. var args = [];
  26924. for(var i = 0; i < pairs.length; i++) {
  26925. selector += pairs[i].key;
  26926. args.push(pairs[i].arg);
  26927. }
  26928. return $globals.SendNode._new()
  26929. ._location_(location())
  26930. ._source_(text())
  26931. ._selector_(selector)
  26932. ._arguments_(args);
  26933. },
  26934. peg$c114 = function(binarys, final) {
  26935. if (final) binarys.push(final);
  26936. return binarys;
  26937. },
  26938. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  26939. peg$c116 = ";",
  26940. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  26941. peg$c118 = function(receiver, tail, mess) {return mess;},
  26942. peg$c119 = function(receiver, tail, messages) {
  26943. messages.unshift(receiver._withTail_(tail));
  26944. return $globals.CascadeNode._new()
  26945. ._location_(location())
  26946. ._source_(text())
  26947. ._dagChildren_(messages);
  26948. },
  26949. peg$c120 = function(pattern, sequence) {
  26950. return $globals.MethodNode._new()
  26951. ._location_(location())
  26952. ._source_(text())
  26953. ._selector_(pattern[0])
  26954. ._arguments_(pattern[1])
  26955. ._dagChildren_([sequence]);
  26956. },
  26957. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  26958. peg$c122 = function(receiver, tail) {
  26959. var last = tail.pop();
  26960. return [receiver._withTail_(tail), last._arguments()[0]];
  26961. },
  26962. peg$c123 = function(first, others) {
  26963. return first.concat.apply(first, others);
  26964. },
  26965. peg$currPos = 0,
  26966. peg$savedPos = 0,
  26967. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  26968. peg$maxFailPos = 0,
  26969. peg$maxFailExpected = [],
  26970. peg$silentFails = 0,
  26971. peg$resultsCache = {},
  26972. peg$result;
  26973. if ("startRule" in options) {
  26974. if (!(options.startRule in peg$startRuleFunctions)) {
  26975. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  26976. }
  26977. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  26978. }
  26979. function text() {
  26980. return input.substring(peg$savedPos, peg$currPos);
  26981. }
  26982. function location() {
  26983. return peg$computeLocation(peg$savedPos, peg$currPos);
  26984. }
  26985. function expected(description) {
  26986. throw peg$buildException(
  26987. null,
  26988. [{ type: "other", description: description }],
  26989. input.substring(peg$savedPos, peg$currPos),
  26990. peg$computeLocation(peg$savedPos, peg$currPos)
  26991. );
  26992. }
  26993. function error(message) {
  26994. throw peg$buildException(
  26995. message,
  26996. null,
  26997. input.substring(peg$savedPos, peg$currPos),
  26998. peg$computeLocation(peg$savedPos, peg$currPos)
  26999. );
  27000. }
  27001. function peg$computePosDetails(pos) {
  27002. var details = peg$posDetailsCache[pos],
  27003. p, ch;
  27004. if (details) {
  27005. return details;
  27006. } else {
  27007. p = pos - 1;
  27008. while (!peg$posDetailsCache[p]) {
  27009. p--;
  27010. }
  27011. details = peg$posDetailsCache[p];
  27012. details = {
  27013. line: details.line,
  27014. column: details.column,
  27015. seenCR: details.seenCR
  27016. };
  27017. while (p < pos) {
  27018. ch = input.charAt(p);
  27019. if (ch === "\n") {
  27020. if (!details.seenCR) { details.line++; }
  27021. details.column = 1;
  27022. details.seenCR = false;
  27023. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27024. details.line++;
  27025. details.column = 1;
  27026. details.seenCR = true;
  27027. } else {
  27028. details.column++;
  27029. details.seenCR = false;
  27030. }
  27031. p++;
  27032. }
  27033. peg$posDetailsCache[pos] = details;
  27034. return details;
  27035. }
  27036. }
  27037. function peg$computeLocation(startPos, endPos) {
  27038. var startPosDetails = peg$computePosDetails(startPos),
  27039. endPosDetails = peg$computePosDetails(endPos);
  27040. return {
  27041. start: {
  27042. offset: startPos,
  27043. line: startPosDetails.line,
  27044. column: startPosDetails.column
  27045. },
  27046. end: {
  27047. offset: endPos,
  27048. line: endPosDetails.line,
  27049. column: endPosDetails.column
  27050. }
  27051. };
  27052. }
  27053. function peg$fail(expected) {
  27054. if (peg$currPos < peg$maxFailPos) { return; }
  27055. if (peg$currPos > peg$maxFailPos) {
  27056. peg$maxFailPos = peg$currPos;
  27057. peg$maxFailExpected = [];
  27058. }
  27059. peg$maxFailExpected.push(expected);
  27060. }
  27061. function peg$buildException(message, expected, found, location) {
  27062. function cleanupExpected(expected) {
  27063. var i = 1;
  27064. expected.sort(function(a, b) {
  27065. if (a.description < b.description) {
  27066. return -1;
  27067. } else if (a.description > b.description) {
  27068. return 1;
  27069. } else {
  27070. return 0;
  27071. }
  27072. });
  27073. while (i < expected.length) {
  27074. if (expected[i - 1] === expected[i]) {
  27075. expected.splice(i, 1);
  27076. } else {
  27077. i++;
  27078. }
  27079. }
  27080. }
  27081. function buildMessage(expected, found) {
  27082. function stringEscape(s) {
  27083. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27084. return s
  27085. .replace(/\\/g, '\\\\')
  27086. .replace(/"/g, '\\"')
  27087. .replace(/\x08/g, '\\b')
  27088. .replace(/\t/g, '\\t')
  27089. .replace(/\n/g, '\\n')
  27090. .replace(/\f/g, '\\f')
  27091. .replace(/\r/g, '\\r')
  27092. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27093. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27094. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27095. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27096. }
  27097. var expectedDescs = new Array(expected.length),
  27098. expectedDesc, foundDesc, i;
  27099. for (i = 0; i < expected.length; i++) {
  27100. expectedDescs[i] = expected[i].description;
  27101. }
  27102. expectedDesc = expected.length > 1
  27103. ? expectedDescs.slice(0, -1).join(", ")
  27104. + " or "
  27105. + expectedDescs[expected.length - 1]
  27106. : expectedDescs[0];
  27107. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27108. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27109. }
  27110. if (expected !== null) {
  27111. cleanupExpected(expected);
  27112. }
  27113. return new peg$SyntaxError(
  27114. message !== null ? message : buildMessage(expected, found),
  27115. expected,
  27116. found,
  27117. location
  27118. );
  27119. }
  27120. function peg$parsestart() {
  27121. var s0;
  27122. var key = peg$currPos * 66 + 0,
  27123. cached = peg$resultsCache[key];
  27124. if (cached) {
  27125. peg$currPos = cached.nextPos;
  27126. return cached.result;
  27127. }
  27128. s0 = peg$parsemethod();
  27129. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27130. return s0;
  27131. }
  27132. function peg$parseseparator() {
  27133. var s0, s1;
  27134. var key = peg$currPos * 66 + 1,
  27135. cached = peg$resultsCache[key];
  27136. if (cached) {
  27137. peg$currPos = cached.nextPos;
  27138. return cached.result;
  27139. }
  27140. s0 = [];
  27141. if (peg$c0.test(input.charAt(peg$currPos))) {
  27142. s1 = input.charAt(peg$currPos);
  27143. peg$currPos++;
  27144. } else {
  27145. s1 = peg$FAILED;
  27146. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27147. }
  27148. if (s1 !== peg$FAILED) {
  27149. while (s1 !== peg$FAILED) {
  27150. s0.push(s1);
  27151. if (peg$c0.test(input.charAt(peg$currPos))) {
  27152. s1 = input.charAt(peg$currPos);
  27153. peg$currPos++;
  27154. } else {
  27155. s1 = peg$FAILED;
  27156. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27157. }
  27158. }
  27159. } else {
  27160. s0 = peg$FAILED;
  27161. }
  27162. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27163. return s0;
  27164. }
  27165. function peg$parsecomments() {
  27166. var s0, s1, s2, s3, s4;
  27167. var key = peg$currPos * 66 + 2,
  27168. cached = peg$resultsCache[key];
  27169. if (cached) {
  27170. peg$currPos = cached.nextPos;
  27171. return cached.result;
  27172. }
  27173. s0 = [];
  27174. s1 = peg$currPos;
  27175. if (input.charCodeAt(peg$currPos) === 34) {
  27176. s2 = peg$c2;
  27177. peg$currPos++;
  27178. } else {
  27179. s2 = peg$FAILED;
  27180. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27181. }
  27182. if (s2 !== peg$FAILED) {
  27183. s3 = [];
  27184. if (peg$c4.test(input.charAt(peg$currPos))) {
  27185. s4 = input.charAt(peg$currPos);
  27186. peg$currPos++;
  27187. } else {
  27188. s4 = peg$FAILED;
  27189. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27190. }
  27191. while (s4 !== peg$FAILED) {
  27192. s3.push(s4);
  27193. if (peg$c4.test(input.charAt(peg$currPos))) {
  27194. s4 = input.charAt(peg$currPos);
  27195. peg$currPos++;
  27196. } else {
  27197. s4 = peg$FAILED;
  27198. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27199. }
  27200. }
  27201. if (s3 !== peg$FAILED) {
  27202. if (input.charCodeAt(peg$currPos) === 34) {
  27203. s4 = peg$c2;
  27204. peg$currPos++;
  27205. } else {
  27206. s4 = peg$FAILED;
  27207. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27208. }
  27209. if (s4 !== peg$FAILED) {
  27210. s2 = [s2, s3, s4];
  27211. s1 = s2;
  27212. } else {
  27213. peg$currPos = s1;
  27214. s1 = peg$FAILED;
  27215. }
  27216. } else {
  27217. peg$currPos = s1;
  27218. s1 = peg$FAILED;
  27219. }
  27220. } else {
  27221. peg$currPos = s1;
  27222. s1 = peg$FAILED;
  27223. }
  27224. if (s1 !== peg$FAILED) {
  27225. while (s1 !== peg$FAILED) {
  27226. s0.push(s1);
  27227. s1 = peg$currPos;
  27228. if (input.charCodeAt(peg$currPos) === 34) {
  27229. s2 = peg$c2;
  27230. peg$currPos++;
  27231. } else {
  27232. s2 = peg$FAILED;
  27233. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27234. }
  27235. if (s2 !== peg$FAILED) {
  27236. s3 = [];
  27237. if (peg$c4.test(input.charAt(peg$currPos))) {
  27238. s4 = input.charAt(peg$currPos);
  27239. peg$currPos++;
  27240. } else {
  27241. s4 = peg$FAILED;
  27242. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27243. }
  27244. while (s4 !== peg$FAILED) {
  27245. s3.push(s4);
  27246. if (peg$c4.test(input.charAt(peg$currPos))) {
  27247. s4 = input.charAt(peg$currPos);
  27248. peg$currPos++;
  27249. } else {
  27250. s4 = peg$FAILED;
  27251. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27252. }
  27253. }
  27254. if (s3 !== peg$FAILED) {
  27255. if (input.charCodeAt(peg$currPos) === 34) {
  27256. s4 = peg$c2;
  27257. peg$currPos++;
  27258. } else {
  27259. s4 = peg$FAILED;
  27260. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27261. }
  27262. if (s4 !== peg$FAILED) {
  27263. s2 = [s2, s3, s4];
  27264. s1 = s2;
  27265. } else {
  27266. peg$currPos = s1;
  27267. s1 = peg$FAILED;
  27268. }
  27269. } else {
  27270. peg$currPos = s1;
  27271. s1 = peg$FAILED;
  27272. }
  27273. } else {
  27274. peg$currPos = s1;
  27275. s1 = peg$FAILED;
  27276. }
  27277. }
  27278. } else {
  27279. s0 = peg$FAILED;
  27280. }
  27281. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27282. return s0;
  27283. }
  27284. function peg$parsews() {
  27285. var s0, s1;
  27286. var key = peg$currPos * 66 + 3,
  27287. cached = peg$resultsCache[key];
  27288. if (cached) {
  27289. peg$currPos = cached.nextPos;
  27290. return cached.result;
  27291. }
  27292. s0 = [];
  27293. s1 = peg$parseseparator();
  27294. if (s1 === peg$FAILED) {
  27295. s1 = peg$parsecomments();
  27296. }
  27297. while (s1 !== peg$FAILED) {
  27298. s0.push(s1);
  27299. s1 = peg$parseseparator();
  27300. if (s1 === peg$FAILED) {
  27301. s1 = peg$parsecomments();
  27302. }
  27303. }
  27304. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27305. return s0;
  27306. }
  27307. function peg$parsemaybeDotsWs() {
  27308. var s0, s1;
  27309. var key = peg$currPos * 66 + 4,
  27310. cached = peg$resultsCache[key];
  27311. if (cached) {
  27312. peg$currPos = cached.nextPos;
  27313. return cached.result;
  27314. }
  27315. s0 = [];
  27316. if (input.charCodeAt(peg$currPos) === 46) {
  27317. s1 = peg$c6;
  27318. peg$currPos++;
  27319. } else {
  27320. s1 = peg$FAILED;
  27321. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27322. }
  27323. if (s1 === peg$FAILED) {
  27324. s1 = peg$parseseparator();
  27325. if (s1 === peg$FAILED) {
  27326. s1 = peg$parsecomments();
  27327. }
  27328. }
  27329. while (s1 !== peg$FAILED) {
  27330. s0.push(s1);
  27331. if (input.charCodeAt(peg$currPos) === 46) {
  27332. s1 = peg$c6;
  27333. peg$currPos++;
  27334. } else {
  27335. s1 = peg$FAILED;
  27336. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27337. }
  27338. if (s1 === peg$FAILED) {
  27339. s1 = peg$parseseparator();
  27340. if (s1 === peg$FAILED) {
  27341. s1 = peg$parsecomments();
  27342. }
  27343. }
  27344. }
  27345. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27346. return s0;
  27347. }
  27348. function peg$parsesomeDotsWs() {
  27349. var s0, s1, s2, s3;
  27350. var key = peg$currPos * 66 + 5,
  27351. cached = peg$resultsCache[key];
  27352. if (cached) {
  27353. peg$currPos = cached.nextPos;
  27354. return cached.result;
  27355. }
  27356. s0 = peg$currPos;
  27357. s1 = peg$parsews();
  27358. if (s1 !== peg$FAILED) {
  27359. if (input.charCodeAt(peg$currPos) === 46) {
  27360. s2 = peg$c6;
  27361. peg$currPos++;
  27362. } else {
  27363. s2 = peg$FAILED;
  27364. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27365. }
  27366. if (s2 !== peg$FAILED) {
  27367. s3 = peg$parsemaybeDotsWs();
  27368. if (s3 !== peg$FAILED) {
  27369. s1 = [s1, s2, s3];
  27370. s0 = s1;
  27371. } else {
  27372. peg$currPos = s0;
  27373. s0 = peg$FAILED;
  27374. }
  27375. } else {
  27376. peg$currPos = s0;
  27377. s0 = peg$FAILED;
  27378. }
  27379. } else {
  27380. peg$currPos = s0;
  27381. s0 = peg$FAILED;
  27382. }
  27383. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27384. return s0;
  27385. }
  27386. function peg$parseidentifier() {
  27387. var s0, s1, s2, s3, s4;
  27388. var key = peg$currPos * 66 + 6,
  27389. cached = peg$resultsCache[key];
  27390. if (cached) {
  27391. peg$currPos = cached.nextPos;
  27392. return cached.result;
  27393. }
  27394. s0 = peg$currPos;
  27395. s1 = peg$currPos;
  27396. if (peg$c8.test(input.charAt(peg$currPos))) {
  27397. s2 = input.charAt(peg$currPos);
  27398. peg$currPos++;
  27399. } else {
  27400. s2 = peg$FAILED;
  27401. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27402. }
  27403. if (s2 !== peg$FAILED) {
  27404. s3 = [];
  27405. if (peg$c10.test(input.charAt(peg$currPos))) {
  27406. s4 = input.charAt(peg$currPos);
  27407. peg$currPos++;
  27408. } else {
  27409. s4 = peg$FAILED;
  27410. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27411. }
  27412. while (s4 !== peg$FAILED) {
  27413. s3.push(s4);
  27414. if (peg$c10.test(input.charAt(peg$currPos))) {
  27415. s4 = input.charAt(peg$currPos);
  27416. peg$currPos++;
  27417. } else {
  27418. s4 = peg$FAILED;
  27419. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27420. }
  27421. }
  27422. if (s3 !== peg$FAILED) {
  27423. s2 = [s2, s3];
  27424. s1 = s2;
  27425. } else {
  27426. peg$currPos = s1;
  27427. s1 = peg$FAILED;
  27428. }
  27429. } else {
  27430. peg$currPos = s1;
  27431. s1 = peg$FAILED;
  27432. }
  27433. if (s1 !== peg$FAILED) {
  27434. s0 = input.substring(s0, peg$currPos);
  27435. } else {
  27436. s0 = s1;
  27437. }
  27438. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27439. return s0;
  27440. }
  27441. function peg$parsekeyword() {
  27442. var s0, s1, s2, s3;
  27443. var key = peg$currPos * 66 + 7,
  27444. cached = peg$resultsCache[key];
  27445. if (cached) {
  27446. peg$currPos = cached.nextPos;
  27447. return cached.result;
  27448. }
  27449. s0 = peg$currPos;
  27450. s1 = peg$currPos;
  27451. s2 = peg$parseidentifier();
  27452. if (s2 !== peg$FAILED) {
  27453. if (input.charCodeAt(peg$currPos) === 58) {
  27454. s3 = peg$c12;
  27455. peg$currPos++;
  27456. } else {
  27457. s3 = peg$FAILED;
  27458. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27459. }
  27460. if (s3 !== peg$FAILED) {
  27461. s2 = [s2, s3];
  27462. s1 = s2;
  27463. } else {
  27464. peg$currPos = s1;
  27465. s1 = peg$FAILED;
  27466. }
  27467. } else {
  27468. peg$currPos = s1;
  27469. s1 = peg$FAILED;
  27470. }
  27471. if (s1 !== peg$FAILED) {
  27472. s0 = input.substring(s0, peg$currPos);
  27473. } else {
  27474. s0 = s1;
  27475. }
  27476. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27477. return s0;
  27478. }
  27479. function peg$parseclassName() {
  27480. var s0, s1, s2, s3, s4;
  27481. var key = peg$currPos * 66 + 8,
  27482. cached = peg$resultsCache[key];
  27483. if (cached) {
  27484. peg$currPos = cached.nextPos;
  27485. return cached.result;
  27486. }
  27487. s0 = peg$currPos;
  27488. s1 = peg$currPos;
  27489. if (peg$c14.test(input.charAt(peg$currPos))) {
  27490. s2 = input.charAt(peg$currPos);
  27491. peg$currPos++;
  27492. } else {
  27493. s2 = peg$FAILED;
  27494. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27495. }
  27496. if (s2 !== peg$FAILED) {
  27497. s3 = [];
  27498. if (peg$c10.test(input.charAt(peg$currPos))) {
  27499. s4 = input.charAt(peg$currPos);
  27500. peg$currPos++;
  27501. } else {
  27502. s4 = peg$FAILED;
  27503. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27504. }
  27505. while (s4 !== peg$FAILED) {
  27506. s3.push(s4);
  27507. if (peg$c10.test(input.charAt(peg$currPos))) {
  27508. s4 = input.charAt(peg$currPos);
  27509. peg$currPos++;
  27510. } else {
  27511. s4 = peg$FAILED;
  27512. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27513. }
  27514. }
  27515. if (s3 !== peg$FAILED) {
  27516. s2 = [s2, s3];
  27517. s1 = s2;
  27518. } else {
  27519. peg$currPos = s1;
  27520. s1 = peg$FAILED;
  27521. }
  27522. } else {
  27523. peg$currPos = s1;
  27524. s1 = peg$FAILED;
  27525. }
  27526. if (s1 !== peg$FAILED) {
  27527. s0 = input.substring(s0, peg$currPos);
  27528. } else {
  27529. s0 = s1;
  27530. }
  27531. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27532. return s0;
  27533. }
  27534. function peg$parsestring() {
  27535. var s0, s1;
  27536. var key = peg$currPos * 66 + 9,
  27537. cached = peg$resultsCache[key];
  27538. if (cached) {
  27539. peg$currPos = cached.nextPos;
  27540. return cached.result;
  27541. }
  27542. s0 = peg$currPos;
  27543. s1 = peg$parserawString();
  27544. if (s1 !== peg$FAILED) {
  27545. peg$savedPos = s0;
  27546. s1 = peg$c16(s1);
  27547. }
  27548. s0 = s1;
  27549. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27550. return s0;
  27551. }
  27552. function peg$parserawString() {
  27553. var s0, s1, s2, s3, s4;
  27554. var key = peg$currPos * 66 + 10,
  27555. cached = peg$resultsCache[key];
  27556. if (cached) {
  27557. peg$currPos = cached.nextPos;
  27558. return cached.result;
  27559. }
  27560. s0 = peg$currPos;
  27561. if (input.charCodeAt(peg$currPos) === 39) {
  27562. s1 = peg$c17;
  27563. peg$currPos++;
  27564. } else {
  27565. s1 = peg$FAILED;
  27566. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27567. }
  27568. if (s1 !== peg$FAILED) {
  27569. s2 = [];
  27570. s3 = peg$currPos;
  27571. if (input.substr(peg$currPos, 2) === peg$c19) {
  27572. s4 = peg$c19;
  27573. peg$currPos += 2;
  27574. } else {
  27575. s4 = peg$FAILED;
  27576. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27577. }
  27578. if (s4 !== peg$FAILED) {
  27579. peg$savedPos = s3;
  27580. s4 = peg$c21();
  27581. }
  27582. s3 = s4;
  27583. if (s3 === peg$FAILED) {
  27584. if (peg$c22.test(input.charAt(peg$currPos))) {
  27585. s3 = input.charAt(peg$currPos);
  27586. peg$currPos++;
  27587. } else {
  27588. s3 = peg$FAILED;
  27589. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27590. }
  27591. }
  27592. while (s3 !== peg$FAILED) {
  27593. s2.push(s3);
  27594. s3 = peg$currPos;
  27595. if (input.substr(peg$currPos, 2) === peg$c19) {
  27596. s4 = peg$c19;
  27597. peg$currPos += 2;
  27598. } else {
  27599. s4 = peg$FAILED;
  27600. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27601. }
  27602. if (s4 !== peg$FAILED) {
  27603. peg$savedPos = s3;
  27604. s4 = peg$c21();
  27605. }
  27606. s3 = s4;
  27607. if (s3 === peg$FAILED) {
  27608. if (peg$c22.test(input.charAt(peg$currPos))) {
  27609. s3 = input.charAt(peg$currPos);
  27610. peg$currPos++;
  27611. } else {
  27612. s3 = peg$FAILED;
  27613. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27614. }
  27615. }
  27616. }
  27617. if (s2 !== peg$FAILED) {
  27618. if (input.charCodeAt(peg$currPos) === 39) {
  27619. s3 = peg$c17;
  27620. peg$currPos++;
  27621. } else {
  27622. s3 = peg$FAILED;
  27623. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27624. }
  27625. if (s3 !== peg$FAILED) {
  27626. peg$savedPos = s0;
  27627. s1 = peg$c24(s2);
  27628. s0 = s1;
  27629. } else {
  27630. peg$currPos = s0;
  27631. s0 = peg$FAILED;
  27632. }
  27633. } else {
  27634. peg$currPos = s0;
  27635. s0 = peg$FAILED;
  27636. }
  27637. } else {
  27638. peg$currPos = s0;
  27639. s0 = peg$FAILED;
  27640. }
  27641. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27642. return s0;
  27643. }
  27644. function peg$parsecharacter() {
  27645. var s0, s1, s2;
  27646. var key = peg$currPos * 66 + 11,
  27647. cached = peg$resultsCache[key];
  27648. if (cached) {
  27649. peg$currPos = cached.nextPos;
  27650. return cached.result;
  27651. }
  27652. s0 = peg$currPos;
  27653. if (input.charCodeAt(peg$currPos) === 36) {
  27654. s1 = peg$c25;
  27655. peg$currPos++;
  27656. } else {
  27657. s1 = peg$FAILED;
  27658. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27659. }
  27660. if (s1 !== peg$FAILED) {
  27661. if (input.length > peg$currPos) {
  27662. s2 = input.charAt(peg$currPos);
  27663. peg$currPos++;
  27664. } else {
  27665. s2 = peg$FAILED;
  27666. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27667. }
  27668. if (s2 !== peg$FAILED) {
  27669. peg$savedPos = s0;
  27670. s1 = peg$c28(s2);
  27671. s0 = s1;
  27672. } else {
  27673. peg$currPos = s0;
  27674. s0 = peg$FAILED;
  27675. }
  27676. } else {
  27677. peg$currPos = s0;
  27678. s0 = peg$FAILED;
  27679. }
  27680. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27681. return s0;
  27682. }
  27683. function peg$parsesymbol() {
  27684. var s0, s1, s2;
  27685. var key = peg$currPos * 66 + 12,
  27686. cached = peg$resultsCache[key];
  27687. if (cached) {
  27688. peg$currPos = cached.nextPos;
  27689. return cached.result;
  27690. }
  27691. s0 = peg$currPos;
  27692. if (input.charCodeAt(peg$currPos) === 35) {
  27693. s1 = peg$c29;
  27694. peg$currPos++;
  27695. } else {
  27696. s1 = peg$FAILED;
  27697. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27698. }
  27699. if (s1 !== peg$FAILED) {
  27700. s2 = peg$parsebareSymbol();
  27701. if (s2 !== peg$FAILED) {
  27702. peg$savedPos = s0;
  27703. s1 = peg$c31(s2);
  27704. s0 = s1;
  27705. } else {
  27706. peg$currPos = s0;
  27707. s0 = peg$FAILED;
  27708. }
  27709. } else {
  27710. peg$currPos = s0;
  27711. s0 = peg$FAILED;
  27712. }
  27713. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27714. return s0;
  27715. }
  27716. function peg$parsebareSymbol() {
  27717. var s0, s1, s2, s3;
  27718. var key = peg$currPos * 66 + 13,
  27719. cached = peg$resultsCache[key];
  27720. if (cached) {
  27721. peg$currPos = cached.nextPos;
  27722. return cached.result;
  27723. }
  27724. s0 = peg$currPos;
  27725. s1 = peg$currPos;
  27726. s2 = [];
  27727. s3 = peg$parsekeyword();
  27728. if (s3 !== peg$FAILED) {
  27729. while (s3 !== peg$FAILED) {
  27730. s2.push(s3);
  27731. s3 = peg$parsekeyword();
  27732. }
  27733. } else {
  27734. s2 = peg$FAILED;
  27735. }
  27736. if (s2 !== peg$FAILED) {
  27737. s1 = input.substring(s1, peg$currPos);
  27738. } else {
  27739. s1 = s2;
  27740. }
  27741. if (s1 === peg$FAILED) {
  27742. s1 = peg$parsebinarySelector();
  27743. if (s1 === peg$FAILED) {
  27744. s1 = peg$parseidentifier();
  27745. if (s1 === peg$FAILED) {
  27746. s1 = peg$parserawString();
  27747. }
  27748. }
  27749. }
  27750. if (s1 !== peg$FAILED) {
  27751. peg$savedPos = s0;
  27752. s1 = peg$c16(s1);
  27753. }
  27754. s0 = s1;
  27755. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27756. return s0;
  27757. }
  27758. function peg$parsenumber() {
  27759. var s0, s1;
  27760. var key = peg$currPos * 66 + 14,
  27761. cached = peg$resultsCache[key];
  27762. if (cached) {
  27763. peg$currPos = cached.nextPos;
  27764. return cached.result;
  27765. }
  27766. s0 = peg$currPos;
  27767. s1 = peg$parserawNumber();
  27768. if (s1 !== peg$FAILED) {
  27769. peg$savedPos = s0;
  27770. s1 = peg$c16(s1);
  27771. }
  27772. s0 = s1;
  27773. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27774. return s0;
  27775. }
  27776. function peg$parserawNumber() {
  27777. var s0;
  27778. var key = peg$currPos * 66 + 15,
  27779. cached = peg$resultsCache[key];
  27780. if (cached) {
  27781. peg$currPos = cached.nextPos;
  27782. return cached.result;
  27783. }
  27784. s0 = peg$parsenumberExp();
  27785. if (s0 === peg$FAILED) {
  27786. s0 = peg$parsehex();
  27787. if (s0 === peg$FAILED) {
  27788. s0 = peg$parsefloat();
  27789. if (s0 === peg$FAILED) {
  27790. s0 = peg$parseinteger();
  27791. }
  27792. }
  27793. }
  27794. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27795. return s0;
  27796. }
  27797. function peg$parsenumberExp() {
  27798. var s0, s1, s2, s3, s4, s5;
  27799. var key = peg$currPos * 66 + 16,
  27800. cached = peg$resultsCache[key];
  27801. if (cached) {
  27802. peg$currPos = cached.nextPos;
  27803. return cached.result;
  27804. }
  27805. s0 = peg$currPos;
  27806. s1 = peg$currPos;
  27807. s2 = peg$currPos;
  27808. s3 = peg$parsefloat();
  27809. if (s3 === peg$FAILED) {
  27810. s3 = peg$parseinteger();
  27811. }
  27812. if (s3 !== peg$FAILED) {
  27813. if (input.charCodeAt(peg$currPos) === 101) {
  27814. s4 = peg$c32;
  27815. peg$currPos++;
  27816. } else {
  27817. s4 = peg$FAILED;
  27818. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27819. }
  27820. if (s4 !== peg$FAILED) {
  27821. s5 = peg$parseinteger();
  27822. if (s5 !== peg$FAILED) {
  27823. s3 = [s3, s4, s5];
  27824. s2 = s3;
  27825. } else {
  27826. peg$currPos = s2;
  27827. s2 = peg$FAILED;
  27828. }
  27829. } else {
  27830. peg$currPos = s2;
  27831. s2 = peg$FAILED;
  27832. }
  27833. } else {
  27834. peg$currPos = s2;
  27835. s2 = peg$FAILED;
  27836. }
  27837. if (s2 !== peg$FAILED) {
  27838. s1 = input.substring(s1, peg$currPos);
  27839. } else {
  27840. s1 = s2;
  27841. }
  27842. if (s1 !== peg$FAILED) {
  27843. peg$savedPos = s0;
  27844. s1 = peg$c34(s1);
  27845. }
  27846. s0 = s1;
  27847. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27848. return s0;
  27849. }
  27850. function peg$parsehex() {
  27851. var s0, s1, s2, s3, s4, s5;
  27852. var key = peg$currPos * 66 + 17,
  27853. cached = peg$resultsCache[key];
  27854. if (cached) {
  27855. peg$currPos = cached.nextPos;
  27856. return cached.result;
  27857. }
  27858. s0 = peg$currPos;
  27859. if (input.charCodeAt(peg$currPos) === 45) {
  27860. s1 = peg$c35;
  27861. peg$currPos++;
  27862. } else {
  27863. s1 = peg$FAILED;
  27864. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27865. }
  27866. if (s1 === peg$FAILED) {
  27867. s1 = null;
  27868. }
  27869. if (s1 !== peg$FAILED) {
  27870. if (input.substr(peg$currPos, 3) === peg$c37) {
  27871. s2 = peg$c37;
  27872. peg$currPos += 3;
  27873. } else {
  27874. s2 = peg$FAILED;
  27875. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27876. }
  27877. if (s2 !== peg$FAILED) {
  27878. s3 = peg$currPos;
  27879. s4 = [];
  27880. if (peg$c39.test(input.charAt(peg$currPos))) {
  27881. s5 = input.charAt(peg$currPos);
  27882. peg$currPos++;
  27883. } else {
  27884. s5 = peg$FAILED;
  27885. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27886. }
  27887. if (s5 !== peg$FAILED) {
  27888. while (s5 !== peg$FAILED) {
  27889. s4.push(s5);
  27890. if (peg$c39.test(input.charAt(peg$currPos))) {
  27891. s5 = input.charAt(peg$currPos);
  27892. peg$currPos++;
  27893. } else {
  27894. s5 = peg$FAILED;
  27895. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27896. }
  27897. }
  27898. } else {
  27899. s4 = peg$FAILED;
  27900. }
  27901. if (s4 !== peg$FAILED) {
  27902. s3 = input.substring(s3, peg$currPos);
  27903. } else {
  27904. s3 = s4;
  27905. }
  27906. if (s3 !== peg$FAILED) {
  27907. peg$savedPos = s0;
  27908. s1 = peg$c41(s1, s3);
  27909. s0 = s1;
  27910. } else {
  27911. peg$currPos = s0;
  27912. s0 = peg$FAILED;
  27913. }
  27914. } else {
  27915. peg$currPos = s0;
  27916. s0 = peg$FAILED;
  27917. }
  27918. } else {
  27919. peg$currPos = s0;
  27920. s0 = peg$FAILED;
  27921. }
  27922. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27923. return s0;
  27924. }
  27925. function peg$parsefloat() {
  27926. var s0, s1, s2, s3, s4, s5, s6, s7;
  27927. var key = peg$currPos * 66 + 18,
  27928. cached = peg$resultsCache[key];
  27929. if (cached) {
  27930. peg$currPos = cached.nextPos;
  27931. return cached.result;
  27932. }
  27933. s0 = peg$currPos;
  27934. s1 = peg$currPos;
  27935. s2 = peg$currPos;
  27936. if (input.charCodeAt(peg$currPos) === 45) {
  27937. s3 = peg$c35;
  27938. peg$currPos++;
  27939. } else {
  27940. s3 = peg$FAILED;
  27941. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27942. }
  27943. if (s3 === peg$FAILED) {
  27944. s3 = null;
  27945. }
  27946. if (s3 !== peg$FAILED) {
  27947. s4 = [];
  27948. if (peg$c42.test(input.charAt(peg$currPos))) {
  27949. s5 = input.charAt(peg$currPos);
  27950. peg$currPos++;
  27951. } else {
  27952. s5 = peg$FAILED;
  27953. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27954. }
  27955. if (s5 !== peg$FAILED) {
  27956. while (s5 !== peg$FAILED) {
  27957. s4.push(s5);
  27958. if (peg$c42.test(input.charAt(peg$currPos))) {
  27959. s5 = input.charAt(peg$currPos);
  27960. peg$currPos++;
  27961. } else {
  27962. s5 = peg$FAILED;
  27963. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27964. }
  27965. }
  27966. } else {
  27967. s4 = peg$FAILED;
  27968. }
  27969. if (s4 !== peg$FAILED) {
  27970. if (input.charCodeAt(peg$currPos) === 46) {
  27971. s5 = peg$c6;
  27972. peg$currPos++;
  27973. } else {
  27974. s5 = peg$FAILED;
  27975. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27976. }
  27977. if (s5 !== peg$FAILED) {
  27978. s6 = [];
  27979. if (peg$c42.test(input.charAt(peg$currPos))) {
  27980. s7 = input.charAt(peg$currPos);
  27981. peg$currPos++;
  27982. } else {
  27983. s7 = peg$FAILED;
  27984. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27985. }
  27986. if (s7 !== peg$FAILED) {
  27987. while (s7 !== peg$FAILED) {
  27988. s6.push(s7);
  27989. if (peg$c42.test(input.charAt(peg$currPos))) {
  27990. s7 = input.charAt(peg$currPos);
  27991. peg$currPos++;
  27992. } else {
  27993. s7 = peg$FAILED;
  27994. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27995. }
  27996. }
  27997. } else {
  27998. s6 = peg$FAILED;
  27999. }
  28000. if (s6 !== peg$FAILED) {
  28001. s3 = [s3, s4, s5, s6];
  28002. s2 = s3;
  28003. } else {
  28004. peg$currPos = s2;
  28005. s2 = peg$FAILED;
  28006. }
  28007. } else {
  28008. peg$currPos = s2;
  28009. s2 = peg$FAILED;
  28010. }
  28011. } else {
  28012. peg$currPos = s2;
  28013. s2 = peg$FAILED;
  28014. }
  28015. } else {
  28016. peg$currPos = s2;
  28017. s2 = peg$FAILED;
  28018. }
  28019. if (s2 !== peg$FAILED) {
  28020. s1 = input.substring(s1, peg$currPos);
  28021. } else {
  28022. s1 = s2;
  28023. }
  28024. if (s1 !== peg$FAILED) {
  28025. peg$savedPos = s0;
  28026. s1 = peg$c44(s1);
  28027. }
  28028. s0 = s1;
  28029. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28030. return s0;
  28031. }
  28032. function peg$parseinteger() {
  28033. var s0, s1, s2, s3, s4, s5;
  28034. var key = peg$currPos * 66 + 19,
  28035. cached = peg$resultsCache[key];
  28036. if (cached) {
  28037. peg$currPos = cached.nextPos;
  28038. return cached.result;
  28039. }
  28040. s0 = peg$currPos;
  28041. s1 = peg$currPos;
  28042. s2 = peg$currPos;
  28043. if (input.charCodeAt(peg$currPos) === 45) {
  28044. s3 = peg$c35;
  28045. peg$currPos++;
  28046. } else {
  28047. s3 = peg$FAILED;
  28048. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28049. }
  28050. if (s3 === peg$FAILED) {
  28051. s3 = null;
  28052. }
  28053. if (s3 !== peg$FAILED) {
  28054. s4 = [];
  28055. if (peg$c42.test(input.charAt(peg$currPos))) {
  28056. s5 = input.charAt(peg$currPos);
  28057. peg$currPos++;
  28058. } else {
  28059. s5 = peg$FAILED;
  28060. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28061. }
  28062. if (s5 !== peg$FAILED) {
  28063. while (s5 !== peg$FAILED) {
  28064. s4.push(s5);
  28065. if (peg$c42.test(input.charAt(peg$currPos))) {
  28066. s5 = input.charAt(peg$currPos);
  28067. peg$currPos++;
  28068. } else {
  28069. s5 = peg$FAILED;
  28070. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28071. }
  28072. }
  28073. } else {
  28074. s4 = peg$FAILED;
  28075. }
  28076. if (s4 !== peg$FAILED) {
  28077. s3 = [s3, s4];
  28078. s2 = s3;
  28079. } else {
  28080. peg$currPos = s2;
  28081. s2 = peg$FAILED;
  28082. }
  28083. } else {
  28084. peg$currPos = s2;
  28085. s2 = peg$FAILED;
  28086. }
  28087. if (s2 !== peg$FAILED) {
  28088. s1 = input.substring(s1, peg$currPos);
  28089. } else {
  28090. s1 = s2;
  28091. }
  28092. if (s1 !== peg$FAILED) {
  28093. peg$savedPos = s0;
  28094. s1 = peg$c45(s1);
  28095. }
  28096. s0 = s1;
  28097. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28098. return s0;
  28099. }
  28100. function peg$parseliteralArray() {
  28101. var s0, s1, s2, s3, s4;
  28102. var key = peg$currPos * 66 + 20,
  28103. cached = peg$resultsCache[key];
  28104. if (cached) {
  28105. peg$currPos = cached.nextPos;
  28106. return cached.result;
  28107. }
  28108. s0 = peg$currPos;
  28109. if (input.substr(peg$currPos, 2) === peg$c46) {
  28110. s1 = peg$c46;
  28111. peg$currPos += 2;
  28112. } else {
  28113. s1 = peg$FAILED;
  28114. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28115. }
  28116. if (s1 !== peg$FAILED) {
  28117. s2 = peg$parsewsLiteralArrayContents();
  28118. if (s2 !== peg$FAILED) {
  28119. s3 = peg$parsews();
  28120. if (s3 !== peg$FAILED) {
  28121. if (input.charCodeAt(peg$currPos) === 41) {
  28122. s4 = peg$c48;
  28123. peg$currPos++;
  28124. } else {
  28125. s4 = peg$FAILED;
  28126. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28127. }
  28128. if (s4 !== peg$FAILED) {
  28129. peg$savedPos = s0;
  28130. s1 = peg$c50(s2);
  28131. s0 = s1;
  28132. } else {
  28133. peg$currPos = s0;
  28134. s0 = peg$FAILED;
  28135. }
  28136. } else {
  28137. peg$currPos = s0;
  28138. s0 = peg$FAILED;
  28139. }
  28140. } else {
  28141. peg$currPos = s0;
  28142. s0 = peg$FAILED;
  28143. }
  28144. } else {
  28145. peg$currPos = s0;
  28146. s0 = peg$FAILED;
  28147. }
  28148. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28149. return s0;
  28150. }
  28151. function peg$parsebareLiteralArray() {
  28152. var s0, s1, s2, s3, s4;
  28153. var key = peg$currPos * 66 + 21,
  28154. cached = peg$resultsCache[key];
  28155. if (cached) {
  28156. peg$currPos = cached.nextPos;
  28157. return cached.result;
  28158. }
  28159. s0 = peg$currPos;
  28160. if (input.charCodeAt(peg$currPos) === 40) {
  28161. s1 = peg$c51;
  28162. peg$currPos++;
  28163. } else {
  28164. s1 = peg$FAILED;
  28165. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28166. }
  28167. if (s1 !== peg$FAILED) {
  28168. s2 = peg$parsewsLiteralArrayContents();
  28169. if (s2 !== peg$FAILED) {
  28170. s3 = peg$parsews();
  28171. if (s3 !== peg$FAILED) {
  28172. if (input.charCodeAt(peg$currPos) === 41) {
  28173. s4 = peg$c48;
  28174. peg$currPos++;
  28175. } else {
  28176. s4 = peg$FAILED;
  28177. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28178. }
  28179. if (s4 !== peg$FAILED) {
  28180. peg$savedPos = s0;
  28181. s1 = peg$c50(s2);
  28182. s0 = s1;
  28183. } else {
  28184. peg$currPos = s0;
  28185. s0 = peg$FAILED;
  28186. }
  28187. } else {
  28188. peg$currPos = s0;
  28189. s0 = peg$FAILED;
  28190. }
  28191. } else {
  28192. peg$currPos = s0;
  28193. s0 = peg$FAILED;
  28194. }
  28195. } else {
  28196. peg$currPos = s0;
  28197. s0 = peg$FAILED;
  28198. }
  28199. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28200. return s0;
  28201. }
  28202. function peg$parseliteralArrayElement() {
  28203. var s0;
  28204. var key = peg$currPos * 66 + 22,
  28205. cached = peg$resultsCache[key];
  28206. if (cached) {
  28207. peg$currPos = cached.nextPos;
  28208. return cached.result;
  28209. }
  28210. s0 = peg$parseparseTimeLiteral();
  28211. if (s0 === peg$FAILED) {
  28212. s0 = peg$parsebareLiteralArray();
  28213. if (s0 === peg$FAILED) {
  28214. s0 = peg$parsebareSymbol();
  28215. }
  28216. }
  28217. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28218. return s0;
  28219. }
  28220. function peg$parsewsLiteralArrayContents() {
  28221. var s0, s1, s2, s3, s4;
  28222. var key = peg$currPos * 66 + 23,
  28223. cached = peg$resultsCache[key];
  28224. if (cached) {
  28225. peg$currPos = cached.nextPos;
  28226. return cached.result;
  28227. }
  28228. s0 = peg$currPos;
  28229. s1 = [];
  28230. s2 = peg$currPos;
  28231. s3 = peg$parsews();
  28232. if (s3 !== peg$FAILED) {
  28233. s4 = peg$parseliteralArrayElement();
  28234. if (s4 !== peg$FAILED) {
  28235. peg$savedPos = s2;
  28236. s3 = peg$c53(s4);
  28237. s2 = s3;
  28238. } else {
  28239. peg$currPos = s2;
  28240. s2 = peg$FAILED;
  28241. }
  28242. } else {
  28243. peg$currPos = s2;
  28244. s2 = peg$FAILED;
  28245. }
  28246. while (s2 !== peg$FAILED) {
  28247. s1.push(s2);
  28248. s2 = peg$currPos;
  28249. s3 = peg$parsews();
  28250. if (s3 !== peg$FAILED) {
  28251. s4 = peg$parseliteralArrayElement();
  28252. if (s4 !== peg$FAILED) {
  28253. peg$savedPos = s2;
  28254. s3 = peg$c53(s4);
  28255. s2 = s3;
  28256. } else {
  28257. peg$currPos = s2;
  28258. s2 = peg$FAILED;
  28259. }
  28260. } else {
  28261. peg$currPos = s2;
  28262. s2 = peg$FAILED;
  28263. }
  28264. }
  28265. if (s1 !== peg$FAILED) {
  28266. peg$savedPos = s0;
  28267. s1 = peg$c54(s1);
  28268. }
  28269. s0 = s1;
  28270. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28271. return s0;
  28272. }
  28273. function peg$parsedynamicArray() {
  28274. var s0, s1, s2, s3, s4;
  28275. var key = peg$currPos * 66 + 24,
  28276. cached = peg$resultsCache[key];
  28277. if (cached) {
  28278. peg$currPos = cached.nextPos;
  28279. return cached.result;
  28280. }
  28281. s0 = peg$currPos;
  28282. if (input.charCodeAt(peg$currPos) === 123) {
  28283. s1 = peg$c55;
  28284. peg$currPos++;
  28285. } else {
  28286. s1 = peg$FAILED;
  28287. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28288. }
  28289. if (s1 !== peg$FAILED) {
  28290. s2 = peg$parsewsExpressions();
  28291. if (s2 === peg$FAILED) {
  28292. s2 = null;
  28293. }
  28294. if (s2 !== peg$FAILED) {
  28295. s3 = peg$parsemaybeDotsWs();
  28296. if (s3 !== peg$FAILED) {
  28297. if (input.charCodeAt(peg$currPos) === 125) {
  28298. s4 = peg$c57;
  28299. peg$currPos++;
  28300. } else {
  28301. s4 = peg$FAILED;
  28302. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28303. }
  28304. if (s4 !== peg$FAILED) {
  28305. peg$savedPos = s0;
  28306. s1 = peg$c59(s2);
  28307. s0 = s1;
  28308. } else {
  28309. peg$currPos = s0;
  28310. s0 = peg$FAILED;
  28311. }
  28312. } else {
  28313. peg$currPos = s0;
  28314. s0 = peg$FAILED;
  28315. }
  28316. } else {
  28317. peg$currPos = s0;
  28318. s0 = peg$FAILED;
  28319. }
  28320. } else {
  28321. peg$currPos = s0;
  28322. s0 = peg$FAILED;
  28323. }
  28324. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28325. return s0;
  28326. }
  28327. function peg$parsedynamicDictionary() {
  28328. var s0, s1, s2, s3, s4;
  28329. var key = peg$currPos * 66 + 25,
  28330. cached = peg$resultsCache[key];
  28331. if (cached) {
  28332. peg$currPos = cached.nextPos;
  28333. return cached.result;
  28334. }
  28335. s0 = peg$currPos;
  28336. if (input.substr(peg$currPos, 2) === peg$c60) {
  28337. s1 = peg$c60;
  28338. peg$currPos += 2;
  28339. } else {
  28340. s1 = peg$FAILED;
  28341. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28342. }
  28343. if (s1 !== peg$FAILED) {
  28344. s2 = peg$parsewsAssociations();
  28345. if (s2 === peg$FAILED) {
  28346. s2 = null;
  28347. }
  28348. if (s2 !== peg$FAILED) {
  28349. s3 = peg$parsemaybeDotsWs();
  28350. if (s3 !== peg$FAILED) {
  28351. if (input.charCodeAt(peg$currPos) === 125) {
  28352. s4 = peg$c57;
  28353. peg$currPos++;
  28354. } else {
  28355. s4 = peg$FAILED;
  28356. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28357. }
  28358. if (s4 !== peg$FAILED) {
  28359. peg$savedPos = s0;
  28360. s1 = peg$c62(s2);
  28361. s0 = s1;
  28362. } else {
  28363. peg$currPos = s0;
  28364. s0 = peg$FAILED;
  28365. }
  28366. } else {
  28367. peg$currPos = s0;
  28368. s0 = peg$FAILED;
  28369. }
  28370. } else {
  28371. peg$currPos = s0;
  28372. s0 = peg$FAILED;
  28373. }
  28374. } else {
  28375. peg$currPos = s0;
  28376. s0 = peg$FAILED;
  28377. }
  28378. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28379. return s0;
  28380. }
  28381. function peg$parsepseudoVariable() {
  28382. var s0, s1, s2;
  28383. var key = peg$currPos * 66 + 26,
  28384. cached = peg$resultsCache[key];
  28385. if (cached) {
  28386. peg$currPos = cached.nextPos;
  28387. return cached.result;
  28388. }
  28389. s0 = peg$currPos;
  28390. s1 = peg$currPos;
  28391. if (input.substr(peg$currPos, 4) === peg$c63) {
  28392. s2 = peg$c63;
  28393. peg$currPos += 4;
  28394. } else {
  28395. s2 = peg$FAILED;
  28396. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28397. }
  28398. if (s2 !== peg$FAILED) {
  28399. peg$savedPos = s1;
  28400. s2 = peg$c65();
  28401. }
  28402. s1 = s2;
  28403. if (s1 === peg$FAILED) {
  28404. s1 = peg$currPos;
  28405. if (input.substr(peg$currPos, 5) === peg$c66) {
  28406. s2 = peg$c66;
  28407. peg$currPos += 5;
  28408. } else {
  28409. s2 = peg$FAILED;
  28410. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28411. }
  28412. if (s2 !== peg$FAILED) {
  28413. peg$savedPos = s1;
  28414. s2 = peg$c68();
  28415. }
  28416. s1 = s2;
  28417. if (s1 === peg$FAILED) {
  28418. s1 = peg$currPos;
  28419. if (input.substr(peg$currPos, 3) === peg$c69) {
  28420. s2 = peg$c69;
  28421. peg$currPos += 3;
  28422. } else {
  28423. s2 = peg$FAILED;
  28424. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28425. }
  28426. if (s2 !== peg$FAILED) {
  28427. peg$savedPos = s1;
  28428. s2 = peg$c71();
  28429. }
  28430. s1 = s2;
  28431. }
  28432. }
  28433. if (s1 !== peg$FAILED) {
  28434. peg$savedPos = s0;
  28435. s1 = peg$c16(s1);
  28436. }
  28437. s0 = s1;
  28438. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28439. return s0;
  28440. }
  28441. function peg$parseparseTimeLiteral() {
  28442. var s0;
  28443. var key = peg$currPos * 66 + 27,
  28444. cached = peg$resultsCache[key];
  28445. if (cached) {
  28446. peg$currPos = cached.nextPos;
  28447. return cached.result;
  28448. }
  28449. s0 = peg$parsepseudoVariable();
  28450. if (s0 === peg$FAILED) {
  28451. s0 = peg$parsenumber();
  28452. if (s0 === peg$FAILED) {
  28453. s0 = peg$parseliteralArray();
  28454. if (s0 === peg$FAILED) {
  28455. s0 = peg$parsestring();
  28456. if (s0 === peg$FAILED) {
  28457. s0 = peg$parsesymbol();
  28458. if (s0 === peg$FAILED) {
  28459. s0 = peg$parsecharacter();
  28460. }
  28461. }
  28462. }
  28463. }
  28464. }
  28465. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28466. return s0;
  28467. }
  28468. function peg$parseruntimeLiteral() {
  28469. var s0;
  28470. var key = peg$currPos * 66 + 28,
  28471. cached = peg$resultsCache[key];
  28472. if (cached) {
  28473. peg$currPos = cached.nextPos;
  28474. return cached.result;
  28475. }
  28476. s0 = peg$parsedynamicDictionary();
  28477. if (s0 === peg$FAILED) {
  28478. s0 = peg$parsedynamicArray();
  28479. if (s0 === peg$FAILED) {
  28480. s0 = peg$parseblock();
  28481. }
  28482. }
  28483. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28484. return s0;
  28485. }
  28486. function peg$parseliteral() {
  28487. var s0;
  28488. var key = peg$currPos * 66 + 29,
  28489. cached = peg$resultsCache[key];
  28490. if (cached) {
  28491. peg$currPos = cached.nextPos;
  28492. return cached.result;
  28493. }
  28494. s0 = peg$parseruntimeLiteral();
  28495. if (s0 === peg$FAILED) {
  28496. s0 = peg$parseparseTimeLiteral();
  28497. }
  28498. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28499. return s0;
  28500. }
  28501. function peg$parsevariable() {
  28502. var s0, s1;
  28503. var key = peg$currPos * 66 + 30,
  28504. cached = peg$resultsCache[key];
  28505. if (cached) {
  28506. peg$currPos = cached.nextPos;
  28507. return cached.result;
  28508. }
  28509. s0 = peg$currPos;
  28510. s1 = peg$parseidentifier();
  28511. if (s1 !== peg$FAILED) {
  28512. peg$savedPos = s0;
  28513. s1 = peg$c72(s1);
  28514. }
  28515. s0 = s1;
  28516. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28517. return s0;
  28518. }
  28519. function peg$parsebinarySelector() {
  28520. var s0, s1, s2;
  28521. var key = peg$currPos * 66 + 31,
  28522. cached = peg$resultsCache[key];
  28523. if (cached) {
  28524. peg$currPos = cached.nextPos;
  28525. return cached.result;
  28526. }
  28527. s0 = peg$currPos;
  28528. s1 = [];
  28529. if (peg$c73.test(input.charAt(peg$currPos))) {
  28530. s2 = input.charAt(peg$currPos);
  28531. peg$currPos++;
  28532. } else {
  28533. s2 = peg$FAILED;
  28534. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28535. }
  28536. if (s2 !== peg$FAILED) {
  28537. while (s2 !== peg$FAILED) {
  28538. s1.push(s2);
  28539. if (peg$c73.test(input.charAt(peg$currPos))) {
  28540. s2 = input.charAt(peg$currPos);
  28541. peg$currPos++;
  28542. } else {
  28543. s2 = peg$FAILED;
  28544. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28545. }
  28546. }
  28547. } else {
  28548. s1 = peg$FAILED;
  28549. }
  28550. if (s1 !== peg$FAILED) {
  28551. s0 = input.substring(s0, peg$currPos);
  28552. } else {
  28553. s0 = s1;
  28554. }
  28555. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28556. return s0;
  28557. }
  28558. function peg$parsewsKeywordPattern() {
  28559. var s0, s1, s2, s3, s4, s5, s6;
  28560. var key = peg$currPos * 66 + 32,
  28561. cached = peg$resultsCache[key];
  28562. if (cached) {
  28563. peg$currPos = cached.nextPos;
  28564. return cached.result;
  28565. }
  28566. s0 = peg$currPos;
  28567. s1 = [];
  28568. s2 = peg$currPos;
  28569. s3 = peg$parsews();
  28570. if (s3 !== peg$FAILED) {
  28571. s4 = peg$parsekeyword();
  28572. if (s4 !== peg$FAILED) {
  28573. s5 = peg$parsews();
  28574. if (s5 !== peg$FAILED) {
  28575. s6 = peg$parseidentifier();
  28576. if (s6 !== peg$FAILED) {
  28577. peg$savedPos = s2;
  28578. s3 = peg$c75(s4, s6);
  28579. s2 = s3;
  28580. } else {
  28581. peg$currPos = s2;
  28582. s2 = peg$FAILED;
  28583. }
  28584. } else {
  28585. peg$currPos = s2;
  28586. s2 = peg$FAILED;
  28587. }
  28588. } else {
  28589. peg$currPos = s2;
  28590. s2 = peg$FAILED;
  28591. }
  28592. } else {
  28593. peg$currPos = s2;
  28594. s2 = peg$FAILED;
  28595. }
  28596. if (s2 !== peg$FAILED) {
  28597. while (s2 !== peg$FAILED) {
  28598. s1.push(s2);
  28599. s2 = peg$currPos;
  28600. s3 = peg$parsews();
  28601. if (s3 !== peg$FAILED) {
  28602. s4 = peg$parsekeyword();
  28603. if (s4 !== peg$FAILED) {
  28604. s5 = peg$parsews();
  28605. if (s5 !== peg$FAILED) {
  28606. s6 = peg$parseidentifier();
  28607. if (s6 !== peg$FAILED) {
  28608. peg$savedPos = s2;
  28609. s3 = peg$c75(s4, s6);
  28610. s2 = s3;
  28611. } else {
  28612. peg$currPos = s2;
  28613. s2 = peg$FAILED;
  28614. }
  28615. } else {
  28616. peg$currPos = s2;
  28617. s2 = peg$FAILED;
  28618. }
  28619. } else {
  28620. peg$currPos = s2;
  28621. s2 = peg$FAILED;
  28622. }
  28623. } else {
  28624. peg$currPos = s2;
  28625. s2 = peg$FAILED;
  28626. }
  28627. }
  28628. } else {
  28629. s1 = peg$FAILED;
  28630. }
  28631. if (s1 !== peg$FAILED) {
  28632. peg$savedPos = s0;
  28633. s1 = peg$c76(s1);
  28634. }
  28635. s0 = s1;
  28636. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28637. return s0;
  28638. }
  28639. function peg$parsewsBinaryPattern() {
  28640. var s0, s1, s2, s3, s4;
  28641. var key = peg$currPos * 66 + 33,
  28642. cached = peg$resultsCache[key];
  28643. if (cached) {
  28644. peg$currPos = cached.nextPos;
  28645. return cached.result;
  28646. }
  28647. s0 = peg$currPos;
  28648. s1 = peg$parsews();
  28649. if (s1 !== peg$FAILED) {
  28650. s2 = peg$parsebinarySelector();
  28651. if (s2 !== peg$FAILED) {
  28652. s3 = peg$parsews();
  28653. if (s3 !== peg$FAILED) {
  28654. s4 = peg$parseidentifier();
  28655. if (s4 !== peg$FAILED) {
  28656. peg$savedPos = s0;
  28657. s1 = peg$c77(s2, s4);
  28658. s0 = s1;
  28659. } else {
  28660. peg$currPos = s0;
  28661. s0 = peg$FAILED;
  28662. }
  28663. } else {
  28664. peg$currPos = s0;
  28665. s0 = peg$FAILED;
  28666. }
  28667. } else {
  28668. peg$currPos = s0;
  28669. s0 = peg$FAILED;
  28670. }
  28671. } else {
  28672. peg$currPos = s0;
  28673. s0 = peg$FAILED;
  28674. }
  28675. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28676. return s0;
  28677. }
  28678. function peg$parsewsUnaryPattern() {
  28679. var s0, s1, s2;
  28680. var key = peg$currPos * 66 + 34,
  28681. cached = peg$resultsCache[key];
  28682. if (cached) {
  28683. peg$currPos = cached.nextPos;
  28684. return cached.result;
  28685. }
  28686. s0 = peg$currPos;
  28687. s1 = peg$parsews();
  28688. if (s1 !== peg$FAILED) {
  28689. s2 = peg$parseidentifier();
  28690. if (s2 !== peg$FAILED) {
  28691. peg$savedPos = s0;
  28692. s1 = peg$c78(s2);
  28693. s0 = s1;
  28694. } else {
  28695. peg$currPos = s0;
  28696. s0 = peg$FAILED;
  28697. }
  28698. } else {
  28699. peg$currPos = s0;
  28700. s0 = peg$FAILED;
  28701. }
  28702. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28703. return s0;
  28704. }
  28705. function peg$parseexpression() {
  28706. var s0;
  28707. var key = peg$currPos * 66 + 35,
  28708. cached = peg$resultsCache[key];
  28709. if (cached) {
  28710. peg$currPos = cached.nextPos;
  28711. return cached.result;
  28712. }
  28713. s0 = peg$parseassignment();
  28714. if (s0 === peg$FAILED) {
  28715. s0 = peg$parsecascade();
  28716. if (s0 === peg$FAILED) {
  28717. s0 = peg$parsekeywordSend();
  28718. }
  28719. }
  28720. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28721. return s0;
  28722. }
  28723. function peg$parsewsExpressionsRest() {
  28724. var s0, s1, s2;
  28725. var key = peg$currPos * 66 + 36,
  28726. cached = peg$resultsCache[key];
  28727. if (cached) {
  28728. peg$currPos = cached.nextPos;
  28729. return cached.result;
  28730. }
  28731. s0 = peg$currPos;
  28732. s1 = peg$parsesomeDotsWs();
  28733. if (s1 !== peg$FAILED) {
  28734. s2 = peg$parseexpression();
  28735. if (s2 !== peg$FAILED) {
  28736. peg$savedPos = s0;
  28737. s1 = peg$c79(s2);
  28738. s0 = s1;
  28739. } else {
  28740. peg$currPos = s0;
  28741. s0 = peg$FAILED;
  28742. }
  28743. } else {
  28744. peg$currPos = s0;
  28745. s0 = peg$FAILED;
  28746. }
  28747. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28748. return s0;
  28749. }
  28750. function peg$parsewsExpressions() {
  28751. var s0, s1, s2, s3, s4;
  28752. var key = peg$currPos * 66 + 37,
  28753. cached = peg$resultsCache[key];
  28754. if (cached) {
  28755. peg$currPos = cached.nextPos;
  28756. return cached.result;
  28757. }
  28758. s0 = peg$currPos;
  28759. s1 = peg$parsemaybeDotsWs();
  28760. if (s1 !== peg$FAILED) {
  28761. s2 = peg$parseexpression();
  28762. if (s2 !== peg$FAILED) {
  28763. s3 = [];
  28764. s4 = peg$parsewsExpressionsRest();
  28765. while (s4 !== peg$FAILED) {
  28766. s3.push(s4);
  28767. s4 = peg$parsewsExpressionsRest();
  28768. }
  28769. if (s3 !== peg$FAILED) {
  28770. peg$savedPos = s0;
  28771. s1 = peg$c80(s2, s3);
  28772. s0 = s1;
  28773. } else {
  28774. peg$currPos = s0;
  28775. s0 = peg$FAILED;
  28776. }
  28777. } else {
  28778. peg$currPos = s0;
  28779. s0 = peg$FAILED;
  28780. }
  28781. } else {
  28782. peg$currPos = s0;
  28783. s0 = peg$FAILED;
  28784. }
  28785. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28786. return s0;
  28787. }
  28788. function peg$parsewsUnaryPragmaMessage() {
  28789. var s0, s1, s2, s3, s4;
  28790. var key = peg$currPos * 66 + 38,
  28791. cached = peg$resultsCache[key];
  28792. if (cached) {
  28793. peg$currPos = cached.nextPos;
  28794. return cached.result;
  28795. }
  28796. s0 = peg$currPos;
  28797. s1 = peg$parsews();
  28798. if (s1 !== peg$FAILED) {
  28799. s2 = peg$parseidentifier();
  28800. if (s2 !== peg$FAILED) {
  28801. s3 = peg$currPos;
  28802. peg$silentFails++;
  28803. if (input.charCodeAt(peg$currPos) === 58) {
  28804. s4 = peg$c12;
  28805. peg$currPos++;
  28806. } else {
  28807. s4 = peg$FAILED;
  28808. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28809. }
  28810. peg$silentFails--;
  28811. if (s4 === peg$FAILED) {
  28812. s3 = void 0;
  28813. } else {
  28814. peg$currPos = s3;
  28815. s3 = peg$FAILED;
  28816. }
  28817. if (s3 !== peg$FAILED) {
  28818. peg$savedPos = s0;
  28819. s1 = peg$c81(s2);
  28820. s0 = s1;
  28821. } else {
  28822. peg$currPos = s0;
  28823. s0 = peg$FAILED;
  28824. }
  28825. } else {
  28826. peg$currPos = s0;
  28827. s0 = peg$FAILED;
  28828. }
  28829. } else {
  28830. peg$currPos = s0;
  28831. s0 = peg$FAILED;
  28832. }
  28833. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28834. return s0;
  28835. }
  28836. function peg$parsewsKeywordPragmaMessage() {
  28837. var s0, s1, s2, s3, s4, s5, s6;
  28838. var key = peg$currPos * 66 + 39,
  28839. cached = peg$resultsCache[key];
  28840. if (cached) {
  28841. peg$currPos = cached.nextPos;
  28842. return cached.result;
  28843. }
  28844. s0 = peg$currPos;
  28845. s1 = [];
  28846. s2 = peg$currPos;
  28847. s3 = peg$parsews();
  28848. if (s3 !== peg$FAILED) {
  28849. s4 = peg$parsekeyword();
  28850. if (s4 !== peg$FAILED) {
  28851. s5 = peg$parsews();
  28852. if (s5 !== peg$FAILED) {
  28853. s6 = peg$parseparseTimeLiteral();
  28854. if (s6 !== peg$FAILED) {
  28855. peg$savedPos = s2;
  28856. s3 = peg$c75(s4, s6);
  28857. s2 = s3;
  28858. } else {
  28859. peg$currPos = s2;
  28860. s2 = peg$FAILED;
  28861. }
  28862. } else {
  28863. peg$currPos = s2;
  28864. s2 = peg$FAILED;
  28865. }
  28866. } else {
  28867. peg$currPos = s2;
  28868. s2 = peg$FAILED;
  28869. }
  28870. } else {
  28871. peg$currPos = s2;
  28872. s2 = peg$FAILED;
  28873. }
  28874. if (s2 !== peg$FAILED) {
  28875. while (s2 !== peg$FAILED) {
  28876. s1.push(s2);
  28877. s2 = peg$currPos;
  28878. s3 = peg$parsews();
  28879. if (s3 !== peg$FAILED) {
  28880. s4 = peg$parsekeyword();
  28881. if (s4 !== peg$FAILED) {
  28882. s5 = peg$parsews();
  28883. if (s5 !== peg$FAILED) {
  28884. s6 = peg$parseparseTimeLiteral();
  28885. if (s6 !== peg$FAILED) {
  28886. peg$savedPos = s2;
  28887. s3 = peg$c75(s4, s6);
  28888. s2 = s3;
  28889. } else {
  28890. peg$currPos = s2;
  28891. s2 = peg$FAILED;
  28892. }
  28893. } else {
  28894. peg$currPos = s2;
  28895. s2 = peg$FAILED;
  28896. }
  28897. } else {
  28898. peg$currPos = s2;
  28899. s2 = peg$FAILED;
  28900. }
  28901. } else {
  28902. peg$currPos = s2;
  28903. s2 = peg$FAILED;
  28904. }
  28905. }
  28906. } else {
  28907. s1 = peg$FAILED;
  28908. }
  28909. if (s1 !== peg$FAILED) {
  28910. peg$savedPos = s0;
  28911. s1 = peg$c82(s1);
  28912. }
  28913. s0 = s1;
  28914. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28915. return s0;
  28916. }
  28917. function peg$parsewsPragmaMessage() {
  28918. var s0;
  28919. var key = peg$currPos * 66 + 40,
  28920. cached = peg$resultsCache[key];
  28921. if (cached) {
  28922. peg$currPos = cached.nextPos;
  28923. return cached.result;
  28924. }
  28925. s0 = peg$parsewsUnaryPragmaMessage();
  28926. if (s0 === peg$FAILED) {
  28927. s0 = peg$parsewsKeywordPragmaMessage();
  28928. }
  28929. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28930. return s0;
  28931. }
  28932. function peg$parsewsPragmas() {
  28933. var s0, s1, s2, s3, s4, s5, s6;
  28934. var key = peg$currPos * 66 + 41,
  28935. cached = peg$resultsCache[key];
  28936. if (cached) {
  28937. peg$currPos = cached.nextPos;
  28938. return cached.result;
  28939. }
  28940. s0 = [];
  28941. s1 = peg$currPos;
  28942. s2 = peg$parsews();
  28943. if (s2 !== peg$FAILED) {
  28944. if (input.charCodeAt(peg$currPos) === 60) {
  28945. s3 = peg$c83;
  28946. peg$currPos++;
  28947. } else {
  28948. s3 = peg$FAILED;
  28949. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28950. }
  28951. if (s3 !== peg$FAILED) {
  28952. s4 = peg$parsewsPragmaMessage();
  28953. if (s4 !== peg$FAILED) {
  28954. s5 = peg$parsews();
  28955. if (s5 !== peg$FAILED) {
  28956. if (input.charCodeAt(peg$currPos) === 62) {
  28957. s6 = peg$c85;
  28958. peg$currPos++;
  28959. } else {
  28960. s6 = peg$FAILED;
  28961. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  28962. }
  28963. if (s6 !== peg$FAILED) {
  28964. peg$savedPos = s1;
  28965. s2 = peg$c87(s4);
  28966. s1 = s2;
  28967. } else {
  28968. peg$currPos = s1;
  28969. s1 = peg$FAILED;
  28970. }
  28971. } else {
  28972. peg$currPos = s1;
  28973. s1 = peg$FAILED;
  28974. }
  28975. } else {
  28976. peg$currPos = s1;
  28977. s1 = peg$FAILED;
  28978. }
  28979. } else {
  28980. peg$currPos = s1;
  28981. s1 = peg$FAILED;
  28982. }
  28983. } else {
  28984. peg$currPos = s1;
  28985. s1 = peg$FAILED;
  28986. }
  28987. while (s1 !== peg$FAILED) {
  28988. s0.push(s1);
  28989. s1 = peg$currPos;
  28990. s2 = peg$parsews();
  28991. if (s2 !== peg$FAILED) {
  28992. if (input.charCodeAt(peg$currPos) === 60) {
  28993. s3 = peg$c83;
  28994. peg$currPos++;
  28995. } else {
  28996. s3 = peg$FAILED;
  28997. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28998. }
  28999. if (s3 !== peg$FAILED) {
  29000. s4 = peg$parsewsPragmaMessage();
  29001. if (s4 !== peg$FAILED) {
  29002. s5 = peg$parsews();
  29003. if (s5 !== peg$FAILED) {
  29004. if (input.charCodeAt(peg$currPos) === 62) {
  29005. s6 = peg$c85;
  29006. peg$currPos++;
  29007. } else {
  29008. s6 = peg$FAILED;
  29009. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29010. }
  29011. if (s6 !== peg$FAILED) {
  29012. peg$savedPos = s1;
  29013. s2 = peg$c87(s4);
  29014. s1 = s2;
  29015. } else {
  29016. peg$currPos = s1;
  29017. s1 = peg$FAILED;
  29018. }
  29019. } else {
  29020. peg$currPos = s1;
  29021. s1 = peg$FAILED;
  29022. }
  29023. } else {
  29024. peg$currPos = s1;
  29025. s1 = peg$FAILED;
  29026. }
  29027. } else {
  29028. peg$currPos = s1;
  29029. s1 = peg$FAILED;
  29030. }
  29031. } else {
  29032. peg$currPos = s1;
  29033. s1 = peg$FAILED;
  29034. }
  29035. }
  29036. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29037. return s0;
  29038. }
  29039. function peg$parseassignment() {
  29040. var s0, s1, s2, s3, s4, s5;
  29041. var key = peg$currPos * 66 + 42,
  29042. cached = peg$resultsCache[key];
  29043. if (cached) {
  29044. peg$currPos = cached.nextPos;
  29045. return cached.result;
  29046. }
  29047. s0 = peg$currPos;
  29048. s1 = peg$parsevariable();
  29049. if (s1 !== peg$FAILED) {
  29050. s2 = peg$parsews();
  29051. if (s2 !== peg$FAILED) {
  29052. if (input.substr(peg$currPos, 2) === peg$c88) {
  29053. s3 = peg$c88;
  29054. peg$currPos += 2;
  29055. } else {
  29056. s3 = peg$FAILED;
  29057. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29058. }
  29059. if (s3 !== peg$FAILED) {
  29060. s4 = peg$parsews();
  29061. if (s4 !== peg$FAILED) {
  29062. s5 = peg$parseexpression();
  29063. if (s5 !== peg$FAILED) {
  29064. peg$savedPos = s0;
  29065. s1 = peg$c90(s1, s5);
  29066. s0 = s1;
  29067. } else {
  29068. peg$currPos = s0;
  29069. s0 = peg$FAILED;
  29070. }
  29071. } else {
  29072. peg$currPos = s0;
  29073. s0 = peg$FAILED;
  29074. }
  29075. } else {
  29076. peg$currPos = s0;
  29077. s0 = peg$FAILED;
  29078. }
  29079. } else {
  29080. peg$currPos = s0;
  29081. s0 = peg$FAILED;
  29082. }
  29083. } else {
  29084. peg$currPos = s0;
  29085. s0 = peg$FAILED;
  29086. }
  29087. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29088. return s0;
  29089. }
  29090. function peg$parseret() {
  29091. var s0, s1, s2, s3;
  29092. var key = peg$currPos * 66 + 43,
  29093. cached = peg$resultsCache[key];
  29094. if (cached) {
  29095. peg$currPos = cached.nextPos;
  29096. return cached.result;
  29097. }
  29098. s0 = peg$currPos;
  29099. if (input.charCodeAt(peg$currPos) === 94) {
  29100. s1 = peg$c91;
  29101. peg$currPos++;
  29102. } else {
  29103. s1 = peg$FAILED;
  29104. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29105. }
  29106. if (s1 !== peg$FAILED) {
  29107. s2 = peg$parsews();
  29108. if (s2 !== peg$FAILED) {
  29109. s3 = peg$parseexpression();
  29110. if (s3 !== peg$FAILED) {
  29111. peg$savedPos = s0;
  29112. s1 = peg$c93(s3);
  29113. s0 = s1;
  29114. } else {
  29115. peg$currPos = s0;
  29116. s0 = peg$FAILED;
  29117. }
  29118. } else {
  29119. peg$currPos = s0;
  29120. s0 = peg$FAILED;
  29121. }
  29122. } else {
  29123. peg$currPos = s0;
  29124. s0 = peg$FAILED;
  29125. }
  29126. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29127. return s0;
  29128. }
  29129. function peg$parsetemps() {
  29130. var s0, s1, s2, s3, s4, s5;
  29131. var key = peg$currPos * 66 + 44,
  29132. cached = peg$resultsCache[key];
  29133. if (cached) {
  29134. peg$currPos = cached.nextPos;
  29135. return cached.result;
  29136. }
  29137. s0 = peg$currPos;
  29138. if (input.charCodeAt(peg$currPos) === 124) {
  29139. s1 = peg$c94;
  29140. peg$currPos++;
  29141. } else {
  29142. s1 = peg$FAILED;
  29143. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29144. }
  29145. if (s1 !== peg$FAILED) {
  29146. s2 = [];
  29147. s3 = peg$currPos;
  29148. s4 = peg$parsews();
  29149. if (s4 !== peg$FAILED) {
  29150. s5 = peg$parseidentifier();
  29151. if (s5 !== peg$FAILED) {
  29152. peg$savedPos = s3;
  29153. s4 = peg$c96(s5);
  29154. s3 = s4;
  29155. } else {
  29156. peg$currPos = s3;
  29157. s3 = peg$FAILED;
  29158. }
  29159. } else {
  29160. peg$currPos = s3;
  29161. s3 = peg$FAILED;
  29162. }
  29163. while (s3 !== peg$FAILED) {
  29164. s2.push(s3);
  29165. s3 = peg$currPos;
  29166. s4 = peg$parsews();
  29167. if (s4 !== peg$FAILED) {
  29168. s5 = peg$parseidentifier();
  29169. if (s5 !== peg$FAILED) {
  29170. peg$savedPos = s3;
  29171. s4 = peg$c96(s5);
  29172. s3 = s4;
  29173. } else {
  29174. peg$currPos = s3;
  29175. s3 = peg$FAILED;
  29176. }
  29177. } else {
  29178. peg$currPos = s3;
  29179. s3 = peg$FAILED;
  29180. }
  29181. }
  29182. if (s2 !== peg$FAILED) {
  29183. s3 = peg$parsews();
  29184. if (s3 !== peg$FAILED) {
  29185. if (input.charCodeAt(peg$currPos) === 124) {
  29186. s4 = peg$c94;
  29187. peg$currPos++;
  29188. } else {
  29189. s4 = peg$FAILED;
  29190. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29191. }
  29192. if (s4 !== peg$FAILED) {
  29193. peg$savedPos = s0;
  29194. s1 = peg$c97(s2);
  29195. s0 = s1;
  29196. } else {
  29197. peg$currPos = s0;
  29198. s0 = peg$FAILED;
  29199. }
  29200. } else {
  29201. peg$currPos = s0;
  29202. s0 = peg$FAILED;
  29203. }
  29204. } else {
  29205. peg$currPos = s0;
  29206. s0 = peg$FAILED;
  29207. }
  29208. } else {
  29209. peg$currPos = s0;
  29210. s0 = peg$FAILED;
  29211. }
  29212. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29213. return s0;
  29214. }
  29215. function peg$parsewsBlockParamList() {
  29216. var s0, s1, s2, s3, s4, s5, s6;
  29217. var key = peg$currPos * 66 + 45,
  29218. cached = peg$resultsCache[key];
  29219. if (cached) {
  29220. peg$currPos = cached.nextPos;
  29221. return cached.result;
  29222. }
  29223. s0 = peg$currPos;
  29224. s1 = [];
  29225. s2 = peg$currPos;
  29226. s3 = peg$parsews();
  29227. if (s3 !== peg$FAILED) {
  29228. if (input.charCodeAt(peg$currPos) === 58) {
  29229. s4 = peg$c12;
  29230. peg$currPos++;
  29231. } else {
  29232. s4 = peg$FAILED;
  29233. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29234. }
  29235. if (s4 !== peg$FAILED) {
  29236. s5 = peg$parsews();
  29237. if (s5 !== peg$FAILED) {
  29238. s6 = peg$parseidentifier();
  29239. if (s6 !== peg$FAILED) {
  29240. peg$savedPos = s2;
  29241. s3 = peg$c98(s6);
  29242. s2 = s3;
  29243. } else {
  29244. peg$currPos = s2;
  29245. s2 = peg$FAILED;
  29246. }
  29247. } else {
  29248. peg$currPos = s2;
  29249. s2 = peg$FAILED;
  29250. }
  29251. } else {
  29252. peg$currPos = s2;
  29253. s2 = peg$FAILED;
  29254. }
  29255. } else {
  29256. peg$currPos = s2;
  29257. s2 = peg$FAILED;
  29258. }
  29259. if (s2 !== peg$FAILED) {
  29260. while (s2 !== peg$FAILED) {
  29261. s1.push(s2);
  29262. s2 = peg$currPos;
  29263. s3 = peg$parsews();
  29264. if (s3 !== peg$FAILED) {
  29265. if (input.charCodeAt(peg$currPos) === 58) {
  29266. s4 = peg$c12;
  29267. peg$currPos++;
  29268. } else {
  29269. s4 = peg$FAILED;
  29270. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29271. }
  29272. if (s4 !== peg$FAILED) {
  29273. s5 = peg$parsews();
  29274. if (s5 !== peg$FAILED) {
  29275. s6 = peg$parseidentifier();
  29276. if (s6 !== peg$FAILED) {
  29277. peg$savedPos = s2;
  29278. s3 = peg$c98(s6);
  29279. s2 = s3;
  29280. } else {
  29281. peg$currPos = s2;
  29282. s2 = peg$FAILED;
  29283. }
  29284. } else {
  29285. peg$currPos = s2;
  29286. s2 = peg$FAILED;
  29287. }
  29288. } else {
  29289. peg$currPos = s2;
  29290. s2 = peg$FAILED;
  29291. }
  29292. } else {
  29293. peg$currPos = s2;
  29294. s2 = peg$FAILED;
  29295. }
  29296. }
  29297. } else {
  29298. s1 = peg$FAILED;
  29299. }
  29300. if (s1 !== peg$FAILED) {
  29301. s2 = peg$parsews();
  29302. if (s2 !== peg$FAILED) {
  29303. if (input.charCodeAt(peg$currPos) === 124) {
  29304. s3 = peg$c94;
  29305. peg$currPos++;
  29306. } else {
  29307. s3 = peg$FAILED;
  29308. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29309. }
  29310. if (s3 !== peg$FAILED) {
  29311. peg$savedPos = s0;
  29312. s1 = peg$c99(s1);
  29313. s0 = s1;
  29314. } else {
  29315. peg$currPos = s0;
  29316. s0 = peg$FAILED;
  29317. }
  29318. } else {
  29319. peg$currPos = s0;
  29320. s0 = peg$FAILED;
  29321. }
  29322. } else {
  29323. peg$currPos = s0;
  29324. s0 = peg$FAILED;
  29325. }
  29326. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29327. return s0;
  29328. }
  29329. function peg$parsesubexpression() {
  29330. var s0, s1, s2, s3, s4, s5;
  29331. var key = peg$currPos * 66 + 46,
  29332. cached = peg$resultsCache[key];
  29333. if (cached) {
  29334. peg$currPos = cached.nextPos;
  29335. return cached.result;
  29336. }
  29337. s0 = peg$currPos;
  29338. if (input.charCodeAt(peg$currPos) === 40) {
  29339. s1 = peg$c51;
  29340. peg$currPos++;
  29341. } else {
  29342. s1 = peg$FAILED;
  29343. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29344. }
  29345. if (s1 !== peg$FAILED) {
  29346. s2 = peg$parsews();
  29347. if (s2 !== peg$FAILED) {
  29348. s3 = peg$parseexpression();
  29349. if (s3 !== peg$FAILED) {
  29350. s4 = peg$parsews();
  29351. if (s4 !== peg$FAILED) {
  29352. if (input.charCodeAt(peg$currPos) === 41) {
  29353. s5 = peg$c48;
  29354. peg$currPos++;
  29355. } else {
  29356. s5 = peg$FAILED;
  29357. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29358. }
  29359. if (s5 !== peg$FAILED) {
  29360. peg$savedPos = s0;
  29361. s1 = peg$c79(s3);
  29362. s0 = s1;
  29363. } else {
  29364. peg$currPos = s0;
  29365. s0 = peg$FAILED;
  29366. }
  29367. } else {
  29368. peg$currPos = s0;
  29369. s0 = peg$FAILED;
  29370. }
  29371. } else {
  29372. peg$currPos = s0;
  29373. s0 = peg$FAILED;
  29374. }
  29375. } else {
  29376. peg$currPos = s0;
  29377. s0 = peg$FAILED;
  29378. }
  29379. } else {
  29380. peg$currPos = s0;
  29381. s0 = peg$FAILED;
  29382. }
  29383. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29384. return s0;
  29385. }
  29386. function peg$parsewsStatements() {
  29387. var s0, s1, s2, s3;
  29388. var key = peg$currPos * 66 + 47,
  29389. cached = peg$resultsCache[key];
  29390. if (cached) {
  29391. peg$currPos = cached.nextPos;
  29392. return cached.result;
  29393. }
  29394. s0 = peg$currPos;
  29395. s1 = peg$parsemaybeDotsWs();
  29396. if (s1 !== peg$FAILED) {
  29397. s2 = peg$parseret();
  29398. if (s2 !== peg$FAILED) {
  29399. peg$savedPos = s0;
  29400. s1 = peg$c100(s2);
  29401. s0 = s1;
  29402. } else {
  29403. peg$currPos = s0;
  29404. s0 = peg$FAILED;
  29405. }
  29406. } else {
  29407. peg$currPos = s0;
  29408. s0 = peg$FAILED;
  29409. }
  29410. if (s0 === peg$FAILED) {
  29411. s0 = peg$currPos;
  29412. s1 = peg$parsewsExpressions();
  29413. if (s1 !== peg$FAILED) {
  29414. s2 = peg$parsesomeDotsWs();
  29415. if (s2 !== peg$FAILED) {
  29416. s3 = peg$parseret();
  29417. if (s3 !== peg$FAILED) {
  29418. peg$savedPos = s0;
  29419. s1 = peg$c101(s1, s3);
  29420. s0 = s1;
  29421. } else {
  29422. peg$currPos = s0;
  29423. s0 = peg$FAILED;
  29424. }
  29425. } else {
  29426. peg$currPos = s0;
  29427. s0 = peg$FAILED;
  29428. }
  29429. } else {
  29430. peg$currPos = s0;
  29431. s0 = peg$FAILED;
  29432. }
  29433. if (s0 === peg$FAILED) {
  29434. s0 = peg$currPos;
  29435. s1 = peg$parsewsExpressions();
  29436. if (s1 === peg$FAILED) {
  29437. s1 = null;
  29438. }
  29439. if (s1 !== peg$FAILED) {
  29440. peg$savedPos = s0;
  29441. s1 = peg$c102(s1);
  29442. }
  29443. s0 = s1;
  29444. }
  29445. }
  29446. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29447. return s0;
  29448. }
  29449. function peg$parsewsSequenceWs() {
  29450. var s0, s1, s2, s3, s4, s5, s6;
  29451. var key = peg$currPos * 66 + 48,
  29452. cached = peg$resultsCache[key];
  29453. if (cached) {
  29454. peg$currPos = cached.nextPos;
  29455. return cached.result;
  29456. }
  29457. s0 = peg$currPos;
  29458. s1 = peg$parsewsPragmas();
  29459. if (s1 === peg$FAILED) {
  29460. s1 = null;
  29461. }
  29462. if (s1 !== peg$FAILED) {
  29463. s2 = peg$parsews();
  29464. if (s2 !== peg$FAILED) {
  29465. s3 = peg$parsetemps();
  29466. if (s3 === peg$FAILED) {
  29467. s3 = null;
  29468. }
  29469. if (s3 !== peg$FAILED) {
  29470. s4 = peg$parsewsPragmas();
  29471. if (s4 === peg$FAILED) {
  29472. s4 = null;
  29473. }
  29474. if (s4 !== peg$FAILED) {
  29475. s5 = peg$parsewsStatements();
  29476. if (s5 === peg$FAILED) {
  29477. s5 = null;
  29478. }
  29479. if (s5 !== peg$FAILED) {
  29480. s6 = peg$parsemaybeDotsWs();
  29481. if (s6 !== peg$FAILED) {
  29482. peg$savedPos = s0;
  29483. s1 = peg$c103(s1, s3, s4, s5);
  29484. s0 = s1;
  29485. } else {
  29486. peg$currPos = s0;
  29487. s0 = peg$FAILED;
  29488. }
  29489. } else {
  29490. peg$currPos = s0;
  29491. s0 = peg$FAILED;
  29492. }
  29493. } else {
  29494. peg$currPos = s0;
  29495. s0 = peg$FAILED;
  29496. }
  29497. } else {
  29498. peg$currPos = s0;
  29499. s0 = peg$FAILED;
  29500. }
  29501. } else {
  29502. peg$currPos = s0;
  29503. s0 = peg$FAILED;
  29504. }
  29505. } else {
  29506. peg$currPos = s0;
  29507. s0 = peg$FAILED;
  29508. }
  29509. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29510. return s0;
  29511. }
  29512. function peg$parseblock() {
  29513. var s0, s1, s2, s3, s4;
  29514. var key = peg$currPos * 66 + 49,
  29515. cached = peg$resultsCache[key];
  29516. if (cached) {
  29517. peg$currPos = cached.nextPos;
  29518. return cached.result;
  29519. }
  29520. s0 = peg$currPos;
  29521. if (input.charCodeAt(peg$currPos) === 91) {
  29522. s1 = peg$c104;
  29523. peg$currPos++;
  29524. } else {
  29525. s1 = peg$FAILED;
  29526. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29527. }
  29528. if (s1 !== peg$FAILED) {
  29529. s2 = peg$parsewsBlockParamList();
  29530. if (s2 === peg$FAILED) {
  29531. s2 = null;
  29532. }
  29533. if (s2 !== peg$FAILED) {
  29534. s3 = peg$parsewsSequenceWs();
  29535. if (s3 !== peg$FAILED) {
  29536. if (input.charCodeAt(peg$currPos) === 93) {
  29537. s4 = peg$c106;
  29538. peg$currPos++;
  29539. } else {
  29540. s4 = peg$FAILED;
  29541. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29542. }
  29543. if (s4 !== peg$FAILED) {
  29544. peg$savedPos = s0;
  29545. s1 = peg$c108(s2, s3);
  29546. s0 = s1;
  29547. } else {
  29548. peg$currPos = s0;
  29549. s0 = peg$FAILED;
  29550. }
  29551. } else {
  29552. peg$currPos = s0;
  29553. s0 = peg$FAILED;
  29554. }
  29555. } else {
  29556. peg$currPos = s0;
  29557. s0 = peg$FAILED;
  29558. }
  29559. } else {
  29560. peg$currPos = s0;
  29561. s0 = peg$FAILED;
  29562. }
  29563. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29564. return s0;
  29565. }
  29566. function peg$parseoperand() {
  29567. var s0;
  29568. var key = peg$currPos * 66 + 50,
  29569. cached = peg$resultsCache[key];
  29570. if (cached) {
  29571. peg$currPos = cached.nextPos;
  29572. return cached.result;
  29573. }
  29574. s0 = peg$parseliteral();
  29575. if (s0 === peg$FAILED) {
  29576. s0 = peg$parsevariable();
  29577. if (s0 === peg$FAILED) {
  29578. s0 = peg$parsesubexpression();
  29579. }
  29580. }
  29581. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29582. return s0;
  29583. }
  29584. function peg$parsewsUnaryMessage() {
  29585. var s0, s1, s2, s3, s4;
  29586. var key = peg$currPos * 66 + 51,
  29587. cached = peg$resultsCache[key];
  29588. if (cached) {
  29589. peg$currPos = cached.nextPos;
  29590. return cached.result;
  29591. }
  29592. s0 = peg$currPos;
  29593. s1 = peg$parsews();
  29594. if (s1 !== peg$FAILED) {
  29595. s2 = peg$parseidentifier();
  29596. if (s2 !== peg$FAILED) {
  29597. s3 = peg$currPos;
  29598. peg$silentFails++;
  29599. if (input.charCodeAt(peg$currPos) === 58) {
  29600. s4 = peg$c12;
  29601. peg$currPos++;
  29602. } else {
  29603. s4 = peg$FAILED;
  29604. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29605. }
  29606. peg$silentFails--;
  29607. if (s4 === peg$FAILED) {
  29608. s3 = void 0;
  29609. } else {
  29610. peg$currPos = s3;
  29611. s3 = peg$FAILED;
  29612. }
  29613. if (s3 !== peg$FAILED) {
  29614. peg$savedPos = s0;
  29615. s1 = peg$c109(s2);
  29616. s0 = s1;
  29617. } else {
  29618. peg$currPos = s0;
  29619. s0 = peg$FAILED;
  29620. }
  29621. } else {
  29622. peg$currPos = s0;
  29623. s0 = peg$FAILED;
  29624. }
  29625. } else {
  29626. peg$currPos = s0;
  29627. s0 = peg$FAILED;
  29628. }
  29629. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29630. return s0;
  29631. }
  29632. function peg$parsewsUnaryTail() {
  29633. var s0, s1;
  29634. var key = peg$currPos * 66 + 52,
  29635. cached = peg$resultsCache[key];
  29636. if (cached) {
  29637. peg$currPos = cached.nextPos;
  29638. return cached.result;
  29639. }
  29640. s0 = [];
  29641. s1 = peg$parsewsUnaryMessage();
  29642. while (s1 !== peg$FAILED) {
  29643. s0.push(s1);
  29644. s1 = peg$parsewsUnaryMessage();
  29645. }
  29646. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29647. return s0;
  29648. }
  29649. function peg$parseunarySend() {
  29650. var s0, s1, s2;
  29651. var key = peg$currPos * 66 + 53,
  29652. cached = peg$resultsCache[key];
  29653. if (cached) {
  29654. peg$currPos = cached.nextPos;
  29655. return cached.result;
  29656. }
  29657. s0 = peg$currPos;
  29658. s1 = peg$parseoperand();
  29659. if (s1 !== peg$FAILED) {
  29660. s2 = peg$parsewsUnaryTail();
  29661. if (s2 !== peg$FAILED) {
  29662. peg$savedPos = s0;
  29663. s1 = peg$c110(s1, s2);
  29664. s0 = s1;
  29665. } else {
  29666. peg$currPos = s0;
  29667. s0 = peg$FAILED;
  29668. }
  29669. } else {
  29670. peg$currPos = s0;
  29671. s0 = peg$FAILED;
  29672. }
  29673. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29674. return s0;
  29675. }
  29676. function peg$parsewsBinaryMessage() {
  29677. var s0, s1, s2, s3, s4;
  29678. var key = peg$currPos * 66 + 54,
  29679. cached = peg$resultsCache[key];
  29680. if (cached) {
  29681. peg$currPos = cached.nextPos;
  29682. return cached.result;
  29683. }
  29684. s0 = peg$currPos;
  29685. s1 = peg$parsews();
  29686. if (s1 !== peg$FAILED) {
  29687. s2 = peg$parsebinarySelector();
  29688. if (s2 !== peg$FAILED) {
  29689. s3 = peg$parsews();
  29690. if (s3 !== peg$FAILED) {
  29691. s4 = peg$parseunarySend();
  29692. if (s4 !== peg$FAILED) {
  29693. peg$savedPos = s0;
  29694. s1 = peg$c111(s2, s4);
  29695. s0 = s1;
  29696. } else {
  29697. peg$currPos = s0;
  29698. s0 = peg$FAILED;
  29699. }
  29700. } else {
  29701. peg$currPos = s0;
  29702. s0 = peg$FAILED;
  29703. }
  29704. } else {
  29705. peg$currPos = s0;
  29706. s0 = peg$FAILED;
  29707. }
  29708. } else {
  29709. peg$currPos = s0;
  29710. s0 = peg$FAILED;
  29711. }
  29712. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29713. return s0;
  29714. }
  29715. function peg$parsewsBinaryTail() {
  29716. var s0, s1, s2, s3;
  29717. var key = peg$currPos * 66 + 55,
  29718. cached = peg$resultsCache[key];
  29719. if (cached) {
  29720. peg$currPos = cached.nextPos;
  29721. return cached.result;
  29722. }
  29723. s0 = peg$currPos;
  29724. s1 = peg$parsewsUnaryTail();
  29725. if (s1 !== peg$FAILED) {
  29726. s2 = [];
  29727. s3 = peg$parsewsBinaryMessage();
  29728. while (s3 !== peg$FAILED) {
  29729. s2.push(s3);
  29730. s3 = peg$parsewsBinaryMessage();
  29731. }
  29732. if (s2 !== peg$FAILED) {
  29733. peg$savedPos = s0;
  29734. s1 = peg$c112(s1, s2);
  29735. s0 = s1;
  29736. } else {
  29737. peg$currPos = s0;
  29738. s0 = peg$FAILED;
  29739. }
  29740. } else {
  29741. peg$currPos = s0;
  29742. s0 = peg$FAILED;
  29743. }
  29744. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29745. return s0;
  29746. }
  29747. function peg$parsebinarySend() {
  29748. var s0, s1, s2;
  29749. var key = peg$currPos * 66 + 56,
  29750. cached = peg$resultsCache[key];
  29751. if (cached) {
  29752. peg$currPos = cached.nextPos;
  29753. return cached.result;
  29754. }
  29755. s0 = peg$currPos;
  29756. s1 = peg$parseoperand();
  29757. if (s1 !== peg$FAILED) {
  29758. s2 = peg$parsewsBinaryTail();
  29759. if (s2 !== peg$FAILED) {
  29760. peg$savedPos = s0;
  29761. s1 = peg$c110(s1, s2);
  29762. s0 = s1;
  29763. } else {
  29764. peg$currPos = s0;
  29765. s0 = peg$FAILED;
  29766. }
  29767. } else {
  29768. peg$currPos = s0;
  29769. s0 = peg$FAILED;
  29770. }
  29771. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29772. return s0;
  29773. }
  29774. function peg$parsewsKeywordMessage() {
  29775. var s0, s1, s2, s3, s4, s5, s6;
  29776. var key = peg$currPos * 66 + 57,
  29777. cached = peg$resultsCache[key];
  29778. if (cached) {
  29779. peg$currPos = cached.nextPos;
  29780. return cached.result;
  29781. }
  29782. s0 = peg$currPos;
  29783. s1 = [];
  29784. s2 = peg$currPos;
  29785. s3 = peg$parsews();
  29786. if (s3 !== peg$FAILED) {
  29787. s4 = peg$parsekeyword();
  29788. if (s4 !== peg$FAILED) {
  29789. s5 = peg$parsews();
  29790. if (s5 !== peg$FAILED) {
  29791. s6 = peg$parsebinarySend();
  29792. if (s6 !== peg$FAILED) {
  29793. peg$savedPos = s2;
  29794. s3 = peg$c75(s4, s6);
  29795. s2 = s3;
  29796. } else {
  29797. peg$currPos = s2;
  29798. s2 = peg$FAILED;
  29799. }
  29800. } else {
  29801. peg$currPos = s2;
  29802. s2 = peg$FAILED;
  29803. }
  29804. } else {
  29805. peg$currPos = s2;
  29806. s2 = peg$FAILED;
  29807. }
  29808. } else {
  29809. peg$currPos = s2;
  29810. s2 = peg$FAILED;
  29811. }
  29812. if (s2 !== peg$FAILED) {
  29813. while (s2 !== peg$FAILED) {
  29814. s1.push(s2);
  29815. s2 = peg$currPos;
  29816. s3 = peg$parsews();
  29817. if (s3 !== peg$FAILED) {
  29818. s4 = peg$parsekeyword();
  29819. if (s4 !== peg$FAILED) {
  29820. s5 = peg$parsews();
  29821. if (s5 !== peg$FAILED) {
  29822. s6 = peg$parsebinarySend();
  29823. if (s6 !== peg$FAILED) {
  29824. peg$savedPos = s2;
  29825. s3 = peg$c75(s4, s6);
  29826. s2 = s3;
  29827. } else {
  29828. peg$currPos = s2;
  29829. s2 = peg$FAILED;
  29830. }
  29831. } else {
  29832. peg$currPos = s2;
  29833. s2 = peg$FAILED;
  29834. }
  29835. } else {
  29836. peg$currPos = s2;
  29837. s2 = peg$FAILED;
  29838. }
  29839. } else {
  29840. peg$currPos = s2;
  29841. s2 = peg$FAILED;
  29842. }
  29843. }
  29844. } else {
  29845. s1 = peg$FAILED;
  29846. }
  29847. if (s1 !== peg$FAILED) {
  29848. peg$savedPos = s0;
  29849. s1 = peg$c113(s1);
  29850. }
  29851. s0 = s1;
  29852. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29853. return s0;
  29854. }
  29855. function peg$parsewsKeywordTail() {
  29856. var s0, s1, s2;
  29857. var key = peg$currPos * 66 + 58,
  29858. cached = peg$resultsCache[key];
  29859. if (cached) {
  29860. peg$currPos = cached.nextPos;
  29861. return cached.result;
  29862. }
  29863. s0 = peg$currPos;
  29864. s1 = peg$parsewsBinaryTail();
  29865. if (s1 !== peg$FAILED) {
  29866. s2 = peg$parsewsKeywordMessage();
  29867. if (s2 === peg$FAILED) {
  29868. s2 = null;
  29869. }
  29870. if (s2 !== peg$FAILED) {
  29871. peg$savedPos = s0;
  29872. s1 = peg$c114(s1, s2);
  29873. s0 = s1;
  29874. } else {
  29875. peg$currPos = s0;
  29876. s0 = peg$FAILED;
  29877. }
  29878. } else {
  29879. peg$currPos = s0;
  29880. s0 = peg$FAILED;
  29881. }
  29882. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29883. return s0;
  29884. }
  29885. function peg$parsekeywordSend() {
  29886. var s0, s1, s2;
  29887. var key = peg$currPos * 66 + 59,
  29888. cached = peg$resultsCache[key];
  29889. if (cached) {
  29890. peg$currPos = cached.nextPos;
  29891. return cached.result;
  29892. }
  29893. s0 = peg$currPos;
  29894. s1 = peg$parseoperand();
  29895. if (s1 !== peg$FAILED) {
  29896. s2 = peg$parsewsKeywordTail();
  29897. if (s2 !== peg$FAILED) {
  29898. peg$savedPos = s0;
  29899. s1 = peg$c110(s1, s2);
  29900. s0 = s1;
  29901. } else {
  29902. peg$currPos = s0;
  29903. s0 = peg$FAILED;
  29904. }
  29905. } else {
  29906. peg$currPos = s0;
  29907. s0 = peg$FAILED;
  29908. }
  29909. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29910. return s0;
  29911. }
  29912. function peg$parsewsMessage() {
  29913. var s0;
  29914. var key = peg$currPos * 66 + 60,
  29915. cached = peg$resultsCache[key];
  29916. if (cached) {
  29917. peg$currPos = cached.nextPos;
  29918. return cached.result;
  29919. }
  29920. s0 = peg$parsewsBinaryMessage();
  29921. if (s0 === peg$FAILED) {
  29922. s0 = peg$parsewsUnaryMessage();
  29923. if (s0 === peg$FAILED) {
  29924. s0 = peg$parsewsKeywordMessage();
  29925. }
  29926. }
  29927. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29928. return s0;
  29929. }
  29930. function peg$parsecascade() {
  29931. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  29932. var key = peg$currPos * 66 + 61,
  29933. cached = peg$resultsCache[key];
  29934. if (cached) {
  29935. peg$currPos = cached.nextPos;
  29936. return cached.result;
  29937. }
  29938. s0 = peg$currPos;
  29939. s1 = peg$parseoperand();
  29940. if (s1 !== peg$FAILED) {
  29941. s2 = peg$parsewsKeywordTail();
  29942. if (s2 !== peg$FAILED) {
  29943. peg$savedPos = peg$currPos;
  29944. s3 = peg$c115(s1, s2);
  29945. if (s3) {
  29946. s3 = void 0;
  29947. } else {
  29948. s3 = peg$FAILED;
  29949. }
  29950. if (s3 !== peg$FAILED) {
  29951. s4 = [];
  29952. s5 = peg$currPos;
  29953. s6 = peg$parsews();
  29954. if (s6 !== peg$FAILED) {
  29955. if (input.charCodeAt(peg$currPos) === 59) {
  29956. s7 = peg$c116;
  29957. peg$currPos++;
  29958. } else {
  29959. s7 = peg$FAILED;
  29960. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29961. }
  29962. if (s7 !== peg$FAILED) {
  29963. s8 = peg$parsewsMessage();
  29964. if (s8 !== peg$FAILED) {
  29965. peg$savedPos = s5;
  29966. s6 = peg$c118(s1, s2, s8);
  29967. s5 = s6;
  29968. } else {
  29969. peg$currPos = s5;
  29970. s5 = peg$FAILED;
  29971. }
  29972. } else {
  29973. peg$currPos = s5;
  29974. s5 = peg$FAILED;
  29975. }
  29976. } else {
  29977. peg$currPos = s5;
  29978. s5 = peg$FAILED;
  29979. }
  29980. if (s5 !== peg$FAILED) {
  29981. while (s5 !== peg$FAILED) {
  29982. s4.push(s5);
  29983. s5 = peg$currPos;
  29984. s6 = peg$parsews();
  29985. if (s6 !== peg$FAILED) {
  29986. if (input.charCodeAt(peg$currPos) === 59) {
  29987. s7 = peg$c116;
  29988. peg$currPos++;
  29989. } else {
  29990. s7 = peg$FAILED;
  29991. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29992. }
  29993. if (s7 !== peg$FAILED) {
  29994. s8 = peg$parsewsMessage();
  29995. if (s8 !== peg$FAILED) {
  29996. peg$savedPos = s5;
  29997. s6 = peg$c118(s1, s2, s8);
  29998. s5 = s6;
  29999. } else {
  30000. peg$currPos = s5;
  30001. s5 = peg$FAILED;
  30002. }
  30003. } else {
  30004. peg$currPos = s5;
  30005. s5 = peg$FAILED;
  30006. }
  30007. } else {
  30008. peg$currPos = s5;
  30009. s5 = peg$FAILED;
  30010. }
  30011. }
  30012. } else {
  30013. s4 = peg$FAILED;
  30014. }
  30015. if (s4 !== peg$FAILED) {
  30016. peg$savedPos = s0;
  30017. s1 = peg$c119(s1, s2, s4);
  30018. s0 = s1;
  30019. } else {
  30020. peg$currPos = s0;
  30021. s0 = peg$FAILED;
  30022. }
  30023. } else {
  30024. peg$currPos = s0;
  30025. s0 = peg$FAILED;
  30026. }
  30027. } else {
  30028. peg$currPos = s0;
  30029. s0 = peg$FAILED;
  30030. }
  30031. } else {
  30032. peg$currPos = s0;
  30033. s0 = peg$FAILED;
  30034. }
  30035. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30036. return s0;
  30037. }
  30038. function peg$parsemethod() {
  30039. var s0, s1, s2;
  30040. var key = peg$currPos * 66 + 62,
  30041. cached = peg$resultsCache[key];
  30042. if (cached) {
  30043. peg$currPos = cached.nextPos;
  30044. return cached.result;
  30045. }
  30046. s0 = peg$currPos;
  30047. s1 = peg$parsewsKeywordPattern();
  30048. if (s1 === peg$FAILED) {
  30049. s1 = peg$parsewsBinaryPattern();
  30050. if (s1 === peg$FAILED) {
  30051. s1 = peg$parsewsUnaryPattern();
  30052. }
  30053. }
  30054. if (s1 !== peg$FAILED) {
  30055. s2 = peg$parsewsSequenceWs();
  30056. if (s2 !== peg$FAILED) {
  30057. peg$savedPos = s0;
  30058. s1 = peg$c120(s1, s2);
  30059. s0 = s1;
  30060. } else {
  30061. peg$currPos = s0;
  30062. s0 = peg$FAILED;
  30063. }
  30064. } else {
  30065. peg$currPos = s0;
  30066. s0 = peg$FAILED;
  30067. }
  30068. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30069. return s0;
  30070. }
  30071. function peg$parseassociationSend() {
  30072. var s0, s1, s2, s3;
  30073. var key = peg$currPos * 66 + 63,
  30074. cached = peg$resultsCache[key];
  30075. if (cached) {
  30076. peg$currPos = cached.nextPos;
  30077. return cached.result;
  30078. }
  30079. s0 = peg$currPos;
  30080. s1 = peg$parseoperand();
  30081. if (s1 !== peg$FAILED) {
  30082. s2 = peg$parsewsBinaryTail();
  30083. if (s2 !== peg$FAILED) {
  30084. peg$savedPos = peg$currPos;
  30085. s3 = peg$c121(s1, s2);
  30086. if (s3) {
  30087. s3 = void 0;
  30088. } else {
  30089. s3 = peg$FAILED;
  30090. }
  30091. if (s3 !== peg$FAILED) {
  30092. peg$savedPos = s0;
  30093. s1 = peg$c122(s1, s2);
  30094. s0 = s1;
  30095. } else {
  30096. peg$currPos = s0;
  30097. s0 = peg$FAILED;
  30098. }
  30099. } else {
  30100. peg$currPos = s0;
  30101. s0 = peg$FAILED;
  30102. }
  30103. } else {
  30104. peg$currPos = s0;
  30105. s0 = peg$FAILED;
  30106. }
  30107. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30108. return s0;
  30109. }
  30110. function peg$parsewsAssociationsRest() {
  30111. var s0, s1, s2;
  30112. var key = peg$currPos * 66 + 64,
  30113. cached = peg$resultsCache[key];
  30114. if (cached) {
  30115. peg$currPos = cached.nextPos;
  30116. return cached.result;
  30117. }
  30118. s0 = peg$currPos;
  30119. s1 = peg$parsesomeDotsWs();
  30120. if (s1 !== peg$FAILED) {
  30121. s2 = peg$parseassociationSend();
  30122. if (s2 !== peg$FAILED) {
  30123. peg$savedPos = s0;
  30124. s1 = peg$c79(s2);
  30125. s0 = s1;
  30126. } else {
  30127. peg$currPos = s0;
  30128. s0 = peg$FAILED;
  30129. }
  30130. } else {
  30131. peg$currPos = s0;
  30132. s0 = peg$FAILED;
  30133. }
  30134. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30135. return s0;
  30136. }
  30137. function peg$parsewsAssociations() {
  30138. var s0, s1, s2, s3, s4;
  30139. var key = peg$currPos * 66 + 65,
  30140. cached = peg$resultsCache[key];
  30141. if (cached) {
  30142. peg$currPos = cached.nextPos;
  30143. return cached.result;
  30144. }
  30145. s0 = peg$currPos;
  30146. s1 = peg$parsemaybeDotsWs();
  30147. if (s1 !== peg$FAILED) {
  30148. s2 = peg$parseassociationSend();
  30149. if (s2 !== peg$FAILED) {
  30150. s3 = [];
  30151. s4 = peg$parsewsAssociationsRest();
  30152. while (s4 !== peg$FAILED) {
  30153. s3.push(s4);
  30154. s4 = peg$parsewsAssociationsRest();
  30155. }
  30156. if (s3 !== peg$FAILED) {
  30157. peg$savedPos = s0;
  30158. s1 = peg$c123(s2, s3);
  30159. s0 = s1;
  30160. } else {
  30161. peg$currPos = s0;
  30162. s0 = peg$FAILED;
  30163. }
  30164. } else {
  30165. peg$currPos = s0;
  30166. s0 = peg$FAILED;
  30167. }
  30168. } else {
  30169. peg$currPos = s0;
  30170. s0 = peg$FAILED;
  30171. }
  30172. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30173. return s0;
  30174. }
  30175. peg$result = peg$startRuleFunction();
  30176. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30177. return peg$result;
  30178. } else {
  30179. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30180. peg$fail({ type: "end", description: "end of input" });
  30181. }
  30182. throw peg$buildException(
  30183. null,
  30184. peg$maxFailExpected,
  30185. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30186. peg$maxFailPos < input.length
  30187. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30188. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30189. );
  30190. }
  30191. }
  30192. return {
  30193. SyntaxError: peg$SyntaxError,
  30194. parse: peg$parse
  30195. };
  30196. })();
  30197. });
  30198. define('amber_core/Platform-ImportExport',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30199. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30200. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30201. var $pkg = $core.addPackage("Platform-ImportExport");
  30202. $pkg.innerEval = function (expr) { return eval(expr); };
  30203. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  30204. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30205. $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.";
  30206. $core.addMethod(
  30207. $core.method({
  30208. selector: "exportPackage:on:",
  30209. protocol: "output",
  30210. fn: function (aPackage,aStream){
  30211. var self=this,$self=this;
  30212. return $core.withContext(function($ctx1) {
  30213. $self._subclassResponsibility();
  30214. return self;
  30215. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30216. },
  30217. args: ["aPackage", "aStream"],
  30218. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30219. referencedClasses: [],
  30220. messageSends: ["subclassResponsibility"]
  30221. }),
  30222. $globals.AbstractExporter);
  30223. $core.addMethod(
  30224. $core.method({
  30225. selector: "extensionMethodsOfPackage:",
  30226. protocol: "accessing",
  30227. fn: function (aPackage){
  30228. var self=this,$self=this;
  30229. var result;
  30230. return $core.withContext(function($ctx1) {
  30231. result=$recv($globals.OrderedCollection)._new();
  30232. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30233. return $core.withContext(function($ctx2) {
  30234. return $recv(result)._addAll_($recv(each)._ownMethods());
  30235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30236. }));
  30237. return result;
  30238. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30239. },
  30240. args: ["aPackage"],
  30241. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each ownMethods ].\x0a\x09\x09\x0a\x09^ result",
  30242. referencedClasses: ["OrderedCollection"],
  30243. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30244. }),
  30245. $globals.AbstractExporter);
  30246. $core.addMethod(
  30247. $core.method({
  30248. selector: "extensionProtocolsOfPackage:",
  30249. protocol: "accessing",
  30250. fn: function (aPackage){
  30251. var self=this,$self=this;
  30252. var extensionName,result;
  30253. return $core.withContext(function($ctx1) {
  30254. var $1,$2,$3;
  30255. $1=$recv(aPackage)._name();
  30256. $ctx1.sendIdx["name"]=1;
  30257. extensionName="*".__comma($1);
  30258. result=$recv($globals.OrderedCollection)._new();
  30259. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30260. return $core.withContext(function($ctx2) {
  30261. $2=$recv(a)._name();
  30262. $ctx2.sendIdx["name"]=2;
  30263. return $recv($2).__lt($recv(b)._name());
  30264. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30265. })))._do_((function(each){
  30266. return $core.withContext(function($ctx2) {
  30267. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30268. return $core.withContext(function($ctx3) {
  30269. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30270. if($core.assert($3)){
  30271. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30272. }
  30273. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30274. }));
  30275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30276. }));
  30277. $ctx1.sendIdx["do:"]=1;
  30278. return result;
  30279. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30280. },
  30281. args: ["aPackage"],
  30282. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09({each. each theMetaClass} copyWithout: nil) do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  30283. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30284. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30285. }),
  30286. $globals.AbstractExporter);
  30287. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30288. $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.";
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "chunkEscape:",
  30292. protocol: "convenience",
  30293. fn: function (aString){
  30294. var self=this,$self=this;
  30295. return $core.withContext(function($ctx1) {
  30296. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30297. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30298. },
  30299. args: ["aString"],
  30300. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30301. referencedClasses: [],
  30302. messageSends: ["trimBoth", "replace:with:"]
  30303. }),
  30304. $globals.ChunkExporter);
  30305. $core.addMethod(
  30306. $core.method({
  30307. selector: "exportBehavior:on:",
  30308. protocol: "output",
  30309. fn: function (aBehavior,aStream){
  30310. var self=this,$self=this;
  30311. return $core.withContext(function($ctx1) {
  30312. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30313. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30314. return self;
  30315. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30316. },
  30317. args: ["aBehavior", "aStream"],
  30318. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30319. referencedClasses: [],
  30320. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30321. }),
  30322. $globals.ChunkExporter);
  30323. $core.addMethod(
  30324. $core.method({
  30325. selector: "exportCategoryEpilogueOf:on:",
  30326. protocol: "output",
  30327. fn: function (aCategory,aStream){
  30328. var self=this,$self=this;
  30329. return $core.withContext(function($ctx1) {
  30330. $recv(aStream)._write_(" !");
  30331. $recv(aStream)._lf();
  30332. $ctx1.sendIdx["lf"]=1;
  30333. $recv(aStream)._lf();
  30334. return self;
  30335. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30336. },
  30337. args: ["aCategory", "aStream"],
  30338. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30339. referencedClasses: [],
  30340. messageSends: ["write:", "lf"]
  30341. }),
  30342. $globals.ChunkExporter);
  30343. $core.addMethod(
  30344. $core.method({
  30345. selector: "exportCategoryPrologueOf:on:",
  30346. protocol: "output",
  30347. fn: function (aCategory,aStream){
  30348. var self=this,$self=this;
  30349. return $core.withContext(function($ctx1) {
  30350. $recv(aStream)._write_("!");
  30351. $ctx1.sendIdx["write:"]=1;
  30352. $recv(aStream)._print_($recv(aCategory)._theClass());
  30353. $ctx1.sendIdx["print:"]=1;
  30354. $recv(aStream)._write_(" methodsFor: ");
  30355. $ctx1.sendIdx["write:"]=2;
  30356. $recv(aStream)._print_(aCategory);
  30357. $recv(aStream)._write_("!");
  30358. return self;
  30359. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30360. },
  30361. args: ["aCategory", "aStream"],
  30362. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aCategory theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aCategory;\x0a\x09\x09write: '!'",
  30363. referencedClasses: [],
  30364. messageSends: ["write:", "print:", "theClass"]
  30365. }),
  30366. $globals.ChunkExporter);
  30367. $core.addMethod(
  30368. $core.method({
  30369. selector: "exportDefinitionOf:on:",
  30370. protocol: "output",
  30371. fn: function (aClass,aStream){
  30372. var self=this,$self=this;
  30373. return $core.withContext(function($ctx1) {
  30374. var $1,$2,$3,$4;
  30375. $recv(aStream)._print_($recv(aClass)._superclass());
  30376. $ctx1.sendIdx["print:"]=1;
  30377. $recv(aStream)._write_(" subclass: ");
  30378. $ctx1.sendIdx["write:"]=1;
  30379. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30380. $1=$recv(aStream)._lf();
  30381. $ctx1.sendIdx["lf"]=1;
  30382. $recv(aStream)._tab();
  30383. $ctx1.sendIdx["tab"]=1;
  30384. $recv(aStream)._write_("instanceVariableNames: ");
  30385. $ctx1.sendIdx["write:"]=2;
  30386. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30387. $ctx1.sendIdx["print:"]=2;
  30388. $recv(aStream)._lf();
  30389. $ctx1.sendIdx["lf"]=2;
  30390. $recv(aStream)._tab();
  30391. $recv(aStream)._write_("package: ");
  30392. $ctx1.sendIdx["write:"]=3;
  30393. $recv(aStream)._print_($recv(aClass)._category());
  30394. $ctx1.sendIdx["print:"]=3;
  30395. $recv(aStream)._write_("!");
  30396. $ctx1.sendIdx["write:"]=4;
  30397. $2=$recv(aStream)._lf();
  30398. $ctx1.sendIdx["lf"]=3;
  30399. $3=$recv(aClass)._comment();
  30400. $ctx1.sendIdx["comment"]=1;
  30401. $recv($3)._ifNotEmpty_((function(){
  30402. return $core.withContext(function($ctx2) {
  30403. $recv(aStream)._write_("!");
  30404. $ctx2.sendIdx["write:"]=5;
  30405. $recv(aStream)._print_(aClass);
  30406. $recv(aStream)._write_(" commentStamp!");
  30407. $ctx2.sendIdx["write:"]=6;
  30408. $recv(aStream)._lf();
  30409. $ctx2.sendIdx["lf"]=4;
  30410. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30411. $4=$recv(aStream)._lf();
  30412. $ctx2.sendIdx["lf"]=5;
  30413. return $4;
  30414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30415. }));
  30416. $recv(aStream)._lf();
  30417. return self;
  30418. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30419. },
  30420. args: ["aClass", "aStream"],
  30421. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09print: aClass superclass;\x0a\x09\x09write: ' subclass: ';\x0a\x09\x09printSymbol: aClass name;\x0a\x09\x09lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab;\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: aClass instanceVariableNames);\x0a\x09\x09lf;\x0a\x09\x09tab;\x0a\x09\x09write: 'package: ';\x0a\x09\x09print: aClass category;\x0a\x09\x09write: '!';\x0a\x09\x09lf.\x0a\x09aClass comment ifNotEmpty: [ aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  30422. referencedClasses: [],
  30423. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30424. }),
  30425. $globals.ChunkExporter);
  30426. $core.addMethod(
  30427. $core.method({
  30428. selector: "exportMetaDefinitionOf:on:",
  30429. protocol: "output",
  30430. fn: function (aClass,aStream){
  30431. var self=this,$self=this;
  30432. var classIvars,classTraitComposition;
  30433. return $core.withContext(function($ctx1) {
  30434. var $1,$2;
  30435. $1=$recv(aClass)._class();
  30436. $ctx1.sendIdx["class"]=1;
  30437. classIvars=$recv($1)._instanceVariableNames();
  30438. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30439. $2=$recv(classIvars)._notEmpty();
  30440. if($core.assert($2)){
  30441. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30442. $ctx1.sendIdx["print:"]=1;
  30443. $recv(aStream)._space();
  30444. $recv(aStream)._write_("instanceVariableNames: ");
  30445. $ctx1.sendIdx["write:"]=1;
  30446. $recv(aStream)._print_(" "._join_(classIvars));
  30447. $recv(aStream)._write_("!");
  30448. $recv(aStream)._lf();
  30449. $ctx1.sendIdx["lf"]=1;
  30450. $recv(aStream)._lf();
  30451. }
  30452. return self;
  30453. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30454. },
  30455. args: ["aClass", "aStream"],
  30456. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09| classIvars classTraitComposition |\x0a\x09classIvars := aClass class instanceVariableNames.\x0a\x09classTraitComposition := aClass class traitComposition.\x0a\x0a\x09(classIvars notEmpty \x22or: [classTraitComposition notEmpty]\x22) ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09print: aClass theMetaClass.\x0a\x09\x09aStream space. \x22classTraitComposition\x0a\x09\x09\x09ifEmpty: [ aStream space ]\x0a\x09\x09\x09ifNotEmpty: [ aStream lf; tab; write: {'uses: '. aClass class traitCompositionDefinition}; lf; tab ].\x22\x0a\x09\x09aStream\x0a\x09\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09\x09print: (' ' join: classIvars);\x0a\x09\x09\x09write: '!'; lf; lf ]",
  30457. referencedClasses: [],
  30458. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30459. }),
  30460. $globals.ChunkExporter);
  30461. $core.addMethod(
  30462. $core.method({
  30463. selector: "exportMethod:on:",
  30464. protocol: "output",
  30465. fn: function (aMethod,aStream){
  30466. var self=this,$self=this;
  30467. return $core.withContext(function($ctx1) {
  30468. $recv(aStream)._lf();
  30469. $ctx1.sendIdx["lf"]=1;
  30470. $recv(aStream)._lf();
  30471. $ctx1.sendIdx["lf"]=2;
  30472. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30473. $ctx1.sendIdx["write:"]=1;
  30474. $recv(aStream)._lf();
  30475. $recv(aStream)._write_("!");
  30476. return self;
  30477. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30478. },
  30479. args: ["aMethod", "aStream"],
  30480. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30481. referencedClasses: [],
  30482. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30483. }),
  30484. $globals.ChunkExporter);
  30485. $core.addMethod(
  30486. $core.method({
  30487. selector: "exportPackage:on:",
  30488. protocol: "output",
  30489. fn: function (aPackage,aStream){
  30490. var self=this,$self=this;
  30491. return $core.withContext(function($ctx1) {
  30492. var $1,$receiver;
  30493. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30494. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30495. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30496. return $core.withContext(function($ctx2) {
  30497. $self._exportBehavior_on_(each,aStream);
  30498. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30499. $1=$recv(each)._theMetaClass();
  30500. if(($receiver = $1) == null || $receiver.a$nil){
  30501. return $1;
  30502. } else {
  30503. var meta;
  30504. meta=$receiver;
  30505. return $self._exportBehavior_on_(meta,aStream);
  30506. }
  30507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30508. }));
  30509. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30510. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30511. return self;
  30512. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30513. },
  30514. args: ["aPackage", "aStream"],
  30515. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  30516. referencedClasses: [],
  30517. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30518. }),
  30519. $globals.ChunkExporter);
  30520. $core.addMethod(
  30521. $core.method({
  30522. selector: "exportPackageDefinitionOf:on:",
  30523. protocol: "output",
  30524. fn: function (aPackage,aStream){
  30525. var self=this,$self=this;
  30526. return $core.withContext(function($ctx1) {
  30527. $recv(aStream)._write_("Smalltalk createPackage: ");
  30528. $ctx1.sendIdx["write:"]=1;
  30529. $recv(aStream)._print_($recv(aPackage)._name());
  30530. $recv(aStream)._write_("!");
  30531. $recv(aStream)._lf();
  30532. return self;
  30533. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30534. },
  30535. args: ["aPackage", "aStream"],
  30536. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30537. referencedClasses: [],
  30538. messageSends: ["write:", "print:", "name", "lf"]
  30539. }),
  30540. $globals.ChunkExporter);
  30541. $core.addMethod(
  30542. $core.method({
  30543. selector: "exportPackageImportsOf:on:",
  30544. protocol: "output",
  30545. fn: function (aPackage,aStream){
  30546. var self=this,$self=this;
  30547. return $core.withContext(function($ctx1) {
  30548. var $1;
  30549. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30550. return $core.withContext(function($ctx2) {
  30551. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30552. $ctx2.sendIdx["write:"]=1;
  30553. $1=$recv(aPackage)._name();
  30554. $ctx2.sendIdx["name"]=1;
  30555. $recv(aStream)._print_($1);
  30556. $ctx2.sendIdx["print:"]=1;
  30557. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30558. $ctx2.sendIdx["write:"]=2;
  30559. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30560. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30561. return $recv(aStream)._lf();
  30562. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30563. }));
  30564. return self;
  30565. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30566. },
  30567. args: ["aPackage", "aStream"],
  30568. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: ' ifAbsent: [ self error: ';\x0a\x09\x09print: 'Package not created: ', aPackage name;\x0a\x09\x09write: { ' ]) imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30569. referencedClasses: [],
  30570. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30571. }),
  30572. $globals.ChunkExporter);
  30573. $core.addMethod(
  30574. $core.method({
  30575. selector: "exportPackageTraitCompositionsOf:on:",
  30576. protocol: "output",
  30577. fn: function (aPackage,aStream){
  30578. var self=this,$self=this;
  30579. return $core.withContext(function($ctx1) {
  30580. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30581. return $core.withContext(function($ctx2) {
  30582. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30583. return $core.withContext(function($ctx3) {
  30584. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30585. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30586. }));
  30587. $recv(aStream)._write_("! !");
  30588. $recv(aStream)._lf();
  30589. $ctx2.sendIdx["lf"]=1;
  30590. return $recv(aStream)._lf();
  30591. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30592. }));
  30593. return self;
  30594. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30595. },
  30596. args: ["aPackage", "aStream"],
  30597. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream write: '! !'; lf; lf ]",
  30598. referencedClasses: [],
  30599. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30600. }),
  30601. $globals.ChunkExporter);
  30602. $core.addMethod(
  30603. $core.method({
  30604. selector: "exportProtocol:on:",
  30605. protocol: "output",
  30606. fn: function (aProtocol,aStream){
  30607. var self=this,$self=this;
  30608. return $core.withContext(function($ctx1) {
  30609. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30610. return $core.withContext(function($ctx2) {
  30611. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30612. $recv(methods)._do_((function(method){
  30613. return $core.withContext(function($ctx3) {
  30614. return $self._exportMethod_on_(method,aStream);
  30615. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30616. }));
  30617. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30618. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30619. }));
  30620. return self;
  30621. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30622. },
  30623. args: ["aProtocol", "aStream"],
  30624. source: "exportProtocol: aProtocol on: aStream\x0a\x09aProtocol ownMethods ifNotEmpty: [ :methods |\x0a\x09\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09\x09methods do: [ :method | \x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09self exportProtocolEpilogueOf: aProtocol on: aStream ]",
  30625. referencedClasses: [],
  30626. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30627. }),
  30628. $globals.ChunkExporter);
  30629. $core.addMethod(
  30630. $core.method({
  30631. selector: "exportProtocolEpilogueOf:on:",
  30632. protocol: "output",
  30633. fn: function (aProtocol,aStream){
  30634. var self=this,$self=this;
  30635. return $core.withContext(function($ctx1) {
  30636. $recv(aStream)._write_(" !");
  30637. $recv(aStream)._lf();
  30638. $ctx1.sendIdx["lf"]=1;
  30639. $recv(aStream)._lf();
  30640. return self;
  30641. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30642. },
  30643. args: ["aProtocol", "aStream"],
  30644. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30645. referencedClasses: [],
  30646. messageSends: ["write:", "lf"]
  30647. }),
  30648. $globals.ChunkExporter);
  30649. $core.addMethod(
  30650. $core.method({
  30651. selector: "exportProtocolPrologueOf:on:",
  30652. protocol: "output",
  30653. fn: function (aProtocol,aStream){
  30654. var self=this,$self=this;
  30655. return $core.withContext(function($ctx1) {
  30656. $recv(aStream)._write_("!");
  30657. $ctx1.sendIdx["write:"]=1;
  30658. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30659. $ctx1.sendIdx["print:"]=1;
  30660. $recv(aStream)._write_(" methodsFor: ");
  30661. $ctx1.sendIdx["write:"]=2;
  30662. $recv(aStream)._print_($recv(aProtocol)._name());
  30663. $recv(aStream)._write_("!");
  30664. return self;
  30665. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30666. },
  30667. args: ["aProtocol", "aStream"],
  30668. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aProtocol theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aProtocol name;\x0a\x09\x09write: '!'",
  30669. referencedClasses: [],
  30670. messageSends: ["write:", "print:", "theClass", "name"]
  30671. }),
  30672. $globals.ChunkExporter);
  30673. $core.addMethod(
  30674. $core.method({
  30675. selector: "exportProtocols:on:",
  30676. protocol: "output",
  30677. fn: function (aCollection,aStream){
  30678. var self=this,$self=this;
  30679. return $core.withContext(function($ctx1) {
  30680. $recv(aCollection)._do_((function(each){
  30681. return $core.withContext(function($ctx2) {
  30682. return $self._exportProtocol_on_(each,aStream);
  30683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30684. }));
  30685. return self;
  30686. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30687. },
  30688. args: ["aCollection", "aStream"],
  30689. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30690. referencedClasses: [],
  30691. messageSends: ["do:", "exportProtocol:on:"]
  30692. }),
  30693. $globals.ChunkExporter);
  30694. $core.addMethod(
  30695. $core.method({
  30696. selector: "exportTraitComposition:of:on:",
  30697. protocol: "output",
  30698. fn: function (aTraitComposition,aBehavior,aStream){
  30699. var self=this,$self=this;
  30700. return $core.withContext(function($ctx1) {
  30701. $recv(aStream)._print_(aBehavior);
  30702. $recv(aStream)._write_(" setTraitComposition: ");
  30703. $ctx1.sendIdx["write:"]=1;
  30704. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30705. $ctx1.sendIdx["write:"]=2;
  30706. $recv(aStream)._write_(" asTraitComposition!");
  30707. $recv(aStream)._lf();
  30708. return self;
  30709. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30710. },
  30711. args: ["aTraitComposition", "aBehavior", "aStream"],
  30712. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream \x0a\x09\x09print: aBehavior;\x0a\x09\x09write: ' setTraitComposition: ';\x0a\x09\x09write: aBehavior traitCompositionDefinition;\x0a\x09\x09write: ' asTraitComposition!';\x0a\x09\x09lf",
  30713. referencedClasses: [],
  30714. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30715. }),
  30716. $globals.ChunkExporter);
  30717. $core.addMethod(
  30718. $core.method({
  30719. selector: "exportTraitDefinitionOf:on:",
  30720. protocol: "output",
  30721. fn: function (aClass,aStream){
  30722. var self=this,$self=this;
  30723. return $core.withContext(function($ctx1) {
  30724. var $1,$2,$3,$4;
  30725. $recv(aStream)._write_("Trait named: ");
  30726. $ctx1.sendIdx["write:"]=1;
  30727. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30728. $1=$recv(aStream)._lf();
  30729. $ctx1.sendIdx["lf"]=1;
  30730. $recv(aStream)._tab();
  30731. $recv(aStream)._write_("package: ");
  30732. $ctx1.sendIdx["write:"]=2;
  30733. $recv(aStream)._print_($recv(aClass)._category());
  30734. $ctx1.sendIdx["print:"]=1;
  30735. $recv(aStream)._write_("!");
  30736. $ctx1.sendIdx["write:"]=3;
  30737. $2=$recv(aStream)._lf();
  30738. $ctx1.sendIdx["lf"]=2;
  30739. $3=$recv(aClass)._comment();
  30740. $ctx1.sendIdx["comment"]=1;
  30741. $recv($3)._ifNotEmpty_((function(){
  30742. return $core.withContext(function($ctx2) {
  30743. $recv(aStream)._write_("!");
  30744. $ctx2.sendIdx["write:"]=4;
  30745. $recv(aStream)._print_(aClass);
  30746. $recv(aStream)._write_(" commentStamp!");
  30747. $ctx2.sendIdx["write:"]=5;
  30748. $recv(aStream)._lf();
  30749. $ctx2.sendIdx["lf"]=3;
  30750. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30751. $4=$recv(aStream)._lf();
  30752. $ctx2.sendIdx["lf"]=4;
  30753. return $4;
  30754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30755. }));
  30756. $recv(aStream)._lf();
  30757. return self;
  30758. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30759. },
  30760. args: ["aClass", "aStream"],
  30761. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09write: 'Trait named: '; printSymbol: aClass name; lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab; write: 'package: '; print:\x09aClass category; write: '!'; lf.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  30762. referencedClasses: [],
  30763. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30764. }),
  30765. $globals.ChunkExporter);
  30766. $core.addMethod(
  30767. $core.method({
  30768. selector: "extensionCategoriesOfPackage:",
  30769. protocol: "accessing",
  30770. fn: function (aPackage){
  30771. var self=this,$self=this;
  30772. var name,map,result;
  30773. return $core.withContext(function($ctx1) {
  30774. var $1;
  30775. name=$recv(aPackage)._name();
  30776. result=$recv($globals.OrderedCollection)._new();
  30777. $ctx1.sendIdx["new"]=1;
  30778. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30779. return $core.withContext(function($ctx2) {
  30780. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30781. return $core.withContext(function($ctx3) {
  30782. map=$recv($globals.Dictionary)._new();
  30783. $recv(aClass)._protocolsDo_((function(category,methods){
  30784. return $core.withContext(function($ctx4) {
  30785. $1=$recv(category).__eq("*".__comma(name));
  30786. if($core.assert($1)){
  30787. return $recv(map)._at_put_(category,methods);
  30788. }
  30789. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30790. }));
  30791. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30792. return $core.withContext(function($ctx4) {
  30793. return $recv(a).__lt_eq(b);
  30794. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30795. })))._collect_((function(category){
  30796. return $core.withContext(function($ctx4) {
  30797. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30798. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30799. })));
  30800. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30801. }));
  30802. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30803. }));
  30804. $ctx1.sendIdx["do:"]=1;
  30805. return result;
  30806. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30807. },
  30808. args: ["aPackage"],
  30809. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each theMetaClass} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  30810. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30811. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30812. }),
  30813. $globals.ChunkExporter);
  30814. $core.addMethod(
  30815. $core.method({
  30816. selector: "ownCategoriesOfClass:",
  30817. protocol: "accessing",
  30818. fn: function (aClass){
  30819. var self=this,$self=this;
  30820. var map;
  30821. return $core.withContext(function($ctx1) {
  30822. var $1;
  30823. map=$recv($globals.Dictionary)._new();
  30824. $recv(aClass)._protocolsDo_((function(each,methods){
  30825. return $core.withContext(function($ctx2) {
  30826. $1=$recv(each)._match_("^\x5c*");
  30827. if(!$core.assert($1)){
  30828. return $recv(map)._at_put_(each,methods);
  30829. }
  30830. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30831. }));
  30832. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30833. return $core.withContext(function($ctx2) {
  30834. return $recv(a).__lt_eq(b);
  30835. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30836. })))._collect_((function(each){
  30837. return $core.withContext(function($ctx2) {
  30838. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30840. }));
  30841. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30842. },
  30843. args: ["aClass"],
  30844. 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) ]",
  30845. referencedClasses: ["Dictionary", "MethodCategory"],
  30846. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30847. }),
  30848. $globals.ChunkExporter);
  30849. $core.addMethod(
  30850. $core.method({
  30851. selector: "ownCategoriesOfMetaClass:",
  30852. protocol: "accessing",
  30853. fn: function (aClass){
  30854. var self=this,$self=this;
  30855. return $core.withContext(function($ctx1) {
  30856. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30857. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30858. },
  30859. args: ["aClass"],
  30860. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30861. referencedClasses: [],
  30862. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30863. }),
  30864. $globals.ChunkExporter);
  30865. $core.addMethod(
  30866. $core.method({
  30867. selector: "ownMethodProtocolsOfClass:",
  30868. protocol: "accessing",
  30869. fn: function (aClass){
  30870. var self=this,$self=this;
  30871. return $core.withContext(function($ctx1) {
  30872. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30873. return $core.withContext(function($ctx2) {
  30874. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30876. }));
  30877. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30878. },
  30879. args: ["aClass"],
  30880. 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 ]",
  30881. referencedClasses: ["ExportMethodProtocol"],
  30882. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30883. }),
  30884. $globals.ChunkExporter);
  30885. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30886. $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.).";
  30887. $core.addMethod(
  30888. $core.method({
  30889. selector: "exportBehavior:on:",
  30890. protocol: "output",
  30891. fn: function (aBehavior,aStream){
  30892. var self=this,$self=this;
  30893. return $core.withContext(function($ctx1) {
  30894. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30895. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30896. return $core.withContext(function($ctx2) {
  30897. return $self._exportMethod_on_(method,aStream);
  30898. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30899. }));
  30900. return self;
  30901. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30902. },
  30903. args: ["aBehavior", "aStream"],
  30904. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30905. referencedClasses: [],
  30906. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30907. }),
  30908. $globals.Exporter);
  30909. $core.addMethod(
  30910. $core.method({
  30911. selector: "exportDefinitionOf:on:",
  30912. protocol: "output",
  30913. fn: function (aClass,aStream){
  30914. var self=this,$self=this;
  30915. return $core.withContext(function($ctx1) {
  30916. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30917. $recv(aStream)._lf();
  30918. $ctx1.sendIdx["lf"]=1;
  30919. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30920. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30921. $5=$recv(aClass)._superclass();
  30922. if(($receiver = $5) == null || $receiver.a$nil){
  30923. $4="null";
  30924. } else {
  30925. var superclass;
  30926. superclass=$receiver;
  30927. $4=$recv(superclass)._asJavaScriptSource();
  30928. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30929. }
  30930. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30931. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30932. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30933. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30934. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30935. $1=$recv(aStream)._write_($2);
  30936. $ctx1.sendIdx["write:"]=1;
  30937. $8=$recv(aClass)._comment();
  30938. $ctx1.sendIdx["comment"]=1;
  30939. $recv($8)._ifNotEmpty_((function(){
  30940. return $core.withContext(function($ctx2) {
  30941. $recv(aStream)._lf();
  30942. $ctx2.sendIdx["lf"]=2;
  30943. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30944. $ctx2.sendIdx["write:"]=2;
  30945. $recv(aStream)._lf();
  30946. $ctx2.sendIdx["lf"]=3;
  30947. $10=$recv(aClass)._asJavaScriptSource();
  30948. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30949. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30950. $recv(aStream)._write_($9);
  30951. $ctx2.sendIdx["write:"]=3;
  30952. $recv(aStream)._lf();
  30953. $ctx2.sendIdx["lf"]=4;
  30954. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30956. }));
  30957. $recv(aStream)._lf();
  30958. return self;
  30959. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30960. },
  30961. args: ["aClass", "aStream"],
  30962. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addClass('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass superclass ifNil: [ 'null' ] ifNotNil: [ :superclass | superclass asJavaScriptSource ]. ', '.\x0a\x09\x09\x09aClass instanceVariableNames asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  30963. referencedClasses: [],
  30964. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30965. }),
  30966. $globals.Exporter);
  30967. $core.addMethod(
  30968. $core.method({
  30969. selector: "exportMetaDefinitionOf:on:",
  30970. protocol: "output",
  30971. fn: function (aClass,aStream){
  30972. var self=this,$self=this;
  30973. return $core.withContext(function($ctx1) {
  30974. var $2,$1,$4,$3;
  30975. $recv(aStream)._lf();
  30976. $ctx1.sendIdx["lf"]=1;
  30977. $2=$recv(aClass)._theMetaClass();
  30978. $ctx1.sendIdx["theMetaClass"]=1;
  30979. $1=$recv($2)._instanceVariableNames();
  30980. $recv($1)._ifNotEmpty_((function(classIvars){
  30981. return $core.withContext(function($ctx2) {
  30982. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30983. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30984. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30985. $recv(aStream)._write_($3);
  30986. return $recv(aStream)._lf();
  30987. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30988. }));
  30989. return self;
  30990. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30991. },
  30992. args: ["aClass", "aStream"],
  30993. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { aClass theMetaClass asJavaScriptSource. '.iVarNames = '. classIvars asJavaScriptSource. ';' };\x0a\x09\x09lf ]",
  30994. referencedClasses: [],
  30995. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30996. }),
  30997. $globals.Exporter);
  30998. $core.addMethod(
  30999. $core.method({
  31000. selector: "exportMethod:on:",
  31001. protocol: "output",
  31002. fn: function (aMethod,aStream){
  31003. var self=this,$self=this;
  31004. return $core.withContext(function($ctx1) {
  31005. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31006. $recv(aStream)._write_("$core.addMethod(");
  31007. $ctx1.sendIdx["write:"]=1;
  31008. $recv(aStream)._lf();
  31009. $ctx1.sendIdx["lf"]=1;
  31010. $recv(aStream)._write_("$core.method({");
  31011. $ctx1.sendIdx["write:"]=2;
  31012. $recv(aStream)._lf();
  31013. $ctx1.sendIdx["lf"]=2;
  31014. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31015. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31016. $1=["selector: ",$2,","];
  31017. $recv(aStream)._write_($1);
  31018. $ctx1.sendIdx["write:"]=3;
  31019. $recv(aStream)._lf();
  31020. $ctx1.sendIdx["lf"]=3;
  31021. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31022. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31023. $3=["protocol: ",$4,","];
  31024. $recv(aStream)._write_($3);
  31025. $ctx1.sendIdx["write:"]=4;
  31026. $recv(aStream)._lf();
  31027. $ctx1.sendIdx["lf"]=4;
  31028. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31029. $ctx1.sendIdx["write:"]=5;
  31030. $recv(aStream)._lf();
  31031. $ctx1.sendIdx["lf"]=5;
  31032. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31033. $ctx1.sendIdx["write:"]=6;
  31034. $recv(aStream)._lf();
  31035. $ctx1.sendIdx["lf"]=6;
  31036. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31037. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31038. $5=["args: ",$6,","];
  31039. $recv(aStream)._write_($5);
  31040. $ctx1.sendIdx["write:"]=7;
  31041. $recv(aStream)._lf();
  31042. $ctx1.sendIdx["lf"]=7;
  31043. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31044. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31045. $7=["source: ",$8,","];
  31046. $recv(aStream)._write_($7);
  31047. $ctx1.sendIdx["write:"]=8;
  31048. $recv(aStream)._lf();
  31049. $ctx1.sendIdx["lf"]=8;
  31050. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31051. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31052. $9=["referencedClasses: ",$10,","];
  31053. $recv(aStream)._write_($9);
  31054. $ctx1.sendIdx["write:"]=9;
  31055. $recv(aStream)._lf();
  31056. $ctx1.sendIdx["lf"]=9;
  31057. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31058. $ctx1.sendIdx["write:"]=10;
  31059. $recv(aStream)._lf();
  31060. $ctx1.sendIdx["lf"]=10;
  31061. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31062. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31063. $11=["messageSends: ",$12];
  31064. $recv(aStream)._write_($11);
  31065. $ctx1.sendIdx["write:"]=11;
  31066. $recv(aStream)._lf();
  31067. $ctx1.sendIdx["lf"]=11;
  31068. $recv(aStream)._write_("}),");
  31069. $ctx1.sendIdx["write:"]=12;
  31070. $recv(aStream)._lf();
  31071. $ctx1.sendIdx["lf"]=12;
  31072. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31073. $recv(aStream)._lf();
  31074. $ctx1.sendIdx["lf"]=13;
  31075. $recv(aStream)._lf();
  31076. return self;
  31077. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31078. },
  31079. args: ["aMethod", "aStream"],
  31080. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod methodClass asJavaScriptSource. ');' }; lf; lf",
  31081. referencedClasses: [],
  31082. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31083. }),
  31084. $globals.Exporter);
  31085. $core.addMethod(
  31086. $core.method({
  31087. selector: "exportPackage:on:",
  31088. protocol: "output",
  31089. fn: function (aPackage,aStream){
  31090. var self=this,$self=this;
  31091. return $core.withContext(function($ctx1) {
  31092. var $1,$receiver;
  31093. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31094. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31095. $self._exportPackageContextOf_on_(aPackage,aStream);
  31096. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31097. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31098. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31099. return $core.withContext(function($ctx2) {
  31100. $self._exportBehavior_on_(each,aStream);
  31101. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31102. $1=$recv(each)._theMetaClass();
  31103. if(($receiver = $1) == null || $receiver.a$nil){
  31104. return $1;
  31105. } else {
  31106. var meta;
  31107. meta=$receiver;
  31108. return $self._exportBehavior_on_(meta,aStream);
  31109. }
  31110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31111. }));
  31112. $ctx1.sendIdx["do:"]=1;
  31113. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31114. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31115. return $core.withContext(function($ctx2) {
  31116. return $self._exportMethod_on_(each,aStream);
  31117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31118. }));
  31119. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31120. return self;
  31121. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31122. },
  31123. args: ["aPackage", "aStream"],
  31124. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x09\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  31125. referencedClasses: [],
  31126. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31127. }),
  31128. $globals.Exporter);
  31129. $core.addMethod(
  31130. $core.method({
  31131. selector: "exportPackageBodyBlockPrologueOf:on:",
  31132. protocol: "output",
  31133. fn: function (aPackage,aStream){
  31134. var self=this,$self=this;
  31135. return $core.withContext(function($ctx1) {
  31136. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31137. $ctx1.sendIdx["write:"]=1;
  31138. $recv(aStream)._lf();
  31139. $ctx1.sendIdx["lf"]=1;
  31140. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31141. $recv(aStream)._lf();
  31142. return self;
  31143. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31144. },
  31145. args: ["aPackage", "aStream"],
  31146. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31147. referencedClasses: [],
  31148. messageSends: ["write:", "lf"]
  31149. }),
  31150. $globals.Exporter);
  31151. $core.addMethod(
  31152. $core.method({
  31153. selector: "exportPackageContextOf:on:",
  31154. protocol: "output",
  31155. fn: function (aPackage,aStream){
  31156. var self=this,$self=this;
  31157. return $core.withContext(function($ctx1) {
  31158. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  31159. $recv(aStream)._lf();
  31160. return self;
  31161. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31162. },
  31163. args: ["aPackage", "aStream"],
  31164. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  31165. referencedClasses: [],
  31166. messageSends: ["write:", "lf"]
  31167. }),
  31168. $globals.Exporter);
  31169. $core.addMethod(
  31170. $core.method({
  31171. selector: "exportPackageDefinitionOf:on:",
  31172. protocol: "output",
  31173. fn: function (aPackage,aStream){
  31174. var self=this,$self=this;
  31175. return $core.withContext(function($ctx1) {
  31176. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31177. $recv(aStream)._lf();
  31178. return self;
  31179. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31180. },
  31181. args: ["aPackage", "aStream"],
  31182. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31183. referencedClasses: [],
  31184. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31185. }),
  31186. $globals.Exporter);
  31187. $core.addMethod(
  31188. $core.method({
  31189. selector: "exportPackageEpilogueOf:on:",
  31190. protocol: "output",
  31191. fn: function (aPackage,aStream){
  31192. var self=this,$self=this;
  31193. return $core.withContext(function($ctx1) {
  31194. $self._subclassResponsibility();
  31195. return self;
  31196. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31197. },
  31198. args: ["aPackage", "aStream"],
  31199. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31200. referencedClasses: [],
  31201. messageSends: ["subclassResponsibility"]
  31202. }),
  31203. $globals.Exporter);
  31204. $core.addMethod(
  31205. $core.method({
  31206. selector: "exportPackageImportsOf:on:",
  31207. protocol: "output",
  31208. fn: function (aPackage,aStream){
  31209. var self=this,$self=this;
  31210. return $core.withContext(function($ctx1) {
  31211. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31212. return $core.withContext(function($ctx2) {
  31213. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  31214. return $recv(aStream)._lf();
  31215. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31216. }));
  31217. return self;
  31218. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31219. },
  31220. args: ["aPackage", "aStream"],
  31221. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: { '$pkg.imports = '. imports asJavaScriptSource. ';' };\x0a\x09\x09\x09lf ]",
  31222. referencedClasses: [],
  31223. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  31224. }),
  31225. $globals.Exporter);
  31226. $core.addMethod(
  31227. $core.method({
  31228. selector: "exportPackagePrologueOf:on:",
  31229. protocol: "output",
  31230. fn: function (aPackage,aStream){
  31231. var self=this,$self=this;
  31232. return $core.withContext(function($ctx1) {
  31233. $self._subclassResponsibility();
  31234. return self;
  31235. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31236. },
  31237. args: ["aPackage", "aStream"],
  31238. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31239. referencedClasses: [],
  31240. messageSends: ["subclassResponsibility"]
  31241. }),
  31242. $globals.Exporter);
  31243. $core.addMethod(
  31244. $core.method({
  31245. selector: "exportPackageTraitCompositionsOf:on:",
  31246. protocol: "output",
  31247. fn: function (aPackage,aStream){
  31248. var self=this,$self=this;
  31249. return $core.withContext(function($ctx1) {
  31250. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31251. return $core.withContext(function($ctx2) {
  31252. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31253. return $core.withContext(function($ctx3) {
  31254. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31255. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31256. }));
  31257. return $recv(aStream)._lf();
  31258. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31259. }));
  31260. return self;
  31261. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31262. },
  31263. args: ["aPackage", "aStream"],
  31264. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream lf ]",
  31265. referencedClasses: [],
  31266. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31267. }),
  31268. $globals.Exporter);
  31269. $core.addMethod(
  31270. $core.method({
  31271. selector: "exportPackageTransportOf:on:",
  31272. protocol: "output",
  31273. fn: function (aPackage,aStream){
  31274. var self=this,$self=this;
  31275. return $core.withContext(function($ctx1) {
  31276. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31277. $recv(aStream)._lf();
  31278. return self;
  31279. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31280. },
  31281. args: ["aPackage", "aStream"],
  31282. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  31283. referencedClasses: [],
  31284. messageSends: ["write:", "asJSONString", "transport", "lf"]
  31285. }),
  31286. $globals.Exporter);
  31287. $core.addMethod(
  31288. $core.method({
  31289. selector: "exportTraitComposition:of:on:",
  31290. protocol: "output",
  31291. fn: function (aTraitComposition,aBehavior,aStream){
  31292. var self=this,$self=this;
  31293. return $core.withContext(function($ctx1) {
  31294. var $2,$1;
  31295. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31296. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31297. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31298. $recv(aStream)._write_($1);
  31299. $recv(aStream)._lf();
  31300. return self;
  31301. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31302. },
  31303. args: ["aTraitComposition", "aBehavior", "aStream"],
  31304. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream write: {\x0a\x09\x09'$core.setTraitComposition('.\x0a\x09\x09aTraitComposition asJavaScriptSource.\x0a\x09\x09', '.\x0a\x09\x09aBehavior asJavaScriptSource.\x0a\x09\x09');' };\x0a\x09lf",
  31305. referencedClasses: [],
  31306. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31307. }),
  31308. $globals.Exporter);
  31309. $core.addMethod(
  31310. $core.method({
  31311. selector: "exportTraitDefinitionOf:on:",
  31312. protocol: "output",
  31313. fn: function (aClass,aStream){
  31314. var self=this,$self=this;
  31315. return $core.withContext(function($ctx1) {
  31316. var $3,$4,$2,$1,$5,$7,$6;
  31317. $recv(aStream)._lf();
  31318. $ctx1.sendIdx["lf"]=1;
  31319. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31320. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31321. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31322. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31323. $2=["$core.addTrait(",$3,", ",$4,");"];
  31324. $1=$recv(aStream)._write_($2);
  31325. $ctx1.sendIdx["write:"]=1;
  31326. $5=$recv(aClass)._comment();
  31327. $ctx1.sendIdx["comment"]=1;
  31328. $recv($5)._ifNotEmpty_((function(){
  31329. return $core.withContext(function($ctx2) {
  31330. $recv(aStream)._lf();
  31331. $ctx2.sendIdx["lf"]=2;
  31332. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31333. $ctx2.sendIdx["write:"]=2;
  31334. $recv(aStream)._lf();
  31335. $ctx2.sendIdx["lf"]=3;
  31336. $7=$recv(aClass)._asJavaScriptSource();
  31337. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31338. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31339. $recv(aStream)._write_($6);
  31340. $ctx2.sendIdx["write:"]=3;
  31341. $recv(aStream)._lf();
  31342. $ctx2.sendIdx["lf"]=4;
  31343. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31345. }));
  31346. $recv(aStream)._lf();
  31347. return self;
  31348. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31349. },
  31350. args: ["aClass", "aStream"],
  31351. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addTrait('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  31352. referencedClasses: [],
  31353. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31354. }),
  31355. $globals.Exporter);
  31356. $core.addMethod(
  31357. $core.method({
  31358. selector: "ownMethodsOfClass:",
  31359. protocol: "accessing",
  31360. fn: function (aClass){
  31361. var self=this,$self=this;
  31362. return $core.withContext(function($ctx1) {
  31363. var $1;
  31364. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31365. return $core.withContext(function($ctx2) {
  31366. $1=$recv(a)._selector();
  31367. $ctx2.sendIdx["selector"]=1;
  31368. return $recv($1).__lt_eq($recv(b)._selector());
  31369. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31370. })))._reject_((function(each){
  31371. return $core.withContext(function($ctx2) {
  31372. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31374. }));
  31375. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31376. },
  31377. args: ["aClass"],
  31378. 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*') ]",
  31379. referencedClasses: [],
  31380. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31381. }),
  31382. $globals.Exporter);
  31383. $core.addMethod(
  31384. $core.method({
  31385. selector: "ownMethodsOfMetaClass:",
  31386. protocol: "accessing",
  31387. fn: function (aClass){
  31388. var self=this,$self=this;
  31389. return $core.withContext(function($ctx1) {
  31390. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31391. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31392. },
  31393. args: ["aClass"],
  31394. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31395. referencedClasses: [],
  31396. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31397. }),
  31398. $globals.Exporter);
  31399. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31400. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31401. $core.addMethod(
  31402. $core.method({
  31403. selector: "amdNamesOfPackages:",
  31404. protocol: "private",
  31405. fn: function (anArray){
  31406. var self=this,$self=this;
  31407. return $core.withContext(function($ctx1) {
  31408. var $1;
  31409. return $recv($recv(anArray)._select_((function(each){
  31410. return $core.withContext(function($ctx2) {
  31411. $1=$self._amdNamespaceOfPackage_(each);
  31412. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31413. return $recv($1)._notNil();
  31414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31415. })))._collect_((function(each){
  31416. return $core.withContext(function($ctx2) {
  31417. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31418. $ctx2.sendIdx[","]=1;
  31419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31420. }));
  31421. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31422. },
  31423. args: ["anArray"],
  31424. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31425. referencedClasses: [],
  31426. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31427. }),
  31428. $globals.AmdExporter);
  31429. $core.addMethod(
  31430. $core.method({
  31431. selector: "amdNamespaceOfPackage:",
  31432. protocol: "private",
  31433. fn: function (aPackage){
  31434. var self=this,$self=this;
  31435. return $core.withContext(function($ctx1) {
  31436. var $3,$2,$1;
  31437. $3=$recv(aPackage)._transport();
  31438. $ctx1.sendIdx["transport"]=1;
  31439. $2=$recv($3)._type();
  31440. $1=$recv($2).__eq("amd");
  31441. if($core.assert($1)){
  31442. return $recv($recv(aPackage)._transport())._namespace();
  31443. } else {
  31444. return nil;
  31445. }
  31446. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31447. },
  31448. args: ["aPackage"],
  31449. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31450. referencedClasses: [],
  31451. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31452. }),
  31453. $globals.AmdExporter);
  31454. $core.addMethod(
  31455. $core.method({
  31456. selector: "exportPackageEpilogueOf:on:",
  31457. protocol: "output",
  31458. fn: function (aPackage,aStream){
  31459. var self=this,$self=this;
  31460. return $core.withContext(function($ctx1) {
  31461. $recv(aStream)._write_("});");
  31462. $recv(aStream)._lf();
  31463. return self;
  31464. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31465. },
  31466. args: ["aPackage", "aStream"],
  31467. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31468. referencedClasses: [],
  31469. messageSends: ["write:", "lf"]
  31470. }),
  31471. $globals.AmdExporter);
  31472. $core.addMethod(
  31473. $core.method({
  31474. selector: "exportPackagePrologueOf:on:",
  31475. protocol: "output",
  31476. fn: function (aPackage,aStream){
  31477. var self=this,$self=this;
  31478. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31479. return $core.withContext(function($ctx1) {
  31480. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31481. pragmaStart="";
  31482. pragmaEnd="";
  31483. importsForOutput=$self._importsForOutput_(aPackage);
  31484. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31485. $1=$recv(importsForOutput)._value();
  31486. $ctx1.sendIdx["value"]=1;
  31487. $recv($1)._ifNotEmpty_((function(){
  31488. return $core.withContext(function($ctx2) {
  31489. $3=$recv($globals.String)._lf();
  31490. $ctx2.sendIdx["lf"]=1;
  31491. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31492. $ctx2.sendIdx[","]=2;
  31493. $4=$recv($globals.String)._lf();
  31494. $ctx2.sendIdx["lf"]=2;
  31495. pragmaStart=$recv($2).__comma($4);
  31496. $ctx2.sendIdx[","]=1;
  31497. $6=$recv($globals.String)._lf();
  31498. $ctx2.sendIdx["lf"]=3;
  31499. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31500. $ctx2.sendIdx[","]=4;
  31501. $7=$recv($globals.String)._lf();
  31502. $ctx2.sendIdx["lf"]=4;
  31503. pragmaEnd=$recv($5).__comma($7);
  31504. $ctx2.sendIdx[","]=3;
  31505. return pragmaEnd;
  31506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31507. }));
  31508. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31509. $ctx1.sendIdx[","]=7;
  31510. $13=$recv($14).__comma([":2:"]);
  31511. $ctx1.sendIdx[","]=6;
  31512. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31513. $ctx1.sendIdx[","]=5;
  31514. $11=$recv($12)._asJavaScriptSource();
  31515. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31516. $ctx1.sendIdx["replace:with:"]=2;
  31517. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31518. $ctx1.sendIdx["replace:with:"]=1;
  31519. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31520. $ctx1.sendIdx[","]=8;
  31521. $17=$recv($18)._join_(",");
  31522. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31523. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31524. $ctx1.sendIdx["replace:with:"]=3;
  31525. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31526. $recv(aStream)._write_($8);
  31527. $recv(aStream)._lf();
  31528. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31529. return self;
  31530. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31531. },
  31532. args: ["aPackage", "aStream"],
  31533. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09((#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavaScriptSource\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd.\x0a\x09\x09\x09', function('.\x0a\x09\x09\x09((((#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',') \x0a\x09\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*:2:' with: pragmaEnd).\x0a\x09\x09\x09'){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  31534. referencedClasses: ["String"],
  31535. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31536. }),
  31537. $globals.AmdExporter);
  31538. $core.addMethod(
  31539. $core.method({
  31540. selector: "importsForOutput:",
  31541. protocol: "private",
  31542. fn: function (aPackage){
  31543. var self=this,$self=this;
  31544. var namedImports,anonImports,importVarNames;
  31545. return $core.withContext(function($ctx1) {
  31546. var $1;
  31547. namedImports=[];
  31548. anonImports=[];
  31549. importVarNames=[];
  31550. $recv($recv(aPackage)._imports())._do_((function(each){
  31551. return $core.withContext(function($ctx2) {
  31552. $1=$recv(each)._isString();
  31553. if($core.assert($1)){
  31554. return $recv(anonImports)._add_(each);
  31555. $ctx2.sendIdx["add:"]=1;
  31556. } else {
  31557. $recv(namedImports)._add_($recv(each)._value());
  31558. $ctx2.sendIdx["add:"]=2;
  31559. return $recv(importVarNames)._add_($recv(each)._key());
  31560. }
  31561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31562. }));
  31563. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31564. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31565. },
  31566. args: ["aPackage"],
  31567. 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)",
  31568. referencedClasses: [],
  31569. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31570. }),
  31571. $globals.AmdExporter);
  31572. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31573. $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";
  31574. $core.addMethod(
  31575. $core.method({
  31576. selector: "last",
  31577. protocol: "accessing",
  31578. fn: function (){
  31579. var self=this,$self=this;
  31580. return $self["@last"];
  31581. },
  31582. args: [],
  31583. source: "last\x0a\x09^ last",
  31584. referencedClasses: [],
  31585. messageSends: []
  31586. }),
  31587. $globals.ChunkParser);
  31588. $core.addMethod(
  31589. $core.method({
  31590. selector: "nextChunk",
  31591. protocol: "reading",
  31592. fn: function (){
  31593. var self=this,$self=this;
  31594. var char,result,chunk;
  31595. return $core.withContext(function($ctx1) {
  31596. var $1,$2,$3,$4;
  31597. var $early={};
  31598. try {
  31599. result=""._writeStream();
  31600. $recv((function(){
  31601. return $core.withContext(function($ctx2) {
  31602. char=$recv($self["@stream"])._next();
  31603. $ctx2.sendIdx["next"]=1;
  31604. return $recv(char)._notNil();
  31605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31606. }))._whileTrue_((function(){
  31607. return $core.withContext(function($ctx2) {
  31608. $1=$recv(char).__eq("!");
  31609. $ctx2.sendIdx["="]=1;
  31610. if($core.assert($1)){
  31611. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31612. if($core.assert($2)){
  31613. $recv($self["@stream"])._next();
  31614. } else {
  31615. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31616. $3=$self["@last"];
  31617. throw $early=[$3];
  31618. }
  31619. }
  31620. return $recv(result)._nextPut_(char);
  31621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31622. }));
  31623. $self["@last"]=nil;
  31624. $4=$self["@last"];
  31625. return $4;
  31626. }
  31627. catch(e) {if(e===$early)return e[0]; throw e}
  31628. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31629. },
  31630. args: [],
  31631. 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",
  31632. referencedClasses: [],
  31633. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31634. }),
  31635. $globals.ChunkParser);
  31636. $core.addMethod(
  31637. $core.method({
  31638. selector: "stream:",
  31639. protocol: "accessing",
  31640. fn: function (aStream){
  31641. var self=this,$self=this;
  31642. $self["@stream"]=aStream;
  31643. return self;
  31644. },
  31645. args: ["aStream"],
  31646. source: "stream: aStream\x0a\x09stream := aStream",
  31647. referencedClasses: [],
  31648. messageSends: []
  31649. }),
  31650. $globals.ChunkParser);
  31651. $core.addMethod(
  31652. $core.method({
  31653. selector: "on:",
  31654. protocol: "instance creation",
  31655. fn: function (aStream){
  31656. var self=this,$self=this;
  31657. return $core.withContext(function($ctx1) {
  31658. return $recv($self._new())._stream_(aStream);
  31659. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31660. },
  31661. args: ["aStream"],
  31662. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31663. referencedClasses: [],
  31664. messageSends: ["stream:", "new"]
  31665. }),
  31666. $globals.ChunkParser.a$cls);
  31667. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31668. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31669. $core.addMethod(
  31670. $core.method({
  31671. selector: "class:",
  31672. protocol: "accessing",
  31673. fn: function (aClass){
  31674. var self=this,$self=this;
  31675. $self["@class"]=aClass;
  31676. return self;
  31677. },
  31678. args: ["aClass"],
  31679. source: "class: aClass\x0a\x09class := aClass",
  31680. referencedClasses: [],
  31681. messageSends: []
  31682. }),
  31683. $globals.ClassCommentReader);
  31684. $core.addMethod(
  31685. $core.method({
  31686. selector: "initialize",
  31687. protocol: "initialization",
  31688. fn: function (){
  31689. var self=this,$self=this;
  31690. return $core.withContext(function($ctx1) {
  31691. (
  31692. $ctx1.supercall = true,
  31693. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31694. $ctx1.supercall = false;
  31695. return self;
  31696. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31697. },
  31698. args: [],
  31699. source: "initialize\x0a\x09super initialize.",
  31700. referencedClasses: [],
  31701. messageSends: ["initialize"]
  31702. }),
  31703. $globals.ClassCommentReader);
  31704. $core.addMethod(
  31705. $core.method({
  31706. selector: "scanFrom:",
  31707. protocol: "fileIn",
  31708. fn: function (aChunkParser){
  31709. var self=this,$self=this;
  31710. var chunk;
  31711. return $core.withContext(function($ctx1) {
  31712. chunk=$recv(aChunkParser)._nextChunk();
  31713. $recv(chunk)._ifNotEmpty_((function(){
  31714. return $core.withContext(function($ctx2) {
  31715. return $self._setComment_(chunk);
  31716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31717. }));
  31718. return self;
  31719. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31720. },
  31721. args: ["aChunkParser"],
  31722. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31723. referencedClasses: [],
  31724. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31725. }),
  31726. $globals.ClassCommentReader);
  31727. $core.addMethod(
  31728. $core.method({
  31729. selector: "setComment:",
  31730. protocol: "private",
  31731. fn: function (aString){
  31732. var self=this,$self=this;
  31733. return $core.withContext(function($ctx1) {
  31734. $recv($self["@class"])._comment_(aString);
  31735. return self;
  31736. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31737. },
  31738. args: ["aString"],
  31739. source: "setComment: aString\x0a\x09class comment: aString",
  31740. referencedClasses: [],
  31741. messageSends: ["comment:"]
  31742. }),
  31743. $globals.ClassCommentReader);
  31744. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31745. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31746. $core.addMethod(
  31747. $core.method({
  31748. selector: "class:category:",
  31749. protocol: "accessing",
  31750. fn: function (aClass,aString){
  31751. var self=this,$self=this;
  31752. $self["@class"]=aClass;
  31753. $self["@category"]=aString;
  31754. return self;
  31755. },
  31756. args: ["aClass", "aString"],
  31757. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31758. referencedClasses: [],
  31759. messageSends: []
  31760. }),
  31761. $globals.ClassProtocolReader);
  31762. $core.addMethod(
  31763. $core.method({
  31764. selector: "compileMethod:",
  31765. protocol: "private",
  31766. fn: function (aString){
  31767. var self=this,$self=this;
  31768. return $core.withContext(function($ctx1) {
  31769. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31770. return self;
  31771. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31772. },
  31773. args: ["aString"],
  31774. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31775. referencedClasses: ["Compiler"],
  31776. messageSends: ["install:forClass:protocol:", "new"]
  31777. }),
  31778. $globals.ClassProtocolReader);
  31779. $core.addMethod(
  31780. $core.method({
  31781. selector: "initialize",
  31782. protocol: "initialization",
  31783. fn: function (){
  31784. var self=this,$self=this;
  31785. return $core.withContext(function($ctx1) {
  31786. (
  31787. $ctx1.supercall = true,
  31788. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31789. $ctx1.supercall = false;
  31790. return self;
  31791. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31792. },
  31793. args: [],
  31794. source: "initialize\x0a\x09super initialize.",
  31795. referencedClasses: [],
  31796. messageSends: ["initialize"]
  31797. }),
  31798. $globals.ClassProtocolReader);
  31799. $core.addMethod(
  31800. $core.method({
  31801. selector: "scanFrom:",
  31802. protocol: "fileIn",
  31803. fn: function (aChunkParser){
  31804. var self=this,$self=this;
  31805. var chunk;
  31806. return $core.withContext(function($ctx1) {
  31807. $recv((function(){
  31808. return $core.withContext(function($ctx2) {
  31809. chunk=$recv(aChunkParser)._nextChunk();
  31810. return $recv(chunk)._isEmpty();
  31811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31812. }))._whileFalse_((function(){
  31813. return $core.withContext(function($ctx2) {
  31814. return $self._compileMethod_(chunk);
  31815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31816. }));
  31817. return self;
  31818. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31819. },
  31820. args: ["aChunkParser"],
  31821. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31822. referencedClasses: [],
  31823. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31824. }),
  31825. $globals.ClassProtocolReader);
  31826. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31827. $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.";
  31828. $core.addMethod(
  31829. $core.method({
  31830. selector: "methods",
  31831. protocol: "accessing",
  31832. fn: function (){
  31833. var self=this,$self=this;
  31834. return $core.withContext(function($ctx1) {
  31835. var $1;
  31836. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31837. return $core.withContext(function($ctx2) {
  31838. $1=$recv(a)._selector();
  31839. $ctx2.sendIdx["selector"]=1;
  31840. return $recv($1).__lt_eq($recv(b)._selector());
  31841. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31842. }));
  31843. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31844. },
  31845. args: [],
  31846. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31847. referencedClasses: [],
  31848. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31849. }),
  31850. $globals.ExportMethodProtocol);
  31851. $core.addMethod(
  31852. $core.method({
  31853. selector: "name",
  31854. protocol: "accessing",
  31855. fn: function (){
  31856. var self=this,$self=this;
  31857. return $self["@name"];
  31858. },
  31859. args: [],
  31860. source: "name\x0a\x09^ name",
  31861. referencedClasses: [],
  31862. messageSends: []
  31863. }),
  31864. $globals.ExportMethodProtocol);
  31865. $core.addMethod(
  31866. $core.method({
  31867. selector: "name:",
  31868. protocol: "accessing",
  31869. fn: function (aString){
  31870. var self=this,$self=this;
  31871. $self["@name"]=aString;
  31872. return self;
  31873. },
  31874. args: ["aString"],
  31875. source: "name: aString\x0a\x09name := aString",
  31876. referencedClasses: [],
  31877. messageSends: []
  31878. }),
  31879. $globals.ExportMethodProtocol);
  31880. $core.addMethod(
  31881. $core.method({
  31882. selector: "ownMethods",
  31883. protocol: "accessing",
  31884. fn: function (){
  31885. var self=this,$self=this;
  31886. return $core.withContext(function($ctx1) {
  31887. var $1;
  31888. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31889. return $core.withContext(function($ctx2) {
  31890. $1=$recv(a)._selector();
  31891. $ctx2.sendIdx["selector"]=1;
  31892. return $recv($1).__lt_eq($recv(b)._selector());
  31893. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31894. }));
  31895. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31896. },
  31897. args: [],
  31898. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31899. referencedClasses: [],
  31900. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31901. }),
  31902. $globals.ExportMethodProtocol);
  31903. $core.addMethod(
  31904. $core.method({
  31905. selector: "theClass",
  31906. protocol: "accessing",
  31907. fn: function (){
  31908. var self=this,$self=this;
  31909. return $self["@theClass"];
  31910. },
  31911. args: [],
  31912. source: "theClass\x0a\x09^ theClass",
  31913. referencedClasses: [],
  31914. messageSends: []
  31915. }),
  31916. $globals.ExportMethodProtocol);
  31917. $core.addMethod(
  31918. $core.method({
  31919. selector: "theClass:",
  31920. protocol: "accessing",
  31921. fn: function (aClass){
  31922. var self=this,$self=this;
  31923. $self["@theClass"]=aClass;
  31924. return self;
  31925. },
  31926. args: ["aClass"],
  31927. source: "theClass: aClass\x0a\x09theClass := aClass",
  31928. referencedClasses: [],
  31929. messageSends: []
  31930. }),
  31931. $globals.ExportMethodProtocol);
  31932. $core.addMethod(
  31933. $core.method({
  31934. selector: "name:theClass:",
  31935. protocol: "instance creation",
  31936. fn: function (aString,aClass){
  31937. var self=this,$self=this;
  31938. return $core.withContext(function($ctx1) {
  31939. var $1;
  31940. $1=$self._new();
  31941. $recv($1)._name_(aString);
  31942. $recv($1)._theClass_(aClass);
  31943. return $recv($1)._yourself();
  31944. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31945. },
  31946. args: ["aString", "aClass"],
  31947. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31948. referencedClasses: [],
  31949. messageSends: ["name:", "new", "theClass:", "yourself"]
  31950. }),
  31951. $globals.ExportMethodProtocol.a$cls);
  31952. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31953. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31954. $core.addMethod(
  31955. $core.method({
  31956. selector: "import:",
  31957. protocol: "fileIn",
  31958. fn: function (aStream){
  31959. var self=this,$self=this;
  31960. var chunk,result,parser,lastEmpty;
  31961. return $core.withContext(function($ctx1) {
  31962. var $1;
  31963. parser=$recv($globals.ChunkParser)._on_(aStream);
  31964. lastEmpty=false;
  31965. $self["@lastSection"]="n/a, not started";
  31966. $self["@lastChunk"]=nil;
  31967. $recv((function(){
  31968. return $core.withContext(function($ctx2) {
  31969. $recv((function(){
  31970. return $core.withContext(function($ctx3) {
  31971. chunk=$recv(parser)._nextChunk();
  31972. return $recv(chunk)._isNil();
  31973. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31974. }))._whileFalse_((function(){
  31975. return $core.withContext(function($ctx3) {
  31976. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31977. lastEmpty=true;
  31978. return lastEmpty;
  31979. }),(function(){
  31980. return $core.withContext(function($ctx4) {
  31981. $self["@lastSection"]=chunk;
  31982. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31983. $1=lastEmpty;
  31984. if($core.assert($1)){
  31985. lastEmpty=false;
  31986. return $recv(result)._scanFrom_(parser);
  31987. }
  31988. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31989. }));
  31990. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31991. }));
  31992. $self["@lastSection"]="n/a, finished";
  31993. return $self["@lastSection"];
  31994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31995. }))._on_do_($globals.Error,(function(e){
  31996. return $core.withContext(function($ctx2) {
  31997. $self["@lastChunk"]=$recv(parser)._last();
  31998. return $recv(e)._pass();
  31999. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32000. }));
  32001. return self;
  32002. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32003. },
  32004. args: ["aStream"],
  32005. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e pass ].",
  32006. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32007. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32008. }),
  32009. $globals.Importer);
  32010. $core.addMethod(
  32011. $core.method({
  32012. selector: "lastChunk",
  32013. protocol: "accessing",
  32014. fn: function (){
  32015. var self=this,$self=this;
  32016. return $self["@lastChunk"];
  32017. },
  32018. args: [],
  32019. source: "lastChunk\x0a\x09^ lastChunk",
  32020. referencedClasses: [],
  32021. messageSends: []
  32022. }),
  32023. $globals.Importer);
  32024. $core.addMethod(
  32025. $core.method({
  32026. selector: "lastSection",
  32027. protocol: "accessing",
  32028. fn: function (){
  32029. var self=this,$self=this;
  32030. return $self["@lastSection"];
  32031. },
  32032. args: [],
  32033. source: "lastSection\x0a\x09^ lastSection",
  32034. referencedClasses: [],
  32035. messageSends: []
  32036. }),
  32037. $globals.Importer);
  32038. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32039. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32040. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32041. $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.";
  32042. $core.addMethod(
  32043. $core.method({
  32044. selector: "ajaxPutAt:data:onSuccess:onError:",
  32045. protocol: "private",
  32046. fn: function (aURL,aString,aBlock,anotherBlock){
  32047. var self=this,$self=this;
  32048. var xhr;
  32049. return $core.withContext(function($ctx1) {
  32050. var $1,$4,$3,$2;
  32051. xhr=$recv($globals.Platform)._newXhr();
  32052. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32053. $recv(xhr)._onreadystatechange_((function(){
  32054. return $core.withContext(function($ctx2) {
  32055. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32056. if($core.assert($1)){
  32057. $4=$recv(xhr)._status();
  32058. $ctx2.sendIdx["status"]=1;
  32059. $3=$recv($4).__gt_eq((200));
  32060. $2=$recv($3)._and_((function(){
  32061. return $core.withContext(function($ctx3) {
  32062. return $recv($recv(xhr)._status()).__lt((300));
  32063. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32064. }));
  32065. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32066. }
  32067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32068. }));
  32069. $recv(xhr)._send_(aString);
  32070. return self;
  32071. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32072. },
  32073. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32074. 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",
  32075. referencedClasses: ["Platform"],
  32076. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32077. }),
  32078. $globals.PackageHandler);
  32079. $core.addMethod(
  32080. $core.method({
  32081. selector: "chunkContentsFor:",
  32082. protocol: "accessing",
  32083. fn: function (aPackage){
  32084. var self=this,$self=this;
  32085. return $core.withContext(function($ctx1) {
  32086. return $recv($globals.String)._streamContents_((function(str){
  32087. return $core.withContext(function($ctx2) {
  32088. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32089. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32090. }));
  32091. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32092. },
  32093. args: ["aPackage"],
  32094. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32095. referencedClasses: ["String"],
  32096. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32097. }),
  32098. $globals.PackageHandler);
  32099. $core.addMethod(
  32100. $core.method({
  32101. selector: "chunkExporter",
  32102. protocol: "factory",
  32103. fn: function (){
  32104. var self=this,$self=this;
  32105. return $core.withContext(function($ctx1) {
  32106. return $recv($self._chunkExporterClass())._new();
  32107. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32108. },
  32109. args: [],
  32110. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32111. referencedClasses: [],
  32112. messageSends: ["new", "chunkExporterClass"]
  32113. }),
  32114. $globals.PackageHandler);
  32115. $core.addMethod(
  32116. $core.method({
  32117. selector: "chunkExporterClass",
  32118. protocol: "accessing",
  32119. fn: function (){
  32120. var self=this,$self=this;
  32121. return $globals.ChunkExporter;
  32122. },
  32123. args: [],
  32124. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32125. referencedClasses: ["ChunkExporter"],
  32126. messageSends: []
  32127. }),
  32128. $globals.PackageHandler);
  32129. $core.addMethod(
  32130. $core.method({
  32131. selector: "commit:",
  32132. protocol: "committing",
  32133. fn: function (aPackage){
  32134. var self=this,$self=this;
  32135. return $core.withContext(function($ctx1) {
  32136. var $1,$2;
  32137. $self._commit_onSuccess_onError_(aPackage,(function(){
  32138. }),(function(error){
  32139. return $core.withContext(function($ctx2) {
  32140. $1=$recv($globals.PackageCommitError)._new();
  32141. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32142. $ctx2.sendIdx[","]=1;
  32143. $recv($1)._messageText_($2);
  32144. return $recv($1)._signal();
  32145. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32146. }));
  32147. return self;
  32148. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32149. },
  32150. args: ["aPackage"],
  32151. 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 ]",
  32152. referencedClasses: ["PackageCommitError"],
  32153. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32154. }),
  32155. $globals.PackageHandler);
  32156. $core.addMethod(
  32157. $core.method({
  32158. selector: "commit:onSuccess:onError:",
  32159. protocol: "committing",
  32160. fn: function (aPackage,aBlock,anotherBlock){
  32161. var self=this,$self=this;
  32162. return $core.withContext(function($ctx1) {
  32163. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32164. return $core.withContext(function($ctx2) {
  32165. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32166. return $core.withContext(function($ctx3) {
  32167. $recv(aPackage)._beClean();
  32168. return $recv(aBlock)._value();
  32169. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32170. }),anotherBlock);
  32171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32172. }),anotherBlock);
  32173. return self;
  32174. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32175. },
  32176. args: ["aPackage", "aBlock", "anotherBlock"],
  32177. 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",
  32178. referencedClasses: [],
  32179. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32180. }),
  32181. $globals.PackageHandler);
  32182. $core.addMethod(
  32183. $core.method({
  32184. selector: "commitJsFileFor:onSuccess:onError:",
  32185. protocol: "committing",
  32186. fn: function (aPackage,aBlock,anotherBlock){
  32187. var self=this,$self=this;
  32188. return $core.withContext(function($ctx1) {
  32189. var $2,$1;
  32190. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32191. $ctx1.sendIdx[","]=2;
  32192. $1=$recv($2).__comma(".js");
  32193. $ctx1.sendIdx[","]=1;
  32194. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32195. return self;
  32196. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32197. },
  32198. args: ["aPackage", "aBlock", "anotherBlock"],
  32199. 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",
  32200. referencedClasses: [],
  32201. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32202. }),
  32203. $globals.PackageHandler);
  32204. $core.addMethod(
  32205. $core.method({
  32206. selector: "commitPathJsFor:",
  32207. protocol: "accessing",
  32208. fn: function (aPackage){
  32209. var self=this,$self=this;
  32210. return $core.withContext(function($ctx1) {
  32211. $self._subclassResponsibility();
  32212. return self;
  32213. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32214. },
  32215. args: ["aPackage"],
  32216. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32217. referencedClasses: [],
  32218. messageSends: ["subclassResponsibility"]
  32219. }),
  32220. $globals.PackageHandler);
  32221. $core.addMethod(
  32222. $core.method({
  32223. selector: "commitPathStFor:",
  32224. protocol: "accessing",
  32225. fn: function (aPackage){
  32226. var self=this,$self=this;
  32227. return $core.withContext(function($ctx1) {
  32228. $self._subclassResponsibility();
  32229. return self;
  32230. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32231. },
  32232. args: ["aPackage"],
  32233. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32234. referencedClasses: [],
  32235. messageSends: ["subclassResponsibility"]
  32236. }),
  32237. $globals.PackageHandler);
  32238. $core.addMethod(
  32239. $core.method({
  32240. selector: "commitStFileFor:onSuccess:onError:",
  32241. protocol: "committing",
  32242. fn: function (aPackage,aBlock,anotherBlock){
  32243. var self=this,$self=this;
  32244. return $core.withContext(function($ctx1) {
  32245. var $2,$1;
  32246. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32247. $ctx1.sendIdx[","]=2;
  32248. $1=$recv($2).__comma(".st");
  32249. $ctx1.sendIdx[","]=1;
  32250. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32251. return self;
  32252. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32253. },
  32254. args: ["aPackage", "aBlock", "anotherBlock"],
  32255. 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",
  32256. referencedClasses: [],
  32257. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32258. }),
  32259. $globals.PackageHandler);
  32260. $core.addMethod(
  32261. $core.method({
  32262. selector: "contentsFor:",
  32263. protocol: "accessing",
  32264. fn: function (aPackage){
  32265. var self=this,$self=this;
  32266. return $core.withContext(function($ctx1) {
  32267. return $recv($globals.String)._streamContents_((function(str){
  32268. return $core.withContext(function($ctx2) {
  32269. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32270. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32271. }));
  32272. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32273. },
  32274. args: ["aPackage"],
  32275. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32276. referencedClasses: ["String"],
  32277. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32278. }),
  32279. $globals.PackageHandler);
  32280. $core.addMethod(
  32281. $core.method({
  32282. selector: "exporter",
  32283. protocol: "factory",
  32284. fn: function (){
  32285. var self=this,$self=this;
  32286. return $core.withContext(function($ctx1) {
  32287. return $recv($self._exporterClass())._new();
  32288. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32289. },
  32290. args: [],
  32291. source: "exporter\x0a\x09^ self exporterClass new",
  32292. referencedClasses: [],
  32293. messageSends: ["new", "exporterClass"]
  32294. }),
  32295. $globals.PackageHandler);
  32296. $core.addMethod(
  32297. $core.method({
  32298. selector: "exporterClass",
  32299. protocol: "accessing",
  32300. fn: function (){
  32301. var self=this,$self=this;
  32302. return $core.withContext(function($ctx1) {
  32303. $self._subclassResponsibility();
  32304. return self;
  32305. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32306. },
  32307. args: [],
  32308. source: "exporterClass\x0a\x09self subclassResponsibility",
  32309. referencedClasses: [],
  32310. messageSends: ["subclassResponsibility"]
  32311. }),
  32312. $globals.PackageHandler);
  32313. $core.addMethod(
  32314. $core.method({
  32315. selector: "load:",
  32316. protocol: "loading",
  32317. fn: function (aPackage){
  32318. var self=this,$self=this;
  32319. return $core.withContext(function($ctx1) {
  32320. $self._subclassResponsibility();
  32321. return self;
  32322. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32323. },
  32324. args: ["aPackage"],
  32325. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32326. referencedClasses: [],
  32327. messageSends: ["subclassResponsibility"]
  32328. }),
  32329. $globals.PackageHandler);
  32330. $core.addMethod(
  32331. $core.method({
  32332. selector: "onCommitError:",
  32333. protocol: "error handling",
  32334. fn: function (anError){
  32335. var self=this,$self=this;
  32336. return $core.withContext(function($ctx1) {
  32337. var $1,$2;
  32338. $1=$recv($globals.PackageCommitError)._new();
  32339. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32340. $ctx1.sendIdx[","]=1;
  32341. $recv($1)._messageText_($2);
  32342. $recv($1)._signal();
  32343. return self;
  32344. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32345. },
  32346. args: ["anError"],
  32347. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32348. referencedClasses: ["PackageCommitError"],
  32349. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32350. }),
  32351. $globals.PackageHandler);
  32352. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32353. $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.";
  32354. $core.addMethod(
  32355. $core.method({
  32356. selector: "commitPathJsFor:",
  32357. protocol: "accessing",
  32358. fn: function (aPackage){
  32359. var self=this,$self=this;
  32360. return $core.withContext(function($ctx1) {
  32361. return $self._toUrl_($self._namespaceFor_(aPackage));
  32362. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32363. },
  32364. args: ["aPackage"],
  32365. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32366. referencedClasses: [],
  32367. messageSends: ["toUrl:", "namespaceFor:"]
  32368. }),
  32369. $globals.AmdPackageHandler);
  32370. $core.addMethod(
  32371. $core.method({
  32372. selector: "commitPathStFor:",
  32373. protocol: "accessing",
  32374. fn: function (aPackage){
  32375. var self=this,$self=this;
  32376. var path,pathWithout;
  32377. return $core.withContext(function($ctx1) {
  32378. var $1,$2;
  32379. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32380. $ctx1.sendIdx[","]=1;
  32381. path=$self._toUrl_($1);
  32382. pathWithout=$self._commitPathJsFor_(aPackage);
  32383. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32384. if($core.assert($2)){
  32385. return pathWithout;
  32386. } else {
  32387. return path;
  32388. }
  32389. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32390. },
  32391. args: ["aPackage"],
  32392. 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 ]",
  32393. referencedClasses: [],
  32394. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32395. }),
  32396. $globals.AmdPackageHandler);
  32397. $core.addMethod(
  32398. $core.method({
  32399. selector: "exporterClass",
  32400. protocol: "accessing",
  32401. fn: function (){
  32402. var self=this,$self=this;
  32403. return $globals.AmdExporter;
  32404. },
  32405. args: [],
  32406. source: "exporterClass\x0a\x09^ AmdExporter",
  32407. referencedClasses: ["AmdExporter"],
  32408. messageSends: []
  32409. }),
  32410. $globals.AmdPackageHandler);
  32411. $core.addMethod(
  32412. $core.method({
  32413. selector: "load:",
  32414. protocol: "loading",
  32415. fn: function (aPackage){
  32416. var self=this,$self=this;
  32417. return $core.withContext(function($ctx1) {
  32418. var $1,$3,$2,$receiver;
  32419. return $recv($globals.Promise)._new_((function(model){
  32420. return $core.withContext(function($ctx2) {
  32421. $1=$recv($globals.Smalltalk)._amdRequire();
  32422. if(($receiver = $1) == null || $receiver.a$nil){
  32423. return $self._error_("AMD loader not present");
  32424. } else {
  32425. var require;
  32426. require=$receiver;
  32427. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32428. $ctx2.sendIdx[","]=1;
  32429. $2=[$3];
  32430. return $recv(require)._value_value_value_($2,(function(result){
  32431. return $core.withContext(function($ctx3) {
  32432. return $recv(model)._value_(result);
  32433. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32434. }),(function(error){
  32435. return $core.withContext(function($ctx3) {
  32436. return $recv(model)._signal_(error);
  32437. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32438. }));
  32439. }
  32440. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32441. }));
  32442. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32443. },
  32444. args: ["aPackage"],
  32445. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32446. referencedClasses: ["Promise", "Smalltalk"],
  32447. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32448. }),
  32449. $globals.AmdPackageHandler);
  32450. $core.addMethod(
  32451. $core.method({
  32452. selector: "namespaceFor:",
  32453. protocol: "committing",
  32454. fn: function (aPackage){
  32455. var self=this,$self=this;
  32456. return $core.withContext(function($ctx1) {
  32457. return $recv($recv(aPackage)._transport())._namespace();
  32458. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32459. },
  32460. args: ["aPackage"],
  32461. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32462. referencedClasses: [],
  32463. messageSends: ["namespace", "transport"]
  32464. }),
  32465. $globals.AmdPackageHandler);
  32466. $core.addMethod(
  32467. $core.method({
  32468. selector: "toUrl:",
  32469. protocol: "private",
  32470. fn: function (aString){
  32471. var self=this,$self=this;
  32472. return $core.withContext(function($ctx1) {
  32473. var $1,$receiver;
  32474. $1=$recv($globals.Smalltalk)._amdRequire();
  32475. if(($receiver = $1) == null || $receiver.a$nil){
  32476. return $self._error_("AMD loader not present");
  32477. } else {
  32478. var require;
  32479. require=$receiver;
  32480. return $recv($recv(require)._provided())._toUrl_(aString);
  32481. }
  32482. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32483. },
  32484. args: ["aString"],
  32485. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32486. referencedClasses: ["Smalltalk"],
  32487. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32488. }),
  32489. $globals.AmdPackageHandler);
  32490. $core.addMethod(
  32491. $core.method({
  32492. selector: "defaultNamespace",
  32493. protocol: "commit paths",
  32494. fn: function (){
  32495. var self=this,$self=this;
  32496. return $core.withContext(function($ctx1) {
  32497. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32498. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32499. },
  32500. args: [],
  32501. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32502. referencedClasses: ["Smalltalk"],
  32503. messageSends: ["defaultAmdNamespace"]
  32504. }),
  32505. $globals.AmdPackageHandler.a$cls);
  32506. $core.addMethod(
  32507. $core.method({
  32508. selector: "defaultNamespace:",
  32509. protocol: "commit paths",
  32510. fn: function (aString){
  32511. var self=this,$self=this;
  32512. return $core.withContext(function($ctx1) {
  32513. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32514. return self;
  32515. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32516. },
  32517. args: ["aString"],
  32518. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32519. referencedClasses: ["Smalltalk"],
  32520. messageSends: ["defaultAmdNamespace:"]
  32521. }),
  32522. $globals.AmdPackageHandler.a$cls);
  32523. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32524. $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.";
  32525. $core.addMethod(
  32526. $core.method({
  32527. selector: "asJavaScriptObject",
  32528. protocol: "converting",
  32529. fn: function (){
  32530. var self=this,$self=this;
  32531. return $core.withContext(function($ctx1) {
  32532. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32533. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32534. },
  32535. args: [],
  32536. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32537. referencedClasses: [],
  32538. messageSends: ["type"]
  32539. }),
  32540. $globals.PackageTransport);
  32541. $core.addMethod(
  32542. $core.method({
  32543. selector: "commit",
  32544. protocol: "committing",
  32545. fn: function (){
  32546. var self=this,$self=this;
  32547. return $core.withContext(function($ctx1) {
  32548. $recv($self._commitHandler())._commit_($self._package());
  32549. return self;
  32550. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32551. },
  32552. args: [],
  32553. source: "commit\x0a\x09self commitHandler commit: self package",
  32554. referencedClasses: [],
  32555. messageSends: ["commit:", "commitHandler", "package"]
  32556. }),
  32557. $globals.PackageTransport);
  32558. $core.addMethod(
  32559. $core.method({
  32560. selector: "commitHandler",
  32561. protocol: "factory",
  32562. fn: function (){
  32563. var self=this,$self=this;
  32564. return $core.withContext(function($ctx1) {
  32565. return $recv($self._commitHandlerClass())._new();
  32566. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32567. },
  32568. args: [],
  32569. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32570. referencedClasses: [],
  32571. messageSends: ["new", "commitHandlerClass"]
  32572. }),
  32573. $globals.PackageTransport);
  32574. $core.addMethod(
  32575. $core.method({
  32576. selector: "commitHandlerClass",
  32577. protocol: "accessing",
  32578. fn: function (){
  32579. var self=this,$self=this;
  32580. return $core.withContext(function($ctx1) {
  32581. $self._subclassResponsibility();
  32582. return self;
  32583. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32584. },
  32585. args: [],
  32586. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32587. referencedClasses: [],
  32588. messageSends: ["subclassResponsibility"]
  32589. }),
  32590. $globals.PackageTransport);
  32591. $core.addMethod(
  32592. $core.method({
  32593. selector: "commitOnSuccess:onError:",
  32594. protocol: "committing",
  32595. fn: function (aBlock,anotherBlock){
  32596. var self=this,$self=this;
  32597. return $core.withContext(function($ctx1) {
  32598. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32599. return self;
  32600. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32601. },
  32602. args: ["aBlock", "anotherBlock"],
  32603. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32604. referencedClasses: [],
  32605. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32606. }),
  32607. $globals.PackageTransport);
  32608. $core.addMethod(
  32609. $core.method({
  32610. selector: "definition",
  32611. protocol: "accessing",
  32612. fn: function (){
  32613. var self=this,$self=this;
  32614. return "";
  32615. },
  32616. args: [],
  32617. source: "definition\x0a\x09^ ''",
  32618. referencedClasses: [],
  32619. messageSends: []
  32620. }),
  32621. $globals.PackageTransport);
  32622. $core.addMethod(
  32623. $core.method({
  32624. selector: "load",
  32625. protocol: "loading",
  32626. fn: function (){
  32627. var self=this,$self=this;
  32628. return $core.withContext(function($ctx1) {
  32629. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32630. return $core.withContext(function($ctx2) {
  32631. return $recv($globals.Smalltalk)._postLoad();
  32632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32633. }));
  32634. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32635. },
  32636. args: [],
  32637. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32638. referencedClasses: ["Smalltalk"],
  32639. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32640. }),
  32641. $globals.PackageTransport);
  32642. $core.addMethod(
  32643. $core.method({
  32644. selector: "package",
  32645. protocol: "accessing",
  32646. fn: function (){
  32647. var self=this,$self=this;
  32648. return $self["@package"];
  32649. },
  32650. args: [],
  32651. source: "package\x0a\x09^ package",
  32652. referencedClasses: [],
  32653. messageSends: []
  32654. }),
  32655. $globals.PackageTransport);
  32656. $core.addMethod(
  32657. $core.method({
  32658. selector: "package:",
  32659. protocol: "accessing",
  32660. fn: function (aPackage){
  32661. var self=this,$self=this;
  32662. $self["@package"]=aPackage;
  32663. return self;
  32664. },
  32665. args: ["aPackage"],
  32666. source: "package: aPackage\x0a\x09package := aPackage",
  32667. referencedClasses: [],
  32668. messageSends: []
  32669. }),
  32670. $globals.PackageTransport);
  32671. $core.addMethod(
  32672. $core.method({
  32673. selector: "setupFromJson:",
  32674. protocol: "initialization",
  32675. fn: function (anObject){
  32676. var self=this,$self=this;
  32677. return self;
  32678. },
  32679. args: ["anObject"],
  32680. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32681. referencedClasses: [],
  32682. messageSends: []
  32683. }),
  32684. $globals.PackageTransport);
  32685. $core.addMethod(
  32686. $core.method({
  32687. selector: "type",
  32688. protocol: "accessing",
  32689. fn: function (){
  32690. var self=this,$self=this;
  32691. return $core.withContext(function($ctx1) {
  32692. return $recv($self._class())._type();
  32693. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32694. },
  32695. args: [],
  32696. source: "type\x0a\x09^ self class type",
  32697. referencedClasses: [],
  32698. messageSends: ["type", "class"]
  32699. }),
  32700. $globals.PackageTransport);
  32701. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32702. $core.addMethod(
  32703. $core.method({
  32704. selector: "classRegisteredFor:",
  32705. protocol: "accessing",
  32706. fn: function (aString){
  32707. var self=this,$self=this;
  32708. return $core.withContext(function($ctx1) {
  32709. return $recv($self["@registry"])._at_(aString);
  32710. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32711. },
  32712. args: ["aString"],
  32713. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32714. referencedClasses: [],
  32715. messageSends: ["at:"]
  32716. }),
  32717. $globals.PackageTransport.a$cls);
  32718. $core.addMethod(
  32719. $core.method({
  32720. selector: "defaultType",
  32721. protocol: "accessing",
  32722. fn: function (){
  32723. var self=this,$self=this;
  32724. return $core.withContext(function($ctx1) {
  32725. return $recv($globals.AmdPackageTransport)._type();
  32726. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32727. },
  32728. args: [],
  32729. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32730. referencedClasses: ["AmdPackageTransport"],
  32731. messageSends: ["type"]
  32732. }),
  32733. $globals.PackageTransport.a$cls);
  32734. $core.addMethod(
  32735. $core.method({
  32736. selector: "for:",
  32737. protocol: "instance creation",
  32738. fn: function (aString){
  32739. var self=this,$self=this;
  32740. return $core.withContext(function($ctx1) {
  32741. return $recv($self._classRegisteredFor_(aString))._new();
  32742. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32743. },
  32744. args: ["aString"],
  32745. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32746. referencedClasses: [],
  32747. messageSends: ["new", "classRegisteredFor:"]
  32748. }),
  32749. $globals.PackageTransport.a$cls);
  32750. $core.addMethod(
  32751. $core.method({
  32752. selector: "fromJson:",
  32753. protocol: "instance creation",
  32754. fn: function (anObject){
  32755. var self=this,$self=this;
  32756. return $core.withContext(function($ctx1) {
  32757. var $1,$2,$receiver;
  32758. if(($receiver = anObject) == null || $receiver.a$nil){
  32759. $1=$self._for_($self._defaultType());
  32760. $ctx1.sendIdx["for:"]=1;
  32761. return $1;
  32762. } else {
  32763. anObject;
  32764. }
  32765. $2=$self._for_($recv(anObject)._type());
  32766. $recv($2)._setupFromJson_(anObject);
  32767. return $recv($2)._yourself();
  32768. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32769. },
  32770. args: ["anObject"],
  32771. 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",
  32772. referencedClasses: [],
  32773. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32774. }),
  32775. $globals.PackageTransport.a$cls);
  32776. $core.addMethod(
  32777. $core.method({
  32778. selector: "initialize",
  32779. protocol: "initialization",
  32780. fn: function (){
  32781. var self=this,$self=this;
  32782. return $core.withContext(function($ctx1) {
  32783. var $1;
  32784. (
  32785. $ctx1.supercall = true,
  32786. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32787. $ctx1.supercall = false;
  32788. $1=$self.__eq_eq($globals.PackageTransport);
  32789. if($core.assert($1)){
  32790. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32791. $self["@registry"];
  32792. } else {
  32793. $self._register();
  32794. }
  32795. return self;
  32796. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32797. },
  32798. args: [],
  32799. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32800. referencedClasses: ["PackageTransport"],
  32801. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32802. }),
  32803. $globals.PackageTransport.a$cls);
  32804. $core.addMethod(
  32805. $core.method({
  32806. selector: "register",
  32807. protocol: "registration",
  32808. fn: function (){
  32809. var self=this,$self=this;
  32810. return $core.withContext(function($ctx1) {
  32811. $recv($globals.PackageTransport)._register_(self);
  32812. return self;
  32813. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32814. },
  32815. args: [],
  32816. source: "register\x0a\x09PackageTransport register: self",
  32817. referencedClasses: ["PackageTransport"],
  32818. messageSends: ["register:"]
  32819. }),
  32820. $globals.PackageTransport.a$cls);
  32821. $core.addMethod(
  32822. $core.method({
  32823. selector: "register:",
  32824. protocol: "registration",
  32825. fn: function (aClass){
  32826. var self=this,$self=this;
  32827. return $core.withContext(function($ctx1) {
  32828. var $1,$receiver;
  32829. $1=$recv(aClass)._type();
  32830. $ctx1.sendIdx["type"]=1;
  32831. if(($receiver = $1) == null || $receiver.a$nil){
  32832. $1;
  32833. } else {
  32834. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32835. }
  32836. return self;
  32837. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32838. },
  32839. args: ["aClass"],
  32840. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32841. referencedClasses: [],
  32842. messageSends: ["ifNotNil:", "type", "at:put:"]
  32843. }),
  32844. $globals.PackageTransport.a$cls);
  32845. $core.addMethod(
  32846. $core.method({
  32847. selector: "type",
  32848. protocol: "accessing",
  32849. fn: function (){
  32850. var self=this,$self=this;
  32851. return nil;
  32852. },
  32853. args: [],
  32854. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32855. referencedClasses: [],
  32856. messageSends: []
  32857. }),
  32858. $globals.PackageTransport.a$cls);
  32859. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32860. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32861. $core.addMethod(
  32862. $core.method({
  32863. selector: "asJavaScriptObject",
  32864. protocol: "converting",
  32865. fn: function (){
  32866. var self=this,$self=this;
  32867. return $core.withContext(function($ctx1) {
  32868. var $1;
  32869. $1=(
  32870. $ctx1.supercall = true,
  32871. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32872. $ctx1.supercall = false;
  32873. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32874. return $recv($1)._yourself();
  32875. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32876. },
  32877. args: [],
  32878. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32879. referencedClasses: [],
  32880. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32881. }),
  32882. $globals.AmdPackageTransport);
  32883. $core.addMethod(
  32884. $core.method({
  32885. selector: "commitHandlerClass",
  32886. protocol: "accessing",
  32887. fn: function (){
  32888. var self=this,$self=this;
  32889. return $globals.AmdPackageHandler;
  32890. },
  32891. args: [],
  32892. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32893. referencedClasses: ["AmdPackageHandler"],
  32894. messageSends: []
  32895. }),
  32896. $globals.AmdPackageTransport);
  32897. $core.addMethod(
  32898. $core.method({
  32899. selector: "defaultNamespace",
  32900. protocol: "defaults",
  32901. fn: function (){
  32902. var self=this,$self=this;
  32903. return $core.withContext(function($ctx1) {
  32904. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32905. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32906. },
  32907. args: [],
  32908. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32909. referencedClasses: ["Smalltalk"],
  32910. messageSends: ["defaultAmdNamespace"]
  32911. }),
  32912. $globals.AmdPackageTransport);
  32913. $core.addMethod(
  32914. $core.method({
  32915. selector: "definition",
  32916. protocol: "accessing",
  32917. fn: function (){
  32918. var self=this,$self=this;
  32919. return $core.withContext(function($ctx1) {
  32920. return $recv($globals.String)._streamContents_((function(stream){
  32921. return $core.withContext(function($ctx2) {
  32922. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32923. return $recv(stream)._print_($self._namespace());
  32924. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32925. }));
  32926. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32927. },
  32928. args: [],
  32929. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32930. referencedClasses: ["String"],
  32931. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32932. }),
  32933. $globals.AmdPackageTransport);
  32934. $core.addMethod(
  32935. $core.method({
  32936. selector: "namespace",
  32937. protocol: "accessing",
  32938. fn: function (){
  32939. var self=this,$self=this;
  32940. return $core.withContext(function($ctx1) {
  32941. var $1,$receiver;
  32942. $1=$self["@namespace"];
  32943. if(($receiver = $1) == null || $receiver.a$nil){
  32944. return $self._defaultNamespace();
  32945. } else {
  32946. return $1;
  32947. }
  32948. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32949. },
  32950. args: [],
  32951. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32952. referencedClasses: [],
  32953. messageSends: ["ifNil:", "defaultNamespace"]
  32954. }),
  32955. $globals.AmdPackageTransport);
  32956. $core.addMethod(
  32957. $core.method({
  32958. selector: "namespace:",
  32959. protocol: "accessing",
  32960. fn: function (aString){
  32961. var self=this,$self=this;
  32962. $self["@namespace"]=aString;
  32963. return self;
  32964. },
  32965. args: ["aString"],
  32966. source: "namespace: aString\x0a\x09namespace := aString",
  32967. referencedClasses: [],
  32968. messageSends: []
  32969. }),
  32970. $globals.AmdPackageTransport);
  32971. $core.addMethod(
  32972. $core.method({
  32973. selector: "printOn:",
  32974. protocol: "printing",
  32975. fn: function (aStream){
  32976. var self=this,$self=this;
  32977. return $core.withContext(function($ctx1) {
  32978. (
  32979. $ctx1.supercall = true,
  32980. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32981. $ctx1.supercall = false;
  32982. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32983. $ctx1.sendIdx["nextPutAll:"]=1;
  32984. $recv(aStream)._nextPutAll_($self._namespace());
  32985. $ctx1.sendIdx["nextPutAll:"]=2;
  32986. $recv(aStream)._nextPutAll_(")");
  32987. return self;
  32988. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32989. },
  32990. args: ["aStream"],
  32991. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32992. referencedClasses: [],
  32993. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32994. }),
  32995. $globals.AmdPackageTransport);
  32996. $core.addMethod(
  32997. $core.method({
  32998. selector: "setPath:",
  32999. protocol: "actions",
  33000. fn: function (aString){
  33001. var self=this,$self=this;
  33002. return $core.withContext(function($ctx1) {
  33003. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33004. return self;
  33005. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33006. },
  33007. args: ["aString"],
  33008. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  33009. referencedClasses: [],
  33010. messageSends: ["config:", "provided", "namespace"]
  33011. }),
  33012. $globals.AmdPackageTransport);
  33013. $core.addMethod(
  33014. $core.method({
  33015. selector: "setupFromJson:",
  33016. protocol: "initialization",
  33017. fn: function (anObject){
  33018. var self=this,$self=this;
  33019. return $core.withContext(function($ctx1) {
  33020. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33021. return self;
  33022. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33023. },
  33024. args: ["anObject"],
  33025. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33026. referencedClasses: [],
  33027. messageSends: ["namespace:", "at:"]
  33028. }),
  33029. $globals.AmdPackageTransport);
  33030. $core.addMethod(
  33031. $core.method({
  33032. selector: "namespace:",
  33033. protocol: "instance creation",
  33034. fn: function (aString){
  33035. var self=this,$self=this;
  33036. return $core.withContext(function($ctx1) {
  33037. var $1;
  33038. $1=$self._new();
  33039. $recv($1)._namespace_(aString);
  33040. return $recv($1)._yourself();
  33041. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33042. },
  33043. args: ["aString"],
  33044. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33045. referencedClasses: [],
  33046. messageSends: ["namespace:", "new", "yourself"]
  33047. }),
  33048. $globals.AmdPackageTransport.a$cls);
  33049. $core.addMethod(
  33050. $core.method({
  33051. selector: "type",
  33052. protocol: "accessing",
  33053. fn: function (){
  33054. var self=this,$self=this;
  33055. return "amd";
  33056. },
  33057. args: [],
  33058. source: "type\x0a\x09^ 'amd'",
  33059. referencedClasses: [],
  33060. messageSends: []
  33061. }),
  33062. $globals.AmdPackageTransport.a$cls);
  33063. $core.addMethod(
  33064. $core.method({
  33065. selector: "exportBehaviorDefinitionTo:using:",
  33066. protocol: "*Platform-ImportExport",
  33067. fn: function (aStream,anExporter){
  33068. var self=this,$self=this;
  33069. return $core.withContext(function($ctx1) {
  33070. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33071. return self;
  33072. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33073. },
  33074. args: ["aStream", "anExporter"],
  33075. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33076. referencedClasses: [],
  33077. messageSends: ["exportDefinitionOf:on:"]
  33078. }),
  33079. $globals.Class);
  33080. $core.addMethod(
  33081. $core.method({
  33082. selector: "exportBehaviorDefinitionTo:using:",
  33083. protocol: "*Platform-ImportExport",
  33084. fn: function (aStream,anExporter){
  33085. var self=this,$self=this;
  33086. return $core.withContext(function($ctx1) {
  33087. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33088. return self;
  33089. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33090. },
  33091. args: ["aStream", "anExporter"],
  33092. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33093. referencedClasses: [],
  33094. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33095. }),
  33096. $globals.Metaclass);
  33097. $core.addMethod(
  33098. $core.method({
  33099. selector: "commit",
  33100. protocol: "*Platform-ImportExport",
  33101. fn: function (){
  33102. var self=this,$self=this;
  33103. return $core.withContext(function($ctx1) {
  33104. return $recv($self._transport())._commit();
  33105. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33106. },
  33107. args: [],
  33108. source: "commit\x0a\x09^ self transport commit",
  33109. referencedClasses: [],
  33110. messageSends: ["commit", "transport"]
  33111. }),
  33112. $globals.Package);
  33113. $core.addMethod(
  33114. $core.method({
  33115. selector: "load",
  33116. protocol: "*Platform-ImportExport",
  33117. fn: function (){
  33118. var self=this,$self=this;
  33119. return $core.withContext(function($ctx1) {
  33120. return $recv($self._transport())._load();
  33121. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33122. },
  33123. args: [],
  33124. source: "load\x0a\x09^ self transport load",
  33125. referencedClasses: [],
  33126. messageSends: ["load", "transport"]
  33127. }),
  33128. $globals.Package);
  33129. $core.addMethod(
  33130. $core.method({
  33131. selector: "loadFromNamespace:",
  33132. protocol: "*Platform-ImportExport",
  33133. fn: function (aString){
  33134. var self=this,$self=this;
  33135. return $core.withContext(function($ctx1) {
  33136. var $1;
  33137. $1=$self._transport();
  33138. $recv($1)._namespace_(aString);
  33139. return $recv($1)._load();
  33140. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33141. },
  33142. args: ["aString"],
  33143. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33144. referencedClasses: [],
  33145. messageSends: ["namespace:", "transport", "load"]
  33146. }),
  33147. $globals.Package);
  33148. $core.addMethod(
  33149. $core.method({
  33150. selector: "load:",
  33151. protocol: "*Platform-ImportExport",
  33152. fn: function (aPackageName){
  33153. var self=this,$self=this;
  33154. return $core.withContext(function($ctx1) {
  33155. return $recv($self._named_(aPackageName))._load();
  33156. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33157. },
  33158. args: ["aPackageName"],
  33159. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33160. referencedClasses: [],
  33161. messageSends: ["load", "named:"]
  33162. }),
  33163. $globals.Package.a$cls);
  33164. $core.addMethod(
  33165. $core.method({
  33166. selector: "load:fromNamespace:",
  33167. protocol: "*Platform-ImportExport",
  33168. fn: function (aPackageName,aString){
  33169. var self=this,$self=this;
  33170. return $core.withContext(function($ctx1) {
  33171. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33172. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33173. },
  33174. args: ["aPackageName", "aString"],
  33175. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33176. referencedClasses: [],
  33177. messageSends: ["loadFromNamespace:", "named:"]
  33178. }),
  33179. $globals.Package.a$cls);
  33180. $core.addMethod(
  33181. $core.method({
  33182. selector: "methodsFor:",
  33183. protocol: "*Platform-ImportExport",
  33184. fn: function (aString){
  33185. var self=this,$self=this;
  33186. return $core.withContext(function($ctx1) {
  33187. var $1;
  33188. $1=$recv($globals.ClassProtocolReader)._new();
  33189. $recv($1)._class_category_(self,aString);
  33190. return $recv($1)._yourself();
  33191. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33192. },
  33193. args: ["aString"],
  33194. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33195. referencedClasses: ["ClassProtocolReader"],
  33196. messageSends: ["class:category:", "new", "yourself"]
  33197. }),
  33198. $globals.TBehaviorProvider);
  33199. $core.addMethod(
  33200. $core.method({
  33201. selector: "methodsFor:stamp:",
  33202. protocol: "*Platform-ImportExport",
  33203. fn: function (aString,aStamp){
  33204. var self=this,$self=this;
  33205. return $core.withContext(function($ctx1) {
  33206. return $self._methodsFor_(aString);
  33207. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33208. },
  33209. args: ["aString", "aStamp"],
  33210. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33211. referencedClasses: [],
  33212. messageSends: ["methodsFor:"]
  33213. }),
  33214. $globals.TBehaviorProvider);
  33215. $core.addMethod(
  33216. $core.method({
  33217. selector: "commentStamp",
  33218. protocol: "*Platform-ImportExport",
  33219. fn: function (){
  33220. var self=this,$self=this;
  33221. return $core.withContext(function($ctx1) {
  33222. var $1;
  33223. $1=$recv($globals.ClassCommentReader)._new();
  33224. $recv($1)._class_(self);
  33225. return $recv($1)._yourself();
  33226. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33227. },
  33228. args: [],
  33229. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33230. referencedClasses: ["ClassCommentReader"],
  33231. messageSends: ["class:", "new", "yourself"]
  33232. }),
  33233. $globals.TMasterBehavior);
  33234. $core.addMethod(
  33235. $core.method({
  33236. selector: "commentStamp:prior:",
  33237. protocol: "*Platform-ImportExport",
  33238. fn: function (aStamp,prior){
  33239. var self=this,$self=this;
  33240. return $core.withContext(function($ctx1) {
  33241. return $self._commentStamp();
  33242. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33243. },
  33244. args: ["aStamp", "prior"],
  33245. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33246. referencedClasses: [],
  33247. messageSends: ["commentStamp"]
  33248. }),
  33249. $globals.TMasterBehavior);
  33250. $core.addMethod(
  33251. $core.method({
  33252. selector: "exportBehaviorDefinitionTo:using:",
  33253. protocol: "*Platform-ImportExport",
  33254. fn: function (aStream,anExporter){
  33255. var self=this,$self=this;
  33256. return $core.withContext(function($ctx1) {
  33257. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33258. return self;
  33259. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33260. },
  33261. args: ["aStream", "anExporter"],
  33262. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33263. referencedClasses: [],
  33264. messageSends: ["exportTraitDefinitionOf:on:"]
  33265. }),
  33266. $globals.Trait);
  33267. });
  33268. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33269. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33270. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33271. var $pkg = $core.addPackage("Compiler-AST");
  33272. $pkg.innerEval = function (expr) { return eval(expr); };
  33273. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  33274. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33275. $globals.ASTNode.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  33276. $core.addMethod(
  33277. $core.method({
  33278. selector: "inPosition:",
  33279. protocol: "testing",
  33280. fn: function (aPoint){
  33281. var self=this,$self=this;
  33282. return $core.withContext(function($ctx1) {
  33283. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33284. return $core.withContext(function($ctx2) {
  33285. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33287. }));
  33288. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33289. },
  33290. args: ["aPoint"],
  33291. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33292. referencedClasses: [],
  33293. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33294. }),
  33295. $globals.ASTNode);
  33296. $core.addMethod(
  33297. $core.method({
  33298. selector: "isAssignmentNode",
  33299. protocol: "testing",
  33300. fn: function (){
  33301. var self=this,$self=this;
  33302. return false;
  33303. },
  33304. args: [],
  33305. source: "isAssignmentNode\x0a\x09^ false",
  33306. referencedClasses: [],
  33307. messageSends: []
  33308. }),
  33309. $globals.ASTNode);
  33310. $core.addMethod(
  33311. $core.method({
  33312. selector: "isBlockNode",
  33313. protocol: "testing",
  33314. fn: function (){
  33315. var self=this,$self=this;
  33316. return false;
  33317. },
  33318. args: [],
  33319. source: "isBlockNode\x0a\x09^ false",
  33320. referencedClasses: [],
  33321. messageSends: []
  33322. }),
  33323. $globals.ASTNode);
  33324. $core.addMethod(
  33325. $core.method({
  33326. selector: "isBlockSequenceNode",
  33327. protocol: "testing",
  33328. fn: function (){
  33329. var self=this,$self=this;
  33330. return false;
  33331. },
  33332. args: [],
  33333. source: "isBlockSequenceNode\x0a\x09^ false",
  33334. referencedClasses: [],
  33335. messageSends: []
  33336. }),
  33337. $globals.ASTNode);
  33338. $core.addMethod(
  33339. $core.method({
  33340. selector: "isCascadeNode",
  33341. protocol: "testing",
  33342. fn: function (){
  33343. var self=this,$self=this;
  33344. return false;
  33345. },
  33346. args: [],
  33347. source: "isCascadeNode\x0a\x09^ false",
  33348. referencedClasses: [],
  33349. messageSends: []
  33350. }),
  33351. $globals.ASTNode);
  33352. $core.addMethod(
  33353. $core.method({
  33354. selector: "isImmutable",
  33355. protocol: "testing",
  33356. fn: function (){
  33357. var self=this,$self=this;
  33358. return false;
  33359. },
  33360. args: [],
  33361. source: "isImmutable\x0a\x09^ false",
  33362. referencedClasses: [],
  33363. messageSends: []
  33364. }),
  33365. $globals.ASTNode);
  33366. $core.addMethod(
  33367. $core.method({
  33368. selector: "isJSStatementNode",
  33369. protocol: "testing",
  33370. fn: function (){
  33371. var self=this,$self=this;
  33372. return false;
  33373. },
  33374. args: [],
  33375. source: "isJSStatementNode\x0a\x09^ false",
  33376. referencedClasses: [],
  33377. messageSends: []
  33378. }),
  33379. $globals.ASTNode);
  33380. $core.addMethod(
  33381. $core.method({
  33382. selector: "isNavigationNode",
  33383. protocol: "testing",
  33384. fn: function (){
  33385. var self=this,$self=this;
  33386. return false;
  33387. },
  33388. args: [],
  33389. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33390. referencedClasses: [],
  33391. messageSends: []
  33392. }),
  33393. $globals.ASTNode);
  33394. $core.addMethod(
  33395. $core.method({
  33396. selector: "isReturnNode",
  33397. protocol: "testing",
  33398. fn: function (){
  33399. var self=this,$self=this;
  33400. return false;
  33401. },
  33402. args: [],
  33403. source: "isReturnNode\x0a\x09^ false",
  33404. referencedClasses: [],
  33405. messageSends: []
  33406. }),
  33407. $globals.ASTNode);
  33408. $core.addMethod(
  33409. $core.method({
  33410. selector: "isSendNode",
  33411. protocol: "testing",
  33412. fn: function (){
  33413. var self=this,$self=this;
  33414. return false;
  33415. },
  33416. args: [],
  33417. source: "isSendNode\x0a\x09^ false",
  33418. referencedClasses: [],
  33419. messageSends: []
  33420. }),
  33421. $globals.ASTNode);
  33422. $core.addMethod(
  33423. $core.method({
  33424. selector: "isSequenceNode",
  33425. protocol: "testing",
  33426. fn: function (){
  33427. var self=this,$self=this;
  33428. return false;
  33429. },
  33430. args: [],
  33431. source: "isSequenceNode\x0a\x09^ false",
  33432. referencedClasses: [],
  33433. messageSends: []
  33434. }),
  33435. $globals.ASTNode);
  33436. $core.addMethod(
  33437. $core.method({
  33438. selector: "isSuperKeyword",
  33439. protocol: "testing",
  33440. fn: function (){
  33441. var self=this,$self=this;
  33442. return false;
  33443. },
  33444. args: [],
  33445. source: "isSuperKeyword\x0a\x09^ false",
  33446. referencedClasses: [],
  33447. messageSends: []
  33448. }),
  33449. $globals.ASTNode);
  33450. $core.addMethod(
  33451. $core.method({
  33452. selector: "isValueNode",
  33453. protocol: "testing",
  33454. fn: function (){
  33455. var self=this,$self=this;
  33456. return false;
  33457. },
  33458. args: [],
  33459. source: "isValueNode\x0a\x09^ false",
  33460. referencedClasses: [],
  33461. messageSends: []
  33462. }),
  33463. $globals.ASTNode);
  33464. $core.addMethod(
  33465. $core.method({
  33466. selector: "isVariableNode",
  33467. protocol: "testing",
  33468. fn: function (){
  33469. var self=this,$self=this;
  33470. return false;
  33471. },
  33472. args: [],
  33473. source: "isVariableNode\x0a\x09^ false",
  33474. referencedClasses: [],
  33475. messageSends: []
  33476. }),
  33477. $globals.ASTNode);
  33478. $core.addMethod(
  33479. $core.method({
  33480. selector: "location:",
  33481. protocol: "accessing",
  33482. fn: function (aLocation){
  33483. var self=this,$self=this;
  33484. return $core.withContext(function($ctx1) {
  33485. var $3,$2,$1;
  33486. $3=$recv(aLocation)._start();
  33487. $ctx1.sendIdx["start"]=1;
  33488. $2=$recv($3)._line();
  33489. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33490. $self._position_($1);
  33491. return self;
  33492. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33493. },
  33494. args: ["aLocation"],
  33495. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33496. referencedClasses: [],
  33497. messageSends: ["position:", "@", "line", "start", "column"]
  33498. }),
  33499. $globals.ASTNode);
  33500. $core.addMethod(
  33501. $core.method({
  33502. selector: "method",
  33503. protocol: "accessing",
  33504. fn: function (){
  33505. var self=this,$self=this;
  33506. return $core.withContext(function($ctx1) {
  33507. var $1,$receiver;
  33508. $1=$self._parent();
  33509. if(($receiver = $1) == null || $receiver.a$nil){
  33510. return $1;
  33511. } else {
  33512. var node;
  33513. node=$receiver;
  33514. return $recv(node)._method();
  33515. }
  33516. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33517. },
  33518. args: [],
  33519. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33520. referencedClasses: [],
  33521. messageSends: ["ifNotNil:", "parent", "method"]
  33522. }),
  33523. $globals.ASTNode);
  33524. $core.addMethod(
  33525. $core.method({
  33526. selector: "navigationNodeAt:ifAbsent:",
  33527. protocol: "accessing",
  33528. fn: function (aPoint,aBlock){
  33529. var self=this,$self=this;
  33530. var children;
  33531. return $core.withContext(function($ctx1) {
  33532. var $2,$1;
  33533. var $early={};
  33534. try {
  33535. children=$recv($self._allDagChildren())._select_((function(each){
  33536. return $core.withContext(function($ctx2) {
  33537. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33538. return $core.withContext(function($ctx3) {
  33539. return $recv(each)._inPosition_(aPoint);
  33540. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33541. }));
  33542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33543. }));
  33544. $recv(children)._ifEmpty_((function(){
  33545. return $core.withContext(function($ctx2) {
  33546. throw $early=[$recv(aBlock)._value()];
  33547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33548. }));
  33549. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33550. return $core.withContext(function($ctx2) {
  33551. $2=$recv(a)._positionStart();
  33552. $ctx2.sendIdx["positionStart"]=1;
  33553. $1=$recv($2)._dist_(aPoint);
  33554. $ctx2.sendIdx["dist:"]=1;
  33555. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33556. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33557. })))._first();
  33558. }
  33559. catch(e) {if(e===$early)return e[0]; throw e}
  33560. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33561. },
  33562. args: ["aPoint", "aBlock"],
  33563. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allDagChildren select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  33564. referencedClasses: [],
  33565. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33566. }),
  33567. $globals.ASTNode);
  33568. $core.addMethod(
  33569. $core.method({
  33570. selector: "parent",
  33571. protocol: "accessing",
  33572. fn: function (){
  33573. var self=this,$self=this;
  33574. return $self["@parent"];
  33575. },
  33576. args: [],
  33577. source: "parent\x0a\x09^ parent",
  33578. referencedClasses: [],
  33579. messageSends: []
  33580. }),
  33581. $globals.ASTNode);
  33582. $core.addMethod(
  33583. $core.method({
  33584. selector: "parent:",
  33585. protocol: "accessing",
  33586. fn: function (aNode){
  33587. var self=this,$self=this;
  33588. $self["@parent"]=aNode;
  33589. return self;
  33590. },
  33591. args: ["aNode"],
  33592. source: "parent: aNode\x0a\x09parent := aNode",
  33593. referencedClasses: [],
  33594. messageSends: []
  33595. }),
  33596. $globals.ASTNode);
  33597. $core.addMethod(
  33598. $core.method({
  33599. selector: "position",
  33600. protocol: "accessing",
  33601. fn: function (){
  33602. var self=this,$self=this;
  33603. return $core.withContext(function($ctx1) {
  33604. var $1,$2,$receiver;
  33605. $1=$self["@position"];
  33606. if(($receiver = $1) == null || $receiver.a$nil){
  33607. $2=$self._parent();
  33608. if(($receiver = $2) == null || $receiver.a$nil){
  33609. return $2;
  33610. } else {
  33611. var node;
  33612. node=$receiver;
  33613. return $recv(node)._position();
  33614. }
  33615. } else {
  33616. return $1;
  33617. }
  33618. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33619. },
  33620. args: [],
  33621. 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 ] ]",
  33622. referencedClasses: [],
  33623. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33624. }),
  33625. $globals.ASTNode);
  33626. $core.addMethod(
  33627. $core.method({
  33628. selector: "position:",
  33629. protocol: "accessing",
  33630. fn: function (aPosition){
  33631. var self=this,$self=this;
  33632. $self["@position"]=aPosition;
  33633. return self;
  33634. },
  33635. args: ["aPosition"],
  33636. source: "position: aPosition\x0a\x09position := aPosition",
  33637. referencedClasses: [],
  33638. messageSends: []
  33639. }),
  33640. $globals.ASTNode);
  33641. $core.addMethod(
  33642. $core.method({
  33643. selector: "positionEnd",
  33644. protocol: "accessing",
  33645. fn: function (){
  33646. var self=this,$self=this;
  33647. return $core.withContext(function($ctx1) {
  33648. var $1,$6,$5,$4,$3,$2;
  33649. $1=$self._positionStart();
  33650. $6=$self._source();
  33651. $ctx1.sendIdx["source"]=1;
  33652. $5=$recv($6)._lines();
  33653. $ctx1.sendIdx["lines"]=1;
  33654. $4=$recv($5)._size();
  33655. $ctx1.sendIdx["size"]=1;
  33656. $3=$recv($4).__minus((1));
  33657. $ctx1.sendIdx["-"]=1;
  33658. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33659. return $recv($1).__plus($2);
  33660. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33661. },
  33662. args: [],
  33663. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33664. referencedClasses: [],
  33665. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33666. }),
  33667. $globals.ASTNode);
  33668. $core.addMethod(
  33669. $core.method({
  33670. selector: "positionStart",
  33671. protocol: "accessing",
  33672. fn: function (){
  33673. var self=this,$self=this;
  33674. return $core.withContext(function($ctx1) {
  33675. return $self._position();
  33676. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33677. },
  33678. args: [],
  33679. source: "positionStart\x0a\x09^ self position",
  33680. referencedClasses: [],
  33681. messageSends: ["position"]
  33682. }),
  33683. $globals.ASTNode);
  33684. $core.addMethod(
  33685. $core.method({
  33686. selector: "requiresSmalltalkContext",
  33687. protocol: "testing",
  33688. fn: function (){
  33689. var self=this,$self=this;
  33690. return $core.withContext(function($ctx1) {
  33691. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33692. return $core.withContext(function($ctx2) {
  33693. return $recv(each)._requiresSmalltalkContext();
  33694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33695. }),(function(){
  33696. return nil;
  33697. })))._notNil();
  33698. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33699. },
  33700. args: [],
  33701. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self dagChildren \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  33702. referencedClasses: [],
  33703. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33704. }),
  33705. $globals.ASTNode);
  33706. $core.addMethod(
  33707. $core.method({
  33708. selector: "shouldBeAliased",
  33709. protocol: "accessing",
  33710. fn: function (){
  33711. var self=this,$self=this;
  33712. return $core.withContext(function($ctx1) {
  33713. var $1,$receiver;
  33714. $1=$self["@shouldBeAliased"];
  33715. if(($receiver = $1) == null || $receiver.a$nil){
  33716. return false;
  33717. } else {
  33718. return $1;
  33719. }
  33720. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33721. },
  33722. args: [],
  33723. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33724. referencedClasses: [],
  33725. messageSends: ["ifNil:"]
  33726. }),
  33727. $globals.ASTNode);
  33728. $core.addMethod(
  33729. $core.method({
  33730. selector: "shouldBeAliased:",
  33731. protocol: "accessing",
  33732. fn: function (aBoolean){
  33733. var self=this,$self=this;
  33734. $self["@shouldBeAliased"]=aBoolean;
  33735. return self;
  33736. },
  33737. args: ["aBoolean"],
  33738. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33739. referencedClasses: [],
  33740. messageSends: []
  33741. }),
  33742. $globals.ASTNode);
  33743. $core.addMethod(
  33744. $core.method({
  33745. selector: "size",
  33746. protocol: "accessing",
  33747. fn: function (){
  33748. var self=this,$self=this;
  33749. return $core.withContext(function($ctx1) {
  33750. return $recv($self._source())._size();
  33751. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33752. },
  33753. args: [],
  33754. source: "size\x0a\x09^ self source size",
  33755. referencedClasses: [],
  33756. messageSends: ["size", "source"]
  33757. }),
  33758. $globals.ASTNode);
  33759. $core.addMethod(
  33760. $core.method({
  33761. selector: "source",
  33762. protocol: "accessing",
  33763. fn: function (){
  33764. var self=this,$self=this;
  33765. return $core.withContext(function($ctx1) {
  33766. var $1,$receiver;
  33767. $1=$self["@source"];
  33768. if(($receiver = $1) == null || $receiver.a$nil){
  33769. return "";
  33770. } else {
  33771. return $1;
  33772. }
  33773. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33774. },
  33775. args: [],
  33776. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33777. referencedClasses: [],
  33778. messageSends: ["ifNil:"]
  33779. }),
  33780. $globals.ASTNode);
  33781. $core.addMethod(
  33782. $core.method({
  33783. selector: "source:",
  33784. protocol: "accessing",
  33785. fn: function (aString){
  33786. var self=this,$self=this;
  33787. $self["@source"]=aString;
  33788. return self;
  33789. },
  33790. args: ["aString"],
  33791. source: "source: aString\x0a\x09source := aString",
  33792. referencedClasses: [],
  33793. messageSends: []
  33794. }),
  33795. $globals.ASTNode);
  33796. $core.addMethod(
  33797. $core.method({
  33798. selector: "withTail:",
  33799. protocol: "building",
  33800. fn: function (aCollection){
  33801. var self=this,$self=this;
  33802. return $core.withContext(function($ctx1) {
  33803. var $1;
  33804. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33805. return $core.withContext(function($ctx2) {
  33806. $1=$recv($globals.SendNode)._new();
  33807. $recv($1)._position_($recv(send)._position());
  33808. $recv($1)._source_($recv(send)._source());
  33809. $recv($1)._receiver_(receiver);
  33810. $recv($1)._selector_($recv(send)._selector());
  33811. $recv($1)._arguments_($recv(send)._arguments());
  33812. return $recv($1)._yourself();
  33813. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33814. }));
  33815. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33816. },
  33817. args: ["aCollection"],
  33818. source: "withTail: aCollection\x0a\x09^ aCollection inject: self into: [\x0a\x09\x09:receiver :send | SendNode new\x0a\x09\x09\x09position: send position;\x0a\x09\x09\x09source: send source;\x0a\x09\x09\x09receiver: receiver;\x0a\x09\x09\x09selector: send selector;\x0a\x09\x09\x09arguments: send arguments;\x0a\x09\x09\x09yourself ]",
  33819. referencedClasses: ["SendNode"],
  33820. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33821. }),
  33822. $globals.ASTNode);
  33823. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33824. $globals.AssignmentNode.comment="I represent an assignment node.";
  33825. $core.addMethod(
  33826. $core.method({
  33827. selector: "acceptDagVisitor:",
  33828. protocol: "visiting",
  33829. fn: function (aVisitor){
  33830. var self=this,$self=this;
  33831. return $core.withContext(function($ctx1) {
  33832. return $recv(aVisitor)._visitAssignmentNode_(self);
  33833. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33834. },
  33835. args: ["aVisitor"],
  33836. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33837. referencedClasses: [],
  33838. messageSends: ["visitAssignmentNode:"]
  33839. }),
  33840. $globals.AssignmentNode);
  33841. $core.addMethod(
  33842. $core.method({
  33843. selector: "dagChildren",
  33844. protocol: "accessing",
  33845. fn: function (){
  33846. var self=this,$self=this;
  33847. return $core.withContext(function($ctx1) {
  33848. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33849. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33850. },
  33851. args: [],
  33852. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33853. referencedClasses: ["Array"],
  33854. messageSends: ["with:with:", "left", "right"]
  33855. }),
  33856. $globals.AssignmentNode);
  33857. $core.addMethod(
  33858. $core.method({
  33859. selector: "isAssignmentNode",
  33860. protocol: "testing",
  33861. fn: function (){
  33862. var self=this,$self=this;
  33863. return true;
  33864. },
  33865. args: [],
  33866. source: "isAssignmentNode\x0a\x09^ true",
  33867. referencedClasses: [],
  33868. messageSends: []
  33869. }),
  33870. $globals.AssignmentNode);
  33871. $core.addMethod(
  33872. $core.method({
  33873. selector: "left",
  33874. protocol: "accessing",
  33875. fn: function (){
  33876. var self=this,$self=this;
  33877. return $self["@left"];
  33878. },
  33879. args: [],
  33880. source: "left\x0a\x09^ left",
  33881. referencedClasses: [],
  33882. messageSends: []
  33883. }),
  33884. $globals.AssignmentNode);
  33885. $core.addMethod(
  33886. $core.method({
  33887. selector: "left:",
  33888. protocol: "accessing",
  33889. fn: function (aNode){
  33890. var self=this,$self=this;
  33891. $self["@left"]=aNode;
  33892. return self;
  33893. },
  33894. args: ["aNode"],
  33895. source: "left: aNode\x0a\x09left := aNode",
  33896. referencedClasses: [],
  33897. messageSends: []
  33898. }),
  33899. $globals.AssignmentNode);
  33900. $core.addMethod(
  33901. $core.method({
  33902. selector: "right",
  33903. protocol: "accessing",
  33904. fn: function (){
  33905. var self=this,$self=this;
  33906. return $self["@right"];
  33907. },
  33908. args: [],
  33909. source: "right\x0a\x09^ right",
  33910. referencedClasses: [],
  33911. messageSends: []
  33912. }),
  33913. $globals.AssignmentNode);
  33914. $core.addMethod(
  33915. $core.method({
  33916. selector: "right:",
  33917. protocol: "accessing",
  33918. fn: function (aNode){
  33919. var self=this,$self=this;
  33920. $self["@right"]=aNode;
  33921. return self;
  33922. },
  33923. args: ["aNode"],
  33924. source: "right: aNode\x0a\x09right := aNode",
  33925. referencedClasses: [],
  33926. messageSends: []
  33927. }),
  33928. $globals.AssignmentNode);
  33929. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33930. $globals.BlockNode.comment="I represent an block closure node.";
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "acceptDagVisitor:",
  33934. protocol: "visiting",
  33935. fn: function (aVisitor){
  33936. var self=this,$self=this;
  33937. return $core.withContext(function($ctx1) {
  33938. return $recv(aVisitor)._visitBlockNode_(self);
  33939. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33940. },
  33941. args: ["aVisitor"],
  33942. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33943. referencedClasses: [],
  33944. messageSends: ["visitBlockNode:"]
  33945. }),
  33946. $globals.BlockNode);
  33947. $core.addMethod(
  33948. $core.method({
  33949. selector: "isBlockNode",
  33950. protocol: "testing",
  33951. fn: function (){
  33952. var self=this,$self=this;
  33953. return true;
  33954. },
  33955. args: [],
  33956. source: "isBlockNode\x0a\x09^ true",
  33957. referencedClasses: [],
  33958. messageSends: []
  33959. }),
  33960. $globals.BlockNode);
  33961. $core.addMethod(
  33962. $core.method({
  33963. selector: "parameters",
  33964. protocol: "accessing",
  33965. fn: function (){
  33966. var self=this,$self=this;
  33967. return $core.withContext(function($ctx1) {
  33968. var $1,$receiver;
  33969. $1=$self["@parameters"];
  33970. if(($receiver = $1) == null || $receiver.a$nil){
  33971. $self["@parameters"]=$recv($globals.Array)._new();
  33972. return $self["@parameters"];
  33973. } else {
  33974. return $1;
  33975. }
  33976. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33977. },
  33978. args: [],
  33979. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33980. referencedClasses: ["Array"],
  33981. messageSends: ["ifNil:", "new"]
  33982. }),
  33983. $globals.BlockNode);
  33984. $core.addMethod(
  33985. $core.method({
  33986. selector: "parameters:",
  33987. protocol: "accessing",
  33988. fn: function (aCollection){
  33989. var self=this,$self=this;
  33990. $self["@parameters"]=aCollection;
  33991. return self;
  33992. },
  33993. args: ["aCollection"],
  33994. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33995. referencedClasses: [],
  33996. messageSends: []
  33997. }),
  33998. $globals.BlockNode);
  33999. $core.addMethod(
  34000. $core.method({
  34001. selector: "scope",
  34002. protocol: "accessing",
  34003. fn: function (){
  34004. var self=this,$self=this;
  34005. return $self["@scope"];
  34006. },
  34007. args: [],
  34008. source: "scope\x0a\x09^ scope",
  34009. referencedClasses: [],
  34010. messageSends: []
  34011. }),
  34012. $globals.BlockNode);
  34013. $core.addMethod(
  34014. $core.method({
  34015. selector: "scope:",
  34016. protocol: "accessing",
  34017. fn: function (aLexicalScope){
  34018. var self=this,$self=this;
  34019. $self["@scope"]=aLexicalScope;
  34020. return self;
  34021. },
  34022. args: ["aLexicalScope"],
  34023. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34024. referencedClasses: [],
  34025. messageSends: []
  34026. }),
  34027. $globals.BlockNode);
  34028. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34029. $globals.CascadeNode.comment="I represent an cascade node.";
  34030. $core.addMethod(
  34031. $core.method({
  34032. selector: "acceptDagVisitor:",
  34033. protocol: "visiting",
  34034. fn: function (aVisitor){
  34035. var self=this,$self=this;
  34036. return $core.withContext(function($ctx1) {
  34037. return $recv(aVisitor)._visitCascadeNode_(self);
  34038. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34039. },
  34040. args: ["aVisitor"],
  34041. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34042. referencedClasses: [],
  34043. messageSends: ["visitCascadeNode:"]
  34044. }),
  34045. $globals.CascadeNode);
  34046. $core.addMethod(
  34047. $core.method({
  34048. selector: "isCascadeNode",
  34049. protocol: "testing",
  34050. fn: function (){
  34051. var self=this,$self=this;
  34052. return true;
  34053. },
  34054. args: [],
  34055. source: "isCascadeNode\x0a\x09^ true",
  34056. referencedClasses: [],
  34057. messageSends: []
  34058. }),
  34059. $globals.CascadeNode);
  34060. $core.addMethod(
  34061. $core.method({
  34062. selector: "receiver",
  34063. protocol: "accessing",
  34064. fn: function (){
  34065. var self=this,$self=this;
  34066. return $self["@receiver"];
  34067. },
  34068. args: [],
  34069. source: "receiver\x0a\x09^ receiver",
  34070. referencedClasses: [],
  34071. messageSends: []
  34072. }),
  34073. $globals.CascadeNode);
  34074. $core.addMethod(
  34075. $core.method({
  34076. selector: "receiver:",
  34077. protocol: "accessing",
  34078. fn: function (aNode){
  34079. var self=this,$self=this;
  34080. $self["@receiver"]=aNode;
  34081. return self;
  34082. },
  34083. args: ["aNode"],
  34084. source: "receiver: aNode\x0a\x09receiver := aNode",
  34085. referencedClasses: [],
  34086. messageSends: []
  34087. }),
  34088. $globals.CascadeNode);
  34089. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34090. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34091. $core.addMethod(
  34092. $core.method({
  34093. selector: "acceptDagVisitor:",
  34094. protocol: "visiting",
  34095. fn: function (aVisitor){
  34096. var self=this,$self=this;
  34097. return $core.withContext(function($ctx1) {
  34098. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34099. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34100. },
  34101. args: ["aVisitor"],
  34102. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34103. referencedClasses: [],
  34104. messageSends: ["visitDynamicArrayNode:"]
  34105. }),
  34106. $globals.DynamicArrayNode);
  34107. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34108. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34109. $core.addMethod(
  34110. $core.method({
  34111. selector: "acceptDagVisitor:",
  34112. protocol: "visiting",
  34113. fn: function (aVisitor){
  34114. var self=this,$self=this;
  34115. return $core.withContext(function($ctx1) {
  34116. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34117. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34118. },
  34119. args: ["aVisitor"],
  34120. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34121. referencedClasses: [],
  34122. messageSends: ["visitDynamicDictionaryNode:"]
  34123. }),
  34124. $globals.DynamicDictionaryNode);
  34125. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34126. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34127. $core.addMethod(
  34128. $core.method({
  34129. selector: "acceptDagVisitor:",
  34130. protocol: "visiting",
  34131. fn: function (aVisitor){
  34132. var self=this,$self=this;
  34133. return $core.withContext(function($ctx1) {
  34134. return $recv(aVisitor)._visitJSStatementNode_(self);
  34135. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34136. },
  34137. args: ["aVisitor"],
  34138. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34139. referencedClasses: [],
  34140. messageSends: ["visitJSStatementNode:"]
  34141. }),
  34142. $globals.JSStatementNode);
  34143. $core.addMethod(
  34144. $core.method({
  34145. selector: "isJSStatementNode",
  34146. protocol: "testing",
  34147. fn: function (){
  34148. var self=this,$self=this;
  34149. return true;
  34150. },
  34151. args: [],
  34152. source: "isJSStatementNode\x0a\x09^ true",
  34153. referencedClasses: [],
  34154. messageSends: []
  34155. }),
  34156. $globals.JSStatementNode);
  34157. $core.addMethod(
  34158. $core.method({
  34159. selector: "requiresSmalltalkContext",
  34160. protocol: "testing",
  34161. fn: function (){
  34162. var self=this,$self=this;
  34163. return true;
  34164. },
  34165. args: [],
  34166. source: "requiresSmalltalkContext\x0a\x09^ true",
  34167. referencedClasses: [],
  34168. messageSends: []
  34169. }),
  34170. $globals.JSStatementNode);
  34171. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34172. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34173. $core.addMethod(
  34174. $core.method({
  34175. selector: "acceptDagVisitor:",
  34176. protocol: "visiting",
  34177. fn: function (aVisitor){
  34178. var self=this,$self=this;
  34179. return $core.withContext(function($ctx1) {
  34180. return $recv(aVisitor)._visitMethodNode_(self);
  34181. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34182. },
  34183. args: ["aVisitor"],
  34184. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34185. referencedClasses: [],
  34186. messageSends: ["visitMethodNode:"]
  34187. }),
  34188. $globals.MethodNode);
  34189. $core.addMethod(
  34190. $core.method({
  34191. selector: "arguments",
  34192. protocol: "accessing",
  34193. fn: function (){
  34194. var self=this,$self=this;
  34195. return $core.withContext(function($ctx1) {
  34196. var $1,$receiver;
  34197. $1=$self["@arguments"];
  34198. if(($receiver = $1) == null || $receiver.a$nil){
  34199. return [];
  34200. } else {
  34201. return $1;
  34202. }
  34203. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34204. },
  34205. args: [],
  34206. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34207. referencedClasses: [],
  34208. messageSends: ["ifNil:"]
  34209. }),
  34210. $globals.MethodNode);
  34211. $core.addMethod(
  34212. $core.method({
  34213. selector: "arguments:",
  34214. protocol: "accessing",
  34215. fn: function (aCollection){
  34216. var self=this,$self=this;
  34217. $self["@arguments"]=aCollection;
  34218. return self;
  34219. },
  34220. args: ["aCollection"],
  34221. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34222. referencedClasses: [],
  34223. messageSends: []
  34224. }),
  34225. $globals.MethodNode);
  34226. $core.addMethod(
  34227. $core.method({
  34228. selector: "classReferences",
  34229. protocol: "accessing",
  34230. fn: function (){
  34231. var self=this,$self=this;
  34232. return $self["@classReferences"];
  34233. },
  34234. args: [],
  34235. source: "classReferences\x0a\x09^ classReferences",
  34236. referencedClasses: [],
  34237. messageSends: []
  34238. }),
  34239. $globals.MethodNode);
  34240. $core.addMethod(
  34241. $core.method({
  34242. selector: "classReferences:",
  34243. protocol: "accessing",
  34244. fn: function (aCollection){
  34245. var self=this,$self=this;
  34246. $self["@classReferences"]=aCollection;
  34247. return self;
  34248. },
  34249. args: ["aCollection"],
  34250. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34251. referencedClasses: [],
  34252. messageSends: []
  34253. }),
  34254. $globals.MethodNode);
  34255. $core.addMethod(
  34256. $core.method({
  34257. selector: "messageSends",
  34258. protocol: "accessing",
  34259. fn: function (){
  34260. var self=this,$self=this;
  34261. return $core.withContext(function($ctx1) {
  34262. return $recv($self._sendIndexes())._keys();
  34263. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34264. },
  34265. args: [],
  34266. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34267. referencedClasses: [],
  34268. messageSends: ["keys", "sendIndexes"]
  34269. }),
  34270. $globals.MethodNode);
  34271. $core.addMethod(
  34272. $core.method({
  34273. selector: "method",
  34274. protocol: "accessing",
  34275. fn: function (){
  34276. var self=this,$self=this;
  34277. return self;
  34278. },
  34279. args: [],
  34280. source: "method\x0a\x09^ self",
  34281. referencedClasses: [],
  34282. messageSends: []
  34283. }),
  34284. $globals.MethodNode);
  34285. $core.addMethod(
  34286. $core.method({
  34287. selector: "scope",
  34288. protocol: "accessing",
  34289. fn: function (){
  34290. var self=this,$self=this;
  34291. return $self["@scope"];
  34292. },
  34293. args: [],
  34294. source: "scope\x0a\x09^ scope",
  34295. referencedClasses: [],
  34296. messageSends: []
  34297. }),
  34298. $globals.MethodNode);
  34299. $core.addMethod(
  34300. $core.method({
  34301. selector: "scope:",
  34302. protocol: "accessing",
  34303. fn: function (aMethodScope){
  34304. var self=this,$self=this;
  34305. $self["@scope"]=aMethodScope;
  34306. return self;
  34307. },
  34308. args: ["aMethodScope"],
  34309. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34310. referencedClasses: [],
  34311. messageSends: []
  34312. }),
  34313. $globals.MethodNode);
  34314. $core.addMethod(
  34315. $core.method({
  34316. selector: "selector",
  34317. protocol: "accessing",
  34318. fn: function (){
  34319. var self=this,$self=this;
  34320. return $self["@selector"];
  34321. },
  34322. args: [],
  34323. source: "selector\x0a\x09^ selector",
  34324. referencedClasses: [],
  34325. messageSends: []
  34326. }),
  34327. $globals.MethodNode);
  34328. $core.addMethod(
  34329. $core.method({
  34330. selector: "selector:",
  34331. protocol: "accessing",
  34332. fn: function (aString){
  34333. var self=this,$self=this;
  34334. $self["@selector"]=aString;
  34335. return self;
  34336. },
  34337. args: ["aString"],
  34338. source: "selector: aString\x0a\x09selector := aString",
  34339. referencedClasses: [],
  34340. messageSends: []
  34341. }),
  34342. $globals.MethodNode);
  34343. $core.addMethod(
  34344. $core.method({
  34345. selector: "sendIndexes",
  34346. protocol: "accessing",
  34347. fn: function (){
  34348. var self=this,$self=this;
  34349. return $self["@sendIndexes"];
  34350. },
  34351. args: [],
  34352. source: "sendIndexes\x0a\x09^ sendIndexes",
  34353. referencedClasses: [],
  34354. messageSends: []
  34355. }),
  34356. $globals.MethodNode);
  34357. $core.addMethod(
  34358. $core.method({
  34359. selector: "sendIndexes:",
  34360. protocol: "accessing",
  34361. fn: function (aDictionary){
  34362. var self=this,$self=this;
  34363. $self["@sendIndexes"]=aDictionary;
  34364. return self;
  34365. },
  34366. args: ["aDictionary"],
  34367. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34368. referencedClasses: [],
  34369. messageSends: []
  34370. }),
  34371. $globals.MethodNode);
  34372. $core.addMethod(
  34373. $core.method({
  34374. selector: "sequenceNode",
  34375. protocol: "accessing",
  34376. fn: function (){
  34377. var self=this,$self=this;
  34378. return $core.withContext(function($ctx1) {
  34379. var $1;
  34380. var $early={};
  34381. try {
  34382. $recv($self._dagChildren())._do_((function(each){
  34383. return $core.withContext(function($ctx2) {
  34384. $1=$recv(each)._isSequenceNode();
  34385. if($core.assert($1)){
  34386. throw $early=[each];
  34387. }
  34388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34389. }));
  34390. return nil;
  34391. }
  34392. catch(e) {if(e===$early)return e[0]; throw e}
  34393. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34394. },
  34395. args: [],
  34396. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34397. referencedClasses: [],
  34398. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34399. }),
  34400. $globals.MethodNode);
  34401. $core.addMethod(
  34402. $core.method({
  34403. selector: "source",
  34404. protocol: "accessing",
  34405. fn: function (){
  34406. var self=this,$self=this;
  34407. return $self["@source"];
  34408. },
  34409. args: [],
  34410. source: "source\x0a\x09^ source",
  34411. referencedClasses: [],
  34412. messageSends: []
  34413. }),
  34414. $globals.MethodNode);
  34415. $core.addMethod(
  34416. $core.method({
  34417. selector: "source:",
  34418. protocol: "accessing",
  34419. fn: function (aString){
  34420. var self=this,$self=this;
  34421. $self["@source"]=aString;
  34422. return self;
  34423. },
  34424. args: ["aString"],
  34425. source: "source: aString\x0a\x09source := aString",
  34426. referencedClasses: [],
  34427. messageSends: []
  34428. }),
  34429. $globals.MethodNode);
  34430. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34431. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34432. $core.addMethod(
  34433. $core.method({
  34434. selector: "acceptDagVisitor:",
  34435. protocol: "visiting",
  34436. fn: function (aVisitor){
  34437. var self=this,$self=this;
  34438. return $core.withContext(function($ctx1) {
  34439. return $recv(aVisitor)._visitReturnNode_(self);
  34440. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34441. },
  34442. args: ["aVisitor"],
  34443. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34444. referencedClasses: [],
  34445. messageSends: ["visitReturnNode:"]
  34446. }),
  34447. $globals.ReturnNode);
  34448. $core.addMethod(
  34449. $core.method({
  34450. selector: "isReturnNode",
  34451. protocol: "testing",
  34452. fn: function (){
  34453. var self=this,$self=this;
  34454. return true;
  34455. },
  34456. args: [],
  34457. source: "isReturnNode\x0a\x09^ true",
  34458. referencedClasses: [],
  34459. messageSends: []
  34460. }),
  34461. $globals.ReturnNode);
  34462. $core.addMethod(
  34463. $core.method({
  34464. selector: "nonLocalReturn",
  34465. protocol: "testing",
  34466. fn: function (){
  34467. var self=this,$self=this;
  34468. return $core.withContext(function($ctx1) {
  34469. return $recv($recv($self._scope())._isMethodScope())._not();
  34470. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34471. },
  34472. args: [],
  34473. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34474. referencedClasses: [],
  34475. messageSends: ["not", "isMethodScope", "scope"]
  34476. }),
  34477. $globals.ReturnNode);
  34478. $core.addMethod(
  34479. $core.method({
  34480. selector: "scope",
  34481. protocol: "accessing",
  34482. fn: function (){
  34483. var self=this,$self=this;
  34484. return $self["@scope"];
  34485. },
  34486. args: [],
  34487. source: "scope\x0a\x09^ scope",
  34488. referencedClasses: [],
  34489. messageSends: []
  34490. }),
  34491. $globals.ReturnNode);
  34492. $core.addMethod(
  34493. $core.method({
  34494. selector: "scope:",
  34495. protocol: "accessing",
  34496. fn: function (aLexicalScope){
  34497. var self=this,$self=this;
  34498. $self["@scope"]=aLexicalScope;
  34499. return self;
  34500. },
  34501. args: ["aLexicalScope"],
  34502. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34503. referencedClasses: [],
  34504. messageSends: []
  34505. }),
  34506. $globals.ReturnNode);
  34507. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34508. $globals.SendNode.comment="I represent an message send node.";
  34509. $core.addMethod(
  34510. $core.method({
  34511. selector: "acceptDagVisitor:",
  34512. protocol: "visiting",
  34513. fn: function (aVisitor){
  34514. var self=this,$self=this;
  34515. return $core.withContext(function($ctx1) {
  34516. return $recv(aVisitor)._visitSendNode_(self);
  34517. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34518. },
  34519. args: ["aVisitor"],
  34520. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34521. referencedClasses: [],
  34522. messageSends: ["visitSendNode:"]
  34523. }),
  34524. $globals.SendNode);
  34525. $core.addMethod(
  34526. $core.method({
  34527. selector: "arguments",
  34528. protocol: "accessing",
  34529. fn: function (){
  34530. var self=this,$self=this;
  34531. return $core.withContext(function($ctx1) {
  34532. var $1,$receiver;
  34533. $1=$self["@arguments"];
  34534. if(($receiver = $1) == null || $receiver.a$nil){
  34535. $self["@arguments"]=[];
  34536. return $self["@arguments"];
  34537. } else {
  34538. return $1;
  34539. }
  34540. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34541. },
  34542. args: [],
  34543. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34544. referencedClasses: [],
  34545. messageSends: ["ifNil:"]
  34546. }),
  34547. $globals.SendNode);
  34548. $core.addMethod(
  34549. $core.method({
  34550. selector: "arguments:",
  34551. protocol: "accessing",
  34552. fn: function (aCollection){
  34553. var self=this,$self=this;
  34554. $self["@arguments"]=aCollection;
  34555. return self;
  34556. },
  34557. args: ["aCollection"],
  34558. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34559. referencedClasses: [],
  34560. messageSends: []
  34561. }),
  34562. $globals.SendNode);
  34563. $core.addMethod(
  34564. $core.method({
  34565. selector: "dagChildren",
  34566. protocol: "accessing",
  34567. fn: function (){
  34568. var self=this,$self=this;
  34569. return $core.withContext(function($ctx1) {
  34570. var $1,$2,$3,$receiver;
  34571. $1=$self._receiver();
  34572. $ctx1.sendIdx["receiver"]=1;
  34573. if(($receiver = $1) == null || $receiver.a$nil){
  34574. $2=$self._arguments();
  34575. $ctx1.sendIdx["arguments"]=1;
  34576. return $recv($2)._copy();
  34577. } else {
  34578. $1;
  34579. }
  34580. $3=$recv($globals.Array)._with_($self._receiver());
  34581. $recv($3)._addAll_($self._arguments());
  34582. return $recv($3)._yourself();
  34583. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34584. },
  34585. args: [],
  34586. source: "dagChildren\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  34587. referencedClasses: ["Array"],
  34588. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34589. }),
  34590. $globals.SendNode);
  34591. $core.addMethod(
  34592. $core.method({
  34593. selector: "index",
  34594. protocol: "accessing",
  34595. fn: function (){
  34596. var self=this,$self=this;
  34597. return $self["@index"];
  34598. },
  34599. args: [],
  34600. source: "index\x0a\x09^ index",
  34601. referencedClasses: [],
  34602. messageSends: []
  34603. }),
  34604. $globals.SendNode);
  34605. $core.addMethod(
  34606. $core.method({
  34607. selector: "index:",
  34608. protocol: "accessing",
  34609. fn: function (anInteger){
  34610. var self=this,$self=this;
  34611. $self["@index"]=anInteger;
  34612. return self;
  34613. },
  34614. args: ["anInteger"],
  34615. source: "index: anInteger\x0a\x09index := anInteger",
  34616. referencedClasses: [],
  34617. messageSends: []
  34618. }),
  34619. $globals.SendNode);
  34620. $core.addMethod(
  34621. $core.method({
  34622. selector: "isNavigationNode",
  34623. protocol: "testing",
  34624. fn: function (){
  34625. var self=this,$self=this;
  34626. return true;
  34627. },
  34628. args: [],
  34629. source: "isNavigationNode\x0a\x09^ true",
  34630. referencedClasses: [],
  34631. messageSends: []
  34632. }),
  34633. $globals.SendNode);
  34634. $core.addMethod(
  34635. $core.method({
  34636. selector: "isSendNode",
  34637. protocol: "testing",
  34638. fn: function (){
  34639. var self=this,$self=this;
  34640. return true;
  34641. },
  34642. args: [],
  34643. source: "isSendNode\x0a\x09^ true",
  34644. referencedClasses: [],
  34645. messageSends: []
  34646. }),
  34647. $globals.SendNode);
  34648. $core.addMethod(
  34649. $core.method({
  34650. selector: "navigationLink",
  34651. protocol: "accessing",
  34652. fn: function (){
  34653. var self=this,$self=this;
  34654. return $core.withContext(function($ctx1) {
  34655. return $self._selector();
  34656. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34657. },
  34658. args: [],
  34659. source: "navigationLink\x0a\x09^ self selector",
  34660. referencedClasses: [],
  34661. messageSends: ["selector"]
  34662. }),
  34663. $globals.SendNode);
  34664. $core.addMethod(
  34665. $core.method({
  34666. selector: "receiver",
  34667. protocol: "accessing",
  34668. fn: function (){
  34669. var self=this,$self=this;
  34670. return $self["@receiver"];
  34671. },
  34672. args: [],
  34673. source: "receiver\x0a\x09^ receiver",
  34674. referencedClasses: [],
  34675. messageSends: []
  34676. }),
  34677. $globals.SendNode);
  34678. $core.addMethod(
  34679. $core.method({
  34680. selector: "receiver:",
  34681. protocol: "accessing",
  34682. fn: function (aNode){
  34683. var self=this,$self=this;
  34684. $self["@receiver"]=aNode;
  34685. return self;
  34686. },
  34687. args: ["aNode"],
  34688. source: "receiver: aNode\x0a\x09receiver := aNode",
  34689. referencedClasses: [],
  34690. messageSends: []
  34691. }),
  34692. $globals.SendNode);
  34693. $core.addMethod(
  34694. $core.method({
  34695. selector: "requiresSmalltalkContext",
  34696. protocol: "testing",
  34697. fn: function (){
  34698. var self=this,$self=this;
  34699. return true;
  34700. },
  34701. args: [],
  34702. source: "requiresSmalltalkContext\x0a\x09^ true",
  34703. referencedClasses: [],
  34704. messageSends: []
  34705. }),
  34706. $globals.SendNode);
  34707. $core.addMethod(
  34708. $core.method({
  34709. selector: "selector",
  34710. protocol: "accessing",
  34711. fn: function (){
  34712. var self=this,$self=this;
  34713. return $self["@selector"];
  34714. },
  34715. args: [],
  34716. source: "selector\x0a\x09^ selector",
  34717. referencedClasses: [],
  34718. messageSends: []
  34719. }),
  34720. $globals.SendNode);
  34721. $core.addMethod(
  34722. $core.method({
  34723. selector: "selector:",
  34724. protocol: "accessing",
  34725. fn: function (aString){
  34726. var self=this,$self=this;
  34727. $self["@selector"]=aString;
  34728. return self;
  34729. },
  34730. args: ["aString"],
  34731. source: "selector: aString\x0a\x09selector := aString",
  34732. referencedClasses: [],
  34733. messageSends: []
  34734. }),
  34735. $globals.SendNode);
  34736. $core.addMethod(
  34737. $core.method({
  34738. selector: "shouldBeInlined",
  34739. protocol: "accessing",
  34740. fn: function (){
  34741. var self=this,$self=this;
  34742. return $core.withContext(function($ctx1) {
  34743. var $1,$receiver;
  34744. $1=$self["@shouldBeInlined"];
  34745. if(($receiver = $1) == null || $receiver.a$nil){
  34746. return false;
  34747. } else {
  34748. return $1;
  34749. }
  34750. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34751. },
  34752. args: [],
  34753. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34754. referencedClasses: [],
  34755. messageSends: ["ifNil:"]
  34756. }),
  34757. $globals.SendNode);
  34758. $core.addMethod(
  34759. $core.method({
  34760. selector: "shouldBeInlined:",
  34761. protocol: "accessing",
  34762. fn: function (aBoolean){
  34763. var self=this,$self=this;
  34764. $self["@shouldBeInlined"]=aBoolean;
  34765. return self;
  34766. },
  34767. args: ["aBoolean"],
  34768. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34769. referencedClasses: [],
  34770. messageSends: []
  34771. }),
  34772. $globals.SendNode);
  34773. $core.addMethod(
  34774. $core.method({
  34775. selector: "superSend",
  34776. protocol: "accessing",
  34777. fn: function (){
  34778. var self=this,$self=this;
  34779. return $core.withContext(function($ctx1) {
  34780. var $2,$1;
  34781. $2=$self._receiver();
  34782. $ctx1.sendIdx["receiver"]=1;
  34783. $1=$recv($2)._notNil();
  34784. return $recv($1)._and_((function(){
  34785. return $core.withContext(function($ctx2) {
  34786. return $recv($self._receiver())._isSuperKeyword();
  34787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34788. }));
  34789. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34790. },
  34791. args: [],
  34792. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34793. referencedClasses: [],
  34794. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34795. }),
  34796. $globals.SendNode);
  34797. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34798. $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).";
  34799. $core.addMethod(
  34800. $core.method({
  34801. selector: "acceptDagVisitor:",
  34802. protocol: "visiting",
  34803. fn: function (aVisitor){
  34804. var self=this,$self=this;
  34805. return $core.withContext(function($ctx1) {
  34806. return $recv(aVisitor)._visitSequenceNode_(self);
  34807. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34808. },
  34809. args: ["aVisitor"],
  34810. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34811. referencedClasses: [],
  34812. messageSends: ["visitSequenceNode:"]
  34813. }),
  34814. $globals.SequenceNode);
  34815. $core.addMethod(
  34816. $core.method({
  34817. selector: "asBlockSequenceNode",
  34818. protocol: "building",
  34819. fn: function (){
  34820. var self=this,$self=this;
  34821. return $core.withContext(function($ctx1) {
  34822. var $1;
  34823. $1=$recv($globals.BlockSequenceNode)._new();
  34824. $recv($1)._position_($self._position());
  34825. $recv($1)._source_($self._source());
  34826. $recv($1)._dagChildren_($self._dagChildren());
  34827. $recv($1)._temps_($self._temps());
  34828. $recv($1)._pragmas_($self._pragmas());
  34829. return $recv($1)._yourself();
  34830. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34831. },
  34832. args: [],
  34833. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34834. referencedClasses: ["BlockSequenceNode"],
  34835. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34836. }),
  34837. $globals.SequenceNode);
  34838. $core.addMethod(
  34839. $core.method({
  34840. selector: "isSequenceNode",
  34841. protocol: "testing",
  34842. fn: function (){
  34843. var self=this,$self=this;
  34844. return true;
  34845. },
  34846. args: [],
  34847. source: "isSequenceNode\x0a\x09^ true",
  34848. referencedClasses: [],
  34849. messageSends: []
  34850. }),
  34851. $globals.SequenceNode);
  34852. $core.addMethod(
  34853. $core.method({
  34854. selector: "pragmas",
  34855. protocol: "accessing",
  34856. fn: function (){
  34857. var self=this,$self=this;
  34858. return $core.withContext(function($ctx1) {
  34859. var $1,$receiver;
  34860. $1=$self["@pragmas"];
  34861. if(($receiver = $1) == null || $receiver.a$nil){
  34862. return [];
  34863. } else {
  34864. return $1;
  34865. }
  34866. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34867. },
  34868. args: [],
  34869. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34870. referencedClasses: [],
  34871. messageSends: ["ifNil:"]
  34872. }),
  34873. $globals.SequenceNode);
  34874. $core.addMethod(
  34875. $core.method({
  34876. selector: "pragmas:",
  34877. protocol: "accessing",
  34878. fn: function (aCollection){
  34879. var self=this,$self=this;
  34880. $self["@pragmas"]=aCollection;
  34881. return self;
  34882. },
  34883. args: ["aCollection"],
  34884. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34885. referencedClasses: [],
  34886. messageSends: []
  34887. }),
  34888. $globals.SequenceNode);
  34889. $core.addMethod(
  34890. $core.method({
  34891. selector: "scope",
  34892. protocol: "accessing",
  34893. fn: function (){
  34894. var self=this,$self=this;
  34895. return $self["@scope"];
  34896. },
  34897. args: [],
  34898. source: "scope\x0a\x09^ scope",
  34899. referencedClasses: [],
  34900. messageSends: []
  34901. }),
  34902. $globals.SequenceNode);
  34903. $core.addMethod(
  34904. $core.method({
  34905. selector: "scope:",
  34906. protocol: "accessing",
  34907. fn: function (aLexicalScope){
  34908. var self=this,$self=this;
  34909. $self["@scope"]=aLexicalScope;
  34910. return self;
  34911. },
  34912. args: ["aLexicalScope"],
  34913. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34914. referencedClasses: [],
  34915. messageSends: []
  34916. }),
  34917. $globals.SequenceNode);
  34918. $core.addMethod(
  34919. $core.method({
  34920. selector: "temps",
  34921. protocol: "accessing",
  34922. fn: function (){
  34923. var self=this,$self=this;
  34924. return $core.withContext(function($ctx1) {
  34925. var $1,$receiver;
  34926. $1=$self["@temps"];
  34927. if(($receiver = $1) == null || $receiver.a$nil){
  34928. return [];
  34929. } else {
  34930. return $1;
  34931. }
  34932. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34933. },
  34934. args: [],
  34935. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34936. referencedClasses: [],
  34937. messageSends: ["ifNil:"]
  34938. }),
  34939. $globals.SequenceNode);
  34940. $core.addMethod(
  34941. $core.method({
  34942. selector: "temps:",
  34943. protocol: "accessing",
  34944. fn: function (aCollection){
  34945. var self=this,$self=this;
  34946. $self["@temps"]=aCollection;
  34947. return self;
  34948. },
  34949. args: ["aCollection"],
  34950. source: "temps: aCollection\x0a\x09temps := aCollection",
  34951. referencedClasses: [],
  34952. messageSends: []
  34953. }),
  34954. $globals.SequenceNode);
  34955. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34956. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34957. $core.addMethod(
  34958. $core.method({
  34959. selector: "acceptDagVisitor:",
  34960. protocol: "visiting",
  34961. fn: function (aVisitor){
  34962. var self=this,$self=this;
  34963. return $core.withContext(function($ctx1) {
  34964. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34965. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34966. },
  34967. args: ["aVisitor"],
  34968. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34969. referencedClasses: [],
  34970. messageSends: ["visitBlockSequenceNode:"]
  34971. }),
  34972. $globals.BlockSequenceNode);
  34973. $core.addMethod(
  34974. $core.method({
  34975. selector: "isBlockSequenceNode",
  34976. protocol: "testing",
  34977. fn: function (){
  34978. var self=this,$self=this;
  34979. return true;
  34980. },
  34981. args: [],
  34982. source: "isBlockSequenceNode\x0a\x09^ true",
  34983. referencedClasses: [],
  34984. messageSends: []
  34985. }),
  34986. $globals.BlockSequenceNode);
  34987. $core.addMethod(
  34988. $core.method({
  34989. selector: "pragmas:",
  34990. protocol: "visiting",
  34991. fn: function (aCollection){
  34992. var self=this,$self=this;
  34993. return $core.withContext(function($ctx1) {
  34994. var $1;
  34995. $recv(aCollection)._ifNotEmpty_((function(){
  34996. return $core.withContext(function($ctx2) {
  34997. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  34998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34999. }));
  35000. $1=(
  35001. $ctx1.supercall = true,
  35002. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35003. $ctx1.supercall = false;
  35004. return $1;
  35005. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35006. },
  35007. args: ["aCollection"],
  35008. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35009. referencedClasses: ["CompilerError"],
  35010. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35011. }),
  35012. $globals.BlockSequenceNode);
  35013. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35014. $globals.ValueNode.comment="I represent a value node.";
  35015. $core.addMethod(
  35016. $core.method({
  35017. selector: "acceptDagVisitor:",
  35018. protocol: "visiting",
  35019. fn: function (aVisitor){
  35020. var self=this,$self=this;
  35021. return $core.withContext(function($ctx1) {
  35022. return $recv(aVisitor)._visitValueNode_(self);
  35023. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35024. },
  35025. args: ["aVisitor"],
  35026. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35027. referencedClasses: [],
  35028. messageSends: ["visitValueNode:"]
  35029. }),
  35030. $globals.ValueNode);
  35031. $core.addMethod(
  35032. $core.method({
  35033. selector: "isImmutable",
  35034. protocol: "testing",
  35035. fn: function (){
  35036. var self=this,$self=this;
  35037. return $core.withContext(function($ctx1) {
  35038. return $recv($self._value())._isImmutable();
  35039. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35040. },
  35041. args: [],
  35042. source: "isImmutable\x0a\x09^ self value isImmutable",
  35043. referencedClasses: [],
  35044. messageSends: ["isImmutable", "value"]
  35045. }),
  35046. $globals.ValueNode);
  35047. $core.addMethod(
  35048. $core.method({
  35049. selector: "isValueNode",
  35050. protocol: "testing",
  35051. fn: function (){
  35052. var self=this,$self=this;
  35053. return true;
  35054. },
  35055. args: [],
  35056. source: "isValueNode\x0a\x09^ true",
  35057. referencedClasses: [],
  35058. messageSends: []
  35059. }),
  35060. $globals.ValueNode);
  35061. $core.addMethod(
  35062. $core.method({
  35063. selector: "value",
  35064. protocol: "accessing",
  35065. fn: function (){
  35066. var self=this,$self=this;
  35067. return $self["@value"];
  35068. },
  35069. args: [],
  35070. source: "value\x0a\x09^ value",
  35071. referencedClasses: [],
  35072. messageSends: []
  35073. }),
  35074. $globals.ValueNode);
  35075. $core.addMethod(
  35076. $core.method({
  35077. selector: "value:",
  35078. protocol: "accessing",
  35079. fn: function (anObject){
  35080. var self=this,$self=this;
  35081. $self["@value"]=anObject;
  35082. return self;
  35083. },
  35084. args: ["anObject"],
  35085. source: "value: anObject\x0a\x09value := anObject",
  35086. referencedClasses: [],
  35087. messageSends: []
  35088. }),
  35089. $globals.ValueNode);
  35090. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35091. $globals.VariableNode.comment="I represent an variable node.";
  35092. $core.addMethod(
  35093. $core.method({
  35094. selector: "acceptDagVisitor:",
  35095. protocol: "visiting",
  35096. fn: function (aVisitor){
  35097. var self=this,$self=this;
  35098. return $core.withContext(function($ctx1) {
  35099. return $recv(aVisitor)._visitVariableNode_(self);
  35100. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35101. },
  35102. args: ["aVisitor"],
  35103. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35104. referencedClasses: [],
  35105. messageSends: ["visitVariableNode:"]
  35106. }),
  35107. $globals.VariableNode);
  35108. $core.addMethod(
  35109. $core.method({
  35110. selector: "alias",
  35111. protocol: "accessing",
  35112. fn: function (){
  35113. var self=this,$self=this;
  35114. return $core.withContext(function($ctx1) {
  35115. return $recv($self._binding())._alias();
  35116. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35117. },
  35118. args: [],
  35119. source: "alias\x0a\x09^ self binding alias",
  35120. referencedClasses: [],
  35121. messageSends: ["alias", "binding"]
  35122. }),
  35123. $globals.VariableNode);
  35124. $core.addMethod(
  35125. $core.method({
  35126. selector: "assigned",
  35127. protocol: "accessing",
  35128. fn: function (){
  35129. var self=this,$self=this;
  35130. return $core.withContext(function($ctx1) {
  35131. var $1,$receiver;
  35132. $1=$self["@assigned"];
  35133. if(($receiver = $1) == null || $receiver.a$nil){
  35134. return false;
  35135. } else {
  35136. return $1;
  35137. }
  35138. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35139. },
  35140. args: [],
  35141. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35142. referencedClasses: [],
  35143. messageSends: ["ifNil:"]
  35144. }),
  35145. $globals.VariableNode);
  35146. $core.addMethod(
  35147. $core.method({
  35148. selector: "assigned:",
  35149. protocol: "accessing",
  35150. fn: function (aBoolean){
  35151. var self=this,$self=this;
  35152. $self["@assigned"]=aBoolean;
  35153. return self;
  35154. },
  35155. args: ["aBoolean"],
  35156. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35157. referencedClasses: [],
  35158. messageSends: []
  35159. }),
  35160. $globals.VariableNode);
  35161. $core.addMethod(
  35162. $core.method({
  35163. selector: "beAssigned",
  35164. protocol: "accessing",
  35165. fn: function (){
  35166. var self=this,$self=this;
  35167. return $core.withContext(function($ctx1) {
  35168. $recv($self._binding())._validateAssignment();
  35169. $self["@assigned"]=true;
  35170. return self;
  35171. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35172. },
  35173. args: [],
  35174. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35175. referencedClasses: [],
  35176. messageSends: ["validateAssignment", "binding"]
  35177. }),
  35178. $globals.VariableNode);
  35179. $core.addMethod(
  35180. $core.method({
  35181. selector: "binding",
  35182. protocol: "accessing",
  35183. fn: function (){
  35184. var self=this,$self=this;
  35185. return $self["@binding"];
  35186. },
  35187. args: [],
  35188. source: "binding\x0a\x09^ binding",
  35189. referencedClasses: [],
  35190. messageSends: []
  35191. }),
  35192. $globals.VariableNode);
  35193. $core.addMethod(
  35194. $core.method({
  35195. selector: "binding:",
  35196. protocol: "accessing",
  35197. fn: function (aScopeVar){
  35198. var self=this,$self=this;
  35199. $self["@binding"]=aScopeVar;
  35200. return self;
  35201. },
  35202. args: ["aScopeVar"],
  35203. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35204. referencedClasses: [],
  35205. messageSends: []
  35206. }),
  35207. $globals.VariableNode);
  35208. $core.addMethod(
  35209. $core.method({
  35210. selector: "isArgument",
  35211. protocol: "testing",
  35212. fn: function (){
  35213. var self=this,$self=this;
  35214. return $core.withContext(function($ctx1) {
  35215. return $recv($self._binding())._isArgVar();
  35216. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35217. },
  35218. args: [],
  35219. source: "isArgument\x0a\x09^ self binding isArgVar",
  35220. referencedClasses: [],
  35221. messageSends: ["isArgVar", "binding"]
  35222. }),
  35223. $globals.VariableNode);
  35224. $core.addMethod(
  35225. $core.method({
  35226. selector: "isImmutable",
  35227. protocol: "testing",
  35228. fn: function (){
  35229. var self=this,$self=this;
  35230. return $core.withContext(function($ctx1) {
  35231. return $recv($self._binding())._isImmutable();
  35232. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35233. },
  35234. args: [],
  35235. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35236. referencedClasses: [],
  35237. messageSends: ["isImmutable", "binding"]
  35238. }),
  35239. $globals.VariableNode);
  35240. $core.addMethod(
  35241. $core.method({
  35242. selector: "isNavigationNode",
  35243. protocol: "testing",
  35244. fn: function (){
  35245. var self=this,$self=this;
  35246. return true;
  35247. },
  35248. args: [],
  35249. source: "isNavigationNode\x0a\x09^ true",
  35250. referencedClasses: [],
  35251. messageSends: []
  35252. }),
  35253. $globals.VariableNode);
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "isSuperKeyword",
  35257. protocol: "testing",
  35258. fn: function (){
  35259. var self=this,$self=this;
  35260. return $core.withContext(function($ctx1) {
  35261. return $recv($self._value()).__eq("super");
  35262. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35263. },
  35264. args: [],
  35265. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35266. referencedClasses: [],
  35267. messageSends: ["=", "value"]
  35268. }),
  35269. $globals.VariableNode);
  35270. $core.addMethod(
  35271. $core.method({
  35272. selector: "isVariableNode",
  35273. protocol: "testing",
  35274. fn: function (){
  35275. var self=this,$self=this;
  35276. return true;
  35277. },
  35278. args: [],
  35279. source: "isVariableNode\x0a\x09^ true",
  35280. referencedClasses: [],
  35281. messageSends: []
  35282. }),
  35283. $globals.VariableNode);
  35284. $core.addMethod(
  35285. $core.method({
  35286. selector: "navigationLink",
  35287. protocol: "accessing",
  35288. fn: function (){
  35289. var self=this,$self=this;
  35290. return $core.withContext(function($ctx1) {
  35291. return $self._value();
  35292. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35293. },
  35294. args: [],
  35295. source: "navigationLink\x0a\x09^ self value",
  35296. referencedClasses: [],
  35297. messageSends: ["value"]
  35298. }),
  35299. $globals.VariableNode);
  35300. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35301. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35302. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35303. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35304. $core.addMethod(
  35305. $core.method({
  35306. selector: "visit:",
  35307. protocol: "visiting",
  35308. fn: function (aNode){
  35309. var self=this,$self=this;
  35310. return $core.withContext(function($ctx1) {
  35311. var $1;
  35312. $recv($self._path())._ifNotEmpty_((function(p){
  35313. return $core.withContext(function($ctx2) {
  35314. return $recv(aNode)._parent_($recv(p)._last());
  35315. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35316. }));
  35317. $1=(
  35318. $ctx1.supercall = true,
  35319. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35320. $ctx1.supercall = false;
  35321. return $1;
  35322. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35323. },
  35324. args: ["aNode"],
  35325. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35326. referencedClasses: [],
  35327. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35328. }),
  35329. $globals.ParentFakingPathDagVisitor);
  35330. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35331. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35332. $core.addMethod(
  35333. $core.method({
  35334. selector: "visitAssignmentNode:",
  35335. protocol: "visiting",
  35336. fn: function (aNode){
  35337. var self=this,$self=this;
  35338. return $core.withContext(function($ctx1) {
  35339. return $self._visitDagNode_(aNode);
  35340. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35341. },
  35342. args: ["aNode"],
  35343. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35344. referencedClasses: [],
  35345. messageSends: ["visitDagNode:"]
  35346. }),
  35347. $globals.NodeVisitor);
  35348. $core.addMethod(
  35349. $core.method({
  35350. selector: "visitBlockNode:",
  35351. protocol: "visiting",
  35352. fn: function (aNode){
  35353. var self=this,$self=this;
  35354. return $core.withContext(function($ctx1) {
  35355. return $self._visitDagNode_(aNode);
  35356. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35357. },
  35358. args: ["aNode"],
  35359. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35360. referencedClasses: [],
  35361. messageSends: ["visitDagNode:"]
  35362. }),
  35363. $globals.NodeVisitor);
  35364. $core.addMethod(
  35365. $core.method({
  35366. selector: "visitBlockSequenceNode:",
  35367. protocol: "visiting",
  35368. fn: function (aNode){
  35369. var self=this,$self=this;
  35370. return $core.withContext(function($ctx1) {
  35371. return $self._visitSequenceNode_(aNode);
  35372. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35373. },
  35374. args: ["aNode"],
  35375. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35376. referencedClasses: [],
  35377. messageSends: ["visitSequenceNode:"]
  35378. }),
  35379. $globals.NodeVisitor);
  35380. $core.addMethod(
  35381. $core.method({
  35382. selector: "visitCascadeNode:",
  35383. protocol: "visiting",
  35384. fn: function (aNode){
  35385. var self=this,$self=this;
  35386. return $core.withContext(function($ctx1) {
  35387. return $self._visitDagNode_(aNode);
  35388. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35389. },
  35390. args: ["aNode"],
  35391. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35392. referencedClasses: [],
  35393. messageSends: ["visitDagNode:"]
  35394. }),
  35395. $globals.NodeVisitor);
  35396. $core.addMethod(
  35397. $core.method({
  35398. selector: "visitDagNode:",
  35399. protocol: "visiting",
  35400. fn: function (aNode){
  35401. var self=this,$self=this;
  35402. return $core.withContext(function($ctx1) {
  35403. return $self._visitDagNodeVariantSimple_(aNode);
  35404. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35405. },
  35406. args: ["aNode"],
  35407. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35408. referencedClasses: [],
  35409. messageSends: ["visitDagNodeVariantSimple:"]
  35410. }),
  35411. $globals.NodeVisitor);
  35412. $core.addMethod(
  35413. $core.method({
  35414. selector: "visitDynamicArrayNode:",
  35415. protocol: "visiting",
  35416. fn: function (aNode){
  35417. var self=this,$self=this;
  35418. return $core.withContext(function($ctx1) {
  35419. return $self._visitDagNode_(aNode);
  35420. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35421. },
  35422. args: ["aNode"],
  35423. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35424. referencedClasses: [],
  35425. messageSends: ["visitDagNode:"]
  35426. }),
  35427. $globals.NodeVisitor);
  35428. $core.addMethod(
  35429. $core.method({
  35430. selector: "visitDynamicDictionaryNode:",
  35431. protocol: "visiting",
  35432. fn: function (aNode){
  35433. var self=this,$self=this;
  35434. return $core.withContext(function($ctx1) {
  35435. return $self._visitDagNode_(aNode);
  35436. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35437. },
  35438. args: ["aNode"],
  35439. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35440. referencedClasses: [],
  35441. messageSends: ["visitDagNode:"]
  35442. }),
  35443. $globals.NodeVisitor);
  35444. $core.addMethod(
  35445. $core.method({
  35446. selector: "visitJSStatementNode:",
  35447. protocol: "visiting",
  35448. fn: function (aNode){
  35449. var self=this,$self=this;
  35450. return $core.withContext(function($ctx1) {
  35451. return $self._visitDagNode_(aNode);
  35452. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35453. },
  35454. args: ["aNode"],
  35455. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35456. referencedClasses: [],
  35457. messageSends: ["visitDagNode:"]
  35458. }),
  35459. $globals.NodeVisitor);
  35460. $core.addMethod(
  35461. $core.method({
  35462. selector: "visitMethodNode:",
  35463. protocol: "visiting",
  35464. fn: function (aNode){
  35465. var self=this,$self=this;
  35466. return $core.withContext(function($ctx1) {
  35467. return $self._visitDagNode_(aNode);
  35468. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35469. },
  35470. args: ["aNode"],
  35471. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35472. referencedClasses: [],
  35473. messageSends: ["visitDagNode:"]
  35474. }),
  35475. $globals.NodeVisitor);
  35476. $core.addMethod(
  35477. $core.method({
  35478. selector: "visitReturnNode:",
  35479. protocol: "visiting",
  35480. fn: function (aNode){
  35481. var self=this,$self=this;
  35482. return $core.withContext(function($ctx1) {
  35483. return $self._visitDagNode_(aNode);
  35484. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35485. },
  35486. args: ["aNode"],
  35487. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35488. referencedClasses: [],
  35489. messageSends: ["visitDagNode:"]
  35490. }),
  35491. $globals.NodeVisitor);
  35492. $core.addMethod(
  35493. $core.method({
  35494. selector: "visitSendNode:",
  35495. protocol: "visiting",
  35496. fn: function (aNode){
  35497. var self=this,$self=this;
  35498. return $core.withContext(function($ctx1) {
  35499. return $self._visitDagNode_(aNode);
  35500. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35501. },
  35502. args: ["aNode"],
  35503. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35504. referencedClasses: [],
  35505. messageSends: ["visitDagNode:"]
  35506. }),
  35507. $globals.NodeVisitor);
  35508. $core.addMethod(
  35509. $core.method({
  35510. selector: "visitSequenceNode:",
  35511. protocol: "visiting",
  35512. fn: function (aNode){
  35513. var self=this,$self=this;
  35514. return $core.withContext(function($ctx1) {
  35515. return $self._visitDagNode_(aNode);
  35516. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35517. },
  35518. args: ["aNode"],
  35519. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35520. referencedClasses: [],
  35521. messageSends: ["visitDagNode:"]
  35522. }),
  35523. $globals.NodeVisitor);
  35524. $core.addMethod(
  35525. $core.method({
  35526. selector: "visitValueNode:",
  35527. protocol: "visiting",
  35528. fn: function (aNode){
  35529. var self=this,$self=this;
  35530. return $core.withContext(function($ctx1) {
  35531. return $self._visitDagNode_(aNode);
  35532. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35533. },
  35534. args: ["aNode"],
  35535. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35536. referencedClasses: [],
  35537. messageSends: ["visitDagNode:"]
  35538. }),
  35539. $globals.NodeVisitor);
  35540. $core.addMethod(
  35541. $core.method({
  35542. selector: "visitVariableNode:",
  35543. protocol: "visiting",
  35544. fn: function (aNode){
  35545. var self=this,$self=this;
  35546. return $core.withContext(function($ctx1) {
  35547. return $self._visitDagNode_(aNode);
  35548. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35549. },
  35550. args: ["aNode"],
  35551. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35552. referencedClasses: [],
  35553. messageSends: ["visitDagNode:"]
  35554. }),
  35555. $globals.NodeVisitor);
  35556. $core.addMethod(
  35557. $core.method({
  35558. selector: "ast",
  35559. protocol: "*Compiler-AST",
  35560. fn: function (){
  35561. var self=this,$self=this;
  35562. return $core.withContext(function($ctx1) {
  35563. var $1;
  35564. $1=$self._source();
  35565. $ctx1.sendIdx["source"]=1;
  35566. $recv($1)._ifEmpty_((function(){
  35567. return $core.withContext(function($ctx2) {
  35568. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35570. }));
  35571. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35572. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35573. },
  35574. args: [],
  35575. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35576. referencedClasses: ["CompilerError", "Compiler"],
  35577. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35578. }),
  35579. $globals.CompiledMethod);
  35580. });
  35581. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35582. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35583. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35584. var $pkg = $core.addPackage("Compiler-Core");
  35585. $pkg.innerEval = function (expr) { return eval(expr); };
  35586. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  35587. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35588. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35589. $core.addMethod(
  35590. $core.method({
  35591. selector: "compileNode:",
  35592. protocol: "compiling",
  35593. fn: function (aNode){
  35594. var self=this,$self=this;
  35595. return $core.withContext(function($ctx1) {
  35596. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35597. return $core.withContext(function($ctx2) {
  35598. return $recv(transformer)._value_(input);
  35599. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35600. }));
  35601. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35602. },
  35603. args: ["aNode"],
  35604. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35605. referencedClasses: [],
  35606. messageSends: ["inject:into:", "transformers", "value:"]
  35607. }),
  35608. $globals.AbstractCodeGenerator);
  35609. $core.addMethod(
  35610. $core.method({
  35611. selector: "currentClass",
  35612. protocol: "accessing",
  35613. fn: function (){
  35614. var self=this,$self=this;
  35615. return $self["@currentClass"];
  35616. },
  35617. args: [],
  35618. source: "currentClass\x0a\x09^ currentClass",
  35619. referencedClasses: [],
  35620. messageSends: []
  35621. }),
  35622. $globals.AbstractCodeGenerator);
  35623. $core.addMethod(
  35624. $core.method({
  35625. selector: "currentClass:",
  35626. protocol: "accessing",
  35627. fn: function (aClass){
  35628. var self=this,$self=this;
  35629. $self["@currentClass"]=aClass;
  35630. return self;
  35631. },
  35632. args: ["aClass"],
  35633. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35634. referencedClasses: [],
  35635. messageSends: []
  35636. }),
  35637. $globals.AbstractCodeGenerator);
  35638. $core.addMethod(
  35639. $core.method({
  35640. selector: "currentPackage",
  35641. protocol: "accessing",
  35642. fn: function (){
  35643. var self=this,$self=this;
  35644. return $self["@currentPackage"];
  35645. },
  35646. args: [],
  35647. source: "currentPackage\x0a\x09^ currentPackage",
  35648. referencedClasses: [],
  35649. messageSends: []
  35650. }),
  35651. $globals.AbstractCodeGenerator);
  35652. $core.addMethod(
  35653. $core.method({
  35654. selector: "currentPackage:",
  35655. protocol: "accessing",
  35656. fn: function (anObject){
  35657. var self=this,$self=this;
  35658. $self["@currentPackage"]=anObject;
  35659. return self;
  35660. },
  35661. args: ["anObject"],
  35662. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35663. referencedClasses: [],
  35664. messageSends: []
  35665. }),
  35666. $globals.AbstractCodeGenerator);
  35667. $core.addMethod(
  35668. $core.method({
  35669. selector: "pseudoVariables",
  35670. protocol: "accessing",
  35671. fn: function (){
  35672. var self=this,$self=this;
  35673. return $core.withContext(function($ctx1) {
  35674. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35675. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35676. },
  35677. args: [],
  35678. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35679. referencedClasses: ["Smalltalk"],
  35680. messageSends: ["pseudoVariableNames"]
  35681. }),
  35682. $globals.AbstractCodeGenerator);
  35683. $core.addMethod(
  35684. $core.method({
  35685. selector: "source",
  35686. protocol: "accessing",
  35687. fn: function (){
  35688. var self=this,$self=this;
  35689. return $core.withContext(function($ctx1) {
  35690. var $1,$receiver;
  35691. $1=$self["@source"];
  35692. if(($receiver = $1) == null || $receiver.a$nil){
  35693. return "";
  35694. } else {
  35695. return $1;
  35696. }
  35697. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35698. },
  35699. args: [],
  35700. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35701. referencedClasses: [],
  35702. messageSends: ["ifNil:"]
  35703. }),
  35704. $globals.AbstractCodeGenerator);
  35705. $core.addMethod(
  35706. $core.method({
  35707. selector: "source:",
  35708. protocol: "accessing",
  35709. fn: function (aString){
  35710. var self=this,$self=this;
  35711. $self["@source"]=aString;
  35712. return self;
  35713. },
  35714. args: ["aString"],
  35715. source: "source: aString\x0a\x09source := aString",
  35716. referencedClasses: [],
  35717. messageSends: []
  35718. }),
  35719. $globals.AbstractCodeGenerator);
  35720. $core.addMethod(
  35721. $core.method({
  35722. selector: "transformers",
  35723. protocol: "compiling",
  35724. fn: function (){
  35725. var self=this,$self=this;
  35726. var dict;
  35727. return $core.withContext(function($ctx1) {
  35728. dict=$self._transformersDictionary();
  35729. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35730. return $core.withContext(function($ctx2) {
  35731. return $recv(dict)._at_(each);
  35732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35733. }));
  35734. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35735. },
  35736. args: [],
  35737. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35738. referencedClasses: [],
  35739. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35740. }),
  35741. $globals.AbstractCodeGenerator);
  35742. $core.addMethod(
  35743. $core.method({
  35744. selector: "transformersDictionary",
  35745. protocol: "compiling",
  35746. fn: function (){
  35747. var self=this,$self=this;
  35748. return $core.withContext(function($ctx1) {
  35749. $self._subclassResponsibility();
  35750. return self;
  35751. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35752. },
  35753. args: [],
  35754. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35755. referencedClasses: [],
  35756. messageSends: ["subclassResponsibility"]
  35757. }),
  35758. $globals.AbstractCodeGenerator);
  35759. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35760. $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.";
  35761. $core.addMethod(
  35762. $core.method({
  35763. selector: "irTranslator",
  35764. protocol: "compiling",
  35765. fn: function (){
  35766. var self=this,$self=this;
  35767. return $core.withContext(function($ctx1) {
  35768. var $1;
  35769. $1=$recv($self._irTranslatorClass())._new();
  35770. $recv($1)._currentClass_($self._currentClass());
  35771. return $recv($1)._yourself();
  35772. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35773. },
  35774. args: [],
  35775. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35776. referencedClasses: [],
  35777. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35778. }),
  35779. $globals.CodeGenerator);
  35780. $core.addMethod(
  35781. $core.method({
  35782. selector: "irTranslatorClass",
  35783. protocol: "compiling",
  35784. fn: function (){
  35785. var self=this,$self=this;
  35786. return $globals.IRJSTranslator;
  35787. },
  35788. args: [],
  35789. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35790. referencedClasses: ["IRJSTranslator"],
  35791. messageSends: []
  35792. }),
  35793. $globals.CodeGenerator);
  35794. $core.addMethod(
  35795. $core.method({
  35796. selector: "semanticAnalyzer",
  35797. protocol: "compiling",
  35798. fn: function (){
  35799. var self=this,$self=this;
  35800. return $core.withContext(function($ctx1) {
  35801. var $1;
  35802. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35803. $recv($1)._thePackage_($self._currentPackage());
  35804. return $recv($1)._yourself();
  35805. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35806. },
  35807. args: [],
  35808. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35809. referencedClasses: ["SemanticAnalyzer"],
  35810. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35811. }),
  35812. $globals.CodeGenerator);
  35813. $core.addMethod(
  35814. $core.method({
  35815. selector: "transformersDictionary",
  35816. protocol: "compiling",
  35817. fn: function (){
  35818. var self=this,$self=this;
  35819. return $core.withContext(function($ctx1) {
  35820. var $1,$2,$receiver;
  35821. $1=$self["@transformersDictionary"];
  35822. if(($receiver = $1) == null || $receiver.a$nil){
  35823. $2=$recv($globals.Dictionary)._new();
  35824. $ctx1.sendIdx["new"]=1;
  35825. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35826. $ctx1.sendIdx["at:put:"]=1;
  35827. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35828. $ctx1.sendIdx["at:put:"]=2;
  35829. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35830. $ctx1.sendIdx["at:put:"]=3;
  35831. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35832. $self["@transformersDictionary"]=$recv($2)._yourself();
  35833. return $self["@transformersDictionary"];
  35834. } else {
  35835. return $1;
  35836. }
  35837. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35838. },
  35839. args: [],
  35840. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35841. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35842. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35843. }),
  35844. $globals.CodeGenerator);
  35845. $core.addMethod(
  35846. $core.method({
  35847. selector: "translator",
  35848. protocol: "compiling",
  35849. fn: function (){
  35850. var self=this,$self=this;
  35851. return $core.withContext(function($ctx1) {
  35852. var $1;
  35853. $1=$recv($globals.IRASTTranslator)._new();
  35854. $recv($1)._source_($self._source());
  35855. $recv($1)._theClass_($self._currentClass());
  35856. return $recv($1)._yourself();
  35857. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35858. },
  35859. args: [],
  35860. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35861. referencedClasses: ["IRASTTranslator"],
  35862. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35863. }),
  35864. $globals.CodeGenerator);
  35865. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35866. $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`";
  35867. $core.addMethod(
  35868. $core.method({
  35869. selector: "ast:forClass:protocol:",
  35870. protocol: "compiling",
  35871. fn: function (aString,aClass,anotherString){
  35872. var self=this,$self=this;
  35873. return $core.withContext(function($ctx1) {
  35874. var $early={};
  35875. try {
  35876. $self._source_(aString);
  35877. $self._forClass_protocol_(aClass,anotherString);
  35878. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35879. throw $early=[x];
  35880. }));
  35881. $self._compileNode_($self._parse_(aString));
  35882. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35883. return self;
  35884. }
  35885. catch(e) {if(e===$early)return e[0]; throw e}
  35886. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35887. },
  35888. args: ["aString", "aClass", "anotherString"],
  35889. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  35890. referencedClasses: ["CompilerError"],
  35891. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35892. }),
  35893. $globals.Compiler);
  35894. $core.addMethod(
  35895. $core.method({
  35896. selector: "cleanCodeGenerator",
  35897. protocol: "accessing",
  35898. fn: function (){
  35899. var self=this,$self=this;
  35900. $self["@codeGenerator"]=nil;
  35901. return self;
  35902. },
  35903. args: [],
  35904. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35905. referencedClasses: [],
  35906. messageSends: []
  35907. }),
  35908. $globals.Compiler);
  35909. $core.addMethod(
  35910. $core.method({
  35911. selector: "codeGenerator",
  35912. protocol: "accessing",
  35913. fn: function (){
  35914. var self=this,$self=this;
  35915. return $core.withContext(function($ctx1) {
  35916. var $1,$2,$receiver;
  35917. $1=$self["@codeGenerator"];
  35918. if(($receiver = $1) == null || $receiver.a$nil){
  35919. $2=$recv($self._codeGeneratorClass())._new();
  35920. $recv($2)._source_($self._source());
  35921. $recv($2)._currentClass_($self._currentClass());
  35922. $recv($2)._currentPackage_($self._currentPackage());
  35923. $self["@codeGenerator"]=$recv($2)._yourself();
  35924. return $self["@codeGenerator"];
  35925. } else {
  35926. return $1;
  35927. }
  35928. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  35929. },
  35930. args: [],
  35931. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  35932. referencedClasses: [],
  35933. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35934. }),
  35935. $globals.Compiler);
  35936. $core.addMethod(
  35937. $core.method({
  35938. selector: "codeGeneratorClass",
  35939. protocol: "accessing",
  35940. fn: function (){
  35941. var self=this,$self=this;
  35942. return $core.withContext(function($ctx1) {
  35943. var $1,$receiver;
  35944. $1=$self["@codeGeneratorClass"];
  35945. if(($receiver = $1) == null || $receiver.a$nil){
  35946. return $globals.InliningCodeGenerator;
  35947. } else {
  35948. return $1;
  35949. }
  35950. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  35951. },
  35952. args: [],
  35953. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35954. referencedClasses: ["InliningCodeGenerator"],
  35955. messageSends: ["ifNil:"]
  35956. }),
  35957. $globals.Compiler);
  35958. $core.addMethod(
  35959. $core.method({
  35960. selector: "codeGeneratorClass:",
  35961. protocol: "accessing",
  35962. fn: function (aClass){
  35963. var self=this,$self=this;
  35964. $self["@codeGeneratorClass"]=aClass;
  35965. return self;
  35966. },
  35967. args: ["aClass"],
  35968. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  35969. referencedClasses: [],
  35970. messageSends: []
  35971. }),
  35972. $globals.Compiler);
  35973. $core.addMethod(
  35974. $core.method({
  35975. selector: "compile:forClass:protocol:",
  35976. protocol: "compiling",
  35977. fn: function (aString,aClass,anotherString){
  35978. var self=this,$self=this;
  35979. return $core.withContext(function($ctx1) {
  35980. $self._source_(aString);
  35981. $self._forClass_protocol_(aClass,anotherString);
  35982. return $self._compileNode_($self._parse_(aString));
  35983. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35984. },
  35985. args: ["aString", "aClass", "anotherString"],
  35986. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  35987. referencedClasses: [],
  35988. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  35989. }),
  35990. $globals.Compiler);
  35991. $core.addMethod(
  35992. $core.method({
  35993. selector: "compileExpression:on:",
  35994. protocol: "compiling",
  35995. fn: function (aString,anObject){
  35996. var self=this,$self=this;
  35997. return $core.withContext(function($ctx1) {
  35998. var $1;
  35999. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36000. $ctx1.sendIdx[","]=1;
  36001. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36002. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36003. },
  36004. args: ["aString", "anObject"],
  36005. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36006. referencedClasses: [],
  36007. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36008. }),
  36009. $globals.Compiler);
  36010. $core.addMethod(
  36011. $core.method({
  36012. selector: "compileNode:",
  36013. protocol: "compiling",
  36014. fn: function (aNode){
  36015. var self=this,$self=this;
  36016. var result;
  36017. return $core.withContext(function($ctx1) {
  36018. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36019. $self._cleanCodeGenerator();
  36020. return result;
  36021. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36022. },
  36023. args: ["aNode"],
  36024. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36025. referencedClasses: [],
  36026. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36027. }),
  36028. $globals.Compiler);
  36029. $core.addMethod(
  36030. $core.method({
  36031. selector: "currentClass",
  36032. protocol: "accessing",
  36033. fn: function (){
  36034. var self=this,$self=this;
  36035. return $self["@currentClass"];
  36036. },
  36037. args: [],
  36038. source: "currentClass\x0a\x09^ currentClass",
  36039. referencedClasses: [],
  36040. messageSends: []
  36041. }),
  36042. $globals.Compiler);
  36043. $core.addMethod(
  36044. $core.method({
  36045. selector: "currentClass:",
  36046. protocol: "accessing",
  36047. fn: function (aClass){
  36048. var self=this,$self=this;
  36049. $self["@currentClass"]=aClass;
  36050. return self;
  36051. },
  36052. args: ["aClass"],
  36053. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36054. referencedClasses: [],
  36055. messageSends: []
  36056. }),
  36057. $globals.Compiler);
  36058. $core.addMethod(
  36059. $core.method({
  36060. selector: "currentPackage",
  36061. protocol: "accessing",
  36062. fn: function (){
  36063. var self=this,$self=this;
  36064. return $self["@currentPackage"];
  36065. },
  36066. args: [],
  36067. source: "currentPackage\x0a\x09^ currentPackage",
  36068. referencedClasses: [],
  36069. messageSends: []
  36070. }),
  36071. $globals.Compiler);
  36072. $core.addMethod(
  36073. $core.method({
  36074. selector: "currentPackage:",
  36075. protocol: "accessing",
  36076. fn: function (anObject){
  36077. var self=this,$self=this;
  36078. $self["@currentPackage"]=anObject;
  36079. return self;
  36080. },
  36081. args: ["anObject"],
  36082. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36083. referencedClasses: [],
  36084. messageSends: []
  36085. }),
  36086. $globals.Compiler);
  36087. $core.addMethod(
  36088. $core.method({
  36089. selector: "eval:",
  36090. protocol: "compiling",
  36091. fn: function (aString){
  36092. var self=this,$self=this;
  36093. return $core.withContext(function($ctx1) {
  36094. return eval(aString);
  36095. return self;
  36096. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36097. },
  36098. args: ["aString"],
  36099. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36100. referencedClasses: [],
  36101. messageSends: []
  36102. }),
  36103. $globals.Compiler);
  36104. $core.addMethod(
  36105. $core.method({
  36106. selector: "eval:forPackage:",
  36107. protocol: "compiling",
  36108. fn: function (aString,aPackage){
  36109. var self=this,$self=this;
  36110. return $core.withContext(function($ctx1) {
  36111. var $receiver;
  36112. if(($receiver = aPackage) == null || $receiver.a$nil){
  36113. return $self._eval_(aString);
  36114. $ctx1.sendIdx["eval:"]=1;
  36115. } else {
  36116. return $recv(aPackage)._eval_(aString);
  36117. }
  36118. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36119. },
  36120. args: ["aString", "aPackage"],
  36121. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36122. referencedClasses: [],
  36123. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36124. }),
  36125. $globals.Compiler);
  36126. $core.addMethod(
  36127. $core.method({
  36128. selector: "evaluateExpression:",
  36129. protocol: "compiling",
  36130. fn: function (aString){
  36131. var self=this,$self=this;
  36132. return $core.withContext(function($ctx1) {
  36133. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36134. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36135. },
  36136. args: ["aString"],
  36137. 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",
  36138. referencedClasses: ["DoIt"],
  36139. messageSends: ["evaluateExpression:on:", "new"]
  36140. }),
  36141. $globals.Compiler);
  36142. $core.addMethod(
  36143. $core.method({
  36144. selector: "evaluateExpression:on:",
  36145. protocol: "compiling",
  36146. fn: function (aString,anObject){
  36147. var self=this,$self=this;
  36148. var result,method;
  36149. return $core.withContext(function($ctx1) {
  36150. var $1;
  36151. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36152. $recv(method)._protocol_("**xxxDoIt");
  36153. $1=$recv(anObject)._class();
  36154. $ctx1.sendIdx["class"]=1;
  36155. $recv($1)._addCompiledMethod_(method);
  36156. result=$recv(anObject)._xxxDoIt();
  36157. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36158. return result;
  36159. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36160. },
  36161. args: ["aString", "anObject"],
  36162. 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",
  36163. referencedClasses: [],
  36164. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36165. }),
  36166. $globals.Compiler);
  36167. $core.addMethod(
  36168. $core.method({
  36169. selector: "forClass:protocol:",
  36170. protocol: "compiling",
  36171. fn: function (aClass,anotherString){
  36172. var self=this,$self=this;
  36173. return $core.withContext(function($ctx1) {
  36174. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36175. $self._currentClass_(aClass);
  36176. return self;
  36177. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36178. },
  36179. args: ["aClass", "anotherString"],
  36180. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36181. referencedClasses: [],
  36182. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36183. }),
  36184. $globals.Compiler);
  36185. $core.addMethod(
  36186. $core.method({
  36187. selector: "install:forClass:protocol:",
  36188. protocol: "compiling",
  36189. fn: function (aString,aBehavior,anotherString){
  36190. var self=this,$self=this;
  36191. var compiledMethod;
  36192. return $core.withContext(function($ctx1) {
  36193. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36194. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36195. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36196. },
  36197. args: ["aString", "aBehavior", "anotherString"],
  36198. 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",
  36199. referencedClasses: ["ClassBuilder"],
  36200. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36201. }),
  36202. $globals.Compiler);
  36203. $core.addMethod(
  36204. $core.method({
  36205. selector: "parse:",
  36206. protocol: "compiling",
  36207. fn: function (aString){
  36208. var self=this,$self=this;
  36209. return $core.withContext(function($ctx1) {
  36210. return $recv($globals.Smalltalk)._parse_(aString);
  36211. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36212. },
  36213. args: ["aString"],
  36214. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36215. referencedClasses: ["Smalltalk"],
  36216. messageSends: ["parse:"]
  36217. }),
  36218. $globals.Compiler);
  36219. $core.addMethod(
  36220. $core.method({
  36221. selector: "parseExpression:",
  36222. protocol: "compiling",
  36223. fn: function (aString){
  36224. var self=this,$self=this;
  36225. return $core.withContext(function($ctx1) {
  36226. var $1;
  36227. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36228. $ctx1.sendIdx[","]=1;
  36229. return $self._parse_($1);
  36230. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36231. },
  36232. args: ["aString"],
  36233. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36234. referencedClasses: [],
  36235. messageSends: ["parse:", ","]
  36236. }),
  36237. $globals.Compiler);
  36238. $core.addMethod(
  36239. $core.method({
  36240. selector: "recompile:",
  36241. protocol: "compiling",
  36242. fn: function (aClass){
  36243. var self=this,$self=this;
  36244. return $core.withContext(function($ctx1) {
  36245. var $1,$2,$3,$receiver;
  36246. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36247. return $core.withContext(function($ctx2) {
  36248. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36249. $ctx2.sendIdx["="]=1;
  36250. if($core.assert($1)){
  36251. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36252. }
  36253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36254. }),"Recompiling ".__comma($recv(aClass)._name()));
  36255. $2=$recv(aClass)._theMetaClass();
  36256. if(($receiver = $2) == null || $receiver.a$nil){
  36257. $2;
  36258. } else {
  36259. var meta;
  36260. meta=$receiver;
  36261. $3=$recv(meta).__eq(aClass);
  36262. if(!$core.assert($3)){
  36263. $self._recompile_(meta);
  36264. }
  36265. }
  36266. return self;
  36267. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36268. },
  36269. args: ["aClass"],
  36270. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | each methodClass = aClass ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
  36271. referencedClasses: [],
  36272. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36273. }),
  36274. $globals.Compiler);
  36275. $core.addMethod(
  36276. $core.method({
  36277. selector: "recompileAll",
  36278. protocol: "compiling",
  36279. fn: function (){
  36280. var self=this,$self=this;
  36281. return $core.withContext(function($ctx1) {
  36282. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36283. return $core.withContext(function($ctx2) {
  36284. return $self._recompile_(each);
  36285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36286. }),"Compiling all classes...");
  36287. return self;
  36288. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36289. },
  36290. args: [],
  36291. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36292. referencedClasses: ["Smalltalk"],
  36293. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36294. }),
  36295. $globals.Compiler);
  36296. $core.addMethod(
  36297. $core.method({
  36298. selector: "source",
  36299. protocol: "accessing",
  36300. fn: function (){
  36301. var self=this,$self=this;
  36302. return $core.withContext(function($ctx1) {
  36303. var $1,$receiver;
  36304. $1=$self["@source"];
  36305. if(($receiver = $1) == null || $receiver.a$nil){
  36306. return "";
  36307. } else {
  36308. return $1;
  36309. }
  36310. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36311. },
  36312. args: [],
  36313. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36314. referencedClasses: [],
  36315. messageSends: ["ifNil:"]
  36316. }),
  36317. $globals.Compiler);
  36318. $core.addMethod(
  36319. $core.method({
  36320. selector: "source:",
  36321. protocol: "accessing",
  36322. fn: function (aString){
  36323. var self=this,$self=this;
  36324. $self["@source"]=aString;
  36325. return self;
  36326. },
  36327. args: ["aString"],
  36328. source: "source: aString\x0a\x09source := aString",
  36329. referencedClasses: [],
  36330. messageSends: []
  36331. }),
  36332. $globals.Compiler);
  36333. $core.addMethod(
  36334. $core.method({
  36335. selector: "eval:",
  36336. protocol: "evaluating",
  36337. fn: function (aString){
  36338. var self=this,$self=this;
  36339. return $core.withContext(function($ctx1) {
  36340. return $recv($self._new())._eval_(aString);
  36341. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36342. },
  36343. args: ["aString"],
  36344. source: "eval: aString\x0a\x09^ self new eval: aString",
  36345. referencedClasses: [],
  36346. messageSends: ["eval:", "new"]
  36347. }),
  36348. $globals.Compiler.a$cls);
  36349. $core.addMethod(
  36350. $core.method({
  36351. selector: "recompile:",
  36352. protocol: "compiling",
  36353. fn: function (aClass){
  36354. var self=this,$self=this;
  36355. return $core.withContext(function($ctx1) {
  36356. $recv($self._new())._recompile_(aClass);
  36357. return self;
  36358. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36359. },
  36360. args: ["aClass"],
  36361. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36362. referencedClasses: [],
  36363. messageSends: ["recompile:", "new"]
  36364. }),
  36365. $globals.Compiler.a$cls);
  36366. $core.addMethod(
  36367. $core.method({
  36368. selector: "recompileAll",
  36369. protocol: "compiling",
  36370. fn: function (){
  36371. var self=this,$self=this;
  36372. return $core.withContext(function($ctx1) {
  36373. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36374. return $core.withContext(function($ctx2) {
  36375. return $self._recompile_(each);
  36376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36377. }));
  36378. return self;
  36379. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36380. },
  36381. args: [],
  36382. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36383. referencedClasses: ["Smalltalk"],
  36384. messageSends: ["do:", "classes", "recompile:"]
  36385. }),
  36386. $globals.Compiler.a$cls);
  36387. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36388. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36389. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36390. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36391. $core.addMethod(
  36392. $core.method({
  36393. selector: "evaluate:context:",
  36394. protocol: "evaluating",
  36395. fn: function (aString,aContext){
  36396. var self=this,$self=this;
  36397. var compiler,ast;
  36398. return $core.withContext(function($ctx1) {
  36399. var $1;
  36400. var $early={};
  36401. try {
  36402. compiler=$recv($globals.Compiler)._new();
  36403. $recv((function(){
  36404. return $core.withContext(function($ctx2) {
  36405. ast=$recv(compiler)._parseExpression_(aString);
  36406. return ast;
  36407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36408. }))._on_do_($globals.Error,(function(ex){
  36409. return $core.withContext(function($ctx2) {
  36410. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36411. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36412. }));
  36413. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36414. $recv($1)._context_(aContext);
  36415. $recv($1)._visit_(ast);
  36416. return $recv(aContext)._evaluateNode_(ast);
  36417. }
  36418. catch(e) {if(e===$early)return e[0]; throw e}
  36419. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36420. },
  36421. args: ["aString", "aContext"],
  36422. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  36423. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36424. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36425. }),
  36426. $globals.Evaluator);
  36427. $core.addMethod(
  36428. $core.method({
  36429. selector: "evaluate:for:",
  36430. protocol: "evaluating",
  36431. fn: function (aString,anObject){
  36432. var self=this,$self=this;
  36433. return $core.withContext(function($ctx1) {
  36434. return $recv(anObject)._evaluate_on_(aString,self);
  36435. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36436. },
  36437. args: ["aString", "anObject"],
  36438. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36439. referencedClasses: [],
  36440. messageSends: ["evaluate:on:"]
  36441. }),
  36442. $globals.Evaluator);
  36443. $core.addMethod(
  36444. $core.method({
  36445. selector: "evaluate:receiver:",
  36446. protocol: "evaluating",
  36447. fn: function (aString,anObject){
  36448. var self=this,$self=this;
  36449. var compiler;
  36450. return $core.withContext(function($ctx1) {
  36451. var $early={};
  36452. try {
  36453. compiler=$recv($globals.Compiler)._new();
  36454. $recv((function(){
  36455. return $core.withContext(function($ctx2) {
  36456. return $recv(compiler)._parseExpression_(aString);
  36457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36458. }))._on_do_($globals.Error,(function(ex){
  36459. return $core.withContext(function($ctx2) {
  36460. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36461. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36462. }));
  36463. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36464. }
  36465. catch(e) {if(e===$early)return e[0]; throw e}
  36466. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36467. },
  36468. args: ["aString", "anObject"],
  36469. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  36470. referencedClasses: ["Compiler", "Error", "Terminal"],
  36471. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36472. }),
  36473. $globals.Evaluator);
  36474. $core.addMethod(
  36475. $core.method({
  36476. selector: "evaluate:for:",
  36477. protocol: "instance creation",
  36478. fn: function (aString,anObject){
  36479. var self=this,$self=this;
  36480. return $core.withContext(function($ctx1) {
  36481. return $recv($self._new())._evaluate_for_(aString,anObject);
  36482. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36483. },
  36484. args: ["aString", "anObject"],
  36485. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36486. referencedClasses: [],
  36487. messageSends: ["evaluate:for:", "new"]
  36488. }),
  36489. $globals.Evaluator.a$cls);
  36490. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36491. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36492. $core.addMethod(
  36493. $core.method({
  36494. selector: "canProcessPragma:",
  36495. protocol: "pragma processing",
  36496. fn: function (aMessage){
  36497. var self=this,$self=this;
  36498. var selector;
  36499. return $core.withContext(function($ctx1) {
  36500. selector=$recv(aMessage)._selector();
  36501. return $recv($self._respondsTo_(selector))._and_((function(){
  36502. return $core.withContext(function($ctx2) {
  36503. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36505. }));
  36506. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36507. },
  36508. args: ["aMessage"],
  36509. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36510. referencedClasses: [],
  36511. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36512. }),
  36513. $globals.Pragmator);
  36514. $core.addMethod(
  36515. $core.method({
  36516. selector: "methodNode",
  36517. protocol: "accessing",
  36518. fn: function (){
  36519. var self=this,$self=this;
  36520. return $self["@methodNode"];
  36521. },
  36522. args: [],
  36523. source: "methodNode\x0a\x09^ methodNode",
  36524. referencedClasses: [],
  36525. messageSends: []
  36526. }),
  36527. $globals.Pragmator);
  36528. $core.addMethod(
  36529. $core.method({
  36530. selector: "methodNode:",
  36531. protocol: "accessing",
  36532. fn: function (anObject){
  36533. var self=this,$self=this;
  36534. $self["@methodNode"]=anObject;
  36535. return self;
  36536. },
  36537. args: ["anObject"],
  36538. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36539. referencedClasses: [],
  36540. messageSends: []
  36541. }),
  36542. $globals.Pragmator);
  36543. $core.addMethod(
  36544. $core.method({
  36545. selector: "processPragma:",
  36546. protocol: "pragma processing",
  36547. fn: function (aMessage){
  36548. var self=this,$self=this;
  36549. return $core.withContext(function($ctx1) {
  36550. var $1;
  36551. $1=$self._canProcessPragma_(aMessage);
  36552. if($core.assert($1)){
  36553. return $recv(aMessage)._sendTo_(self);
  36554. }
  36555. return self;
  36556. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36557. },
  36558. args: ["aMessage"],
  36559. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36560. referencedClasses: [],
  36561. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36562. }),
  36563. $globals.Pragmator);
  36564. $core.addMethod(
  36565. $core.method({
  36566. selector: "sequenceNode",
  36567. protocol: "accessing",
  36568. fn: function (){
  36569. var self=this,$self=this;
  36570. return $self["@sequenceNode"];
  36571. },
  36572. args: [],
  36573. source: "sequenceNode\x0a\x09^ sequenceNode",
  36574. referencedClasses: [],
  36575. messageSends: []
  36576. }),
  36577. $globals.Pragmator);
  36578. $core.addMethod(
  36579. $core.method({
  36580. selector: "sequenceNode:",
  36581. protocol: "accessing",
  36582. fn: function (anObject){
  36583. var self=this,$self=this;
  36584. $self["@sequenceNode"]=anObject;
  36585. return self;
  36586. },
  36587. args: ["anObject"],
  36588. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36589. referencedClasses: [],
  36590. messageSends: []
  36591. }),
  36592. $globals.Pragmator);
  36593. $core.addMethod(
  36594. $core.method({
  36595. selector: "visitMethodNode:",
  36596. protocol: "pragma processing",
  36597. fn: function (aNode){
  36598. var self=this,$self=this;
  36599. return $core.withContext(function($ctx1) {
  36600. var $1;
  36601. $self._methodNode_(aNode);
  36602. $1=(
  36603. $ctx1.supercall = true,
  36604. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36605. $ctx1.supercall = false;
  36606. return $1;
  36607. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36608. },
  36609. args: ["aNode"],
  36610. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36611. referencedClasses: [],
  36612. messageSends: ["methodNode:", "visitMethodNode:"]
  36613. }),
  36614. $globals.Pragmator);
  36615. $core.addMethod(
  36616. $core.method({
  36617. selector: "visitSequenceNode:",
  36618. protocol: "pragma processing",
  36619. fn: function (aNode){
  36620. var self=this,$self=this;
  36621. return $core.withContext(function($ctx1) {
  36622. var $1;
  36623. $self._sequenceNode_(aNode);
  36624. $recv($recv(aNode)._pragmas())._do_((function(each){
  36625. return $core.withContext(function($ctx2) {
  36626. return $self._processPragma_(each);
  36627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36628. }));
  36629. $1=(
  36630. $ctx1.supercall = true,
  36631. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36632. $ctx1.supercall = false;
  36633. return $1;
  36634. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36635. },
  36636. args: ["aNode"],
  36637. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36638. referencedClasses: [],
  36639. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36640. }),
  36641. $globals.Pragmator);
  36642. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36643. $core.addMethod(
  36644. $core.method({
  36645. selector: "asVariableName",
  36646. protocol: "*Compiler-Core",
  36647. fn: function (){
  36648. var self=this,$self=this;
  36649. return $core.withContext(function($ctx1) {
  36650. var $1;
  36651. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36652. if($core.assert($1)){
  36653. return $self.__comma("_");
  36654. } else {
  36655. return self;
  36656. }
  36657. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36658. },
  36659. args: [],
  36660. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36661. referencedClasses: ["Smalltalk"],
  36662. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36663. }),
  36664. $globals.String);
  36665. });
  36666. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36667. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36668. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36669. var $pkg = $core.addPackage("Compiler-Semantic");
  36670. $pkg.innerEval = function (expr) { return eval(expr); };
  36671. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  36672. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36673. $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.";
  36674. $core.addMethod(
  36675. $core.method({
  36676. selector: "addArg:",
  36677. protocol: "adding",
  36678. fn: function (aString){
  36679. var self=this,$self=this;
  36680. return $core.withContext(function($ctx1) {
  36681. var $1;
  36682. $1=$self._args();
  36683. $ctx1.sendIdx["args"]=1;
  36684. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36685. $recv($recv($self._args())._at_(aString))._scope_(self);
  36686. return self;
  36687. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36688. },
  36689. args: ["aString"],
  36690. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36691. referencedClasses: ["ArgVar"],
  36692. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36693. }),
  36694. $globals.LexicalScope);
  36695. $core.addMethod(
  36696. $core.method({
  36697. selector: "addTemp:",
  36698. protocol: "adding",
  36699. fn: function (aString){
  36700. var self=this,$self=this;
  36701. return $core.withContext(function($ctx1) {
  36702. var $1;
  36703. $1=$self._temps();
  36704. $ctx1.sendIdx["temps"]=1;
  36705. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36706. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36707. return self;
  36708. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36709. },
  36710. args: ["aString"],
  36711. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36712. referencedClasses: ["TempVar"],
  36713. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36714. }),
  36715. $globals.LexicalScope);
  36716. $core.addMethod(
  36717. $core.method({
  36718. selector: "alias",
  36719. protocol: "accessing",
  36720. fn: function (){
  36721. var self=this,$self=this;
  36722. return $core.withContext(function($ctx1) {
  36723. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36724. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36725. },
  36726. args: [],
  36727. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36728. referencedClasses: [],
  36729. messageSends: [",", "asString", "scopeLevel"]
  36730. }),
  36731. $globals.LexicalScope);
  36732. $core.addMethod(
  36733. $core.method({
  36734. selector: "allVariableNames",
  36735. protocol: "accessing",
  36736. fn: function (){
  36737. var self=this,$self=this;
  36738. return $core.withContext(function($ctx1) {
  36739. var $1;
  36740. $1=$recv($self._args())._keys();
  36741. $ctx1.sendIdx["keys"]=1;
  36742. return $recv($1).__comma($recv($self._temps())._keys());
  36743. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36744. },
  36745. args: [],
  36746. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36747. referencedClasses: [],
  36748. messageSends: [",", "keys", "args", "temps"]
  36749. }),
  36750. $globals.LexicalScope);
  36751. $core.addMethod(
  36752. $core.method({
  36753. selector: "args",
  36754. protocol: "accessing",
  36755. fn: function (){
  36756. var self=this,$self=this;
  36757. return $core.withContext(function($ctx1) {
  36758. var $1,$receiver;
  36759. $1=$self["@args"];
  36760. if(($receiver = $1) == null || $receiver.a$nil){
  36761. $self["@args"]=$recv($globals.Dictionary)._new();
  36762. return $self["@args"];
  36763. } else {
  36764. return $1;
  36765. }
  36766. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36767. },
  36768. args: [],
  36769. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36770. referencedClasses: ["Dictionary"],
  36771. messageSends: ["ifNil:", "new"]
  36772. }),
  36773. $globals.LexicalScope);
  36774. $core.addMethod(
  36775. $core.method({
  36776. selector: "bindingFor:",
  36777. protocol: "accessing",
  36778. fn: function (aStringOrNode){
  36779. var self=this,$self=this;
  36780. return $core.withContext(function($ctx1) {
  36781. var $2,$3,$4,$5,$1;
  36782. $2=$self._pseudoVars();
  36783. $3=$recv(aStringOrNode)._value();
  36784. $ctx1.sendIdx["value"]=1;
  36785. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36786. return $core.withContext(function($ctx2) {
  36787. $4=$self._args();
  36788. $5=$recv(aStringOrNode)._value();
  36789. $ctx2.sendIdx["value"]=2;
  36790. return $recv($4)._at_ifAbsent_($5,(function(){
  36791. return $core.withContext(function($ctx3) {
  36792. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36793. return nil;
  36794. }));
  36795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36796. }));
  36797. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36799. }));
  36800. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36801. return $1;
  36802. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36803. },
  36804. args: ["aStringOrNode"],
  36805. 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 ]]]",
  36806. referencedClasses: [],
  36807. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36808. }),
  36809. $globals.LexicalScope);
  36810. $core.addMethod(
  36811. $core.method({
  36812. selector: "blockIndex",
  36813. protocol: "accessing",
  36814. fn: function (){
  36815. var self=this,$self=this;
  36816. return $core.withContext(function($ctx1) {
  36817. var $1,$receiver;
  36818. $1=$self["@blockIndex"];
  36819. if(($receiver = $1) == null || $receiver.a$nil){
  36820. return (0);
  36821. } else {
  36822. return $1;
  36823. }
  36824. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36825. },
  36826. args: [],
  36827. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36828. referencedClasses: [],
  36829. messageSends: ["ifNil:"]
  36830. }),
  36831. $globals.LexicalScope);
  36832. $core.addMethod(
  36833. $core.method({
  36834. selector: "blockIndex:",
  36835. protocol: "accessing",
  36836. fn: function (anInteger){
  36837. var self=this,$self=this;
  36838. $self["@blockIndex"]=anInteger;
  36839. return self;
  36840. },
  36841. args: ["anInteger"],
  36842. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36843. referencedClasses: [],
  36844. messageSends: []
  36845. }),
  36846. $globals.LexicalScope);
  36847. $core.addMethod(
  36848. $core.method({
  36849. selector: "canInlineNonLocalReturns",
  36850. protocol: "testing",
  36851. fn: function (){
  36852. var self=this,$self=this;
  36853. return $core.withContext(function($ctx1) {
  36854. return $recv($self._isInlined())._and_((function(){
  36855. return $core.withContext(function($ctx2) {
  36856. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36858. }));
  36859. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36860. },
  36861. args: [],
  36862. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36863. referencedClasses: [],
  36864. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36865. }),
  36866. $globals.LexicalScope);
  36867. $core.addMethod(
  36868. $core.method({
  36869. selector: "instruction",
  36870. protocol: "accessing",
  36871. fn: function (){
  36872. var self=this,$self=this;
  36873. return $self["@instruction"];
  36874. },
  36875. args: [],
  36876. source: "instruction\x0a\x09^ instruction",
  36877. referencedClasses: [],
  36878. messageSends: []
  36879. }),
  36880. $globals.LexicalScope);
  36881. $core.addMethod(
  36882. $core.method({
  36883. selector: "instruction:",
  36884. protocol: "accessing",
  36885. fn: function (anIRInstruction){
  36886. var self=this,$self=this;
  36887. $self["@instruction"]=anIRInstruction;
  36888. return self;
  36889. },
  36890. args: ["anIRInstruction"],
  36891. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36892. referencedClasses: [],
  36893. messageSends: []
  36894. }),
  36895. $globals.LexicalScope);
  36896. $core.addMethod(
  36897. $core.method({
  36898. selector: "isBlockScope",
  36899. protocol: "testing",
  36900. fn: function (){
  36901. var self=this,$self=this;
  36902. return $core.withContext(function($ctx1) {
  36903. return $recv($self._isMethodScope())._not();
  36904. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36905. },
  36906. args: [],
  36907. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36908. referencedClasses: [],
  36909. messageSends: ["not", "isMethodScope"]
  36910. }),
  36911. $globals.LexicalScope);
  36912. $core.addMethod(
  36913. $core.method({
  36914. selector: "isInlined",
  36915. protocol: "testing",
  36916. fn: function (){
  36917. var self=this,$self=this;
  36918. return $core.withContext(function($ctx1) {
  36919. var $2,$1;
  36920. $2=$self._instruction();
  36921. $ctx1.sendIdx["instruction"]=1;
  36922. $1=$recv($2)._notNil();
  36923. return $recv($1)._and_((function(){
  36924. return $core.withContext(function($ctx2) {
  36925. return $recv($self._instruction())._isInlined();
  36926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36927. }));
  36928. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36929. },
  36930. args: [],
  36931. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36932. referencedClasses: [],
  36933. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36934. }),
  36935. $globals.LexicalScope);
  36936. $core.addMethod(
  36937. $core.method({
  36938. selector: "isMethodScope",
  36939. protocol: "testing",
  36940. fn: function (){
  36941. var self=this,$self=this;
  36942. return false;
  36943. },
  36944. args: [],
  36945. source: "isMethodScope\x0a\x09^ false",
  36946. referencedClasses: [],
  36947. messageSends: []
  36948. }),
  36949. $globals.LexicalScope);
  36950. $core.addMethod(
  36951. $core.method({
  36952. selector: "lookupVariable:",
  36953. protocol: "accessing",
  36954. fn: function (aNode){
  36955. var self=this,$self=this;
  36956. var lookup;
  36957. return $core.withContext(function($ctx1) {
  36958. var $1,$2,$receiver;
  36959. lookup=$self._bindingFor_(aNode);
  36960. $1=lookup;
  36961. if(($receiver = $1) == null || $receiver.a$nil){
  36962. $2=$self._outerScope();
  36963. $ctx1.sendIdx["outerScope"]=1;
  36964. if(($receiver = $2) == null || $receiver.a$nil){
  36965. lookup=$2;
  36966. } else {
  36967. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36968. }
  36969. lookup;
  36970. } else {
  36971. $1;
  36972. }
  36973. return lookup;
  36974. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36975. },
  36976. args: ["aNode"],
  36977. 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",
  36978. referencedClasses: [],
  36979. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36980. }),
  36981. $globals.LexicalScope);
  36982. $core.addMethod(
  36983. $core.method({
  36984. selector: "methodScope",
  36985. protocol: "accessing",
  36986. fn: function (){
  36987. var self=this,$self=this;
  36988. return $core.withContext(function($ctx1) {
  36989. var $1,$receiver;
  36990. $1=$self._outerScope();
  36991. $ctx1.sendIdx["outerScope"]=1;
  36992. if(($receiver = $1) == null || $receiver.a$nil){
  36993. return $1;
  36994. } else {
  36995. return $recv($self._outerScope())._methodScope();
  36996. }
  36997. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36998. },
  36999. args: [],
  37000. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37001. referencedClasses: [],
  37002. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37003. }),
  37004. $globals.LexicalScope);
  37005. $core.addMethod(
  37006. $core.method({
  37007. selector: "node",
  37008. protocol: "accessing",
  37009. fn: function (){
  37010. var self=this,$self=this;
  37011. return $self["@node"];
  37012. },
  37013. args: [],
  37014. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37015. referencedClasses: [],
  37016. messageSends: []
  37017. }),
  37018. $globals.LexicalScope);
  37019. $core.addMethod(
  37020. $core.method({
  37021. selector: "node:",
  37022. protocol: "accessing",
  37023. fn: function (aNode){
  37024. var self=this,$self=this;
  37025. $self["@node"]=aNode;
  37026. return self;
  37027. },
  37028. args: ["aNode"],
  37029. source: "node: aNode\x0a\x09node := aNode",
  37030. referencedClasses: [],
  37031. messageSends: []
  37032. }),
  37033. $globals.LexicalScope);
  37034. $core.addMethod(
  37035. $core.method({
  37036. selector: "outerScope",
  37037. protocol: "accessing",
  37038. fn: function (){
  37039. var self=this,$self=this;
  37040. return $self["@outerScope"];
  37041. },
  37042. args: [],
  37043. source: "outerScope\x0a\x09^ outerScope",
  37044. referencedClasses: [],
  37045. messageSends: []
  37046. }),
  37047. $globals.LexicalScope);
  37048. $core.addMethod(
  37049. $core.method({
  37050. selector: "outerScope:",
  37051. protocol: "accessing",
  37052. fn: function (aLexicalScope){
  37053. var self=this,$self=this;
  37054. $self["@outerScope"]=aLexicalScope;
  37055. return self;
  37056. },
  37057. args: ["aLexicalScope"],
  37058. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37059. referencedClasses: [],
  37060. messageSends: []
  37061. }),
  37062. $globals.LexicalScope);
  37063. $core.addMethod(
  37064. $core.method({
  37065. selector: "pseudoVars",
  37066. protocol: "accessing",
  37067. fn: function (){
  37068. var self=this,$self=this;
  37069. return $core.withContext(function($ctx1) {
  37070. return $recv($self._methodScope())._pseudoVars();
  37071. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37072. },
  37073. args: [],
  37074. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37075. referencedClasses: [],
  37076. messageSends: ["pseudoVars", "methodScope"]
  37077. }),
  37078. $globals.LexicalScope);
  37079. $core.addMethod(
  37080. $core.method({
  37081. selector: "scopeLevel",
  37082. protocol: "accessing",
  37083. fn: function (){
  37084. var self=this,$self=this;
  37085. return $core.withContext(function($ctx1) {
  37086. var $1,$2,$4,$3,$receiver;
  37087. $1=$self._outerScope();
  37088. $ctx1.sendIdx["outerScope"]=1;
  37089. if(($receiver = $1) == null || $receiver.a$nil){
  37090. return (1);
  37091. } else {
  37092. $1;
  37093. }
  37094. $2=$self._isInlined();
  37095. if($core.assert($2)){
  37096. $4=$self._outerScope();
  37097. $ctx1.sendIdx["outerScope"]=2;
  37098. $3=$recv($4)._scopeLevel();
  37099. $ctx1.sendIdx["scopeLevel"]=1;
  37100. return $3;
  37101. }
  37102. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37103. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37104. },
  37105. args: [],
  37106. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37107. referencedClasses: [],
  37108. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37109. }),
  37110. $globals.LexicalScope);
  37111. $core.addMethod(
  37112. $core.method({
  37113. selector: "temps",
  37114. protocol: "accessing",
  37115. fn: function (){
  37116. var self=this,$self=this;
  37117. return $core.withContext(function($ctx1) {
  37118. var $1,$receiver;
  37119. $1=$self["@temps"];
  37120. if(($receiver = $1) == null || $receiver.a$nil){
  37121. $self["@temps"]=$recv($globals.Dictionary)._new();
  37122. return $self["@temps"];
  37123. } else {
  37124. return $1;
  37125. }
  37126. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37127. },
  37128. args: [],
  37129. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37130. referencedClasses: ["Dictionary"],
  37131. messageSends: ["ifNil:", "new"]
  37132. }),
  37133. $globals.LexicalScope);
  37134. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37135. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37136. $core.addMethod(
  37137. $core.method({
  37138. selector: "addIVar:",
  37139. protocol: "adding",
  37140. fn: function (aString){
  37141. var self=this,$self=this;
  37142. return $core.withContext(function($ctx1) {
  37143. var $1;
  37144. $1=$self._iVars();
  37145. $ctx1.sendIdx["iVars"]=1;
  37146. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37147. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37148. return self;
  37149. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37150. },
  37151. args: ["aString"],
  37152. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37153. referencedClasses: ["InstanceVar"],
  37154. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37155. }),
  37156. $globals.MethodLexicalScope);
  37157. $core.addMethod(
  37158. $core.method({
  37159. selector: "addNonLocalReturn:",
  37160. protocol: "adding",
  37161. fn: function (aScope){
  37162. var self=this,$self=this;
  37163. return $core.withContext(function($ctx1) {
  37164. $recv($self._nonLocalReturns())._add_(aScope);
  37165. return self;
  37166. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37167. },
  37168. args: ["aScope"],
  37169. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37170. referencedClasses: [],
  37171. messageSends: ["add:", "nonLocalReturns"]
  37172. }),
  37173. $globals.MethodLexicalScope);
  37174. $core.addMethod(
  37175. $core.method({
  37176. selector: "allVariableNames",
  37177. protocol: "accessing",
  37178. fn: function (){
  37179. var self=this,$self=this;
  37180. return $core.withContext(function($ctx1) {
  37181. var $1;
  37182. $1=(
  37183. $ctx1.supercall = true,
  37184. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37185. $ctx1.supercall = false;
  37186. return $recv($1).__comma($recv($self._iVars())._keys());
  37187. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37188. },
  37189. args: [],
  37190. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37191. referencedClasses: [],
  37192. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37193. }),
  37194. $globals.MethodLexicalScope);
  37195. $core.addMethod(
  37196. $core.method({
  37197. selector: "bindingFor:",
  37198. protocol: "accessing",
  37199. fn: function (aNode){
  37200. var self=this,$self=this;
  37201. return $core.withContext(function($ctx1) {
  37202. var $1,$receiver;
  37203. $1=(
  37204. $ctx1.supercall = true,
  37205. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37206. $ctx1.supercall = false;
  37207. if(($receiver = $1) == null || $receiver.a$nil){
  37208. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37209. return nil;
  37210. }));
  37211. } else {
  37212. return $1;
  37213. }
  37214. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37215. },
  37216. args: ["aNode"],
  37217. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37218. referencedClasses: [],
  37219. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37220. }),
  37221. $globals.MethodLexicalScope);
  37222. $core.addMethod(
  37223. $core.method({
  37224. selector: "canInlineNonLocalReturns",
  37225. protocol: "testing",
  37226. fn: function (){
  37227. var self=this,$self=this;
  37228. return true;
  37229. },
  37230. args: [],
  37231. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37232. referencedClasses: [],
  37233. messageSends: []
  37234. }),
  37235. $globals.MethodLexicalScope);
  37236. $core.addMethod(
  37237. $core.method({
  37238. selector: "hasLocalReturn",
  37239. protocol: "testing",
  37240. fn: function (){
  37241. var self=this,$self=this;
  37242. return $core.withContext(function($ctx1) {
  37243. return $self._localReturn();
  37244. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37245. },
  37246. args: [],
  37247. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37248. referencedClasses: [],
  37249. messageSends: ["localReturn"]
  37250. }),
  37251. $globals.MethodLexicalScope);
  37252. $core.addMethod(
  37253. $core.method({
  37254. selector: "hasNonLocalReturn",
  37255. protocol: "testing",
  37256. fn: function (){
  37257. var self=this,$self=this;
  37258. return $core.withContext(function($ctx1) {
  37259. return $recv($self._nonLocalReturns())._notEmpty();
  37260. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37261. },
  37262. args: [],
  37263. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37264. referencedClasses: [],
  37265. messageSends: ["notEmpty", "nonLocalReturns"]
  37266. }),
  37267. $globals.MethodLexicalScope);
  37268. $core.addMethod(
  37269. $core.method({
  37270. selector: "iVars",
  37271. protocol: "accessing",
  37272. fn: function (){
  37273. var self=this,$self=this;
  37274. return $core.withContext(function($ctx1) {
  37275. var $1,$receiver;
  37276. $1=$self["@iVars"];
  37277. if(($receiver = $1) == null || $receiver.a$nil){
  37278. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37279. return $self["@iVars"];
  37280. } else {
  37281. return $1;
  37282. }
  37283. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37284. },
  37285. args: [],
  37286. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37287. referencedClasses: ["Dictionary"],
  37288. messageSends: ["ifNil:", "new"]
  37289. }),
  37290. $globals.MethodLexicalScope);
  37291. $core.addMethod(
  37292. $core.method({
  37293. selector: "isMethodScope",
  37294. protocol: "testing",
  37295. fn: function (){
  37296. var self=this,$self=this;
  37297. return true;
  37298. },
  37299. args: [],
  37300. source: "isMethodScope\x0a\x09^ true",
  37301. referencedClasses: [],
  37302. messageSends: []
  37303. }),
  37304. $globals.MethodLexicalScope);
  37305. $core.addMethod(
  37306. $core.method({
  37307. selector: "localReturn",
  37308. protocol: "accessing",
  37309. fn: function (){
  37310. var self=this,$self=this;
  37311. return $core.withContext(function($ctx1) {
  37312. var $1,$receiver;
  37313. $1=$self["@localReturn"];
  37314. if(($receiver = $1) == null || $receiver.a$nil){
  37315. return false;
  37316. } else {
  37317. return $1;
  37318. }
  37319. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37320. },
  37321. args: [],
  37322. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37323. referencedClasses: [],
  37324. messageSends: ["ifNil:"]
  37325. }),
  37326. $globals.MethodLexicalScope);
  37327. $core.addMethod(
  37328. $core.method({
  37329. selector: "localReturn:",
  37330. protocol: "accessing",
  37331. fn: function (aBoolean){
  37332. var self=this,$self=this;
  37333. $self["@localReturn"]=aBoolean;
  37334. return self;
  37335. },
  37336. args: ["aBoolean"],
  37337. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37338. referencedClasses: [],
  37339. messageSends: []
  37340. }),
  37341. $globals.MethodLexicalScope);
  37342. $core.addMethod(
  37343. $core.method({
  37344. selector: "methodScope",
  37345. protocol: "accessing",
  37346. fn: function (){
  37347. var self=this,$self=this;
  37348. return self;
  37349. },
  37350. args: [],
  37351. source: "methodScope\x0a\x09^ self",
  37352. referencedClasses: [],
  37353. messageSends: []
  37354. }),
  37355. $globals.MethodLexicalScope);
  37356. $core.addMethod(
  37357. $core.method({
  37358. selector: "nonLocalReturns",
  37359. protocol: "accessing",
  37360. fn: function (){
  37361. var self=this,$self=this;
  37362. return $core.withContext(function($ctx1) {
  37363. var $1,$receiver;
  37364. $1=$self["@nonLocalReturns"];
  37365. if(($receiver = $1) == null || $receiver.a$nil){
  37366. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37367. return $self["@nonLocalReturns"];
  37368. } else {
  37369. return $1;
  37370. }
  37371. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37372. },
  37373. args: [],
  37374. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37375. referencedClasses: ["OrderedCollection"],
  37376. messageSends: ["ifNil:", "new"]
  37377. }),
  37378. $globals.MethodLexicalScope);
  37379. $core.addMethod(
  37380. $core.method({
  37381. selector: "pseudoVars",
  37382. protocol: "accessing",
  37383. fn: function (){
  37384. var self=this,$self=this;
  37385. return $core.withContext(function($ctx1) {
  37386. var $1,$2,$4,$3,$receiver;
  37387. $1=$self["@pseudoVars"];
  37388. if(($receiver = $1) == null || $receiver.a$nil){
  37389. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37390. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37391. return $core.withContext(function($ctx2) {
  37392. $2=$self["@pseudoVars"];
  37393. $4=$recv($globals.PseudoVar)._on_(each);
  37394. $recv($4)._scope_($self._methodScope());
  37395. $3=$recv($4)._yourself();
  37396. return $recv($2)._at_put_(each,$3);
  37397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37398. }));
  37399. } else {
  37400. $1;
  37401. }
  37402. return $self["@pseudoVars"];
  37403. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37404. },
  37405. args: [],
  37406. 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",
  37407. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37408. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37409. }),
  37410. $globals.MethodLexicalScope);
  37411. $core.addMethod(
  37412. $core.method({
  37413. selector: "removeNonLocalReturn:",
  37414. protocol: "adding",
  37415. fn: function (aScope){
  37416. var self=this,$self=this;
  37417. return $core.withContext(function($ctx1) {
  37418. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37419. }));
  37420. return self;
  37421. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37422. },
  37423. args: ["aScope"],
  37424. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37425. referencedClasses: [],
  37426. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37427. }),
  37428. $globals.MethodLexicalScope);
  37429. $core.addMethod(
  37430. $core.method({
  37431. selector: "unknownVariables",
  37432. protocol: "accessing",
  37433. fn: function (){
  37434. var self=this,$self=this;
  37435. return $core.withContext(function($ctx1) {
  37436. var $1,$receiver;
  37437. $1=$self["@unknownVariables"];
  37438. if(($receiver = $1) == null || $receiver.a$nil){
  37439. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37440. return $self["@unknownVariables"];
  37441. } else {
  37442. return $1;
  37443. }
  37444. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37445. },
  37446. args: [],
  37447. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37448. referencedClasses: ["OrderedCollection"],
  37449. messageSends: ["ifNil:", "new"]
  37450. }),
  37451. $globals.MethodLexicalScope);
  37452. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37453. $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.";
  37454. $core.addMethod(
  37455. $core.method({
  37456. selector: "alias",
  37457. protocol: "accessing",
  37458. fn: function (){
  37459. var self=this,$self=this;
  37460. return $core.withContext(function($ctx1) {
  37461. return $recv($self._name())._asVariableName();
  37462. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37463. },
  37464. args: [],
  37465. source: "alias\x0a\x09^ self name asVariableName",
  37466. referencedClasses: [],
  37467. messageSends: ["asVariableName", "name"]
  37468. }),
  37469. $globals.ScopeVar);
  37470. $core.addMethod(
  37471. $core.method({
  37472. selector: "isArgVar",
  37473. protocol: "testing",
  37474. fn: function (){
  37475. var self=this,$self=this;
  37476. return false;
  37477. },
  37478. args: [],
  37479. source: "isArgVar\x0a\x09^ false",
  37480. referencedClasses: [],
  37481. messageSends: []
  37482. }),
  37483. $globals.ScopeVar);
  37484. $core.addMethod(
  37485. $core.method({
  37486. selector: "isClassRefVar",
  37487. protocol: "testing",
  37488. fn: function (){
  37489. var self=this,$self=this;
  37490. return false;
  37491. },
  37492. args: [],
  37493. source: "isClassRefVar\x0a\x09^ false",
  37494. referencedClasses: [],
  37495. messageSends: []
  37496. }),
  37497. $globals.ScopeVar);
  37498. $core.addMethod(
  37499. $core.method({
  37500. selector: "isImmutable",
  37501. protocol: "testing",
  37502. fn: function (){
  37503. var self=this,$self=this;
  37504. return false;
  37505. },
  37506. args: [],
  37507. source: "isImmutable\x0a\x09^ false",
  37508. referencedClasses: [],
  37509. messageSends: []
  37510. }),
  37511. $globals.ScopeVar);
  37512. $core.addMethod(
  37513. $core.method({
  37514. selector: "isInstanceVar",
  37515. protocol: "testing",
  37516. fn: function (){
  37517. var self=this,$self=this;
  37518. return false;
  37519. },
  37520. args: [],
  37521. source: "isInstanceVar\x0a\x09^ false",
  37522. referencedClasses: [],
  37523. messageSends: []
  37524. }),
  37525. $globals.ScopeVar);
  37526. $core.addMethod(
  37527. $core.method({
  37528. selector: "isPseudoVar",
  37529. protocol: "testing",
  37530. fn: function (){
  37531. var self=this,$self=this;
  37532. return false;
  37533. },
  37534. args: [],
  37535. source: "isPseudoVar\x0a\x09^ false",
  37536. referencedClasses: [],
  37537. messageSends: []
  37538. }),
  37539. $globals.ScopeVar);
  37540. $core.addMethod(
  37541. $core.method({
  37542. selector: "isSelf",
  37543. protocol: "testing",
  37544. fn: function (){
  37545. var self=this,$self=this;
  37546. return false;
  37547. },
  37548. args: [],
  37549. source: "isSelf\x0a\x09^ false",
  37550. referencedClasses: [],
  37551. messageSends: []
  37552. }),
  37553. $globals.ScopeVar);
  37554. $core.addMethod(
  37555. $core.method({
  37556. selector: "isSuper",
  37557. protocol: "testing",
  37558. fn: function (){
  37559. var self=this,$self=this;
  37560. return false;
  37561. },
  37562. args: [],
  37563. source: "isSuper\x0a\x09^ false",
  37564. referencedClasses: [],
  37565. messageSends: []
  37566. }),
  37567. $globals.ScopeVar);
  37568. $core.addMethod(
  37569. $core.method({
  37570. selector: "isTempVar",
  37571. protocol: "testing",
  37572. fn: function (){
  37573. var self=this,$self=this;
  37574. return false;
  37575. },
  37576. args: [],
  37577. source: "isTempVar\x0a\x09^ false",
  37578. referencedClasses: [],
  37579. messageSends: []
  37580. }),
  37581. $globals.ScopeVar);
  37582. $core.addMethod(
  37583. $core.method({
  37584. selector: "isUnknownVar",
  37585. protocol: "testing",
  37586. fn: function (){
  37587. var self=this,$self=this;
  37588. return false;
  37589. },
  37590. args: [],
  37591. source: "isUnknownVar\x0a\x09^ false",
  37592. referencedClasses: [],
  37593. messageSends: []
  37594. }),
  37595. $globals.ScopeVar);
  37596. $core.addMethod(
  37597. $core.method({
  37598. selector: "name",
  37599. protocol: "accessing",
  37600. fn: function (){
  37601. var self=this,$self=this;
  37602. return $self["@name"];
  37603. },
  37604. args: [],
  37605. source: "name\x0a\x09^ name",
  37606. referencedClasses: [],
  37607. messageSends: []
  37608. }),
  37609. $globals.ScopeVar);
  37610. $core.addMethod(
  37611. $core.method({
  37612. selector: "name:",
  37613. protocol: "accessing",
  37614. fn: function (aString){
  37615. var self=this,$self=this;
  37616. $self["@name"]=aString;
  37617. return self;
  37618. },
  37619. args: ["aString"],
  37620. source: "name: aString\x0a\x09name := aString",
  37621. referencedClasses: [],
  37622. messageSends: []
  37623. }),
  37624. $globals.ScopeVar);
  37625. $core.addMethod(
  37626. $core.method({
  37627. selector: "scope",
  37628. protocol: "accessing",
  37629. fn: function (){
  37630. var self=this,$self=this;
  37631. return $self["@scope"];
  37632. },
  37633. args: [],
  37634. source: "scope\x0a\x09^ scope",
  37635. referencedClasses: [],
  37636. messageSends: []
  37637. }),
  37638. $globals.ScopeVar);
  37639. $core.addMethod(
  37640. $core.method({
  37641. selector: "scope:",
  37642. protocol: "accessing",
  37643. fn: function (aScope){
  37644. var self=this,$self=this;
  37645. $self["@scope"]=aScope;
  37646. return self;
  37647. },
  37648. args: ["aScope"],
  37649. source: "scope: aScope\x0a\x09scope := aScope",
  37650. referencedClasses: [],
  37651. messageSends: []
  37652. }),
  37653. $globals.ScopeVar);
  37654. $core.addMethod(
  37655. $core.method({
  37656. selector: "validateAssignment",
  37657. protocol: "testing",
  37658. fn: function (){
  37659. var self=this,$self=this;
  37660. return $core.withContext(function($ctx1) {
  37661. var $1,$2;
  37662. $1=$recv($self._isArgVar())._or_((function(){
  37663. return $core.withContext(function($ctx2) {
  37664. return $self._isPseudoVar();
  37665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37666. }));
  37667. if($core.assert($1)){
  37668. $2=$recv($globals.InvalidAssignmentError)._new();
  37669. $recv($2)._variableName_($self._name());
  37670. $recv($2)._signal();
  37671. }
  37672. return self;
  37673. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37674. },
  37675. args: [],
  37676. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37677. referencedClasses: ["InvalidAssignmentError"],
  37678. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37679. }),
  37680. $globals.ScopeVar);
  37681. $core.addMethod(
  37682. $core.method({
  37683. selector: "on:",
  37684. protocol: "instance creation",
  37685. fn: function (aString){
  37686. var self=this,$self=this;
  37687. return $core.withContext(function($ctx1) {
  37688. var $1;
  37689. $1=$self._new();
  37690. $recv($1)._name_(aString);
  37691. return $recv($1)._yourself();
  37692. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37693. },
  37694. args: ["aString"],
  37695. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37696. referencedClasses: [],
  37697. messageSends: ["name:", "new", "yourself"]
  37698. }),
  37699. $globals.ScopeVar.a$cls);
  37700. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37701. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37702. $core.addMethod(
  37703. $core.method({
  37704. selector: "isImmutable",
  37705. protocol: "testing",
  37706. fn: function (){
  37707. var self=this,$self=this;
  37708. return true;
  37709. },
  37710. args: [],
  37711. source: "isImmutable\x0a\x09^ true",
  37712. referencedClasses: [],
  37713. messageSends: []
  37714. }),
  37715. $globals.AliasVar);
  37716. $core.addMethod(
  37717. $core.method({
  37718. selector: "node",
  37719. protocol: "accessing",
  37720. fn: function (){
  37721. var self=this,$self=this;
  37722. return $self["@node"];
  37723. },
  37724. args: [],
  37725. source: "node\x0a\x09^ node",
  37726. referencedClasses: [],
  37727. messageSends: []
  37728. }),
  37729. $globals.AliasVar);
  37730. $core.addMethod(
  37731. $core.method({
  37732. selector: "node:",
  37733. protocol: "accessing",
  37734. fn: function (aNode){
  37735. var self=this,$self=this;
  37736. $self["@node"]=aNode;
  37737. return self;
  37738. },
  37739. args: ["aNode"],
  37740. source: "node: aNode\x0a\x09node := aNode",
  37741. referencedClasses: [],
  37742. messageSends: []
  37743. }),
  37744. $globals.AliasVar);
  37745. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37746. $globals.ArgVar.comment="I am an argument of a method or block.";
  37747. $core.addMethod(
  37748. $core.method({
  37749. selector: "isArgVar",
  37750. protocol: "testing",
  37751. fn: function (){
  37752. var self=this,$self=this;
  37753. return true;
  37754. },
  37755. args: [],
  37756. source: "isArgVar\x0a\x09^ true",
  37757. referencedClasses: [],
  37758. messageSends: []
  37759. }),
  37760. $globals.ArgVar);
  37761. $core.addMethod(
  37762. $core.method({
  37763. selector: "isImmutable",
  37764. protocol: "testing",
  37765. fn: function (){
  37766. var self=this,$self=this;
  37767. return true;
  37768. },
  37769. args: [],
  37770. source: "isImmutable\x0a\x09^ true",
  37771. referencedClasses: [],
  37772. messageSends: []
  37773. }),
  37774. $globals.ArgVar);
  37775. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37776. $globals.ClassRefVar.comment="I am an class reference variable";
  37777. $core.addMethod(
  37778. $core.method({
  37779. selector: "alias",
  37780. protocol: "accessing",
  37781. fn: function (){
  37782. var self=this,$self=this;
  37783. return $core.withContext(function($ctx1) {
  37784. return "$globals.".__comma($self._name());
  37785. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37786. },
  37787. args: [],
  37788. 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",
  37789. referencedClasses: [],
  37790. messageSends: [",", "name"]
  37791. }),
  37792. $globals.ClassRefVar);
  37793. $core.addMethod(
  37794. $core.method({
  37795. selector: "isClassRefVar",
  37796. protocol: "testing",
  37797. fn: function (){
  37798. var self=this,$self=this;
  37799. return true;
  37800. },
  37801. args: [],
  37802. source: "isClassRefVar\x0a\x09^ true",
  37803. referencedClasses: [],
  37804. messageSends: []
  37805. }),
  37806. $globals.ClassRefVar);
  37807. $core.addMethod(
  37808. $core.method({
  37809. selector: "isImmutable",
  37810. protocol: "testing",
  37811. fn: function (){
  37812. var self=this,$self=this;
  37813. return true;
  37814. },
  37815. args: [],
  37816. source: "isImmutable\x0a\x09^ true",
  37817. referencedClasses: [],
  37818. messageSends: []
  37819. }),
  37820. $globals.ClassRefVar);
  37821. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37822. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37823. $core.addMethod(
  37824. $core.method({
  37825. selector: "alias",
  37826. protocol: "testing",
  37827. fn: function (){
  37828. var self=this,$self=this;
  37829. return $core.withContext(function($ctx1) {
  37830. var $1;
  37831. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37832. $ctx1.sendIdx[","]=1;
  37833. return $1;
  37834. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37835. },
  37836. args: [],
  37837. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37838. referencedClasses: [],
  37839. messageSends: [",", "name"]
  37840. }),
  37841. $globals.InstanceVar);
  37842. $core.addMethod(
  37843. $core.method({
  37844. selector: "isInstanceVar",
  37845. protocol: "testing",
  37846. fn: function (){
  37847. var self=this,$self=this;
  37848. return true;
  37849. },
  37850. args: [],
  37851. source: "isInstanceVar\x0a\x09^ true",
  37852. referencedClasses: [],
  37853. messageSends: []
  37854. }),
  37855. $globals.InstanceVar);
  37856. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37857. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37858. $core.addMethod(
  37859. $core.method({
  37860. selector: "alias",
  37861. protocol: "accessing",
  37862. fn: function (){
  37863. var self=this,$self=this;
  37864. return $core.withContext(function($ctx1) {
  37865. return $self._name();
  37866. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37867. },
  37868. args: [],
  37869. source: "alias\x0a\x09^ self name",
  37870. referencedClasses: [],
  37871. messageSends: ["name"]
  37872. }),
  37873. $globals.PseudoVar);
  37874. $core.addMethod(
  37875. $core.method({
  37876. selector: "isImmutable",
  37877. protocol: "testing",
  37878. fn: function (){
  37879. var self=this,$self=this;
  37880. return true;
  37881. },
  37882. args: [],
  37883. source: "isImmutable\x0a\x09^ true",
  37884. referencedClasses: [],
  37885. messageSends: []
  37886. }),
  37887. $globals.PseudoVar);
  37888. $core.addMethod(
  37889. $core.method({
  37890. selector: "isPseudoVar",
  37891. protocol: "testing",
  37892. fn: function (){
  37893. var self=this,$self=this;
  37894. return true;
  37895. },
  37896. args: [],
  37897. source: "isPseudoVar\x0a\x09^ true",
  37898. referencedClasses: [],
  37899. messageSends: []
  37900. }),
  37901. $globals.PseudoVar);
  37902. $core.addMethod(
  37903. $core.method({
  37904. selector: "isSelf",
  37905. protocol: "testing",
  37906. fn: function (){
  37907. var self=this,$self=this;
  37908. return $core.withContext(function($ctx1) {
  37909. return $recv($self["@name"]).__eq("self");
  37910. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37911. },
  37912. args: [],
  37913. source: "isSelf\x0a\x09^ name = 'self'",
  37914. referencedClasses: [],
  37915. messageSends: ["="]
  37916. }),
  37917. $globals.PseudoVar);
  37918. $core.addMethod(
  37919. $core.method({
  37920. selector: "isSuper",
  37921. protocol: "testing",
  37922. fn: function (){
  37923. var self=this,$self=this;
  37924. return $core.withContext(function($ctx1) {
  37925. return $recv($self["@name"]).__eq("super");
  37926. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37927. },
  37928. args: [],
  37929. source: "isSuper\x0a\x09^ name = 'super'",
  37930. referencedClasses: [],
  37931. messageSends: ["="]
  37932. }),
  37933. $globals.PseudoVar);
  37934. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37935. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37936. $core.addMethod(
  37937. $core.method({
  37938. selector: "isTempVar",
  37939. protocol: "testing",
  37940. fn: function (){
  37941. var self=this,$self=this;
  37942. return true;
  37943. },
  37944. args: [],
  37945. source: "isTempVar\x0a\x09^ true",
  37946. referencedClasses: [],
  37947. messageSends: []
  37948. }),
  37949. $globals.TempVar);
  37950. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37951. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37952. $core.addMethod(
  37953. $core.method({
  37954. selector: "isUnknownVar",
  37955. protocol: "testing",
  37956. fn: function (){
  37957. var self=this,$self=this;
  37958. return true;
  37959. },
  37960. args: [],
  37961. source: "isUnknownVar\x0a\x09^ true",
  37962. referencedClasses: [],
  37963. messageSends: []
  37964. }),
  37965. $globals.UnknownVar);
  37966. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37967. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37968. $core.addMethod(
  37969. $core.method({
  37970. selector: "classReferences",
  37971. protocol: "accessing",
  37972. fn: function (){
  37973. var self=this,$self=this;
  37974. return $core.withContext(function($ctx1) {
  37975. var $1,$receiver;
  37976. $1=$self["@classReferences"];
  37977. if(($receiver = $1) == null || $receiver.a$nil){
  37978. $self["@classReferences"]=$recv($globals.Set)._new();
  37979. return $self["@classReferences"];
  37980. } else {
  37981. return $1;
  37982. }
  37983. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37984. },
  37985. args: [],
  37986. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37987. referencedClasses: ["Set"],
  37988. messageSends: ["ifNil:", "new"]
  37989. }),
  37990. $globals.SemanticAnalyzer);
  37991. $core.addMethod(
  37992. $core.method({
  37993. selector: "errorShadowingVariable:",
  37994. protocol: "error handling",
  37995. fn: function (aString){
  37996. var self=this,$self=this;
  37997. return $core.withContext(function($ctx1) {
  37998. var $1;
  37999. $1=$recv($globals.ShadowingVariableError)._new();
  38000. $recv($1)._variableName_(aString);
  38001. $recv($1)._signal();
  38002. return self;
  38003. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38004. },
  38005. args: ["aString"],
  38006. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38007. referencedClasses: ["ShadowingVariableError"],
  38008. messageSends: ["variableName:", "new", "signal"]
  38009. }),
  38010. $globals.SemanticAnalyzer);
  38011. $core.addMethod(
  38012. $core.method({
  38013. selector: "errorUnknownVariable:",
  38014. protocol: "error handling",
  38015. fn: function (aNode){
  38016. var self=this,$self=this;
  38017. var identifier;
  38018. return $core.withContext(function($ctx1) {
  38019. var $1,$2,$3;
  38020. identifier=$recv(aNode)._value();
  38021. $ctx1.sendIdx["value"]=1;
  38022. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38023. return $core.withContext(function($ctx2) {
  38024. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38026. }));
  38027. if($core.assert($1)){
  38028. $2=$recv($globals.UnknownVariableError)._new();
  38029. $3=$recv(aNode)._value();
  38030. $ctx1.sendIdx["value"]=2;
  38031. $recv($2)._variableName_($3);
  38032. $recv($2)._signal();
  38033. } else {
  38034. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38035. }
  38036. return self;
  38037. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38038. },
  38039. args: ["aNode"],
  38040. 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 ]",
  38041. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38042. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38043. }),
  38044. $globals.SemanticAnalyzer);
  38045. $core.addMethod(
  38046. $core.method({
  38047. selector: "isVariableUndefined:inPackage:",
  38048. protocol: "testing",
  38049. fn: function (aString,aPackage){
  38050. var self=this,$self=this;
  38051. return $core.withContext(function($ctx1) {
  38052. var $1,$2,$receiver;
  38053. if(($receiver = aPackage) == null || $receiver.a$nil){
  38054. aPackage;
  38055. } else {
  38056. var packageKnownVars;
  38057. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38058. $1=$recv(packageKnownVars)._includes_(aString);
  38059. if($core.assert($1)){
  38060. return false;
  38061. }
  38062. }
  38063. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38064. $ctx1.sendIdx[","]=1;
  38065. return $recv($globals.Compiler)._eval_($2);
  38066. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38067. },
  38068. args: ["aString", "aPackage"],
  38069. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler eval: 'typeof ', aString, ' === \x22undefined\x22'",
  38070. referencedClasses: ["Compiler"],
  38071. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38072. }),
  38073. $globals.SemanticAnalyzer);
  38074. $core.addMethod(
  38075. $core.method({
  38076. selector: "messageSends",
  38077. protocol: "accessing",
  38078. fn: function (){
  38079. var self=this,$self=this;
  38080. return $core.withContext(function($ctx1) {
  38081. var $1,$receiver;
  38082. $1=$self["@messageSends"];
  38083. if(($receiver = $1) == null || $receiver.a$nil){
  38084. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38085. return $self["@messageSends"];
  38086. } else {
  38087. return $1;
  38088. }
  38089. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38090. },
  38091. args: [],
  38092. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38093. referencedClasses: ["Dictionary"],
  38094. messageSends: ["ifNil:", "new"]
  38095. }),
  38096. $globals.SemanticAnalyzer);
  38097. $core.addMethod(
  38098. $core.method({
  38099. selector: "newBlockScope",
  38100. protocol: "factory",
  38101. fn: function (){
  38102. var self=this,$self=this;
  38103. return $core.withContext(function($ctx1) {
  38104. return $self._newScopeOfClass_($globals.LexicalScope);
  38105. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38106. },
  38107. args: [],
  38108. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38109. referencedClasses: ["LexicalScope"],
  38110. messageSends: ["newScopeOfClass:"]
  38111. }),
  38112. $globals.SemanticAnalyzer);
  38113. $core.addMethod(
  38114. $core.method({
  38115. selector: "newMethodScope",
  38116. protocol: "factory",
  38117. fn: function (){
  38118. var self=this,$self=this;
  38119. return $core.withContext(function($ctx1) {
  38120. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38121. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38122. },
  38123. args: [],
  38124. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38125. referencedClasses: ["MethodLexicalScope"],
  38126. messageSends: ["newScopeOfClass:"]
  38127. }),
  38128. $globals.SemanticAnalyzer);
  38129. $core.addMethod(
  38130. $core.method({
  38131. selector: "newScopeOfClass:",
  38132. protocol: "factory",
  38133. fn: function (aLexicalScopeClass){
  38134. var self=this,$self=this;
  38135. return $core.withContext(function($ctx1) {
  38136. var $1;
  38137. $1=$recv(aLexicalScopeClass)._new();
  38138. $recv($1)._outerScope_($self["@currentScope"]);
  38139. return $recv($1)._yourself();
  38140. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38141. },
  38142. args: ["aLexicalScopeClass"],
  38143. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38144. referencedClasses: [],
  38145. messageSends: ["outerScope:", "new", "yourself"]
  38146. }),
  38147. $globals.SemanticAnalyzer);
  38148. $core.addMethod(
  38149. $core.method({
  38150. selector: "nextBlockIndex",
  38151. protocol: "private",
  38152. fn: function (){
  38153. var self=this,$self=this;
  38154. return $core.withContext(function($ctx1) {
  38155. var $1,$receiver;
  38156. $1=$self["@blockIndex"];
  38157. if(($receiver = $1) == null || $receiver.a$nil){
  38158. $self["@blockIndex"]=(0);
  38159. $self["@blockIndex"];
  38160. } else {
  38161. $1;
  38162. }
  38163. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38164. return $self["@blockIndex"];
  38165. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38166. },
  38167. args: [],
  38168. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38169. referencedClasses: [],
  38170. messageSends: ["ifNil:", "+"]
  38171. }),
  38172. $globals.SemanticAnalyzer);
  38173. $core.addMethod(
  38174. $core.method({
  38175. selector: "popScope",
  38176. protocol: "scope",
  38177. fn: function (){
  38178. var self=this,$self=this;
  38179. return $core.withContext(function($ctx1) {
  38180. var $1,$receiver;
  38181. $1=$self["@currentScope"];
  38182. if(($receiver = $1) == null || $receiver.a$nil){
  38183. $1;
  38184. } else {
  38185. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38186. $self["@currentScope"];
  38187. }
  38188. return self;
  38189. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38190. },
  38191. args: [],
  38192. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38193. referencedClasses: [],
  38194. messageSends: ["ifNotNil:", "outerScope"]
  38195. }),
  38196. $globals.SemanticAnalyzer);
  38197. $core.addMethod(
  38198. $core.method({
  38199. selector: "pushScope:",
  38200. protocol: "scope",
  38201. fn: function (aScope){
  38202. var self=this,$self=this;
  38203. return $core.withContext(function($ctx1) {
  38204. $recv(aScope)._outerScope_($self["@currentScope"]);
  38205. $self["@currentScope"]=aScope;
  38206. return self;
  38207. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38208. },
  38209. args: ["aScope"],
  38210. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38211. referencedClasses: [],
  38212. messageSends: ["outerScope:"]
  38213. }),
  38214. $globals.SemanticAnalyzer);
  38215. $core.addMethod(
  38216. $core.method({
  38217. selector: "theClass",
  38218. protocol: "accessing",
  38219. fn: function (){
  38220. var self=this,$self=this;
  38221. return $self["@theClass"];
  38222. },
  38223. args: [],
  38224. source: "theClass\x0a\x09^ theClass",
  38225. referencedClasses: [],
  38226. messageSends: []
  38227. }),
  38228. $globals.SemanticAnalyzer);
  38229. $core.addMethod(
  38230. $core.method({
  38231. selector: "theClass:",
  38232. protocol: "accessing",
  38233. fn: function (aClass){
  38234. var self=this,$self=this;
  38235. $self["@theClass"]=aClass;
  38236. return self;
  38237. },
  38238. args: ["aClass"],
  38239. source: "theClass: aClass\x0a\x09theClass := aClass",
  38240. referencedClasses: [],
  38241. messageSends: []
  38242. }),
  38243. $globals.SemanticAnalyzer);
  38244. $core.addMethod(
  38245. $core.method({
  38246. selector: "thePackage",
  38247. protocol: "accessing",
  38248. fn: function (){
  38249. var self=this,$self=this;
  38250. return $self["@thePackage"];
  38251. },
  38252. args: [],
  38253. source: "thePackage\x0a\x09^ thePackage",
  38254. referencedClasses: [],
  38255. messageSends: []
  38256. }),
  38257. $globals.SemanticAnalyzer);
  38258. $core.addMethod(
  38259. $core.method({
  38260. selector: "thePackage:",
  38261. protocol: "accessing",
  38262. fn: function (aPackage){
  38263. var self=this,$self=this;
  38264. $self["@thePackage"]=aPackage;
  38265. return self;
  38266. },
  38267. args: ["aPackage"],
  38268. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38269. referencedClasses: [],
  38270. messageSends: []
  38271. }),
  38272. $globals.SemanticAnalyzer);
  38273. $core.addMethod(
  38274. $core.method({
  38275. selector: "validateVariableScope:",
  38276. protocol: "scope",
  38277. fn: function (aString){
  38278. var self=this,$self=this;
  38279. return $core.withContext(function($ctx1) {
  38280. var $1,$receiver;
  38281. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38282. if(($receiver = $1) == null || $receiver.a$nil){
  38283. $1;
  38284. } else {
  38285. $self._errorShadowingVariable_(aString);
  38286. }
  38287. return self;
  38288. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38289. },
  38290. args: ["aString"],
  38291. 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 ]",
  38292. referencedClasses: [],
  38293. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38294. }),
  38295. $globals.SemanticAnalyzer);
  38296. $core.addMethod(
  38297. $core.method({
  38298. selector: "visitAssignmentNode:",
  38299. protocol: "visiting",
  38300. fn: function (aNode){
  38301. var self=this,$self=this;
  38302. return $core.withContext(function($ctx1) {
  38303. (
  38304. $ctx1.supercall = true,
  38305. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38306. $ctx1.supercall = false;
  38307. $recv($recv(aNode)._left())._beAssigned();
  38308. return self;
  38309. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38310. },
  38311. args: ["aNode"],
  38312. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38313. referencedClasses: [],
  38314. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38315. }),
  38316. $globals.SemanticAnalyzer);
  38317. $core.addMethod(
  38318. $core.method({
  38319. selector: "visitBlockNode:",
  38320. protocol: "visiting",
  38321. fn: function (aNode){
  38322. var self=this,$self=this;
  38323. return $core.withContext(function($ctx1) {
  38324. $self._pushScope_($self._newBlockScope());
  38325. $recv(aNode)._scope_($self["@currentScope"]);
  38326. $recv($self["@currentScope"])._node_(aNode);
  38327. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38328. $recv($recv(aNode)._parameters())._do_((function(each){
  38329. return $core.withContext(function($ctx2) {
  38330. $self._validateVariableScope_(each);
  38331. return $recv($self["@currentScope"])._addArg_(each);
  38332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38333. }));
  38334. (
  38335. $ctx1.supercall = true,
  38336. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38337. $ctx1.supercall = false;
  38338. $self._popScope();
  38339. return self;
  38340. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38341. },
  38342. args: ["aNode"],
  38343. 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",
  38344. referencedClasses: [],
  38345. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38346. }),
  38347. $globals.SemanticAnalyzer);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "visitCascadeNode:",
  38351. protocol: "visiting",
  38352. fn: function (aNode){
  38353. var self=this,$self=this;
  38354. return $core.withContext(function($ctx1) {
  38355. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38356. (
  38357. $ctx1.supercall = true,
  38358. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38359. $ctx1.supercall = false;
  38360. return self;
  38361. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38362. },
  38363. args: ["aNode"],
  38364. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38365. referencedClasses: [],
  38366. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38367. }),
  38368. $globals.SemanticAnalyzer);
  38369. $core.addMethod(
  38370. $core.method({
  38371. selector: "visitMethodNode:",
  38372. protocol: "visiting",
  38373. fn: function (aNode){
  38374. var self=this,$self=this;
  38375. return $core.withContext(function($ctx1) {
  38376. $self._pushScope_($self._newMethodScope());
  38377. $recv(aNode)._scope_($self["@currentScope"]);
  38378. $recv($self["@currentScope"])._node_(aNode);
  38379. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38380. return $core.withContext(function($ctx2) {
  38381. return $recv($self["@currentScope"])._addIVar_(each);
  38382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38383. }));
  38384. $ctx1.sendIdx["do:"]=1;
  38385. $recv($recv(aNode)._arguments())._do_((function(each){
  38386. return $core.withContext(function($ctx2) {
  38387. $self._validateVariableScope_(each);
  38388. return $recv($self["@currentScope"])._addArg_(each);
  38389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38390. }));
  38391. (
  38392. $ctx1.supercall = true,
  38393. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38394. $ctx1.supercall = false;
  38395. $recv(aNode)._classReferences_($self._classReferences());
  38396. $recv(aNode)._sendIndexes_($self._messageSends());
  38397. $self._popScope();
  38398. return aNode;
  38399. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38400. },
  38401. args: ["aNode"],
  38402. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends.\x0a\x09self popScope.\x0a\x09^ aNode",
  38403. referencedClasses: [],
  38404. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38405. }),
  38406. $globals.SemanticAnalyzer);
  38407. $core.addMethod(
  38408. $core.method({
  38409. selector: "visitReturnNode:",
  38410. protocol: "visiting",
  38411. fn: function (aNode){
  38412. var self=this,$self=this;
  38413. return $core.withContext(function($ctx1) {
  38414. var $1;
  38415. $recv(aNode)._scope_($self["@currentScope"]);
  38416. $1=$recv($self["@currentScope"])._isMethodScope();
  38417. if($core.assert($1)){
  38418. $recv($self["@currentScope"])._localReturn_(true);
  38419. } else {
  38420. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38421. }
  38422. (
  38423. $ctx1.supercall = true,
  38424. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38425. $ctx1.supercall = false;
  38426. return self;
  38427. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38428. },
  38429. args: ["aNode"],
  38430. 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",
  38431. referencedClasses: [],
  38432. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38433. }),
  38434. $globals.SemanticAnalyzer);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "visitSendNode:",
  38438. protocol: "visiting",
  38439. fn: function (aNode){
  38440. var self=this,$self=this;
  38441. var sends;
  38442. return $core.withContext(function($ctx1) {
  38443. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38444. return $core.withContext(function($ctx2) {
  38445. return $recv($globals.OrderedCollection)._new();
  38446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38447. }));
  38448. $recv(sends)._add_(aNode);
  38449. $recv(aNode)._index_($recv(sends)._size());
  38450. (
  38451. $ctx1.supercall = true,
  38452. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38453. $ctx1.supercall = false;
  38454. return self;
  38455. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38456. },
  38457. args: ["aNode"],
  38458. source: "visitSendNode: aNode\x0a\x0a\x09| sends |\x0a\x09sends := self messageSends at: aNode selector ifAbsentPut: [ OrderedCollection new ].\x0a\x09sends add: aNode.\x0a\x0a\x09aNode index: sends size.\x0a\x0a\x09super visitSendNode: aNode",
  38459. referencedClasses: ["OrderedCollection"],
  38460. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38461. }),
  38462. $globals.SemanticAnalyzer);
  38463. $core.addMethod(
  38464. $core.method({
  38465. selector: "visitSequenceNode:",
  38466. protocol: "visiting",
  38467. fn: function (aNode){
  38468. var self=this,$self=this;
  38469. return $core.withContext(function($ctx1) {
  38470. $recv($recv(aNode)._temps())._do_((function(each){
  38471. return $core.withContext(function($ctx2) {
  38472. $self._validateVariableScope_(each);
  38473. return $recv($self["@currentScope"])._addTemp_(each);
  38474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38475. }));
  38476. (
  38477. $ctx1.supercall = true,
  38478. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38479. $ctx1.supercall = false;
  38480. return self;
  38481. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38482. },
  38483. args: ["aNode"],
  38484. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38485. referencedClasses: [],
  38486. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38487. }),
  38488. $globals.SemanticAnalyzer);
  38489. $core.addMethod(
  38490. $core.method({
  38491. selector: "visitVariableNode:",
  38492. protocol: "visiting",
  38493. fn: function (aNode){
  38494. var self=this,$self=this;
  38495. var binding;
  38496. return $core.withContext(function($ctx1) {
  38497. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38498. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38499. $1=binding;
  38500. if(($receiver = $1) == null || $receiver.a$nil){
  38501. $3=$recv(aNode)._value();
  38502. $ctx1.sendIdx["value"]=1;
  38503. $2=$recv($3)._isCapitalized();
  38504. if($core.assert($2)){
  38505. $4=$recv($globals.ClassRefVar)._new();
  38506. $ctx1.sendIdx["new"]=1;
  38507. $5=$recv(aNode)._value();
  38508. $ctx1.sendIdx["value"]=2;
  38509. $recv($4)._name_($5);
  38510. $ctx1.sendIdx["name:"]=1;
  38511. $6=$recv($4)._yourself();
  38512. $ctx1.sendIdx["yourself"]=1;
  38513. binding=$6;
  38514. $7=$self._classReferences();
  38515. $8=$recv(aNode)._value();
  38516. $ctx1.sendIdx["value"]=3;
  38517. $recv($7)._add_($8);
  38518. } else {
  38519. $self._errorUnknownVariable_(aNode);
  38520. $9=$recv($globals.UnknownVar)._new();
  38521. $recv($9)._name_($recv(aNode)._value());
  38522. binding=$recv($9)._yourself();
  38523. binding;
  38524. }
  38525. } else {
  38526. $1;
  38527. }
  38528. $recv(aNode)._binding_(binding);
  38529. return self;
  38530. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38531. },
  38532. args: ["aNode"],
  38533. 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.",
  38534. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38535. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38536. }),
  38537. $globals.SemanticAnalyzer);
  38538. $core.addMethod(
  38539. $core.method({
  38540. selector: "on:",
  38541. protocol: "instance creation",
  38542. fn: function (aClass){
  38543. var self=this,$self=this;
  38544. return $core.withContext(function($ctx1) {
  38545. var $1;
  38546. $1=$self._new();
  38547. $recv($1)._theClass_(aClass);
  38548. return $recv($1)._yourself();
  38549. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38550. },
  38551. args: ["aClass"],
  38552. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38553. referencedClasses: [],
  38554. messageSends: ["theClass:", "new", "yourself"]
  38555. }),
  38556. $globals.SemanticAnalyzer.a$cls);
  38557. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38558. $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";
  38559. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38560. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38561. $core.addMethod(
  38562. $core.method({
  38563. selector: "messageText",
  38564. protocol: "accessing",
  38565. fn: function (){
  38566. var self=this,$self=this;
  38567. return $core.withContext(function($ctx1) {
  38568. return " Invalid assignment to variable: ".__comma($self._variableName());
  38569. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38570. },
  38571. args: [],
  38572. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38573. referencedClasses: [],
  38574. messageSends: [",", "variableName"]
  38575. }),
  38576. $globals.InvalidAssignmentError);
  38577. $core.addMethod(
  38578. $core.method({
  38579. selector: "variableName",
  38580. protocol: "accessing",
  38581. fn: function (){
  38582. var self=this,$self=this;
  38583. return $self["@variableName"];
  38584. },
  38585. args: [],
  38586. source: "variableName\x0a\x09^ variableName",
  38587. referencedClasses: [],
  38588. messageSends: []
  38589. }),
  38590. $globals.InvalidAssignmentError);
  38591. $core.addMethod(
  38592. $core.method({
  38593. selector: "variableName:",
  38594. protocol: "accessing",
  38595. fn: function (aString){
  38596. var self=this,$self=this;
  38597. $self["@variableName"]=aString;
  38598. return self;
  38599. },
  38600. args: ["aString"],
  38601. source: "variableName: aString\x0a\x09variableName := aString",
  38602. referencedClasses: [],
  38603. messageSends: []
  38604. }),
  38605. $globals.InvalidAssignmentError);
  38606. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38607. $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.";
  38608. $core.addMethod(
  38609. $core.method({
  38610. selector: "messageText",
  38611. protocol: "accessing",
  38612. fn: function (){
  38613. var self=this,$self=this;
  38614. return $core.withContext(function($ctx1) {
  38615. var $1;
  38616. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38617. $ctx1.sendIdx[","]=1;
  38618. return $1;
  38619. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38620. },
  38621. args: [],
  38622. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38623. referencedClasses: [],
  38624. messageSends: [",", "variableName"]
  38625. }),
  38626. $globals.ShadowingVariableError);
  38627. $core.addMethod(
  38628. $core.method({
  38629. selector: "variableName",
  38630. protocol: "accessing",
  38631. fn: function (){
  38632. var self=this,$self=this;
  38633. return $self["@variableName"];
  38634. },
  38635. args: [],
  38636. source: "variableName\x0a\x09^ variableName",
  38637. referencedClasses: [],
  38638. messageSends: []
  38639. }),
  38640. $globals.ShadowingVariableError);
  38641. $core.addMethod(
  38642. $core.method({
  38643. selector: "variableName:",
  38644. protocol: "accessing",
  38645. fn: function (aString){
  38646. var self=this,$self=this;
  38647. $self["@variableName"]=aString;
  38648. return self;
  38649. },
  38650. args: ["aString"],
  38651. source: "variableName: aString\x0a\x09variableName := aString",
  38652. referencedClasses: [],
  38653. messageSends: []
  38654. }),
  38655. $globals.ShadowingVariableError);
  38656. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38657. $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.";
  38658. $core.addMethod(
  38659. $core.method({
  38660. selector: "messageText",
  38661. protocol: "accessing",
  38662. fn: function (){
  38663. var self=this,$self=this;
  38664. return $core.withContext(function($ctx1) {
  38665. var $1;
  38666. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38667. $ctx1.sendIdx[","]=1;
  38668. return $1;
  38669. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38670. },
  38671. args: [],
  38672. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38673. referencedClasses: [],
  38674. messageSends: [",", "variableName"]
  38675. }),
  38676. $globals.UnknownVariableError);
  38677. $core.addMethod(
  38678. $core.method({
  38679. selector: "variableName",
  38680. protocol: "accessing",
  38681. fn: function (){
  38682. var self=this,$self=this;
  38683. return $self["@variableName"];
  38684. },
  38685. args: [],
  38686. source: "variableName\x0a\x09^ variableName",
  38687. referencedClasses: [],
  38688. messageSends: []
  38689. }),
  38690. $globals.UnknownVariableError);
  38691. $core.addMethod(
  38692. $core.method({
  38693. selector: "variableName:",
  38694. protocol: "accessing",
  38695. fn: function (aString){
  38696. var self=this,$self=this;
  38697. $self["@variableName"]=aString;
  38698. return self;
  38699. },
  38700. args: ["aString"],
  38701. source: "variableName: aString\x0a\x09variableName := aString",
  38702. referencedClasses: [],
  38703. messageSends: []
  38704. }),
  38705. $globals.UnknownVariableError);
  38706. $core.addMethod(
  38707. $core.method({
  38708. selector: "inlineJS:",
  38709. protocol: "*Compiler-Semantic",
  38710. fn: function (aString){
  38711. var self=this,$self=this;
  38712. return $core.withContext(function($ctx1) {
  38713. var $2,$1,$3,$5,$4;
  38714. $2=$self._sequenceNode();
  38715. $ctx1.sendIdx["sequenceNode"]=1;
  38716. $1=$recv($2)._dagChildren();
  38717. $recv($1)._ifNotEmpty_((function(){
  38718. return $core.withContext(function($ctx2) {
  38719. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38721. }));
  38722. $3=$self._sequenceNode();
  38723. $5=$recv($globals.JSStatementNode)._new();
  38724. $recv($5)._source_(aString);
  38725. $4=$recv($5)._yourself();
  38726. $recv($3)._addDagChild_($4);
  38727. return self;
  38728. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38729. },
  38730. args: ["aString"],
  38731. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38732. referencedClasses: ["CompilerError", "JSStatementNode"],
  38733. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38734. }),
  38735. $globals.EarlyPragmator);
  38736. });
  38737. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  38738. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38739. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38740. var $pkg = $core.addPackage("Compiler-IR");
  38741. $pkg.innerEval = function (expr) { return eval(expr); };
  38742. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  38743. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38744. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38745. $core.addMethod(
  38746. $core.method({
  38747. selector: "addToSequence:",
  38748. protocol: "visiting",
  38749. fn: function (anInstruction){
  38750. var self=this,$self=this;
  38751. return $core.withContext(function($ctx1) {
  38752. var $1,$receiver;
  38753. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38754. anInstruction;
  38755. } else {
  38756. $1=$recv(anInstruction)._isVariable();
  38757. if(!$core.assert($1)){
  38758. $recv($self._sequence())._add_(anInstruction);
  38759. }
  38760. }
  38761. return anInstruction;
  38762. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38763. },
  38764. args: ["anInstruction"],
  38765. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38766. referencedClasses: [],
  38767. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38768. }),
  38769. $globals.IRASTTranslator);
  38770. $core.addMethod(
  38771. $core.method({
  38772. selector: "alias:",
  38773. protocol: "visiting",
  38774. fn: function (aNode){
  38775. var self=this,$self=this;
  38776. var variable;
  38777. return $core.withContext(function($ctx1) {
  38778. var $1,$2,$3,$5,$4,$6,$8,$7;
  38779. $1=$recv(aNode)._isImmutable();
  38780. if($core.assert($1)){
  38781. $2=$self._visit_(aNode);
  38782. $ctx1.sendIdx["visit:"]=1;
  38783. return $2;
  38784. }
  38785. $3=$recv($globals.IRVariable)._new();
  38786. $ctx1.sendIdx["new"]=1;
  38787. $5=$recv($globals.AliasVar)._new();
  38788. $ctx1.sendIdx["new"]=2;
  38789. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38790. $recv($3)._variable_($4);
  38791. $6=$recv($3)._yourself();
  38792. $ctx1.sendIdx["yourself"]=1;
  38793. variable=$6;
  38794. $8=$recv($globals.IRAssignment)._new();
  38795. $recv($8)._add_(variable);
  38796. $ctx1.sendIdx["add:"]=1;
  38797. $recv($8)._add_($self._visit_(aNode));
  38798. $ctx1.sendIdx["add:"]=2;
  38799. $7=$recv($8)._yourself();
  38800. $self._addToSequence_($7);
  38801. $recv($recv($self._method())._internalVariables())._add_(variable);
  38802. return variable;
  38803. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38804. },
  38805. args: ["aNode"],
  38806. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38807. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38808. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38809. }),
  38810. $globals.IRASTTranslator);
  38811. $core.addMethod(
  38812. $core.method({
  38813. selector: "aliasTemporally:",
  38814. protocol: "visiting",
  38815. fn: function (aCollection){
  38816. var self=this,$self=this;
  38817. var threshold,result;
  38818. return $core.withContext(function($ctx1) {
  38819. var $1,$2,$4,$3;
  38820. threshold=(0);
  38821. $recv(aCollection)._withIndexDo_((function(each,i){
  38822. return $core.withContext(function($ctx2) {
  38823. $1=$recv(each)._subtreeNeedsAliasing();
  38824. if($core.assert($1)){
  38825. threshold=i;
  38826. return threshold;
  38827. }
  38828. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38829. }));
  38830. $ctx1.sendIdx["withIndexDo:"]=1;
  38831. result=$recv($globals.OrderedCollection)._new();
  38832. $recv(aCollection)._withIndexDo_((function(each,i){
  38833. return $core.withContext(function($ctx2) {
  38834. $2=result;
  38835. $4=$recv(i).__lt_eq(threshold);
  38836. if($core.assert($4)){
  38837. $3=$self._alias_(each);
  38838. } else {
  38839. $3=$self._visit_(each);
  38840. }
  38841. return $recv($2)._add_($3);
  38842. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38843. }));
  38844. return result;
  38845. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38846. },
  38847. args: ["aCollection"],
  38848. source: "aliasTemporally: aCollection\x0a\x09\x22https://lolg.it/amber/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  38849. referencedClasses: ["OrderedCollection"],
  38850. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38851. }),
  38852. $globals.IRASTTranslator);
  38853. $core.addMethod(
  38854. $core.method({
  38855. selector: "method",
  38856. protocol: "accessing",
  38857. fn: function (){
  38858. var self=this,$self=this;
  38859. return $self["@method"];
  38860. },
  38861. args: [],
  38862. source: "method\x0a\x09^ method",
  38863. referencedClasses: [],
  38864. messageSends: []
  38865. }),
  38866. $globals.IRASTTranslator);
  38867. $core.addMethod(
  38868. $core.method({
  38869. selector: "method:",
  38870. protocol: "accessing",
  38871. fn: function (anIRMethod){
  38872. var self=this,$self=this;
  38873. $self["@method"]=anIRMethod;
  38874. return self;
  38875. },
  38876. args: ["anIRMethod"],
  38877. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38878. referencedClasses: [],
  38879. messageSends: []
  38880. }),
  38881. $globals.IRASTTranslator);
  38882. $core.addMethod(
  38883. $core.method({
  38884. selector: "nextAlias",
  38885. protocol: "accessing",
  38886. fn: function (){
  38887. var self=this,$self=this;
  38888. return $core.withContext(function($ctx1) {
  38889. var $1,$receiver;
  38890. $1=$self["@nextAlias"];
  38891. if(($receiver = $1) == null || $receiver.a$nil){
  38892. $self["@nextAlias"]=(0);
  38893. $self["@nextAlias"];
  38894. } else {
  38895. $1;
  38896. }
  38897. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38898. return $recv($self["@nextAlias"])._asString();
  38899. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38900. },
  38901. args: [],
  38902. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38903. referencedClasses: [],
  38904. messageSends: ["ifNil:", "+", "asString"]
  38905. }),
  38906. $globals.IRASTTranslator);
  38907. $core.addMethod(
  38908. $core.method({
  38909. selector: "sequence",
  38910. protocol: "accessing",
  38911. fn: function (){
  38912. var self=this,$self=this;
  38913. return $self["@sequence"];
  38914. },
  38915. args: [],
  38916. source: "sequence\x0a\x09^ sequence",
  38917. referencedClasses: [],
  38918. messageSends: []
  38919. }),
  38920. $globals.IRASTTranslator);
  38921. $core.addMethod(
  38922. $core.method({
  38923. selector: "sequence:",
  38924. protocol: "accessing",
  38925. fn: function (anIRSequence){
  38926. var self=this,$self=this;
  38927. $self["@sequence"]=anIRSequence;
  38928. return self;
  38929. },
  38930. args: ["anIRSequence"],
  38931. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38932. referencedClasses: [],
  38933. messageSends: []
  38934. }),
  38935. $globals.IRASTTranslator);
  38936. $core.addMethod(
  38937. $core.method({
  38938. selector: "source",
  38939. protocol: "accessing",
  38940. fn: function (){
  38941. var self=this,$self=this;
  38942. return $self["@source"];
  38943. },
  38944. args: [],
  38945. source: "source\x0a\x09^ source",
  38946. referencedClasses: [],
  38947. messageSends: []
  38948. }),
  38949. $globals.IRASTTranslator);
  38950. $core.addMethod(
  38951. $core.method({
  38952. selector: "source:",
  38953. protocol: "accessing",
  38954. fn: function (aString){
  38955. var self=this,$self=this;
  38956. $self["@source"]=aString;
  38957. return self;
  38958. },
  38959. args: ["aString"],
  38960. source: "source: aString\x0a\x09source := aString",
  38961. referencedClasses: [],
  38962. messageSends: []
  38963. }),
  38964. $globals.IRASTTranslator);
  38965. $core.addMethod(
  38966. $core.method({
  38967. selector: "theClass",
  38968. protocol: "accessing",
  38969. fn: function (){
  38970. var self=this,$self=this;
  38971. return $self["@theClass"];
  38972. },
  38973. args: [],
  38974. source: "theClass\x0a\x09^ theClass",
  38975. referencedClasses: [],
  38976. messageSends: []
  38977. }),
  38978. $globals.IRASTTranslator);
  38979. $core.addMethod(
  38980. $core.method({
  38981. selector: "theClass:",
  38982. protocol: "accessing",
  38983. fn: function (aClass){
  38984. var self=this,$self=this;
  38985. $self["@theClass"]=aClass;
  38986. return self;
  38987. },
  38988. args: ["aClass"],
  38989. source: "theClass: aClass\x0a\x09theClass := aClass",
  38990. referencedClasses: [],
  38991. messageSends: []
  38992. }),
  38993. $globals.IRASTTranslator);
  38994. $core.addMethod(
  38995. $core.method({
  38996. selector: "visitAssignmentNode:",
  38997. protocol: "visiting",
  38998. fn: function (aNode){
  38999. var self=this,$self=this;
  39000. var left,right,assignment;
  39001. return $core.withContext(function($ctx1) {
  39002. var $2,$1;
  39003. right=$self._visit_($recv(aNode)._right());
  39004. $ctx1.sendIdx["visit:"]=1;
  39005. left=$self._visit_($recv(aNode)._left());
  39006. $2=$recv($globals.IRAssignment)._new();
  39007. $recv($2)._add_(left);
  39008. $ctx1.sendIdx["add:"]=1;
  39009. $recv($2)._add_(right);
  39010. $1=$recv($2)._yourself();
  39011. $self._addToSequence_($1);
  39012. return left;
  39013. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39014. },
  39015. args: ["aNode"],
  39016. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39017. referencedClasses: ["IRAssignment"],
  39018. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39019. }),
  39020. $globals.IRASTTranslator);
  39021. $core.addMethod(
  39022. $core.method({
  39023. selector: "visitBlockNode:",
  39024. protocol: "visiting",
  39025. fn: function (aNode){
  39026. var self=this,$self=this;
  39027. var closure;
  39028. return $core.withContext(function($ctx1) {
  39029. var $1,$2,$3,$5,$4,$6,$8,$7;
  39030. $1=$recv($globals.IRClosure)._new();
  39031. $ctx1.sendIdx["new"]=1;
  39032. $recv($1)._arguments_($recv(aNode)._parameters());
  39033. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39034. $2=$recv(aNode)._scope();
  39035. $ctx1.sendIdx["scope"]=1;
  39036. $recv($1)._scope_($2);
  39037. $ctx1.sendIdx["scope:"]=1;
  39038. $3=$recv($1)._yourself();
  39039. $ctx1.sendIdx["yourself"]=1;
  39040. closure=$3;
  39041. $5=$recv(aNode)._scope();
  39042. $ctx1.sendIdx["scope"]=2;
  39043. $4=$recv($5)._temps();
  39044. $recv($4)._do_((function(each){
  39045. return $core.withContext(function($ctx2) {
  39046. $6=closure;
  39047. $8=$recv($globals.IRTempDeclaration)._new();
  39048. $recv($8)._name_($recv(each)._name());
  39049. $recv($8)._scope_($recv(aNode)._scope());
  39050. $7=$recv($8)._yourself();
  39051. return $recv($6)._add_($7);
  39052. $ctx2.sendIdx["add:"]=1;
  39053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39054. }));
  39055. $ctx1.sendIdx["do:"]=1;
  39056. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39057. return $core.withContext(function($ctx2) {
  39058. return $recv(closure)._add_($self._visit_(each));
  39059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39060. }));
  39061. return closure;
  39062. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39063. },
  39064. args: ["aNode"],
  39065. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode dagChildren do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  39066. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39067. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39068. }),
  39069. $globals.IRASTTranslator);
  39070. $core.addMethod(
  39071. $core.method({
  39072. selector: "visitBlockSequenceNode:",
  39073. protocol: "visiting",
  39074. fn: function (aNode){
  39075. var self=this,$self=this;
  39076. return $core.withContext(function($ctx1) {
  39077. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39078. $1=$recv($globals.IRBlockSequence)._new();
  39079. $ctx1.sendIdx["new"]=1;
  39080. return $self._withSequence_do_($1,(function(){
  39081. return $core.withContext(function($ctx2) {
  39082. $2=$recv(aNode)._dagChildren();
  39083. $ctx2.sendIdx["dagChildren"]=1;
  39084. return $recv($2)._ifNotEmpty_((function(){
  39085. return $core.withContext(function($ctx3) {
  39086. $4=$recv(aNode)._dagChildren();
  39087. $ctx3.sendIdx["dagChildren"]=2;
  39088. $3=$recv($4)._allButLast();
  39089. $recv($3)._do_((function(each){
  39090. return $core.withContext(function($ctx4) {
  39091. $5=$self._visitOrAlias_(each);
  39092. $ctx4.sendIdx["visitOrAlias:"]=1;
  39093. return $self._addToSequence_($5);
  39094. $ctx4.sendIdx["addToSequence:"]=1;
  39095. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39096. }));
  39097. $8=$recv(aNode)._dagChildren();
  39098. $ctx3.sendIdx["dagChildren"]=3;
  39099. $7=$recv($8)._last();
  39100. $ctx3.sendIdx["last"]=1;
  39101. $6=$recv($7)._isReturnNode();
  39102. if($core.assert($6)){
  39103. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39104. } else {
  39105. $10=$recv($globals.IRBlockReturn)._new();
  39106. $13=$recv(aNode)._dagChildren();
  39107. $ctx3.sendIdx["dagChildren"]=4;
  39108. $12=$recv($13)._last();
  39109. $ctx3.sendIdx["last"]=2;
  39110. $11=$self._visitOrAlias_($12);
  39111. $ctx3.sendIdx["visitOrAlias:"]=2;
  39112. $recv($10)._add_($11);
  39113. $9=$recv($10)._yourself();
  39114. return $self._addToSequence_($9);
  39115. $ctx3.sendIdx["addToSequence:"]=2;
  39116. }
  39117. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39118. }));
  39119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39120. }));
  39121. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39122. },
  39123. args: ["aNode"],
  39124. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39125. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39126. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39127. }),
  39128. $globals.IRASTTranslator);
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "visitCascadeNode:",
  39132. protocol: "visiting",
  39133. fn: function (aNode){
  39134. var self=this,$self=this;
  39135. var receiver;
  39136. return $core.withContext(function($ctx1) {
  39137. var $1,$2,$4,$3;
  39138. receiver=$recv(aNode)._receiver();
  39139. $1=$recv(receiver)._isImmutable();
  39140. if(!$core.assert($1)){
  39141. var alias;
  39142. alias=$self._alias_(receiver);
  39143. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39144. receiver;
  39145. }
  39146. $2=$recv(aNode)._dagChildren();
  39147. $ctx1.sendIdx["dagChildren"]=1;
  39148. $recv($2)._do_((function(each){
  39149. return $core.withContext(function($ctx2) {
  39150. return $recv(each)._receiver_(receiver);
  39151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39152. }));
  39153. $ctx1.sendIdx["do:"]=1;
  39154. $4=$recv(aNode)._dagChildren();
  39155. $ctx1.sendIdx["dagChildren"]=2;
  39156. $3=$recv($4)._allButLast();
  39157. $recv($3)._do_((function(each){
  39158. return $core.withContext(function($ctx2) {
  39159. return $self._addToSequence_($self._visit_(each));
  39160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39161. }));
  39162. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39163. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39164. },
  39165. args: ["aNode"],
  39166. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39167. referencedClasses: ["VariableNode"],
  39168. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39169. }),
  39170. $globals.IRASTTranslator);
  39171. $core.addMethod(
  39172. $core.method({
  39173. selector: "visitDynamicArrayNode:",
  39174. protocol: "visiting",
  39175. fn: function (aNode){
  39176. var self=this,$self=this;
  39177. var array;
  39178. return $core.withContext(function($ctx1) {
  39179. array=$recv($globals.IRDynamicArray)._new();
  39180. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39181. return $core.withContext(function($ctx2) {
  39182. return $recv(array)._add_(each);
  39183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39184. }));
  39185. return array;
  39186. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39187. },
  39188. args: ["aNode"],
  39189. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39190. referencedClasses: ["IRDynamicArray"],
  39191. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39192. }),
  39193. $globals.IRASTTranslator);
  39194. $core.addMethod(
  39195. $core.method({
  39196. selector: "visitDynamicDictionaryNode:",
  39197. protocol: "visiting",
  39198. fn: function (aNode){
  39199. var self=this,$self=this;
  39200. var dictionary;
  39201. return $core.withContext(function($ctx1) {
  39202. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39203. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39204. return $core.withContext(function($ctx2) {
  39205. return $recv(dictionary)._add_(each);
  39206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39207. }));
  39208. return dictionary;
  39209. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39210. },
  39211. args: ["aNode"],
  39212. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39213. referencedClasses: ["IRDynamicDictionary"],
  39214. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39215. }),
  39216. $globals.IRASTTranslator);
  39217. $core.addMethod(
  39218. $core.method({
  39219. selector: "visitJSStatementNode:",
  39220. protocol: "visiting",
  39221. fn: function (aNode){
  39222. var self=this,$self=this;
  39223. return $core.withContext(function($ctx1) {
  39224. var $1;
  39225. $1=$recv($globals.IRVerbatim)._new();
  39226. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39227. return $recv($1)._yourself();
  39228. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39229. },
  39230. args: ["aNode"],
  39231. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39232. referencedClasses: ["IRVerbatim"],
  39233. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39234. }),
  39235. $globals.IRASTTranslator);
  39236. $core.addMethod(
  39237. $core.method({
  39238. selector: "visitMethodNode:",
  39239. protocol: "visiting",
  39240. fn: function (aNode){
  39241. var self=this,$self=this;
  39242. return $core.withContext(function($ctx1) {
  39243. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39244. $2=$recv($globals.IRMethod)._new();
  39245. $ctx1.sendIdx["new"]=1;
  39246. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39247. $ctx1.sendIdx["source:"]=1;
  39248. $recv($2)._theClass_($self._theClass());
  39249. $recv($2)._arguments_($recv(aNode)._arguments());
  39250. $recv($2)._selector_($recv(aNode)._selector());
  39251. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39252. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39253. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39254. $3=$recv(aNode)._scope();
  39255. $ctx1.sendIdx["scope"]=1;
  39256. $recv($2)._scope_($3);
  39257. $ctx1.sendIdx["scope:"]=1;
  39258. $4=$recv($2)._yourself();
  39259. $ctx1.sendIdx["yourself"]=1;
  39260. $1=$4;
  39261. $self._method_($1);
  39262. $6=$recv(aNode)._scope();
  39263. $ctx1.sendIdx["scope"]=2;
  39264. $5=$recv($6)._temps();
  39265. $recv($5)._do_((function(each){
  39266. return $core.withContext(function($ctx2) {
  39267. $7=$self._method();
  39268. $ctx2.sendIdx["method"]=1;
  39269. $9=$recv($globals.IRTempDeclaration)._new();
  39270. $ctx2.sendIdx["new"]=2;
  39271. $recv($9)._name_($recv(each)._name());
  39272. $10=$recv(aNode)._scope();
  39273. $ctx2.sendIdx["scope"]=3;
  39274. $recv($9)._scope_($10);
  39275. $11=$recv($9)._yourself();
  39276. $ctx2.sendIdx["yourself"]=2;
  39277. $8=$11;
  39278. return $recv($7)._add_($8);
  39279. $ctx2.sendIdx["add:"]=1;
  39280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39281. }));
  39282. $ctx1.sendIdx["do:"]=1;
  39283. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39284. return $core.withContext(function($ctx2) {
  39285. $12=$self._method();
  39286. $ctx2.sendIdx["method"]=2;
  39287. return $recv($12)._add_($self._visit_(each));
  39288. $ctx2.sendIdx["add:"]=2;
  39289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39290. }));
  39291. $14=$recv(aNode)._scope();
  39292. $ctx1.sendIdx["scope"]=4;
  39293. $13=$recv($14)._hasLocalReturn();
  39294. if(!$core.assert($13)){
  39295. $15=$self._method();
  39296. $ctx1.sendIdx["method"]=3;
  39297. $17=$recv($globals.IRReturn)._new();
  39298. $ctx1.sendIdx["new"]=3;
  39299. $19=$recv($globals.IRVariable)._new();
  39300. $ctx1.sendIdx["new"]=4;
  39301. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39302. $20=$recv($19)._yourself();
  39303. $ctx1.sendIdx["yourself"]=3;
  39304. $18=$20;
  39305. $recv($17)._add_($18);
  39306. $ctx1.sendIdx["add:"]=4;
  39307. $21=$recv($17)._yourself();
  39308. $ctx1.sendIdx["yourself"]=4;
  39309. $16=$21;
  39310. $recv($15)._add_($16);
  39311. $ctx1.sendIdx["add:"]=3;
  39312. $23=$recv($globals.IRVerbatim)._new();
  39313. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39314. $22=$recv($23)._yourself();
  39315. $recv($15)._add_($22);
  39316. }
  39317. return $self._method();
  39318. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39319. },
  39320. args: ["aNode"],
  39321. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39322. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39323. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39324. }),
  39325. $globals.IRASTTranslator);
  39326. $core.addMethod(
  39327. $core.method({
  39328. selector: "visitOrAlias:",
  39329. protocol: "visiting",
  39330. fn: function (aNode){
  39331. var self=this,$self=this;
  39332. return $core.withContext(function($ctx1) {
  39333. var $1;
  39334. $1=$recv(aNode)._shouldBeAliased();
  39335. if($core.assert($1)){
  39336. return $self._alias_(aNode);
  39337. } else {
  39338. return $self._visit_(aNode);
  39339. }
  39340. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39341. },
  39342. args: ["aNode"],
  39343. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39344. referencedClasses: [],
  39345. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39346. }),
  39347. $globals.IRASTTranslator);
  39348. $core.addMethod(
  39349. $core.method({
  39350. selector: "visitReturnNode:",
  39351. protocol: "visiting",
  39352. fn: function (aNode){
  39353. var self=this,$self=this;
  39354. var return_;
  39355. return $core.withContext(function($ctx1) {
  39356. var $1;
  39357. $1=$recv(aNode)._nonLocalReturn();
  39358. if($core.assert($1)){
  39359. return_=$recv($globals.IRNonLocalReturn)._new();
  39360. $ctx1.sendIdx["new"]=1;
  39361. } else {
  39362. return_=$recv($globals.IRReturn)._new();
  39363. }
  39364. $recv(return_)._scope_($recv(aNode)._scope());
  39365. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39366. return $core.withContext(function($ctx2) {
  39367. return $recv(return_)._add_($self._visitOrAlias_(each));
  39368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39369. }));
  39370. return return_;
  39371. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39372. },
  39373. args: ["aNode"],
  39374. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  39375. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39376. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39377. }),
  39378. $globals.IRASTTranslator);
  39379. $core.addMethod(
  39380. $core.method({
  39381. selector: "visitSendNode:",
  39382. protocol: "visiting",
  39383. fn: function (aNode){
  39384. var self=this,$self=this;
  39385. var send;
  39386. return $core.withContext(function($ctx1) {
  39387. var $1;
  39388. send=$recv($globals.IRSend)._new();
  39389. $1=send;
  39390. $recv($1)._selector_($recv(aNode)._selector());
  39391. $recv($1)._index_($recv(aNode)._index());
  39392. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39393. return $core.withContext(function($ctx2) {
  39394. return $recv(send)._add_(each);
  39395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39396. }));
  39397. return send;
  39398. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39399. },
  39400. args: ["aNode"],
  39401. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  39402. referencedClasses: ["IRSend"],
  39403. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39404. }),
  39405. $globals.IRASTTranslator);
  39406. $core.addMethod(
  39407. $core.method({
  39408. selector: "visitSequenceNode:",
  39409. protocol: "visiting",
  39410. fn: function (aNode){
  39411. var self=this,$self=this;
  39412. return $core.withContext(function($ctx1) {
  39413. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39414. return $core.withContext(function($ctx2) {
  39415. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39416. return $core.withContext(function($ctx3) {
  39417. return $self._addToSequence_($self._visitOrAlias_(each));
  39418. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39419. }));
  39420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39421. }));
  39422. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39423. },
  39424. args: ["aNode"],
  39425. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39426. referencedClasses: ["IRSequence"],
  39427. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39428. }),
  39429. $globals.IRASTTranslator);
  39430. $core.addMethod(
  39431. $core.method({
  39432. selector: "visitValueNode:",
  39433. protocol: "visiting",
  39434. fn: function (aNode){
  39435. var self=this,$self=this;
  39436. return $core.withContext(function($ctx1) {
  39437. var $1;
  39438. $1=$recv($globals.IRValue)._new();
  39439. $recv($1)._value_($recv(aNode)._value());
  39440. return $recv($1)._yourself();
  39441. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39442. },
  39443. args: ["aNode"],
  39444. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39445. referencedClasses: ["IRValue"],
  39446. messageSends: ["value:", "new", "value", "yourself"]
  39447. }),
  39448. $globals.IRASTTranslator);
  39449. $core.addMethod(
  39450. $core.method({
  39451. selector: "visitVariableNode:",
  39452. protocol: "visiting",
  39453. fn: function (aNode){
  39454. var self=this,$self=this;
  39455. return $core.withContext(function($ctx1) {
  39456. var $1;
  39457. $1=$recv($globals.IRVariable)._new();
  39458. $recv($1)._variable_($recv(aNode)._binding());
  39459. return $recv($1)._yourself();
  39460. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39461. },
  39462. args: ["aNode"],
  39463. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39464. referencedClasses: ["IRVariable"],
  39465. messageSends: ["variable:", "new", "binding", "yourself"]
  39466. }),
  39467. $globals.IRASTTranslator);
  39468. $core.addMethod(
  39469. $core.method({
  39470. selector: "withSequence:do:",
  39471. protocol: "accessing",
  39472. fn: function (aSequence,aBlock){
  39473. var self=this,$self=this;
  39474. var outerSequence;
  39475. return $core.withContext(function($ctx1) {
  39476. outerSequence=$self._sequence();
  39477. $self._sequence_(aSequence);
  39478. $ctx1.sendIdx["sequence:"]=1;
  39479. $recv(aBlock)._value();
  39480. $self._sequence_(outerSequence);
  39481. return aSequence;
  39482. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39483. },
  39484. args: ["aSequence", "aBlock"],
  39485. 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",
  39486. referencedClasses: [],
  39487. messageSends: ["sequence", "sequence:", "value"]
  39488. }),
  39489. $globals.IRASTTranslator);
  39490. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39491. $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.";
  39492. $core.addMethod(
  39493. $core.method({
  39494. selector: "add:",
  39495. protocol: "building",
  39496. fn: function (anObject){
  39497. var self=this,$self=this;
  39498. return $core.withContext(function($ctx1) {
  39499. $recv(anObject)._parent_(self);
  39500. return $recv($self._dagChildren())._add_(anObject);
  39501. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39502. },
  39503. args: ["anObject"],
  39504. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39505. referencedClasses: [],
  39506. messageSends: ["parent:", "add:", "dagChildren"]
  39507. }),
  39508. $globals.IRInstruction);
  39509. $core.addMethod(
  39510. $core.method({
  39511. selector: "isClosure",
  39512. protocol: "testing",
  39513. fn: function (){
  39514. var self=this,$self=this;
  39515. return false;
  39516. },
  39517. args: [],
  39518. source: "isClosure\x0a\x09^ false",
  39519. referencedClasses: [],
  39520. messageSends: []
  39521. }),
  39522. $globals.IRInstruction);
  39523. $core.addMethod(
  39524. $core.method({
  39525. selector: "isInlined",
  39526. protocol: "testing",
  39527. fn: function (){
  39528. var self=this,$self=this;
  39529. return false;
  39530. },
  39531. args: [],
  39532. source: "isInlined\x0a\x09^ false",
  39533. referencedClasses: [],
  39534. messageSends: []
  39535. }),
  39536. $globals.IRInstruction);
  39537. $core.addMethod(
  39538. $core.method({
  39539. selector: "isMethod",
  39540. protocol: "testing",
  39541. fn: function (){
  39542. var self=this,$self=this;
  39543. return false;
  39544. },
  39545. args: [],
  39546. source: "isMethod\x0a\x09^ false",
  39547. referencedClasses: [],
  39548. messageSends: []
  39549. }),
  39550. $globals.IRInstruction);
  39551. $core.addMethod(
  39552. $core.method({
  39553. selector: "isSelf",
  39554. protocol: "testing",
  39555. fn: function (){
  39556. var self=this,$self=this;
  39557. return false;
  39558. },
  39559. args: [],
  39560. source: "isSelf\x0a\x09^ false",
  39561. referencedClasses: [],
  39562. messageSends: []
  39563. }),
  39564. $globals.IRInstruction);
  39565. $core.addMethod(
  39566. $core.method({
  39567. selector: "isSend",
  39568. protocol: "testing",
  39569. fn: function (){
  39570. var self=this,$self=this;
  39571. return false;
  39572. },
  39573. args: [],
  39574. source: "isSend\x0a\x09^ false",
  39575. referencedClasses: [],
  39576. messageSends: []
  39577. }),
  39578. $globals.IRInstruction);
  39579. $core.addMethod(
  39580. $core.method({
  39581. selector: "isSequence",
  39582. protocol: "testing",
  39583. fn: function (){
  39584. var self=this,$self=this;
  39585. return false;
  39586. },
  39587. args: [],
  39588. source: "isSequence\x0a\x09^ false",
  39589. referencedClasses: [],
  39590. messageSends: []
  39591. }),
  39592. $globals.IRInstruction);
  39593. $core.addMethod(
  39594. $core.method({
  39595. selector: "isSuper",
  39596. protocol: "testing",
  39597. fn: function (){
  39598. var self=this,$self=this;
  39599. return false;
  39600. },
  39601. args: [],
  39602. source: "isSuper\x0a\x09^ false",
  39603. referencedClasses: [],
  39604. messageSends: []
  39605. }),
  39606. $globals.IRInstruction);
  39607. $core.addMethod(
  39608. $core.method({
  39609. selector: "isTempDeclaration",
  39610. protocol: "testing",
  39611. fn: function (){
  39612. var self=this,$self=this;
  39613. return false;
  39614. },
  39615. args: [],
  39616. source: "isTempDeclaration\x0a\x09^ false",
  39617. referencedClasses: [],
  39618. messageSends: []
  39619. }),
  39620. $globals.IRInstruction);
  39621. $core.addMethod(
  39622. $core.method({
  39623. selector: "isVariable",
  39624. protocol: "testing",
  39625. fn: function (){
  39626. var self=this,$self=this;
  39627. return false;
  39628. },
  39629. args: [],
  39630. source: "isVariable\x0a\x09^ false",
  39631. referencedClasses: [],
  39632. messageSends: []
  39633. }),
  39634. $globals.IRInstruction);
  39635. $core.addMethod(
  39636. $core.method({
  39637. selector: "method",
  39638. protocol: "accessing",
  39639. fn: function (){
  39640. var self=this,$self=this;
  39641. return $core.withContext(function($ctx1) {
  39642. return $recv($self._parent())._method();
  39643. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39644. },
  39645. args: [],
  39646. source: "method\x0a\x09^ self parent method",
  39647. referencedClasses: [],
  39648. messageSends: ["method", "parent"]
  39649. }),
  39650. $globals.IRInstruction);
  39651. $core.addMethod(
  39652. $core.method({
  39653. selector: "needsBoxingAsReceiver",
  39654. protocol: "testing",
  39655. fn: function (){
  39656. var self=this,$self=this;
  39657. return true;
  39658. },
  39659. args: [],
  39660. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39661. referencedClasses: [],
  39662. messageSends: []
  39663. }),
  39664. $globals.IRInstruction);
  39665. $core.addMethod(
  39666. $core.method({
  39667. selector: "parent",
  39668. protocol: "accessing",
  39669. fn: function (){
  39670. var self=this,$self=this;
  39671. return $self["@parent"];
  39672. },
  39673. args: [],
  39674. source: "parent\x0a\x09^ parent",
  39675. referencedClasses: [],
  39676. messageSends: []
  39677. }),
  39678. $globals.IRInstruction);
  39679. $core.addMethod(
  39680. $core.method({
  39681. selector: "parent:",
  39682. protocol: "accessing",
  39683. fn: function (anIRInstruction){
  39684. var self=this,$self=this;
  39685. $self["@parent"]=anIRInstruction;
  39686. return self;
  39687. },
  39688. args: ["anIRInstruction"],
  39689. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39690. referencedClasses: [],
  39691. messageSends: []
  39692. }),
  39693. $globals.IRInstruction);
  39694. $core.addMethod(
  39695. $core.method({
  39696. selector: "remove:",
  39697. protocol: "building",
  39698. fn: function (anIRInstruction){
  39699. var self=this,$self=this;
  39700. return $core.withContext(function($ctx1) {
  39701. $recv($self._dagChildren())._remove_(anIRInstruction);
  39702. return self;
  39703. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39704. },
  39705. args: ["anIRInstruction"],
  39706. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39707. referencedClasses: [],
  39708. messageSends: ["remove:", "dagChildren"]
  39709. }),
  39710. $globals.IRInstruction);
  39711. $core.addMethod(
  39712. $core.method({
  39713. selector: "replace:with:",
  39714. protocol: "building",
  39715. fn: function (anIRInstruction,anotherIRInstruction){
  39716. var self=this,$self=this;
  39717. return $core.withContext(function($ctx1) {
  39718. var $1;
  39719. $recv(anotherIRInstruction)._parent_(self);
  39720. $1=$self._dagChildren();
  39721. $ctx1.sendIdx["dagChildren"]=1;
  39722. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39723. return self;
  39724. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39725. },
  39726. args: ["anIRInstruction", "anotherIRInstruction"],
  39727. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39728. referencedClasses: [],
  39729. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39730. }),
  39731. $globals.IRInstruction);
  39732. $core.addMethod(
  39733. $core.method({
  39734. selector: "replaceWith:",
  39735. protocol: "building",
  39736. fn: function (anIRInstruction){
  39737. var self=this,$self=this;
  39738. return $core.withContext(function($ctx1) {
  39739. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39740. return self;
  39741. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39742. },
  39743. args: ["anIRInstruction"],
  39744. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39745. referencedClasses: [],
  39746. messageSends: ["replace:with:", "parent"]
  39747. }),
  39748. $globals.IRInstruction);
  39749. $core.addMethod(
  39750. $core.method({
  39751. selector: "scope",
  39752. protocol: "accessing",
  39753. fn: function (){
  39754. var self=this,$self=this;
  39755. return $core.withContext(function($ctx1) {
  39756. var $1,$receiver;
  39757. $1=$self._parent();
  39758. if(($receiver = $1) == null || $receiver.a$nil){
  39759. return $1;
  39760. } else {
  39761. var node;
  39762. node=$receiver;
  39763. return $recv(node)._scope();
  39764. }
  39765. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39766. },
  39767. args: [],
  39768. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39769. referencedClasses: [],
  39770. messageSends: ["ifNotNil:", "parent", "scope"]
  39771. }),
  39772. $globals.IRInstruction);
  39773. $core.addMethod(
  39774. $core.method({
  39775. selector: "yieldsValue",
  39776. protocol: "testing",
  39777. fn: function (){
  39778. var self=this,$self=this;
  39779. return true;
  39780. },
  39781. args: [],
  39782. source: "yieldsValue\x0a\x09^ true",
  39783. referencedClasses: [],
  39784. messageSends: []
  39785. }),
  39786. $globals.IRInstruction);
  39787. $core.addMethod(
  39788. $core.method({
  39789. selector: "on:",
  39790. protocol: "instance creation",
  39791. fn: function (aBuilder){
  39792. var self=this,$self=this;
  39793. return $core.withContext(function($ctx1) {
  39794. var $1;
  39795. $1=$self._new();
  39796. $recv($1)._builder_(aBuilder);
  39797. return $recv($1)._yourself();
  39798. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39799. },
  39800. args: ["aBuilder"],
  39801. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39802. referencedClasses: [],
  39803. messageSends: ["builder:", "new", "yourself"]
  39804. }),
  39805. $globals.IRInstruction.a$cls);
  39806. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39807. $core.addMethod(
  39808. $core.method({
  39809. selector: "acceptDagVisitor:",
  39810. protocol: "visiting",
  39811. fn: function (aVisitor){
  39812. var self=this,$self=this;
  39813. return $core.withContext(function($ctx1) {
  39814. return $recv(aVisitor)._visitIRAssignment_(self);
  39815. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39816. },
  39817. args: ["aVisitor"],
  39818. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39819. referencedClasses: [],
  39820. messageSends: ["visitIRAssignment:"]
  39821. }),
  39822. $globals.IRAssignment);
  39823. $core.addMethod(
  39824. $core.method({
  39825. selector: "left",
  39826. protocol: "accessing",
  39827. fn: function (){
  39828. var self=this,$self=this;
  39829. return $core.withContext(function($ctx1) {
  39830. return $recv($self._dagChildren())._first();
  39831. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39832. },
  39833. args: [],
  39834. source: "left\x0a\x09^ self dagChildren first",
  39835. referencedClasses: [],
  39836. messageSends: ["first", "dagChildren"]
  39837. }),
  39838. $globals.IRAssignment);
  39839. $core.addMethod(
  39840. $core.method({
  39841. selector: "right",
  39842. protocol: "accessing",
  39843. fn: function (){
  39844. var self=this,$self=this;
  39845. return $core.withContext(function($ctx1) {
  39846. return $recv($self._dagChildren())._last();
  39847. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39848. },
  39849. args: [],
  39850. source: "right\x0a\x09^ self dagChildren last",
  39851. referencedClasses: [],
  39852. messageSends: ["last", "dagChildren"]
  39853. }),
  39854. $globals.IRAssignment);
  39855. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39856. $core.addMethod(
  39857. $core.method({
  39858. selector: "acceptDagVisitor:",
  39859. protocol: "visiting",
  39860. fn: function (aVisitor){
  39861. var self=this,$self=this;
  39862. return $core.withContext(function($ctx1) {
  39863. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39864. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39865. },
  39866. args: ["aVisitor"],
  39867. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39868. referencedClasses: [],
  39869. messageSends: ["visitIRDynamicArray:"]
  39870. }),
  39871. $globals.IRDynamicArray);
  39872. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39873. $core.addMethod(
  39874. $core.method({
  39875. selector: "acceptDagVisitor:",
  39876. protocol: "visiting",
  39877. fn: function (aVisitor){
  39878. var self=this,$self=this;
  39879. return $core.withContext(function($ctx1) {
  39880. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39881. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39882. },
  39883. args: ["aVisitor"],
  39884. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39885. referencedClasses: [],
  39886. messageSends: ["visitIRDynamicDictionary:"]
  39887. }),
  39888. $globals.IRDynamicDictionary);
  39889. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39890. $core.addMethod(
  39891. $core.method({
  39892. selector: "scope",
  39893. protocol: "accessing",
  39894. fn: function (){
  39895. var self=this,$self=this;
  39896. return $self["@scope"];
  39897. },
  39898. args: [],
  39899. source: "scope\x0a\x09^ scope",
  39900. referencedClasses: [],
  39901. messageSends: []
  39902. }),
  39903. $globals.IRScopedInstruction);
  39904. $core.addMethod(
  39905. $core.method({
  39906. selector: "scope:",
  39907. protocol: "accessing",
  39908. fn: function (aScope){
  39909. var self=this,$self=this;
  39910. $self["@scope"]=aScope;
  39911. return self;
  39912. },
  39913. args: ["aScope"],
  39914. source: "scope: aScope\x0a\x09scope := aScope",
  39915. referencedClasses: [],
  39916. messageSends: []
  39917. }),
  39918. $globals.IRScopedInstruction);
  39919. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39920. $core.addMethod(
  39921. $core.method({
  39922. selector: "arguments",
  39923. protocol: "accessing",
  39924. fn: function (){
  39925. var self=this,$self=this;
  39926. return $core.withContext(function($ctx1) {
  39927. var $1,$receiver;
  39928. $1=$self["@arguments"];
  39929. if(($receiver = $1) == null || $receiver.a$nil){
  39930. return [];
  39931. } else {
  39932. return $1;
  39933. }
  39934. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39935. },
  39936. args: [],
  39937. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39938. referencedClasses: [],
  39939. messageSends: ["ifNil:"]
  39940. }),
  39941. $globals.IRClosureInstruction);
  39942. $core.addMethod(
  39943. $core.method({
  39944. selector: "arguments:",
  39945. protocol: "accessing",
  39946. fn: function (aCollection){
  39947. var self=this,$self=this;
  39948. $self["@arguments"]=aCollection;
  39949. return self;
  39950. },
  39951. args: ["aCollection"],
  39952. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39953. referencedClasses: [],
  39954. messageSends: []
  39955. }),
  39956. $globals.IRClosureInstruction);
  39957. $core.addMethod(
  39958. $core.method({
  39959. selector: "locals",
  39960. protocol: "accessing",
  39961. fn: function (){
  39962. var self=this,$self=this;
  39963. return $core.withContext(function($ctx1) {
  39964. var $1;
  39965. $1=$recv($self._arguments())._copy();
  39966. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39967. return $core.withContext(function($ctx2) {
  39968. return $recv(each)._name();
  39969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39970. })));
  39971. return $recv($1)._yourself();
  39972. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39973. },
  39974. args: [],
  39975. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39976. referencedClasses: [],
  39977. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39978. }),
  39979. $globals.IRClosureInstruction);
  39980. $core.addMethod(
  39981. $core.method({
  39982. selector: "requiresSmalltalkContext",
  39983. protocol: "accessing",
  39984. fn: function (){
  39985. var self=this,$self=this;
  39986. return $core.withContext(function($ctx1) {
  39987. var $1,$receiver;
  39988. $1=$self["@requiresSmalltalkContext"];
  39989. if(($receiver = $1) == null || $receiver.a$nil){
  39990. return false;
  39991. } else {
  39992. return $1;
  39993. }
  39994. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39995. },
  39996. args: [],
  39997. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39998. referencedClasses: [],
  39999. messageSends: ["ifNil:"]
  40000. }),
  40001. $globals.IRClosureInstruction);
  40002. $core.addMethod(
  40003. $core.method({
  40004. selector: "requiresSmalltalkContext:",
  40005. protocol: "accessing",
  40006. fn: function (anObject){
  40007. var self=this,$self=this;
  40008. $self["@requiresSmalltalkContext"]=anObject;
  40009. return self;
  40010. },
  40011. args: ["anObject"],
  40012. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40013. referencedClasses: [],
  40014. messageSends: []
  40015. }),
  40016. $globals.IRClosureInstruction);
  40017. $core.addMethod(
  40018. $core.method({
  40019. selector: "scope:",
  40020. protocol: "accessing",
  40021. fn: function (aScope){
  40022. var self=this,$self=this;
  40023. return $core.withContext(function($ctx1) {
  40024. (
  40025. $ctx1.supercall = true,
  40026. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40027. $ctx1.supercall = false;
  40028. $recv(aScope)._instruction_(self);
  40029. return self;
  40030. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40031. },
  40032. args: ["aScope"],
  40033. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40034. referencedClasses: [],
  40035. messageSends: ["scope:", "instruction:"]
  40036. }),
  40037. $globals.IRClosureInstruction);
  40038. $core.addMethod(
  40039. $core.method({
  40040. selector: "tempDeclarations",
  40041. protocol: "accessing",
  40042. fn: function (){
  40043. var self=this,$self=this;
  40044. return $core.withContext(function($ctx1) {
  40045. return $recv($self._dagChildren())._select_((function(each){
  40046. return $core.withContext(function($ctx2) {
  40047. return $recv(each)._isTempDeclaration();
  40048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40049. }));
  40050. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40051. },
  40052. args: [],
  40053. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40054. referencedClasses: [],
  40055. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40056. }),
  40057. $globals.IRClosureInstruction);
  40058. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40059. $core.addMethod(
  40060. $core.method({
  40061. selector: "acceptDagVisitor:",
  40062. protocol: "visiting",
  40063. fn: function (aVisitor){
  40064. var self=this,$self=this;
  40065. return $core.withContext(function($ctx1) {
  40066. return $recv(aVisitor)._visitIRClosure_(self);
  40067. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40068. },
  40069. args: ["aVisitor"],
  40070. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40071. referencedClasses: [],
  40072. messageSends: ["visitIRClosure:"]
  40073. }),
  40074. $globals.IRClosure);
  40075. $core.addMethod(
  40076. $core.method({
  40077. selector: "isClosure",
  40078. protocol: "testing",
  40079. fn: function (){
  40080. var self=this,$self=this;
  40081. return true;
  40082. },
  40083. args: [],
  40084. source: "isClosure\x0a\x09^ true",
  40085. referencedClasses: [],
  40086. messageSends: []
  40087. }),
  40088. $globals.IRClosure);
  40089. $core.addMethod(
  40090. $core.method({
  40091. selector: "sequence",
  40092. protocol: "accessing",
  40093. fn: function (){
  40094. var self=this,$self=this;
  40095. return $core.withContext(function($ctx1) {
  40096. return $recv($self._dagChildren())._last();
  40097. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40098. },
  40099. args: [],
  40100. source: "sequence\x0a\x09^ self dagChildren last",
  40101. referencedClasses: [],
  40102. messageSends: ["last", "dagChildren"]
  40103. }),
  40104. $globals.IRClosure);
  40105. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40106. $globals.IRMethod.comment="I am a method instruction";
  40107. $core.addMethod(
  40108. $core.method({
  40109. selector: "acceptDagVisitor:",
  40110. protocol: "visiting",
  40111. fn: function (aVisitor){
  40112. var self=this,$self=this;
  40113. return $core.withContext(function($ctx1) {
  40114. return $recv(aVisitor)._visitIRMethod_(self);
  40115. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40116. },
  40117. args: ["aVisitor"],
  40118. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40119. referencedClasses: [],
  40120. messageSends: ["visitIRMethod:"]
  40121. }),
  40122. $globals.IRMethod);
  40123. $core.addMethod(
  40124. $core.method({
  40125. selector: "classReferences",
  40126. protocol: "accessing",
  40127. fn: function (){
  40128. var self=this,$self=this;
  40129. return $self["@classReferences"];
  40130. },
  40131. args: [],
  40132. source: "classReferences\x0a\x09^ classReferences",
  40133. referencedClasses: [],
  40134. messageSends: []
  40135. }),
  40136. $globals.IRMethod);
  40137. $core.addMethod(
  40138. $core.method({
  40139. selector: "classReferences:",
  40140. protocol: "accessing",
  40141. fn: function (aCollection){
  40142. var self=this,$self=this;
  40143. $self["@classReferences"]=aCollection;
  40144. return self;
  40145. },
  40146. args: ["aCollection"],
  40147. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40148. referencedClasses: [],
  40149. messageSends: []
  40150. }),
  40151. $globals.IRMethod);
  40152. $core.addMethod(
  40153. $core.method({
  40154. selector: "internalVariables",
  40155. protocol: "accessing",
  40156. fn: function (){
  40157. var self=this,$self=this;
  40158. return $core.withContext(function($ctx1) {
  40159. var $1,$receiver;
  40160. $1=$self["@internalVariables"];
  40161. if(($receiver = $1) == null || $receiver.a$nil){
  40162. $self["@internalVariables"]=$recv($globals.Set)._new();
  40163. return $self["@internalVariables"];
  40164. } else {
  40165. return $1;
  40166. }
  40167. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40168. },
  40169. args: [],
  40170. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40171. referencedClasses: ["Set"],
  40172. messageSends: ["ifNil:", "new"]
  40173. }),
  40174. $globals.IRMethod);
  40175. $core.addMethod(
  40176. $core.method({
  40177. selector: "isMethod",
  40178. protocol: "testing",
  40179. fn: function (){
  40180. var self=this,$self=this;
  40181. return true;
  40182. },
  40183. args: [],
  40184. source: "isMethod\x0a\x09^ true",
  40185. referencedClasses: [],
  40186. messageSends: []
  40187. }),
  40188. $globals.IRMethod);
  40189. $core.addMethod(
  40190. $core.method({
  40191. selector: "messageSends",
  40192. protocol: "accessing",
  40193. fn: function (){
  40194. var self=this,$self=this;
  40195. return $core.withContext(function($ctx1) {
  40196. return $recv($self._sendIndexes())._keys();
  40197. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40198. },
  40199. args: [],
  40200. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40201. referencedClasses: [],
  40202. messageSends: ["keys", "sendIndexes"]
  40203. }),
  40204. $globals.IRMethod);
  40205. $core.addMethod(
  40206. $core.method({
  40207. selector: "method",
  40208. protocol: "accessing",
  40209. fn: function (){
  40210. var self=this,$self=this;
  40211. return self;
  40212. },
  40213. args: [],
  40214. source: "method\x0a\x09^ self",
  40215. referencedClasses: [],
  40216. messageSends: []
  40217. }),
  40218. $globals.IRMethod);
  40219. $core.addMethod(
  40220. $core.method({
  40221. selector: "selector",
  40222. protocol: "accessing",
  40223. fn: function (){
  40224. var self=this,$self=this;
  40225. return $self["@selector"];
  40226. },
  40227. args: [],
  40228. source: "selector\x0a\x09^ selector",
  40229. referencedClasses: [],
  40230. messageSends: []
  40231. }),
  40232. $globals.IRMethod);
  40233. $core.addMethod(
  40234. $core.method({
  40235. selector: "selector:",
  40236. protocol: "accessing",
  40237. fn: function (aString){
  40238. var self=this,$self=this;
  40239. $self["@selector"]=aString;
  40240. return self;
  40241. },
  40242. args: ["aString"],
  40243. source: "selector: aString\x0a\x09selector := aString",
  40244. referencedClasses: [],
  40245. messageSends: []
  40246. }),
  40247. $globals.IRMethod);
  40248. $core.addMethod(
  40249. $core.method({
  40250. selector: "sendIndexes",
  40251. protocol: "accessing",
  40252. fn: function (){
  40253. var self=this,$self=this;
  40254. return $self["@sendIndexes"];
  40255. },
  40256. args: [],
  40257. source: "sendIndexes\x0a\x09^ sendIndexes",
  40258. referencedClasses: [],
  40259. messageSends: []
  40260. }),
  40261. $globals.IRMethod);
  40262. $core.addMethod(
  40263. $core.method({
  40264. selector: "sendIndexes:",
  40265. protocol: "accessing",
  40266. fn: function (aDictionary){
  40267. var self=this,$self=this;
  40268. $self["@sendIndexes"]=aDictionary;
  40269. return self;
  40270. },
  40271. args: ["aDictionary"],
  40272. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40273. referencedClasses: [],
  40274. messageSends: []
  40275. }),
  40276. $globals.IRMethod);
  40277. $core.addMethod(
  40278. $core.method({
  40279. selector: "source",
  40280. protocol: "accessing",
  40281. fn: function (){
  40282. var self=this,$self=this;
  40283. return $self["@source"];
  40284. },
  40285. args: [],
  40286. source: "source\x0a\x09^ source",
  40287. referencedClasses: [],
  40288. messageSends: []
  40289. }),
  40290. $globals.IRMethod);
  40291. $core.addMethod(
  40292. $core.method({
  40293. selector: "source:",
  40294. protocol: "accessing",
  40295. fn: function (aString){
  40296. var self=this,$self=this;
  40297. $self["@source"]=aString;
  40298. return self;
  40299. },
  40300. args: ["aString"],
  40301. source: "source: aString\x0a\x09source := aString",
  40302. referencedClasses: [],
  40303. messageSends: []
  40304. }),
  40305. $globals.IRMethod);
  40306. $core.addMethod(
  40307. $core.method({
  40308. selector: "theClass",
  40309. protocol: "accessing",
  40310. fn: function (){
  40311. var self=this,$self=this;
  40312. return $self["@theClass"];
  40313. },
  40314. args: [],
  40315. source: "theClass\x0a\x09^ theClass",
  40316. referencedClasses: [],
  40317. messageSends: []
  40318. }),
  40319. $globals.IRMethod);
  40320. $core.addMethod(
  40321. $core.method({
  40322. selector: "theClass:",
  40323. protocol: "accessing",
  40324. fn: function (aClass){
  40325. var self=this,$self=this;
  40326. $self["@theClass"]=aClass;
  40327. return self;
  40328. },
  40329. args: ["aClass"],
  40330. source: "theClass: aClass\x0a\x09theClass := aClass",
  40331. referencedClasses: [],
  40332. messageSends: []
  40333. }),
  40334. $globals.IRMethod);
  40335. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40336. $globals.IRReturn.comment="I am a local return instruction.";
  40337. $core.addMethod(
  40338. $core.method({
  40339. selector: "acceptDagVisitor:",
  40340. protocol: "visiting",
  40341. fn: function (aVisitor){
  40342. var self=this,$self=this;
  40343. return $core.withContext(function($ctx1) {
  40344. return $recv(aVisitor)._visitIRReturn_(self);
  40345. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40346. },
  40347. args: ["aVisitor"],
  40348. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40349. referencedClasses: [],
  40350. messageSends: ["visitIRReturn:"]
  40351. }),
  40352. $globals.IRReturn);
  40353. $core.addMethod(
  40354. $core.method({
  40355. selector: "expression",
  40356. protocol: "accessing",
  40357. fn: function (){
  40358. var self=this,$self=this;
  40359. return $core.withContext(function($ctx1) {
  40360. return $recv($self._dagChildren())._single();
  40361. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40362. },
  40363. args: [],
  40364. source: "expression\x0a\x09^ self dagChildren single",
  40365. referencedClasses: [],
  40366. messageSends: ["single", "dagChildren"]
  40367. }),
  40368. $globals.IRReturn);
  40369. $core.addMethod(
  40370. $core.method({
  40371. selector: "scope",
  40372. protocol: "accessing",
  40373. fn: function (){
  40374. var self=this,$self=this;
  40375. return $core.withContext(function($ctx1) {
  40376. var $1,$receiver;
  40377. $1=$self["@scope"];
  40378. if(($receiver = $1) == null || $receiver.a$nil){
  40379. return $recv($self._parent())._scope();
  40380. } else {
  40381. return $1;
  40382. }
  40383. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40384. },
  40385. args: [],
  40386. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40387. referencedClasses: [],
  40388. messageSends: ["ifNil:", "scope", "parent"]
  40389. }),
  40390. $globals.IRReturn);
  40391. $core.addMethod(
  40392. $core.method({
  40393. selector: "yieldsValue",
  40394. protocol: "testing",
  40395. fn: function (){
  40396. var self=this,$self=this;
  40397. return false;
  40398. },
  40399. args: [],
  40400. source: "yieldsValue\x0a\x09^ false",
  40401. referencedClasses: [],
  40402. messageSends: []
  40403. }),
  40404. $globals.IRReturn);
  40405. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40406. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40407. $core.addMethod(
  40408. $core.method({
  40409. selector: "acceptDagVisitor:",
  40410. protocol: "visiting",
  40411. fn: function (aVisitor){
  40412. var self=this,$self=this;
  40413. return $core.withContext(function($ctx1) {
  40414. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40415. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40416. },
  40417. args: ["aVisitor"],
  40418. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40419. referencedClasses: [],
  40420. messageSends: ["visitIRBlockReturn:"]
  40421. }),
  40422. $globals.IRBlockReturn);
  40423. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40424. $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.";
  40425. $core.addMethod(
  40426. $core.method({
  40427. selector: "acceptDagVisitor:",
  40428. protocol: "visiting",
  40429. fn: function (aVisitor){
  40430. var self=this,$self=this;
  40431. return $core.withContext(function($ctx1) {
  40432. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40433. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40434. },
  40435. args: ["aVisitor"],
  40436. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40437. referencedClasses: [],
  40438. messageSends: ["visitIRNonLocalReturn:"]
  40439. }),
  40440. $globals.IRNonLocalReturn);
  40441. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40442. $core.addMethod(
  40443. $core.method({
  40444. selector: "acceptDagVisitor:",
  40445. protocol: "visiting",
  40446. fn: function (aVisitor){
  40447. var self=this,$self=this;
  40448. return $core.withContext(function($ctx1) {
  40449. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40450. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40451. },
  40452. args: ["aVisitor"],
  40453. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40454. referencedClasses: [],
  40455. messageSends: ["visitIRTempDeclaration:"]
  40456. }),
  40457. $globals.IRTempDeclaration);
  40458. $core.addMethod(
  40459. $core.method({
  40460. selector: "isTempDeclaration",
  40461. protocol: "testing",
  40462. fn: function (){
  40463. var self=this,$self=this;
  40464. return true;
  40465. },
  40466. args: [],
  40467. source: "isTempDeclaration\x0a\x09^ true",
  40468. referencedClasses: [],
  40469. messageSends: []
  40470. }),
  40471. $globals.IRTempDeclaration);
  40472. $core.addMethod(
  40473. $core.method({
  40474. selector: "name",
  40475. protocol: "accessing",
  40476. fn: function (){
  40477. var self=this,$self=this;
  40478. return $self["@name"];
  40479. },
  40480. args: [],
  40481. source: "name\x0a\x09^ name",
  40482. referencedClasses: [],
  40483. messageSends: []
  40484. }),
  40485. $globals.IRTempDeclaration);
  40486. $core.addMethod(
  40487. $core.method({
  40488. selector: "name:",
  40489. protocol: "accessing",
  40490. fn: function (aString){
  40491. var self=this,$self=this;
  40492. $self["@name"]=aString;
  40493. return self;
  40494. },
  40495. args: ["aString"],
  40496. source: "name: aString\x0a\x09name := aString",
  40497. referencedClasses: [],
  40498. messageSends: []
  40499. }),
  40500. $globals.IRTempDeclaration);
  40501. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40502. $globals.IRSend.comment="I am a message send instruction.";
  40503. $core.addMethod(
  40504. $core.method({
  40505. selector: "acceptDagVisitor:",
  40506. protocol: "visiting",
  40507. fn: function (aVisitor){
  40508. var self=this,$self=this;
  40509. return $core.withContext(function($ctx1) {
  40510. return $recv(aVisitor)._visitIRSend_(self);
  40511. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40512. },
  40513. args: ["aVisitor"],
  40514. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40515. referencedClasses: [],
  40516. messageSends: ["visitIRSend:"]
  40517. }),
  40518. $globals.IRSend);
  40519. $core.addMethod(
  40520. $core.method({
  40521. selector: "arguments",
  40522. protocol: "accessing",
  40523. fn: function (){
  40524. var self=this,$self=this;
  40525. return $core.withContext(function($ctx1) {
  40526. return $recv($self._dagChildren())._allButFirst();
  40527. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40528. },
  40529. args: [],
  40530. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40531. referencedClasses: [],
  40532. messageSends: ["allButFirst", "dagChildren"]
  40533. }),
  40534. $globals.IRSend);
  40535. $core.addMethod(
  40536. $core.method({
  40537. selector: "index",
  40538. protocol: "accessing",
  40539. fn: function (){
  40540. var self=this,$self=this;
  40541. return $self["@index"];
  40542. },
  40543. args: [],
  40544. source: "index\x0a\x09^ index",
  40545. referencedClasses: [],
  40546. messageSends: []
  40547. }),
  40548. $globals.IRSend);
  40549. $core.addMethod(
  40550. $core.method({
  40551. selector: "index:",
  40552. protocol: "accessing",
  40553. fn: function (anInteger){
  40554. var self=this,$self=this;
  40555. $self["@index"]=anInteger;
  40556. return self;
  40557. },
  40558. args: ["anInteger"],
  40559. source: "index: anInteger\x0a\x09index := anInteger",
  40560. referencedClasses: [],
  40561. messageSends: []
  40562. }),
  40563. $globals.IRSend);
  40564. $core.addMethod(
  40565. $core.method({
  40566. selector: "isSend",
  40567. protocol: "testing",
  40568. fn: function (){
  40569. var self=this,$self=this;
  40570. return true;
  40571. },
  40572. args: [],
  40573. source: "isSend\x0a\x09^ true",
  40574. referencedClasses: [],
  40575. messageSends: []
  40576. }),
  40577. $globals.IRSend);
  40578. $core.addMethod(
  40579. $core.method({
  40580. selector: "receiver",
  40581. protocol: "accessing",
  40582. fn: function (){
  40583. var self=this,$self=this;
  40584. return $core.withContext(function($ctx1) {
  40585. return $recv($self._dagChildren())._first();
  40586. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40587. },
  40588. args: [],
  40589. source: "receiver\x0a\x09^ self dagChildren first",
  40590. referencedClasses: [],
  40591. messageSends: ["first", "dagChildren"]
  40592. }),
  40593. $globals.IRSend);
  40594. $core.addMethod(
  40595. $core.method({
  40596. selector: "selector",
  40597. protocol: "accessing",
  40598. fn: function (){
  40599. var self=this,$self=this;
  40600. return $self["@selector"];
  40601. },
  40602. args: [],
  40603. source: "selector\x0a\x09^ selector",
  40604. referencedClasses: [],
  40605. messageSends: []
  40606. }),
  40607. $globals.IRSend);
  40608. $core.addMethod(
  40609. $core.method({
  40610. selector: "selector:",
  40611. protocol: "accessing",
  40612. fn: function (aString){
  40613. var self=this,$self=this;
  40614. $self["@selector"]=aString;
  40615. return self;
  40616. },
  40617. args: ["aString"],
  40618. source: "selector: aString\x0a\x09selector := aString",
  40619. referencedClasses: [],
  40620. messageSends: []
  40621. }),
  40622. $globals.IRSend);
  40623. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40624. $core.addMethod(
  40625. $core.method({
  40626. selector: "acceptDagVisitor:",
  40627. protocol: "visiting",
  40628. fn: function (aVisitor){
  40629. var self=this,$self=this;
  40630. return $core.withContext(function($ctx1) {
  40631. return $recv(aVisitor)._visitIRSequence_(self);
  40632. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40633. },
  40634. args: ["aVisitor"],
  40635. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40636. referencedClasses: [],
  40637. messageSends: ["visitIRSequence:"]
  40638. }),
  40639. $globals.IRSequence);
  40640. $core.addMethod(
  40641. $core.method({
  40642. selector: "isSequence",
  40643. protocol: "testing",
  40644. fn: function (){
  40645. var self=this,$self=this;
  40646. return true;
  40647. },
  40648. args: [],
  40649. source: "isSequence\x0a\x09^ true",
  40650. referencedClasses: [],
  40651. messageSends: []
  40652. }),
  40653. $globals.IRSequence);
  40654. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40655. $core.addMethod(
  40656. $core.method({
  40657. selector: "acceptDagVisitor:",
  40658. protocol: "visiting",
  40659. fn: function (aVisitor){
  40660. var self=this,$self=this;
  40661. return $core.withContext(function($ctx1) {
  40662. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40663. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40664. },
  40665. args: ["aVisitor"],
  40666. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40667. referencedClasses: [],
  40668. messageSends: ["visitIRBlockSequence:"]
  40669. }),
  40670. $globals.IRBlockSequence);
  40671. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40672. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40673. $core.addMethod(
  40674. $core.method({
  40675. selector: "acceptDagVisitor:",
  40676. protocol: "visiting",
  40677. fn: function (aVisitor){
  40678. var self=this,$self=this;
  40679. return $core.withContext(function($ctx1) {
  40680. return $recv(aVisitor)._visitIRValue_(self);
  40681. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40682. },
  40683. args: ["aVisitor"],
  40684. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40685. referencedClasses: [],
  40686. messageSends: ["visitIRValue:"]
  40687. }),
  40688. $globals.IRValue);
  40689. $core.addMethod(
  40690. $core.method({
  40691. selector: "needsBoxingAsReceiver",
  40692. protocol: "testing",
  40693. fn: function (){
  40694. var self=this,$self=this;
  40695. return false;
  40696. },
  40697. args: [],
  40698. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40699. referencedClasses: [],
  40700. messageSends: []
  40701. }),
  40702. $globals.IRValue);
  40703. $core.addMethod(
  40704. $core.method({
  40705. selector: "value",
  40706. protocol: "accessing",
  40707. fn: function (){
  40708. var self=this,$self=this;
  40709. return $self["@value"];
  40710. },
  40711. args: [],
  40712. source: "value\x0a\x09^ value",
  40713. referencedClasses: [],
  40714. messageSends: []
  40715. }),
  40716. $globals.IRValue);
  40717. $core.addMethod(
  40718. $core.method({
  40719. selector: "value:",
  40720. protocol: "accessing",
  40721. fn: function (aString){
  40722. var self=this,$self=this;
  40723. $self["@value"]=aString;
  40724. return self;
  40725. },
  40726. args: ["aString"],
  40727. source: "value: aString\x0a\x09value := aString",
  40728. referencedClasses: [],
  40729. messageSends: []
  40730. }),
  40731. $globals.IRValue);
  40732. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40733. $globals.IRVariable.comment="I am a variable instruction.";
  40734. $core.addMethod(
  40735. $core.method({
  40736. selector: "acceptDagVisitor:",
  40737. protocol: "visiting",
  40738. fn: function (aVisitor){
  40739. var self=this,$self=this;
  40740. return $core.withContext(function($ctx1) {
  40741. return $recv(aVisitor)._visitIRVariable_(self);
  40742. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40743. },
  40744. args: ["aVisitor"],
  40745. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40746. referencedClasses: [],
  40747. messageSends: ["visitIRVariable:"]
  40748. }),
  40749. $globals.IRVariable);
  40750. $core.addMethod(
  40751. $core.method({
  40752. selector: "isSelf",
  40753. protocol: "testing",
  40754. fn: function (){
  40755. var self=this,$self=this;
  40756. return $core.withContext(function($ctx1) {
  40757. return $recv($self._variable())._isSelf();
  40758. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40759. },
  40760. args: [],
  40761. source: "isSelf\x0a\x09^ self variable isSelf",
  40762. referencedClasses: [],
  40763. messageSends: ["isSelf", "variable"]
  40764. }),
  40765. $globals.IRVariable);
  40766. $core.addMethod(
  40767. $core.method({
  40768. selector: "isSuper",
  40769. protocol: "testing",
  40770. fn: function (){
  40771. var self=this,$self=this;
  40772. return $core.withContext(function($ctx1) {
  40773. return $recv($self._variable())._isSuper();
  40774. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40775. },
  40776. args: [],
  40777. source: "isSuper\x0a\x09^ self variable isSuper",
  40778. referencedClasses: [],
  40779. messageSends: ["isSuper", "variable"]
  40780. }),
  40781. $globals.IRVariable);
  40782. $core.addMethod(
  40783. $core.method({
  40784. selector: "isVariable",
  40785. protocol: "testing",
  40786. fn: function (){
  40787. var self=this,$self=this;
  40788. return true;
  40789. },
  40790. args: [],
  40791. source: "isVariable\x0a\x09^ true",
  40792. referencedClasses: [],
  40793. messageSends: []
  40794. }),
  40795. $globals.IRVariable);
  40796. $core.addMethod(
  40797. $core.method({
  40798. selector: "needsBoxingAsReceiver",
  40799. protocol: "testing",
  40800. fn: function (){
  40801. var self=this,$self=this;
  40802. return $core.withContext(function($ctx1) {
  40803. return $recv($recv($self._variable())._isPseudoVar())._not();
  40804. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40805. },
  40806. args: [],
  40807. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40808. referencedClasses: [],
  40809. messageSends: ["not", "isPseudoVar", "variable"]
  40810. }),
  40811. $globals.IRVariable);
  40812. $core.addMethod(
  40813. $core.method({
  40814. selector: "variable",
  40815. protocol: "accessing",
  40816. fn: function (){
  40817. var self=this,$self=this;
  40818. return $self["@variable"];
  40819. },
  40820. args: [],
  40821. source: "variable\x0a\x09^ variable",
  40822. referencedClasses: [],
  40823. messageSends: []
  40824. }),
  40825. $globals.IRVariable);
  40826. $core.addMethod(
  40827. $core.method({
  40828. selector: "variable:",
  40829. protocol: "accessing",
  40830. fn: function (aScopeVariable){
  40831. var self=this,$self=this;
  40832. $self["@variable"]=aScopeVariable;
  40833. return self;
  40834. },
  40835. args: ["aScopeVariable"],
  40836. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40837. referencedClasses: [],
  40838. messageSends: []
  40839. }),
  40840. $globals.IRVariable);
  40841. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40842. $core.addMethod(
  40843. $core.method({
  40844. selector: "acceptDagVisitor:",
  40845. protocol: "visiting",
  40846. fn: function (aVisitor){
  40847. var self=this,$self=this;
  40848. return $core.withContext(function($ctx1) {
  40849. return $recv(aVisitor)._visitIRVerbatim_(self);
  40850. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40851. },
  40852. args: ["aVisitor"],
  40853. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40854. referencedClasses: [],
  40855. messageSends: ["visitIRVerbatim:"]
  40856. }),
  40857. $globals.IRVerbatim);
  40858. $core.addMethod(
  40859. $core.method({
  40860. selector: "source",
  40861. protocol: "accessing",
  40862. fn: function (){
  40863. var self=this,$self=this;
  40864. return $self["@source"];
  40865. },
  40866. args: [],
  40867. source: "source\x0a\x09^ source",
  40868. referencedClasses: [],
  40869. messageSends: []
  40870. }),
  40871. $globals.IRVerbatim);
  40872. $core.addMethod(
  40873. $core.method({
  40874. selector: "source:",
  40875. protocol: "accessing",
  40876. fn: function (aString){
  40877. var self=this,$self=this;
  40878. $self["@source"]=aString;
  40879. return self;
  40880. },
  40881. args: ["aString"],
  40882. source: "source: aString\x0a\x09source := aString",
  40883. referencedClasses: [],
  40884. messageSends: []
  40885. }),
  40886. $globals.IRVerbatim);
  40887. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40888. $core.addMethod(
  40889. $core.method({
  40890. selector: "visitDagNode:",
  40891. protocol: "visiting",
  40892. fn: function (aNode){
  40893. var self=this,$self=this;
  40894. return $core.withContext(function($ctx1) {
  40895. return $self._visitDagNodeVariantSimple_(aNode);
  40896. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40897. },
  40898. args: ["aNode"],
  40899. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40900. referencedClasses: [],
  40901. messageSends: ["visitDagNodeVariantSimple:"]
  40902. }),
  40903. $globals.IRVisitor);
  40904. $core.addMethod(
  40905. $core.method({
  40906. selector: "visitIRAssignment:",
  40907. protocol: "visiting",
  40908. fn: function (anIRAssignment){
  40909. var self=this,$self=this;
  40910. return $core.withContext(function($ctx1) {
  40911. return $self._visitDagNode_(anIRAssignment);
  40912. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40913. },
  40914. args: ["anIRAssignment"],
  40915. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40916. referencedClasses: [],
  40917. messageSends: ["visitDagNode:"]
  40918. }),
  40919. $globals.IRVisitor);
  40920. $core.addMethod(
  40921. $core.method({
  40922. selector: "visitIRBlockReturn:",
  40923. protocol: "visiting",
  40924. fn: function (anIRBlockReturn){
  40925. var self=this,$self=this;
  40926. return $core.withContext(function($ctx1) {
  40927. return $self._visitIRReturn_(anIRBlockReturn);
  40928. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40929. },
  40930. args: ["anIRBlockReturn"],
  40931. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40932. referencedClasses: [],
  40933. messageSends: ["visitIRReturn:"]
  40934. }),
  40935. $globals.IRVisitor);
  40936. $core.addMethod(
  40937. $core.method({
  40938. selector: "visitIRBlockSequence:",
  40939. protocol: "visiting",
  40940. fn: function (anIRBlockSequence){
  40941. var self=this,$self=this;
  40942. return $core.withContext(function($ctx1) {
  40943. return $self._visitIRSequence_(anIRBlockSequence);
  40944. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40945. },
  40946. args: ["anIRBlockSequence"],
  40947. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40948. referencedClasses: [],
  40949. messageSends: ["visitIRSequence:"]
  40950. }),
  40951. $globals.IRVisitor);
  40952. $core.addMethod(
  40953. $core.method({
  40954. selector: "visitIRClosure:",
  40955. protocol: "visiting",
  40956. fn: function (anIRClosure){
  40957. var self=this,$self=this;
  40958. return $core.withContext(function($ctx1) {
  40959. return $self._visitDagNode_(anIRClosure);
  40960. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40961. },
  40962. args: ["anIRClosure"],
  40963. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40964. referencedClasses: [],
  40965. messageSends: ["visitDagNode:"]
  40966. }),
  40967. $globals.IRVisitor);
  40968. $core.addMethod(
  40969. $core.method({
  40970. selector: "visitIRDynamicArray:",
  40971. protocol: "visiting",
  40972. fn: function (anIRDynamicArray){
  40973. var self=this,$self=this;
  40974. return $core.withContext(function($ctx1) {
  40975. return $self._visitDagNode_(anIRDynamicArray);
  40976. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40977. },
  40978. args: ["anIRDynamicArray"],
  40979. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40980. referencedClasses: [],
  40981. messageSends: ["visitDagNode:"]
  40982. }),
  40983. $globals.IRVisitor);
  40984. $core.addMethod(
  40985. $core.method({
  40986. selector: "visitIRDynamicDictionary:",
  40987. protocol: "visiting",
  40988. fn: function (anIRDynamicDictionary){
  40989. var self=this,$self=this;
  40990. return $core.withContext(function($ctx1) {
  40991. return $self._visitDagNode_(anIRDynamicDictionary);
  40992. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40993. },
  40994. args: ["anIRDynamicDictionary"],
  40995. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40996. referencedClasses: [],
  40997. messageSends: ["visitDagNode:"]
  40998. }),
  40999. $globals.IRVisitor);
  41000. $core.addMethod(
  41001. $core.method({
  41002. selector: "visitIRInlinedClosure:",
  41003. protocol: "visiting",
  41004. fn: function (anIRInlinedClosure){
  41005. var self=this,$self=this;
  41006. return $core.withContext(function($ctx1) {
  41007. return $self._visitIRClosure_(anIRInlinedClosure);
  41008. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41009. },
  41010. args: ["anIRInlinedClosure"],
  41011. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41012. referencedClasses: [],
  41013. messageSends: ["visitIRClosure:"]
  41014. }),
  41015. $globals.IRVisitor);
  41016. $core.addMethod(
  41017. $core.method({
  41018. selector: "visitIRInlinedSequence:",
  41019. protocol: "visiting",
  41020. fn: function (anIRInlinedSequence){
  41021. var self=this,$self=this;
  41022. return $core.withContext(function($ctx1) {
  41023. return $self._visitIRSequence_(anIRInlinedSequence);
  41024. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41025. },
  41026. args: ["anIRInlinedSequence"],
  41027. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41028. referencedClasses: [],
  41029. messageSends: ["visitIRSequence:"]
  41030. }),
  41031. $globals.IRVisitor);
  41032. $core.addMethod(
  41033. $core.method({
  41034. selector: "visitIRMethod:",
  41035. protocol: "visiting",
  41036. fn: function (anIRMethod){
  41037. var self=this,$self=this;
  41038. return $core.withContext(function($ctx1) {
  41039. return $self._visitDagNode_(anIRMethod);
  41040. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41041. },
  41042. args: ["anIRMethod"],
  41043. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41044. referencedClasses: [],
  41045. messageSends: ["visitDagNode:"]
  41046. }),
  41047. $globals.IRVisitor);
  41048. $core.addMethod(
  41049. $core.method({
  41050. selector: "visitIRNonLocalReturn:",
  41051. protocol: "visiting",
  41052. fn: function (anIRNonLocalReturn){
  41053. var self=this,$self=this;
  41054. return $core.withContext(function($ctx1) {
  41055. return $self._visitDagNode_(anIRNonLocalReturn);
  41056. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41057. },
  41058. args: ["anIRNonLocalReturn"],
  41059. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41060. referencedClasses: [],
  41061. messageSends: ["visitDagNode:"]
  41062. }),
  41063. $globals.IRVisitor);
  41064. $core.addMethod(
  41065. $core.method({
  41066. selector: "visitIRNonLocalReturnHandling:",
  41067. protocol: "visiting",
  41068. fn: function (anIRNonLocalReturnHandling){
  41069. var self=this,$self=this;
  41070. return $core.withContext(function($ctx1) {
  41071. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41072. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41073. },
  41074. args: ["anIRNonLocalReturnHandling"],
  41075. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41076. referencedClasses: [],
  41077. messageSends: ["visitDagNode:"]
  41078. }),
  41079. $globals.IRVisitor);
  41080. $core.addMethod(
  41081. $core.method({
  41082. selector: "visitIRReturn:",
  41083. protocol: "visiting",
  41084. fn: function (anIRReturn){
  41085. var self=this,$self=this;
  41086. return $core.withContext(function($ctx1) {
  41087. return $self._visitDagNode_(anIRReturn);
  41088. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41089. },
  41090. args: ["anIRReturn"],
  41091. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41092. referencedClasses: [],
  41093. messageSends: ["visitDagNode:"]
  41094. }),
  41095. $globals.IRVisitor);
  41096. $core.addMethod(
  41097. $core.method({
  41098. selector: "visitIRSend:",
  41099. protocol: "visiting",
  41100. fn: function (anIRSend){
  41101. var self=this,$self=this;
  41102. return $core.withContext(function($ctx1) {
  41103. return $self._visitDagNode_(anIRSend);
  41104. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41105. },
  41106. args: ["anIRSend"],
  41107. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41108. referencedClasses: [],
  41109. messageSends: ["visitDagNode:"]
  41110. }),
  41111. $globals.IRVisitor);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "visitIRSequence:",
  41115. protocol: "visiting",
  41116. fn: function (anIRSequence){
  41117. var self=this,$self=this;
  41118. return $core.withContext(function($ctx1) {
  41119. return $self._visitDagNode_(anIRSequence);
  41120. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41121. },
  41122. args: ["anIRSequence"],
  41123. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41124. referencedClasses: [],
  41125. messageSends: ["visitDagNode:"]
  41126. }),
  41127. $globals.IRVisitor);
  41128. $core.addMethod(
  41129. $core.method({
  41130. selector: "visitIRTempDeclaration:",
  41131. protocol: "visiting",
  41132. fn: function (anIRTempDeclaration){
  41133. var self=this,$self=this;
  41134. return $core.withContext(function($ctx1) {
  41135. return $self._visitDagNode_(anIRTempDeclaration);
  41136. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41137. },
  41138. args: ["anIRTempDeclaration"],
  41139. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41140. referencedClasses: [],
  41141. messageSends: ["visitDagNode:"]
  41142. }),
  41143. $globals.IRVisitor);
  41144. $core.addMethod(
  41145. $core.method({
  41146. selector: "visitIRValue:",
  41147. protocol: "visiting",
  41148. fn: function (anIRValue){
  41149. var self=this,$self=this;
  41150. return $core.withContext(function($ctx1) {
  41151. return $self._visitDagNode_(anIRValue);
  41152. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41153. },
  41154. args: ["anIRValue"],
  41155. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41156. referencedClasses: [],
  41157. messageSends: ["visitDagNode:"]
  41158. }),
  41159. $globals.IRVisitor);
  41160. $core.addMethod(
  41161. $core.method({
  41162. selector: "visitIRVariable:",
  41163. protocol: "visiting",
  41164. fn: function (anIRVariable){
  41165. var self=this,$self=this;
  41166. return $core.withContext(function($ctx1) {
  41167. return $self._visitDagNode_(anIRVariable);
  41168. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41169. },
  41170. args: ["anIRVariable"],
  41171. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41172. referencedClasses: [],
  41173. messageSends: ["visitDagNode:"]
  41174. }),
  41175. $globals.IRVisitor);
  41176. $core.addMethod(
  41177. $core.method({
  41178. selector: "visitIRVerbatim:",
  41179. protocol: "visiting",
  41180. fn: function (anIRVerbatim){
  41181. var self=this,$self=this;
  41182. return $core.withContext(function($ctx1) {
  41183. return $self._visitDagNode_(anIRVerbatim);
  41184. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41185. },
  41186. args: ["anIRVerbatim"],
  41187. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41188. referencedClasses: [],
  41189. messageSends: ["visitDagNode:"]
  41190. }),
  41191. $globals.IRVisitor);
  41192. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41193. $core.addMethod(
  41194. $core.method({
  41195. selector: "contents",
  41196. protocol: "accessing",
  41197. fn: function (){
  41198. var self=this,$self=this;
  41199. return $core.withContext(function($ctx1) {
  41200. return $recv($self._stream())._contents();
  41201. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41202. },
  41203. args: [],
  41204. source: "contents\x0a\x09^ self stream contents",
  41205. referencedClasses: [],
  41206. messageSends: ["contents", "stream"]
  41207. }),
  41208. $globals.IRJSTranslator);
  41209. $core.addMethod(
  41210. $core.method({
  41211. selector: "currentClass",
  41212. protocol: "accessing",
  41213. fn: function (){
  41214. var self=this,$self=this;
  41215. return $self["@currentClass"];
  41216. },
  41217. args: [],
  41218. source: "currentClass\x0a\x09^ currentClass",
  41219. referencedClasses: [],
  41220. messageSends: []
  41221. }),
  41222. $globals.IRJSTranslator);
  41223. $core.addMethod(
  41224. $core.method({
  41225. selector: "currentClass:",
  41226. protocol: "accessing",
  41227. fn: function (aClass){
  41228. var self=this,$self=this;
  41229. $self["@currentClass"]=aClass;
  41230. return self;
  41231. },
  41232. args: ["aClass"],
  41233. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41234. referencedClasses: [],
  41235. messageSends: []
  41236. }),
  41237. $globals.IRJSTranslator);
  41238. $core.addMethod(
  41239. $core.method({
  41240. selector: "initialize",
  41241. protocol: "initialization",
  41242. fn: function (){
  41243. var self=this,$self=this;
  41244. return $core.withContext(function($ctx1) {
  41245. (
  41246. $ctx1.supercall = true,
  41247. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41248. $ctx1.supercall = false;
  41249. $self["@stream"]=$recv($globals.JSStream)._new();
  41250. return self;
  41251. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41252. },
  41253. args: [],
  41254. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41255. referencedClasses: ["JSStream"],
  41256. messageSends: ["initialize", "new"]
  41257. }),
  41258. $globals.IRJSTranslator);
  41259. $core.addMethod(
  41260. $core.method({
  41261. selector: "stream",
  41262. protocol: "accessing",
  41263. fn: function (){
  41264. var self=this,$self=this;
  41265. return $self["@stream"];
  41266. },
  41267. args: [],
  41268. source: "stream\x0a\x09^ stream",
  41269. referencedClasses: [],
  41270. messageSends: []
  41271. }),
  41272. $globals.IRJSTranslator);
  41273. $core.addMethod(
  41274. $core.method({
  41275. selector: "stream:",
  41276. protocol: "accessing",
  41277. fn: function (aStream){
  41278. var self=this,$self=this;
  41279. $self["@stream"]=aStream;
  41280. return self;
  41281. },
  41282. args: ["aStream"],
  41283. source: "stream: aStream\x0a\x09stream := aStream",
  41284. referencedClasses: [],
  41285. messageSends: []
  41286. }),
  41287. $globals.IRJSTranslator);
  41288. $core.addMethod(
  41289. $core.method({
  41290. selector: "visitIRAssignment:",
  41291. protocol: "visiting",
  41292. fn: function (anIRAssignment){
  41293. var self=this,$self=this;
  41294. return $core.withContext(function($ctx1) {
  41295. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41296. return $core.withContext(function($ctx2) {
  41297. return $self._visit_($recv(anIRAssignment)._left());
  41298. $ctx2.sendIdx["visit:"]=1;
  41299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41300. }),(function(){
  41301. return $core.withContext(function($ctx2) {
  41302. return $self._visit_($recv(anIRAssignment)._right());
  41303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41304. }));
  41305. return self;
  41306. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41307. },
  41308. args: ["anIRAssignment"],
  41309. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41310. referencedClasses: [],
  41311. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41312. }),
  41313. $globals.IRJSTranslator);
  41314. $core.addMethod(
  41315. $core.method({
  41316. selector: "visitIRClosure:",
  41317. protocol: "visiting",
  41318. fn: function (anIRClosure){
  41319. var self=this,$self=this;
  41320. return $core.withContext(function($ctx1) {
  41321. var $1,$2;
  41322. $1=$self._stream();
  41323. $ctx1.sendIdx["stream"]=1;
  41324. $recv($1)._nextPutClosureWith_arguments_((function(){
  41325. return $core.withContext(function($ctx2) {
  41326. $2=$self._stream();
  41327. $ctx2.sendIdx["stream"]=2;
  41328. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41329. return $core.withContext(function($ctx3) {
  41330. return $recv($recv(each)._name())._asVariableName();
  41331. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41332. })));
  41333. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41334. return $core.withContext(function($ctx3) {
  41335. return (
  41336. $ctx3.supercall = true,
  41337. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41338. $ctx3.supercall = false;
  41339. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41340. }));
  41341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41342. }),$recv(anIRClosure)._arguments());
  41343. return self;
  41344. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41345. },
  41346. args: ["anIRClosure"],
  41347. 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",
  41348. referencedClasses: [],
  41349. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41350. }),
  41351. $globals.IRJSTranslator);
  41352. $core.addMethod(
  41353. $core.method({
  41354. selector: "visitIRDynamicArray:",
  41355. protocol: "visiting",
  41356. fn: function (anIRDynamicArray){
  41357. var self=this,$self=this;
  41358. return $core.withContext(function($ctx1) {
  41359. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41360. return self;
  41361. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41362. },
  41363. args: ["anIRDynamicArray"],
  41364. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41365. referencedClasses: [],
  41366. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41367. }),
  41368. $globals.IRJSTranslator);
  41369. $core.addMethod(
  41370. $core.method({
  41371. selector: "visitIRDynamicDictionary:",
  41372. protocol: "visiting",
  41373. fn: function (anIRDynamicDictionary){
  41374. var self=this,$self=this;
  41375. return $core.withContext(function($ctx1) {
  41376. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41377. return self;
  41378. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41379. },
  41380. args: ["anIRDynamicDictionary"],
  41381. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41382. referencedClasses: [],
  41383. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41384. }),
  41385. $globals.IRJSTranslator);
  41386. $core.addMethod(
  41387. $core.method({
  41388. selector: "visitIRMethod:",
  41389. protocol: "visiting",
  41390. fn: function (anIRMethod){
  41391. var self=this,$self=this;
  41392. return $core.withContext(function($ctx1) {
  41393. var $1,$2,$3,$4,$5,$6,$7;
  41394. $1=$self._stream();
  41395. $ctx1.sendIdx["stream"]=1;
  41396. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41397. return $core.withContext(function($ctx2) {
  41398. $2=$self._stream();
  41399. $ctx2.sendIdx["stream"]=2;
  41400. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41401. return $core.withContext(function($ctx3) {
  41402. $3=$self._stream();
  41403. $ctx3.sendIdx["stream"]=3;
  41404. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41405. return $core.withContext(function($ctx4) {
  41406. return $recv($recv(each)._name())._asVariableName();
  41407. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41408. }));
  41409. $ctx3.sendIdx["collect:"]=1;
  41410. $recv($3)._nextPutVars_($4);
  41411. $ctx3.sendIdx["nextPutVars:"]=1;
  41412. $5=$self._stream();
  41413. $ctx3.sendIdx["stream"]=4;
  41414. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41415. return $core.withContext(function($ctx4) {
  41416. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41417. return $core.withContext(function($ctx5) {
  41418. $6=$self._stream();
  41419. $ctx5.sendIdx["stream"]=5;
  41420. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41421. return $core.withContext(function($ctx6) {
  41422. return $recv($recv(each)._variable())._alias();
  41423. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41424. })));
  41425. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41426. }));
  41427. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41428. if($core.assert($7)){
  41429. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41430. return $core.withContext(function($ctx5) {
  41431. return (
  41432. $ctx5.supercall = true,
  41433. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41434. $ctx5.supercall = false;
  41435. $ctx5.sendIdx["visitIRMethod:"]=1;
  41436. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41437. }));
  41438. } else {
  41439. return (
  41440. $ctx4.supercall = true,
  41441. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41442. $ctx4.supercall = false;
  41443. }
  41444. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41445. }));
  41446. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41447. }),$recv(anIRMethod)._arguments());
  41448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41449. }));
  41450. return $self._contents();
  41451. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41452. },
  41453. args: ["anIRMethod"],
  41454. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ].\x0a\x09^ self contents",
  41455. referencedClasses: [],
  41456. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "contents"]
  41457. }),
  41458. $globals.IRJSTranslator);
  41459. $core.addMethod(
  41460. $core.method({
  41461. selector: "visitIRNonLocalReturn:",
  41462. protocol: "visiting",
  41463. fn: function (anIRNonLocalReturn){
  41464. var self=this,$self=this;
  41465. return $core.withContext(function($ctx1) {
  41466. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41467. return $core.withContext(function($ctx2) {
  41468. return (
  41469. $ctx2.supercall = true,
  41470. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41471. $ctx2.supercall = false;
  41472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41473. }));
  41474. return self;
  41475. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41476. },
  41477. args: ["anIRNonLocalReturn"],
  41478. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41479. referencedClasses: [],
  41480. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41481. }),
  41482. $globals.IRJSTranslator);
  41483. $core.addMethod(
  41484. $core.method({
  41485. selector: "visitIRReturn:",
  41486. protocol: "visiting",
  41487. fn: function (anIRReturn){
  41488. var self=this,$self=this;
  41489. return $core.withContext(function($ctx1) {
  41490. $recv($self._stream())._nextPutReturnWith_((function(){
  41491. return $core.withContext(function($ctx2) {
  41492. return (
  41493. $ctx2.supercall = true,
  41494. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41495. $ctx2.supercall = false;
  41496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41497. }));
  41498. return self;
  41499. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41500. },
  41501. args: ["anIRReturn"],
  41502. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41503. referencedClasses: [],
  41504. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41505. }),
  41506. $globals.IRJSTranslator);
  41507. $core.addMethod(
  41508. $core.method({
  41509. selector: "visitIRSend:",
  41510. protocol: "visiting",
  41511. fn: function (anIRSend){
  41512. var self=this,$self=this;
  41513. var sends,superclass;
  41514. return $core.withContext(function($ctx1) {
  41515. var $1,$2;
  41516. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41517. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41518. if($core.assert($1)){
  41519. $self._visitSuperSend_(anIRSend);
  41520. } else {
  41521. $self._visitSend_(anIRSend);
  41522. }
  41523. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41524. if($core.assert($2)){
  41525. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41526. }
  41527. return self;
  41528. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41529. },
  41530. args: ["anIRSend"],
  41531. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend receiver isSuper\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09anIRSend index < sends\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  41532. referencedClasses: [],
  41533. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41534. }),
  41535. $globals.IRJSTranslator);
  41536. $core.addMethod(
  41537. $core.method({
  41538. selector: "visitIRSequence:",
  41539. protocol: "visiting",
  41540. fn: function (anIRSequence){
  41541. var self=this,$self=this;
  41542. return $core.withContext(function($ctx1) {
  41543. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41544. return $core.withContext(function($ctx2) {
  41545. return $recv($self._stream())._nextPutStatementWith_((function(){
  41546. return $core.withContext(function($ctx3) {
  41547. return $self._visit_(each);
  41548. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41549. }));
  41550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41551. }));
  41552. return self;
  41553. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41554. },
  41555. args: ["anIRSequence"],
  41556. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41557. referencedClasses: [],
  41558. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41559. }),
  41560. $globals.IRJSTranslator);
  41561. $core.addMethod(
  41562. $core.method({
  41563. selector: "visitIRTempDeclaration:",
  41564. protocol: "visiting",
  41565. fn: function (anIRTempDeclaration){
  41566. var self=this,$self=this;
  41567. return self;
  41568. },
  41569. args: ["anIRTempDeclaration"],
  41570. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41571. referencedClasses: [],
  41572. messageSends: []
  41573. }),
  41574. $globals.IRJSTranslator);
  41575. $core.addMethod(
  41576. $core.method({
  41577. selector: "visitIRValue:",
  41578. protocol: "visiting",
  41579. fn: function (anIRValue){
  41580. var self=this,$self=this;
  41581. return $core.withContext(function($ctx1) {
  41582. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41583. return self;
  41584. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41585. },
  41586. args: ["anIRValue"],
  41587. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41588. referencedClasses: [],
  41589. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41590. }),
  41591. $globals.IRJSTranslator);
  41592. $core.addMethod(
  41593. $core.method({
  41594. selector: "visitIRVariable:",
  41595. protocol: "visiting",
  41596. fn: function (anIRVariable){
  41597. var self=this,$self=this;
  41598. return $core.withContext(function($ctx1) {
  41599. var $3,$2,$1,$4;
  41600. $3=$recv(anIRVariable)._variable();
  41601. $ctx1.sendIdx["variable"]=1;
  41602. $2=$recv($3)._name();
  41603. $1=$recv($2).__eq("thisContext");
  41604. if($core.assert($1)){
  41605. $4=$self._stream();
  41606. $ctx1.sendIdx["stream"]=1;
  41607. $recv($4)._nextPutAll_("$core.getThisContext()");
  41608. $ctx1.sendIdx["nextPutAll:"]=1;
  41609. } else {
  41610. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41611. }
  41612. return self;
  41613. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41614. },
  41615. args: ["anIRVariable"],
  41616. 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 ]",
  41617. referencedClasses: [],
  41618. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41619. }),
  41620. $globals.IRJSTranslator);
  41621. $core.addMethod(
  41622. $core.method({
  41623. selector: "visitIRVerbatim:",
  41624. protocol: "visiting",
  41625. fn: function (anIRVerbatim){
  41626. var self=this,$self=this;
  41627. return $core.withContext(function($ctx1) {
  41628. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41629. return self;
  41630. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41631. },
  41632. args: ["anIRVerbatim"],
  41633. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41634. referencedClasses: [],
  41635. messageSends: ["nextPutAll:", "stream", "source"]
  41636. }),
  41637. $globals.IRJSTranslator);
  41638. $core.addMethod(
  41639. $core.method({
  41640. selector: "visitInstructionList:enclosedBetween:and:",
  41641. protocol: "visiting",
  41642. fn: function (anArray,aString,anotherString){
  41643. var self=this,$self=this;
  41644. return $core.withContext(function($ctx1) {
  41645. var $1;
  41646. $1=$self._stream();
  41647. $ctx1.sendIdx["stream"]=1;
  41648. $recv($1)._nextPutAll_(aString);
  41649. $ctx1.sendIdx["nextPutAll:"]=1;
  41650. $recv(anArray)._do_separatedBy_((function(each){
  41651. return $core.withContext(function($ctx2) {
  41652. return $self._visit_(each);
  41653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41654. }),(function(){
  41655. return $core.withContext(function($ctx2) {
  41656. return $recv($self._stream())._nextPutAll_(",");
  41657. $ctx2.sendIdx["nextPutAll:"]=2;
  41658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41659. }));
  41660. $recv($self["@stream"])._nextPutAll_(anotherString);
  41661. return self;
  41662. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41663. },
  41664. args: ["anArray", "aString", "anotherString"],
  41665. 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",
  41666. referencedClasses: [],
  41667. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41668. }),
  41669. $globals.IRJSTranslator);
  41670. $core.addMethod(
  41671. $core.method({
  41672. selector: "visitReceiver:",
  41673. protocol: "visiting",
  41674. fn: function (anIRInstruction){
  41675. var self=this,$self=this;
  41676. var instr;
  41677. return $core.withContext(function($ctx1) {
  41678. var $1,$2,$4,$5,$3,$6,$7,$8;
  41679. $1=$recv(anIRInstruction)._isSelf();
  41680. if($core.assert($1)){
  41681. $2=$recv(anIRInstruction)._copy();
  41682. $ctx1.sendIdx["copy"]=1;
  41683. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41684. $recv($4)._name_("$self");
  41685. $5=$recv($4)._yourself();
  41686. $ctx1.sendIdx["yourself"]=1;
  41687. $3=$5;
  41688. $recv($2)._variable_($3);
  41689. instr=$recv($2)._yourself();
  41690. instr;
  41691. } else {
  41692. instr=anIRInstruction;
  41693. instr;
  41694. }
  41695. $6=$recv(instr)._needsBoxingAsReceiver();
  41696. if(!$core.assert($6)){
  41697. $7=$self._visit_(instr);
  41698. $ctx1.sendIdx["visit:"]=1;
  41699. return $7;
  41700. }
  41701. $8=$self._stream();
  41702. $ctx1.sendIdx["stream"]=1;
  41703. $recv($8)._nextPutAll_("$recv(");
  41704. $ctx1.sendIdx["nextPutAll:"]=1;
  41705. $self._visit_(instr);
  41706. $recv($self._stream())._nextPutAll_(")");
  41707. return self;
  41708. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41709. },
  41710. args: ["anIRInstruction"],
  41711. source: "visitReceiver: anIRInstruction\x0a\x09| instr |\x0a\x0a\x09anIRInstruction isSelf\x0a\x09\x09ifTrue: [ instr := anIRInstruction copy\x0a\x09\x09\x09variable: (anIRInstruction variable copy name: '$self'; yourself);\x0a\x09\x09\x09yourself ]\x0a\x09\x09ifFalse: [ instr := anIRInstruction ].\x0a\x09\x0a\x09instr needsBoxingAsReceiver ifFalse: [ ^ self visit: instr ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: instr.\x0a\x09self stream nextPutAll: ')'",
  41712. referencedClasses: [],
  41713. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41714. }),
  41715. $globals.IRJSTranslator);
  41716. $core.addMethod(
  41717. $core.method({
  41718. selector: "visitSend:",
  41719. protocol: "visiting",
  41720. fn: function (anIRSend){
  41721. var self=this,$self=this;
  41722. return $core.withContext(function($ctx1) {
  41723. $self._visitReceiver_($recv(anIRSend)._receiver());
  41724. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41725. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41726. return self;
  41727. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41728. },
  41729. args: ["anIRSend"],
  41730. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  41731. referencedClasses: [],
  41732. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41733. }),
  41734. $globals.IRJSTranslator);
  41735. $core.addMethod(
  41736. $core.method({
  41737. selector: "visitSuperSend:",
  41738. protocol: "visiting",
  41739. fn: function (anIRSend){
  41740. var self=this,$self=this;
  41741. return $core.withContext(function($ctx1) {
  41742. var $1,$4,$3,$2,$5,$6,$7,$8;
  41743. $1=$self._stream();
  41744. $ctx1.sendIdx["stream"]=1;
  41745. $recv($1)._nextPutAll_("(");
  41746. $ctx1.sendIdx["nextPutAll:"]=1;
  41747. $recv($1)._lf();
  41748. $ctx1.sendIdx["lf"]=1;
  41749. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41750. $ctx1.sendIdx["nextPutAll:"]=2;
  41751. $recv($1)._lf();
  41752. $ctx1.sendIdx["lf"]=2;
  41753. $4=$recv(anIRSend)._scope();
  41754. $ctx1.sendIdx["scope"]=1;
  41755. $3=$recv($4)._alias();
  41756. $ctx1.sendIdx["alias"]=1;
  41757. $2=$recv($3).__comma(".supercall = true,");
  41758. $ctx1.sendIdx[","]=1;
  41759. $recv($1)._nextPutAll_($2);
  41760. $ctx1.sendIdx["nextPutAll:"]=3;
  41761. $recv($1)._lf();
  41762. $ctx1.sendIdx["lf"]=3;
  41763. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41764. $ctx1.sendIdx["nextPutAll:"]=4;
  41765. $recv($1)._lf();
  41766. $ctx1.sendIdx["lf"]=4;
  41767. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41768. $ctx1.sendIdx[","]=2;
  41769. $recv($1)._nextPutAll_($5);
  41770. $ctx1.sendIdx["nextPutAll:"]=5;
  41771. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41772. $ctx1.sendIdx["nextPutAll:"]=6;
  41773. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41774. $ctx1.sendIdx[","]=3;
  41775. $recv($1)._nextPutAll_($6);
  41776. $ctx1.sendIdx["nextPutAll:"]=7;
  41777. $7=$recv($1)._nextPutAll_("$self, ");
  41778. $ctx1.sendIdx["nextPutAll:"]=8;
  41779. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41780. $8=$self._stream();
  41781. $recv($8)._nextPutAll_("));");
  41782. $ctx1.sendIdx["nextPutAll:"]=9;
  41783. $recv($8)._lf();
  41784. $ctx1.sendIdx["lf"]=5;
  41785. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41786. $ctx1.sendIdx["nextPutAll:"]=10;
  41787. $recv($8)._lf();
  41788. $ctx1.sendIdx["lf"]=6;
  41789. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41790. $ctx1.sendIdx["nextPutAll:"]=11;
  41791. $recv($8)._lf();
  41792. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41793. return self;
  41794. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41795. },
  41796. args: ["anIRSend"],
  41797. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  41798. referencedClasses: [],
  41799. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41800. }),
  41801. $globals.IRJSTranslator);
  41802. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41803. $core.addMethod(
  41804. $core.method({
  41805. selector: "contents",
  41806. protocol: "accessing",
  41807. fn: function (){
  41808. var self=this,$self=this;
  41809. return $core.withContext(function($ctx1) {
  41810. return $recv($self["@stream"])._contents();
  41811. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41812. },
  41813. args: [],
  41814. source: "contents\x0a\x09^ stream contents",
  41815. referencedClasses: [],
  41816. messageSends: ["contents"]
  41817. }),
  41818. $globals.JSStream);
  41819. $core.addMethod(
  41820. $core.method({
  41821. selector: "initialize",
  41822. protocol: "initialization",
  41823. fn: function (){
  41824. var self=this,$self=this;
  41825. return $core.withContext(function($ctx1) {
  41826. (
  41827. $ctx1.supercall = true,
  41828. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41829. $ctx1.supercall = false;
  41830. $self["@stream"]=""._writeStream();
  41831. return self;
  41832. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41833. },
  41834. args: [],
  41835. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41836. referencedClasses: [],
  41837. messageSends: ["initialize", "writeStream"]
  41838. }),
  41839. $globals.JSStream);
  41840. $core.addMethod(
  41841. $core.method({
  41842. selector: "lf",
  41843. protocol: "streaming",
  41844. fn: function (){
  41845. var self=this,$self=this;
  41846. return $core.withContext(function($ctx1) {
  41847. $recv($self["@stream"])._lf();
  41848. return self;
  41849. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41850. },
  41851. args: [],
  41852. source: "lf\x0a\x09stream lf",
  41853. referencedClasses: [],
  41854. messageSends: ["lf"]
  41855. }),
  41856. $globals.JSStream);
  41857. $core.addMethod(
  41858. $core.method({
  41859. selector: "nextPut:",
  41860. protocol: "streaming",
  41861. fn: function (aString){
  41862. var self=this,$self=this;
  41863. return $core.withContext(function($ctx1) {
  41864. $recv($self["@stream"])._nextPut_(aString);
  41865. return self;
  41866. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41867. },
  41868. args: ["aString"],
  41869. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41870. referencedClasses: [],
  41871. messageSends: ["nextPut:"]
  41872. }),
  41873. $globals.JSStream);
  41874. $core.addMethod(
  41875. $core.method({
  41876. selector: "nextPutAll:",
  41877. protocol: "streaming",
  41878. fn: function (aString){
  41879. var self=this,$self=this;
  41880. return $core.withContext(function($ctx1) {
  41881. $recv($self["@stream"])._nextPutAll_(aString);
  41882. return self;
  41883. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41884. },
  41885. args: ["aString"],
  41886. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41887. referencedClasses: [],
  41888. messageSends: ["nextPutAll:"]
  41889. }),
  41890. $globals.JSStream);
  41891. $core.addMethod(
  41892. $core.method({
  41893. selector: "nextPutAssignLhs:rhs:",
  41894. protocol: "streaming",
  41895. fn: function (aBlock,anotherBlock){
  41896. var self=this,$self=this;
  41897. return $core.withContext(function($ctx1) {
  41898. $recv(aBlock)._value();
  41899. $ctx1.sendIdx["value"]=1;
  41900. $recv($self["@stream"])._nextPutAll_("=");
  41901. $recv(anotherBlock)._value();
  41902. return self;
  41903. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41904. },
  41905. args: ["aBlock", "anotherBlock"],
  41906. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41907. referencedClasses: [],
  41908. messageSends: ["value", "nextPutAll:"]
  41909. }),
  41910. $globals.JSStream);
  41911. $core.addMethod(
  41912. $core.method({
  41913. selector: "nextPutBlockContextFor:during:",
  41914. protocol: "streaming",
  41915. fn: function (anIRClosure,aBlock){
  41916. var self=this,$self=this;
  41917. return $core.withContext(function($ctx1) {
  41918. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41919. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41920. if(!$core.assert($1)){
  41921. $2=$recv(aBlock)._value();
  41922. $ctx1.sendIdx["value"]=1;
  41923. return $2;
  41924. }
  41925. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41926. $ctx1.sendIdx["nextPutAll:"]=1;
  41927. $self._lf();
  41928. $ctx1.sendIdx["lf"]=1;
  41929. $6=$recv(anIRClosure)._scope();
  41930. $ctx1.sendIdx["scope"]=1;
  41931. $5=$recv($6)._alias();
  41932. $ctx1.sendIdx["alias"]=1;
  41933. $4="return $core.withContext(function(".__comma($5);
  41934. $ctx1.sendIdx[","]=2;
  41935. $3=$recv($4).__comma(") {");
  41936. $ctx1.sendIdx[","]=1;
  41937. $self._nextPutAll_($3);
  41938. $ctx1.sendIdx["nextPutAll:"]=2;
  41939. $self._lf();
  41940. $ctx1.sendIdx["lf"]=2;
  41941. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41942. $ctx1.sendIdx["nextPutAll:"]=3;
  41943. $7=$self._lf();
  41944. $ctx1.sendIdx["lf"]=3;
  41945. $recv(aBlock)._value();
  41946. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41947. $ctx1.sendIdx["nextPutAll:"]=4;
  41948. $self._lf();
  41949. $ctx1.sendIdx["lf"]=4;
  41950. $11=$recv(anIRClosure)._scope();
  41951. $ctx1.sendIdx["scope"]=2;
  41952. $10=$recv($11)._alias();
  41953. $ctx1.sendIdx["alias"]=2;
  41954. $9="}, function(".__comma($10);
  41955. $ctx1.sendIdx[","]=4;
  41956. $8=$recv($9).__comma(") {");
  41957. $ctx1.sendIdx[","]=3;
  41958. $self._nextPutAll_($8);
  41959. $ctx1.sendIdx["nextPutAll:"]=5;
  41960. $15=$recv(anIRClosure)._scope();
  41961. $ctx1.sendIdx["scope"]=3;
  41962. $14=$recv($15)._alias();
  41963. $ctx1.sendIdx["alias"]=3;
  41964. $13=$recv($14).__comma(".fillBlock({");
  41965. $ctx1.sendIdx[","]=5;
  41966. $12=$self._nextPutAll_($13);
  41967. $ctx1.sendIdx["nextPutAll:"]=6;
  41968. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41969. return $core.withContext(function($ctx2) {
  41970. $16=$recv(each)._asVariableName();
  41971. $ctx2.sendIdx["asVariableName"]=1;
  41972. $self._nextPutAll_($16);
  41973. $ctx2.sendIdx["nextPutAll:"]=7;
  41974. $self._nextPutAll_(":");
  41975. $ctx2.sendIdx["nextPutAll:"]=8;
  41976. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41977. $ctx2.sendIdx["nextPutAll:"]=9;
  41978. return $17;
  41979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41980. }),(function(){
  41981. return $core.withContext(function($ctx2) {
  41982. return $self._nextPutAll_(",");
  41983. $ctx2.sendIdx["nextPutAll:"]=10;
  41984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41985. }));
  41986. $self._nextPutAll_("},");
  41987. $ctx1.sendIdx["nextPutAll:"]=11;
  41988. $23=$recv(anIRClosure)._scope();
  41989. $ctx1.sendIdx["scope"]=4;
  41990. $22=$recv($23)._outerScope();
  41991. $21=$recv($22)._alias();
  41992. $20=$recv($21).__comma(",");
  41993. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41994. $ctx1.sendIdx[","]=7;
  41995. $18=$recv($19).__comma(")});");
  41996. $ctx1.sendIdx[","]=6;
  41997. $self._nextPutAll_($18);
  41998. $ctx1.sendIdx["nextPutAll:"]=12;
  41999. $self._lf();
  42000. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42001. return self;
  42002. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42003. },
  42004. args: ["anIRClosure", "aBlock"],
  42005. 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);'",
  42006. referencedClasses: [],
  42007. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42008. }),
  42009. $globals.JSStream);
  42010. $core.addMethod(
  42011. $core.method({
  42012. selector: "nextPutClosureWith:arguments:",
  42013. protocol: "streaming",
  42014. fn: function (aBlock,anArray){
  42015. var self=this,$self=this;
  42016. return $core.withContext(function($ctx1) {
  42017. var $1,$2,$3;
  42018. $recv($self["@stream"])._nextPutAll_("(function(");
  42019. $ctx1.sendIdx["nextPutAll:"]=1;
  42020. $recv(anArray)._do_separatedBy_((function(each){
  42021. return $core.withContext(function($ctx2) {
  42022. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42023. $ctx2.sendIdx["nextPutAll:"]=2;
  42024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42025. }),(function(){
  42026. return $core.withContext(function($ctx2) {
  42027. return $recv($self["@stream"])._nextPut_(",");
  42028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42029. }));
  42030. $1=$self["@stream"];
  42031. $recv($1)._nextPutAll_("){");
  42032. $ctx1.sendIdx["nextPutAll:"]=3;
  42033. $2=$recv($1)._lf();
  42034. $ctx1.sendIdx["lf"]=1;
  42035. $recv(aBlock)._value();
  42036. $3=$self["@stream"];
  42037. $recv($3)._lf();
  42038. $recv($3)._nextPutAll_("})");
  42039. return self;
  42040. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42041. },
  42042. args: ["aBlock", "anArray"],
  42043. 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: '})'",
  42044. referencedClasses: [],
  42045. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42046. }),
  42047. $globals.JSStream);
  42048. $core.addMethod(
  42049. $core.method({
  42050. selector: "nextPutContextFor:during:",
  42051. protocol: "streaming",
  42052. fn: function (aMethod,aBlock){
  42053. var self=this,$self=this;
  42054. return $core.withContext(function($ctx1) {
  42055. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42056. $1=$recv(aMethod)._requiresSmalltalkContext();
  42057. if(!$core.assert($1)){
  42058. $2=$recv(aBlock)._value();
  42059. $ctx1.sendIdx["value"]=1;
  42060. return $2;
  42061. }
  42062. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42063. $ctx1.sendIdx["nextPutAll:"]=1;
  42064. $self._lf();
  42065. $ctx1.sendIdx["lf"]=1;
  42066. $6=$recv(aMethod)._scope();
  42067. $ctx1.sendIdx["scope"]=1;
  42068. $5=$recv($6)._alias();
  42069. $ctx1.sendIdx["alias"]=1;
  42070. $4="return $core.withContext(function(".__comma($5);
  42071. $ctx1.sendIdx[","]=2;
  42072. $3=$recv($4).__comma(") {");
  42073. $ctx1.sendIdx[","]=1;
  42074. $self._nextPutAll_($3);
  42075. $ctx1.sendIdx["nextPutAll:"]=2;
  42076. $self._lf();
  42077. $ctx1.sendIdx["lf"]=2;
  42078. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42079. $ctx1.sendIdx["nextPutAll:"]=3;
  42080. $7=$self._lf();
  42081. $ctx1.sendIdx["lf"]=3;
  42082. $recv(aBlock)._value();
  42083. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42084. $ctx1.sendIdx["nextPutAll:"]=4;
  42085. $self._lf();
  42086. $ctx1.sendIdx["lf"]=4;
  42087. $12=$recv(aMethod)._scope();
  42088. $ctx1.sendIdx["scope"]=2;
  42089. $11=$recv($12)._alias();
  42090. $ctx1.sendIdx["alias"]=2;
  42091. $10="}, function(".__comma($11);
  42092. $ctx1.sendIdx[","]=5;
  42093. $9=$recv($10).__comma(") {");
  42094. $ctx1.sendIdx[","]=4;
  42095. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42096. $ctx1.sendIdx[","]=3;
  42097. $self._nextPutAll_($8);
  42098. $ctx1.sendIdx["nextPutAll:"]=5;
  42099. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42100. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42101. $15=".fill(self,".__comma($16);
  42102. $14=$recv($15).__comma(",{");
  42103. $ctx1.sendIdx[","]=6;
  42104. $13=$self._nextPutAll_($14);
  42105. $ctx1.sendIdx["nextPutAll:"]=6;
  42106. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42107. return $core.withContext(function($ctx2) {
  42108. $17=$recv(each)._asVariableName();
  42109. $ctx2.sendIdx["asVariableName"]=1;
  42110. $self._nextPutAll_($17);
  42111. $ctx2.sendIdx["nextPutAll:"]=7;
  42112. $self._nextPutAll_(":");
  42113. $ctx2.sendIdx["nextPutAll:"]=8;
  42114. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42115. $ctx2.sendIdx["nextPutAll:"]=9;
  42116. return $18;
  42117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42118. }),(function(){
  42119. return $core.withContext(function($ctx2) {
  42120. return $self._nextPutAll_(",");
  42121. $ctx2.sendIdx["nextPutAll:"]=10;
  42122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42123. }));
  42124. $self._nextPutAll_("},");
  42125. $ctx1.sendIdx["nextPutAll:"]=11;
  42126. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42127. $ctx1.sendIdx["nextPutAll:"]=12;
  42128. $self._nextPutAll_(")});");
  42129. $ctx1.sendIdx["nextPutAll:"]=13;
  42130. $self._lf();
  42131. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42132. return self;
  42133. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42134. },
  42135. args: ["aMethod", "aBlock"],
  42136. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavaScriptSource, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavaScriptSource;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  42137. referencedClasses: [],
  42138. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42139. }),
  42140. $globals.JSStream);
  42141. $core.addMethod(
  42142. $core.method({
  42143. selector: "nextPutFunctionWith:arguments:",
  42144. protocol: "streaming",
  42145. fn: function (aBlock,anArray){
  42146. var self=this,$self=this;
  42147. return $core.withContext(function($ctx1) {
  42148. var $1,$2,$3,$4,$5;
  42149. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42150. $ctx1.sendIdx["nextPutAll:"]=1;
  42151. $recv(anArray)._do_separatedBy_((function(each){
  42152. return $core.withContext(function($ctx2) {
  42153. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42154. $ctx2.sendIdx["nextPutAll:"]=2;
  42155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42156. }),(function(){
  42157. return $core.withContext(function($ctx2) {
  42158. return $recv($self["@stream"])._nextPut_(",");
  42159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42160. }));
  42161. $1=$self["@stream"];
  42162. $recv($1)._nextPutAll_("){");
  42163. $ctx1.sendIdx["nextPutAll:"]=3;
  42164. $2=$recv($1)._lf();
  42165. $ctx1.sendIdx["lf"]=1;
  42166. $3=$self["@stream"];
  42167. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42168. $ctx1.sendIdx["nextPutAll:"]=4;
  42169. $4=$recv($3)._lf();
  42170. $ctx1.sendIdx["lf"]=2;
  42171. $recv(aBlock)._value();
  42172. $5=$self["@stream"];
  42173. $recv($5)._lf();
  42174. $recv($5)._nextPutAll_("}");
  42175. return self;
  42176. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42177. },
  42178. args: ["aBlock", "anArray"],
  42179. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function ('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  42180. referencedClasses: [],
  42181. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42182. }),
  42183. $globals.JSStream);
  42184. $core.addMethod(
  42185. $core.method({
  42186. selector: "nextPutIf:then:",
  42187. protocol: "streaming",
  42188. fn: function (aBlock,anotherBlock){
  42189. var self=this,$self=this;
  42190. return $core.withContext(function($ctx1) {
  42191. var $1;
  42192. $recv($self["@stream"])._nextPutAll_("if(");
  42193. $ctx1.sendIdx["nextPutAll:"]=1;
  42194. $recv(aBlock)._value();
  42195. $ctx1.sendIdx["value"]=1;
  42196. $1=$self["@stream"];
  42197. $recv($1)._nextPutAll_("){");
  42198. $ctx1.sendIdx["nextPutAll:"]=2;
  42199. $recv($1)._lf();
  42200. $recv(anotherBlock)._value();
  42201. $recv($self["@stream"])._nextPutAll_("}");
  42202. $self._omitSemicolon_(true);
  42203. return self;
  42204. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42205. },
  42206. args: ["aBlock", "anotherBlock"],
  42207. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'.\x0a\x09self omitSemicolon: true",
  42208. referencedClasses: [],
  42209. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42210. }),
  42211. $globals.JSStream);
  42212. $core.addMethod(
  42213. $core.method({
  42214. selector: "nextPutIf:then:else:",
  42215. protocol: "streaming",
  42216. fn: function (aBlock,ifBlock,elseBlock){
  42217. var self=this,$self=this;
  42218. return $core.withContext(function($ctx1) {
  42219. var $1,$2,$3;
  42220. $recv($self["@stream"])._nextPutAll_("if(");
  42221. $ctx1.sendIdx["nextPutAll:"]=1;
  42222. $recv(aBlock)._value();
  42223. $ctx1.sendIdx["value"]=1;
  42224. $1=$self["@stream"];
  42225. $recv($1)._nextPutAll_("){");
  42226. $ctx1.sendIdx["nextPutAll:"]=2;
  42227. $2=$recv($1)._lf();
  42228. $ctx1.sendIdx["lf"]=1;
  42229. $recv(ifBlock)._value();
  42230. $ctx1.sendIdx["value"]=2;
  42231. $3=$self["@stream"];
  42232. $recv($3)._nextPutAll_("} else {");
  42233. $ctx1.sendIdx["nextPutAll:"]=3;
  42234. $recv($3)._lf();
  42235. $recv(elseBlock)._value();
  42236. $recv($self["@stream"])._nextPutAll_("}");
  42237. $self._omitSemicolon_(true);
  42238. return self;
  42239. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42240. },
  42241. args: ["aBlock", "ifBlock", "elseBlock"],
  42242. source: "nextPutIf: aBlock then: ifBlock else: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'.\x0a\x09self omitSemicolon: true",
  42243. referencedClasses: [],
  42244. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42245. }),
  42246. $globals.JSStream);
  42247. $core.addMethod(
  42248. $core.method({
  42249. selector: "nextPutMethodDeclaration:with:",
  42250. protocol: "streaming",
  42251. fn: function (aMethod,aBlock){
  42252. var self=this,$self=this;
  42253. return $core.withContext(function($ctx1) {
  42254. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42255. $1=$self["@stream"];
  42256. $recv($1)._nextPutAll_("$core.method({");
  42257. $ctx1.sendIdx["nextPutAll:"]=1;
  42258. $recv($1)._lf();
  42259. $ctx1.sendIdx["lf"]=1;
  42260. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42261. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42262. $3="selector: ".__comma($4);
  42263. $ctx1.sendIdx[","]=2;
  42264. $2=$recv($3).__comma(",");
  42265. $ctx1.sendIdx[","]=1;
  42266. $recv($1)._nextPutAll_($2);
  42267. $ctx1.sendIdx["nextPutAll:"]=2;
  42268. $recv($1)._lf();
  42269. $ctx1.sendIdx["lf"]=2;
  42270. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42271. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42272. $6="source: ".__comma($7);
  42273. $ctx1.sendIdx[","]=4;
  42274. $5=$recv($6).__comma(",");
  42275. $ctx1.sendIdx[","]=3;
  42276. $recv($1)._nextPutAll_($5);
  42277. $ctx1.sendIdx["nextPutAll:"]=3;
  42278. $8=$recv($1)._lf();
  42279. $ctx1.sendIdx["lf"]=3;
  42280. $recv(aBlock)._value();
  42281. $ctx1.sendIdx["value"]=1;
  42282. $9=$self["@stream"];
  42283. $12=$recv($globals.String)._lf();
  42284. $ctx1.sendIdx["lf"]=4;
  42285. $11=",".__comma($12);
  42286. $ctx1.sendIdx[","]=6;
  42287. $10=$recv($11).__comma("messageSends: ");
  42288. $ctx1.sendIdx[","]=5;
  42289. $recv($9)._nextPutAll_($10);
  42290. $ctx1.sendIdx["nextPutAll:"]=4;
  42291. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42292. $ctx1.sendIdx["asArray"]=1;
  42293. $14=$recv($15)._asJavaScriptSource();
  42294. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42295. $13=$recv($14).__comma(",");
  42296. $ctx1.sendIdx[","]=7;
  42297. $recv($9)._nextPutAll_($13);
  42298. $ctx1.sendIdx["nextPutAll:"]=5;
  42299. $recv($9)._lf();
  42300. $ctx1.sendIdx["lf"]=5;
  42301. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42302. return $core.withContext(function($ctx2) {
  42303. return $recv(each)._value();
  42304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42305. })))._asArray())._asJavaScriptSource();
  42306. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42307. $17="args: ".__comma($18);
  42308. $16=$recv($17).__comma(",");
  42309. $ctx1.sendIdx[","]=8;
  42310. $recv($9)._nextPutAll_($16);
  42311. $ctx1.sendIdx["nextPutAll:"]=6;
  42312. $recv($9)._lf();
  42313. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42314. $ctx1.sendIdx["nextPutAll:"]=7;
  42315. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42316. return $core.withContext(function($ctx2) {
  42317. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42318. $ctx2.sendIdx["nextPutAll:"]=8;
  42319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42320. }),(function(){
  42321. return $core.withContext(function($ctx2) {
  42322. return $recv($self["@stream"])._nextPutAll_(",");
  42323. $ctx2.sendIdx["nextPutAll:"]=9;
  42324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42325. }));
  42326. $20=$self["@stream"];
  42327. $recv($20)._nextPutAll_("]");
  42328. $ctx1.sendIdx["nextPutAll:"]=10;
  42329. $recv($20)._nextPutAll_("})");
  42330. return self;
  42331. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42332. },
  42333. args: ["aMethod", "aBlock"],
  42334. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavaScriptSource, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavaScriptSource ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  42335. referencedClasses: ["String"],
  42336. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42337. }),
  42338. $globals.JSStream);
  42339. $core.addMethod(
  42340. $core.method({
  42341. selector: "nextPutNonLocalReturnHandlingWith:",
  42342. protocol: "streaming",
  42343. fn: function (aBlock){
  42344. var self=this,$self=this;
  42345. return $core.withContext(function($ctx1) {
  42346. var $1,$2,$3;
  42347. $1=$self["@stream"];
  42348. $recv($1)._nextPutAll_("var $early={};");
  42349. $ctx1.sendIdx["nextPutAll:"]=1;
  42350. $recv($1)._lf();
  42351. $ctx1.sendIdx["lf"]=1;
  42352. $recv($1)._nextPutAll_("try {");
  42353. $ctx1.sendIdx["nextPutAll:"]=2;
  42354. $2=$recv($1)._lf();
  42355. $ctx1.sendIdx["lf"]=2;
  42356. $recv(aBlock)._value();
  42357. $3=$self["@stream"];
  42358. $recv($3)._nextPutAll_("}");
  42359. $ctx1.sendIdx["nextPutAll:"]=3;
  42360. $recv($3)._lf();
  42361. $ctx1.sendIdx["lf"]=3;
  42362. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42363. $recv($3)._lf();
  42364. return self;
  42365. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42366. },
  42367. args: ["aBlock"],
  42368. 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",
  42369. referencedClasses: [],
  42370. messageSends: ["nextPutAll:", "lf", "value"]
  42371. }),
  42372. $globals.JSStream);
  42373. $core.addMethod(
  42374. $core.method({
  42375. selector: "nextPutNonLocalReturnWith:",
  42376. protocol: "streaming",
  42377. fn: function (aBlock){
  42378. var self=this,$self=this;
  42379. return $core.withContext(function($ctx1) {
  42380. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42381. $ctx1.sendIdx["nextPutAll:"]=1;
  42382. $recv(aBlock)._value();
  42383. $recv($self["@stream"])._nextPutAll_("]");
  42384. return self;
  42385. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42386. },
  42387. args: ["aBlock"],
  42388. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42389. referencedClasses: [],
  42390. messageSends: ["nextPutAll:", "value"]
  42391. }),
  42392. $globals.JSStream);
  42393. $core.addMethod(
  42394. $core.method({
  42395. selector: "nextPutReturnWith:",
  42396. protocol: "streaming",
  42397. fn: function (aBlock){
  42398. var self=this,$self=this;
  42399. return $core.withContext(function($ctx1) {
  42400. $recv($self["@stream"])._nextPutAll_("return ");
  42401. $recv(aBlock)._value();
  42402. return self;
  42403. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42404. },
  42405. args: ["aBlock"],
  42406. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42407. referencedClasses: [],
  42408. messageSends: ["nextPutAll:", "value"]
  42409. }),
  42410. $globals.JSStream);
  42411. $core.addMethod(
  42412. $core.method({
  42413. selector: "nextPutSendIndexFor:",
  42414. protocol: "streaming",
  42415. fn: function (anIRSend){
  42416. var self=this,$self=this;
  42417. return $core.withContext(function($ctx1) {
  42418. $self._nextPutAll_(";");
  42419. $ctx1.sendIdx["nextPutAll:"]=1;
  42420. $self._lf();
  42421. $ctx1.sendIdx["lf"]=1;
  42422. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42423. $ctx1.sendIdx["nextPutAll:"]=2;
  42424. $self._lf();
  42425. $ctx1.sendIdx["lf"]=2;
  42426. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42427. $ctx1.sendIdx["nextPutAll:"]=3;
  42428. $self._nextPutAll_(".sendIdx[");
  42429. $ctx1.sendIdx["nextPutAll:"]=4;
  42430. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42431. $ctx1.sendIdx["nextPutAll:"]=5;
  42432. $self._nextPutAll_("]=");
  42433. $ctx1.sendIdx["nextPutAll:"]=6;
  42434. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42435. $ctx1.sendIdx["nextPutAll:"]=7;
  42436. $self._nextPutAll_(";");
  42437. $ctx1.sendIdx["nextPutAll:"]=8;
  42438. $self._lf();
  42439. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42440. return self;
  42441. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42442. },
  42443. args: ["anIRSend"],
  42444. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptSource;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  42445. referencedClasses: [],
  42446. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42447. }),
  42448. $globals.JSStream);
  42449. $core.addMethod(
  42450. $core.method({
  42451. selector: "nextPutStatementWith:",
  42452. protocol: "streaming",
  42453. fn: function (aBlock){
  42454. var self=this,$self=this;
  42455. return $core.withContext(function($ctx1) {
  42456. var $1;
  42457. $self._omitSemicolon_(false);
  42458. $ctx1.sendIdx["omitSemicolon:"]=1;
  42459. $recv(aBlock)._value();
  42460. $1=$self._omitSemicolon();
  42461. if(!$core.assert($1)){
  42462. $recv($self["@stream"])._nextPutAll_(";");
  42463. }
  42464. $self._omitSemicolon_(false);
  42465. $recv($self["@stream"])._lf();
  42466. return self;
  42467. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42468. },
  42469. args: ["aBlock"],
  42470. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42471. referencedClasses: [],
  42472. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42473. }),
  42474. $globals.JSStream);
  42475. $core.addMethod(
  42476. $core.method({
  42477. selector: "nextPutVars:",
  42478. protocol: "streaming",
  42479. fn: function (aCollection){
  42480. var self=this,$self=this;
  42481. return $core.withContext(function($ctx1) {
  42482. var $1;
  42483. $recv(aCollection)._ifNotEmpty_((function(){
  42484. return $core.withContext(function($ctx2) {
  42485. $recv($self["@stream"])._nextPutAll_("var ");
  42486. $ctx2.sendIdx["nextPutAll:"]=1;
  42487. $recv(aCollection)._do_separatedBy_((function(each){
  42488. return $core.withContext(function($ctx3) {
  42489. return $recv($self["@stream"])._nextPutAll_(each);
  42490. $ctx3.sendIdx["nextPutAll:"]=2;
  42491. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42492. }),(function(){
  42493. return $core.withContext(function($ctx3) {
  42494. return $recv($self["@stream"])._nextPutAll_(",");
  42495. $ctx3.sendIdx["nextPutAll:"]=3;
  42496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42497. }));
  42498. $1=$self["@stream"];
  42499. $recv($1)._nextPutAll_(";");
  42500. return $recv($1)._lf();
  42501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42502. }));
  42503. return self;
  42504. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42505. },
  42506. args: ["aCollection"],
  42507. 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 ]",
  42508. referencedClasses: [],
  42509. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42510. }),
  42511. $globals.JSStream);
  42512. $core.addMethod(
  42513. $core.method({
  42514. selector: "omitSemicolon",
  42515. protocol: "accessing",
  42516. fn: function (){
  42517. var self=this,$self=this;
  42518. return $self["@omitSemicolon"];
  42519. },
  42520. args: [],
  42521. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42522. referencedClasses: [],
  42523. messageSends: []
  42524. }),
  42525. $globals.JSStream);
  42526. $core.addMethod(
  42527. $core.method({
  42528. selector: "omitSemicolon:",
  42529. protocol: "accessing",
  42530. fn: function (aBoolean){
  42531. var self=this,$self=this;
  42532. $self["@omitSemicolon"]=aBoolean;
  42533. return self;
  42534. },
  42535. args: ["aBoolean"],
  42536. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42537. referencedClasses: [],
  42538. messageSends: []
  42539. }),
  42540. $globals.JSStream);
  42541. $core.addMethod(
  42542. $core.method({
  42543. selector: "isReferenced",
  42544. protocol: "*Compiler-IR",
  42545. fn: function (){
  42546. var self=this,$self=this;
  42547. return $core.withContext(function($ctx1) {
  42548. var $3,$2,$1;
  42549. $3=$self._parent();
  42550. $ctx1.sendIdx["parent"]=1;
  42551. $2=$recv($3)._isSequenceNode();
  42552. $1=$recv($2)._or_((function(){
  42553. return $core.withContext(function($ctx2) {
  42554. return $recv($self._parent())._isAssignmentNode();
  42555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42556. }));
  42557. return $recv($1)._not();
  42558. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42559. },
  42560. args: [],
  42561. 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",
  42562. referencedClasses: [],
  42563. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42564. }),
  42565. $globals.ASTNode);
  42566. $core.addMethod(
  42567. $core.method({
  42568. selector: "subtreeNeedsAliasing",
  42569. protocol: "*Compiler-IR",
  42570. fn: function (){
  42571. var self=this,$self=this;
  42572. return $core.withContext(function($ctx1) {
  42573. return $recv($self._shouldBeAliased())._or_((function(){
  42574. return $core.withContext(function($ctx2) {
  42575. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42576. return $core.withContext(function($ctx3) {
  42577. return $recv(each)._subtreeNeedsAliasing();
  42578. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42579. }));
  42580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42581. }));
  42582. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42583. },
  42584. args: [],
  42585. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42586. referencedClasses: [],
  42587. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42588. }),
  42589. $globals.ASTNode);
  42590. $core.addMethod(
  42591. $core.method({
  42592. selector: "shouldBeAliased",
  42593. protocol: "*Compiler-IR",
  42594. fn: function (){
  42595. var self=this,$self=this;
  42596. return $core.withContext(function($ctx1) {
  42597. var $1;
  42598. $1=(
  42599. $ctx1.supercall = true,
  42600. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42601. $ctx1.supercall = false;
  42602. return $recv($1)._or_((function(){
  42603. return $core.withContext(function($ctx2) {
  42604. return $self._isReferenced();
  42605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42606. }));
  42607. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42608. },
  42609. args: [],
  42610. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42611. referencedClasses: [],
  42612. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42613. }),
  42614. $globals.AssignmentNode);
  42615. $core.addMethod(
  42616. $core.method({
  42617. selector: "appendToInstruction:",
  42618. protocol: "*Compiler-IR",
  42619. fn: function (anIRInstruction){
  42620. var self=this,$self=this;
  42621. return $core.withContext(function($ctx1) {
  42622. $recv(anIRInstruction)._appendBlock_(self);
  42623. return self;
  42624. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42625. },
  42626. args: ["anIRInstruction"],
  42627. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42628. referencedClasses: [],
  42629. messageSends: ["appendBlock:"]
  42630. }),
  42631. $globals.BlockClosure);
  42632. $core.addMethod(
  42633. $core.method({
  42634. selector: "subtreeNeedsAliasing",
  42635. protocol: "*Compiler-IR",
  42636. fn: function (){
  42637. var self=this,$self=this;
  42638. return $core.withContext(function($ctx1) {
  42639. return $self._shouldBeAliased();
  42640. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42641. },
  42642. args: [],
  42643. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42644. referencedClasses: [],
  42645. messageSends: ["shouldBeAliased"]
  42646. }),
  42647. $globals.BlockNode);
  42648. $core.addMethod(
  42649. $core.method({
  42650. selector: "subtreeNeedsAliasing",
  42651. protocol: "*Compiler-IR",
  42652. fn: function (){
  42653. var self=this,$self=this;
  42654. return $core.withContext(function($ctx1) {
  42655. return $recv($recv($self._parent())._isSequenceNode())._not();
  42656. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42657. },
  42658. args: [],
  42659. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42660. referencedClasses: [],
  42661. messageSends: ["not", "isSequenceNode", "parent"]
  42662. }),
  42663. $globals.CascadeNode);
  42664. $core.addMethod(
  42665. $core.method({
  42666. selector: "shouldBeAliased",
  42667. protocol: "*Compiler-IR",
  42668. fn: function (){
  42669. var self=this,$self=this;
  42670. var sends;
  42671. return $core.withContext(function($ctx1) {
  42672. var $2,$1;
  42673. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42674. $2=(
  42675. $ctx1.supercall = true,
  42676. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42677. $ctx1.supercall = false;
  42678. $1=$recv($2)._or_((function(){
  42679. return $core.withContext(function($ctx2) {
  42680. return $recv($self._isReferenced())._and_((function(){
  42681. return $core.withContext(function($ctx3) {
  42682. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42683. return $core.withContext(function($ctx4) {
  42684. return $self._superSend();
  42685. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42686. }));
  42687. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42688. }));
  42689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42690. }));
  42691. $ctx1.sendIdx["or:"]=1;
  42692. return $1;
  42693. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42694. },
  42695. args: [],
  42696. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09self index < sends or: [\x0a\x09\x09\x09\x09self superSend ] ] ])",
  42697. referencedClasses: [],
  42698. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42699. }),
  42700. $globals.SendNode);
  42701. $core.addMethod(
  42702. $core.method({
  42703. selector: "subtreeNeedsAliasing",
  42704. protocol: "*Compiler-IR",
  42705. fn: function (){
  42706. var self=this,$self=this;
  42707. return $core.withContext(function($ctx1) {
  42708. return $recv($self._shouldBeInlined())._or_((function(){
  42709. return $core.withContext(function($ctx2) {
  42710. return (
  42711. $ctx2.supercall = true,
  42712. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42713. $ctx2.supercall = false;
  42714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42715. }));
  42716. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42717. },
  42718. args: [],
  42719. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42720. referencedClasses: [],
  42721. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42722. }),
  42723. $globals.SendNode);
  42724. });
  42725. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  42726. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42727. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42728. var $pkg = $core.addPackage("Compiler-Inlining");
  42729. $pkg.innerEval = function (expr) { return eval(expr); };
  42730. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  42731. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42732. $core.addMethod(
  42733. $core.method({
  42734. selector: "visitSendNode:",
  42735. protocol: "visiting",
  42736. fn: function (aNode){
  42737. var self=this,$self=this;
  42738. return $core.withContext(function($ctx1) {
  42739. var $1,$2,$3,$4,$receiver;
  42740. $1=$recv(aNode)._superSend();
  42741. if(!$core.assert($1)){
  42742. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42743. if($core.assert($2)){
  42744. $recv(aNode)._shouldBeInlined_(true);
  42745. $3=$recv(aNode)._receiver();
  42746. if(($receiver = $3) == null || $receiver.a$nil){
  42747. $3;
  42748. } else {
  42749. var receiver;
  42750. receiver=$receiver;
  42751. $recv(receiver)._shouldBeAliased_(true);
  42752. }
  42753. }
  42754. }
  42755. $4=(
  42756. $ctx1.supercall = true,
  42757. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42758. $ctx1.supercall = false;
  42759. return $4;
  42760. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42761. },
  42762. args: ["aNode"],
  42763. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  42764. referencedClasses: ["IRSendInliner"],
  42765. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42766. }),
  42767. $globals.ASTPreInliner);
  42768. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42769. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42770. $core.addMethod(
  42771. $core.method({
  42772. selector: "acceptDagVisitor:",
  42773. protocol: "visiting",
  42774. fn: function (aVisitor){
  42775. var self=this,$self=this;
  42776. return $core.withContext(function($ctx1) {
  42777. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42778. return self;
  42779. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42780. },
  42781. args: ["aVisitor"],
  42782. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42783. referencedClasses: [],
  42784. messageSends: ["visitIRInlinedClosure:"]
  42785. }),
  42786. $globals.IRInlinedClosure);
  42787. $core.addMethod(
  42788. $core.method({
  42789. selector: "isInlined",
  42790. protocol: "testing",
  42791. fn: function (){
  42792. var self=this,$self=this;
  42793. return true;
  42794. },
  42795. args: [],
  42796. source: "isInlined\x0a\x09^ true",
  42797. referencedClasses: [],
  42798. messageSends: []
  42799. }),
  42800. $globals.IRInlinedClosure);
  42801. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42802. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42803. $core.addMethod(
  42804. $core.method({
  42805. selector: "acceptDagVisitor:",
  42806. protocol: "visiting",
  42807. fn: function (aVisitor){
  42808. var self=this,$self=this;
  42809. return $core.withContext(function($ctx1) {
  42810. $recv(aVisitor)._visitInlinedSend_(self);
  42811. return self;
  42812. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42813. },
  42814. args: ["aVisitor"],
  42815. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42816. referencedClasses: [],
  42817. messageSends: ["visitInlinedSend:"]
  42818. }),
  42819. $globals.IRInlinedSend);
  42820. $core.addMethod(
  42821. $core.method({
  42822. selector: "internalVariables",
  42823. protocol: "accessing",
  42824. fn: function (){
  42825. var self=this,$self=this;
  42826. return [];
  42827. },
  42828. args: [],
  42829. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42830. referencedClasses: [],
  42831. messageSends: []
  42832. }),
  42833. $globals.IRInlinedSend);
  42834. $core.addMethod(
  42835. $core.method({
  42836. selector: "isInlined",
  42837. protocol: "testing",
  42838. fn: function (){
  42839. var self=this,$self=this;
  42840. return true;
  42841. },
  42842. args: [],
  42843. source: "isInlined\x0a\x09^ true",
  42844. referencedClasses: [],
  42845. messageSends: []
  42846. }),
  42847. $globals.IRInlinedSend);
  42848. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42849. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42850. $core.addMethod(
  42851. $core.method({
  42852. selector: "acceptDagVisitor:",
  42853. protocol: "visiting",
  42854. fn: function (aVisitor){
  42855. var self=this,$self=this;
  42856. return $core.withContext(function($ctx1) {
  42857. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42858. return self;
  42859. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42860. },
  42861. args: ["aVisitor"],
  42862. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42863. referencedClasses: [],
  42864. messageSends: ["visitIRInlinedIfFalse:"]
  42865. }),
  42866. $globals.IRInlinedIfFalse);
  42867. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42868. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42869. $core.addMethod(
  42870. $core.method({
  42871. selector: "acceptDagVisitor:",
  42872. protocol: "visiting",
  42873. fn: function (aVisitor){
  42874. var self=this,$self=this;
  42875. return $core.withContext(function($ctx1) {
  42876. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42877. return self;
  42878. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42879. },
  42880. args: ["aVisitor"],
  42881. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42882. referencedClasses: [],
  42883. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42884. }),
  42885. $globals.IRInlinedIfNilIfNotNil);
  42886. $core.addMethod(
  42887. $core.method({
  42888. selector: "internalVariables",
  42889. protocol: "accessing",
  42890. fn: function (){
  42891. var self=this,$self=this;
  42892. return $core.withContext(function($ctx1) {
  42893. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42894. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42895. },
  42896. args: [],
  42897. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42898. referencedClasses: ["Array"],
  42899. messageSends: ["with:", "receiverInternalVariable"]
  42900. }),
  42901. $globals.IRInlinedIfNilIfNotNil);
  42902. $core.addMethod(
  42903. $core.method({
  42904. selector: "receiverInternalVariable",
  42905. protocol: "accessing",
  42906. fn: function (){
  42907. var self=this,$self=this;
  42908. return $core.withContext(function($ctx1) {
  42909. var $1;
  42910. $1=$recv($globals.IRVariable)._new();
  42911. $ctx1.sendIdx["new"]=1;
  42912. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42913. return $recv($1)._yourself();
  42914. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42915. },
  42916. args: [],
  42917. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42918. referencedClasses: ["IRVariable", "AliasVar"],
  42919. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42920. }),
  42921. $globals.IRInlinedIfNilIfNotNil);
  42922. $core.addMethod(
  42923. $core.method({
  42924. selector: "receiverInternalVariableName",
  42925. protocol: "accessing",
  42926. fn: function (){
  42927. var self=this,$self=this;
  42928. return "$receiver";
  42929. },
  42930. args: [],
  42931. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42932. referencedClasses: [],
  42933. messageSends: []
  42934. }),
  42935. $globals.IRInlinedIfNilIfNotNil);
  42936. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42937. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42938. $core.addMethod(
  42939. $core.method({
  42940. selector: "acceptDagVisitor:",
  42941. protocol: "visiting",
  42942. fn: function (aVisitor){
  42943. var self=this,$self=this;
  42944. return $core.withContext(function($ctx1) {
  42945. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42946. return self;
  42947. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42948. },
  42949. args: ["aVisitor"],
  42950. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42951. referencedClasses: [],
  42952. messageSends: ["visitIRInlinedIfTrue:"]
  42953. }),
  42954. $globals.IRInlinedIfTrue);
  42955. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42956. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42957. $core.addMethod(
  42958. $core.method({
  42959. selector: "acceptDagVisitor:",
  42960. protocol: "visiting",
  42961. fn: function (aVisitor){
  42962. var self=this,$self=this;
  42963. return $core.withContext(function($ctx1) {
  42964. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42965. return self;
  42966. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42967. },
  42968. args: ["aVisitor"],
  42969. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42970. referencedClasses: [],
  42971. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42972. }),
  42973. $globals.IRInlinedIfTrueIfFalse);
  42974. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42975. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42976. $core.addMethod(
  42977. $core.method({
  42978. selector: "acceptDagVisitor:",
  42979. protocol: "visiting",
  42980. fn: function (aVisitor){
  42981. var self=this,$self=this;
  42982. return $core.withContext(function($ctx1) {
  42983. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42984. return self;
  42985. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42986. },
  42987. args: ["aVisitor"],
  42988. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42989. referencedClasses: [],
  42990. messageSends: ["visitIRInlinedSequence:"]
  42991. }),
  42992. $globals.IRInlinedSequence);
  42993. $core.addMethod(
  42994. $core.method({
  42995. selector: "isInlined",
  42996. protocol: "testing",
  42997. fn: function (){
  42998. var self=this,$self=this;
  42999. return true;
  43000. },
  43001. args: [],
  43002. source: "isInlined\x0a\x09^ true",
  43003. referencedClasses: [],
  43004. messageSends: []
  43005. }),
  43006. $globals.IRInlinedSequence);
  43007. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43008. $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`";
  43009. $core.addMethod(
  43010. $core.method({
  43011. selector: "assignmentInliner",
  43012. protocol: "factory",
  43013. fn: function (){
  43014. var self=this,$self=this;
  43015. return $core.withContext(function($ctx1) {
  43016. var $1;
  43017. $1=$recv($globals.IRAssignmentInliner)._new();
  43018. $recv($1)._translator_(self);
  43019. return $recv($1)._yourself();
  43020. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43021. },
  43022. args: [],
  43023. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43024. referencedClasses: ["IRAssignmentInliner"],
  43025. messageSends: ["translator:", "new", "yourself"]
  43026. }),
  43027. $globals.IRInliner);
  43028. $core.addMethod(
  43029. $core.method({
  43030. selector: "returnInliner",
  43031. protocol: "factory",
  43032. fn: function (){
  43033. var self=this,$self=this;
  43034. return $core.withContext(function($ctx1) {
  43035. var $1;
  43036. $1=$recv($globals.IRReturnInliner)._new();
  43037. $recv($1)._translator_(self);
  43038. return $recv($1)._yourself();
  43039. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43040. },
  43041. args: [],
  43042. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43043. referencedClasses: ["IRReturnInliner"],
  43044. messageSends: ["translator:", "new", "yourself"]
  43045. }),
  43046. $globals.IRInliner);
  43047. $core.addMethod(
  43048. $core.method({
  43049. selector: "sendInliner",
  43050. protocol: "factory",
  43051. fn: function (){
  43052. var self=this,$self=this;
  43053. return $core.withContext(function($ctx1) {
  43054. var $1;
  43055. $1=$recv($globals.IRSendInliner)._new();
  43056. $recv($1)._translator_(self);
  43057. return $recv($1)._yourself();
  43058. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43059. },
  43060. args: [],
  43061. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43062. referencedClasses: ["IRSendInliner"],
  43063. messageSends: ["translator:", "new", "yourself"]
  43064. }),
  43065. $globals.IRInliner);
  43066. $core.addMethod(
  43067. $core.method({
  43068. selector: "shouldInlineAssignment:",
  43069. protocol: "testing",
  43070. fn: function (anIRAssignment){
  43071. var self=this,$self=this;
  43072. return $core.withContext(function($ctx1) {
  43073. var $3,$2,$1;
  43074. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43075. return $core.withContext(function($ctx2) {
  43076. $3=$recv(anIRAssignment)._right();
  43077. $ctx2.sendIdx["right"]=1;
  43078. $2=$recv($3)._isSend();
  43079. return $recv($2)._and_((function(){
  43080. return $core.withContext(function($ctx3) {
  43081. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43083. }));
  43084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43085. }));
  43086. $ctx1.sendIdx["and:"]=1;
  43087. return $1;
  43088. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43089. },
  43090. args: ["anIRAssignment"],
  43091. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43092. referencedClasses: [],
  43093. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43094. }),
  43095. $globals.IRInliner);
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "shouldInlineReturn:",
  43099. protocol: "testing",
  43100. fn: function (anIRReturn){
  43101. var self=this,$self=this;
  43102. return $core.withContext(function($ctx1) {
  43103. var $3,$2,$1;
  43104. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43105. return $core.withContext(function($ctx2) {
  43106. $3=$recv(anIRReturn)._expression();
  43107. $ctx2.sendIdx["expression"]=1;
  43108. $2=$recv($3)._isSend();
  43109. return $recv($2)._and_((function(){
  43110. return $core.withContext(function($ctx3) {
  43111. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43112. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43113. }));
  43114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43115. }));
  43116. $ctx1.sendIdx["and:"]=1;
  43117. return $1;
  43118. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43119. },
  43120. args: ["anIRReturn"],
  43121. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43122. referencedClasses: [],
  43123. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43124. }),
  43125. $globals.IRInliner);
  43126. $core.addMethod(
  43127. $core.method({
  43128. selector: "shouldInlineSend:",
  43129. protocol: "testing",
  43130. fn: function (anIRSend){
  43131. var self=this,$self=this;
  43132. return $core.withContext(function($ctx1) {
  43133. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43134. return $core.withContext(function($ctx2) {
  43135. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43137. }));
  43138. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43139. },
  43140. args: ["anIRSend"],
  43141. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43142. referencedClasses: ["IRSendInliner"],
  43143. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43144. }),
  43145. $globals.IRInliner);
  43146. $core.addMethod(
  43147. $core.method({
  43148. selector: "visitIRAssignment:",
  43149. protocol: "visiting",
  43150. fn: function (anIRAssignment){
  43151. var self=this,$self=this;
  43152. return $core.withContext(function($ctx1) {
  43153. var $1;
  43154. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43155. if($core.assert($1)){
  43156. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43157. } else {
  43158. return (
  43159. $ctx1.supercall = true,
  43160. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43161. $ctx1.supercall = false;
  43162. }
  43163. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43164. },
  43165. args: ["anIRAssignment"],
  43166. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43167. referencedClasses: [],
  43168. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43169. }),
  43170. $globals.IRInliner);
  43171. $core.addMethod(
  43172. $core.method({
  43173. selector: "visitIRNonLocalReturn:",
  43174. protocol: "visiting",
  43175. fn: function (anIRNonLocalReturn){
  43176. var self=this,$self=this;
  43177. var localReturn;
  43178. return $core.withContext(function($ctx1) {
  43179. var $2,$1,$4,$3,$5,$6,$7;
  43180. $2=$recv(anIRNonLocalReturn)._scope();
  43181. $ctx1.sendIdx["scope"]=1;
  43182. $1=$recv($2)._canInlineNonLocalReturns();
  43183. if($core.assert($1)){
  43184. $4=$recv(anIRNonLocalReturn)._scope();
  43185. $ctx1.sendIdx["scope"]=2;
  43186. $3=$recv($4)._methodScope();
  43187. $5=$recv(anIRNonLocalReturn)._scope();
  43188. $ctx1.sendIdx["scope"]=3;
  43189. $recv($3)._removeNonLocalReturn_($5);
  43190. $6=$recv($globals.IRReturn)._new();
  43191. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43192. localReturn=$recv($6)._yourself();
  43193. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43194. return $core.withContext(function($ctx2) {
  43195. return $recv(localReturn)._add_(each);
  43196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43197. }));
  43198. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43199. return $self._visitIRReturn_(localReturn);
  43200. }
  43201. $7=(
  43202. $ctx1.supercall = true,
  43203. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43204. $ctx1.supercall = false;
  43205. return $7;
  43206. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43207. },
  43208. args: ["anIRNonLocalReturn"],
  43209. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  43210. referencedClasses: ["IRReturn"],
  43211. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43212. }),
  43213. $globals.IRInliner);
  43214. $core.addMethod(
  43215. $core.method({
  43216. selector: "visitIRReturn:",
  43217. protocol: "visiting",
  43218. fn: function (anIRReturn){
  43219. var self=this,$self=this;
  43220. return $core.withContext(function($ctx1) {
  43221. var $1;
  43222. $1=$self._shouldInlineReturn_(anIRReturn);
  43223. if($core.assert($1)){
  43224. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43225. } else {
  43226. return (
  43227. $ctx1.supercall = true,
  43228. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43229. $ctx1.supercall = false;
  43230. }
  43231. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43232. },
  43233. args: ["anIRReturn"],
  43234. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43235. referencedClasses: [],
  43236. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43237. }),
  43238. $globals.IRInliner);
  43239. $core.addMethod(
  43240. $core.method({
  43241. selector: "visitIRSend:",
  43242. protocol: "visiting",
  43243. fn: function (anIRSend){
  43244. var self=this,$self=this;
  43245. return $core.withContext(function($ctx1) {
  43246. var $1;
  43247. $1=$self._shouldInlineSend_(anIRSend);
  43248. if($core.assert($1)){
  43249. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43250. } else {
  43251. return (
  43252. $ctx1.supercall = true,
  43253. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43254. $ctx1.supercall = false;
  43255. }
  43256. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43257. },
  43258. args: ["anIRSend"],
  43259. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43260. referencedClasses: [],
  43261. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43262. }),
  43263. $globals.IRInliner);
  43264. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43265. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43266. $core.addMethod(
  43267. $core.method({
  43268. selector: "visitIRInlinedClosure:",
  43269. protocol: "visiting",
  43270. fn: function (anIRInlinedClosure){
  43271. var self=this,$self=this;
  43272. return $core.withContext(function($ctx1) {
  43273. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43274. return $core.withContext(function($ctx2) {
  43275. return $recv($recv(each)._name())._asVariableName();
  43276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43277. })));
  43278. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43279. return self;
  43280. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43281. },
  43282. args: ["anIRInlinedClosure"],
  43283. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43284. referencedClasses: [],
  43285. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43286. }),
  43287. $globals.IRInliningJSTranslator);
  43288. $core.addMethod(
  43289. $core.method({
  43290. selector: "visitIRInlinedIfFalse:",
  43291. protocol: "visiting",
  43292. fn: function (anIRInlinedIfFalse){
  43293. var self=this,$self=this;
  43294. return $core.withContext(function($ctx1) {
  43295. var $1,$2,$4,$3;
  43296. $1=$self._stream();
  43297. $ctx1.sendIdx["stream"]=1;
  43298. $recv($1)._nextPutIf_then_((function(){
  43299. return $core.withContext(function($ctx2) {
  43300. $2=$self._stream();
  43301. $ctx2.sendIdx["stream"]=2;
  43302. $recv($2)._nextPutAll_("!$core.assert(");
  43303. $ctx2.sendIdx["nextPutAll:"]=1;
  43304. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43305. $ctx2.sendIdx["dagChildren"]=1;
  43306. $3=$recv($4)._first();
  43307. $self._visit_($3);
  43308. $ctx2.sendIdx["visit:"]=1;
  43309. return $recv($self._stream())._nextPutAll_(")");
  43310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43311. }),(function(){
  43312. return $core.withContext(function($ctx2) {
  43313. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43315. }));
  43316. return self;
  43317. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43318. },
  43319. args: ["anIRInlinedIfFalse"],
  43320. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse dagChildren last ]",
  43321. referencedClasses: [],
  43322. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43323. }),
  43324. $globals.IRInliningJSTranslator);
  43325. $core.addMethod(
  43326. $core.method({
  43327. selector: "visitIRInlinedIfNilIfNotNil:",
  43328. protocol: "visiting",
  43329. fn: function (anIRInlinedIfNilIfNotNil){
  43330. var self=this,$self=this;
  43331. return $core.withContext(function($ctx1) {
  43332. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43333. $1=$self._stream();
  43334. $ctx1.sendIdx["stream"]=1;
  43335. $recv($1)._nextPutIf_then_else_((function(){
  43336. var recvVarName;
  43337. return $core.withContext(function($ctx2) {
  43338. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43339. $2=$self._stream();
  43340. $ctx2.sendIdx["stream"]=2;
  43341. $4="(".__comma(recvVarName);
  43342. $ctx2.sendIdx[","]=2;
  43343. $3=$recv($4).__comma(" = ");
  43344. $ctx2.sendIdx[","]=1;
  43345. $recv($2)._nextPutAll_($3);
  43346. $ctx2.sendIdx["nextPutAll:"]=1;
  43347. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43348. $ctx2.sendIdx["dagChildren"]=1;
  43349. $5=$recv($6)._first();
  43350. $self._visit_($5);
  43351. $ctx2.sendIdx["visit:"]=1;
  43352. $7=$self._stream();
  43353. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43354. $ctx2.sendIdx[","]=3;
  43355. return $recv($7)._nextPutAll_($8);
  43356. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43357. }),(function(){
  43358. return $core.withContext(function($ctx2) {
  43359. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43360. $ctx2.sendIdx["dagChildren"]=2;
  43361. $9=$recv($10)._second();
  43362. return $self._visit_($9);
  43363. $ctx2.sendIdx["visit:"]=2;
  43364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43365. }),(function(){
  43366. return $core.withContext(function($ctx2) {
  43367. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43369. }));
  43370. return self;
  43371. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43372. },
  43373. args: ["anIRInlinedIfNilIfNotNil"],
  43374. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  43375. referencedClasses: [],
  43376. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43377. }),
  43378. $globals.IRInliningJSTranslator);
  43379. $core.addMethod(
  43380. $core.method({
  43381. selector: "visitIRInlinedIfTrue:",
  43382. protocol: "visiting",
  43383. fn: function (anIRInlinedIfTrue){
  43384. var self=this,$self=this;
  43385. return $core.withContext(function($ctx1) {
  43386. var $1,$2,$4,$3;
  43387. $1=$self._stream();
  43388. $ctx1.sendIdx["stream"]=1;
  43389. $recv($1)._nextPutIf_then_((function(){
  43390. return $core.withContext(function($ctx2) {
  43391. $2=$self._stream();
  43392. $ctx2.sendIdx["stream"]=2;
  43393. $recv($2)._nextPutAll_("$core.assert(");
  43394. $ctx2.sendIdx["nextPutAll:"]=1;
  43395. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43396. $ctx2.sendIdx["dagChildren"]=1;
  43397. $3=$recv($4)._first();
  43398. $self._visit_($3);
  43399. $ctx2.sendIdx["visit:"]=1;
  43400. return $recv($self._stream())._nextPutAll_(")");
  43401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43402. }),(function(){
  43403. return $core.withContext(function($ctx2) {
  43404. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43406. }));
  43407. return self;
  43408. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43409. },
  43410. args: ["anIRInlinedIfTrue"],
  43411. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue dagChildren last ]",
  43412. referencedClasses: [],
  43413. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43414. }),
  43415. $globals.IRInliningJSTranslator);
  43416. $core.addMethod(
  43417. $core.method({
  43418. selector: "visitIRInlinedIfTrueIfFalse:",
  43419. protocol: "visiting",
  43420. fn: function (anIRInlinedIfTrueIfFalse){
  43421. var self=this,$self=this;
  43422. return $core.withContext(function($ctx1) {
  43423. var $1,$2,$4,$3,$6,$5;
  43424. $1=$self._stream();
  43425. $ctx1.sendIdx["stream"]=1;
  43426. $recv($1)._nextPutIf_then_else_((function(){
  43427. return $core.withContext(function($ctx2) {
  43428. $2=$self._stream();
  43429. $ctx2.sendIdx["stream"]=2;
  43430. $recv($2)._nextPutAll_("$core.assert(");
  43431. $ctx2.sendIdx["nextPutAll:"]=1;
  43432. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43433. $ctx2.sendIdx["dagChildren"]=1;
  43434. $3=$recv($4)._first();
  43435. $self._visit_($3);
  43436. $ctx2.sendIdx["visit:"]=1;
  43437. return $recv($self._stream())._nextPutAll_(")");
  43438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43439. }),(function(){
  43440. return $core.withContext(function($ctx2) {
  43441. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43442. $ctx2.sendIdx["dagChildren"]=2;
  43443. $5=$recv($6)._second();
  43444. return $self._visit_($5);
  43445. $ctx2.sendIdx["visit:"]=2;
  43446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43447. }),(function(){
  43448. return $core.withContext(function($ctx2) {
  43449. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43451. }));
  43452. return self;
  43453. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43454. },
  43455. args: ["anIRInlinedIfTrueIfFalse"],
  43456. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]",
  43457. referencedClasses: [],
  43458. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43459. }),
  43460. $globals.IRInliningJSTranslator);
  43461. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43462. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43463. $core.addMethod(
  43464. $core.method({
  43465. selector: "ifFalse:",
  43466. protocol: "inlining",
  43467. fn: function (anIRInstruction){
  43468. var self=this,$self=this;
  43469. return $core.withContext(function($ctx1) {
  43470. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43471. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43472. },
  43473. args: ["anIRInstruction"],
  43474. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43475. referencedClasses: ["IRInlinedIfFalse"],
  43476. messageSends: ["inlinedSend:withBlock:", "new"]
  43477. }),
  43478. $globals.IRSendInliner);
  43479. $core.addMethod(
  43480. $core.method({
  43481. selector: "ifFalse:ifTrue:",
  43482. protocol: "inlining",
  43483. fn: function (anIRInstruction,anotherIRInstruction){
  43484. var self=this,$self=this;
  43485. return $core.withContext(function($ctx1) {
  43486. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43487. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43488. },
  43489. args: ["anIRInstruction", "anotherIRInstruction"],
  43490. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43491. referencedClasses: [],
  43492. messageSends: ["perform:withArguments:"]
  43493. }),
  43494. $globals.IRSendInliner);
  43495. $core.addMethod(
  43496. $core.method({
  43497. selector: "ifNil:",
  43498. protocol: "inlining",
  43499. fn: function (anIRInstruction){
  43500. var self=this,$self=this;
  43501. return $core.withContext(function($ctx1) {
  43502. var $1,$3,$5,$6,$4,$2;
  43503. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43504. $ctx1.sendIdx["new"]=1;
  43505. $3=$recv($globals.IRClosure)._new();
  43506. $ctx1.sendIdx["new"]=2;
  43507. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43508. $5=$recv($globals.IRBlockSequence)._new();
  43509. $recv($5)._add_($recv($self._send())._receiver());
  43510. $6=$recv($5)._yourself();
  43511. $ctx1.sendIdx["yourself"]=1;
  43512. $4=$6;
  43513. $recv($3)._add_($4);
  43514. $ctx1.sendIdx["add:"]=1;
  43515. $2=$recv($3)._yourself();
  43516. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43517. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43518. },
  43519. args: ["anIRInstruction"],
  43520. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  43521. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43522. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43523. }),
  43524. $globals.IRSendInliner);
  43525. $core.addMethod(
  43526. $core.method({
  43527. selector: "ifNil:ifNotNil:",
  43528. protocol: "inlining",
  43529. fn: function (anIRInstruction,anotherIRInstruction){
  43530. var self=this,$self=this;
  43531. return $core.withContext(function($ctx1) {
  43532. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43533. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43534. },
  43535. args: ["anIRInstruction", "anotherIRInstruction"],
  43536. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43537. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43538. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43539. }),
  43540. $globals.IRSendInliner);
  43541. $core.addMethod(
  43542. $core.method({
  43543. selector: "ifNotNil:",
  43544. protocol: "inlining",
  43545. fn: function (anIRInstruction){
  43546. var self=this,$self=this;
  43547. return $core.withContext(function($ctx1) {
  43548. var $1,$3,$5,$6,$4,$2;
  43549. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43550. $ctx1.sendIdx["new"]=1;
  43551. $3=$recv($globals.IRClosure)._new();
  43552. $ctx1.sendIdx["new"]=2;
  43553. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43554. $5=$recv($globals.IRBlockSequence)._new();
  43555. $recv($5)._add_($recv($self._send())._receiver());
  43556. $6=$recv($5)._yourself();
  43557. $ctx1.sendIdx["yourself"]=1;
  43558. $4=$6;
  43559. $recv($3)._add_($4);
  43560. $ctx1.sendIdx["add:"]=1;
  43561. $2=$recv($3)._yourself();
  43562. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43563. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43564. },
  43565. args: ["anIRInstruction"],
  43566. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  43567. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43568. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43569. }),
  43570. $globals.IRSendInliner);
  43571. $core.addMethod(
  43572. $core.method({
  43573. selector: "ifNotNil:ifNil:",
  43574. protocol: "inlining",
  43575. fn: function (anIRInstruction,anotherIRInstruction){
  43576. var self=this,$self=this;
  43577. return $core.withContext(function($ctx1) {
  43578. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43579. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43580. },
  43581. args: ["anIRInstruction", "anotherIRInstruction"],
  43582. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43583. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43584. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43585. }),
  43586. $globals.IRSendInliner);
  43587. $core.addMethod(
  43588. $core.method({
  43589. selector: "ifTrue:",
  43590. protocol: "inlining",
  43591. fn: function (anIRInstruction){
  43592. var self=this,$self=this;
  43593. return $core.withContext(function($ctx1) {
  43594. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43595. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43596. },
  43597. args: ["anIRInstruction"],
  43598. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43599. referencedClasses: ["IRInlinedIfTrue"],
  43600. messageSends: ["inlinedSend:withBlock:", "new"]
  43601. }),
  43602. $globals.IRSendInliner);
  43603. $core.addMethod(
  43604. $core.method({
  43605. selector: "ifTrue:ifFalse:",
  43606. protocol: "inlining",
  43607. fn: function (anIRInstruction,anotherIRInstruction){
  43608. var self=this,$self=this;
  43609. return $core.withContext(function($ctx1) {
  43610. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43611. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43612. },
  43613. args: ["anIRInstruction", "anotherIRInstruction"],
  43614. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43615. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43616. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43617. }),
  43618. $globals.IRSendInliner);
  43619. $core.addMethod(
  43620. $core.method({
  43621. selector: "inlineClosure:",
  43622. protocol: "inlining",
  43623. fn: function (anIRClosure){
  43624. var self=this,$self=this;
  43625. var inlinedClosure,sequence,statements;
  43626. return $core.withContext(function($ctx1) {
  43627. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43628. inlinedClosure=$self._inlinedClosure();
  43629. $1=inlinedClosure;
  43630. $2=$recv(anIRClosure)._scope();
  43631. $ctx1.sendIdx["scope"]=1;
  43632. $recv($1)._scope_($2);
  43633. $ctx1.sendIdx["scope:"]=1;
  43634. $recv($1)._parent_($recv(anIRClosure)._parent());
  43635. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43636. return $core.withContext(function($ctx2) {
  43637. return $recv(inlinedClosure)._add_(each);
  43638. $ctx2.sendIdx["add:"]=1;
  43639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43640. }));
  43641. $ctx1.sendIdx["do:"]=1;
  43642. sequence=$self._inlinedSequence();
  43643. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43644. return $core.withContext(function($ctx2) {
  43645. $3=inlinedClosure;
  43646. $5=$recv($globals.IRTempDeclaration)._new();
  43647. $ctx2.sendIdx["new"]=1;
  43648. $recv($5)._name_(each);
  43649. $ctx2.sendIdx["name:"]=1;
  43650. $6=$recv($5)._yourself();
  43651. $ctx2.sendIdx["yourself"]=1;
  43652. $4=$6;
  43653. $recv($3)._add_($4);
  43654. $ctx2.sendIdx["add:"]=2;
  43655. $7=sequence;
  43656. $9=$recv($globals.IRAssignment)._new();
  43657. $ctx2.sendIdx["new"]=2;
  43658. $11=$recv($globals.IRVariable)._new();
  43659. $ctx2.sendIdx["new"]=3;
  43660. $13=$recv($globals.AliasVar)._new();
  43661. $ctx2.sendIdx["new"]=4;
  43662. $14=$recv(inlinedClosure)._scope();
  43663. $ctx2.sendIdx["scope"]=2;
  43664. $recv($13)._scope_($14);
  43665. $ctx2.sendIdx["scope:"]=2;
  43666. $recv($13)._name_(each);
  43667. $ctx2.sendIdx["name:"]=2;
  43668. $15=$recv($13)._yourself();
  43669. $ctx2.sendIdx["yourself"]=2;
  43670. $12=$15;
  43671. $10=$recv($11)._variable_($12);
  43672. $ctx2.sendIdx["variable:"]=1;
  43673. $recv($9)._add_($10);
  43674. $ctx2.sendIdx["add:"]=4;
  43675. $17=$recv($globals.IRVariable)._new();
  43676. $ctx2.sendIdx["new"]=5;
  43677. $19=$recv($globals.AliasVar)._new();
  43678. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43679. $recv($19)._name_("$receiver");
  43680. $20=$recv($19)._yourself();
  43681. $ctx2.sendIdx["yourself"]=3;
  43682. $18=$20;
  43683. $16=$recv($17)._variable_($18);
  43684. $recv($9)._add_($16);
  43685. $ctx2.sendIdx["add:"]=5;
  43686. $8=$recv($9)._yourself();
  43687. return $recv($7)._add_($8);
  43688. $ctx2.sendIdx["add:"]=3;
  43689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43690. }));
  43691. $ctx1.sendIdx["do:"]=2;
  43692. $recv(inlinedClosure)._add_(sequence);
  43693. $ctx1.sendIdx["add:"]=6;
  43694. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43695. $recv(statements)._ifNotEmpty_((function(){
  43696. return $core.withContext(function($ctx2) {
  43697. $recv($recv(statements)._allButLast())._do_((function(each){
  43698. return $core.withContext(function($ctx3) {
  43699. return $recv(sequence)._add_(each);
  43700. $ctx3.sendIdx["add:"]=7;
  43701. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43702. }));
  43703. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43705. }));
  43706. return inlinedClosure;
  43707. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43708. },
  43709. args: ["anIRClosure"],
  43710. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures change local returns into result value itself\x22\x0a\x09\x09sequence add: statements last asInlinedBlockResult ].\x0a\x0a\x09^ inlinedClosure",
  43711. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43712. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43713. }),
  43714. $globals.IRSendInliner);
  43715. $core.addMethod(
  43716. $core.method({
  43717. selector: "inlineSend:",
  43718. protocol: "inlining",
  43719. fn: function (anIRSend){
  43720. var self=this,$self=this;
  43721. return $core.withContext(function($ctx1) {
  43722. var $2,$1;
  43723. $self._send_(anIRSend);
  43724. $2=$self._send();
  43725. $ctx1.sendIdx["send"]=1;
  43726. $1=$recv($2)._selector();
  43727. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43728. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43729. },
  43730. args: ["anIRSend"],
  43731. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43732. referencedClasses: [],
  43733. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43734. }),
  43735. $globals.IRSendInliner);
  43736. $core.addMethod(
  43737. $core.method({
  43738. selector: "inlineSend:andReplace:",
  43739. protocol: "private",
  43740. fn: function (anIRSend,anIRInstruction){
  43741. var self=this,$self=this;
  43742. return $core.withContext(function($ctx1) {
  43743. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43744. return $self._inlineSend_(anIRSend);
  43745. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43746. },
  43747. args: ["anIRSend", "anIRInstruction"],
  43748. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43749. referencedClasses: [],
  43750. messageSends: ["replaceWith:", "inlineSend:"]
  43751. }),
  43752. $globals.IRSendInliner);
  43753. $core.addMethod(
  43754. $core.method({
  43755. selector: "inlinedClosure",
  43756. protocol: "factory",
  43757. fn: function (){
  43758. var self=this,$self=this;
  43759. return $core.withContext(function($ctx1) {
  43760. return $recv($globals.IRInlinedClosure)._new();
  43761. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43762. },
  43763. args: [],
  43764. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43765. referencedClasses: ["IRInlinedClosure"],
  43766. messageSends: ["new"]
  43767. }),
  43768. $globals.IRSendInliner);
  43769. $core.addMethod(
  43770. $core.method({
  43771. selector: "inlinedSend:withBlock:",
  43772. protocol: "private",
  43773. fn: function (inlinedSend,anIRInstruction){
  43774. var self=this,$self=this;
  43775. var inlinedClosure;
  43776. return $core.withContext(function($ctx1) {
  43777. var $1,$2,$4,$3,$5;
  43778. $1=$recv(anIRInstruction)._isClosure();
  43779. if(!$core.assert($1)){
  43780. $self._inliningError_("Message argument should be a block");
  43781. $ctx1.sendIdx["inliningError:"]=1;
  43782. }
  43783. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43784. if(!$core.assert($2)){
  43785. $self._inliningError_("Inlined block should have zero argument");
  43786. }
  43787. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43788. $4=$self._send();
  43789. $ctx1.sendIdx["send"]=1;
  43790. $3=$recv($4)._receiver();
  43791. $recv(inlinedSend)._add_($3);
  43792. $ctx1.sendIdx["add:"]=1;
  43793. $recv(inlinedSend)._add_(inlinedClosure);
  43794. $recv($self._send())._replaceWith_(inlinedSend);
  43795. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43796. $ctx1.sendIdx["internalVariables"]=1;
  43797. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43798. return inlinedSend;
  43799. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43800. },
  43801. args: ["inlinedSend", "anIRInstruction"],
  43802. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  43803. referencedClasses: [],
  43804. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43805. }),
  43806. $globals.IRSendInliner);
  43807. $core.addMethod(
  43808. $core.method({
  43809. selector: "inlinedSend:withBlock:withBlock:",
  43810. protocol: "private",
  43811. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43812. var self=this,$self=this;
  43813. var inlinedClosure1,inlinedClosure2;
  43814. return $core.withContext(function($ctx1) {
  43815. var $1,$2,$3,$4,$6,$5,$7;
  43816. $1=$recv(anIRInstruction)._isClosure();
  43817. $ctx1.sendIdx["isClosure"]=1;
  43818. if(!$core.assert($1)){
  43819. $self._inliningError_("Message argument should be a block");
  43820. $ctx1.sendIdx["inliningError:"]=1;
  43821. }
  43822. $2=$recv(anotherIRInstruction)._isClosure();
  43823. if(!$core.assert($2)){
  43824. $self._inliningError_("Message argument should be a block");
  43825. }
  43826. $3=$self._translator();
  43827. $ctx1.sendIdx["translator"]=1;
  43828. $4=$self._inlineClosure_(anIRInstruction);
  43829. $ctx1.sendIdx["inlineClosure:"]=1;
  43830. inlinedClosure1=$recv($3)._visit_($4);
  43831. $ctx1.sendIdx["visit:"]=1;
  43832. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43833. $6=$self._send();
  43834. $ctx1.sendIdx["send"]=1;
  43835. $5=$recv($6)._receiver();
  43836. $recv(inlinedSend)._add_($5);
  43837. $ctx1.sendIdx["add:"]=1;
  43838. $recv(inlinedSend)._add_(inlinedClosure1);
  43839. $ctx1.sendIdx["add:"]=2;
  43840. $recv(inlinedSend)._add_(inlinedClosure2);
  43841. $recv($self._send())._replaceWith_(inlinedSend);
  43842. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43843. $ctx1.sendIdx["internalVariables"]=1;
  43844. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43845. return inlinedSend;
  43846. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43847. },
  43848. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43849. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  43850. referencedClasses: [],
  43851. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43852. }),
  43853. $globals.IRSendInliner);
  43854. $core.addMethod(
  43855. $core.method({
  43856. selector: "inlinedSequence",
  43857. protocol: "factory",
  43858. fn: function (){
  43859. var self=this,$self=this;
  43860. return $core.withContext(function($ctx1) {
  43861. return $recv($globals.IRInlinedSequence)._new();
  43862. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43863. },
  43864. args: [],
  43865. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43866. referencedClasses: ["IRInlinedSequence"],
  43867. messageSends: ["new"]
  43868. }),
  43869. $globals.IRSendInliner);
  43870. $core.addMethod(
  43871. $core.method({
  43872. selector: "inliningError:",
  43873. protocol: "error handling",
  43874. fn: function (aString){
  43875. var self=this,$self=this;
  43876. return $core.withContext(function($ctx1) {
  43877. $recv($globals.InliningError)._signal_(aString);
  43878. return self;
  43879. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43880. },
  43881. args: ["aString"],
  43882. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43883. referencedClasses: ["InliningError"],
  43884. messageSends: ["signal:"]
  43885. }),
  43886. $globals.IRSendInliner);
  43887. $core.addMethod(
  43888. $core.method({
  43889. selector: "send",
  43890. protocol: "accessing",
  43891. fn: function (){
  43892. var self=this,$self=this;
  43893. return $self["@send"];
  43894. },
  43895. args: [],
  43896. source: "send\x0a\x09^ send",
  43897. referencedClasses: [],
  43898. messageSends: []
  43899. }),
  43900. $globals.IRSendInliner);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "send:",
  43904. protocol: "accessing",
  43905. fn: function (anIRSend){
  43906. var self=this,$self=this;
  43907. $self["@send"]=anIRSend;
  43908. return self;
  43909. },
  43910. args: ["anIRSend"],
  43911. source: "send: anIRSend\x0a\x09send := anIRSend",
  43912. referencedClasses: [],
  43913. messageSends: []
  43914. }),
  43915. $globals.IRSendInliner);
  43916. $core.addMethod(
  43917. $core.method({
  43918. selector: "translator",
  43919. protocol: "accessing",
  43920. fn: function (){
  43921. var self=this,$self=this;
  43922. return $self["@translator"];
  43923. },
  43924. args: [],
  43925. source: "translator\x0a\x09^ translator",
  43926. referencedClasses: [],
  43927. messageSends: []
  43928. }),
  43929. $globals.IRSendInliner);
  43930. $core.addMethod(
  43931. $core.method({
  43932. selector: "translator:",
  43933. protocol: "accessing",
  43934. fn: function (anASTTranslator){
  43935. var self=this,$self=this;
  43936. $self["@translator"]=anASTTranslator;
  43937. return self;
  43938. },
  43939. args: ["anASTTranslator"],
  43940. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43941. referencedClasses: [],
  43942. messageSends: []
  43943. }),
  43944. $globals.IRSendInliner);
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "inlinedSelectors",
  43948. protocol: "accessing",
  43949. fn: function (){
  43950. var self=this,$self=this;
  43951. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43952. },
  43953. args: [],
  43954. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43955. referencedClasses: [],
  43956. messageSends: []
  43957. }),
  43958. $globals.IRSendInliner.a$cls);
  43959. $core.addMethod(
  43960. $core.method({
  43961. selector: "shouldInline:",
  43962. protocol: "accessing",
  43963. fn: function (anIRSend){
  43964. var self=this,$self=this;
  43965. return $core.withContext(function($ctx1) {
  43966. var $1;
  43967. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43968. if(!$core.assert($1)){
  43969. return false;
  43970. }
  43971. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43972. return $core.withContext(function($ctx2) {
  43973. return $recv(each)._isClosure();
  43974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43975. }));
  43976. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43977. },
  43978. args: ["anIRSend"],
  43979. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43980. referencedClasses: [],
  43981. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43982. }),
  43983. $globals.IRSendInliner.a$cls);
  43984. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43985. $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};";
  43986. $core.addMethod(
  43987. $core.method({
  43988. selector: "inlineAssignment:",
  43989. protocol: "inlining",
  43990. fn: function (anIRAssignment){
  43991. var self=this,$self=this;
  43992. return $core.withContext(function($ctx1) {
  43993. $self._target_($recv(anIRAssignment)._left());
  43994. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43995. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43996. },
  43997. args: ["anIRAssignment"],
  43998. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43999. referencedClasses: [],
  44000. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44001. }),
  44002. $globals.IRAssignmentInliner);
  44003. $core.addMethod(
  44004. $core.method({
  44005. selector: "inlineClosure:",
  44006. protocol: "inlining",
  44007. fn: function (anIRClosure){
  44008. var self=this,$self=this;
  44009. var closure,sequence,statements;
  44010. return $core.withContext(function($ctx1) {
  44011. var $1,$2,$3,$5,$4;
  44012. closure=(
  44013. $ctx1.supercall = true,
  44014. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44015. $ctx1.supercall = false;
  44016. sequence=$recv(closure)._sequence();
  44017. statements=$recv(sequence)._dagChildren();
  44018. $recv(statements)._ifNotEmpty_((function(){
  44019. var final;
  44020. return $core.withContext(function($ctx2) {
  44021. final=$recv(statements)._last();
  44022. $1=$recv(final)._yieldsValue();
  44023. if($core.assert($1)){
  44024. $2=sequence;
  44025. $3=final;
  44026. $5=$recv($globals.IRAssignment)._new();
  44027. $recv($5)._add_($self._target());
  44028. $ctx2.sendIdx["add:"]=1;
  44029. $recv($5)._add_($recv(final)._copy());
  44030. $4=$recv($5)._yourself();
  44031. return $recv($2)._replace_with_($3,$4);
  44032. }
  44033. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44034. }));
  44035. return closure;
  44036. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44037. },
  44038. args: ["anIRClosure"],
  44039. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  44040. referencedClasses: ["IRAssignment"],
  44041. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44042. }),
  44043. $globals.IRAssignmentInliner);
  44044. $core.addMethod(
  44045. $core.method({
  44046. selector: "target",
  44047. protocol: "accessing",
  44048. fn: function (){
  44049. var self=this,$self=this;
  44050. return $self["@target"];
  44051. },
  44052. args: [],
  44053. source: "target\x0a\x09^ target",
  44054. referencedClasses: [],
  44055. messageSends: []
  44056. }),
  44057. $globals.IRAssignmentInliner);
  44058. $core.addMethod(
  44059. $core.method({
  44060. selector: "target:",
  44061. protocol: "accessing",
  44062. fn: function (anObject){
  44063. var self=this,$self=this;
  44064. $self["@target"]=anObject;
  44065. return self;
  44066. },
  44067. args: ["anObject"],
  44068. source: "target: anObject\x0a\x09target := anObject",
  44069. referencedClasses: [],
  44070. messageSends: []
  44071. }),
  44072. $globals.IRAssignmentInliner);
  44073. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44074. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44075. $core.addMethod(
  44076. $core.method({
  44077. selector: "inlineClosure:",
  44078. protocol: "inlining",
  44079. fn: function (anIRClosure){
  44080. var self=this,$self=this;
  44081. var closure,sequence,statements;
  44082. return $core.withContext(function($ctx1) {
  44083. var $1,$2,$3,$5,$4;
  44084. closure=(
  44085. $ctx1.supercall = true,
  44086. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44087. $ctx1.supercall = false;
  44088. sequence=$recv(closure)._sequence();
  44089. statements=$recv(sequence)._dagChildren();
  44090. $recv(statements)._ifNotEmpty_((function(){
  44091. var final;
  44092. return $core.withContext(function($ctx2) {
  44093. final=$recv(statements)._last();
  44094. $1=$recv(final)._yieldsValue();
  44095. if($core.assert($1)){
  44096. $2=sequence;
  44097. $3=final;
  44098. $5=$recv($globals.IRReturn)._new();
  44099. $recv($5)._add_($recv(final)._copy());
  44100. $4=$recv($5)._yourself();
  44101. return $recv($2)._replace_with_($3,$4);
  44102. }
  44103. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44104. }));
  44105. return closure;
  44106. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44107. },
  44108. args: ["anIRClosure"],
  44109. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  44110. referencedClasses: ["IRReturn"],
  44111. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44112. }),
  44113. $globals.IRReturnInliner);
  44114. $core.addMethod(
  44115. $core.method({
  44116. selector: "inlineReturn:",
  44117. protocol: "inlining",
  44118. fn: function (anIRReturn){
  44119. var self=this,$self=this;
  44120. return $core.withContext(function($ctx1) {
  44121. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44122. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44123. },
  44124. args: ["anIRReturn"],
  44125. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44126. referencedClasses: [],
  44127. messageSends: ["inlineSend:andReplace:", "expression"]
  44128. }),
  44129. $globals.IRReturnInliner);
  44130. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44131. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44132. $core.addMethod(
  44133. $core.method({
  44134. selector: "inliner",
  44135. protocol: "compiling",
  44136. fn: function (){
  44137. var self=this,$self=this;
  44138. return $core.withContext(function($ctx1) {
  44139. return $recv($globals.IRInliner)._new();
  44140. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44141. },
  44142. args: [],
  44143. source: "inliner\x0a\x09^ IRInliner new",
  44144. referencedClasses: ["IRInliner"],
  44145. messageSends: ["new"]
  44146. }),
  44147. $globals.InliningCodeGenerator);
  44148. $core.addMethod(
  44149. $core.method({
  44150. selector: "irTranslatorClass",
  44151. protocol: "compiling",
  44152. fn: function (){
  44153. var self=this,$self=this;
  44154. return $globals.IRInliningJSTranslator;
  44155. },
  44156. args: [],
  44157. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44158. referencedClasses: ["IRInliningJSTranslator"],
  44159. messageSends: []
  44160. }),
  44161. $globals.InliningCodeGenerator);
  44162. $core.addMethod(
  44163. $core.method({
  44164. selector: "preInliner",
  44165. protocol: "compiling",
  44166. fn: function (){
  44167. var self=this,$self=this;
  44168. return $core.withContext(function($ctx1) {
  44169. return $recv($globals.ASTPreInliner)._new();
  44170. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44171. },
  44172. args: [],
  44173. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44174. referencedClasses: ["ASTPreInliner"],
  44175. messageSends: ["new"]
  44176. }),
  44177. $globals.InliningCodeGenerator);
  44178. $core.addMethod(
  44179. $core.method({
  44180. selector: "transformersDictionary",
  44181. protocol: "compiling",
  44182. fn: function (){
  44183. var self=this,$self=this;
  44184. return $core.withContext(function($ctx1) {
  44185. var $1,$2,$receiver;
  44186. $1=$self["@transformersDictionary"];
  44187. if(($receiver = $1) == null || $receiver.a$nil){
  44188. $2=(
  44189. $ctx1.supercall = true,
  44190. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44191. $ctx1.supercall = false;
  44192. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44193. $ctx1.sendIdx["at:put:"]=1;
  44194. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44195. $ctx1.sendIdx["at:put:"]=2;
  44196. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44197. $self["@transformersDictionary"]=$recv($2)._yourself();
  44198. return $self["@transformersDictionary"];
  44199. } else {
  44200. return $1;
  44201. }
  44202. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44203. },
  44204. args: [],
  44205. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  44206. referencedClasses: [],
  44207. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44208. }),
  44209. $globals.InliningCodeGenerator);
  44210. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44211. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44212. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44213. $core.addMethod(
  44214. $core.method({
  44215. selector: "visitSendNode:",
  44216. protocol: "visiting",
  44217. fn: function (aNode){
  44218. var self=this,$self=this;
  44219. return $core.withContext(function($ctx1) {
  44220. var $1,$2,$3,$receiver;
  44221. $1=$recv(aNode)._superSend();
  44222. if(!$core.assert($1)){
  44223. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44224. if($core.assert($2)){
  44225. $recv(aNode)._shouldBeInlined_(true);
  44226. $3=$recv(aNode)._receiver();
  44227. if(($receiver = $3) == null || $receiver.a$nil){
  44228. $3;
  44229. } else {
  44230. var receiver;
  44231. receiver=$receiver;
  44232. $recv(receiver)._shouldBeAliased_(true);
  44233. }
  44234. }
  44235. }
  44236. (
  44237. $ctx1.supercall = true,
  44238. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44239. $ctx1.supercall = false;
  44240. return self;
  44241. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44242. },
  44243. args: ["aNode"],
  44244. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09super visitSendNode: aNode",
  44245. referencedClasses: ["IRSendInliner"],
  44246. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44247. }),
  44248. $globals.InliningSemanticAnalyzer);
  44249. $core.addMethod(
  44250. $core.method({
  44251. selector: "asInlinedBlockResult",
  44252. protocol: "*Compiler-Inlining",
  44253. fn: function (){
  44254. var self=this,$self=this;
  44255. return $core.withContext(function($ctx1) {
  44256. return $self._expression();
  44257. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44258. },
  44259. args: [],
  44260. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44261. referencedClasses: [],
  44262. messageSends: ["expression"]
  44263. }),
  44264. $globals.IRBlockReturn);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "asInlinedBlockResult",
  44268. protocol: "*Compiler-Inlining",
  44269. fn: function (){
  44270. var self=this,$self=this;
  44271. return self;
  44272. },
  44273. args: [],
  44274. source: "asInlinedBlockResult\x0a\x09^ self",
  44275. referencedClasses: [],
  44276. messageSends: []
  44277. }),
  44278. $globals.IRInstruction);
  44279. });
  44280. define('amber_core/Compiler-Interpreter',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  44281. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44282. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44283. var $pkg = $core.addPackage("Compiler-Interpreter");
  44284. $pkg.innerEval = function (expr) { return eval(expr); };
  44285. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  44286. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44287. $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`).";
  44288. $core.addMethod(
  44289. $core.method({
  44290. selector: "applyTo:arguments:",
  44291. protocol: "evaluating",
  44292. fn: function (anObject,aCollection){
  44293. var self=this,$self=this;
  44294. return $core.withContext(function($ctx1) {
  44295. $self._interpreterError();
  44296. return self;
  44297. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44298. },
  44299. args: ["anObject", "aCollection"],
  44300. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44301. referencedClasses: [],
  44302. messageSends: ["interpreterError"]
  44303. }),
  44304. $globals.AIBlockClosure);
  44305. $core.addMethod(
  44306. $core.method({
  44307. selector: "compiledSource",
  44308. protocol: "accessing",
  44309. fn: function (){
  44310. var self=this,$self=this;
  44311. return "[ AST Block closure ]";
  44312. },
  44313. args: [],
  44314. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44315. referencedClasses: [],
  44316. messageSends: []
  44317. }),
  44318. $globals.AIBlockClosure);
  44319. $core.addMethod(
  44320. $core.method({
  44321. selector: "currySelf",
  44322. protocol: "converting",
  44323. fn: function (){
  44324. var self=this,$self=this;
  44325. return $core.withContext(function($ctx1) {
  44326. $self._interpreterError();
  44327. return self;
  44328. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44329. },
  44330. args: [],
  44331. source: "currySelf\x0a\x09self interpreterError",
  44332. referencedClasses: [],
  44333. messageSends: ["interpreterError"]
  44334. }),
  44335. $globals.AIBlockClosure);
  44336. $core.addMethod(
  44337. $core.method({
  44338. selector: "initializeWithContext:node:",
  44339. protocol: "initialization",
  44340. fn: function (aContext,aNode){
  44341. var self=this,$self=this;
  44342. $self["@node"]=aNode;
  44343. $self["@outerContext"]=aContext;
  44344. return self;
  44345. },
  44346. args: ["aContext", "aNode"],
  44347. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44348. referencedClasses: [],
  44349. messageSends: []
  44350. }),
  44351. $globals.AIBlockClosure);
  44352. $core.addMethod(
  44353. $core.method({
  44354. selector: "interpreterError",
  44355. protocol: "error handling",
  44356. fn: function (){
  44357. var self=this,$self=this;
  44358. return $core.withContext(function($ctx1) {
  44359. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44360. return self;
  44361. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44362. },
  44363. args: [],
  44364. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44365. referencedClasses: ["ASTInterpreterError"],
  44366. messageSends: ["signal:"]
  44367. }),
  44368. $globals.AIBlockClosure);
  44369. $core.addMethod(
  44370. $core.method({
  44371. selector: "numArgs",
  44372. protocol: "accessing",
  44373. fn: function (){
  44374. var self=this,$self=this;
  44375. return $core.withContext(function($ctx1) {
  44376. return $recv($recv($self["@node"])._temps())._size();
  44377. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44378. },
  44379. args: [],
  44380. source: "numArgs\x0a\x09^ node temps size",
  44381. referencedClasses: [],
  44382. messageSends: ["size", "temps"]
  44383. }),
  44384. $globals.AIBlockClosure);
  44385. $core.addMethod(
  44386. $core.method({
  44387. selector: "value",
  44388. protocol: "evaluating",
  44389. fn: function (){
  44390. var self=this,$self=this;
  44391. return $core.withContext(function($ctx1) {
  44392. return $self._valueWithPossibleArguments_([]);
  44393. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44394. },
  44395. args: [],
  44396. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44397. referencedClasses: [],
  44398. messageSends: ["valueWithPossibleArguments:"]
  44399. }),
  44400. $globals.AIBlockClosure);
  44401. $core.addMethod(
  44402. $core.method({
  44403. selector: "value:",
  44404. protocol: "evaluating",
  44405. fn: function (anArgument){
  44406. var self=this,$self=this;
  44407. return $core.withContext(function($ctx1) {
  44408. return $self._valueWithPossibleArguments_([anArgument]);
  44409. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44410. },
  44411. args: ["anArgument"],
  44412. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44413. referencedClasses: [],
  44414. messageSends: ["valueWithPossibleArguments:"]
  44415. }),
  44416. $globals.AIBlockClosure);
  44417. $core.addMethod(
  44418. $core.method({
  44419. selector: "value:value:",
  44420. protocol: "evaluating",
  44421. fn: function (firstArgument,secondArgument){
  44422. var self=this,$self=this;
  44423. return $core.withContext(function($ctx1) {
  44424. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44425. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44426. },
  44427. args: ["firstArgument", "secondArgument"],
  44428. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44429. referencedClasses: [],
  44430. messageSends: ["valueWithPossibleArguments:"]
  44431. }),
  44432. $globals.AIBlockClosure);
  44433. $core.addMethod(
  44434. $core.method({
  44435. selector: "value:value:value:",
  44436. protocol: "evaluating",
  44437. fn: function (firstArgument,secondArgument,thirdArgument){
  44438. var self=this,$self=this;
  44439. return $core.withContext(function($ctx1) {
  44440. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44441. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44442. },
  44443. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44444. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44445. referencedClasses: [],
  44446. messageSends: ["valueWithPossibleArguments:"]
  44447. }),
  44448. $globals.AIBlockClosure);
  44449. $core.addMethod(
  44450. $core.method({
  44451. selector: "valueWithPossibleArguments:",
  44452. protocol: "evaluating",
  44453. fn: function (aCollection){
  44454. var self=this,$self=this;
  44455. var context,sequenceNode;
  44456. return $core.withContext(function($ctx1) {
  44457. var $1,$2,$3;
  44458. context=$recv($self["@outerContext"])._newInnerContext();
  44459. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44460. $recv($1)._parent_(nil);
  44461. sequenceNode=$recv($1)._yourself();
  44462. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44463. return $core.withContext(function($ctx2) {
  44464. return $recv(context)._defineLocal_(each);
  44465. $ctx2.sendIdx["defineLocal:"]=1;
  44466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44467. }));
  44468. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44469. return $core.withContext(function($ctx2) {
  44470. $recv(context)._defineLocal_(each);
  44471. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44472. return nil;
  44473. })));
  44474. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44475. }));
  44476. $2=$recv(context)._interpreter();
  44477. $ctx1.sendIdx["interpreter"]=1;
  44478. $recv($2)._node_(sequenceNode);
  44479. $recv($2)._enterNode();
  44480. $recv($2)._proceed();
  44481. $3=$recv($self["@outerContext"])._interpreter();
  44482. $ctx1.sendIdx["interpreter"]=2;
  44483. $recv($3)._setNonLocalReturnFromContext_(context);
  44484. return $recv($recv(context)._interpreter())._pop();
  44485. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44486. },
  44487. args: ["aCollection"],
  44488. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node dagChildren first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  44489. referencedClasses: [],
  44490. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44491. }),
  44492. $globals.AIBlockClosure);
  44493. $core.addMethod(
  44494. $core.method({
  44495. selector: "forContext:node:",
  44496. protocol: "instance creation",
  44497. fn: function (aContext,aNode){
  44498. var self=this,$self=this;
  44499. return $core.withContext(function($ctx1) {
  44500. var $1;
  44501. $1=$self._new();
  44502. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44503. return $recv($1)._yourself();
  44504. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44505. },
  44506. args: ["aContext", "aNode"],
  44507. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44508. referencedClasses: [],
  44509. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44510. }),
  44511. $globals.AIBlockClosure.a$cls);
  44512. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44513. $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)";
  44514. $core.addMethod(
  44515. $core.method({
  44516. selector: "arguments",
  44517. protocol: "interpreting",
  44518. fn: function (){
  44519. var self=this,$self=this;
  44520. return $core.withContext(function($ctx1) {
  44521. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44522. return $core.withContext(function($ctx2) {
  44523. return $self._localAt_ifAbsent_(each,(function(){
  44524. return $core.withContext(function($ctx3) {
  44525. return $self._error_("Argument not in context");
  44526. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44527. }));
  44528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44529. }));
  44530. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44531. },
  44532. args: [],
  44533. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44534. referencedClasses: [],
  44535. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44536. }),
  44537. $globals.AIContext);
  44538. $core.addMethod(
  44539. $core.method({
  44540. selector: "ast",
  44541. protocol: "interpreting",
  44542. fn: function (){
  44543. var self=this,$self=this;
  44544. return $core.withContext(function($ctx1) {
  44545. var $1,$2,$3,$receiver;
  44546. $1=$self._isBlockContext();
  44547. if($core.assert($1)){
  44548. $2=$self._outerContext();
  44549. if(($receiver = $2) == null || $receiver.a$nil){
  44550. return $2;
  44551. } else {
  44552. var context;
  44553. context=$receiver;
  44554. return $recv(context)._ast();
  44555. }
  44556. }
  44557. $3=$self["@ast"];
  44558. if(($receiver = $3) == null || $receiver.a$nil){
  44559. $self._initializeAST();
  44560. } else {
  44561. $3;
  44562. }
  44563. return $self["@ast"];
  44564. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44565. },
  44566. args: [],
  44567. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44568. referencedClasses: [],
  44569. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44570. }),
  44571. $globals.AIContext);
  44572. $core.addMethod(
  44573. $core.method({
  44574. selector: "basicLocalAt:",
  44575. protocol: "private",
  44576. fn: function (aString){
  44577. var self=this,$self=this;
  44578. return $core.withContext(function($ctx1) {
  44579. return $recv($self._locals())._at_(aString);
  44580. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44581. },
  44582. args: ["aString"],
  44583. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44584. referencedClasses: [],
  44585. messageSends: ["at:", "locals"]
  44586. }),
  44587. $globals.AIContext);
  44588. $core.addMethod(
  44589. $core.method({
  44590. selector: "basicLocalAt:put:",
  44591. protocol: "private",
  44592. fn: function (aString,anObject){
  44593. var self=this,$self=this;
  44594. return $core.withContext(function($ctx1) {
  44595. $recv($self._locals())._at_put_(aString,anObject);
  44596. return self;
  44597. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44598. },
  44599. args: ["aString", "anObject"],
  44600. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44601. referencedClasses: [],
  44602. messageSends: ["at:put:", "locals"]
  44603. }),
  44604. $globals.AIContext);
  44605. $core.addMethod(
  44606. $core.method({
  44607. selector: "basicReceiver",
  44608. protocol: "interpreting",
  44609. fn: function (){
  44610. var self=this,$self=this;
  44611. return $core.withContext(function($ctx1) {
  44612. return $self._localAt_("self");
  44613. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44614. },
  44615. args: [],
  44616. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44617. referencedClasses: [],
  44618. messageSends: ["localAt:"]
  44619. }),
  44620. $globals.AIContext);
  44621. $core.addMethod(
  44622. $core.method({
  44623. selector: "defineLocal:",
  44624. protocol: "accessing",
  44625. fn: function (aString){
  44626. var self=this,$self=this;
  44627. return $core.withContext(function($ctx1) {
  44628. $recv($self._locals())._at_put_(aString,nil);
  44629. return self;
  44630. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44631. },
  44632. args: ["aString"],
  44633. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44634. referencedClasses: [],
  44635. messageSends: ["at:put:", "locals"]
  44636. }),
  44637. $globals.AIContext);
  44638. $core.addMethod(
  44639. $core.method({
  44640. selector: "evaluate:on:",
  44641. protocol: "evaluating",
  44642. fn: function (aString,anEvaluator){
  44643. var self=this,$self=this;
  44644. return $core.withContext(function($ctx1) {
  44645. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44646. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44647. },
  44648. args: ["aString", "anEvaluator"],
  44649. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44650. referencedClasses: [],
  44651. messageSends: ["evaluate:context:"]
  44652. }),
  44653. $globals.AIContext);
  44654. $core.addMethod(
  44655. $core.method({
  44656. selector: "evaluateNode:",
  44657. protocol: "evaluating",
  44658. fn: function (aNode){
  44659. var self=this,$self=this;
  44660. return $core.withContext(function($ctx1) {
  44661. var $1;
  44662. $1=$recv($globals.ASTInterpreter)._new();
  44663. $recv($1)._context_(self);
  44664. $recv($1)._node_(aNode);
  44665. $recv($1)._enterNode();
  44666. $recv($1)._proceed();
  44667. return $recv($1)._result();
  44668. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44669. },
  44670. args: ["aNode"],
  44671. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44672. referencedClasses: ["ASTInterpreter"],
  44673. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44674. }),
  44675. $globals.AIContext);
  44676. $core.addMethod(
  44677. $core.method({
  44678. selector: "evaluatedSelector",
  44679. protocol: "accessing",
  44680. fn: function (){
  44681. var self=this,$self=this;
  44682. return $self["@evaluatedSelector"];
  44683. },
  44684. args: [],
  44685. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44686. referencedClasses: [],
  44687. messageSends: []
  44688. }),
  44689. $globals.AIContext);
  44690. $core.addMethod(
  44691. $core.method({
  44692. selector: "evaluatedSelector:",
  44693. protocol: "accessing",
  44694. fn: function (aString){
  44695. var self=this,$self=this;
  44696. $self["@evaluatedSelector"]=aString;
  44697. return self;
  44698. },
  44699. args: ["aString"],
  44700. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44701. referencedClasses: [],
  44702. messageSends: []
  44703. }),
  44704. $globals.AIContext);
  44705. $core.addMethod(
  44706. $core.method({
  44707. selector: "index",
  44708. protocol: "accessing",
  44709. fn: function (){
  44710. var self=this,$self=this;
  44711. return $core.withContext(function($ctx1) {
  44712. var $1,$receiver;
  44713. $1=$self["@index"];
  44714. if(($receiver = $1) == null || $receiver.a$nil){
  44715. return (0);
  44716. } else {
  44717. return $1;
  44718. }
  44719. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44720. },
  44721. args: [],
  44722. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44723. referencedClasses: [],
  44724. messageSends: ["ifNil:"]
  44725. }),
  44726. $globals.AIContext);
  44727. $core.addMethod(
  44728. $core.method({
  44729. selector: "index:",
  44730. protocol: "accessing",
  44731. fn: function (anInteger){
  44732. var self=this,$self=this;
  44733. $self["@index"]=anInteger;
  44734. return self;
  44735. },
  44736. args: ["anInteger"],
  44737. source: "index: anInteger\x0a\x09index := anInteger",
  44738. referencedClasses: [],
  44739. messageSends: []
  44740. }),
  44741. $globals.AIContext);
  44742. $core.addMethod(
  44743. $core.method({
  44744. selector: "initializeAST",
  44745. protocol: "initialization",
  44746. fn: function (){
  44747. var self=this,$self=this;
  44748. return $core.withContext(function($ctx1) {
  44749. var $1;
  44750. $1=$self._method();
  44751. $ctx1.sendIdx["method"]=1;
  44752. $self["@ast"]=$recv($1)._ast();
  44753. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44754. return self;
  44755. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44756. },
  44757. args: [],
  44758. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44759. referencedClasses: ["SemanticAnalyzer"],
  44760. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44761. }),
  44762. $globals.AIContext);
  44763. $core.addMethod(
  44764. $core.method({
  44765. selector: "initializeFromMethodContext:",
  44766. protocol: "initialization",
  44767. fn: function (aMethodContext){
  44768. var self=this,$self=this;
  44769. return $core.withContext(function($ctx1) {
  44770. var $1,$2,$3,$receiver;
  44771. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44772. $self._index_($recv(aMethodContext)._index());
  44773. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44774. $self._receiver_($recv(aMethodContext)._receiver());
  44775. $self._supercall_($recv(aMethodContext)._supercall());
  44776. $self._selector_($recv(aMethodContext)._selector());
  44777. $1=$recv(aMethodContext)._outerContext();
  44778. $ctx1.sendIdx["outerContext"]=1;
  44779. if(($receiver = $1) == null || $receiver.a$nil){
  44780. $1;
  44781. } else {
  44782. var outer;
  44783. outer=$receiver;
  44784. $2=$recv(outer)._methodContext();
  44785. if(($receiver = $2) == null || $receiver.a$nil){
  44786. $2;
  44787. } else {
  44788. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44789. }
  44790. $3=$recv(aMethodContext)._locals();
  44791. $ctx1.sendIdx["locals"]=1;
  44792. $recv($3)._keysAndValuesDo_((function(key,value){
  44793. return $core.withContext(function($ctx2) {
  44794. return $recv($self._locals())._at_put_(key,value);
  44795. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44796. }));
  44797. }
  44798. return self;
  44799. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44800. },
  44801. args: ["aMethodContext"],
  44802. 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 ] ]",
  44803. referencedClasses: [],
  44804. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44805. }),
  44806. $globals.AIContext);
  44807. $core.addMethod(
  44808. $core.method({
  44809. selector: "initializeInterpreter",
  44810. protocol: "initialization",
  44811. fn: function (){
  44812. var self=this,$self=this;
  44813. return $core.withContext(function($ctx1) {
  44814. var $1,$2,$receiver;
  44815. $1=$recv($globals.ASTInterpreter)._new();
  44816. $recv($1)._context_(self);
  44817. $self["@interpreter"]=$recv($1)._yourself();
  44818. $2=$self._innerContext();
  44819. if(($receiver = $2) == null || $receiver.a$nil){
  44820. $2;
  44821. } else {
  44822. $self._setupInterpreter_($self["@interpreter"]);
  44823. }
  44824. return self;
  44825. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44826. },
  44827. args: [],
  44828. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44829. referencedClasses: ["ASTInterpreter"],
  44830. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44831. }),
  44832. $globals.AIContext);
  44833. $core.addMethod(
  44834. $core.method({
  44835. selector: "initializeLocals",
  44836. protocol: "initialization",
  44837. fn: function (){
  44838. var self=this,$self=this;
  44839. return $core.withContext(function($ctx1) {
  44840. $self["@locals"]=$recv($globals.Dictionary)._new();
  44841. $recv($self["@locals"])._at_put_("thisContext",self);
  44842. return self;
  44843. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44844. },
  44845. args: [],
  44846. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44847. referencedClasses: ["Dictionary"],
  44848. messageSends: ["new", "at:put:"]
  44849. }),
  44850. $globals.AIContext);
  44851. $core.addMethod(
  44852. $core.method({
  44853. selector: "innerContext",
  44854. protocol: "accessing",
  44855. fn: function (){
  44856. var self=this,$self=this;
  44857. return $self["@innerContext"];
  44858. },
  44859. args: [],
  44860. source: "innerContext\x0a\x09^ innerContext",
  44861. referencedClasses: [],
  44862. messageSends: []
  44863. }),
  44864. $globals.AIContext);
  44865. $core.addMethod(
  44866. $core.method({
  44867. selector: "innerContext:",
  44868. protocol: "accessing",
  44869. fn: function (anAIContext){
  44870. var self=this,$self=this;
  44871. $self["@innerContext"]=anAIContext;
  44872. return self;
  44873. },
  44874. args: ["anAIContext"],
  44875. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44876. referencedClasses: [],
  44877. messageSends: []
  44878. }),
  44879. $globals.AIContext);
  44880. $core.addMethod(
  44881. $core.method({
  44882. selector: "interpreter",
  44883. protocol: "interpreting",
  44884. fn: function (){
  44885. var self=this,$self=this;
  44886. return $core.withContext(function($ctx1) {
  44887. var $1,$receiver;
  44888. $1=$self["@interpreter"];
  44889. if(($receiver = $1) == null || $receiver.a$nil){
  44890. $self._initializeInterpreter();
  44891. } else {
  44892. $1;
  44893. }
  44894. return $self["@interpreter"];
  44895. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44896. },
  44897. args: [],
  44898. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44899. referencedClasses: [],
  44900. messageSends: ["ifNil:", "initializeInterpreter"]
  44901. }),
  44902. $globals.AIContext);
  44903. $core.addMethod(
  44904. $core.method({
  44905. selector: "interpreter:",
  44906. protocol: "interpreting",
  44907. fn: function (anInterpreter){
  44908. var self=this,$self=this;
  44909. $self["@interpreter"]=anInterpreter;
  44910. return self;
  44911. },
  44912. args: ["anInterpreter"],
  44913. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44914. referencedClasses: [],
  44915. messageSends: []
  44916. }),
  44917. $globals.AIContext);
  44918. $core.addMethod(
  44919. $core.method({
  44920. selector: "isTopContext",
  44921. protocol: "testing",
  44922. fn: function (){
  44923. var self=this,$self=this;
  44924. return $core.withContext(function($ctx1) {
  44925. return $recv($self._innerContext())._isNil();
  44926. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44927. },
  44928. args: [],
  44929. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44930. referencedClasses: [],
  44931. messageSends: ["isNil", "innerContext"]
  44932. }),
  44933. $globals.AIContext);
  44934. $core.addMethod(
  44935. $core.method({
  44936. selector: "localAt:",
  44937. protocol: "accessing",
  44938. fn: function (aString){
  44939. var self=this,$self=this;
  44940. var context;
  44941. return $core.withContext(function($ctx1) {
  44942. context=$self._lookupContextForLocal_(aString);
  44943. return $recv(context)._basicLocalAt_(aString);
  44944. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44945. },
  44946. args: ["aString"],
  44947. 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",
  44948. referencedClasses: [],
  44949. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44950. }),
  44951. $globals.AIContext);
  44952. $core.addMethod(
  44953. $core.method({
  44954. selector: "localAt:ifAbsent:",
  44955. protocol: "accessing",
  44956. fn: function (aString,aBlock){
  44957. var self=this,$self=this;
  44958. var context;
  44959. return $core.withContext(function($ctx1) {
  44960. var $early={};
  44961. try {
  44962. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44963. return $core.withContext(function($ctx2) {
  44964. throw $early=[$recv(aBlock)._value()];
  44965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44966. }));
  44967. return $recv(context)._basicLocalAt_(aString);
  44968. }
  44969. catch(e) {if(e===$early)return e[0]; throw e}
  44970. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44971. },
  44972. args: ["aString", "aBlock"],
  44973. 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",
  44974. referencedClasses: [],
  44975. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44976. }),
  44977. $globals.AIContext);
  44978. $core.addMethod(
  44979. $core.method({
  44980. selector: "localAt:put:",
  44981. protocol: "accessing",
  44982. fn: function (aString,anObject){
  44983. var self=this,$self=this;
  44984. var context;
  44985. return $core.withContext(function($ctx1) {
  44986. context=$self._lookupContextForLocal_(aString);
  44987. $recv(context)._basicLocalAt_put_(aString,anObject);
  44988. return self;
  44989. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44990. },
  44991. args: ["aString", "anObject"],
  44992. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44993. referencedClasses: [],
  44994. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44995. }),
  44996. $globals.AIContext);
  44997. $core.addMethod(
  44998. $core.method({
  44999. selector: "locals",
  45000. protocol: "accessing",
  45001. fn: function (){
  45002. var self=this,$self=this;
  45003. return $core.withContext(function($ctx1) {
  45004. var $1,$receiver;
  45005. $1=$self["@locals"];
  45006. if(($receiver = $1) == null || $receiver.a$nil){
  45007. $self._initializeLocals();
  45008. } else {
  45009. $1;
  45010. }
  45011. return $self["@locals"];
  45012. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45013. },
  45014. args: [],
  45015. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45016. referencedClasses: [],
  45017. messageSends: ["ifNil:", "initializeLocals"]
  45018. }),
  45019. $globals.AIContext);
  45020. $core.addMethod(
  45021. $core.method({
  45022. selector: "lookupContextForLocal:",
  45023. protocol: "private",
  45024. fn: function (aString){
  45025. var self=this,$self=this;
  45026. return $core.withContext(function($ctx1) {
  45027. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45028. return $core.withContext(function($ctx2) {
  45029. return $self._variableNotFound();
  45030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45031. }));
  45032. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45033. },
  45034. args: ["aString"],
  45035. 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 ]",
  45036. referencedClasses: [],
  45037. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45038. }),
  45039. $globals.AIContext);
  45040. $core.addMethod(
  45041. $core.method({
  45042. selector: "lookupContextForLocal:ifNone:",
  45043. protocol: "private",
  45044. fn: function (aString,aBlock){
  45045. var self=this,$self=this;
  45046. return $core.withContext(function($ctx1) {
  45047. var $1;
  45048. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45049. return self;
  45050. }),(function(){
  45051. return $core.withContext(function($ctx2) {
  45052. $1=$self._outerContext();
  45053. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45054. return $core.withContext(function($ctx3) {
  45055. return $recv(context)._lookupContextForLocal_(aString);
  45056. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45057. }));
  45058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45059. }));
  45060. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45061. },
  45062. args: ["aString", "aBlock"],
  45063. 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 ] ]",
  45064. referencedClasses: [],
  45065. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45066. }),
  45067. $globals.AIContext);
  45068. $core.addMethod(
  45069. $core.method({
  45070. selector: "newInnerContext",
  45071. protocol: "factory",
  45072. fn: function (){
  45073. var self=this,$self=this;
  45074. return $core.withContext(function($ctx1) {
  45075. var $1;
  45076. $1=$recv($self._class())._new();
  45077. $recv($1)._outerContext_(self);
  45078. return $recv($1)._yourself();
  45079. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45080. },
  45081. args: [],
  45082. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45083. referencedClasses: [],
  45084. messageSends: ["outerContext:", "new", "class", "yourself"]
  45085. }),
  45086. $globals.AIContext);
  45087. $core.addMethod(
  45088. $core.method({
  45089. selector: "outerContext",
  45090. protocol: "accessing",
  45091. fn: function (){
  45092. var self=this,$self=this;
  45093. return $self["@outerContext"];
  45094. },
  45095. args: [],
  45096. source: "outerContext\x0a\x09^ outerContext",
  45097. referencedClasses: [],
  45098. messageSends: []
  45099. }),
  45100. $globals.AIContext);
  45101. $core.addMethod(
  45102. $core.method({
  45103. selector: "outerContext:",
  45104. protocol: "accessing",
  45105. fn: function (anAIContext){
  45106. var self=this,$self=this;
  45107. return $core.withContext(function($ctx1) {
  45108. var $1,$receiver;
  45109. $self["@outerContext"]=anAIContext;
  45110. $1=$self["@outerContext"];
  45111. if(($receiver = $1) == null || $receiver.a$nil){
  45112. $1;
  45113. } else {
  45114. var context;
  45115. context=$receiver;
  45116. $recv(context)._innerContext_(self);
  45117. }
  45118. return self;
  45119. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45120. },
  45121. args: ["anAIContext"],
  45122. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45123. referencedClasses: [],
  45124. messageSends: ["ifNotNil:", "innerContext:"]
  45125. }),
  45126. $globals.AIContext);
  45127. $core.addMethod(
  45128. $core.method({
  45129. selector: "receiver:",
  45130. protocol: "interpreting",
  45131. fn: function (anObject){
  45132. var self=this,$self=this;
  45133. return $core.withContext(function($ctx1) {
  45134. $recv($self._locals())._at_put_("self",anObject);
  45135. return self;
  45136. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45137. },
  45138. args: ["anObject"],
  45139. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45140. referencedClasses: [],
  45141. messageSends: ["at:put:", "locals"]
  45142. }),
  45143. $globals.AIContext);
  45144. $core.addMethod(
  45145. $core.method({
  45146. selector: "selector",
  45147. protocol: "accessing",
  45148. fn: function (){
  45149. var self=this,$self=this;
  45150. return $self["@selector"];
  45151. },
  45152. args: [],
  45153. source: "selector\x0a\x09^ selector",
  45154. referencedClasses: [],
  45155. messageSends: []
  45156. }),
  45157. $globals.AIContext);
  45158. $core.addMethod(
  45159. $core.method({
  45160. selector: "selector:",
  45161. protocol: "accessing",
  45162. fn: function (aString){
  45163. var self=this,$self=this;
  45164. $self["@selector"]=aString;
  45165. return self;
  45166. },
  45167. args: ["aString"],
  45168. source: "selector: aString\x0a\x09selector := aString",
  45169. referencedClasses: [],
  45170. messageSends: []
  45171. }),
  45172. $globals.AIContext);
  45173. $core.addMethod(
  45174. $core.method({
  45175. selector: "sendIndexAt:",
  45176. protocol: "accessing",
  45177. fn: function (aString){
  45178. var self=this,$self=this;
  45179. return $core.withContext(function($ctx1) {
  45180. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45181. return (0);
  45182. }));
  45183. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45184. },
  45185. args: ["aString"],
  45186. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45187. referencedClasses: [],
  45188. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45189. }),
  45190. $globals.AIContext);
  45191. $core.addMethod(
  45192. $core.method({
  45193. selector: "sendIndexes",
  45194. protocol: "accessing",
  45195. fn: function (){
  45196. var self=this,$self=this;
  45197. return $core.withContext(function($ctx1) {
  45198. var $1,$receiver;
  45199. $1=$self["@sendIndexes"];
  45200. if(($receiver = $1) == null || $receiver.a$nil){
  45201. return $recv($globals.Dictionary)._new();
  45202. } else {
  45203. return $1;
  45204. }
  45205. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45206. },
  45207. args: [],
  45208. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45209. referencedClasses: ["Dictionary"],
  45210. messageSends: ["ifNil:", "new"]
  45211. }),
  45212. $globals.AIContext);
  45213. $core.addMethod(
  45214. $core.method({
  45215. selector: "sendIndexes:",
  45216. protocol: "accessing",
  45217. fn: function (aDictionary){
  45218. var self=this,$self=this;
  45219. $self["@sendIndexes"]=aDictionary;
  45220. return self;
  45221. },
  45222. args: ["aDictionary"],
  45223. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45224. referencedClasses: [],
  45225. messageSends: []
  45226. }),
  45227. $globals.AIContext);
  45228. $core.addMethod(
  45229. $core.method({
  45230. selector: "setupInterpreter:",
  45231. protocol: "interpreting",
  45232. fn: function (anInterpreter){
  45233. var self=this,$self=this;
  45234. var currentNode;
  45235. return $core.withContext(function($ctx1) {
  45236. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45237. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45238. $2=$self._evaluatedSelector();
  45239. $ctx1.sendIdx["evaluatedSelector"]=1;
  45240. $recv($1)._selector_($2);
  45241. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45242. $3=$self._ast();
  45243. $ctx1.sendIdx["ast"]=1;
  45244. $recv($1)._visit_($3);
  45245. currentNode=$recv($1)._currentNode();
  45246. $4=$recv($self._ast())._sequenceNode();
  45247. if(($receiver = $4) == null || $receiver.a$nil){
  45248. $4;
  45249. } else {
  45250. var sequence;
  45251. sequence=$receiver;
  45252. $recv($recv(sequence)._temps())._do_((function(each){
  45253. return $core.withContext(function($ctx2) {
  45254. return $self._defineLocal_(each);
  45255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45256. }));
  45257. $ctx1.sendIdx["do:"]=1;
  45258. }
  45259. $recv(anInterpreter)._node_(currentNode);
  45260. $7=$self._innerContext();
  45261. $ctx1.sendIdx["innerContext"]=1;
  45262. $6=$recv($7)._arguments();
  45263. $5=$recv($6)._reversed();
  45264. $recv($5)._do_((function(each){
  45265. return $core.withContext(function($ctx2) {
  45266. return $recv(anInterpreter)._push_(each);
  45267. $ctx2.sendIdx["push:"]=1;
  45268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45269. }));
  45270. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45271. return self;
  45272. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45273. },
  45274. args: ["anInterpreter"],
  45275. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09index: (self sendIndexAt: self evaluatedSelector);\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  45276. referencedClasses: ["ASTPCNodeVisitor"],
  45277. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45278. }),
  45279. $globals.AIContext);
  45280. $core.addMethod(
  45281. $core.method({
  45282. selector: "supercall",
  45283. protocol: "interpreting",
  45284. fn: function (){
  45285. var self=this,$self=this;
  45286. return $core.withContext(function($ctx1) {
  45287. var $1,$receiver;
  45288. $1=$self["@supercall"];
  45289. if(($receiver = $1) == null || $receiver.a$nil){
  45290. return false;
  45291. } else {
  45292. return $1;
  45293. }
  45294. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45295. },
  45296. args: [],
  45297. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45298. referencedClasses: [],
  45299. messageSends: ["ifNil:"]
  45300. }),
  45301. $globals.AIContext);
  45302. $core.addMethod(
  45303. $core.method({
  45304. selector: "supercall:",
  45305. protocol: "interpreting",
  45306. fn: function (aBoolean){
  45307. var self=this,$self=this;
  45308. $self["@supercall"]=aBoolean;
  45309. return self;
  45310. },
  45311. args: ["aBoolean"],
  45312. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45313. referencedClasses: [],
  45314. messageSends: []
  45315. }),
  45316. $globals.AIContext);
  45317. $core.addMethod(
  45318. $core.method({
  45319. selector: "variableNotFound",
  45320. protocol: "error handling",
  45321. fn: function (){
  45322. var self=this,$self=this;
  45323. return $core.withContext(function($ctx1) {
  45324. $self._error_("Variable missing");
  45325. return self;
  45326. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45327. },
  45328. args: [],
  45329. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45330. referencedClasses: [],
  45331. messageSends: ["error:"]
  45332. }),
  45333. $globals.AIContext);
  45334. $core.addMethod(
  45335. $core.method({
  45336. selector: "fromMethodContext:",
  45337. protocol: "instance creation",
  45338. fn: function (aMethodContext){
  45339. var self=this,$self=this;
  45340. return $core.withContext(function($ctx1) {
  45341. var $1;
  45342. $1=$self._new();
  45343. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45344. return $recv($1)._yourself();
  45345. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45346. },
  45347. args: ["aMethodContext"],
  45348. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45349. referencedClasses: [],
  45350. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45351. }),
  45352. $globals.AIContext.a$cls);
  45353. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45354. $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.";
  45355. $core.addMethod(
  45356. $core.method({
  45357. selector: "context",
  45358. protocol: "accessing",
  45359. fn: function (){
  45360. var self=this,$self=this;
  45361. return $self["@context"];
  45362. },
  45363. args: [],
  45364. source: "context\x0a\x09^ context",
  45365. referencedClasses: [],
  45366. messageSends: []
  45367. }),
  45368. $globals.AISemanticAnalyzer);
  45369. $core.addMethod(
  45370. $core.method({
  45371. selector: "context:",
  45372. protocol: "accessing",
  45373. fn: function (anAIContext){
  45374. var self=this,$self=this;
  45375. $self["@context"]=anAIContext;
  45376. return self;
  45377. },
  45378. args: ["anAIContext"],
  45379. source: "context: anAIContext\x0a\x09context := anAIContext",
  45380. referencedClasses: [],
  45381. messageSends: []
  45382. }),
  45383. $globals.AISemanticAnalyzer);
  45384. $core.addMethod(
  45385. $core.method({
  45386. selector: "visitVariableNode:",
  45387. protocol: "visiting",
  45388. fn: function (aNode){
  45389. var self=this,$self=this;
  45390. return $core.withContext(function($ctx1) {
  45391. var $1;
  45392. var $early={};
  45393. try {
  45394. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45395. return $core.withContext(function($ctx2) {
  45396. $1=(
  45397. $ctx2.supercall = true,
  45398. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45399. $ctx2.supercall = false;
  45400. throw $early=[$1];
  45401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45402. }));
  45403. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45404. return self;
  45405. }
  45406. catch(e) {if(e===$early)return e[0]; throw e}
  45407. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45408. },
  45409. args: ["aNode"],
  45410. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45411. referencedClasses: ["ASTContextVar"],
  45412. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45413. }),
  45414. $globals.AISemanticAnalyzer);
  45415. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45416. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45417. $core.addMethod(
  45418. $core.method({
  45419. selector: "context",
  45420. protocol: "accessing",
  45421. fn: function (){
  45422. var self=this,$self=this;
  45423. return $self["@context"];
  45424. },
  45425. args: [],
  45426. source: "context\x0a\x09^ context",
  45427. referencedClasses: [],
  45428. messageSends: []
  45429. }),
  45430. $globals.ASTContextVar);
  45431. $core.addMethod(
  45432. $core.method({
  45433. selector: "context:",
  45434. protocol: "accessing",
  45435. fn: function (anObject){
  45436. var self=this,$self=this;
  45437. $self["@context"]=anObject;
  45438. return self;
  45439. },
  45440. args: ["anObject"],
  45441. source: "context: anObject\x0a\x09context := anObject",
  45442. referencedClasses: [],
  45443. messageSends: []
  45444. }),
  45445. $globals.ASTContextVar);
  45446. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45447. $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.";
  45448. $core.addMethod(
  45449. $core.method({
  45450. selector: "atEnd",
  45451. protocol: "testing",
  45452. fn: function (){
  45453. var self=this,$self=this;
  45454. return $core.withContext(function($ctx1) {
  45455. var $1,$receiver;
  45456. $1=$self._context();
  45457. $ctx1.sendIdx["context"]=1;
  45458. if(($receiver = $1) == null || $receiver.a$nil){
  45459. return true;
  45460. } else {
  45461. $1;
  45462. }
  45463. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45464. return $core.withContext(function($ctx2) {
  45465. return $recv($self._context())._isTopContext();
  45466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45467. }));
  45468. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45469. },
  45470. args: [],
  45471. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45472. referencedClasses: [],
  45473. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45474. }),
  45475. $globals.ASTDebugger);
  45476. $core.addMethod(
  45477. $core.method({
  45478. selector: "context",
  45479. protocol: "accessing",
  45480. fn: function (){
  45481. var self=this,$self=this;
  45482. return $self["@context"];
  45483. },
  45484. args: [],
  45485. source: "context\x0a\x09^ context",
  45486. referencedClasses: [],
  45487. messageSends: []
  45488. }),
  45489. $globals.ASTDebugger);
  45490. $core.addMethod(
  45491. $core.method({
  45492. selector: "context:",
  45493. protocol: "accessing",
  45494. fn: function (aContext){
  45495. var self=this,$self=this;
  45496. $self["@context"]=aContext;
  45497. return self;
  45498. },
  45499. args: ["aContext"],
  45500. source: "context: aContext\x0a\x09context := aContext",
  45501. referencedClasses: [],
  45502. messageSends: []
  45503. }),
  45504. $globals.ASTDebugger);
  45505. $core.addMethod(
  45506. $core.method({
  45507. selector: "flushInnerContexts",
  45508. protocol: "actions",
  45509. fn: function (){
  45510. var self=this,$self=this;
  45511. return $core.withContext(function($ctx1) {
  45512. var $1,$receiver;
  45513. $1=$self._context();
  45514. if(($receiver = $1) == null || $receiver.a$nil){
  45515. $1;
  45516. } else {
  45517. var cxt;
  45518. cxt=$receiver;
  45519. $recv(cxt)._innerContext_(nil);
  45520. }
  45521. return self;
  45522. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45523. },
  45524. args: [],
  45525. 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 ]",
  45526. referencedClasses: [],
  45527. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45528. }),
  45529. $globals.ASTDebugger);
  45530. $core.addMethod(
  45531. $core.method({
  45532. selector: "interpreter",
  45533. protocol: "accessing",
  45534. fn: function (){
  45535. var self=this,$self=this;
  45536. return $core.withContext(function($ctx1) {
  45537. var $1,$receiver;
  45538. $1=$self._context();
  45539. if(($receiver = $1) == null || $receiver.a$nil){
  45540. return $1;
  45541. } else {
  45542. var ctx;
  45543. ctx=$receiver;
  45544. return $recv(ctx)._interpreter();
  45545. }
  45546. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45547. },
  45548. args: [],
  45549. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45550. referencedClasses: [],
  45551. messageSends: ["ifNotNil:", "context", "interpreter"]
  45552. }),
  45553. $globals.ASTDebugger);
  45554. $core.addMethod(
  45555. $core.method({
  45556. selector: "method",
  45557. protocol: "accessing",
  45558. fn: function (){
  45559. var self=this,$self=this;
  45560. return $core.withContext(function($ctx1) {
  45561. return $recv($self._context())._method();
  45562. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45563. },
  45564. args: [],
  45565. source: "method\x0a\x09^ self context method",
  45566. referencedClasses: [],
  45567. messageSends: ["method", "context"]
  45568. }),
  45569. $globals.ASTDebugger);
  45570. $core.addMethod(
  45571. $core.method({
  45572. selector: "node",
  45573. protocol: "accessing",
  45574. fn: function (){
  45575. var self=this,$self=this;
  45576. return $core.withContext(function($ctx1) {
  45577. var $1,$receiver;
  45578. $1=$self._interpreter();
  45579. $ctx1.sendIdx["interpreter"]=1;
  45580. if(($receiver = $1) == null || $receiver.a$nil){
  45581. return $1;
  45582. } else {
  45583. return $recv($self._interpreter())._node();
  45584. }
  45585. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45586. },
  45587. args: [],
  45588. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45589. referencedClasses: [],
  45590. messageSends: ["ifNotNil:", "interpreter", "node"]
  45591. }),
  45592. $globals.ASTDebugger);
  45593. $core.addMethod(
  45594. $core.method({
  45595. selector: "onStep",
  45596. protocol: "private",
  45597. fn: function (){
  45598. var self=this,$self=this;
  45599. return $core.withContext(function($ctx1) {
  45600. var $1,$3,$2,$4,$6,$5,$receiver;
  45601. $1=$self._interpreter();
  45602. $ctx1.sendIdx["interpreter"]=1;
  45603. $self["@result"]=$recv($1)._result();
  45604. $3=$self._interpreter();
  45605. $ctx1.sendIdx["interpreter"]=2;
  45606. $2=$recv($3)._atEnd();
  45607. $ctx1.sendIdx["atEnd"]=1;
  45608. if($core.assert($2)){
  45609. $4=$recv($self._context())._outerContext();
  45610. if(($receiver = $4) == null || $receiver.a$nil){
  45611. $4;
  45612. } else {
  45613. var outerContext;
  45614. outerContext=$receiver;
  45615. $self._context_(outerContext);
  45616. }
  45617. $6=$self._interpreter();
  45618. $ctx1.sendIdx["interpreter"]=3;
  45619. $5=$recv($6)._atEnd();
  45620. if(!$core.assert($5)){
  45621. $recv($self._interpreter())._skip();
  45622. }
  45623. }
  45624. $self._flushInnerContexts();
  45625. return self;
  45626. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45627. },
  45628. args: [],
  45629. 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",
  45630. referencedClasses: [],
  45631. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45632. }),
  45633. $globals.ASTDebugger);
  45634. $core.addMethod(
  45635. $core.method({
  45636. selector: "proceed",
  45637. protocol: "stepping",
  45638. fn: function (){
  45639. var self=this,$self=this;
  45640. return $core.withContext(function($ctx1) {
  45641. $recv((function(){
  45642. return $core.withContext(function($ctx2) {
  45643. return $self._atEnd();
  45644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45645. }))._whileFalse_((function(){
  45646. return $core.withContext(function($ctx2) {
  45647. return $self._stepOver();
  45648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45649. }));
  45650. return self;
  45651. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45652. },
  45653. args: [],
  45654. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45655. referencedClasses: [],
  45656. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45657. }),
  45658. $globals.ASTDebugger);
  45659. $core.addMethod(
  45660. $core.method({
  45661. selector: "restart",
  45662. protocol: "stepping",
  45663. fn: function (){
  45664. var self=this,$self=this;
  45665. return $core.withContext(function($ctx1) {
  45666. $recv($self._interpreter())._restart();
  45667. $self._flushInnerContexts();
  45668. return self;
  45669. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45670. },
  45671. args: [],
  45672. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45673. referencedClasses: [],
  45674. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45675. }),
  45676. $globals.ASTDebugger);
  45677. $core.addMethod(
  45678. $core.method({
  45679. selector: "result",
  45680. protocol: "accessing",
  45681. fn: function (){
  45682. var self=this,$self=this;
  45683. return $self["@result"];
  45684. },
  45685. args: [],
  45686. source: "result\x0a\x09^ result",
  45687. referencedClasses: [],
  45688. messageSends: []
  45689. }),
  45690. $globals.ASTDebugger);
  45691. $core.addMethod(
  45692. $core.method({
  45693. selector: "stepInto",
  45694. protocol: "stepping",
  45695. fn: function (){
  45696. var self=this,$self=this;
  45697. return $core.withContext(function($ctx1) {
  45698. $self._shouldBeImplemented();
  45699. return self;
  45700. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45701. },
  45702. args: [],
  45703. source: "stepInto\x0a\x09self shouldBeImplemented",
  45704. referencedClasses: [],
  45705. messageSends: ["shouldBeImplemented"]
  45706. }),
  45707. $globals.ASTDebugger);
  45708. $core.addMethod(
  45709. $core.method({
  45710. selector: "stepOver",
  45711. protocol: "stepping",
  45712. fn: function (){
  45713. var self=this,$self=this;
  45714. return $core.withContext(function($ctx1) {
  45715. var $1,$2;
  45716. $1=$recv($self._context())._isTopContext();
  45717. if($core.assert($1)){
  45718. $recv($self._interpreter())._stepOver();
  45719. } else {
  45720. $2=$self._interpreter();
  45721. $ctx1.sendIdx["interpreter"]=1;
  45722. $recv($2)._skip();
  45723. }
  45724. $self._onStep();
  45725. return self;
  45726. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45727. },
  45728. args: [],
  45729. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45730. referencedClasses: [],
  45731. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45732. }),
  45733. $globals.ASTDebugger);
  45734. $core.addMethod(
  45735. $core.method({
  45736. selector: "context:",
  45737. protocol: "instance creation",
  45738. fn: function (aContext){
  45739. var self=this,$self=this;
  45740. return $core.withContext(function($ctx1) {
  45741. var $1;
  45742. $1=$self._new();
  45743. $recv($1)._context_(aContext);
  45744. return $recv($1)._yourself();
  45745. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45746. },
  45747. args: ["aContext"],
  45748. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45749. referencedClasses: [],
  45750. messageSends: ["context:", "new", "yourself"]
  45751. }),
  45752. $globals.ASTDebugger.a$cls);
  45753. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45754. $core.addMethod(
  45755. $core.method({
  45756. selector: "interpreter",
  45757. protocol: "accessing",
  45758. fn: function (){
  45759. var self=this,$self=this;
  45760. return $self["@interpreter"];
  45761. },
  45762. args: [],
  45763. source: "interpreter\x0a\x09^ interpreter",
  45764. referencedClasses: [],
  45765. messageSends: []
  45766. }),
  45767. $globals.ASTEnterNode);
  45768. $core.addMethod(
  45769. $core.method({
  45770. selector: "interpreter:",
  45771. protocol: "accessing",
  45772. fn: function (anObject){
  45773. var self=this,$self=this;
  45774. $self["@interpreter"]=anObject;
  45775. return self;
  45776. },
  45777. args: ["anObject"],
  45778. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45779. referencedClasses: [],
  45780. messageSends: []
  45781. }),
  45782. $globals.ASTEnterNode);
  45783. $core.addMethod(
  45784. $core.method({
  45785. selector: "visitBlockNode:",
  45786. protocol: "visiting",
  45787. fn: function (aNode){
  45788. var self=this,$self=this;
  45789. return aNode;
  45790. },
  45791. args: ["aNode"],
  45792. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45793. referencedClasses: [],
  45794. messageSends: []
  45795. }),
  45796. $globals.ASTEnterNode);
  45797. $core.addMethod(
  45798. $core.method({
  45799. selector: "visitDagNode:",
  45800. protocol: "visiting",
  45801. fn: function (aNode){
  45802. var self=this,$self=this;
  45803. return $core.withContext(function($ctx1) {
  45804. var $early={};
  45805. try {
  45806. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45807. throw $early=[aNode];
  45808. }),(function(nodes){
  45809. return $core.withContext(function($ctx2) {
  45810. throw $early=[$self._visit_($recv(nodes)._first())];
  45811. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45812. }));
  45813. return self;
  45814. }
  45815. catch(e) {if(e===$early)return e[0]; throw e}
  45816. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45817. },
  45818. args: ["aNode"],
  45819. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45820. referencedClasses: [],
  45821. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45822. }),
  45823. $globals.ASTEnterNode);
  45824. $core.addMethod(
  45825. $core.method({
  45826. selector: "visitSequenceNode:",
  45827. protocol: "visiting",
  45828. fn: function (aNode){
  45829. var self=this,$self=this;
  45830. return $core.withContext(function($ctx1) {
  45831. var $1;
  45832. $recv($recv(aNode)._temps())._do_((function(each){
  45833. return $core.withContext(function($ctx2) {
  45834. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45836. }));
  45837. $1=(
  45838. $ctx1.supercall = true,
  45839. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45840. $ctx1.supercall = false;
  45841. return $1;
  45842. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45843. },
  45844. args: ["aNode"],
  45845. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45846. referencedClasses: [],
  45847. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45848. }),
  45849. $globals.ASTEnterNode);
  45850. $core.addMethod(
  45851. $core.method({
  45852. selector: "on:",
  45853. protocol: "instance creation",
  45854. fn: function (anInterpreter){
  45855. var self=this,$self=this;
  45856. return $core.withContext(function($ctx1) {
  45857. var $1;
  45858. $1=$self._new();
  45859. $recv($1)._interpreter_(anInterpreter);
  45860. return $recv($1)._yourself();
  45861. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45862. },
  45863. args: ["anInterpreter"],
  45864. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45865. referencedClasses: [],
  45866. messageSends: ["interpreter:", "new", "yourself"]
  45867. }),
  45868. $globals.ASTEnterNode.a$cls);
  45869. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45870. $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";
  45871. $core.addMethod(
  45872. $core.method({
  45873. selector: "assign:to:",
  45874. protocol: "private",
  45875. fn: function (aNode,anObject){
  45876. var self=this,$self=this;
  45877. return $core.withContext(function($ctx1) {
  45878. var $1,$3,$2,$4;
  45879. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45880. if($core.assert($1)){
  45881. $3=$self._context();
  45882. $ctx1.sendIdx["context"]=1;
  45883. $2=$recv($3)._receiver();
  45884. $4=$recv(aNode)._value();
  45885. $ctx1.sendIdx["value"]=1;
  45886. $recv($2)._instVarAt_put_($4,anObject);
  45887. } else {
  45888. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45889. }
  45890. return self;
  45891. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45892. },
  45893. args: ["aNode", "anObject"],
  45894. 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 ]",
  45895. referencedClasses: [],
  45896. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45897. }),
  45898. $globals.ASTInterpreter);
  45899. $core.addMethod(
  45900. $core.method({
  45901. selector: "atEnd",
  45902. protocol: "testing",
  45903. fn: function (){
  45904. var self=this,$self=this;
  45905. return $core.withContext(function($ctx1) {
  45906. var $1;
  45907. $1=$self["@forceAtEnd"];
  45908. if($core.assert($1)){
  45909. return true;
  45910. }
  45911. return $recv($self._hasReturned())._or_((function(){
  45912. return $core.withContext(function($ctx2) {
  45913. return $recv($self._node())._isNil();
  45914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45915. }));
  45916. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45917. },
  45918. args: [],
  45919. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45920. referencedClasses: [],
  45921. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45922. }),
  45923. $globals.ASTInterpreter);
  45924. $core.addMethod(
  45925. $core.method({
  45926. selector: "context",
  45927. protocol: "accessing",
  45928. fn: function (){
  45929. var self=this,$self=this;
  45930. return $self["@context"];
  45931. },
  45932. args: [],
  45933. source: "context\x0a\x09^ context",
  45934. referencedClasses: [],
  45935. messageSends: []
  45936. }),
  45937. $globals.ASTInterpreter);
  45938. $core.addMethod(
  45939. $core.method({
  45940. selector: "context:",
  45941. protocol: "accessing",
  45942. fn: function (aContext){
  45943. var self=this,$self=this;
  45944. $self["@context"]=aContext;
  45945. return self;
  45946. },
  45947. args: ["aContext"],
  45948. source: "context: aContext\x0a\x09context := aContext",
  45949. referencedClasses: [],
  45950. messageSends: []
  45951. }),
  45952. $globals.ASTInterpreter);
  45953. $core.addMethod(
  45954. $core.method({
  45955. selector: "enterNode",
  45956. protocol: "interpreting",
  45957. fn: function (){
  45958. var self=this,$self=this;
  45959. return $core.withContext(function($ctx1) {
  45960. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45961. return self;
  45962. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45963. },
  45964. args: [],
  45965. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45966. referencedClasses: ["ASTEnterNode"],
  45967. messageSends: ["node:", "visit:", "on:", "node"]
  45968. }),
  45969. $globals.ASTInterpreter);
  45970. $core.addMethod(
  45971. $core.method({
  45972. selector: "eval:",
  45973. protocol: "private",
  45974. fn: function (aString){
  45975. var self=this,$self=this;
  45976. var source,function_;
  45977. return $core.withContext(function($ctx1) {
  45978. var $3,$2,$1;
  45979. source=$recv($globals.String)._streamContents_((function(str){
  45980. return $core.withContext(function($ctx2) {
  45981. $recv(str)._nextPutAll_("0,(function(");
  45982. $ctx2.sendIdx["nextPutAll:"]=1;
  45983. $3=$self._context();
  45984. $ctx2.sendIdx["context"]=1;
  45985. $2=$recv($3)._locals();
  45986. $ctx2.sendIdx["locals"]=1;
  45987. $1=$recv($2)._keys();
  45988. $recv($1)._do_separatedBy_((function(each){
  45989. return $core.withContext(function($ctx3) {
  45990. return $recv(str)._nextPutAll_(each);
  45991. $ctx3.sendIdx["nextPutAll:"]=2;
  45992. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45993. }),(function(){
  45994. return $core.withContext(function($ctx3) {
  45995. return $recv(str)._nextPutAll_(",");
  45996. $ctx3.sendIdx["nextPutAll:"]=3;
  45997. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45998. }));
  45999. $recv(str)._nextPutAll_("){ return (function() {");
  46000. $ctx2.sendIdx["nextPutAll:"]=4;
  46001. $recv(str)._nextPutAll_(aString);
  46002. $ctx2.sendIdx["nextPutAll:"]=5;
  46003. return $recv(str)._nextPutAll_("})()})");
  46004. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46005. }));
  46006. function_=$recv($globals.Compiler)._eval_(source);
  46007. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46008. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46009. },
  46010. args: ["aString"],
  46011. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  46012. referencedClasses: ["String", "Compiler"],
  46013. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46014. }),
  46015. $globals.ASTInterpreter);
  46016. $core.addMethod(
  46017. $core.method({
  46018. selector: "hasReturned",
  46019. protocol: "testing",
  46020. fn: function (){
  46021. var self=this,$self=this;
  46022. return $core.withContext(function($ctx1) {
  46023. var $1,$receiver;
  46024. $1=$self["@returned"];
  46025. if(($receiver = $1) == null || $receiver.a$nil){
  46026. return false;
  46027. } else {
  46028. return $1;
  46029. }
  46030. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46031. },
  46032. args: [],
  46033. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46034. referencedClasses: [],
  46035. messageSends: ["ifNil:"]
  46036. }),
  46037. $globals.ASTInterpreter);
  46038. $core.addMethod(
  46039. $core.method({
  46040. selector: "initialize",
  46041. protocol: "initialization",
  46042. fn: function (){
  46043. var self=this,$self=this;
  46044. return $core.withContext(function($ctx1) {
  46045. (
  46046. $ctx1.supercall = true,
  46047. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46048. $ctx1.supercall = false;
  46049. $self["@forceAtEnd"]=false;
  46050. return self;
  46051. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46052. },
  46053. args: [],
  46054. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46055. referencedClasses: [],
  46056. messageSends: ["initialize"]
  46057. }),
  46058. $globals.ASTInterpreter);
  46059. $core.addMethod(
  46060. $core.method({
  46061. selector: "interpret",
  46062. protocol: "interpreting",
  46063. fn: function (){
  46064. var self=this,$self=this;
  46065. return $core.withContext(function($ctx1) {
  46066. $self._visit_($self._node());
  46067. return self;
  46068. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46069. },
  46070. args: [],
  46071. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46072. referencedClasses: [],
  46073. messageSends: ["visit:", "node"]
  46074. }),
  46075. $globals.ASTInterpreter);
  46076. $core.addMethod(
  46077. $core.method({
  46078. selector: "messageFromSendNode:arguments:",
  46079. protocol: "private",
  46080. fn: function (aSendNode,aCollection){
  46081. var self=this,$self=this;
  46082. return $core.withContext(function($ctx1) {
  46083. var $1;
  46084. $1=$recv($globals.Message)._new();
  46085. $recv($1)._selector_($recv(aSendNode)._selector());
  46086. $recv($1)._arguments_(aCollection);
  46087. return $recv($1)._yourself();
  46088. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46089. },
  46090. args: ["aSendNode", "aCollection"],
  46091. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46092. referencedClasses: ["Message"],
  46093. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46094. }),
  46095. $globals.ASTInterpreter);
  46096. $core.addMethod(
  46097. $core.method({
  46098. selector: "messageNotUnderstood:receiver:",
  46099. protocol: "private",
  46100. fn: function (aMessage,anObject){
  46101. var self=this,$self=this;
  46102. return $core.withContext(function($ctx1) {
  46103. var $1;
  46104. $1=$recv($globals.MessageNotUnderstood)._new();
  46105. $recv($1)._message_(aMessage);
  46106. $recv($1)._receiver_(anObject);
  46107. $recv($1)._signal();
  46108. return self;
  46109. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46110. },
  46111. args: ["aMessage", "anObject"],
  46112. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46113. referencedClasses: ["MessageNotUnderstood"],
  46114. messageSends: ["message:", "new", "receiver:", "signal"]
  46115. }),
  46116. $globals.ASTInterpreter);
  46117. $core.addMethod(
  46118. $core.method({
  46119. selector: "next",
  46120. protocol: "interpreting",
  46121. fn: function (){
  46122. var self=this,$self=this;
  46123. var nd,nextNode;
  46124. return $core.withContext(function($ctx1) {
  46125. var $1,$2,$receiver;
  46126. nd=$self._node();
  46127. $1=$recv(nd)._parent();
  46128. if(($receiver = $1) == null || $receiver.a$nil){
  46129. nextNode=$1;
  46130. } else {
  46131. var parent;
  46132. parent=$receiver;
  46133. $2=$recv(parent)._nextSiblingNode_(nd);
  46134. if(($receiver = $2) == null || $receiver.a$nil){
  46135. nextNode=parent;
  46136. } else {
  46137. var sibling;
  46138. sibling=$receiver;
  46139. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46140. }
  46141. }
  46142. $self._node_(nextNode);
  46143. return self;
  46144. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46145. },
  46146. args: [],
  46147. 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",
  46148. referencedClasses: ["ASTEnterNode"],
  46149. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46150. }),
  46151. $globals.ASTInterpreter);
  46152. $core.addMethod(
  46153. $core.method({
  46154. selector: "node",
  46155. protocol: "accessing",
  46156. fn: function (){
  46157. var self=this,$self=this;
  46158. return $self["@node"];
  46159. },
  46160. args: [],
  46161. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46162. referencedClasses: [],
  46163. messageSends: []
  46164. }),
  46165. $globals.ASTInterpreter);
  46166. $core.addMethod(
  46167. $core.method({
  46168. selector: "node:",
  46169. protocol: "accessing",
  46170. fn: function (aNode){
  46171. var self=this,$self=this;
  46172. $self["@node"]=aNode;
  46173. return self;
  46174. },
  46175. args: ["aNode"],
  46176. source: "node: aNode\x0a\x09node := aNode",
  46177. referencedClasses: [],
  46178. messageSends: []
  46179. }),
  46180. $globals.ASTInterpreter);
  46181. $core.addMethod(
  46182. $core.method({
  46183. selector: "peek",
  46184. protocol: "stack",
  46185. fn: function (){
  46186. var self=this,$self=this;
  46187. return $core.withContext(function($ctx1) {
  46188. var $1;
  46189. var $early={};
  46190. try {
  46191. $1=$self._stack();
  46192. $ctx1.sendIdx["stack"]=1;
  46193. $recv($1)._ifEmpty_((function(){
  46194. throw $early=[nil];
  46195. }));
  46196. return $recv($self._stack())._last();
  46197. }
  46198. catch(e) {if(e===$early)return e[0]; throw e}
  46199. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46200. },
  46201. args: [],
  46202. 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",
  46203. referencedClasses: [],
  46204. messageSends: ["ifEmpty:", "stack", "last"]
  46205. }),
  46206. $globals.ASTInterpreter);
  46207. $core.addMethod(
  46208. $core.method({
  46209. selector: "pop",
  46210. protocol: "stack",
  46211. fn: function (){
  46212. var self=this,$self=this;
  46213. var peekedValue;
  46214. return $core.withContext(function($ctx1) {
  46215. peekedValue=$self._peek();
  46216. $recv($self._stack())._removeLast();
  46217. return peekedValue;
  46218. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46219. },
  46220. args: [],
  46221. 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",
  46222. referencedClasses: [],
  46223. messageSends: ["peek", "removeLast", "stack"]
  46224. }),
  46225. $globals.ASTInterpreter);
  46226. $core.addMethod(
  46227. $core.method({
  46228. selector: "proceed",
  46229. protocol: "interpreting",
  46230. fn: function (){
  46231. var self=this,$self=this;
  46232. return $core.withContext(function($ctx1) {
  46233. $recv((function(){
  46234. return $core.withContext(function($ctx2) {
  46235. return $self._atEnd();
  46236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46237. }))._whileFalse_((function(){
  46238. return $core.withContext(function($ctx2) {
  46239. return $self._step();
  46240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46241. }));
  46242. return self;
  46243. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46244. },
  46245. args: [],
  46246. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46247. referencedClasses: [],
  46248. messageSends: ["whileFalse:", "atEnd", "step"]
  46249. }),
  46250. $globals.ASTInterpreter);
  46251. $core.addMethod(
  46252. $core.method({
  46253. selector: "push:",
  46254. protocol: "stack",
  46255. fn: function (anObject){
  46256. var self=this,$self=this;
  46257. return $core.withContext(function($ctx1) {
  46258. return $recv($self._stack())._add_(anObject);
  46259. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46260. },
  46261. args: ["anObject"],
  46262. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46263. referencedClasses: [],
  46264. messageSends: ["add:", "stack"]
  46265. }),
  46266. $globals.ASTInterpreter);
  46267. $core.addMethod(
  46268. $core.method({
  46269. selector: "restart",
  46270. protocol: "interpreting",
  46271. fn: function (){
  46272. var self=this,$self=this;
  46273. return $core.withContext(function($ctx1) {
  46274. $self._node_($recv($self._context())._ast());
  46275. $self._enterNode();
  46276. return self;
  46277. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46278. },
  46279. args: [],
  46280. source: "restart\x0a\x09self node: self context ast; enterNode",
  46281. referencedClasses: [],
  46282. messageSends: ["node:", "ast", "context", "enterNode"]
  46283. }),
  46284. $globals.ASTInterpreter);
  46285. $core.addMethod(
  46286. $core.method({
  46287. selector: "result",
  46288. protocol: "accessing",
  46289. fn: function (){
  46290. var self=this,$self=this;
  46291. return $core.withContext(function($ctx1) {
  46292. var $1;
  46293. $1=$self._hasReturned();
  46294. if($core.assert($1)){
  46295. return $self._returnValue();
  46296. } else {
  46297. return $recv($self._context())._receiver();
  46298. }
  46299. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46300. },
  46301. args: [],
  46302. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46303. referencedClasses: [],
  46304. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46305. }),
  46306. $globals.ASTInterpreter);
  46307. $core.addMethod(
  46308. $core.method({
  46309. selector: "returnValue",
  46310. protocol: "accessing",
  46311. fn: function (){
  46312. var self=this,$self=this;
  46313. return $self["@returnValue"];
  46314. },
  46315. args: [],
  46316. source: "returnValue\x0a\x09^ returnValue",
  46317. referencedClasses: [],
  46318. messageSends: []
  46319. }),
  46320. $globals.ASTInterpreter);
  46321. $core.addMethod(
  46322. $core.method({
  46323. selector: "returnValue:",
  46324. protocol: "accessing",
  46325. fn: function (anObject){
  46326. var self=this,$self=this;
  46327. $self["@returnValue"]=anObject;
  46328. return self;
  46329. },
  46330. args: ["anObject"],
  46331. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46332. referencedClasses: [],
  46333. messageSends: []
  46334. }),
  46335. $globals.ASTInterpreter);
  46336. $core.addMethod(
  46337. $core.method({
  46338. selector: "sendMessage:to:superSend:",
  46339. protocol: "private",
  46340. fn: function (aMessage,anObject,aBoolean){
  46341. var self=this,$self=this;
  46342. var method;
  46343. return $core.withContext(function($ctx1) {
  46344. var $2,$1,$3,$receiver;
  46345. var $early={};
  46346. try {
  46347. if(!$core.assert(aBoolean)){
  46348. return $recv(aMessage)._sendTo_(anObject);
  46349. }
  46350. $2=$recv(anObject)._class();
  46351. $ctx1.sendIdx["class"]=1;
  46352. $1=$recv($2)._superclass();
  46353. $ctx1.sendIdx["superclass"]=1;
  46354. if(($receiver = $1) == null || $receiver.a$nil){
  46355. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46356. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46357. return $3;
  46358. } else {
  46359. $1;
  46360. }
  46361. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46362. return $core.withContext(function($ctx2) {
  46363. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46365. }));
  46366. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46367. }
  46368. catch(e) {if(e===$early)return e[0]; throw e}
  46369. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46370. },
  46371. args: ["aMessage", "anObject", "aBoolean"],
  46372. 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",
  46373. referencedClasses: [],
  46374. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46375. }),
  46376. $globals.ASTInterpreter);
  46377. $core.addMethod(
  46378. $core.method({
  46379. selector: "setNonLocalReturnFromContext:",
  46380. protocol: "interpreting",
  46381. fn: function (aContext){
  46382. var self=this,$self=this;
  46383. return $core.withContext(function($ctx1) {
  46384. var $2,$1;
  46385. $2=$recv(aContext)._interpreter();
  46386. $ctx1.sendIdx["interpreter"]=1;
  46387. $1=$recv($2)._hasReturned();
  46388. if($core.assert($1)){
  46389. $self["@returned"]=true;
  46390. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46391. }
  46392. return self;
  46393. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46394. },
  46395. args: ["aContext"],
  46396. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46397. referencedClasses: [],
  46398. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46399. }),
  46400. $globals.ASTInterpreter);
  46401. $core.addMethod(
  46402. $core.method({
  46403. selector: "skip",
  46404. protocol: "interpreting",
  46405. fn: function (){
  46406. var self=this,$self=this;
  46407. return $core.withContext(function($ctx1) {
  46408. $self._next();
  46409. return self;
  46410. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46411. },
  46412. args: [],
  46413. source: "skip\x0a\x09self next",
  46414. referencedClasses: [],
  46415. messageSends: ["next"]
  46416. }),
  46417. $globals.ASTInterpreter);
  46418. $core.addMethod(
  46419. $core.method({
  46420. selector: "stack",
  46421. protocol: "accessing",
  46422. fn: function (){
  46423. var self=this,$self=this;
  46424. return $core.withContext(function($ctx1) {
  46425. var $1,$receiver;
  46426. $1=$self["@stack"];
  46427. if(($receiver = $1) == null || $receiver.a$nil){
  46428. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46429. return $self["@stack"];
  46430. } else {
  46431. return $1;
  46432. }
  46433. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46434. },
  46435. args: [],
  46436. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46437. referencedClasses: ["OrderedCollection"],
  46438. messageSends: ["ifNil:", "new"]
  46439. }),
  46440. $globals.ASTInterpreter);
  46441. $core.addMethod(
  46442. $core.method({
  46443. selector: "step",
  46444. protocol: "interpreting",
  46445. fn: function (){
  46446. var self=this,$self=this;
  46447. return $core.withContext(function($ctx1) {
  46448. $self._interpret();
  46449. $self._next();
  46450. return self;
  46451. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46452. },
  46453. args: [],
  46454. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46455. referencedClasses: [],
  46456. messageSends: ["interpret", "next"]
  46457. }),
  46458. $globals.ASTInterpreter);
  46459. $core.addMethod(
  46460. $core.method({
  46461. selector: "stepOver",
  46462. protocol: "interpreting",
  46463. fn: function (){
  46464. var self=this,$self=this;
  46465. return $core.withContext(function($ctx1) {
  46466. var $2,$1;
  46467. $self._step();
  46468. $ctx1.sendIdx["step"]=1;
  46469. $recv((function(){
  46470. return $core.withContext(function($ctx2) {
  46471. $2=$self._node();
  46472. $ctx2.sendIdx["node"]=1;
  46473. $1=$recv($2)._isNil();
  46474. return $recv($1)._or_((function(){
  46475. return $core.withContext(function($ctx3) {
  46476. return $recv($self._node())._isSteppingNode();
  46477. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46478. }));
  46479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46480. }))._whileFalse_((function(){
  46481. return $core.withContext(function($ctx2) {
  46482. return $self._step();
  46483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46484. }));
  46485. return self;
  46486. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46487. },
  46488. args: [],
  46489. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46490. referencedClasses: [],
  46491. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46492. }),
  46493. $globals.ASTInterpreter);
  46494. $core.addMethod(
  46495. $core.method({
  46496. selector: "visit:",
  46497. protocol: "visiting",
  46498. fn: function (aNode){
  46499. var self=this,$self=this;
  46500. return $core.withContext(function($ctx1) {
  46501. var $1;
  46502. $1=$self._hasReturned();
  46503. if(!$core.assert($1)){
  46504. (
  46505. $ctx1.supercall = true,
  46506. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46507. $ctx1.supercall = false;
  46508. }
  46509. return self;
  46510. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46511. },
  46512. args: ["aNode"],
  46513. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46514. referencedClasses: [],
  46515. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46516. }),
  46517. $globals.ASTInterpreter);
  46518. $core.addMethod(
  46519. $core.method({
  46520. selector: "visitAssignmentNode:",
  46521. protocol: "visiting",
  46522. fn: function (aNode){
  46523. var self=this,$self=this;
  46524. var poppedValue;
  46525. return $core.withContext(function($ctx1) {
  46526. poppedValue=$self._pop();
  46527. $ctx1.sendIdx["pop"]=1;
  46528. $self._pop();
  46529. $self._push_(poppedValue);
  46530. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46531. return self;
  46532. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46533. },
  46534. args: ["aNode"],
  46535. 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",
  46536. referencedClasses: [],
  46537. messageSends: ["pop", "push:", "assign:to:", "left"]
  46538. }),
  46539. $globals.ASTInterpreter);
  46540. $core.addMethod(
  46541. $core.method({
  46542. selector: "visitBlockNode:",
  46543. protocol: "visiting",
  46544. fn: function (aNode){
  46545. var self=this,$self=this;
  46546. var block;
  46547. return $core.withContext(function($ctx1) {
  46548. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46549. $self._push_(block);
  46550. return self;
  46551. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46552. },
  46553. args: ["aNode"],
  46554. 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",
  46555. referencedClasses: ["AIBlockClosure"],
  46556. messageSends: ["forContext:node:", "context", "push:"]
  46557. }),
  46558. $globals.ASTInterpreter);
  46559. $core.addMethod(
  46560. $core.method({
  46561. selector: "visitBlockSequenceNode:",
  46562. protocol: "visiting",
  46563. fn: function (aNode){
  46564. var self=this,$self=this;
  46565. return $core.withContext(function($ctx1) {
  46566. (
  46567. $ctx1.supercall = true,
  46568. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46569. $ctx1.supercall = false;
  46570. $self["@forceAtEnd"]=true;
  46571. return self;
  46572. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46573. },
  46574. args: ["aNode"],
  46575. 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",
  46576. referencedClasses: [],
  46577. messageSends: ["visitBlockSequenceNode:"]
  46578. }),
  46579. $globals.ASTInterpreter);
  46580. $core.addMethod(
  46581. $core.method({
  46582. selector: "visitDagNode:",
  46583. protocol: "visiting",
  46584. fn: function (aNode){
  46585. var self=this,$self=this;
  46586. return self;
  46587. },
  46588. args: ["aNode"],
  46589. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46590. referencedClasses: [],
  46591. messageSends: []
  46592. }),
  46593. $globals.ASTInterpreter);
  46594. $core.addMethod(
  46595. $core.method({
  46596. selector: "visitDynamicArrayNode:",
  46597. protocol: "visiting",
  46598. fn: function (aNode){
  46599. var self=this,$self=this;
  46600. var array;
  46601. return $core.withContext(function($ctx1) {
  46602. array=[];
  46603. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46604. return $core.withContext(function($ctx2) {
  46605. return $recv(array)._addFirst_($self._pop());
  46606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46607. }));
  46608. $self._push_(array);
  46609. return self;
  46610. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46611. },
  46612. args: ["aNode"],
  46613. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  46614. referencedClasses: [],
  46615. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46616. }),
  46617. $globals.ASTInterpreter);
  46618. $core.addMethod(
  46619. $core.method({
  46620. selector: "visitDynamicDictionaryNode:",
  46621. protocol: "visiting",
  46622. fn: function (aNode){
  46623. var self=this,$self=this;
  46624. var keyValueList;
  46625. return $core.withContext(function($ctx1) {
  46626. keyValueList=$recv($globals.OrderedCollection)._new();
  46627. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46628. return $core.withContext(function($ctx2) {
  46629. return $recv(keyValueList)._add_($self._pop());
  46630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46631. }));
  46632. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46633. return self;
  46634. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46635. },
  46636. args: ["aNode"],
  46637. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode dagChildren do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  46638. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46639. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46640. }),
  46641. $globals.ASTInterpreter);
  46642. $core.addMethod(
  46643. $core.method({
  46644. selector: "visitJSStatementNode:",
  46645. protocol: "visiting",
  46646. fn: function (aNode){
  46647. var self=this,$self=this;
  46648. return $core.withContext(function($ctx1) {
  46649. $self["@returned"]=true;
  46650. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46651. return self;
  46652. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46653. },
  46654. args: ["aNode"],
  46655. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46656. referencedClasses: [],
  46657. messageSends: ["returnValue:", "eval:", "source"]
  46658. }),
  46659. $globals.ASTInterpreter);
  46660. $core.addMethod(
  46661. $core.method({
  46662. selector: "visitReturnNode:",
  46663. protocol: "visiting",
  46664. fn: function (aNode){
  46665. var self=this,$self=this;
  46666. return $core.withContext(function($ctx1) {
  46667. $self["@returned"]=true;
  46668. $self._returnValue_($self._pop());
  46669. return self;
  46670. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46671. },
  46672. args: ["aNode"],
  46673. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46674. referencedClasses: [],
  46675. messageSends: ["returnValue:", "pop"]
  46676. }),
  46677. $globals.ASTInterpreter);
  46678. $core.addMethod(
  46679. $core.method({
  46680. selector: "visitSendNode:",
  46681. protocol: "visiting",
  46682. fn: function (aNode){
  46683. var self=this,$self=this;
  46684. var receiver,args,message,result;
  46685. return $core.withContext(function($ctx1) {
  46686. var $1;
  46687. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46688. return $core.withContext(function($ctx2) {
  46689. return $self._pop();
  46690. $ctx2.sendIdx["pop"]=1;
  46691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46692. }));
  46693. receiver=$self._peek();
  46694. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46695. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46696. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46697. return $core.withContext(function($ctx2) {
  46698. return $recv($recv(aNode)._isLastChild())._not();
  46699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46700. }));
  46701. if(!$core.assert($1)){
  46702. $self._pop();
  46703. $self._push_(result);
  46704. }
  46705. return self;
  46706. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46707. },
  46708. args: ["aNode"],
  46709. 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 ]",
  46710. referencedClasses: [],
  46711. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46712. }),
  46713. $globals.ASTInterpreter);
  46714. $core.addMethod(
  46715. $core.method({
  46716. selector: "visitValueNode:",
  46717. protocol: "visiting",
  46718. fn: function (aNode){
  46719. var self=this,$self=this;
  46720. return $core.withContext(function($ctx1) {
  46721. $self._push_($recv(aNode)._value());
  46722. return self;
  46723. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46724. },
  46725. args: ["aNode"],
  46726. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46727. referencedClasses: [],
  46728. messageSends: ["push:", "value"]
  46729. }),
  46730. $globals.ASTInterpreter);
  46731. $core.addMethod(
  46732. $core.method({
  46733. selector: "visitVariableNode:",
  46734. protocol: "visiting",
  46735. fn: function (aNode){
  46736. var self=this,$self=this;
  46737. return $core.withContext(function($ctx1) {
  46738. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46739. $2=$recv(aNode)._binding();
  46740. $ctx1.sendIdx["binding"]=1;
  46741. $1=$recv($2)._isUnknownVar();
  46742. if($core.assert($1)){
  46743. $5=$recv($globals.Platform)._globals();
  46744. $ctx1.sendIdx["globals"]=1;
  46745. $6=$recv(aNode)._value();
  46746. $ctx1.sendIdx["value"]=1;
  46747. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46748. return $core.withContext(function($ctx2) {
  46749. return $self._error_("Unknown variable");
  46750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46751. }));
  46752. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46753. $3=$self._push_($4);
  46754. $ctx1.sendIdx["push:"]=1;
  46755. return $3;
  46756. }
  46757. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46758. if($core.assert($8)){
  46759. $10=$self._context();
  46760. $ctx1.sendIdx["context"]=1;
  46761. $9=$recv($10)._receiver();
  46762. $11=$recv(aNode)._value();
  46763. $ctx1.sendIdx["value"]=2;
  46764. $7=$recv($9)._instVarAt_($11);
  46765. } else {
  46766. $12=$self._context();
  46767. $13=$recv(aNode)._value();
  46768. $ctx1.sendIdx["value"]=3;
  46769. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46770. return $core.withContext(function($ctx2) {
  46771. $15=$recv(aNode)._value();
  46772. $ctx2.sendIdx["value"]=4;
  46773. $14=$recv($15)._isCapitalized();
  46774. if($core.assert($14)){
  46775. $16=$recv($globals.Smalltalk)._globals();
  46776. $ctx2.sendIdx["globals"]=2;
  46777. $17=$recv(aNode)._value();
  46778. $ctx2.sendIdx["value"]=5;
  46779. return $recv($16)._at_ifAbsent_($17,(function(){
  46780. return $core.withContext(function($ctx3) {
  46781. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46782. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46783. }));
  46784. }
  46785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46786. }));
  46787. }
  46788. $self._push_($7);
  46789. return self;
  46790. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46791. },
  46792. args: ["aNode"],
  46793. 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 ] ] ] ])",
  46794. referencedClasses: ["Platform", "Smalltalk"],
  46795. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46796. }),
  46797. $globals.ASTInterpreter);
  46798. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46799. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46800. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46801. $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`";
  46802. $core.addMethod(
  46803. $core.method({
  46804. selector: "currentNode",
  46805. protocol: "accessing",
  46806. fn: function (){
  46807. var self=this,$self=this;
  46808. return $self["@currentNode"];
  46809. },
  46810. args: [],
  46811. source: "currentNode\x0a\x09^ currentNode",
  46812. referencedClasses: [],
  46813. messageSends: []
  46814. }),
  46815. $globals.ASTPCNodeVisitor);
  46816. $core.addMethod(
  46817. $core.method({
  46818. selector: "increaseTrackedIndex",
  46819. protocol: "accessing",
  46820. fn: function (){
  46821. var self=this,$self=this;
  46822. return $core.withContext(function($ctx1) {
  46823. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46824. return self;
  46825. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46826. },
  46827. args: [],
  46828. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46829. referencedClasses: [],
  46830. messageSends: ["+", "trackedIndex"]
  46831. }),
  46832. $globals.ASTPCNodeVisitor);
  46833. $core.addMethod(
  46834. $core.method({
  46835. selector: "index",
  46836. protocol: "accessing",
  46837. fn: function (){
  46838. var self=this,$self=this;
  46839. return $self["@index"];
  46840. },
  46841. args: [],
  46842. source: "index\x0a\x09^ index",
  46843. referencedClasses: [],
  46844. messageSends: []
  46845. }),
  46846. $globals.ASTPCNodeVisitor);
  46847. $core.addMethod(
  46848. $core.method({
  46849. selector: "index:",
  46850. protocol: "accessing",
  46851. fn: function (aNumber){
  46852. var self=this,$self=this;
  46853. $self["@index"]=aNumber;
  46854. return self;
  46855. },
  46856. args: ["aNumber"],
  46857. source: "index: aNumber\x0a\x09index := aNumber",
  46858. referencedClasses: [],
  46859. messageSends: []
  46860. }),
  46861. $globals.ASTPCNodeVisitor);
  46862. $core.addMethod(
  46863. $core.method({
  46864. selector: "selector",
  46865. protocol: "accessing",
  46866. fn: function (){
  46867. var self=this,$self=this;
  46868. return $self["@selector"];
  46869. },
  46870. args: [],
  46871. source: "selector\x0a\x09^ selector",
  46872. referencedClasses: [],
  46873. messageSends: []
  46874. }),
  46875. $globals.ASTPCNodeVisitor);
  46876. $core.addMethod(
  46877. $core.method({
  46878. selector: "selector:",
  46879. protocol: "accessing",
  46880. fn: function (aString){
  46881. var self=this,$self=this;
  46882. $self["@selector"]=aString;
  46883. return self;
  46884. },
  46885. args: ["aString"],
  46886. source: "selector: aString\x0a\x09selector := aString",
  46887. referencedClasses: [],
  46888. messageSends: []
  46889. }),
  46890. $globals.ASTPCNodeVisitor);
  46891. $core.addMethod(
  46892. $core.method({
  46893. selector: "trackedIndex",
  46894. protocol: "accessing",
  46895. fn: function (){
  46896. var self=this,$self=this;
  46897. return $core.withContext(function($ctx1) {
  46898. var $1,$receiver;
  46899. $1=$self["@trackedIndex"];
  46900. if(($receiver = $1) == null || $receiver.a$nil){
  46901. $self["@trackedIndex"]=(0);
  46902. return $self["@trackedIndex"];
  46903. } else {
  46904. return $1;
  46905. }
  46906. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46907. },
  46908. args: [],
  46909. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46910. referencedClasses: [],
  46911. messageSends: ["ifNil:"]
  46912. }),
  46913. $globals.ASTPCNodeVisitor);
  46914. $core.addMethod(
  46915. $core.method({
  46916. selector: "visitJSStatementNode:",
  46917. protocol: "visiting",
  46918. fn: function (aNode){
  46919. var self=this,$self=this;
  46920. $self["@currentNode"]=aNode;
  46921. return self;
  46922. },
  46923. args: ["aNode"],
  46924. 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",
  46925. referencedClasses: [],
  46926. messageSends: []
  46927. }),
  46928. $globals.ASTPCNodeVisitor);
  46929. $core.addMethod(
  46930. $core.method({
  46931. selector: "visitSendNode:",
  46932. protocol: "visiting",
  46933. fn: function (aNode){
  46934. var self=this,$self=this;
  46935. return $core.withContext(function($ctx1) {
  46936. var $2,$1,$3;
  46937. (
  46938. $ctx1.supercall = true,
  46939. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46940. $ctx1.supercall = false;
  46941. $2=$self._selector();
  46942. $ctx1.sendIdx["selector"]=1;
  46943. $1=$recv($2).__eq($recv(aNode)._selector());
  46944. $ctx1.sendIdx["="]=1;
  46945. if($core.assert($1)){
  46946. $3=$recv($self._trackedIndex()).__eq($self._index());
  46947. if($core.assert($3)){
  46948. $self["@currentNode"]=aNode;
  46949. $self["@currentNode"];
  46950. }
  46951. $self._increaseTrackedIndex();
  46952. }
  46953. return self;
  46954. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46955. },
  46956. args: ["aNode"],
  46957. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self trackedIndex = self index ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseTrackedIndex ]",
  46958. referencedClasses: [],
  46959. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46960. }),
  46961. $globals.ASTPCNodeVisitor);
  46962. $core.addMethod(
  46963. $core.method({
  46964. selector: "isLastChild",
  46965. protocol: "*Compiler-Interpreter",
  46966. fn: function (){
  46967. var self=this,$self=this;
  46968. return $core.withContext(function($ctx1) {
  46969. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46970. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46971. },
  46972. args: [],
  46973. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46974. referencedClasses: [],
  46975. messageSends: ["=", "last", "dagChildren", "parent"]
  46976. }),
  46977. $globals.ASTNode);
  46978. $core.addMethod(
  46979. $core.method({
  46980. selector: "isSteppingNode",
  46981. protocol: "*Compiler-Interpreter",
  46982. fn: function (){
  46983. var self=this,$self=this;
  46984. return false;
  46985. },
  46986. args: [],
  46987. source: "isSteppingNode\x0a\x09^ false",
  46988. referencedClasses: [],
  46989. messageSends: []
  46990. }),
  46991. $globals.ASTNode);
  46992. $core.addMethod(
  46993. $core.method({
  46994. selector: "nextSiblingNode:",
  46995. protocol: "*Compiler-Interpreter",
  46996. fn: function (aNode){
  46997. var self=this,$self=this;
  46998. return $core.withContext(function($ctx1) {
  46999. var $1;
  47000. var $early={};
  47001. try {
  47002. $1=$self._dagChildren();
  47003. $ctx1.sendIdx["dagChildren"]=1;
  47004. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47005. throw $early=[nil];
  47006. }));
  47007. }
  47008. catch(e) {if(e===$early)return e[0]; throw e}
  47009. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47010. },
  47011. args: ["aNode"],
  47012. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self dagChildren \x0a\x09\x09at: (self dagChildren indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  47013. referencedClasses: [],
  47014. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47015. }),
  47016. $globals.ASTNode);
  47017. $core.addMethod(
  47018. $core.method({
  47019. selector: "isSteppingNode",
  47020. protocol: "*Compiler-Interpreter",
  47021. fn: function (){
  47022. var self=this,$self=this;
  47023. return true;
  47024. },
  47025. args: [],
  47026. source: "isSteppingNode\x0a\x09^ true",
  47027. referencedClasses: [],
  47028. messageSends: []
  47029. }),
  47030. $globals.AssignmentNode);
  47031. $core.addMethod(
  47032. $core.method({
  47033. selector: "isSteppingNode",
  47034. protocol: "*Compiler-Interpreter",
  47035. fn: function (){
  47036. var self=this,$self=this;
  47037. return true;
  47038. },
  47039. args: [],
  47040. source: "isSteppingNode\x0a\x09^ true",
  47041. referencedClasses: [],
  47042. messageSends: []
  47043. }),
  47044. $globals.BlockNode);
  47045. $core.addMethod(
  47046. $core.method({
  47047. selector: "nextSiblingNode:",
  47048. protocol: "*Compiler-Interpreter",
  47049. fn: function (aNode){
  47050. var self=this,$self=this;
  47051. return nil;
  47052. },
  47053. args: ["aNode"],
  47054. 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",
  47055. referencedClasses: [],
  47056. messageSends: []
  47057. }),
  47058. $globals.BlockNode);
  47059. $core.addMethod(
  47060. $core.method({
  47061. selector: "isSteppingNode",
  47062. protocol: "*Compiler-Interpreter",
  47063. fn: function (){
  47064. var self=this,$self=this;
  47065. return true;
  47066. },
  47067. args: [],
  47068. source: "isSteppingNode\x0a\x09^ true",
  47069. referencedClasses: [],
  47070. messageSends: []
  47071. }),
  47072. $globals.DynamicArrayNode);
  47073. $core.addMethod(
  47074. $core.method({
  47075. selector: "isSteppingNode",
  47076. protocol: "*Compiler-Interpreter",
  47077. fn: function (){
  47078. var self=this,$self=this;
  47079. return true;
  47080. },
  47081. args: [],
  47082. source: "isSteppingNode\x0a\x09^ true",
  47083. referencedClasses: [],
  47084. messageSends: []
  47085. }),
  47086. $globals.DynamicDictionaryNode);
  47087. $core.addMethod(
  47088. $core.method({
  47089. selector: "isSteppingNode",
  47090. protocol: "*Compiler-Interpreter",
  47091. fn: function (){
  47092. var self=this,$self=this;
  47093. return true;
  47094. },
  47095. args: [],
  47096. source: "isSteppingNode\x0a\x09^ true",
  47097. referencedClasses: [],
  47098. messageSends: []
  47099. }),
  47100. $globals.JSStatementNode);
  47101. $core.addMethod(
  47102. $core.method({
  47103. selector: "isCascadeSendNode",
  47104. protocol: "*Compiler-Interpreter",
  47105. fn: function (){
  47106. var self=this,$self=this;
  47107. return $core.withContext(function($ctx1) {
  47108. return $recv($self._parent())._isCascadeNode();
  47109. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47110. },
  47111. args: [],
  47112. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47113. referencedClasses: [],
  47114. messageSends: ["isCascadeNode", "parent"]
  47115. }),
  47116. $globals.SendNode);
  47117. $core.addMethod(
  47118. $core.method({
  47119. selector: "isSteppingNode",
  47120. protocol: "*Compiler-Interpreter",
  47121. fn: function (){
  47122. var self=this,$self=this;
  47123. return true;
  47124. },
  47125. args: [],
  47126. source: "isSteppingNode\x0a\x09^ true",
  47127. referencedClasses: [],
  47128. messageSends: []
  47129. }),
  47130. $globals.SendNode);
  47131. });
  47132. define('amber/lang',[
  47133. './deploy',
  47134. './boot', // pre-fetch, dep of ./helpers
  47135. './helpers', // pre-fetch, dep of ./deploy
  47136. './parser',
  47137. // --- packages for the Amber reflection begin here ---
  47138. 'amber_core/Platform-ImportExport',
  47139. 'amber_core/Compiler-Core',
  47140. 'amber_core/Compiler-AST',
  47141. 'amber_core/Compiler-Semantic',
  47142. 'amber_core/Compiler-IR',
  47143. 'amber_core/Compiler-Inlining',
  47144. 'amber_core/Compiler-Interpreter'
  47145. // --- packages for the Amber reflection end here ---
  47146. ], function (amber) {
  47147. return amber;
  47148. });
  47149. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47150. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47151. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47152. var $pkg = $core.addPackage("Platform-DOM");
  47153. $pkg.innerEval = function (expr) { return eval(expr); };
  47154. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47155. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47156. $core.addMethod(
  47157. $core.method({
  47158. selector: "isDomNode:",
  47159. protocol: "testing",
  47160. fn: function (anObject){
  47161. var self=this,$self=this;
  47162. return $core.withContext(function($ctx1) {
  47163. return anObject.nodeType > 0 &&
  47164. Object.prototype.toString.call(anObject) !== "[object Object]";
  47165. return self;
  47166. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47167. },
  47168. args: ["anObject"],
  47169. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47170. referencedClasses: [],
  47171. messageSends: []
  47172. }),
  47173. $globals.PlatformDom.a$cls);
  47174. $core.addMethod(
  47175. $core.method({
  47176. selector: "isFeasible",
  47177. protocol: "testing",
  47178. fn: function (){
  47179. var self=this,$self=this;
  47180. return $core.withContext(function($ctx1) {
  47181. if (typeof document === "undefined") return false;
  47182. try {
  47183. var d = document.createElement("div"),
  47184. f = document.createDocumentFragment(),
  47185. t = document.createTextNode("Hello, Amber!");
  47186. f.appendChild(t);
  47187. d.insertBefore(f, null);
  47188. return d.innerHTML === "Hello, Amber!";
  47189. } catch (e) {
  47190. return false;
  47191. };
  47192. return self;
  47193. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47194. },
  47195. args: [],
  47196. source: "isFeasible\x0a<inlineJS: '\x0a if (typeof document === \x22undefined\x22) return false;\x0a try {\x0a var d = document.createElement(\x22div\x22),\x0a\x09 f = document.createDocumentFragment(),\x0a\x09 t = document.createTextNode(\x22Hello, Amber!\x22);\x0a\x09f.appendChild(t);\x0a\x09d.insertBefore(f, null);\x0a\x09return d.innerHTML === \x22Hello, Amber!\x22;\x0a } catch (e) {\x0a return false;\x0a }\x0a'>",
  47197. referencedClasses: [],
  47198. messageSends: []
  47199. }),
  47200. $globals.PlatformDom.a$cls);
  47201. $core.addMethod(
  47202. $core.method({
  47203. selector: "newCustomEvent:detail:",
  47204. protocol: "creation",
  47205. fn: function (aString,anObject){
  47206. var self=this,$self=this;
  47207. return $core.withContext(function($ctx1) {
  47208. return new CustomEvent(aString, {detail: anObject});
  47209. return self;
  47210. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47211. },
  47212. args: ["aString", "anObject"],
  47213. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47214. referencedClasses: [],
  47215. messageSends: []
  47216. }),
  47217. $globals.PlatformDom.a$cls);
  47218. $core.addMethod(
  47219. $core.method({
  47220. selector: "toArray:",
  47221. protocol: "converting",
  47222. fn: function (aDomList){
  47223. var self=this,$self=this;
  47224. return $core.withContext(function($ctx1) {
  47225. return Array.prototype.slice.call(aDomList);
  47226. return self;
  47227. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47228. },
  47229. args: ["aDomList"],
  47230. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47231. referencedClasses: [],
  47232. messageSends: []
  47233. }),
  47234. $globals.PlatformDom.a$cls);
  47235. $core.addMethod(
  47236. $core.method({
  47237. selector: "asDomNode",
  47238. protocol: "*Platform-DOM",
  47239. fn: function (){
  47240. var self=this,$self=this;
  47241. var fragment;
  47242. return $core.withContext(function($ctx1) {
  47243. fragment=$recv(document)._createDocumentFragment();
  47244. $self._do_((function(each){
  47245. return $core.withContext(function($ctx2) {
  47246. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47248. }));
  47249. return fragment;
  47250. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47251. },
  47252. args: [],
  47253. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47254. referencedClasses: [],
  47255. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47256. }),
  47257. $globals.Collection);
  47258. $core.addMethod(
  47259. $core.method({
  47260. selector: "asDomNode",
  47261. protocol: "*Platform-DOM",
  47262. fn: function (){
  47263. var self=this,$self=this;
  47264. return $core.withContext(function($ctx1) {
  47265. var $1,$2;
  47266. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47267. if($core.assert($1)){
  47268. return $self["@jsObject"];
  47269. } else {
  47270. $2=(
  47271. $ctx1.supercall = true,
  47272. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47273. $ctx1.supercall = false;
  47274. return $2;
  47275. }
  47276. return self;
  47277. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47278. },
  47279. args: [],
  47280. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47281. referencedClasses: ["PlatformDom"],
  47282. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47283. }),
  47284. $globals.JSObjectProxy);
  47285. $core.addMethod(
  47286. $core.method({
  47287. selector: "asDomNode",
  47288. protocol: "*Platform-DOM",
  47289. fn: function (){
  47290. var self=this,$self=this;
  47291. return $core.withContext(function($ctx1) {
  47292. return $recv(document)._createTextNode_($self._asString());
  47293. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.String)});
  47294. },
  47295. args: [],
  47296. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47297. referencedClasses: [],
  47298. messageSends: ["createTextNode:", "asString"]
  47299. }),
  47300. $globals.String);
  47301. $core.addMethod(
  47302. $core.method({
  47303. selector: "htmlTextContent",
  47304. protocol: "*Platform-DOM",
  47305. fn: function (){
  47306. var self=this,$self=this;
  47307. return $core.withContext(function($ctx1) {
  47308. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47309. return self;
  47310. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47311. },
  47312. args: [],
  47313. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47314. referencedClasses: [],
  47315. messageSends: []
  47316. }),
  47317. $globals.String);
  47318. });
  47319. define('amber_core/SUnit',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47320. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47321. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47322. var $pkg = $core.addPackage("SUnit");
  47323. $pkg.innerEval = function (expr) { return eval(expr); };
  47324. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47325. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47326. $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.";
  47327. $core.addMethod(
  47328. $core.method({
  47329. selector: "result",
  47330. protocol: "accessing",
  47331. fn: function (){
  47332. var self=this,$self=this;
  47333. return $self["@result"];
  47334. },
  47335. args: [],
  47336. source: "result\x0a\x09^ result",
  47337. referencedClasses: [],
  47338. messageSends: []
  47339. }),
  47340. $globals.ResultAnnouncement);
  47341. $core.addMethod(
  47342. $core.method({
  47343. selector: "result:",
  47344. protocol: "accessing",
  47345. fn: function (aTestResult){
  47346. var self=this,$self=this;
  47347. $self["@result"]=aTestResult;
  47348. return self;
  47349. },
  47350. args: ["aTestResult"],
  47351. source: "result: aTestResult\x0a\x09result := aTestResult",
  47352. referencedClasses: [],
  47353. messageSends: []
  47354. }),
  47355. $globals.ResultAnnouncement);
  47356. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47357. $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.";
  47358. $core.addMethod(
  47359. $core.method({
  47360. selector: "assert:",
  47361. protocol: "testing",
  47362. fn: function (aBoolean){
  47363. var self=this,$self=this;
  47364. return $core.withContext(function($ctx1) {
  47365. $self._assert_description_(aBoolean,"Assertion failed");
  47366. return self;
  47367. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47368. },
  47369. args: ["aBoolean"],
  47370. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47371. referencedClasses: [],
  47372. messageSends: ["assert:description:"]
  47373. }),
  47374. $globals.TestCase);
  47375. $core.addMethod(
  47376. $core.method({
  47377. selector: "assert:description:",
  47378. protocol: "testing",
  47379. fn: function (aBoolean,aString){
  47380. var self=this,$self=this;
  47381. return $core.withContext(function($ctx1) {
  47382. if(!$core.assert(aBoolean)){
  47383. $self._signalFailure_(aString);
  47384. }
  47385. return self;
  47386. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47387. },
  47388. args: ["aBoolean", "aString"],
  47389. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47390. referencedClasses: [],
  47391. messageSends: ["ifFalse:", "signalFailure:"]
  47392. }),
  47393. $globals.TestCase);
  47394. $core.addMethod(
  47395. $core.method({
  47396. selector: "assert:equals:",
  47397. protocol: "testing",
  47398. fn: function (actual,expected){
  47399. var self=this,$self=this;
  47400. return $core.withContext(function($ctx1) {
  47401. var $1,$5,$4,$3,$2;
  47402. $1=$recv(actual).__eq(expected);
  47403. $5=$recv(expected)._printString();
  47404. $ctx1.sendIdx["printString"]=1;
  47405. $4="Expected: ".__comma($5);
  47406. $3=$recv($4).__comma(" but was: ");
  47407. $ctx1.sendIdx[","]=2;
  47408. $2=$recv($3).__comma($recv(actual)._printString());
  47409. $ctx1.sendIdx[","]=1;
  47410. return $self._assert_description_($1,$2);
  47411. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47412. },
  47413. args: ["actual", "expected"],
  47414. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47415. referencedClasses: [],
  47416. messageSends: ["assert:description:", "=", ",", "printString"]
  47417. }),
  47418. $globals.TestCase);
  47419. $core.addMethod(
  47420. $core.method({
  47421. selector: "async:",
  47422. protocol: "async",
  47423. fn: function (aBlock){
  47424. var self=this,$self=this;
  47425. var c;
  47426. return $core.withContext(function($ctx1) {
  47427. var $1;
  47428. $self._errorIfNotAsync_("#async");
  47429. c=$self["@context"];
  47430. return (function(){
  47431. return $core.withContext(function($ctx2) {
  47432. $1=$self._isAsync();
  47433. if($core.assert($1)){
  47434. return $recv(c)._execute_(aBlock);
  47435. }
  47436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47437. });
  47438. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47439. },
  47440. args: ["aBlock"],
  47441. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47442. referencedClasses: [],
  47443. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47444. }),
  47445. $globals.TestCase);
  47446. $core.addMethod(
  47447. $core.method({
  47448. selector: "context:",
  47449. protocol: "accessing",
  47450. fn: function (aRunningTestContext){
  47451. var self=this,$self=this;
  47452. $self["@context"]=aRunningTestContext;
  47453. return self;
  47454. },
  47455. args: ["aRunningTestContext"],
  47456. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47457. referencedClasses: [],
  47458. messageSends: []
  47459. }),
  47460. $globals.TestCase);
  47461. $core.addMethod(
  47462. $core.method({
  47463. selector: "deny:",
  47464. protocol: "testing",
  47465. fn: function (aBoolean){
  47466. var self=this,$self=this;
  47467. return $core.withContext(function($ctx1) {
  47468. $self._assert_($recv(aBoolean)._not());
  47469. return self;
  47470. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47471. },
  47472. args: ["aBoolean"],
  47473. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47474. referencedClasses: [],
  47475. messageSends: ["assert:", "not"]
  47476. }),
  47477. $globals.TestCase);
  47478. $core.addMethod(
  47479. $core.method({
  47480. selector: "errorIfNotAsync:",
  47481. protocol: "error handling",
  47482. fn: function (aString){
  47483. var self=this,$self=this;
  47484. return $core.withContext(function($ctx1) {
  47485. var $1;
  47486. $1=$self._isAsync();
  47487. if(!$core.assert($1)){
  47488. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47489. }
  47490. return self;
  47491. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47492. },
  47493. args: ["aString"],
  47494. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47495. referencedClasses: [],
  47496. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47497. }),
  47498. $globals.TestCase);
  47499. $core.addMethod(
  47500. $core.method({
  47501. selector: "finished",
  47502. protocol: "async",
  47503. fn: function (){
  47504. var self=this,$self=this;
  47505. return $core.withContext(function($ctx1) {
  47506. $self._errorIfNotAsync_("#finished");
  47507. $self["@asyncTimeout"]=nil;
  47508. return self;
  47509. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47510. },
  47511. args: [],
  47512. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47513. referencedClasses: [],
  47514. messageSends: ["errorIfNotAsync:"]
  47515. }),
  47516. $globals.TestCase);
  47517. $core.addMethod(
  47518. $core.method({
  47519. selector: "isAsync",
  47520. protocol: "testing",
  47521. fn: function (){
  47522. var self=this,$self=this;
  47523. return $core.withContext(function($ctx1) {
  47524. return $recv($self["@asyncTimeout"])._notNil();
  47525. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47526. },
  47527. args: [],
  47528. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47529. referencedClasses: [],
  47530. messageSends: ["notNil"]
  47531. }),
  47532. $globals.TestCase);
  47533. $core.addMethod(
  47534. $core.method({
  47535. selector: "performTest",
  47536. protocol: "running",
  47537. fn: function (){
  47538. var self=this,$self=this;
  47539. return $core.withContext(function($ctx1) {
  47540. $self["@asyncTimeout"]=nil;
  47541. $self._perform_($self._selector());
  47542. return self;
  47543. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47544. },
  47545. args: [],
  47546. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47547. referencedClasses: [],
  47548. messageSends: ["perform:", "selector"]
  47549. }),
  47550. $globals.TestCase);
  47551. $core.addMethod(
  47552. $core.method({
  47553. selector: "runCase",
  47554. protocol: "running",
  47555. fn: function (){
  47556. var self=this,$self=this;
  47557. return $core.withContext(function($ctx1) {
  47558. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47559. return self;
  47560. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47561. },
  47562. args: [],
  47563. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47564. referencedClasses: ["TestContext"],
  47565. messageSends: ["start", "testCase:"]
  47566. }),
  47567. $globals.TestCase);
  47568. $core.addMethod(
  47569. $core.method({
  47570. selector: "selector",
  47571. protocol: "accessing",
  47572. fn: function (){
  47573. var self=this,$self=this;
  47574. return $self["@testSelector"];
  47575. },
  47576. args: [],
  47577. source: "selector\x0a\x09^ testSelector",
  47578. referencedClasses: [],
  47579. messageSends: []
  47580. }),
  47581. $globals.TestCase);
  47582. $core.addMethod(
  47583. $core.method({
  47584. selector: "setTestSelector:",
  47585. protocol: "accessing",
  47586. fn: function (aSelector){
  47587. var self=this,$self=this;
  47588. $self["@testSelector"]=aSelector;
  47589. return self;
  47590. },
  47591. args: ["aSelector"],
  47592. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47593. referencedClasses: [],
  47594. messageSends: []
  47595. }),
  47596. $globals.TestCase);
  47597. $core.addMethod(
  47598. $core.method({
  47599. selector: "setUp",
  47600. protocol: "running",
  47601. fn: function (){
  47602. var self=this,$self=this;
  47603. return self;
  47604. },
  47605. args: [],
  47606. source: "setUp",
  47607. referencedClasses: [],
  47608. messageSends: []
  47609. }),
  47610. $globals.TestCase);
  47611. $core.addMethod(
  47612. $core.method({
  47613. selector: "should:",
  47614. protocol: "testing",
  47615. fn: function (aBlock){
  47616. var self=this,$self=this;
  47617. return $core.withContext(function($ctx1) {
  47618. $self._assert_($recv(aBlock)._value());
  47619. return self;
  47620. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47621. },
  47622. args: ["aBlock"],
  47623. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47624. referencedClasses: [],
  47625. messageSends: ["assert:", "value"]
  47626. }),
  47627. $globals.TestCase);
  47628. $core.addMethod(
  47629. $core.method({
  47630. selector: "should:raise:",
  47631. protocol: "testing",
  47632. fn: function (aBlock,anExceptionClass){
  47633. var self=this,$self=this;
  47634. return $core.withContext(function($ctx1) {
  47635. $self._assert_($recv((function(){
  47636. return $core.withContext(function($ctx2) {
  47637. $recv(aBlock)._value();
  47638. return false;
  47639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47640. }))._on_do_(anExceptionClass,(function(ex){
  47641. return true;
  47642. })));
  47643. return self;
  47644. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47645. },
  47646. args: ["aBlock", "anExceptionClass"],
  47647. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47648. referencedClasses: [],
  47649. messageSends: ["assert:", "on:do:", "value"]
  47650. }),
  47651. $globals.TestCase);
  47652. $core.addMethod(
  47653. $core.method({
  47654. selector: "shouldnt:raise:",
  47655. protocol: "testing",
  47656. fn: function (aBlock,anExceptionClass){
  47657. var self=this,$self=this;
  47658. return $core.withContext(function($ctx1) {
  47659. $self._assert_($recv((function(){
  47660. return $core.withContext(function($ctx2) {
  47661. $recv(aBlock)._value();
  47662. return true;
  47663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47664. }))._on_do_(anExceptionClass,(function(ex){
  47665. return false;
  47666. })));
  47667. return self;
  47668. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47669. },
  47670. args: ["aBlock", "anExceptionClass"],
  47671. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47672. referencedClasses: [],
  47673. messageSends: ["assert:", "on:do:", "value"]
  47674. }),
  47675. $globals.TestCase);
  47676. $core.addMethod(
  47677. $core.method({
  47678. selector: "signalFailure:",
  47679. protocol: "private",
  47680. fn: function (aString){
  47681. var self=this,$self=this;
  47682. return $core.withContext(function($ctx1) {
  47683. var $1;
  47684. $1=$recv($globals.TestFailure)._new();
  47685. $recv($1)._messageText_(aString);
  47686. $recv($1)._signal();
  47687. return self;
  47688. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47689. },
  47690. args: ["aString"],
  47691. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47692. referencedClasses: ["TestFailure"],
  47693. messageSends: ["messageText:", "new", "signal"]
  47694. }),
  47695. $globals.TestCase);
  47696. $core.addMethod(
  47697. $core.method({
  47698. selector: "tearDown",
  47699. protocol: "running",
  47700. fn: function (){
  47701. var self=this,$self=this;
  47702. return self;
  47703. },
  47704. args: [],
  47705. source: "tearDown",
  47706. referencedClasses: [],
  47707. messageSends: []
  47708. }),
  47709. $globals.TestCase);
  47710. $core.addMethod(
  47711. $core.method({
  47712. selector: "timeout:",
  47713. protocol: "async",
  47714. fn: function (aNumber){
  47715. var self=this,$self=this;
  47716. return $core.withContext(function($ctx1) {
  47717. var $1,$receiver;
  47718. $1=$self["@asyncTimeout"];
  47719. if(($receiver = $1) == null || $receiver.a$nil){
  47720. $1;
  47721. } else {
  47722. $recv($self["@asyncTimeout"])._clearTimeout();
  47723. }
  47724. $self["@asyncTimeout"]=(0);
  47725. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47726. return $core.withContext(function($ctx2) {
  47727. return $self._assert_description_(false,"SUnit grace time exhausted");
  47728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47729. })))._valueWithTimeout_(aNumber);
  47730. return self;
  47731. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47732. },
  47733. args: ["aNumber"],
  47734. 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",
  47735. referencedClasses: [],
  47736. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47737. }),
  47738. $globals.TestCase);
  47739. $core.addMethod(
  47740. $core.method({
  47741. selector: "allTestSelectors",
  47742. protocol: "accessing",
  47743. fn: function (){
  47744. var self=this,$self=this;
  47745. var selectors;
  47746. return $core.withContext(function($ctx1) {
  47747. var $1;
  47748. selectors=$self._testSelectors();
  47749. $1=$self._shouldInheritSelectors();
  47750. if($core.assert($1)){
  47751. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47752. }
  47753. return selectors;
  47754. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47755. },
  47756. args: [],
  47757. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47758. referencedClasses: [],
  47759. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47760. }),
  47761. $globals.TestCase.a$cls);
  47762. $core.addMethod(
  47763. $core.method({
  47764. selector: "buildSuite",
  47765. protocol: "accessing",
  47766. fn: function (){
  47767. var self=this,$self=this;
  47768. return $core.withContext(function($ctx1) {
  47769. return $recv($self._allTestSelectors())._collect_((function(each){
  47770. return $core.withContext(function($ctx2) {
  47771. return $self._selector_(each);
  47772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47773. }));
  47774. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47775. },
  47776. args: [],
  47777. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47778. referencedClasses: [],
  47779. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47780. }),
  47781. $globals.TestCase.a$cls);
  47782. $core.addMethod(
  47783. $core.method({
  47784. selector: "classTag",
  47785. protocol: "accessing",
  47786. fn: function (){
  47787. var self=this,$self=this;
  47788. return "test";
  47789. },
  47790. args: [],
  47791. 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'",
  47792. referencedClasses: [],
  47793. messageSends: []
  47794. }),
  47795. $globals.TestCase.a$cls);
  47796. $core.addMethod(
  47797. $core.method({
  47798. selector: "isAbstract",
  47799. protocol: "testing",
  47800. fn: function (){
  47801. var self=this,$self=this;
  47802. return $core.withContext(function($ctx1) {
  47803. return $recv($self._name()).__eq("TestCase");
  47804. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47805. },
  47806. args: [],
  47807. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47808. referencedClasses: [],
  47809. messageSends: ["=", "name"]
  47810. }),
  47811. $globals.TestCase.a$cls);
  47812. $core.addMethod(
  47813. $core.method({
  47814. selector: "isTestClass",
  47815. protocol: "testing",
  47816. fn: function (){
  47817. var self=this,$self=this;
  47818. return $core.withContext(function($ctx1) {
  47819. return $recv($self._isAbstract())._not();
  47820. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47821. },
  47822. args: [],
  47823. source: "isTestClass\x0a\x09^ self isAbstract not",
  47824. referencedClasses: [],
  47825. messageSends: ["not", "isAbstract"]
  47826. }),
  47827. $globals.TestCase.a$cls);
  47828. $core.addMethod(
  47829. $core.method({
  47830. selector: "lookupHierarchyRoot",
  47831. protocol: "accessing",
  47832. fn: function (){
  47833. var self=this,$self=this;
  47834. return $globals.TestCase;
  47835. },
  47836. args: [],
  47837. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47838. referencedClasses: ["TestCase"],
  47839. messageSends: []
  47840. }),
  47841. $globals.TestCase.a$cls);
  47842. $core.addMethod(
  47843. $core.method({
  47844. selector: "selector:",
  47845. protocol: "accessing",
  47846. fn: function (aSelector){
  47847. var self=this,$self=this;
  47848. return $core.withContext(function($ctx1) {
  47849. var $1;
  47850. $1=$self._new();
  47851. $recv($1)._setTestSelector_(aSelector);
  47852. return $recv($1)._yourself();
  47853. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47854. },
  47855. args: ["aSelector"],
  47856. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47857. referencedClasses: [],
  47858. messageSends: ["setTestSelector:", "new", "yourself"]
  47859. }),
  47860. $globals.TestCase.a$cls);
  47861. $core.addMethod(
  47862. $core.method({
  47863. selector: "shouldInheritSelectors",
  47864. protocol: "testing",
  47865. fn: function (){
  47866. var self=this,$self=this;
  47867. return $core.withContext(function($ctx1) {
  47868. return $self.__tild_eq($self._lookupHierarchyRoot());
  47869. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47870. },
  47871. args: [],
  47872. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47873. referencedClasses: [],
  47874. messageSends: ["~=", "lookupHierarchyRoot"]
  47875. }),
  47876. $globals.TestCase.a$cls);
  47877. $core.addMethod(
  47878. $core.method({
  47879. selector: "testSelectors",
  47880. protocol: "accessing",
  47881. fn: function (){
  47882. var self=this,$self=this;
  47883. return $core.withContext(function($ctx1) {
  47884. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47885. return $core.withContext(function($ctx2) {
  47886. return $recv(each)._match_("^test");
  47887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47888. }));
  47889. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47890. },
  47891. args: [],
  47892. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47893. referencedClasses: [],
  47894. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47895. }),
  47896. $globals.TestCase.a$cls);
  47897. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47898. $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).";
  47899. $core.addMethod(
  47900. $core.method({
  47901. selector: "execute:",
  47902. protocol: "running",
  47903. fn: function (aBlock){
  47904. var self=this,$self=this;
  47905. var failed;
  47906. return $core.withContext(function($ctx1) {
  47907. var $1,$2;
  47908. $recv($self["@testCase"])._context_(self);
  47909. $ctx1.sendIdx["context:"]=1;
  47910. $recv((function(){
  47911. return $core.withContext(function($ctx2) {
  47912. failed=true;
  47913. $recv(aBlock)._value();
  47914. failed=false;
  47915. return failed;
  47916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47917. }))._ensure_((function(){
  47918. return $core.withContext(function($ctx2) {
  47919. $recv($self["@testCase"])._context_(nil);
  47920. $1=$recv(failed)._and_((function(){
  47921. return $core.withContext(function($ctx3) {
  47922. return $recv($self["@testCase"])._isAsync();
  47923. $ctx3.sendIdx["isAsync"]=1;
  47924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47925. }));
  47926. if($core.assert($1)){
  47927. $recv($self["@testCase"])._finished();
  47928. }
  47929. $2=$recv($self["@testCase"])._isAsync();
  47930. if(!$core.assert($2)){
  47931. return $recv($self["@testCase"])._tearDown();
  47932. }
  47933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47934. }));
  47935. return self;
  47936. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47937. },
  47938. args: ["aBlock"],
  47939. 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 ] ]",
  47940. referencedClasses: [],
  47941. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47942. }),
  47943. $globals.TestContext);
  47944. $core.addMethod(
  47945. $core.method({
  47946. selector: "start",
  47947. protocol: "running",
  47948. fn: function (){
  47949. var self=this,$self=this;
  47950. return $core.withContext(function($ctx1) {
  47951. $self._execute_((function(){
  47952. return $core.withContext(function($ctx2) {
  47953. $recv($self["@testCase"])._setUp();
  47954. return $recv($self["@testCase"])._performTest();
  47955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47956. }));
  47957. return self;
  47958. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47959. },
  47960. args: [],
  47961. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47962. referencedClasses: [],
  47963. messageSends: ["execute:", "setUp", "performTest"]
  47964. }),
  47965. $globals.TestContext);
  47966. $core.addMethod(
  47967. $core.method({
  47968. selector: "testCase:",
  47969. protocol: "accessing",
  47970. fn: function (aTestCase){
  47971. var self=this,$self=this;
  47972. $self["@testCase"]=aTestCase;
  47973. return self;
  47974. },
  47975. args: ["aTestCase"],
  47976. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47977. referencedClasses: [],
  47978. messageSends: []
  47979. }),
  47980. $globals.TestContext);
  47981. $core.addMethod(
  47982. $core.method({
  47983. selector: "testCase:",
  47984. protocol: "instance creation",
  47985. fn: function (aTestCase){
  47986. var self=this,$self=this;
  47987. return $core.withContext(function($ctx1) {
  47988. var $1;
  47989. $1=$self._new();
  47990. $recv($1)._testCase_(aTestCase);
  47991. return $recv($1)._yourself();
  47992. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47993. },
  47994. args: ["aTestCase"],
  47995. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47996. referencedClasses: [],
  47997. messageSends: ["testCase:", "new", "yourself"]
  47998. }),
  47999. $globals.TestContext.a$cls);
  48000. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48001. $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`.";
  48002. $core.addMethod(
  48003. $core.method({
  48004. selector: "execute:",
  48005. protocol: "running",
  48006. fn: function (aBlock){
  48007. var self=this,$self=this;
  48008. return $core.withContext(function($ctx1) {
  48009. var $1;
  48010. $recv((function(){
  48011. return $core.withContext(function($ctx2) {
  48012. return $self._withErrorReporting_((function(){
  48013. return $core.withContext(function($ctx3) {
  48014. return (
  48015. $ctx3.supercall = true,
  48016. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48017. $ctx3.supercall = false;
  48018. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48019. }));
  48020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48021. }))._ensure_((function(){
  48022. return $core.withContext(function($ctx2) {
  48023. $1=$recv($self["@testCase"])._isAsync();
  48024. if(!$core.assert($1)){
  48025. $recv($self["@result"])._increaseRuns();
  48026. return $recv($self["@finished"])._value();
  48027. }
  48028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48029. }));
  48030. return self;
  48031. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48032. },
  48033. args: ["aBlock"],
  48034. 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 ] ]",
  48035. referencedClasses: [],
  48036. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48037. }),
  48038. $globals.ReportingTestContext);
  48039. $core.addMethod(
  48040. $core.method({
  48041. selector: "finished:",
  48042. protocol: "accessing",
  48043. fn: function (aBlock){
  48044. var self=this,$self=this;
  48045. $self["@finished"]=aBlock;
  48046. return self;
  48047. },
  48048. args: ["aBlock"],
  48049. source: "finished: aBlock\x0a\x09finished := aBlock",
  48050. referencedClasses: [],
  48051. messageSends: []
  48052. }),
  48053. $globals.ReportingTestContext);
  48054. $core.addMethod(
  48055. $core.method({
  48056. selector: "result:",
  48057. protocol: "accessing",
  48058. fn: function (aTestResult){
  48059. var self=this,$self=this;
  48060. $self["@result"]=aTestResult;
  48061. return self;
  48062. },
  48063. args: ["aTestResult"],
  48064. source: "result: aTestResult\x0a\x09result := aTestResult",
  48065. referencedClasses: [],
  48066. messageSends: []
  48067. }),
  48068. $globals.ReportingTestContext);
  48069. $core.addMethod(
  48070. $core.method({
  48071. selector: "withErrorReporting:",
  48072. protocol: "private",
  48073. fn: function (aBlock){
  48074. var self=this,$self=this;
  48075. return $core.withContext(function($ctx1) {
  48076. $recv((function(){
  48077. return $core.withContext(function($ctx2) {
  48078. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48079. return $core.withContext(function($ctx3) {
  48080. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48081. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48082. }));
  48083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48084. }))._on_do_($globals.Error,(function(ex){
  48085. return $core.withContext(function($ctx2) {
  48086. return $recv($self["@result"])._addError_($self["@testCase"]);
  48087. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48088. }));
  48089. $ctx1.sendIdx["on:do:"]=1;
  48090. return self;
  48091. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48092. },
  48093. args: ["aBlock"],
  48094. 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 ]",
  48095. referencedClasses: ["TestFailure", "Error"],
  48096. messageSends: ["on:do:", "addFailure:", "addError:"]
  48097. }),
  48098. $globals.ReportingTestContext);
  48099. $core.addMethod(
  48100. $core.method({
  48101. selector: "testCase:result:finished:",
  48102. protocol: "instance creation",
  48103. fn: function (aTestCase,aTestResult,aBlock){
  48104. var self=this,$self=this;
  48105. return $core.withContext(function($ctx1) {
  48106. var $1;
  48107. $1=(
  48108. $ctx1.supercall = true,
  48109. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48110. $ctx1.supercall = false;
  48111. $recv($1)._result_(aTestResult);
  48112. $recv($1)._finished_(aBlock);
  48113. return $recv($1)._yourself();
  48114. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48115. },
  48116. args: ["aTestCase", "aTestResult", "aBlock"],
  48117. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48118. referencedClasses: [],
  48119. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48120. }),
  48121. $globals.ReportingTestContext.a$cls);
  48122. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48123. $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.";
  48124. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48125. $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";
  48126. $core.addMethod(
  48127. $core.method({
  48128. selector: "addError:",
  48129. protocol: "accessing",
  48130. fn: function (anError){
  48131. var self=this,$self=this;
  48132. return $core.withContext(function($ctx1) {
  48133. $recv($self._errors())._add_(anError);
  48134. return self;
  48135. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48136. },
  48137. args: ["anError"],
  48138. source: "addError: anError\x0a\x09self errors add: anError",
  48139. referencedClasses: [],
  48140. messageSends: ["add:", "errors"]
  48141. }),
  48142. $globals.TestResult);
  48143. $core.addMethod(
  48144. $core.method({
  48145. selector: "addFailure:",
  48146. protocol: "accessing",
  48147. fn: function (aFailure){
  48148. var self=this,$self=this;
  48149. return $core.withContext(function($ctx1) {
  48150. $recv($self._failures())._add_(aFailure);
  48151. return self;
  48152. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48153. },
  48154. args: ["aFailure"],
  48155. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48156. referencedClasses: [],
  48157. messageSends: ["add:", "failures"]
  48158. }),
  48159. $globals.TestResult);
  48160. $core.addMethod(
  48161. $core.method({
  48162. selector: "errors",
  48163. protocol: "accessing",
  48164. fn: function (){
  48165. var self=this,$self=this;
  48166. return $self["@errors"];
  48167. },
  48168. args: [],
  48169. source: "errors\x0a\x09^ errors",
  48170. referencedClasses: [],
  48171. messageSends: []
  48172. }),
  48173. $globals.TestResult);
  48174. $core.addMethod(
  48175. $core.method({
  48176. selector: "failures",
  48177. protocol: "accessing",
  48178. fn: function (){
  48179. var self=this,$self=this;
  48180. return $self["@failures"];
  48181. },
  48182. args: [],
  48183. source: "failures\x0a\x09^ failures",
  48184. referencedClasses: [],
  48185. messageSends: []
  48186. }),
  48187. $globals.TestResult);
  48188. $core.addMethod(
  48189. $core.method({
  48190. selector: "increaseRuns",
  48191. protocol: "accessing",
  48192. fn: function (){
  48193. var self=this,$self=this;
  48194. return $core.withContext(function($ctx1) {
  48195. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48196. return self;
  48197. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48198. },
  48199. args: [],
  48200. source: "increaseRuns\x0a\x09runs := runs + 1",
  48201. referencedClasses: [],
  48202. messageSends: ["+"]
  48203. }),
  48204. $globals.TestResult);
  48205. $core.addMethod(
  48206. $core.method({
  48207. selector: "initialize",
  48208. protocol: "initialization",
  48209. fn: function (){
  48210. var self=this,$self=this;
  48211. return $core.withContext(function($ctx1) {
  48212. (
  48213. $ctx1.supercall = true,
  48214. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48215. $ctx1.supercall = false;
  48216. $self["@timestamp"]=$recv($globals.Date)._now();
  48217. $self["@runs"]=(0);
  48218. $self["@errors"]=$recv($globals.Array)._new();
  48219. $ctx1.sendIdx["new"]=1;
  48220. $self["@failures"]=$recv($globals.Array)._new();
  48221. $self["@total"]=(0);
  48222. return self;
  48223. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48224. },
  48225. args: [],
  48226. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48227. referencedClasses: ["Date", "Array"],
  48228. messageSends: ["initialize", "now", "new"]
  48229. }),
  48230. $globals.TestResult);
  48231. $core.addMethod(
  48232. $core.method({
  48233. selector: "nextRunDo:",
  48234. protocol: "running",
  48235. fn: function (aBlock){
  48236. var self=this,$self=this;
  48237. return $core.withContext(function($ctx1) {
  48238. var $2,$1;
  48239. $2=$self._runs();
  48240. $ctx1.sendIdx["runs"]=1;
  48241. $1=$recv($2).__eq_eq($self._total());
  48242. if(!$core.assert($1)){
  48243. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48244. }
  48245. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48246. },
  48247. args: ["aBlock"],
  48248. 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 ]",
  48249. referencedClasses: [],
  48250. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48251. }),
  48252. $globals.TestResult);
  48253. $core.addMethod(
  48254. $core.method({
  48255. selector: "runCase:",
  48256. protocol: "running",
  48257. fn: function (aTestCase){
  48258. var self=this,$self=this;
  48259. return $core.withContext(function($ctx1) {
  48260. $recv((function(){
  48261. return $core.withContext(function($ctx2) {
  48262. return $recv((function(){
  48263. return $core.withContext(function($ctx3) {
  48264. $self._increaseRuns();
  48265. return $recv(aTestCase)._runCase();
  48266. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48267. }))._on_do_($globals.TestFailure,(function(ex){
  48268. return $core.withContext(function($ctx3) {
  48269. return $self._addFailure_(aTestCase);
  48270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48271. }));
  48272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48273. }))._on_do_($globals.Error,(function(ex){
  48274. return $core.withContext(function($ctx2) {
  48275. return $self._addError_(aTestCase);
  48276. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48277. }));
  48278. $ctx1.sendIdx["on:do:"]=1;
  48279. return self;
  48280. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48281. },
  48282. args: ["aTestCase"],
  48283. 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 ]",
  48284. referencedClasses: ["TestFailure", "Error"],
  48285. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48286. }),
  48287. $globals.TestResult);
  48288. $core.addMethod(
  48289. $core.method({
  48290. selector: "runs",
  48291. protocol: "accessing",
  48292. fn: function (){
  48293. var self=this,$self=this;
  48294. return $self["@runs"];
  48295. },
  48296. args: [],
  48297. source: "runs\x0a\x09^ runs",
  48298. referencedClasses: [],
  48299. messageSends: []
  48300. }),
  48301. $globals.TestResult);
  48302. $core.addMethod(
  48303. $core.method({
  48304. selector: "status",
  48305. protocol: "accessing",
  48306. fn: function (){
  48307. var self=this,$self=this;
  48308. return $core.withContext(function($ctx1) {
  48309. var $1;
  48310. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48311. return "error";
  48312. }),(function(){
  48313. return $core.withContext(function($ctx2) {
  48314. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48315. return "failure";
  48316. }),(function(){
  48317. return "success";
  48318. }));
  48319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48320. }));
  48321. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48322. return $1;
  48323. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48324. },
  48325. args: [],
  48326. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48327. referencedClasses: [],
  48328. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48329. }),
  48330. $globals.TestResult);
  48331. $core.addMethod(
  48332. $core.method({
  48333. selector: "timestamp",
  48334. protocol: "accessing",
  48335. fn: function (){
  48336. var self=this,$self=this;
  48337. return $self["@timestamp"];
  48338. },
  48339. args: [],
  48340. source: "timestamp\x0a\x09^ timestamp",
  48341. referencedClasses: [],
  48342. messageSends: []
  48343. }),
  48344. $globals.TestResult);
  48345. $core.addMethod(
  48346. $core.method({
  48347. selector: "total",
  48348. protocol: "accessing",
  48349. fn: function (){
  48350. var self=this,$self=this;
  48351. return $self["@total"];
  48352. },
  48353. args: [],
  48354. source: "total\x0a\x09^ total",
  48355. referencedClasses: [],
  48356. messageSends: []
  48357. }),
  48358. $globals.TestResult);
  48359. $core.addMethod(
  48360. $core.method({
  48361. selector: "total:",
  48362. protocol: "accessing",
  48363. fn: function (aNumber){
  48364. var self=this,$self=this;
  48365. $self["@total"]=aNumber;
  48366. return self;
  48367. },
  48368. args: ["aNumber"],
  48369. source: "total: aNumber\x0a\x09total := aNumber",
  48370. referencedClasses: [],
  48371. messageSends: []
  48372. }),
  48373. $globals.TestResult);
  48374. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48375. $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`.";
  48376. $core.addMethod(
  48377. $core.method({
  48378. selector: "announcer",
  48379. protocol: "accessing",
  48380. fn: function (){
  48381. var self=this,$self=this;
  48382. return $self["@announcer"];
  48383. },
  48384. args: [],
  48385. source: "announcer\x0a\x09^ announcer",
  48386. referencedClasses: [],
  48387. messageSends: []
  48388. }),
  48389. $globals.TestSuiteRunner);
  48390. $core.addMethod(
  48391. $core.method({
  48392. selector: "contextOf:",
  48393. protocol: "private",
  48394. fn: function (anInteger){
  48395. var self=this,$self=this;
  48396. return $core.withContext(function($ctx1) {
  48397. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48398. return $core.withContext(function($ctx2) {
  48399. return $self._resume();
  48400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48401. }));
  48402. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48403. },
  48404. args: ["anInteger"],
  48405. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48406. referencedClasses: ["ReportingTestContext"],
  48407. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48408. }),
  48409. $globals.TestSuiteRunner);
  48410. $core.addMethod(
  48411. $core.method({
  48412. selector: "initialize",
  48413. protocol: "initialization",
  48414. fn: function (){
  48415. var self=this,$self=this;
  48416. return $core.withContext(function($ctx1) {
  48417. var $1;
  48418. (
  48419. $ctx1.supercall = true,
  48420. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48421. $ctx1.supercall = false;
  48422. $self["@announcer"]=$recv($globals.Announcer)._new();
  48423. $ctx1.sendIdx["new"]=1;
  48424. $self["@result"]=$recv($globals.TestResult)._new();
  48425. $self["@runNextTest"]=(function(){
  48426. var runs;
  48427. return $core.withContext(function($ctx2) {
  48428. runs=$recv($self["@result"])._runs();
  48429. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48430. if($core.assert($1)){
  48431. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48432. }
  48433. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48434. });
  48435. return self;
  48436. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48437. },
  48438. args: [],
  48439. 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 ] ].",
  48440. referencedClasses: ["Announcer", "TestResult"],
  48441. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48442. }),
  48443. $globals.TestSuiteRunner);
  48444. $core.addMethod(
  48445. $core.method({
  48446. selector: "result",
  48447. protocol: "accessing",
  48448. fn: function (){
  48449. var self=this,$self=this;
  48450. return $self["@result"];
  48451. },
  48452. args: [],
  48453. source: "result\x0a\x09^ result",
  48454. referencedClasses: [],
  48455. messageSends: []
  48456. }),
  48457. $globals.TestSuiteRunner);
  48458. $core.addMethod(
  48459. $core.method({
  48460. selector: "resume",
  48461. protocol: "actions",
  48462. fn: function (){
  48463. var self=this,$self=this;
  48464. return $core.withContext(function($ctx1) {
  48465. $recv($self["@runNextTest"])._fork();
  48466. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48467. return self;
  48468. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48469. },
  48470. args: [],
  48471. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48472. referencedClasses: ["ResultAnnouncement"],
  48473. messageSends: ["fork", "announce:", "result:", "new"]
  48474. }),
  48475. $globals.TestSuiteRunner);
  48476. $core.addMethod(
  48477. $core.method({
  48478. selector: "run",
  48479. protocol: "actions",
  48480. fn: function (){
  48481. var self=this,$self=this;
  48482. return $core.withContext(function($ctx1) {
  48483. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48484. $self._resume();
  48485. return self;
  48486. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48487. },
  48488. args: [],
  48489. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48490. referencedClasses: [],
  48491. messageSends: ["total:", "size", "resume"]
  48492. }),
  48493. $globals.TestSuiteRunner);
  48494. $core.addMethod(
  48495. $core.method({
  48496. selector: "suite:",
  48497. protocol: "accessing",
  48498. fn: function (aCollection){
  48499. var self=this,$self=this;
  48500. $self["@suite"]=aCollection;
  48501. return self;
  48502. },
  48503. args: ["aCollection"],
  48504. source: "suite: aCollection\x0a\x09suite := aCollection",
  48505. referencedClasses: [],
  48506. messageSends: []
  48507. }),
  48508. $globals.TestSuiteRunner);
  48509. $core.addMethod(
  48510. $core.method({
  48511. selector: "new",
  48512. protocol: "instance creation",
  48513. fn: function (){
  48514. var self=this,$self=this;
  48515. return $core.withContext(function($ctx1) {
  48516. $self._shouldNotImplement();
  48517. return self;
  48518. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48519. },
  48520. args: [],
  48521. source: "new\x0a\x09self shouldNotImplement",
  48522. referencedClasses: [],
  48523. messageSends: ["shouldNotImplement"]
  48524. }),
  48525. $globals.TestSuiteRunner.a$cls);
  48526. $core.addMethod(
  48527. $core.method({
  48528. selector: "on:",
  48529. protocol: "instance creation",
  48530. fn: function (aCollection){
  48531. var self=this,$self=this;
  48532. return $core.withContext(function($ctx1) {
  48533. var $1;
  48534. $1=(
  48535. $ctx1.supercall = true,
  48536. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48537. $ctx1.supercall = false;
  48538. return $recv($1)._suite_(aCollection);
  48539. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48540. },
  48541. args: ["aCollection"],
  48542. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48543. referencedClasses: [],
  48544. messageSends: ["suite:", "new"]
  48545. }),
  48546. $globals.TestSuiteRunner.a$cls);
  48547. $core.addMethod(
  48548. $core.method({
  48549. selector: "isTestPackage",
  48550. protocol: "*SUnit",
  48551. fn: function (){
  48552. var self=this,$self=this;
  48553. return $core.withContext(function($ctx1) {
  48554. return $recv($self._classes())._anySatisfy_((function(each){
  48555. return $core.withContext(function($ctx2) {
  48556. return $recv(each)._isTestClass();
  48557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48558. }));
  48559. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48560. },
  48561. args: [],
  48562. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48563. referencedClasses: [],
  48564. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48565. }),
  48566. $globals.Package);
  48567. $core.addMethod(
  48568. $core.method({
  48569. selector: "isTestClass",
  48570. protocol: "*SUnit",
  48571. fn: function (){
  48572. var self=this,$self=this;
  48573. return false;
  48574. },
  48575. args: [],
  48576. source: "isTestClass\x0a\x09^ false",
  48577. referencedClasses: [],
  48578. messageSends: []
  48579. }),
  48580. $globals.TBehaviorDefaults);
  48581. });
  48582. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48583. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48584. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48585. var $pkg = $core.addPackage("Compiler-Tests");
  48586. $pkg.innerEval = function (expr) { return eval(expr); };
  48587. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  48588. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48589. $core.addMethod(
  48590. $core.method({
  48591. selector: "parse:forClass:",
  48592. protocol: "parsing",
  48593. fn: function (aString,aClass){
  48594. var self=this,$self=this;
  48595. return $core.withContext(function($ctx1) {
  48596. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48597. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48598. },
  48599. args: ["aString", "aClass"],
  48600. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48601. referencedClasses: ["Compiler"],
  48602. messageSends: ["ast:forClass:protocol:", "new"]
  48603. }),
  48604. $globals.ASTParsingTest);
  48605. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48606. $core.addMethod(
  48607. $core.method({
  48608. selector: "astPCNodeVisitor",
  48609. protocol: "factory",
  48610. fn: function (){
  48611. var self=this,$self=this;
  48612. return $core.withContext(function($ctx1) {
  48613. var $1;
  48614. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48615. $recv($1)._index_((0));
  48616. return $recv($1)._yourself();
  48617. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48618. },
  48619. args: [],
  48620. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48621. referencedClasses: ["ASTPCNodeVisitor"],
  48622. messageSends: ["index:", "new", "yourself"]
  48623. }),
  48624. $globals.ASTPCNodeVisitorTest);
  48625. $core.addMethod(
  48626. $core.method({
  48627. selector: "astPCNodeVisitorForSelector:",
  48628. protocol: "factory",
  48629. fn: function (aString){
  48630. var self=this,$self=this;
  48631. return $core.withContext(function($ctx1) {
  48632. var $1;
  48633. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48634. $recv($1)._selector_(aString);
  48635. $recv($1)._index_((0));
  48636. return $recv($1)._yourself();
  48637. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48638. },
  48639. args: ["aString"],
  48640. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48641. referencedClasses: ["ASTPCNodeVisitor"],
  48642. messageSends: ["selector:", "new", "index:", "yourself"]
  48643. }),
  48644. $globals.ASTPCNodeVisitorTest);
  48645. $core.addMethod(
  48646. $core.method({
  48647. selector: "testJSStatementNode",
  48648. protocol: "tests",
  48649. fn: function (){
  48650. var self=this,$self=this;
  48651. var ast,visitor;
  48652. return $core.withContext(function($ctx1) {
  48653. var $3,$2,$1;
  48654. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48655. $3=$self._astPCNodeVisitor();
  48656. $recv($3)._visit_(ast);
  48657. $2=$recv($3)._currentNode();
  48658. $1=$recv($2)._isJSStatementNode();
  48659. $self._assert_($1);
  48660. return self;
  48661. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48662. },
  48663. args: [],
  48664. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48665. referencedClasses: ["Object"],
  48666. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48667. }),
  48668. $globals.ASTPCNodeVisitorTest);
  48669. $core.addMethod(
  48670. $core.method({
  48671. selector: "testMessageSend",
  48672. protocol: "tests",
  48673. fn: function (){
  48674. var self=this,$self=this;
  48675. var ast;
  48676. return $core.withContext(function($ctx1) {
  48677. var $3,$2,$1;
  48678. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48679. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48680. $recv($3)._visit_(ast);
  48681. $2=$recv($3)._currentNode();
  48682. $1=$recv($2)._selector();
  48683. $self._assert_equals_($1,"yourself");
  48684. return self;
  48685. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48686. },
  48687. args: [],
  48688. 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'",
  48689. referencedClasses: ["Object"],
  48690. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48691. }),
  48692. $globals.ASTPCNodeVisitorTest);
  48693. $core.addMethod(
  48694. $core.method({
  48695. selector: "testMessageSendWithBlocks",
  48696. protocol: "tests",
  48697. fn: function (){
  48698. var self=this,$self=this;
  48699. var ast;
  48700. return $core.withContext(function($ctx1) {
  48701. var $3,$2,$1;
  48702. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48703. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48704. $recv($3)._visit_(ast);
  48705. $2=$recv($3)._currentNode();
  48706. $1=$recv($2)._selector();
  48707. $self._assert_equals_($1,"yourself");
  48708. return self;
  48709. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48710. },
  48711. args: [],
  48712. 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'",
  48713. referencedClasses: ["Object"],
  48714. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48715. }),
  48716. $globals.ASTPCNodeVisitorTest);
  48717. $core.addMethod(
  48718. $core.method({
  48719. selector: "testMessageSendWithInlining",
  48720. protocol: "tests",
  48721. fn: function (){
  48722. var self=this,$self=this;
  48723. var ast;
  48724. return $core.withContext(function($ctx1) {
  48725. var $3,$4,$2,$1,$7,$6,$5;
  48726. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48727. $ctx1.sendIdx["parse:forClass:"]=1;
  48728. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48729. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48730. $recv($3)._visit_(ast);
  48731. $ctx1.sendIdx["visit:"]=1;
  48732. $4=$recv($3)._currentNode();
  48733. $ctx1.sendIdx["currentNode"]=1;
  48734. $2=$4;
  48735. $1=$recv($2)._selector();
  48736. $ctx1.sendIdx["selector"]=1;
  48737. $self._assert_equals_($1,"yourself");
  48738. $ctx1.sendIdx["assert:equals:"]=1;
  48739. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48740. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48741. $recv($7)._visit_(ast);
  48742. $6=$recv($7)._currentNode();
  48743. $5=$recv($6)._selector();
  48744. $self._assert_equals_($5,"asBoolean");
  48745. return self;
  48746. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48747. },
  48748. args: [],
  48749. 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'",
  48750. referencedClasses: ["Object"],
  48751. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48752. }),
  48753. $globals.ASTPCNodeVisitorTest);
  48754. $core.addMethod(
  48755. $core.method({
  48756. selector: "testNoMessageSend",
  48757. protocol: "tests",
  48758. fn: function (){
  48759. var self=this,$self=this;
  48760. var ast;
  48761. return $core.withContext(function($ctx1) {
  48762. var $3,$2,$1;
  48763. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48764. $3=$self._astPCNodeVisitor();
  48765. $recv($3)._visit_(ast);
  48766. $2=$recv($3)._currentNode();
  48767. $1=$recv($2)._isNil();
  48768. $self._assert_($1);
  48769. return self;
  48770. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48771. },
  48772. args: [],
  48773. 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",
  48774. referencedClasses: ["Object"],
  48775. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48776. }),
  48777. $globals.ASTPCNodeVisitorTest);
  48778. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48779. $core.addMethod(
  48780. $core.method({
  48781. selector: "testNodeAtPosition",
  48782. protocol: "tests",
  48783. fn: function (){
  48784. var self=this,$self=this;
  48785. var node;
  48786. return $core.withContext(function($ctx1) {
  48787. var $3,$4,$2,$1,$7,$8,$6,$5;
  48788. node=$self._parse_forClass_("yourself\x0d\x0a\x09^ self",$globals.Object);
  48789. $ctx1.sendIdx["parse:forClass:"]=1;
  48790. $3=node;
  48791. $4=(2).__at((4));
  48792. $ctx1.sendIdx["@"]=1;
  48793. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48794. return nil;
  48795. }));
  48796. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48797. $1=$recv($2)._source();
  48798. $self._assert_equals_($1,"self");
  48799. $ctx1.sendIdx["assert:equals:"]=1;
  48800. node=$self._parse_forClass_("foo\x0d\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48801. $ctx1.sendIdx["parse:forClass:"]=2;
  48802. $7=node;
  48803. $8=(2).__at((7));
  48804. $ctx1.sendIdx["@"]=2;
  48805. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48806. return nil;
  48807. }));
  48808. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48809. $5=$recv($6)._selector();
  48810. $ctx1.sendIdx["selector"]=1;
  48811. $self._assert_equals_($5,"ifTrue:");
  48812. $ctx1.sendIdx["assert:equals:"]=2;
  48813. node=$self._parse_forClass_("foo\x0d\x0a\x09self foo; bar; baz",$globals.Object);
  48814. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48815. return nil;
  48816. })))._selector(),"foo");
  48817. return self;
  48818. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48819. },
  48820. args: [],
  48821. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48822. referencedClasses: ["Object"],
  48823. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48824. }),
  48825. $globals.ASTPositionTest);
  48826. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48827. $core.addMethod(
  48828. $core.method({
  48829. selector: "codeGeneratorClass",
  48830. protocol: "accessing",
  48831. fn: function (){
  48832. var self=this,$self=this;
  48833. return $globals.CodeGenerator;
  48834. },
  48835. args: [],
  48836. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48837. referencedClasses: ["CodeGenerator"],
  48838. messageSends: []
  48839. }),
  48840. $globals.CodeGeneratorTest);
  48841. $core.addMethod(
  48842. $core.method({
  48843. selector: "compiler",
  48844. protocol: "factory",
  48845. fn: function (){
  48846. var self=this,$self=this;
  48847. return $core.withContext(function($ctx1) {
  48848. var $1;
  48849. $1=$recv($globals.Compiler)._new();
  48850. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48851. return $recv($1)._yourself();
  48852. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48853. },
  48854. args: [],
  48855. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48856. referencedClasses: ["Compiler"],
  48857. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48858. }),
  48859. $globals.CodeGeneratorTest);
  48860. $core.addMethod(
  48861. $core.method({
  48862. selector: "setUp",
  48863. protocol: "initialization",
  48864. fn: function (){
  48865. var self=this,$self=this;
  48866. return $core.withContext(function($ctx1) {
  48867. $self["@receiver"]=$recv($globals.DoIt)._new();
  48868. return self;
  48869. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48870. },
  48871. args: [],
  48872. source: "setUp\x0a\x09receiver := DoIt new",
  48873. referencedClasses: ["DoIt"],
  48874. messageSends: ["new"]
  48875. }),
  48876. $globals.CodeGeneratorTest);
  48877. $core.addMethod(
  48878. $core.method({
  48879. selector: "should:receiver:raise:",
  48880. protocol: "testing",
  48881. fn: function (aString,anObject,anErrorClass){
  48882. var self=this,$self=this;
  48883. var method,result;
  48884. return $core.withContext(function($ctx1) {
  48885. var $1,$2,$3,$receiver;
  48886. $self["@receiver"]=anObject;
  48887. $recv((function(){
  48888. return $core.withContext(function($ctx2) {
  48889. return $self._should_raise_((function(){
  48890. return $core.withContext(function($ctx3) {
  48891. $1=$self._compiler();
  48892. $2=$recv(anObject)._class();
  48893. $ctx3.sendIdx["class"]=1;
  48894. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48895. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48896. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48897. }),anErrorClass);
  48898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48899. }))._ensure_((function(){
  48900. return $core.withContext(function($ctx2) {
  48901. $3=method;
  48902. if(($receiver = $3) == null || $receiver.a$nil){
  48903. return $3;
  48904. } else {
  48905. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48906. }
  48907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48908. }));
  48909. return self;
  48910. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48911. },
  48912. args: ["aString", "anObject", "anErrorClass"],
  48913. 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 ] ]",
  48914. referencedClasses: [],
  48915. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48916. }),
  48917. $globals.CodeGeneratorTest);
  48918. $core.addMethod(
  48919. $core.method({
  48920. selector: "should:receiver:return:",
  48921. protocol: "testing",
  48922. fn: function (aString,anObject,aResult){
  48923. var self=this,$self=this;
  48924. var method,result;
  48925. return $core.withContext(function($ctx1) {
  48926. var $1,$2;
  48927. $self["@receiver"]=anObject;
  48928. $1=$self._compiler();
  48929. $2=$recv(anObject)._class();
  48930. $ctx1.sendIdx["class"]=1;
  48931. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48932. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48933. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48934. $self._assert_equals_(aResult,result);
  48935. return self;
  48936. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48937. },
  48938. args: ["aString", "anObject", "aResult"],
  48939. 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",
  48940. referencedClasses: [],
  48941. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48942. }),
  48943. $globals.CodeGeneratorTest);
  48944. $core.addMethod(
  48945. $core.method({
  48946. selector: "should:return:",
  48947. protocol: "testing",
  48948. fn: function (aString,anObject){
  48949. var self=this,$self=this;
  48950. return $core.withContext(function($ctx1) {
  48951. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48952. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48953. },
  48954. args: ["aString", "anObject"],
  48955. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48956. referencedClasses: [],
  48957. messageSends: ["should:receiver:return:"]
  48958. }),
  48959. $globals.CodeGeneratorTest);
  48960. $core.addMethod(
  48961. $core.method({
  48962. selector: "tearDown",
  48963. protocol: "initialization",
  48964. fn: function (){
  48965. var self=this,$self=this;
  48966. return self;
  48967. },
  48968. args: [],
  48969. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48970. referencedClasses: [],
  48971. messageSends: []
  48972. }),
  48973. $globals.CodeGeneratorTest);
  48974. $core.addMethod(
  48975. $core.method({
  48976. selector: "testAssignment",
  48977. protocol: "tests",
  48978. fn: function (){
  48979. var self=this,$self=this;
  48980. return $core.withContext(function($ctx1) {
  48981. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48982. $ctx1.sendIdx["should:return:"]=1;
  48983. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48984. $ctx1.sendIdx["should:return:"]=2;
  48985. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48986. return self;
  48987. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48988. },
  48989. args: [],
  48990. 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",
  48991. referencedClasses: [],
  48992. messageSends: ["should:return:"]
  48993. }),
  48994. $globals.CodeGeneratorTest);
  48995. $core.addMethod(
  48996. $core.method({
  48997. selector: "testBackslashSelectors",
  48998. protocol: "tests",
  48999. fn: function (){
  49000. var self=this,$self=this;
  49001. return $core.withContext(function($ctx1) {
  49002. $self._should_return_("\x5c arg ^ 4",(4));
  49003. $ctx1.sendIdx["should:return:"]=1;
  49004. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49005. return self;
  49006. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49007. },
  49008. args: [],
  49009. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49010. referencedClasses: [],
  49011. messageSends: ["should:return:"]
  49012. }),
  49013. $globals.CodeGeneratorTest);
  49014. $core.addMethod(
  49015. $core.method({
  49016. selector: "testBlockReturn",
  49017. protocol: "tests",
  49018. fn: function (){
  49019. var self=this,$self=this;
  49020. return $core.withContext(function($ctx1) {
  49021. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49022. $ctx1.sendIdx["should:return:"]=1;
  49023. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49024. $ctx1.sendIdx["should:return:"]=2;
  49025. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49026. return self;
  49027. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49028. },
  49029. args: [],
  49030. 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).",
  49031. referencedClasses: [],
  49032. messageSends: ["should:return:"]
  49033. }),
  49034. $globals.CodeGeneratorTest);
  49035. $core.addMethod(
  49036. $core.method({
  49037. selector: "testCascades",
  49038. protocol: "tests",
  49039. fn: function (){
  49040. var self=this,$self=this;
  49041. return $core.withContext(function($ctx1) {
  49042. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49043. return self;
  49044. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49045. },
  49046. args: [],
  49047. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49048. referencedClasses: [],
  49049. messageSends: ["should:return:"]
  49050. }),
  49051. $globals.CodeGeneratorTest);
  49052. $core.addMethod(
  49053. $core.method({
  49054. selector: "testCascadesInDynamicArray",
  49055. protocol: "tests",
  49056. fn: function (){
  49057. var self=this,$self=this;
  49058. return $core.withContext(function($ctx1) {
  49059. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49060. return self;
  49061. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49062. },
  49063. args: [],
  49064. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49065. referencedClasses: [],
  49066. messageSends: ["should:return:"]
  49067. }),
  49068. $globals.CodeGeneratorTest);
  49069. $core.addMethod(
  49070. $core.method({
  49071. selector: "testCascadesInDynamicDictioary",
  49072. protocol: "tests",
  49073. fn: function (){
  49074. var self=this,$self=this;
  49075. return $core.withContext(function($ctx1) {
  49076. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49077. return self;
  49078. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49079. },
  49080. args: [],
  49081. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49082. referencedClasses: [],
  49083. messageSends: ["should:return:"]
  49084. }),
  49085. $globals.CodeGeneratorTest);
  49086. $core.addMethod(
  49087. $core.method({
  49088. selector: "testCascadesInSend",
  49089. protocol: "tests",
  49090. fn: function (){
  49091. var self=this,$self=this;
  49092. return $core.withContext(function($ctx1) {
  49093. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49094. return self;
  49095. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49096. },
  49097. args: [],
  49098. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49099. referencedClasses: [],
  49100. messageSends: ["should:return:"]
  49101. }),
  49102. $globals.CodeGeneratorTest);
  49103. $core.addMethod(
  49104. $core.method({
  49105. selector: "testCascadesWithInlining",
  49106. protocol: "tests",
  49107. fn: function (){
  49108. var self=this,$self=this;
  49109. return $core.withContext(function($ctx1) {
  49110. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49111. $ctx1.sendIdx["should:return:"]=1;
  49112. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49113. return self;
  49114. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49115. },
  49116. args: [],
  49117. 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",
  49118. referencedClasses: [],
  49119. messageSends: ["should:return:"]
  49120. }),
  49121. $globals.CodeGeneratorTest);
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "testDynamicArrayElementsOrdered",
  49125. protocol: "tests",
  49126. fn: function (){
  49127. var self=this,$self=this;
  49128. return $core.withContext(function($ctx1) {
  49129. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ { x. x := 2 }\x0d\x0a",[(1), (2)]);
  49130. $ctx1.sendIdx["should:return:"]=1;
  49131. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0d\x0a",[(1), (2)]);
  49132. return self;
  49133. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49134. },
  49135. args: [],
  49136. 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).",
  49137. referencedClasses: [],
  49138. messageSends: ["should:return:"]
  49139. }),
  49140. $globals.CodeGeneratorTest);
  49141. $core.addMethod(
  49142. $core.method({
  49143. selector: "testDynamicDictionaryElementsOrdered",
  49144. protocol: "tests",
  49145. fn: function (){
  49146. var self=this,$self=this;
  49147. return $core.withContext(function($ctx1) {
  49148. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 'foo'.\x0d\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0d\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  49149. return self;
  49150. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49151. },
  49152. args: [],
  49153. 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}.",
  49154. referencedClasses: [],
  49155. messageSends: ["should:return:"]
  49156. }),
  49157. $globals.CodeGeneratorTest);
  49158. $core.addMethod(
  49159. $core.method({
  49160. selector: "testDynamicDictionaryWithMoreArrows",
  49161. protocol: "tests",
  49162. fn: function (){
  49163. var self=this,$self=this;
  49164. return $core.withContext(function($ctx1) {
  49165. var $2,$1;
  49166. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49167. $ctx1.sendIdx["->"]=1;
  49168. $1=$recv($globals.HashedCollection)._with_($2);
  49169. $self._should_return_("foo ^ #{1->2->3}",$1);
  49170. return self;
  49171. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49172. },
  49173. args: [],
  49174. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49175. referencedClasses: ["HashedCollection"],
  49176. messageSends: ["should:return:", "with:", "->"]
  49177. }),
  49178. $globals.CodeGeneratorTest);
  49179. $core.addMethod(
  49180. $core.method({
  49181. selector: "testGlobalVar",
  49182. protocol: "tests",
  49183. fn: function (){
  49184. var self=this,$self=this;
  49185. return $core.withContext(function($ctx1) {
  49186. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49187. $ctx1.sendIdx["should:return:"]=1;
  49188. $self._should_return_("foo ^ Math cos: 0",(1));
  49189. $ctx1.sendIdx["should:return:"]=2;
  49190. $self._should_return_("foo ^ NonExistingVar",nil);
  49191. return self;
  49192. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49193. },
  49194. args: [],
  49195. 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",
  49196. referencedClasses: ["BlockClosure"],
  49197. messageSends: ["should:return:"]
  49198. }),
  49199. $globals.CodeGeneratorTest);
  49200. $core.addMethod(
  49201. $core.method({
  49202. selector: "testInnerTemporalDependentElementsOrdered",
  49203. protocol: "tests",
  49204. fn: function (){
  49205. var self=this,$self=this;
  49206. return $core.withContext(function($ctx1) {
  49207. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49208. $2="foo".__minus_gt($globals.Array);
  49209. $ctx1.sendIdx["->"]=1;
  49210. $3="bar".__minus_gt((2));
  49211. $ctx1.sendIdx["->"]=2;
  49212. $1=[$2,$3];
  49213. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := Array.\x0d\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0d\x0a",$1);
  49214. $ctx1.sendIdx["should:return:"]=1;
  49215. $5="foo".__minus_gt($globals.Array);
  49216. $ctx1.sendIdx["->"]=3;
  49217. $6="bar".__minus_gt((2));
  49218. $ctx1.sendIdx["->"]=4;
  49219. $4=[$5,$6];
  49220. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := Array.\x0d\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0d\x0a",$4);
  49221. $ctx1.sendIdx["should:return:"]=2;
  49222. $8="foo".__minus_gt((1));
  49223. $ctx1.sendIdx["->"]=5;
  49224. $9="bar".__minus_gt((2));
  49225. $ctx1.sendIdx["->"]=6;
  49226. $7=[$8,$9];
  49227. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0d\x0a",$7);
  49228. $ctx1.sendIdx["should:return:"]=3;
  49229. $11="foo".__minus_gt((1));
  49230. $ctx1.sendIdx["->"]=7;
  49231. $10=[$11,"bar".__minus_gt((2))];
  49232. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0d\x0a",$10);
  49233. $ctx1.sendIdx["should:return:"]=4;
  49234. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0d\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  49235. return self;
  49236. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49237. },
  49238. args: [],
  49239. 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}.",
  49240. referencedClasses: ["Array"],
  49241. messageSends: ["should:return:", "->"]
  49242. }),
  49243. $globals.CodeGeneratorTest);
  49244. $core.addMethod(
  49245. $core.method({
  49246. selector: "testLexicalScope",
  49247. protocol: "tests",
  49248. fn: function (){
  49249. var self=this,$self=this;
  49250. return $core.withContext(function($ctx1) {
  49251. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49252. return self;
  49253. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49254. },
  49255. args: [],
  49256. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49257. referencedClasses: [],
  49258. messageSends: ["should:return:"]
  49259. }),
  49260. $globals.CodeGeneratorTest);
  49261. $core.addMethod(
  49262. $core.method({
  49263. selector: "testLiterals",
  49264. protocol: "tests",
  49265. fn: function (){
  49266. var self=this,$self=this;
  49267. return $core.withContext(function($ctx1) {
  49268. $self._should_return_("foo ^ 1",(1));
  49269. $ctx1.sendIdx["should:return:"]=1;
  49270. $self._should_return_("foo ^ 'hello'","hello");
  49271. $ctx1.sendIdx["should:return:"]=2;
  49272. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49273. $ctx1.sendIdx["should:return:"]=3;
  49274. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49275. $ctx1.sendIdx["should:return:"]=4;
  49276. $self._should_return_("foo ^ true",true);
  49277. $ctx1.sendIdx["should:return:"]=5;
  49278. $self._should_return_("foo ^ false",false);
  49279. $ctx1.sendIdx["should:return:"]=6;
  49280. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49281. $ctx1.sendIdx["should:return:"]=7;
  49282. $self._should_return_("foo ^ #hello","hello");
  49283. $ctx1.sendIdx["should:return:"]=8;
  49284. $self._should_return_("foo ^ $h","h");
  49285. $ctx1.sendIdx["should:return:"]=9;
  49286. $self._should_return_("foo ^ -123.456",(-123.456));
  49287. $ctx1.sendIdx["should:return:"]=10;
  49288. $self._should_return_("foo ^ -2.5e4",(-25000));
  49289. return self;
  49290. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49291. },
  49292. args: [],
  49293. 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.",
  49294. referencedClasses: [],
  49295. messageSends: ["should:return:"]
  49296. }),
  49297. $globals.CodeGeneratorTest);
  49298. $core.addMethod(
  49299. $core.method({
  49300. selector: "testLocalReturn",
  49301. protocol: "tests",
  49302. fn: function (){
  49303. var self=this,$self=this;
  49304. return $core.withContext(function($ctx1) {
  49305. $self._should_return_("foo ^ 1",(1));
  49306. $ctx1.sendIdx["should:return:"]=1;
  49307. $self._should_return_("foo ^ 1 + 1",(2));
  49308. $ctx1.sendIdx["should:return:"]=2;
  49309. $self._should_return_("foo ",$self["@receiver"]);
  49310. $ctx1.sendIdx["should:return:"]=3;
  49311. $self._should_return_("foo self asString",$self["@receiver"]);
  49312. $ctx1.sendIdx["should:return:"]=4;
  49313. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49314. return self;
  49315. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49316. },
  49317. args: [],
  49318. 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",
  49319. referencedClasses: [],
  49320. messageSends: ["should:return:"]
  49321. }),
  49322. $globals.CodeGeneratorTest);
  49323. $core.addMethod(
  49324. $core.method({
  49325. selector: "testMessageSends",
  49326. protocol: "tests",
  49327. fn: function (){
  49328. var self=this,$self=this;
  49329. return $core.withContext(function($ctx1) {
  49330. $self._should_return_("foo ^ 1 asString","1");
  49331. $ctx1.sendIdx["should:return:"]=1;
  49332. $self._should_return_("foo ^ 1 + 1",(2));
  49333. $ctx1.sendIdx["should:return:"]=2;
  49334. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49335. $ctx1.sendIdx["should:return:"]=3;
  49336. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49337. $ctx1.sendIdx["should:return:"]=4;
  49338. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49339. return self;
  49340. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49341. },
  49342. args: [],
  49343. 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)",
  49344. referencedClasses: [],
  49345. messageSends: ["should:return:"]
  49346. }),
  49347. $globals.CodeGeneratorTest);
  49348. $core.addMethod(
  49349. $core.method({
  49350. selector: "testMistypedPragmaJSStatement",
  49351. protocol: "tests",
  49352. fn: function (){
  49353. var self=this,$self=this;
  49354. return $core.withContext(function($ctx1) {
  49355. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49356. return self;
  49357. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49358. },
  49359. args: [],
  49360. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49361. referencedClasses: ["ParseError"],
  49362. messageSends: ["should:receiver:raise:"]
  49363. }),
  49364. $globals.CodeGeneratorTest);
  49365. $core.addMethod(
  49366. $core.method({
  49367. selector: "testMultipleSequences",
  49368. protocol: "tests",
  49369. fn: function (){
  49370. var self=this,$self=this;
  49371. return $core.withContext(function($ctx1) {
  49372. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49373. return self;
  49374. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49375. },
  49376. args: [],
  49377. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49378. referencedClasses: [],
  49379. messageSends: ["should:return:"]
  49380. }),
  49381. $globals.CodeGeneratorTest);
  49382. $core.addMethod(
  49383. $core.method({
  49384. selector: "testMutableLiterals",
  49385. protocol: "tests",
  49386. fn: function (){
  49387. var self=this,$self=this;
  49388. return $core.withContext(function($ctx1) {
  49389. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49390. return self;
  49391. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49392. },
  49393. args: [],
  49394. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://lolg.it/amber/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  49395. referencedClasses: [],
  49396. messageSends: ["should:return:"]
  49397. }),
  49398. $globals.CodeGeneratorTest);
  49399. $core.addMethod(
  49400. $core.method({
  49401. selector: "testNestedIfTrue",
  49402. protocol: "tests",
  49403. fn: function (){
  49404. var self=this,$self=this;
  49405. return $core.withContext(function($ctx1) {
  49406. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49407. $ctx1.sendIdx["should:return:"]=1;
  49408. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49409. $ctx1.sendIdx["should:return:"]=2;
  49410. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49411. $ctx1.sendIdx["should:return:"]=3;
  49412. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49413. return self;
  49414. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49415. },
  49416. args: [],
  49417. 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.",
  49418. referencedClasses: [],
  49419. messageSends: ["should:return:"]
  49420. }),
  49421. $globals.CodeGeneratorTest);
  49422. $core.addMethod(
  49423. $core.method({
  49424. selector: "testNestedSends",
  49425. protocol: "tests",
  49426. fn: function (){
  49427. var self=this,$self=this;
  49428. return $core.withContext(function($ctx1) {
  49429. $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());
  49430. return self;
  49431. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49432. },
  49433. args: [],
  49434. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49435. referencedClasses: ["Point"],
  49436. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49437. }),
  49438. $globals.CodeGeneratorTest);
  49439. $core.addMethod(
  49440. $core.method({
  49441. selector: "testNonLocalReturn",
  49442. protocol: "tests",
  49443. fn: function (){
  49444. var self=this,$self=this;
  49445. return $core.withContext(function($ctx1) {
  49446. $self._should_return_("foo [ ^ 1 ] value",(1));
  49447. $ctx1.sendIdx["should:return:"]=1;
  49448. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49449. $ctx1.sendIdx["should:return:"]=2;
  49450. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49451. $ctx1.sendIdx["should:return:"]=3;
  49452. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49453. return self;
  49454. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49455. },
  49456. args: [],
  49457. 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",
  49458. referencedClasses: [],
  49459. messageSends: ["should:return:"]
  49460. }),
  49461. $globals.CodeGeneratorTest);
  49462. $core.addMethod(
  49463. $core.method({
  49464. selector: "testPascalCaseGlobal",
  49465. protocol: "tests",
  49466. fn: function (){
  49467. var self=this,$self=this;
  49468. return $core.withContext(function($ctx1) {
  49469. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49470. $ctx1.sendIdx["should:return:"]=1;
  49471. $self._should_return_("foo ^NonExistent",nil);
  49472. return self;
  49473. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49474. },
  49475. args: [],
  49476. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49477. referencedClasses: ["Smalltalk"],
  49478. messageSends: ["should:return:", "at:", "globals"]
  49479. }),
  49480. $globals.CodeGeneratorTest);
  49481. $core.addMethod(
  49482. $core.method({
  49483. selector: "testPragmaInBlock",
  49484. protocol: "tests",
  49485. fn: function (){
  49486. var self=this,$self=this;
  49487. return $core.withContext(function($ctx1) {
  49488. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49489. return self;
  49490. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49491. },
  49492. args: [],
  49493. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49494. referencedClasses: ["CompilerError"],
  49495. messageSends: ["should:receiver:raise:"]
  49496. }),
  49497. $globals.CodeGeneratorTest);
  49498. $core.addMethod(
  49499. $core.method({
  49500. selector: "testPragmaJSStatement",
  49501. protocol: "tests",
  49502. fn: function (){
  49503. var self=this,$self=this;
  49504. return $core.withContext(function($ctx1) {
  49505. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49506. return self;
  49507. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49508. },
  49509. args: [],
  49510. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49511. referencedClasses: [],
  49512. messageSends: ["should:return:"]
  49513. }),
  49514. $globals.CodeGeneratorTest);
  49515. $core.addMethod(
  49516. $core.method({
  49517. selector: "testRootSuperSend",
  49518. protocol: "tests",
  49519. fn: function (){
  49520. var self=this,$self=this;
  49521. return $core.withContext(function($ctx1) {
  49522. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49523. return self;
  49524. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49525. },
  49526. args: [],
  49527. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49528. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49529. messageSends: ["should:receiver:raise:", "new"]
  49530. }),
  49531. $globals.CodeGeneratorTest);
  49532. $core.addMethod(
  49533. $core.method({
  49534. selector: "testSendReceiverAndArgumentsOrdered",
  49535. protocol: "tests",
  49536. fn: function (){
  49537. var self=this,$self=this;
  49538. return $core.withContext(function($ctx1) {
  49539. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := 1.\x0d\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0d\x0a",[(1), (2)]);
  49540. $ctx1.sendIdx["should:return:"]=1;
  49541. $self._should_return_("foo\x0d\x0a\x09| x |\x0d\x0a\x09x := Array.\x0d\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0d\x0a",[$globals.Array,(2)]);
  49542. return self;
  49543. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49544. },
  49545. args: [],
  49546. 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}.",
  49547. referencedClasses: ["Array"],
  49548. messageSends: ["should:return:"]
  49549. }),
  49550. $globals.CodeGeneratorTest);
  49551. $core.addMethod(
  49552. $core.method({
  49553. selector: "testSuperSend",
  49554. protocol: "tests",
  49555. fn: function (){
  49556. var self=this,$self=this;
  49557. return $core.withContext(function($ctx1) {
  49558. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49559. return self;
  49560. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49561. },
  49562. args: [],
  49563. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49564. referencedClasses: [],
  49565. messageSends: ["should:receiver:return:"]
  49566. }),
  49567. $globals.CodeGeneratorTest);
  49568. $core.addMethod(
  49569. $core.method({
  49570. selector: "testTempVariables",
  49571. protocol: "tests",
  49572. fn: function (){
  49573. var self=this,$self=this;
  49574. return $core.withContext(function($ctx1) {
  49575. $self._should_return_("foo | a | ^ a",nil);
  49576. $ctx1.sendIdx["should:return:"]=1;
  49577. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49578. $ctx1.sendIdx["should:return:"]=2;
  49579. $self._should_return_("foo | a b c | ^ c",nil);
  49580. $ctx1.sendIdx["should:return:"]=3;
  49581. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49582. $ctx1.sendIdx["should:return:"]=4;
  49583. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49584. $ctx1.sendIdx["should:return:"]=5;
  49585. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49586. return self;
  49587. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49588. },
  49589. args: [],
  49590. 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.",
  49591. referencedClasses: [],
  49592. messageSends: ["should:return:"]
  49593. }),
  49594. $globals.CodeGeneratorTest);
  49595. $core.addMethod(
  49596. $core.method({
  49597. selector: "testThisContext",
  49598. protocol: "tests",
  49599. fn: function (){
  49600. var self=this,$self=this;
  49601. return $core.withContext(function($ctx1) {
  49602. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49603. return self;
  49604. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49605. },
  49606. args: [],
  49607. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49608. referencedClasses: [],
  49609. messageSends: ["should:return:"]
  49610. }),
  49611. $globals.CodeGeneratorTest);
  49612. $core.addMethod(
  49613. $core.method({
  49614. selector: "testUnknownPragma",
  49615. protocol: "tests",
  49616. fn: function (){
  49617. var self=this,$self=this;
  49618. return $core.withContext(function($ctx1) {
  49619. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49620. $ctx1.sendIdx["should:return:"]=1;
  49621. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49622. return self;
  49623. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49624. },
  49625. args: [],
  49626. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49627. referencedClasses: [],
  49628. messageSends: ["should:return:"]
  49629. }),
  49630. $globals.CodeGeneratorTest);
  49631. $core.addMethod(
  49632. $core.method({
  49633. selector: "testifFalse",
  49634. protocol: "tests",
  49635. fn: function (){
  49636. var self=this,$self=this;
  49637. return $core.withContext(function($ctx1) {
  49638. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49639. $ctx1.sendIdx["should:return:"]=1;
  49640. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49641. $ctx1.sendIdx["should:return:"]=2;
  49642. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49643. $ctx1.sendIdx["should:return:"]=3;
  49644. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49645. return self;
  49646. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49647. },
  49648. args: [],
  49649. 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.",
  49650. referencedClasses: [],
  49651. messageSends: ["should:return:"]
  49652. }),
  49653. $globals.CodeGeneratorTest);
  49654. $core.addMethod(
  49655. $core.method({
  49656. selector: "testifFalseIfTrue",
  49657. protocol: "tests",
  49658. fn: function (){
  49659. var self=this,$self=this;
  49660. return $core.withContext(function($ctx1) {
  49661. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49662. $ctx1.sendIdx["should:return:"]=1;
  49663. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49664. $ctx1.sendIdx["should:return:"]=2;
  49665. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49666. $ctx1.sendIdx["should:return:"]=3;
  49667. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49668. return self;
  49669. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49670. },
  49671. args: [],
  49672. 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.",
  49673. referencedClasses: [],
  49674. messageSends: ["should:return:"]
  49675. }),
  49676. $globals.CodeGeneratorTest);
  49677. $core.addMethod(
  49678. $core.method({
  49679. selector: "testifNil",
  49680. protocol: "tests",
  49681. fn: function (){
  49682. var self=this,$self=this;
  49683. return $core.withContext(function($ctx1) {
  49684. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49685. $ctx1.sendIdx["should:return:"]=1;
  49686. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49687. $ctx1.sendIdx["should:return:"]=2;
  49688. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49689. $ctx1.sendIdx["should:return:"]=3;
  49690. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49691. return self;
  49692. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49693. },
  49694. args: [],
  49695. 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.",
  49696. referencedClasses: [],
  49697. messageSends: ["should:return:"]
  49698. }),
  49699. $globals.CodeGeneratorTest);
  49700. $core.addMethod(
  49701. $core.method({
  49702. selector: "testifNilIfNotNil",
  49703. protocol: "tests",
  49704. fn: function (){
  49705. var self=this,$self=this;
  49706. return $core.withContext(function($ctx1) {
  49707. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49708. $ctx1.sendIdx["should:return:"]=1;
  49709. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49710. $ctx1.sendIdx["should:return:"]=2;
  49711. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49712. $ctx1.sendIdx["should:return:"]=3;
  49713. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49714. return self;
  49715. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49716. },
  49717. args: [],
  49718. 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.",
  49719. referencedClasses: [],
  49720. messageSends: ["should:return:"]
  49721. }),
  49722. $globals.CodeGeneratorTest);
  49723. $core.addMethod(
  49724. $core.method({
  49725. selector: "testifNotNil",
  49726. protocol: "tests",
  49727. fn: function (){
  49728. var self=this,$self=this;
  49729. return $core.withContext(function($ctx1) {
  49730. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49731. $ctx1.sendIdx["should:return:"]=1;
  49732. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49733. $ctx1.sendIdx["should:return:"]=2;
  49734. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49735. $ctx1.sendIdx["should:return:"]=3;
  49736. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49737. return self;
  49738. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49739. },
  49740. args: [],
  49741. 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.",
  49742. referencedClasses: [],
  49743. messageSends: ["should:return:"]
  49744. }),
  49745. $globals.CodeGeneratorTest);
  49746. $core.addMethod(
  49747. $core.method({
  49748. selector: "testifNotNilWithArgument",
  49749. protocol: "tests",
  49750. fn: function (){
  49751. var self=this,$self=this;
  49752. return $core.withContext(function($ctx1) {
  49753. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49754. $ctx1.sendIdx["should:return:"]=1;
  49755. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49756. $ctx1.sendIdx["should:return:"]=2;
  49757. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49758. $ctx1.sendIdx["should:return:"]=3;
  49759. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49760. $ctx1.sendIdx["should:return:"]=4;
  49761. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49762. $ctx1.sendIdx["should:return:"]=5;
  49763. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49764. return self;
  49765. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49766. },
  49767. args: [],
  49768. 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",
  49769. referencedClasses: [],
  49770. messageSends: ["should:return:"]
  49771. }),
  49772. $globals.CodeGeneratorTest);
  49773. $core.addMethod(
  49774. $core.method({
  49775. selector: "testifTrue",
  49776. protocol: "tests",
  49777. fn: function (){
  49778. var self=this,$self=this;
  49779. return $core.withContext(function($ctx1) {
  49780. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49781. $ctx1.sendIdx["should:return:"]=1;
  49782. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49783. $ctx1.sendIdx["should:return:"]=2;
  49784. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49785. $ctx1.sendIdx["should:return:"]=3;
  49786. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49787. return self;
  49788. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49789. },
  49790. args: [],
  49791. 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.",
  49792. referencedClasses: [],
  49793. messageSends: ["should:return:"]
  49794. }),
  49795. $globals.CodeGeneratorTest);
  49796. $core.addMethod(
  49797. $core.method({
  49798. selector: "testifTrueIfFalse",
  49799. protocol: "tests",
  49800. fn: function (){
  49801. var self=this,$self=this;
  49802. return $core.withContext(function($ctx1) {
  49803. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49804. $ctx1.sendIdx["should:return:"]=1;
  49805. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49806. $ctx1.sendIdx["should:return:"]=2;
  49807. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49808. $ctx1.sendIdx["should:return:"]=3;
  49809. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49810. return self;
  49811. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49812. },
  49813. args: [],
  49814. 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.",
  49815. referencedClasses: [],
  49816. messageSends: ["should:return:"]
  49817. }),
  49818. $globals.CodeGeneratorTest);
  49819. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49820. $core.addMethod(
  49821. $core.method({
  49822. selector: "interpret:receiver:withArguments:",
  49823. protocol: "private",
  49824. fn: function (aString,anObject,aDictionary){
  49825. var self=this,$self=this;
  49826. var ctx,ast,interpreter;
  49827. return $core.withContext(function($ctx1) {
  49828. var $1,$2,$3,$receiver;
  49829. interpreter=$recv($globals.ASTInterpreter)._new();
  49830. $ctx1.sendIdx["new"]=1;
  49831. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49832. $1=$recv($globals.AIContext)._new();
  49833. $recv($1)._receiver_(anObject);
  49834. $recv($1)._interpreter_(interpreter);
  49835. ctx=$recv($1)._yourself();
  49836. $2=$recv(ast)._sequenceNode();
  49837. if(($receiver = $2) == null || $receiver.a$nil){
  49838. $2;
  49839. } else {
  49840. var sequence;
  49841. sequence=$receiver;
  49842. $recv($recv(sequence)._temps())._do_((function(each){
  49843. return $core.withContext(function($ctx2) {
  49844. return $recv(ctx)._defineLocal_(each);
  49845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49846. }));
  49847. }
  49848. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49849. return $core.withContext(function($ctx2) {
  49850. return $recv(ctx)._localAt_put_(key,value);
  49851. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49852. }));
  49853. $3=interpreter;
  49854. $recv($3)._context_(ctx);
  49855. $recv($3)._node_(ast);
  49856. $recv($3)._enterNode();
  49857. $recv($3)._proceed();
  49858. return $recv($3)._result();
  49859. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49860. },
  49861. args: ["aString", "anObject", "aDictionary"],
  49862. 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",
  49863. referencedClasses: ["ASTInterpreter", "AIContext"],
  49864. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49865. }),
  49866. $globals.ASTInterpreterTest);
  49867. $core.addMethod(
  49868. $core.method({
  49869. selector: "should:receiver:return:",
  49870. protocol: "testing",
  49871. fn: function (aString,anObject,aResult){
  49872. var self=this,$self=this;
  49873. return $core.withContext(function($ctx1) {
  49874. $self["@receiver"]=anObject;
  49875. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49876. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49877. },
  49878. args: ["aString", "anObject", "aResult"],
  49879. 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",
  49880. referencedClasses: [],
  49881. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49882. }),
  49883. $globals.ASTInterpreterTest);
  49884. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49885. $core.addMethod(
  49886. $core.method({
  49887. selector: "interpret:receiver:withArguments:",
  49888. protocol: "private",
  49889. fn: function (aString,anObject,aDictionary){
  49890. var self=this,$self=this;
  49891. var ctx,ast,debugger_;
  49892. return $core.withContext(function($ctx1) {
  49893. var $1,$2,$3,$4,$5,$receiver;
  49894. $1=$recv($globals.AIContext)._new();
  49895. $ctx1.sendIdx["new"]=1;
  49896. $recv($1)._receiver_(anObject);
  49897. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49898. ctx=$recv($1)._yourself();
  49899. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49900. $2=$recv(ast)._sequenceNode();
  49901. if(($receiver = $2) == null || $receiver.a$nil){
  49902. $2;
  49903. } else {
  49904. var sequence;
  49905. sequence=$receiver;
  49906. $recv($recv(sequence)._temps())._do_((function(each){
  49907. return $core.withContext(function($ctx2) {
  49908. return $recv(ctx)._defineLocal_(each);
  49909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49910. }));
  49911. }
  49912. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49913. return $core.withContext(function($ctx2) {
  49914. return $recv(ctx)._localAt_put_(key,value);
  49915. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49916. }));
  49917. $3=$recv(ctx)._interpreter();
  49918. $ctx1.sendIdx["interpreter"]=1;
  49919. $recv($3)._context_(ctx);
  49920. $ctx1.sendIdx["context:"]=1;
  49921. $4=$recv(ctx)._interpreter();
  49922. $recv($4)._node_(ast);
  49923. $recv($4)._enterNode();
  49924. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49925. $5=debugger_;
  49926. $recv($5)._proceed();
  49927. return $recv($5)._result();
  49928. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49929. },
  49930. args: ["aString", "anObject", "aDictionary"],
  49931. 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",
  49932. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49933. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49934. }),
  49935. $globals.ASTDebuggerTest);
  49936. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49937. $core.addMethod(
  49938. $core.method({
  49939. selector: "codeGeneratorClass",
  49940. protocol: "accessing",
  49941. fn: function (){
  49942. var self=this,$self=this;
  49943. return $globals.InliningCodeGenerator;
  49944. },
  49945. args: [],
  49946. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49947. referencedClasses: ["InliningCodeGenerator"],
  49948. messageSends: []
  49949. }),
  49950. $globals.InliningCodeGeneratorTest);
  49951. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49952. $core.addMethod(
  49953. $core.method({
  49954. selector: "testClassRefVar",
  49955. protocol: "tests",
  49956. fn: function (){
  49957. var self=this,$self=this;
  49958. var node;
  49959. return $core.withContext(function($ctx1) {
  49960. var $1,$2;
  49961. $1=$recv($globals.VariableNode)._new();
  49962. $ctx1.sendIdx["new"]=1;
  49963. $recv($1)._value_("Object");
  49964. node=$recv($1)._yourself();
  49965. $2=$recv($globals.SemanticAnalyzer)._new();
  49966. $ctx1.sendIdx["new"]=2;
  49967. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49968. $recv($2)._visit_(node);
  49969. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49970. return self;
  49971. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49972. },
  49973. args: [],
  49974. 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",
  49975. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49976. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49977. }),
  49978. $globals.ScopeVarTest);
  49979. $core.addMethod(
  49980. $core.method({
  49981. selector: "testInstanceVar",
  49982. protocol: "tests",
  49983. fn: function (){
  49984. var self=this,$self=this;
  49985. var node,scope;
  49986. return $core.withContext(function($ctx1) {
  49987. var $1;
  49988. $1=$recv($globals.VariableNode)._new();
  49989. $ctx1.sendIdx["new"]=1;
  49990. $recv($1)._value_("bzzz");
  49991. node=$recv($1)._yourself();
  49992. scope=$recv($globals.MethodLexicalScope)._new();
  49993. $recv(scope)._addIVar_("bzzz");
  49994. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49995. return self;
  49996. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49997. },
  49998. args: [],
  49999. 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",
  50000. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50001. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50002. }),
  50003. $globals.ScopeVarTest);
  50004. $core.addMethod(
  50005. $core.method({
  50006. selector: "testPseudoVar",
  50007. protocol: "tests",
  50008. fn: function (){
  50009. var self=this,$self=this;
  50010. var node,pseudoVars;
  50011. return $core.withContext(function($ctx1) {
  50012. var $1;
  50013. pseudoVars=["self", "super", "true", "false", "nil"];
  50014. $recv(pseudoVars)._do_((function(each){
  50015. return $core.withContext(function($ctx2) {
  50016. $1=$recv($globals.VariableNode)._new();
  50017. $ctx2.sendIdx["new"]=1;
  50018. $recv($1)._value_(each);
  50019. node=$recv($1)._yourself();
  50020. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50022. }));
  50023. return self;
  50024. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50025. },
  50026. args: [],
  50027. 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]",
  50028. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50029. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50030. }),
  50031. $globals.ScopeVarTest);
  50032. $core.addMethod(
  50033. $core.method({
  50034. selector: "testTempVar",
  50035. protocol: "tests",
  50036. fn: function (){
  50037. var self=this,$self=this;
  50038. var node,scope;
  50039. return $core.withContext(function($ctx1) {
  50040. var $1;
  50041. $1=$recv($globals.VariableNode)._new();
  50042. $ctx1.sendIdx["new"]=1;
  50043. $recv($1)._value_("bzzz");
  50044. node=$recv($1)._yourself();
  50045. scope=$recv($globals.MethodLexicalScope)._new();
  50046. $recv(scope)._addTemp_("bzzz");
  50047. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50048. return self;
  50049. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50050. },
  50051. args: [],
  50052. 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",
  50053. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50054. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50055. }),
  50056. $globals.ScopeVarTest);
  50057. $core.addMethod(
  50058. $core.method({
  50059. selector: "testUnknownVar",
  50060. protocol: "tests",
  50061. fn: function (){
  50062. var self=this,$self=this;
  50063. var node;
  50064. return $core.withContext(function($ctx1) {
  50065. var $1;
  50066. $1=$recv($globals.VariableNode)._new();
  50067. $ctx1.sendIdx["new"]=1;
  50068. $recv($1)._value_("bzzz");
  50069. node=$recv($1)._yourself();
  50070. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50071. return self;
  50072. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50073. },
  50074. args: [],
  50075. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50076. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50077. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50078. }),
  50079. $globals.ScopeVarTest);
  50080. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50081. $core.addMethod(
  50082. $core.method({
  50083. selector: "setUp",
  50084. protocol: "running",
  50085. fn: function (){
  50086. var self=this,$self=this;
  50087. return $core.withContext(function($ctx1) {
  50088. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50089. return self;
  50090. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50091. },
  50092. args: [],
  50093. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50094. referencedClasses: ["SemanticAnalyzer", "Object"],
  50095. messageSends: ["on:"]
  50096. }),
  50097. $globals.SemanticAnalyzerTest);
  50098. $core.addMethod(
  50099. $core.method({
  50100. selector: "testAssignment",
  50101. protocol: "tests",
  50102. fn: function (){
  50103. var self=this,$self=this;
  50104. var src,ast;
  50105. return $core.withContext(function($ctx1) {
  50106. src="foo self := 1";
  50107. ast=$recv($globals.Smalltalk)._parse_(src);
  50108. $self._should_raise_((function(){
  50109. return $core.withContext(function($ctx2) {
  50110. return $recv($self["@analyzer"])._visit_(ast);
  50111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50112. }),$globals.InvalidAssignmentError);
  50113. return self;
  50114. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50115. },
  50116. args: [],
  50117. 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",
  50118. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50119. messageSends: ["parse:", "should:raise:", "visit:"]
  50120. }),
  50121. $globals.SemanticAnalyzerTest);
  50122. $core.addMethod(
  50123. $core.method({
  50124. selector: "testNonLocalReturn",
  50125. protocol: "tests",
  50126. fn: function (){
  50127. var self=this,$self=this;
  50128. var src,ast;
  50129. return $core.withContext(function($ctx1) {
  50130. src="foo | a | a + 1. ^ a";
  50131. ast=$recv($globals.Smalltalk)._parse_(src);
  50132. $recv($self["@analyzer"])._visit_(ast);
  50133. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50134. return self;
  50135. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50136. },
  50137. args: [],
  50138. 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",
  50139. referencedClasses: ["Smalltalk"],
  50140. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50141. }),
  50142. $globals.SemanticAnalyzerTest);
  50143. $core.addMethod(
  50144. $core.method({
  50145. selector: "testNonLocalReturn2",
  50146. protocol: "tests",
  50147. fn: function (){
  50148. var self=this,$self=this;
  50149. var src,ast;
  50150. return $core.withContext(function($ctx1) {
  50151. src="foo | a | a + 1. [ [ ^ a] ]";
  50152. ast=$recv($globals.Smalltalk)._parse_(src);
  50153. $recv($self["@analyzer"])._visit_(ast);
  50154. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50155. return self;
  50156. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50157. },
  50158. args: [],
  50159. 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",
  50160. referencedClasses: ["Smalltalk"],
  50161. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50162. }),
  50163. $globals.SemanticAnalyzerTest);
  50164. $core.addMethod(
  50165. $core.method({
  50166. selector: "testScope",
  50167. protocol: "tests",
  50168. fn: function (){
  50169. var self=this,$self=this;
  50170. var src,ast;
  50171. return $core.withContext(function($ctx1) {
  50172. var $4,$3,$2,$1;
  50173. src="foo | a | a + 1. [ | b | b := a ]";
  50174. ast=$recv($globals.Smalltalk)._parse_(src);
  50175. $recv($self["@analyzer"])._visit_(ast);
  50176. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50177. $ctx1.sendIdx["dagChildren"]=1;
  50178. $3=$recv($4)._last();
  50179. $2=$recv($3)._scope();
  50180. $ctx1.sendIdx["scope"]=1;
  50181. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50182. $self._deny_($1);
  50183. return self;
  50184. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50185. },
  50186. args: [],
  50187. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last scope == ast scope.",
  50188. referencedClasses: ["Smalltalk"],
  50189. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50190. }),
  50191. $globals.SemanticAnalyzerTest);
  50192. $core.addMethod(
  50193. $core.method({
  50194. selector: "testScope2",
  50195. protocol: "tests",
  50196. fn: function (){
  50197. var self=this,$self=this;
  50198. var src,ast;
  50199. return $core.withContext(function($ctx1) {
  50200. var $8,$7,$6,$5,$4,$3,$2,$1;
  50201. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50202. ast=$recv($globals.Smalltalk)._parse_(src);
  50203. $recv($self["@analyzer"])._visit_(ast);
  50204. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50205. $ctx1.sendIdx["dagChildren"]=3;
  50206. $7=$recv($8)._last();
  50207. $6=$recv($7)._dagChildren();
  50208. $ctx1.sendIdx["dagChildren"]=2;
  50209. $5=$recv($6)._first();
  50210. $ctx1.sendIdx["first"]=2;
  50211. $4=$recv($5)._dagChildren();
  50212. $ctx1.sendIdx["dagChildren"]=1;
  50213. $3=$recv($4)._first();
  50214. $ctx1.sendIdx["first"]=1;
  50215. $2=$recv($3)._scope();
  50216. $ctx1.sendIdx["scope"]=1;
  50217. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50218. $self._deny_($1);
  50219. return self;
  50220. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50221. },
  50222. args: [],
  50223. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last dagChildren first dagChildren first scope == ast scope.",
  50224. referencedClasses: ["Smalltalk"],
  50225. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50226. }),
  50227. $globals.SemanticAnalyzerTest);
  50228. $core.addMethod(
  50229. $core.method({
  50230. selector: "testScopeLevel",
  50231. protocol: "tests",
  50232. fn: function (){
  50233. var self=this,$self=this;
  50234. var src,ast;
  50235. return $core.withContext(function($ctx1) {
  50236. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50237. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50238. ast=$recv($globals.Smalltalk)._parse_(src);
  50239. $recv($self["@analyzer"])._visit_(ast);
  50240. $2=$recv(ast)._scope();
  50241. $ctx1.sendIdx["scope"]=1;
  50242. $1=$recv($2)._scopeLevel();
  50243. $ctx1.sendIdx["scopeLevel"]=1;
  50244. $self._assert_equals_($1,(1));
  50245. $ctx1.sendIdx["assert:equals:"]=1;
  50246. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50247. $ctx1.sendIdx["dagChildren"]=3;
  50248. $9=$recv($10)._last();
  50249. $8=$recv($9)._dagChildren();
  50250. $ctx1.sendIdx["dagChildren"]=2;
  50251. $7=$recv($8)._first();
  50252. $ctx1.sendIdx["first"]=2;
  50253. $6=$recv($7)._dagChildren();
  50254. $ctx1.sendIdx["dagChildren"]=1;
  50255. $5=$recv($6)._first();
  50256. $ctx1.sendIdx["first"]=1;
  50257. $4=$recv($5)._scope();
  50258. $3=$recv($4)._scopeLevel();
  50259. $self._assert_equals_($3,(3));
  50260. return self;
  50261. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50262. },
  50263. args: [],
  50264. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first scope scopeLevel equals: 3",
  50265. referencedClasses: ["Smalltalk"],
  50266. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50267. }),
  50268. $globals.SemanticAnalyzerTest);
  50269. $core.addMethod(
  50270. $core.method({
  50271. selector: "testUnknownVariables",
  50272. protocol: "tests",
  50273. fn: function (){
  50274. var self=this,$self=this;
  50275. var src,ast;
  50276. return $core.withContext(function($ctx1) {
  50277. src="foo | a | b + a";
  50278. ast=$recv($globals.Smalltalk)._parse_(src);
  50279. $self._should_raise_((function(){
  50280. return $core.withContext(function($ctx2) {
  50281. return $recv($self["@analyzer"])._visit_(ast);
  50282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50283. }),$globals.UnknownVariableError);
  50284. return self;
  50285. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50286. },
  50287. args: [],
  50288. 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",
  50289. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50290. messageSends: ["parse:", "should:raise:", "visit:"]
  50291. }),
  50292. $globals.SemanticAnalyzerTest);
  50293. $core.addMethod(
  50294. $core.method({
  50295. selector: "testUnknownVariablesWithScope",
  50296. protocol: "tests",
  50297. fn: function (){
  50298. var self=this,$self=this;
  50299. var src,ast;
  50300. return $core.withContext(function($ctx1) {
  50301. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50302. ast=$recv($globals.Smalltalk)._parse_(src);
  50303. $self._should_raise_((function(){
  50304. return $core.withContext(function($ctx2) {
  50305. return $recv($self["@analyzer"])._visit_(ast);
  50306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50307. }),$globals.UnknownVariableError);
  50308. return self;
  50309. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50310. },
  50311. args: [],
  50312. 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",
  50313. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50314. messageSends: ["parse:", "should:raise:", "visit:"]
  50315. }),
  50316. $globals.SemanticAnalyzerTest);
  50317. $core.addMethod(
  50318. $core.method({
  50319. selector: "testVariableShadowing",
  50320. protocol: "tests",
  50321. fn: function (){
  50322. var self=this,$self=this;
  50323. var src,ast;
  50324. return $core.withContext(function($ctx1) {
  50325. src="foo | a | a + 1";
  50326. ast=$recv($globals.Smalltalk)._parse_(src);
  50327. $recv($self["@analyzer"])._visit_(ast);
  50328. return self;
  50329. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50330. },
  50331. args: [],
  50332. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50333. referencedClasses: ["Smalltalk"],
  50334. messageSends: ["parse:", "visit:"]
  50335. }),
  50336. $globals.SemanticAnalyzerTest);
  50337. $core.addMethod(
  50338. $core.method({
  50339. selector: "testVariableShadowing2",
  50340. protocol: "tests",
  50341. fn: function (){
  50342. var self=this,$self=this;
  50343. var src,ast;
  50344. return $core.withContext(function($ctx1) {
  50345. src="foo | a | a + 1. [ | a | a := 2 ]";
  50346. ast=$recv($globals.Smalltalk)._parse_(src);
  50347. $self._should_raise_((function(){
  50348. return $core.withContext(function($ctx2) {
  50349. return $recv($self["@analyzer"])._visit_(ast);
  50350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50351. }),$globals.ShadowingVariableError);
  50352. return self;
  50353. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50354. },
  50355. args: [],
  50356. 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",
  50357. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50358. messageSends: ["parse:", "should:raise:", "visit:"]
  50359. }),
  50360. $globals.SemanticAnalyzerTest);
  50361. $core.addMethod(
  50362. $core.method({
  50363. selector: "testVariableShadowing3",
  50364. protocol: "tests",
  50365. fn: function (){
  50366. var self=this,$self=this;
  50367. var src,ast;
  50368. return $core.withContext(function($ctx1) {
  50369. src="foo | a | a + 1. [ | b | b := 2 ]";
  50370. ast=$recv($globals.Smalltalk)._parse_(src);
  50371. $recv($self["@analyzer"])._visit_(ast);
  50372. return self;
  50373. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50374. },
  50375. args: [],
  50376. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50377. referencedClasses: ["Smalltalk"],
  50378. messageSends: ["parse:", "visit:"]
  50379. }),
  50380. $globals.SemanticAnalyzerTest);
  50381. $core.addMethod(
  50382. $core.method({
  50383. selector: "testVariableShadowing4",
  50384. protocol: "tests",
  50385. fn: function (){
  50386. var self=this,$self=this;
  50387. var src,ast;
  50388. return $core.withContext(function($ctx1) {
  50389. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50390. ast=$recv($globals.Smalltalk)._parse_(src);
  50391. $recv($self["@analyzer"])._visit_(ast);
  50392. return self;
  50393. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50394. },
  50395. args: [],
  50396. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50397. referencedClasses: ["Smalltalk"],
  50398. messageSends: ["parse:", "visit:"]
  50399. }),
  50400. $globals.SemanticAnalyzerTest);
  50401. $core.addMethod(
  50402. $core.method({
  50403. selector: "testVariableShadowing5",
  50404. protocol: "tests",
  50405. fn: function (){
  50406. var self=this,$self=this;
  50407. var src,ast;
  50408. return $core.withContext(function($ctx1) {
  50409. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50410. ast=$recv($globals.Smalltalk)._parse_(src);
  50411. $self._should_raise_((function(){
  50412. return $core.withContext(function($ctx2) {
  50413. return $recv($self["@analyzer"])._visit_(ast);
  50414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50415. }),$globals.ShadowingVariableError);
  50416. return self;
  50417. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50418. },
  50419. args: [],
  50420. 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",
  50421. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50422. messageSends: ["parse:", "should:raise:", "visit:"]
  50423. }),
  50424. $globals.SemanticAnalyzerTest);
  50425. $core.addMethod(
  50426. $core.method({
  50427. selector: "testVariablesLookup",
  50428. protocol: "tests",
  50429. fn: function (){
  50430. var self=this,$self=this;
  50431. var src,ast;
  50432. return $core.withContext(function($ctx1) {
  50433. 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;
  50434. src="foo | a | a + 1. [ | b | b := a ]";
  50435. ast=$recv($globals.Smalltalk)._parse_(src);
  50436. $recv($self["@analyzer"])._visit_(ast);
  50437. $7=$recv(ast)._dagChildren();
  50438. $ctx1.sendIdx["dagChildren"]=2;
  50439. $6=$recv($7)._first();
  50440. $ctx1.sendIdx["first"]=2;
  50441. $5=$recv($6)._dagChildren();
  50442. $ctx1.sendIdx["dagChildren"]=1;
  50443. $4=$recv($5)._first();
  50444. $ctx1.sendIdx["first"]=1;
  50445. $3=$recv($4)._receiver();
  50446. $ctx1.sendIdx["receiver"]=1;
  50447. $2=$recv($3)._binding();
  50448. $ctx1.sendIdx["binding"]=1;
  50449. $1=$recv($2)._isTempVar();
  50450. $ctx1.sendIdx["isTempVar"]=1;
  50451. $self._assert_($1);
  50452. $ctx1.sendIdx["assert:"]=1;
  50453. $15=$recv(ast)._dagChildren();
  50454. $ctx1.sendIdx["dagChildren"]=4;
  50455. $14=$recv($15)._first();
  50456. $ctx1.sendIdx["first"]=4;
  50457. $13=$recv($14)._dagChildren();
  50458. $ctx1.sendIdx["dagChildren"]=3;
  50459. $12=$recv($13)._first();
  50460. $ctx1.sendIdx["first"]=3;
  50461. $11=$recv($12)._receiver();
  50462. $10=$recv($11)._binding();
  50463. $ctx1.sendIdx["binding"]=2;
  50464. $9=$recv($10)._scope();
  50465. $ctx1.sendIdx["scope"]=1;
  50466. $16=$recv(ast)._scope();
  50467. $ctx1.sendIdx["scope"]=2;
  50468. $8=$recv($9).__eq_eq($16);
  50469. $ctx1.sendIdx["=="]=1;
  50470. $self._assert_($8);
  50471. $ctx1.sendIdx["assert:"]=2;
  50472. $27=$recv(ast)._dagChildren();
  50473. $ctx1.sendIdx["dagChildren"]=8;
  50474. $26=$recv($27)._first();
  50475. $ctx1.sendIdx["first"]=7;
  50476. $25=$recv($26)._dagChildren();
  50477. $ctx1.sendIdx["dagChildren"]=7;
  50478. $24=$recv($25)._last();
  50479. $ctx1.sendIdx["last"]=1;
  50480. $23=$recv($24)._dagChildren();
  50481. $ctx1.sendIdx["dagChildren"]=6;
  50482. $22=$recv($23)._first();
  50483. $ctx1.sendIdx["first"]=6;
  50484. $21=$recv($22)._dagChildren();
  50485. $ctx1.sendIdx["dagChildren"]=5;
  50486. $20=$recv($21)._first();
  50487. $ctx1.sendIdx["first"]=5;
  50488. $19=$recv($20)._left();
  50489. $ctx1.sendIdx["left"]=1;
  50490. $18=$recv($19)._binding();
  50491. $ctx1.sendIdx["binding"]=3;
  50492. $17=$recv($18)._isTempVar();
  50493. $self._assert_($17);
  50494. $ctx1.sendIdx["assert:"]=3;
  50495. $39=$recv(ast)._dagChildren();
  50496. $ctx1.sendIdx["dagChildren"]=12;
  50497. $38=$recv($39)._first();
  50498. $ctx1.sendIdx["first"]=10;
  50499. $37=$recv($38)._dagChildren();
  50500. $ctx1.sendIdx["dagChildren"]=11;
  50501. $36=$recv($37)._last();
  50502. $ctx1.sendIdx["last"]=2;
  50503. $35=$recv($36)._dagChildren();
  50504. $ctx1.sendIdx["dagChildren"]=10;
  50505. $34=$recv($35)._first();
  50506. $ctx1.sendIdx["first"]=9;
  50507. $33=$recv($34)._dagChildren();
  50508. $ctx1.sendIdx["dagChildren"]=9;
  50509. $32=$recv($33)._first();
  50510. $ctx1.sendIdx["first"]=8;
  50511. $31=$recv($32)._left();
  50512. $30=$recv($31)._binding();
  50513. $29=$recv($30)._scope();
  50514. $ctx1.sendIdx["scope"]=3;
  50515. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50516. $ctx1.sendIdx["dagChildren"]=13;
  50517. $41=$recv($42)._last();
  50518. $40=$recv($41)._scope();
  50519. $28=$recv($29).__eq_eq($40);
  50520. $self._assert_($28);
  50521. return self;
  50522. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50523. },
  50524. args: [],
  50525. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding scope == ast dagChildren first dagChildren last scope.",
  50526. referencedClasses: ["Smalltalk"],
  50527. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50528. }),
  50529. $globals.SemanticAnalyzerTest);
  50530. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50531. $core.addMethod(
  50532. $core.method({
  50533. selector: "setUp",
  50534. protocol: "running",
  50535. fn: function (){
  50536. var self=this,$self=this;
  50537. return $core.withContext(function($ctx1) {
  50538. var $1,$3,$4,$2;
  50539. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50540. $3=$recv($globals.AIContext)._new();
  50541. $recv($3)._defineLocal_("local");
  50542. $recv($3)._localAt_put_("local",(3));
  50543. $4=$recv($3)._yourself();
  50544. $ctx1.sendIdx["yourself"]=1;
  50545. $2=$4;
  50546. $recv($1)._context_($2);
  50547. $self["@analyzer"]=$recv($1)._yourself();
  50548. return self;
  50549. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50550. },
  50551. args: [],
  50552. 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",
  50553. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50554. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50555. }),
  50556. $globals.AISemanticAnalyzerTest);
  50557. $core.addMethod(
  50558. $core.method({
  50559. selector: "testContextVariables",
  50560. protocol: "tests",
  50561. fn: function (){
  50562. var self=this,$self=this;
  50563. var src,ast;
  50564. return $core.withContext(function($ctx1) {
  50565. src="foo | a | local + a";
  50566. ast=$recv($globals.Smalltalk)._parse_(src);
  50567. $self._shouldnt_raise_((function(){
  50568. return $core.withContext(function($ctx2) {
  50569. return $recv($self["@analyzer"])._visit_(ast);
  50570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50571. }),$globals.UnknownVariableError);
  50572. return self;
  50573. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50574. },
  50575. args: [],
  50576. 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",
  50577. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50578. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50579. }),
  50580. $globals.AISemanticAnalyzerTest);
  50581. });
  50582. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50583. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50584. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50585. var $pkg = $core.addPackage("Kernel-Tests");
  50586. $pkg.innerEval = function (expr) { return eval(expr); };
  50587. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  50588. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50589. $core.addMethod(
  50590. $core.method({
  50591. selector: "testAddExtensionMethod",
  50592. protocol: "tests",
  50593. fn: function (){
  50594. var self=this,$self=this;
  50595. var method,dirty;
  50596. return $core.withContext(function($ctx1) {
  50597. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50598. $2=$self._class();
  50599. $ctx1.sendIdx["class"]=1;
  50600. $1=$recv($2)._package();
  50601. $ctx1.sendIdx["package"]=1;
  50602. dirty=$recv($1)._isDirty();
  50603. $ctx1.sendIdx["isDirty"]=1;
  50604. $4=$self._class();
  50605. $ctx1.sendIdx["class"]=2;
  50606. $3=$recv($4)._package();
  50607. $ctx1.sendIdx["package"]=2;
  50608. $recv($3)._beClean();
  50609. $5=$self._class();
  50610. $ctx1.sendIdx["class"]=3;
  50611. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50612. $8=$self._class();
  50613. $ctx1.sendIdx["class"]=4;
  50614. $7=$recv($8)._package();
  50615. $ctx1.sendIdx["package"]=3;
  50616. $6=$recv($7)._isDirty();
  50617. $self._deny_($6);
  50618. $9=$self._class();
  50619. $ctx1.sendIdx["class"]=5;
  50620. $recv($9)._removeCompiledMethod_(method);
  50621. $10=dirty;
  50622. if($core.assert($10)){
  50623. $recv($recv($self._class())._package())._beDirty();
  50624. }
  50625. return self;
  50626. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50627. },
  50628. args: [],
  50629. 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 ]",
  50630. referencedClasses: [],
  50631. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50632. }),
  50633. $globals.AnnouncementSubscriptionTest);
  50634. $core.addMethod(
  50635. $core.method({
  50636. selector: "testHandlesAnnouncement",
  50637. protocol: "tests",
  50638. fn: function (){
  50639. var self=this,$self=this;
  50640. var subscription,announcementClass1,announcementClass2,classBuilder;
  50641. return $core.withContext(function($ctx1) {
  50642. var $1,$3,$4,$2,$6,$7,$5;
  50643. classBuilder=$recv($globals.ClassBuilder)._new();
  50644. $ctx1.sendIdx["new"]=1;
  50645. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50646. $1=$recv($globals.AnnouncementSubscription)._new();
  50647. $ctx1.sendIdx["new"]=2;
  50648. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  50649. $3=subscription;
  50650. $4=$recv($globals.SystemAnnouncement)._new();
  50651. $ctx1.sendIdx["new"]=3;
  50652. $2=$recv($3)._handlesAnnouncement_($4);
  50653. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50654. $self._assert_equals_($2,true);
  50655. $ctx1.sendIdx["assert:equals:"]=1;
  50656. $6=subscription;
  50657. $7=$recv(announcementClass1)._new();
  50658. $ctx1.sendIdx["new"]=4;
  50659. $5=$recv($6)._handlesAnnouncement_($7);
  50660. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50661. $self._assert_equals_($5,true);
  50662. $ctx1.sendIdx["assert:equals:"]=2;
  50663. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50664. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50665. return self;
  50666. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50667. },
  50668. args: [],
  50669. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement new) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1 new) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object new) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50670. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50671. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50672. }),
  50673. $globals.AnnouncementSubscriptionTest);
  50674. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50675. $core.addMethod(
  50676. $core.method({
  50677. selector: "testOnDo",
  50678. protocol: "tests",
  50679. fn: function (){
  50680. var self=this,$self=this;
  50681. var counter,announcer;
  50682. return $core.withContext(function($ctx1) {
  50683. var $1,$2;
  50684. counter=(0);
  50685. announcer=$recv($globals.Announcer)._new();
  50686. $ctx1.sendIdx["new"]=1;
  50687. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50688. return $core.withContext(function($ctx2) {
  50689. counter=$recv(counter).__plus((1));
  50690. return counter;
  50691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50692. }));
  50693. $1=announcer;
  50694. $2=$recv($globals.SystemAnnouncement)._new();
  50695. $ctx1.sendIdx["new"]=2;
  50696. $recv($1)._announce_($2);
  50697. $ctx1.sendIdx["announce:"]=1;
  50698. $self._assert_equals_(counter,(1));
  50699. $ctx1.sendIdx["assert:equals:"]=1;
  50700. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50701. $self._assert_equals_(counter,(2));
  50702. return self;
  50703. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50704. },
  50705. args: [],
  50706. 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.",
  50707. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50708. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50709. }),
  50710. $globals.AnnouncerTest);
  50711. $core.addMethod(
  50712. $core.method({
  50713. selector: "testOnDoFor",
  50714. protocol: "tests",
  50715. fn: function (){
  50716. var self=this,$self=this;
  50717. var counter,announcer;
  50718. return $core.withContext(function($ctx1) {
  50719. var $1,$2,$3,$4;
  50720. counter=(0);
  50721. announcer=$recv($globals.Announcer)._new();
  50722. $ctx1.sendIdx["new"]=1;
  50723. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50724. return $core.withContext(function($ctx2) {
  50725. counter=$recv(counter).__plus((1));
  50726. return counter;
  50727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50728. }),self);
  50729. $1=announcer;
  50730. $2=$recv($globals.SystemAnnouncement)._new();
  50731. $ctx1.sendIdx["new"]=2;
  50732. $recv($1)._announce_($2);
  50733. $ctx1.sendIdx["announce:"]=1;
  50734. $self._assert_equals_(counter,(1));
  50735. $ctx1.sendIdx["assert:equals:"]=1;
  50736. $3=announcer;
  50737. $4=$recv($globals.SystemAnnouncement)._new();
  50738. $ctx1.sendIdx["new"]=3;
  50739. $recv($3)._announce_($4);
  50740. $ctx1.sendIdx["announce:"]=2;
  50741. $self._assert_equals_(counter,(2));
  50742. $ctx1.sendIdx["assert:equals:"]=2;
  50743. $recv(announcer)._unsubscribe_(self);
  50744. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50745. $self._assert_equals_(counter,(2));
  50746. return self;
  50747. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50748. },
  50749. args: [],
  50750. 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.",
  50751. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50752. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50753. }),
  50754. $globals.AnnouncerTest);
  50755. $core.addMethod(
  50756. $core.method({
  50757. selector: "testOnDoOnce",
  50758. protocol: "tests",
  50759. fn: function (){
  50760. var self=this,$self=this;
  50761. var counter,announcer;
  50762. return $core.withContext(function($ctx1) {
  50763. var $1,$2;
  50764. counter=(0);
  50765. announcer=$recv($globals.Announcer)._new();
  50766. $ctx1.sendIdx["new"]=1;
  50767. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50768. return $core.withContext(function($ctx2) {
  50769. counter=$recv(counter).__plus((1));
  50770. return counter;
  50771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50772. }));
  50773. $1=announcer;
  50774. $2=$recv($globals.SystemAnnouncement)._new();
  50775. $ctx1.sendIdx["new"]=2;
  50776. $recv($1)._announce_($2);
  50777. $ctx1.sendIdx["announce:"]=1;
  50778. $self._assert_equals_(counter,(1));
  50779. $ctx1.sendIdx["assert:equals:"]=1;
  50780. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50781. $self._assert_equals_(counter,(1));
  50782. return self;
  50783. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50784. },
  50785. args: [],
  50786. 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.",
  50787. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50788. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50789. }),
  50790. $globals.AnnouncerTest);
  50791. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50792. $core.addMethod(
  50793. $core.method({
  50794. selector: "localReturnOnDoCatch",
  50795. protocol: "fixture",
  50796. fn: function (){
  50797. var self=this,$self=this;
  50798. return $core.withContext(function($ctx1) {
  50799. var $early={};
  50800. try {
  50801. $recv((function(){
  50802. throw $early=[(2)];
  50803. }))._on_do_($globals.Error,(function(){
  50804. }));
  50805. return (3);
  50806. }
  50807. catch(e) {if(e===$early)return e[0]; throw e}
  50808. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50809. },
  50810. args: [],
  50811. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50812. referencedClasses: ["Error"],
  50813. messageSends: ["on:do:"]
  50814. }),
  50815. $globals.BlockClosureTest);
  50816. $core.addMethod(
  50817. $core.method({
  50818. selector: "localReturnOnDoMiss",
  50819. protocol: "fixture",
  50820. fn: function (){
  50821. var self=this,$self=this;
  50822. return $core.withContext(function($ctx1) {
  50823. var $early={};
  50824. try {
  50825. $recv((function(){
  50826. throw $early=[(2)];
  50827. }))._on_do_($globals.Class,(function(){
  50828. }));
  50829. return (3);
  50830. }
  50831. catch(e) {if(e===$early)return e[0]; throw e}
  50832. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50833. },
  50834. args: [],
  50835. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50836. referencedClasses: ["Class"],
  50837. messageSends: ["on:do:"]
  50838. }),
  50839. $globals.BlockClosureTest);
  50840. $core.addMethod(
  50841. $core.method({
  50842. selector: "testCanClearInterval",
  50843. protocol: "tests",
  50844. fn: function (){
  50845. var self=this,$self=this;
  50846. return $core.withContext(function($ctx1) {
  50847. $self._shouldnt_raise_((function(){
  50848. return $core.withContext(function($ctx2) {
  50849. return $recv($recv((function(){
  50850. return $core.withContext(function($ctx3) {
  50851. return $recv($recv($globals.Error)._new())._signal();
  50852. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50853. }))._valueWithInterval_((0)))._clearInterval();
  50854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50855. }),$globals.Error);
  50856. return self;
  50857. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50858. },
  50859. args: [],
  50860. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50861. referencedClasses: ["Error"],
  50862. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50863. }),
  50864. $globals.BlockClosureTest);
  50865. $core.addMethod(
  50866. $core.method({
  50867. selector: "testCanClearTimeout",
  50868. protocol: "tests",
  50869. fn: function (){
  50870. var self=this,$self=this;
  50871. return $core.withContext(function($ctx1) {
  50872. $self._shouldnt_raise_((function(){
  50873. return $core.withContext(function($ctx2) {
  50874. return $recv($recv((function(){
  50875. return $core.withContext(function($ctx3) {
  50876. return $recv($recv($globals.Error)._new())._signal();
  50877. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50878. }))._valueWithTimeout_((0)))._clearTimeout();
  50879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50880. }),$globals.Error);
  50881. return self;
  50882. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50883. },
  50884. args: [],
  50885. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50886. referencedClasses: ["Error"],
  50887. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50888. }),
  50889. $globals.BlockClosureTest);
  50890. $core.addMethod(
  50891. $core.method({
  50892. selector: "testCompiledSource",
  50893. protocol: "tests",
  50894. fn: function (){
  50895. var self=this,$self=this;
  50896. return $core.withContext(function($ctx1) {
  50897. $self._assert_($recv($recv((function(){
  50898. return $core.withContext(function($ctx2) {
  50899. return (1).__plus((1));
  50900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50901. }))._compiledSource())._includesSubString_("function"));
  50902. return self;
  50903. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50904. },
  50905. args: [],
  50906. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50907. referencedClasses: [],
  50908. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50909. }),
  50910. $globals.BlockClosureTest);
  50911. $core.addMethod(
  50912. $core.method({
  50913. selector: "testCurrySelf",
  50914. protocol: "tests",
  50915. fn: function (){
  50916. var self=this,$self=this;
  50917. var curriedMethod,array;
  50918. return $core.withContext(function($ctx1) {
  50919. curriedMethod=$recv($recv((function(selfarg,x){
  50920. return $core.withContext(function($ctx2) {
  50921. return $recv(selfarg)._at_(x);
  50922. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50923. }))._currySelf())._asCompiledMethod_("foo:");
  50924. array=[(3), (1), (4)];
  50925. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50926. $recv((function(){
  50927. return $core.withContext(function($ctx2) {
  50928. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50930. }))._ensure_((function(){
  50931. return $core.withContext(function($ctx2) {
  50932. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50934. }));
  50935. return self;
  50936. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50937. },
  50938. args: [],
  50939. 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 ]",
  50940. referencedClasses: ["ClassBuilder", "Array"],
  50941. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50942. }),
  50943. $globals.BlockClosureTest);
  50944. $core.addMethod(
  50945. $core.method({
  50946. selector: "testEnsure",
  50947. protocol: "tests",
  50948. fn: function (){
  50949. var self=this,$self=this;
  50950. return $core.withContext(function($ctx1) {
  50951. $self._assert_equals_($recv((function(){
  50952. return (3);
  50953. }))._ensure_((function(){
  50954. return (4);
  50955. })),(3));
  50956. return self;
  50957. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50958. },
  50959. args: [],
  50960. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50961. referencedClasses: [],
  50962. messageSends: ["assert:equals:", "ensure:"]
  50963. }),
  50964. $globals.BlockClosureTest);
  50965. $core.addMethod(
  50966. $core.method({
  50967. selector: "testEnsureRaises",
  50968. protocol: "tests",
  50969. fn: function (){
  50970. var self=this,$self=this;
  50971. return $core.withContext(function($ctx1) {
  50972. $self._should_raise_((function(){
  50973. return $core.withContext(function($ctx2) {
  50974. return $recv((function(){
  50975. return $core.withContext(function($ctx3) {
  50976. return $recv($recv($globals.Error)._new())._signal();
  50977. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50978. }))._ensure_((function(){
  50979. return true;
  50980. }));
  50981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50982. }),$globals.Error);
  50983. return self;
  50984. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50985. },
  50986. args: [],
  50987. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50988. referencedClasses: ["Error"],
  50989. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50990. }),
  50991. $globals.BlockClosureTest);
  50992. $core.addMethod(
  50993. $core.method({
  50994. selector: "testExceptionSemantics",
  50995. protocol: "tests",
  50996. fn: function (){
  50997. var self=this,$self=this;
  50998. return $core.withContext(function($ctx1) {
  50999. $self._timeout_((100));
  51000. $recv($self._async_((function(){
  51001. return $core.withContext(function($ctx2) {
  51002. return $recv((function(){
  51003. return $core.withContext(function($ctx3) {
  51004. $self._assert_(true);
  51005. $recv($globals.Error)._signal();
  51006. $self._deny_(true);
  51007. return $self._finished();
  51008. $ctx3.sendIdx["finished"]=1;
  51009. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51010. }))._on_do_($globals.Error,(function(ex){
  51011. return $core.withContext(function($ctx3) {
  51012. return $self._finished();
  51013. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51014. }));
  51015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51016. })))._valueWithTimeout_((0));
  51017. return self;
  51018. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51019. },
  51020. args: [],
  51021. source: "testExceptionSemantics\x0a\x09\x22See https://lolg.it/amber/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  51022. referencedClasses: ["Error"],
  51023. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51024. }),
  51025. $globals.BlockClosureTest);
  51026. $core.addMethod(
  51027. $core.method({
  51028. selector: "testLocalReturnOnDoCatch",
  51029. protocol: "tests",
  51030. fn: function (){
  51031. var self=this,$self=this;
  51032. return $core.withContext(function($ctx1) {
  51033. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51034. return self;
  51035. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51036. },
  51037. args: [],
  51038. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51039. referencedClasses: [],
  51040. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51041. }),
  51042. $globals.BlockClosureTest);
  51043. $core.addMethod(
  51044. $core.method({
  51045. selector: "testLocalReturnOnDoMiss",
  51046. protocol: "tests",
  51047. fn: function (){
  51048. var self=this,$self=this;
  51049. return $core.withContext(function($ctx1) {
  51050. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51051. return self;
  51052. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51053. },
  51054. args: [],
  51055. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51056. referencedClasses: [],
  51057. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51058. }),
  51059. $globals.BlockClosureTest);
  51060. $core.addMethod(
  51061. $core.method({
  51062. selector: "testNewWithValues",
  51063. protocol: "tests",
  51064. fn: function (){
  51065. var self=this,$self=this;
  51066. return $core.withContext(function($ctx1) {
  51067. function TestConstructor(arg1, arg2, arg3) {}
  51068. TestConstructor.prototype.name = "theTestPrototype";
  51069. var wrappedConstructor = $recv(TestConstructor);
  51070. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51071. $self._assert_(result instanceof TestConstructor);
  51072. $self._assert_equals_(result.name, "theTestPrototype");
  51073. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51074. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51075. return self;
  51076. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51077. },
  51078. args: [],
  51079. source: "testNewWithValues\x0a<inlineJS: '\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09$self._assert_(result instanceof TestConstructor);\x0a\x09$self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09$self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  51080. referencedClasses: [],
  51081. messageSends: []
  51082. }),
  51083. $globals.BlockClosureTest);
  51084. $core.addMethod(
  51085. $core.method({
  51086. selector: "testNumArgs",
  51087. protocol: "tests",
  51088. fn: function (){
  51089. var self=this,$self=this;
  51090. return $core.withContext(function($ctx1) {
  51091. var $1;
  51092. $1=$recv((function(){
  51093. }))._numArgs();
  51094. $ctx1.sendIdx["numArgs"]=1;
  51095. $self._assert_equals_($1,(0));
  51096. $ctx1.sendIdx["assert:equals:"]=1;
  51097. $self._assert_equals_($recv((function(a,b){
  51098. }))._numArgs(),(2));
  51099. return self;
  51100. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51101. },
  51102. args: [],
  51103. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51104. referencedClasses: [],
  51105. messageSends: ["assert:equals:", "numArgs"]
  51106. }),
  51107. $globals.BlockClosureTest);
  51108. $core.addMethod(
  51109. $core.method({
  51110. selector: "testOnDo",
  51111. protocol: "tests",
  51112. fn: function (){
  51113. var self=this,$self=this;
  51114. return $core.withContext(function($ctx1) {
  51115. $self._assert_($recv((function(){
  51116. return $core.withContext(function($ctx2) {
  51117. return $recv($recv($globals.Error)._new())._signal();
  51118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51119. }))._on_do_($globals.Error,(function(ex){
  51120. return true;
  51121. })));
  51122. return self;
  51123. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51124. },
  51125. args: [],
  51126. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51127. referencedClasses: ["Error"],
  51128. messageSends: ["assert:", "on:do:", "signal", "new"]
  51129. }),
  51130. $globals.BlockClosureTest);
  51131. $core.addMethod(
  51132. $core.method({
  51133. selector: "testValue",
  51134. protocol: "tests",
  51135. fn: function (){
  51136. var self=this,$self=this;
  51137. return $core.withContext(function($ctx1) {
  51138. var $1;
  51139. $1=$recv((function(){
  51140. return $core.withContext(function($ctx2) {
  51141. return (1).__plus((1));
  51142. $ctx2.sendIdx["+"]=1;
  51143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51144. }))._value();
  51145. $ctx1.sendIdx["value"]=1;
  51146. $self._assert_equals_($1,(2));
  51147. $ctx1.sendIdx["assert:equals:"]=1;
  51148. $self._assert_equals_($recv((function(x){
  51149. return $core.withContext(function($ctx2) {
  51150. return $recv(x).__plus((1));
  51151. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51152. }))._value_((2)),(3));
  51153. $ctx1.sendIdx["assert:equals:"]=2;
  51154. $self._assert_equals_($recv((function(x,y){
  51155. return $core.withContext(function($ctx2) {
  51156. return $recv(x).__star(y);
  51157. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51158. }))._value_value_((2),(4)),(8));
  51159. $ctx1.sendIdx["assert:equals:"]=3;
  51160. $self._assert_equals_($recv((function(a,b,c){
  51161. return (1);
  51162. }))._value(),(1));
  51163. return self;
  51164. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51165. },
  51166. args: [],
  51167. 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",
  51168. referencedClasses: [],
  51169. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51170. }),
  51171. $globals.BlockClosureTest);
  51172. $core.addMethod(
  51173. $core.method({
  51174. selector: "testValueWithPossibleArguments",
  51175. protocol: "tests",
  51176. fn: function (){
  51177. var self=this,$self=this;
  51178. return $core.withContext(function($ctx1) {
  51179. var $1,$2;
  51180. $1=$recv((function(){
  51181. return (1);
  51182. }))._valueWithPossibleArguments_([(3), (4)]);
  51183. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51184. $self._assert_equals_($1,(1));
  51185. $ctx1.sendIdx["assert:equals:"]=1;
  51186. $2=$recv((function(a){
  51187. return $core.withContext(function($ctx2) {
  51188. return $recv(a).__plus((4));
  51189. $ctx2.sendIdx["+"]=1;
  51190. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51191. }))._valueWithPossibleArguments_([(3), (4)]);
  51192. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51193. $self._assert_equals_($2,(7));
  51194. $ctx1.sendIdx["assert:equals:"]=2;
  51195. $self._assert_equals_($recv((function(a,b){
  51196. return $core.withContext(function($ctx2) {
  51197. return $recv(a).__plus(b);
  51198. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51199. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51200. return self;
  51201. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51202. },
  51203. args: [],
  51204. 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.",
  51205. referencedClasses: [],
  51206. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51207. }),
  51208. $globals.BlockClosureTest);
  51209. $core.addMethod(
  51210. $core.method({
  51211. selector: "testWhileFalse",
  51212. protocol: "tests",
  51213. fn: function (){
  51214. var self=this,$self=this;
  51215. var i;
  51216. return $core.withContext(function($ctx1) {
  51217. i=(0);
  51218. $recv((function(){
  51219. return $core.withContext(function($ctx2) {
  51220. return $recv(i).__gt((5));
  51221. $ctx2.sendIdx[">"]=1;
  51222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51223. }))._whileFalse_((function(){
  51224. return $core.withContext(function($ctx2) {
  51225. i=$recv(i).__plus((1));
  51226. $ctx2.sendIdx["+"]=1;
  51227. return i;
  51228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51229. }));
  51230. $self._assert_equals_(i,(6));
  51231. $ctx1.sendIdx["assert:equals:"]=1;
  51232. i=(0);
  51233. $recv((function(){
  51234. return $core.withContext(function($ctx2) {
  51235. i=$recv(i).__plus((1));
  51236. return $recv(i).__gt((5));
  51237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51238. }))._whileFalse();
  51239. $self._assert_equals_(i,(6));
  51240. return self;
  51241. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51242. },
  51243. args: [],
  51244. 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",
  51245. referencedClasses: [],
  51246. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51247. }),
  51248. $globals.BlockClosureTest);
  51249. $core.addMethod(
  51250. $core.method({
  51251. selector: "testWhileTrue",
  51252. protocol: "tests",
  51253. fn: function (){
  51254. var self=this,$self=this;
  51255. var i;
  51256. return $core.withContext(function($ctx1) {
  51257. i=(0);
  51258. $recv((function(){
  51259. return $core.withContext(function($ctx2) {
  51260. return $recv(i).__lt((5));
  51261. $ctx2.sendIdx["<"]=1;
  51262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51263. }))._whileTrue_((function(){
  51264. return $core.withContext(function($ctx2) {
  51265. i=$recv(i).__plus((1));
  51266. $ctx2.sendIdx["+"]=1;
  51267. return i;
  51268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51269. }));
  51270. $self._assert_equals_(i,(5));
  51271. $ctx1.sendIdx["assert:equals:"]=1;
  51272. i=(0);
  51273. $recv((function(){
  51274. return $core.withContext(function($ctx2) {
  51275. i=$recv(i).__plus((1));
  51276. return $recv(i).__lt((5));
  51277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51278. }))._whileTrue();
  51279. $self._assert_equals_(i,(5));
  51280. return self;
  51281. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51282. },
  51283. args: [],
  51284. 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",
  51285. referencedClasses: [],
  51286. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51287. }),
  51288. $globals.BlockClosureTest);
  51289. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51290. $core.addMethod(
  51291. $core.method({
  51292. selector: "testEquality",
  51293. protocol: "tests",
  51294. fn: function (){
  51295. var self=this,$self=this;
  51296. return $core.withContext(function($ctx1) {
  51297. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51298. $1=(0).__eq(false);
  51299. $ctx1.sendIdx["="]=1;
  51300. $self._deny_($1);
  51301. $ctx1.sendIdx["deny:"]=1;
  51302. $2=false.__eq((0));
  51303. $ctx1.sendIdx["="]=2;
  51304. $self._deny_($2);
  51305. $ctx1.sendIdx["deny:"]=2;
  51306. $3="".__eq(false);
  51307. $ctx1.sendIdx["="]=3;
  51308. $self._deny_($3);
  51309. $ctx1.sendIdx["deny:"]=3;
  51310. $4=false.__eq("");
  51311. $ctx1.sendIdx["="]=4;
  51312. $self._deny_($4);
  51313. $ctx1.sendIdx["deny:"]=4;
  51314. $5=true.__eq(true);
  51315. $ctx1.sendIdx["="]=5;
  51316. $self._assert_($5);
  51317. $ctx1.sendIdx["assert:"]=1;
  51318. $6=false.__eq(true);
  51319. $ctx1.sendIdx["="]=6;
  51320. $self._deny_($6);
  51321. $ctx1.sendIdx["deny:"]=5;
  51322. $7=true.__eq(false);
  51323. $ctx1.sendIdx["="]=7;
  51324. $self._deny_($7);
  51325. $8=false.__eq(false);
  51326. $ctx1.sendIdx["="]=8;
  51327. $self._assert_($8);
  51328. $ctx1.sendIdx["assert:"]=2;
  51329. $10=true._yourself();
  51330. $ctx1.sendIdx["yourself"]=1;
  51331. $9=$recv($10).__eq(true);
  51332. $ctx1.sendIdx["="]=9;
  51333. $self._assert_($9);
  51334. $ctx1.sendIdx["assert:"]=3;
  51335. $12=true._yourself();
  51336. $ctx1.sendIdx["yourself"]=2;
  51337. $11=$recv($12).__eq(true._yourself());
  51338. $self._assert_($11);
  51339. return self;
  51340. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51341. },
  51342. args: [],
  51343. 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)",
  51344. referencedClasses: [],
  51345. messageSends: ["deny:", "=", "assert:", "yourself"]
  51346. }),
  51347. $globals.BooleanTest);
  51348. $core.addMethod(
  51349. $core.method({
  51350. selector: "testIdentity",
  51351. protocol: "tests",
  51352. fn: function (){
  51353. var self=this,$self=this;
  51354. return $core.withContext(function($ctx1) {
  51355. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51356. $1=(0).__eq_eq(false);
  51357. $ctx1.sendIdx["=="]=1;
  51358. $self._deny_($1);
  51359. $ctx1.sendIdx["deny:"]=1;
  51360. $2=false.__eq_eq((0));
  51361. $ctx1.sendIdx["=="]=2;
  51362. $self._deny_($2);
  51363. $ctx1.sendIdx["deny:"]=2;
  51364. $3="".__eq_eq(false);
  51365. $ctx1.sendIdx["=="]=3;
  51366. $self._deny_($3);
  51367. $ctx1.sendIdx["deny:"]=3;
  51368. $4=false.__eq_eq("");
  51369. $ctx1.sendIdx["=="]=4;
  51370. $self._deny_($4);
  51371. $ctx1.sendIdx["deny:"]=4;
  51372. $5=true.__eq_eq(true);
  51373. $ctx1.sendIdx["=="]=5;
  51374. $self._assert_($5);
  51375. $ctx1.sendIdx["assert:"]=1;
  51376. $6=false.__eq_eq(true);
  51377. $ctx1.sendIdx["=="]=6;
  51378. $self._deny_($6);
  51379. $ctx1.sendIdx["deny:"]=5;
  51380. $7=true.__eq_eq(false);
  51381. $ctx1.sendIdx["=="]=7;
  51382. $self._deny_($7);
  51383. $8=false.__eq_eq(false);
  51384. $ctx1.sendIdx["=="]=8;
  51385. $self._assert_($8);
  51386. $ctx1.sendIdx["assert:"]=2;
  51387. $10=true._yourself();
  51388. $ctx1.sendIdx["yourself"]=1;
  51389. $9=$recv($10).__eq_eq(true);
  51390. $ctx1.sendIdx["=="]=9;
  51391. $self._assert_($9);
  51392. $ctx1.sendIdx["assert:"]=3;
  51393. $12=true._yourself();
  51394. $ctx1.sendIdx["yourself"]=2;
  51395. $11=$recv($12).__eq_eq(true._yourself());
  51396. $self._assert_($11);
  51397. return self;
  51398. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51399. },
  51400. args: [],
  51401. 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",
  51402. referencedClasses: [],
  51403. messageSends: ["deny:", "==", "assert:", "yourself"]
  51404. }),
  51405. $globals.BooleanTest);
  51406. $core.addMethod(
  51407. $core.method({
  51408. selector: "testIfTrueIfFalse",
  51409. protocol: "tests",
  51410. fn: function (){
  51411. var self=this,$self=this;
  51412. return $core.withContext(function($ctx1) {
  51413. var $1,$2,$3,$4,$5,$6,$7,$8;
  51414. if($core.assert(true)){
  51415. $1="alternative block";
  51416. }
  51417. $self._assert_equals_($1,"alternative block");
  51418. $ctx1.sendIdx["assert:equals:"]=1;
  51419. if(!$core.assert(true)){
  51420. $2="alternative block";
  51421. }
  51422. $self._assert_equals_($2,nil);
  51423. $ctx1.sendIdx["assert:equals:"]=2;
  51424. if($core.assert(false)){
  51425. $3="alternative block";
  51426. }
  51427. $self._assert_equals_($3,nil);
  51428. $ctx1.sendIdx["assert:equals:"]=3;
  51429. if(!$core.assert(false)){
  51430. $4="alternative block";
  51431. }
  51432. $self._assert_equals_($4,"alternative block");
  51433. $ctx1.sendIdx["assert:equals:"]=4;
  51434. if($core.assert(false)){
  51435. $5="alternative block";
  51436. } else {
  51437. $5="alternative block2";
  51438. }
  51439. $self._assert_equals_($5,"alternative block2");
  51440. $ctx1.sendIdx["assert:equals:"]=5;
  51441. if($core.assert(false)){
  51442. $6="alternative block2";
  51443. } else {
  51444. $6="alternative block";
  51445. }
  51446. $self._assert_equals_($6,"alternative block");
  51447. $ctx1.sendIdx["assert:equals:"]=6;
  51448. if($core.assert(true)){
  51449. $7="alternative block";
  51450. } else {
  51451. $7="alternative block2";
  51452. }
  51453. $self._assert_equals_($7,"alternative block");
  51454. $ctx1.sendIdx["assert:equals:"]=7;
  51455. if($core.assert(true)){
  51456. $8="alternative block2";
  51457. } else {
  51458. $8="alternative block";
  51459. }
  51460. $self._assert_equals_($8,"alternative block2");
  51461. return self;
  51462. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51463. },
  51464. args: [],
  51465. 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'.",
  51466. referencedClasses: [],
  51467. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51468. }),
  51469. $globals.BooleanTest);
  51470. $core.addMethod(
  51471. $core.method({
  51472. selector: "testIfTrueIfFalseWithBoxing",
  51473. protocol: "tests",
  51474. fn: function (){
  51475. var self=this,$self=this;
  51476. return $core.withContext(function($ctx1) {
  51477. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51478. $2=true._yourself();
  51479. $ctx1.sendIdx["yourself"]=1;
  51480. if($core.assert($2)){
  51481. $1="alternative block";
  51482. }
  51483. $self._assert_equals_($1,"alternative block");
  51484. $ctx1.sendIdx["assert:equals:"]=1;
  51485. $4=true._yourself();
  51486. $ctx1.sendIdx["yourself"]=2;
  51487. if(!$core.assert($4)){
  51488. $3="alternative block";
  51489. }
  51490. $self._assert_equals_($3,nil);
  51491. $ctx1.sendIdx["assert:equals:"]=2;
  51492. $6=false._yourself();
  51493. $ctx1.sendIdx["yourself"]=3;
  51494. if($core.assert($6)){
  51495. $5="alternative block";
  51496. }
  51497. $self._assert_equals_($5,nil);
  51498. $ctx1.sendIdx["assert:equals:"]=3;
  51499. $8=false._yourself();
  51500. $ctx1.sendIdx["yourself"]=4;
  51501. if(!$core.assert($8)){
  51502. $7="alternative block";
  51503. }
  51504. $self._assert_equals_($7,"alternative block");
  51505. $ctx1.sendIdx["assert:equals:"]=4;
  51506. $10=false._yourself();
  51507. $ctx1.sendIdx["yourself"]=5;
  51508. if($core.assert($10)){
  51509. $9="alternative block";
  51510. } else {
  51511. $9="alternative block2";
  51512. }
  51513. $self._assert_equals_($9,"alternative block2");
  51514. $ctx1.sendIdx["assert:equals:"]=5;
  51515. $12=false._yourself();
  51516. $ctx1.sendIdx["yourself"]=6;
  51517. if($core.assert($12)){
  51518. $11="alternative block2";
  51519. } else {
  51520. $11="alternative block";
  51521. }
  51522. $self._assert_equals_($11,"alternative block");
  51523. $ctx1.sendIdx["assert:equals:"]=6;
  51524. $14=true._yourself();
  51525. $ctx1.sendIdx["yourself"]=7;
  51526. if($core.assert($14)){
  51527. $13="alternative block";
  51528. } else {
  51529. $13="alternative block2";
  51530. }
  51531. $self._assert_equals_($13,"alternative block");
  51532. $ctx1.sendIdx["assert:equals:"]=7;
  51533. $16=true._yourself();
  51534. if($core.assert($16)){
  51535. $15="alternative block2";
  51536. } else {
  51537. $15="alternative block";
  51538. }
  51539. $self._assert_equals_($15,"alternative block2");
  51540. return self;
  51541. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51542. },
  51543. args: [],
  51544. 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'.",
  51545. referencedClasses: [],
  51546. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51547. }),
  51548. $globals.BooleanTest);
  51549. $core.addMethod(
  51550. $core.method({
  51551. selector: "testLogic",
  51552. protocol: "tests",
  51553. fn: function (){
  51554. var self=this,$self=this;
  51555. return $core.withContext(function($ctx1) {
  51556. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51557. $1=true.__and(true);
  51558. $ctx1.sendIdx["&"]=1;
  51559. $self._assert_($1);
  51560. $ctx1.sendIdx["assert:"]=1;
  51561. $2=true.__and(false);
  51562. $ctx1.sendIdx["&"]=2;
  51563. $self._deny_($2);
  51564. $ctx1.sendIdx["deny:"]=1;
  51565. $3=false.__and(true);
  51566. $ctx1.sendIdx["&"]=3;
  51567. $self._deny_($3);
  51568. $ctx1.sendIdx["deny:"]=2;
  51569. $5=false.__and(false);
  51570. $ctx1.sendIdx["&"]=4;
  51571. $4=$self._deny_($5);
  51572. $ctx1.sendIdx["deny:"]=3;
  51573. $6=true.__or(true);
  51574. $ctx1.sendIdx["|"]=1;
  51575. $self._assert_($6);
  51576. $ctx1.sendIdx["assert:"]=2;
  51577. $7=true.__or(false);
  51578. $ctx1.sendIdx["|"]=2;
  51579. $self._assert_($7);
  51580. $ctx1.sendIdx["assert:"]=3;
  51581. $8=false.__or(true);
  51582. $ctx1.sendIdx["|"]=3;
  51583. $self._assert_($8);
  51584. $ctx1.sendIdx["assert:"]=4;
  51585. $10=false.__or(false);
  51586. $ctx1.sendIdx["|"]=4;
  51587. $9=$self._deny_($10);
  51588. $ctx1.sendIdx["deny:"]=4;
  51589. $12=(1).__gt((0));
  51590. $ctx1.sendIdx[">"]=1;
  51591. $11=true.__and($12);
  51592. $ctx1.sendIdx["&"]=5;
  51593. $self._assert_($11);
  51594. $ctx1.sendIdx["assert:"]=5;
  51595. $14=(1).__gt((0));
  51596. $ctx1.sendIdx[">"]=2;
  51597. $13=$recv($14).__and(false);
  51598. $ctx1.sendIdx["&"]=6;
  51599. $self._deny_($13);
  51600. $ctx1.sendIdx["deny:"]=5;
  51601. $16=(1).__gt((0));
  51602. $ctx1.sendIdx[">"]=3;
  51603. $17=(1).__gt((2));
  51604. $ctx1.sendIdx[">"]=4;
  51605. $15=$recv($16).__and($17);
  51606. $self._deny_($15);
  51607. $19=(1).__gt((0));
  51608. $ctx1.sendIdx[">"]=5;
  51609. $18=false.__or($19);
  51610. $ctx1.sendIdx["|"]=5;
  51611. $self._assert_($18);
  51612. $ctx1.sendIdx["assert:"]=6;
  51613. $21=(1).__gt((0));
  51614. $ctx1.sendIdx[">"]=6;
  51615. $20=$recv($21).__or(false);
  51616. $ctx1.sendIdx["|"]=6;
  51617. $self._assert_($20);
  51618. $ctx1.sendIdx["assert:"]=7;
  51619. $23=(1).__gt((0));
  51620. $ctx1.sendIdx[">"]=7;
  51621. $22=$recv($23).__or((1).__gt((2)));
  51622. $self._assert_($22);
  51623. return self;
  51624. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51625. },
  51626. args: [],
  51627. 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))",
  51628. referencedClasses: [],
  51629. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51630. }),
  51631. $globals.BooleanTest);
  51632. $core.addMethod(
  51633. $core.method({
  51634. selector: "testLogicKeywords",
  51635. protocol: "tests",
  51636. fn: function (){
  51637. var self=this,$self=this;
  51638. return $core.withContext(function($ctx1) {
  51639. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51640. $1=true._and_((function(){
  51641. return true;
  51642. }));
  51643. $ctx1.sendIdx["and:"]=1;
  51644. $self._assert_($1);
  51645. $ctx1.sendIdx["assert:"]=1;
  51646. $2=true._and_((function(){
  51647. return false;
  51648. }));
  51649. $ctx1.sendIdx["and:"]=2;
  51650. $self._deny_($2);
  51651. $ctx1.sendIdx["deny:"]=1;
  51652. $3=false._and_((function(){
  51653. return true;
  51654. }));
  51655. $ctx1.sendIdx["and:"]=3;
  51656. $self._deny_($3);
  51657. $ctx1.sendIdx["deny:"]=2;
  51658. $5=false._and_((function(){
  51659. return false;
  51660. }));
  51661. $ctx1.sendIdx["and:"]=4;
  51662. $4=$self._deny_($5);
  51663. $ctx1.sendIdx["deny:"]=3;
  51664. $6=true._or_((function(){
  51665. return true;
  51666. }));
  51667. $ctx1.sendIdx["or:"]=1;
  51668. $self._assert_($6);
  51669. $ctx1.sendIdx["assert:"]=2;
  51670. $7=true._or_((function(){
  51671. return false;
  51672. }));
  51673. $ctx1.sendIdx["or:"]=2;
  51674. $self._assert_($7);
  51675. $ctx1.sendIdx["assert:"]=3;
  51676. $8=false._or_((function(){
  51677. return true;
  51678. }));
  51679. $ctx1.sendIdx["or:"]=3;
  51680. $self._assert_($8);
  51681. $ctx1.sendIdx["assert:"]=4;
  51682. $10=false._or_((function(){
  51683. return false;
  51684. }));
  51685. $ctx1.sendIdx["or:"]=4;
  51686. $9=$self._deny_($10);
  51687. $ctx1.sendIdx["deny:"]=4;
  51688. $11=true._and_((function(){
  51689. return $core.withContext(function($ctx2) {
  51690. return (1).__gt((0));
  51691. $ctx2.sendIdx[">"]=1;
  51692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51693. }));
  51694. $ctx1.sendIdx["and:"]=5;
  51695. $self._assert_($11);
  51696. $ctx1.sendIdx["assert:"]=5;
  51697. $13=(1).__gt((0));
  51698. $ctx1.sendIdx[">"]=2;
  51699. $12=$recv($13)._and_((function(){
  51700. return false;
  51701. }));
  51702. $ctx1.sendIdx["and:"]=6;
  51703. $self._deny_($12);
  51704. $ctx1.sendIdx["deny:"]=5;
  51705. $15=(1).__gt((0));
  51706. $ctx1.sendIdx[">"]=3;
  51707. $14=$recv($15)._and_((function(){
  51708. return $core.withContext(function($ctx2) {
  51709. return (1).__gt((2));
  51710. $ctx2.sendIdx[">"]=4;
  51711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51712. }));
  51713. $self._deny_($14);
  51714. $16=false._or_((function(){
  51715. return $core.withContext(function($ctx2) {
  51716. return (1).__gt((0));
  51717. $ctx2.sendIdx[">"]=5;
  51718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51719. }));
  51720. $ctx1.sendIdx["or:"]=5;
  51721. $self._assert_($16);
  51722. $ctx1.sendIdx["assert:"]=6;
  51723. $18=(1).__gt((0));
  51724. $ctx1.sendIdx[">"]=6;
  51725. $17=$recv($18)._or_((function(){
  51726. return false;
  51727. }));
  51728. $ctx1.sendIdx["or:"]=6;
  51729. $self._assert_($17);
  51730. $ctx1.sendIdx["assert:"]=7;
  51731. $20=(1).__gt((0));
  51732. $ctx1.sendIdx[">"]=7;
  51733. $19=$recv($20)._or_((function(){
  51734. return $core.withContext(function($ctx2) {
  51735. return (1).__gt((2));
  51736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51737. }));
  51738. $self._assert_($19);
  51739. return self;
  51740. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51741. },
  51742. args: [],
  51743. 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 ])",
  51744. referencedClasses: [],
  51745. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51746. }),
  51747. $globals.BooleanTest);
  51748. $core.addMethod(
  51749. $core.method({
  51750. selector: "testNonBooleanError",
  51751. protocol: "tests",
  51752. fn: function (){
  51753. var self=this,$self=this;
  51754. return $core.withContext(function($ctx1) {
  51755. $self._should_raise_((function(){
  51756. return $core.withContext(function($ctx2) {
  51757. if($core.assert("")){
  51758. } else {
  51759. }
  51760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51761. }),$globals.NonBooleanReceiver);
  51762. return self;
  51763. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51764. },
  51765. args: [],
  51766. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51767. referencedClasses: ["NonBooleanReceiver"],
  51768. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51769. }),
  51770. $globals.BooleanTest);
  51771. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51772. $core.addMethod(
  51773. $core.method({
  51774. selector: "setUp",
  51775. protocol: "running",
  51776. fn: function (){
  51777. var self=this,$self=this;
  51778. return $core.withContext(function($ctx1) {
  51779. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51780. return self;
  51781. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51782. },
  51783. args: [],
  51784. source: "setUp\x0a\x09builder := ClassBuilder new",
  51785. referencedClasses: ["ClassBuilder"],
  51786. messageSends: ["new"]
  51787. }),
  51788. $globals.ClassBuilderTest);
  51789. $core.addMethod(
  51790. $core.method({
  51791. selector: "tearDown",
  51792. protocol: "running",
  51793. fn: function (){
  51794. var self=this,$self=this;
  51795. return $core.withContext(function($ctx1) {
  51796. var $1,$receiver;
  51797. $1=$self["@theClass"];
  51798. if(($receiver = $1) == null || $receiver.a$nil){
  51799. $1;
  51800. } else {
  51801. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51802. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51803. $self["@theClass"]=nil;
  51804. $self["@theClass"];
  51805. }
  51806. return self;
  51807. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51808. },
  51809. args: [],
  51810. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51811. referencedClasses: ["Smalltalk"],
  51812. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51813. }),
  51814. $globals.ClassBuilderTest);
  51815. $core.addMethod(
  51816. $core.method({
  51817. selector: "testAddTrait",
  51818. protocol: "tests",
  51819. fn: function (){
  51820. var self=this,$self=this;
  51821. return $core.withContext(function($ctx1) {
  51822. var $3,$2,$1,$4;
  51823. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51824. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51825. $ctx1.sendIdx["assert:equals:"]=1;
  51826. $3=$recv($self["@theClass"])._package();
  51827. $ctx1.sendIdx["package"]=1;
  51828. $2=$recv($3)._classes();
  51829. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51830. $self._assert_equals_($1,(1));
  51831. $ctx1.sendIdx["assert:equals:"]=2;
  51832. $4=$recv($self["@theClass"])._package();
  51833. $ctx1.sendIdx["package"]=2;
  51834. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51835. return self;
  51836. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51837. },
  51838. args: [],
  51839. source: "testAddTrait\x0a\x09theClass := builder addTraitNamed: 'ObjectMock2' package: 'Kernel-Tests'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package",
  51840. referencedClasses: ["ObjectMock"],
  51841. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51842. }),
  51843. $globals.ClassBuilderTest);
  51844. $core.addMethod(
  51845. $core.method({
  51846. selector: "testClassCopy",
  51847. protocol: "tests",
  51848. fn: function (){
  51849. var self=this,$self=this;
  51850. return $core.withContext(function($ctx1) {
  51851. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51852. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51853. $2=$recv($self["@theClass"])._superclass();
  51854. $ctx1.sendIdx["superclass"]=1;
  51855. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51856. $ctx1.sendIdx["=="]=1;
  51857. $self._assert_($1);
  51858. $ctx1.sendIdx["assert:"]=1;
  51859. $4=$recv($self["@theClass"])._instanceVariableNames();
  51860. $ctx1.sendIdx["instanceVariableNames"]=1;
  51861. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51862. $ctx1.sendIdx["=="]=2;
  51863. $self._assert_($3);
  51864. $ctx1.sendIdx["assert:"]=2;
  51865. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51866. $ctx1.sendIdx["assert:equals:"]=1;
  51867. $6=$recv($self["@theClass"])._package();
  51868. $ctx1.sendIdx["package"]=1;
  51869. $7=$recv($globals.ObjectMock)._package();
  51870. $ctx1.sendIdx["package"]=2;
  51871. $5=$recv($6).__eq_eq($7);
  51872. $self._assert_($5);
  51873. $ctx1.sendIdx["assert:"]=3;
  51874. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51875. $9=$recv($self["@theClass"])._methodDictionary();
  51876. $ctx1.sendIdx["methodDictionary"]=1;
  51877. $8=$recv($9)._keys();
  51878. $ctx1.sendIdx["keys"]=1;
  51879. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51880. return self;
  51881. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51882. },
  51883. args: [],
  51884. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: (theClass package classes includes: theClass).\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  51885. referencedClasses: ["ObjectMock"],
  51886. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51887. }),
  51888. $globals.ClassBuilderTest);
  51889. $core.addMethod(
  51890. $core.method({
  51891. selector: "testClassMigration",
  51892. protocol: "tests",
  51893. fn: function (){
  51894. var self=this,$self=this;
  51895. var instance,oldClass;
  51896. return $core.withContext(function($ctx1) {
  51897. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51898. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51899. $2=$recv($globals.Smalltalk)._globals();
  51900. $ctx1.sendIdx["globals"]=1;
  51901. $1=$recv($2)._at_("ObjectMock2");
  51902. $ctx1.sendIdx["at:"]=1;
  51903. instance=$recv($1)._new();
  51904. $4=$recv($globals.Smalltalk)._globals();
  51905. $ctx1.sendIdx["globals"]=2;
  51906. $3=$recv($4)._at_("ObjectMock2");
  51907. $ctx1.sendIdx["at:"]=2;
  51908. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51909. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51910. $ctx1.sendIdx["=="]=1;
  51911. $self._deny_($5);
  51912. $ctx1.sendIdx["deny:"]=1;
  51913. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51914. $ctx1.sendIdx["=="]=2;
  51915. $self._assert_($6);
  51916. $ctx1.sendIdx["assert:"]=1;
  51917. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51918. $ctx1.sendIdx["assert:"]=2;
  51919. $7=$recv($globals.ObjectMock2)._selectors();
  51920. $ctx1.sendIdx["selectors"]=1;
  51921. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51922. $ctx1.sendIdx["assert:equals:"]=1;
  51923. $8=$recv($globals.ObjectMock2)._comment();
  51924. $ctx1.sendIdx["comment"]=1;
  51925. $self._assert_equals_($8,$recv(oldClass)._comment());
  51926. $ctx1.sendIdx["assert:equals:"]=2;
  51927. $10=$recv($globals.ObjectMock2)._package();
  51928. $ctx1.sendIdx["package"]=1;
  51929. $9=$recv($10)._name();
  51930. $ctx1.sendIdx["name"]=1;
  51931. $self._assert_equals_($9,"Kernel-Tests");
  51932. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51933. $ctx1.sendIdx["assert:"]=3;
  51934. $12=$recv(instance)._class();
  51935. $ctx1.sendIdx["class"]=1;
  51936. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51937. $self._deny_($11);
  51938. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51939. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51940. return self;
  51941. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51942. },
  51943. args: [],
  51944. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  51945. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51946. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "includes:", "classes", "class", "isNil", "removeClass:"]
  51947. }),
  51948. $globals.ClassBuilderTest);
  51949. $core.addMethod(
  51950. $core.method({
  51951. selector: "testClassMigrationWithClassInstanceVariables",
  51952. protocol: "tests",
  51953. fn: function (){
  51954. var self=this,$self=this;
  51955. return $core.withContext(function($ctx1) {
  51956. var $1;
  51957. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51958. $1=$recv($globals.ObjectMock2)._class();
  51959. $ctx1.sendIdx["class"]=1;
  51960. $recv($1)._instanceVariableNames_("foo bar");
  51961. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51962. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51963. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51964. return self;
  51965. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51966. },
  51967. args: [],
  51968. 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",
  51969. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51970. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51971. }),
  51972. $globals.ClassBuilderTest);
  51973. $core.addMethod(
  51974. $core.method({
  51975. selector: "testClassMigrationWithSubclasses",
  51976. protocol: "tests",
  51977. fn: function (){
  51978. var self=this,$self=this;
  51979. return $core.withContext(function($ctx1) {
  51980. var $2,$1,$4,$3;
  51981. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51982. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51983. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51984. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51985. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51986. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51987. $2=$recv($globals.ObjectMock)._subclasses();
  51988. $ctx1.sendIdx["subclasses"]=1;
  51989. $1=$recv($2)._includes_($globals.ObjectMock2);
  51990. $ctx1.sendIdx["includes:"]=1;
  51991. $self._assert_($1);
  51992. $ctx1.sendIdx["assert:"]=1;
  51993. $4=$recv($globals.ObjectMock2)._subclasses();
  51994. $ctx1.sendIdx["subclasses"]=2;
  51995. $3=$recv($4)._includes_($globals.ObjectMock3);
  51996. $ctx1.sendIdx["includes:"]=2;
  51997. $self._assert_($3);
  51998. $ctx1.sendIdx["assert:"]=2;
  51999. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52000. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52001. return $core.withContext(function($ctx2) {
  52002. return $recv($globals.Smalltalk)._removeClass_(each);
  52003. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52004. }));
  52005. return self;
  52006. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52007. },
  52008. args: [],
  52009. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ]",
  52010. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52011. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52012. }),
  52013. $globals.ClassBuilderTest);
  52014. $core.addMethod(
  52015. $core.method({
  52016. selector: "testInstanceVariableNames",
  52017. protocol: "tests",
  52018. fn: function (){
  52019. var self=this,$self=this;
  52020. return $core.withContext(function($ctx1) {
  52021. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52022. return self;
  52023. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52024. },
  52025. args: [],
  52026. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52027. referencedClasses: [],
  52028. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52029. }),
  52030. $globals.ClassBuilderTest);
  52031. $core.addMethod(
  52032. $core.method({
  52033. selector: "testSubclass",
  52034. protocol: "tests",
  52035. fn: function (){
  52036. var self=this,$self=this;
  52037. return $core.withContext(function($ctx1) {
  52038. var $3,$2,$1,$4;
  52039. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52040. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52041. $ctx1.sendIdx["assert:equals:"]=1;
  52042. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52043. $ctx1.sendIdx["assert:equals:"]=2;
  52044. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52045. $ctx1.sendIdx["assert:equals:"]=3;
  52046. $3=$recv($self["@theClass"])._package();
  52047. $ctx1.sendIdx["package"]=1;
  52048. $2=$recv($3)._classes();
  52049. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52050. $self._assert_equals_($1,(1));
  52051. $ctx1.sendIdx["assert:equals:"]=4;
  52052. $4=$recv($self["@theClass"])._package();
  52053. $ctx1.sendIdx["package"]=2;
  52054. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52055. $ctx1.sendIdx["assert:equals:"]=5;
  52056. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52057. return self;
  52058. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52059. },
  52060. args: [],
  52061. source: "testSubclass\x0a\x09theClass := builder addSubclassOf: ObjectMock named: 'ObjectMock2' instanceVariableNames: 'foo bar' package: 'Kernel-Tests'.\x0a\x09self assert: theClass superclass equals: ObjectMock.\x0a\x09self assert: theClass instanceVariableNames equals: 'foo bar'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys size equals: 0",
  52062. referencedClasses: ["ObjectMock"],
  52063. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52064. }),
  52065. $globals.ClassBuilderTest);
  52066. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52067. $core.addMethod(
  52068. $core.method({
  52069. selector: "jsConstructor",
  52070. protocol: "running",
  52071. fn: function (){
  52072. var self=this,$self=this;
  52073. return $core.withContext(function($ctx1) {
  52074. function Foo(){}
  52075. Foo.prototype.valueOf = function () {return 4;};
  52076. return Foo;
  52077. ;
  52078. return self;
  52079. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52080. },
  52081. args: [],
  52082. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52083. referencedClasses: [],
  52084. messageSends: []
  52085. }),
  52086. $globals.ClassTest);
  52087. $core.addMethod(
  52088. $core.method({
  52089. selector: "setUp",
  52090. protocol: "running",
  52091. fn: function (){
  52092. var self=this,$self=this;
  52093. return $core.withContext(function($ctx1) {
  52094. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52095. return self;
  52096. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52097. },
  52098. args: [],
  52099. source: "setUp\x0a\x09builder := ClassBuilder new",
  52100. referencedClasses: ["ClassBuilder"],
  52101. messageSends: ["new"]
  52102. }),
  52103. $globals.ClassTest);
  52104. $core.addMethod(
  52105. $core.method({
  52106. selector: "tearDown",
  52107. protocol: "running",
  52108. fn: function (){
  52109. var self=this,$self=this;
  52110. return $core.withContext(function($ctx1) {
  52111. var $1,$receiver;
  52112. $1=$self["@theClass"];
  52113. if(($receiver = $1) == null || $receiver.a$nil){
  52114. $1;
  52115. } else {
  52116. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52117. return $core.withContext(function($ctx2) {
  52118. return $recv($globals.Smalltalk)._removeClass_(each);
  52119. $ctx2.sendIdx["removeClass:"]=1;
  52120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52121. }));
  52122. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52123. $self["@theClass"]=nil;
  52124. $self["@theClass"];
  52125. }
  52126. return self;
  52127. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52128. },
  52129. args: [],
  52130. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52131. referencedClasses: ["Smalltalk"],
  52132. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52133. }),
  52134. $globals.ClassTest);
  52135. $core.addMethod(
  52136. $core.method({
  52137. selector: "testAllSubclasses",
  52138. protocol: "tests",
  52139. fn: function (){
  52140. var self=this,$self=this;
  52141. var subclasses,index;
  52142. return $core.withContext(function($ctx1) {
  52143. subclasses=$recv($globals.Object)._subclasses();
  52144. $ctx1.sendIdx["subclasses"]=1;
  52145. index=(1);
  52146. $recv((function(){
  52147. return $core.withContext(function($ctx2) {
  52148. return $recv(index).__gt($recv(subclasses)._size());
  52149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52150. }))._whileFalse_((function(){
  52151. return $core.withContext(function($ctx2) {
  52152. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52153. index=$recv(index).__plus((1));
  52154. return index;
  52155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52156. }));
  52157. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52158. return self;
  52159. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52160. },
  52161. args: [],
  52162. source: "testAllSubclasses\x0a\x09| subclasses index |\x0a\x0a\x09subclasses := Object subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09self assert: Object allSubclasses equals: subclasses",
  52163. referencedClasses: ["Object"],
  52164. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52165. }),
  52166. $globals.ClassTest);
  52167. $core.addMethod(
  52168. $core.method({
  52169. selector: "testMetaclassSubclasses",
  52170. protocol: "tests",
  52171. fn: function (){
  52172. var self=this,$self=this;
  52173. var subclasses;
  52174. return $core.withContext(function($ctx1) {
  52175. var $4,$3,$2,$1;
  52176. $4=$recv($globals.Object)._class();
  52177. $ctx1.sendIdx["class"]=1;
  52178. $3=$recv($4)._instanceClass();
  52179. $2=$recv($3)._subclasses();
  52180. $ctx1.sendIdx["subclasses"]=1;
  52181. $1=$recv($2)._select_((function(each){
  52182. return $core.withContext(function($ctx2) {
  52183. return $recv($recv(each)._isMetaclass())._not();
  52184. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52185. }));
  52186. subclasses=$recv($1)._collect_((function(each){
  52187. return $core.withContext(function($ctx2) {
  52188. return $recv(each)._theMetaClass();
  52189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52190. }));
  52191. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52192. return self;
  52193. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52194. },
  52195. args: [],
  52196. source: "testMetaclassSubclasses\x0a\x09| subclasses |\x0a\x0a\x09subclasses := (Object class instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ].\x0a\x0a\x09self assert: Object class subclasses equals: subclasses",
  52197. referencedClasses: ["Object"],
  52198. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52199. }),
  52200. $globals.ClassTest);
  52201. $core.addMethod(
  52202. $core.method({
  52203. selector: "testSetJavaScriptConstructor",
  52204. protocol: "tests",
  52205. fn: function (){
  52206. var self=this,$self=this;
  52207. var instance;
  52208. return $core.withContext(function($ctx1) {
  52209. var $2,$1,$4,$3,$6,$5,$8,$7;
  52210. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52211. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52212. $2=$recv($self["@theClass"])._superclass();
  52213. $ctx1.sendIdx["superclass"]=1;
  52214. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52215. $ctx1.sendIdx["=="]=1;
  52216. $self._assert_($1);
  52217. $ctx1.sendIdx["assert:"]=1;
  52218. $4=$recv($self["@theClass"])._instanceVariableNames();
  52219. $ctx1.sendIdx["instanceVariableNames"]=1;
  52220. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52221. $ctx1.sendIdx["=="]=2;
  52222. $self._assert_($3);
  52223. $ctx1.sendIdx["assert:"]=2;
  52224. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52225. $ctx1.sendIdx["assert:equals:"]=1;
  52226. $6=$recv($self["@theClass"])._package();
  52227. $ctx1.sendIdx["package"]=1;
  52228. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52229. $ctx1.sendIdx["=="]=3;
  52230. $self._assert_($5);
  52231. $ctx1.sendIdx["assert:"]=3;
  52232. $8=$recv($self["@theClass"])._methodDictionary();
  52233. $ctx1.sendIdx["methodDictionary"]=1;
  52234. $7=$recv($8)._keys();
  52235. $ctx1.sendIdx["keys"]=1;
  52236. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52237. $ctx1.sendIdx["assert:equals:"]=2;
  52238. instance=$recv($self["@theClass"])._new();
  52239. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52240. $self._assert_equals_($recv(instance)._value(),(4));
  52241. $ctx1.sendIdx["assert:equals:"]=3;
  52242. $self._shouldnt_raise_((function(){
  52243. return $core.withContext(function($ctx2) {
  52244. return $recv(instance)._foo_((9));
  52245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52246. }),$globals.Error);
  52247. $self._assert_equals_($recv(instance)._foo(),(9));
  52248. return self;
  52249. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52250. },
  52251. args: [],
  52252. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  52253. referencedClasses: ["ObjectMock", "Error"],
  52254. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52255. }),
  52256. $globals.ClassTest);
  52257. $core.addMethod(
  52258. $core.method({
  52259. selector: "testTrickySetJavaScriptConstructor",
  52260. protocol: "tests",
  52261. fn: function (){
  52262. var self=this,$self=this;
  52263. var instance;
  52264. return $core.withContext(function($ctx1) {
  52265. var $2,$1,$4,$3,$6,$5,$8,$7;
  52266. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52267. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52268. $2=$recv($self["@theClass"])._superclass();
  52269. $ctx1.sendIdx["superclass"]=1;
  52270. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52271. $ctx1.sendIdx["=="]=1;
  52272. $self._assert_($1);
  52273. $ctx1.sendIdx["assert:"]=1;
  52274. $4=$recv($self["@theClass"])._instanceVariableNames();
  52275. $ctx1.sendIdx["instanceVariableNames"]=1;
  52276. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52277. $ctx1.sendIdx["=="]=2;
  52278. $self._assert_($3);
  52279. $ctx1.sendIdx["assert:"]=2;
  52280. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52281. $ctx1.sendIdx["assert:equals:"]=1;
  52282. $6=$recv($self["@theClass"])._package();
  52283. $ctx1.sendIdx["package"]=1;
  52284. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52285. $ctx1.sendIdx["=="]=3;
  52286. $self._assert_($5);
  52287. $ctx1.sendIdx["assert:"]=3;
  52288. $8=$recv($self["@theClass"])._methodDictionary();
  52289. $ctx1.sendIdx["methodDictionary"]=1;
  52290. $7=$recv($8)._keys();
  52291. $ctx1.sendIdx["keys"]=1;
  52292. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52293. $ctx1.sendIdx["assert:equals:"]=2;
  52294. instance=$recv($self["@theClass"])._new();
  52295. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52296. $self._assert_equals_($recv(instance)._value(),(4));
  52297. $ctx1.sendIdx["assert:equals:"]=3;
  52298. $self._shouldnt_raise_((function(){
  52299. return $core.withContext(function($ctx2) {
  52300. return $recv(instance)._foo_((9));
  52301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52302. }),$globals.Error);
  52303. $self._assert_equals_($recv(instance)._foo(),(9));
  52304. return self;
  52305. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52306. },
  52307. args: [],
  52308. source: "testTrickySetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self trickyJsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  52309. referencedClasses: ["ObjectMock", "Error"],
  52310. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52311. }),
  52312. $globals.ClassTest);
  52313. $core.addMethod(
  52314. $core.method({
  52315. selector: "trickyJsConstructor",
  52316. protocol: "running",
  52317. fn: function (){
  52318. var self=this,$self=this;
  52319. return $core.withContext(function($ctx1) {
  52320. function Foo(){}
  52321. Foo.prototype.valueOf = function () {return 4;};
  52322. Foo.prototype._foo = function () {return "bar";};
  52323. return Foo;
  52324. ;
  52325. return self;
  52326. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52327. },
  52328. args: [],
  52329. source: "trickyJsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09Foo.prototype._foo = function () {return \x22bar\x22;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52330. referencedClasses: [],
  52331. messageSends: []
  52332. }),
  52333. $globals.ClassTest);
  52334. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52335. $core.addMethod(
  52336. $core.method({
  52337. selector: "assertSameContents:as:",
  52338. protocol: "convenience",
  52339. fn: function (aCollection,anotherCollection){
  52340. var self=this,$self=this;
  52341. return $core.withContext(function($ctx1) {
  52342. var $2,$1,$4,$3;
  52343. $2=$recv(aCollection)._size();
  52344. $ctx1.sendIdx["size"]=1;
  52345. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52346. $ctx1.sendIdx["="]=1;
  52347. $self._assert_($1);
  52348. $ctx1.sendIdx["assert:"]=1;
  52349. $recv(aCollection)._do_((function(each){
  52350. return $core.withContext(function($ctx2) {
  52351. $4=$recv(aCollection)._occurrencesOf_(each);
  52352. $ctx2.sendIdx["occurrencesOf:"]=1;
  52353. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52354. return $self._assert_($3);
  52355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52356. }));
  52357. return self;
  52358. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52359. },
  52360. args: ["aCollection", "anotherCollection"],
  52361. 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)) ]",
  52362. referencedClasses: [],
  52363. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52364. }),
  52365. $globals.CollectionTest);
  52366. $core.addMethod(
  52367. $core.method({
  52368. selector: "collection",
  52369. protocol: "fixture",
  52370. fn: function (){
  52371. var self=this,$self=this;
  52372. return $core.withContext(function($ctx1) {
  52373. $self._subclassResponsibility();
  52374. return self;
  52375. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52376. },
  52377. args: [],
  52378. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52379. referencedClasses: [],
  52380. messageSends: ["subclassResponsibility"]
  52381. }),
  52382. $globals.CollectionTest);
  52383. $core.addMethod(
  52384. $core.method({
  52385. selector: "collectionClass",
  52386. protocol: "fixture",
  52387. fn: function (){
  52388. var self=this,$self=this;
  52389. return $core.withContext(function($ctx1) {
  52390. return $recv($self._class())._collectionClass();
  52391. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52392. },
  52393. args: [],
  52394. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52395. referencedClasses: [],
  52396. messageSends: ["collectionClass", "class"]
  52397. }),
  52398. $globals.CollectionTest);
  52399. $core.addMethod(
  52400. $core.method({
  52401. selector: "collectionOfPrintStrings",
  52402. protocol: "fixture",
  52403. fn: function (){
  52404. var self=this,$self=this;
  52405. return $core.withContext(function($ctx1) {
  52406. $self._subclassResponsibility();
  52407. return self;
  52408. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52409. },
  52410. args: [],
  52411. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52412. referencedClasses: [],
  52413. messageSends: ["subclassResponsibility"]
  52414. }),
  52415. $globals.CollectionTest);
  52416. $core.addMethod(
  52417. $core.method({
  52418. selector: "collectionSize",
  52419. protocol: "fixture",
  52420. fn: function (){
  52421. var self=this,$self=this;
  52422. return $core.withContext(function($ctx1) {
  52423. $self._subclassResponsibility();
  52424. return self;
  52425. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52426. },
  52427. args: [],
  52428. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52429. referencedClasses: [],
  52430. messageSends: ["subclassResponsibility"]
  52431. }),
  52432. $globals.CollectionTest);
  52433. $core.addMethod(
  52434. $core.method({
  52435. selector: "collectionWithDuplicates",
  52436. protocol: "fixture",
  52437. fn: function (){
  52438. var self=this,$self=this;
  52439. return $core.withContext(function($ctx1) {
  52440. $self._subclassResponsibility();
  52441. return self;
  52442. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52443. },
  52444. args: [],
  52445. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly six distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  52446. referencedClasses: [],
  52447. messageSends: ["subclassResponsibility"]
  52448. }),
  52449. $globals.CollectionTest);
  52450. $core.addMethod(
  52451. $core.method({
  52452. selector: "collectionWithNewValue",
  52453. protocol: "fixture",
  52454. fn: function (){
  52455. var self=this,$self=this;
  52456. return $core.withContext(function($ctx1) {
  52457. $self._subclassResponsibility();
  52458. return self;
  52459. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52460. },
  52461. args: [],
  52462. 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",
  52463. referencedClasses: [],
  52464. messageSends: ["subclassResponsibility"]
  52465. }),
  52466. $globals.CollectionTest);
  52467. $core.addMethod(
  52468. $core.method({
  52469. selector: "initialize",
  52470. protocol: "initialization",
  52471. fn: function (){
  52472. var self=this,$self=this;
  52473. return $core.withContext(function($ctx1) {
  52474. (
  52475. $ctx1.supercall = true,
  52476. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52477. $ctx1.supercall = false;
  52478. $self["@sampleBlock"]=(function(){
  52479. });
  52480. return self;
  52481. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52482. },
  52483. args: [],
  52484. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52485. referencedClasses: [],
  52486. messageSends: ["initialize"]
  52487. }),
  52488. $globals.CollectionTest);
  52489. $core.addMethod(
  52490. $core.method({
  52491. selector: "sampleNewValue",
  52492. protocol: "fixture",
  52493. fn: function (){
  52494. var self=this,$self=this;
  52495. return "N";
  52496. },
  52497. args: [],
  52498. 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'",
  52499. referencedClasses: [],
  52500. messageSends: []
  52501. }),
  52502. $globals.CollectionTest);
  52503. $core.addMethod(
  52504. $core.method({
  52505. selector: "sampleNewValueAsCollection",
  52506. protocol: "fixture",
  52507. fn: function (){
  52508. var self=this,$self=this;
  52509. return $core.withContext(function($ctx1) {
  52510. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52511. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52512. },
  52513. args: [],
  52514. 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",
  52515. referencedClasses: [],
  52516. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52517. }),
  52518. $globals.CollectionTest);
  52519. $core.addMethod(
  52520. $core.method({
  52521. selector: "testAddAll",
  52522. protocol: "tests",
  52523. fn: function (){
  52524. var self=this,$self=this;
  52525. return $core.withContext(function($ctx1) {
  52526. 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;
  52527. $2=$self._collection();
  52528. $ctx1.sendIdx["collection"]=1;
  52529. $4=$self._collectionClass();
  52530. $ctx1.sendIdx["collectionClass"]=1;
  52531. $3=$recv($4)._new();
  52532. $ctx1.sendIdx["new"]=1;
  52533. $recv($2)._addAll_($3);
  52534. $ctx1.sendIdx["addAll:"]=1;
  52535. $5=$recv($2)._yourself();
  52536. $ctx1.sendIdx["yourself"]=1;
  52537. $1=$5;
  52538. $6=$self._collection();
  52539. $ctx1.sendIdx["collection"]=2;
  52540. $self._assert_equals_($1,$6);
  52541. $ctx1.sendIdx["assert:equals:"]=1;
  52542. $9=$self._collectionClass();
  52543. $ctx1.sendIdx["collectionClass"]=2;
  52544. $8=$recv($9)._new();
  52545. $ctx1.sendIdx["new"]=2;
  52546. $10=$self._collection();
  52547. $ctx1.sendIdx["collection"]=3;
  52548. $recv($8)._addAll_($10);
  52549. $ctx1.sendIdx["addAll:"]=2;
  52550. $11=$recv($8)._yourself();
  52551. $ctx1.sendIdx["yourself"]=2;
  52552. $7=$11;
  52553. $12=$self._collection();
  52554. $ctx1.sendIdx["collection"]=4;
  52555. $self._assert_equals_($7,$12);
  52556. $ctx1.sendIdx["assert:equals:"]=2;
  52557. $15=$self._collectionClass();
  52558. $ctx1.sendIdx["collectionClass"]=3;
  52559. $14=$recv($15)._new();
  52560. $ctx1.sendIdx["new"]=3;
  52561. $17=$self._collectionClass();
  52562. $ctx1.sendIdx["collectionClass"]=4;
  52563. $16=$recv($17)._new();
  52564. $ctx1.sendIdx["new"]=4;
  52565. $recv($14)._addAll_($16);
  52566. $ctx1.sendIdx["addAll:"]=3;
  52567. $18=$recv($14)._yourself();
  52568. $ctx1.sendIdx["yourself"]=3;
  52569. $13=$18;
  52570. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52571. $ctx1.sendIdx["assert:equals:"]=3;
  52572. $20=$self._collection();
  52573. $ctx1.sendIdx["collection"]=5;
  52574. $21=$self._sampleNewValueAsCollection();
  52575. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52576. $recv($20)._addAll_($21);
  52577. $ctx1.sendIdx["addAll:"]=4;
  52578. $22=$recv($20)._yourself();
  52579. $ctx1.sendIdx["yourself"]=4;
  52580. $19=$22;
  52581. $23=$self._collectionWithNewValue();
  52582. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52583. $self._assert_equals_($19,$23);
  52584. $25=$self._sampleNewValueAsCollection();
  52585. $recv($25)._addAll_($self._collection());
  52586. $24=$recv($25)._yourself();
  52587. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52588. return self;
  52589. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52590. },
  52591. args: [],
  52592. 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",
  52593. referencedClasses: [],
  52594. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52595. }),
  52596. $globals.CollectionTest);
  52597. $core.addMethod(
  52598. $core.method({
  52599. selector: "testAllSatisfy",
  52600. protocol: "tests",
  52601. fn: function (){
  52602. var self=this,$self=this;
  52603. var collection,anyOne;
  52604. return $core.withContext(function($ctx1) {
  52605. var $1;
  52606. collection=$self._collection();
  52607. anyOne=$recv(collection)._anyOne();
  52608. $1=$recv(collection)._allSatisfy_((function(each){
  52609. return $core.withContext(function($ctx2) {
  52610. return $recv(collection)._includes_(each);
  52611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52612. }));
  52613. $ctx1.sendIdx["allSatisfy:"]=1;
  52614. $self._assert_($1);
  52615. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52616. return $core.withContext(function($ctx2) {
  52617. return $recv(each).__tild_eq(anyOne);
  52618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52619. })));
  52620. return self;
  52621. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52622. },
  52623. args: [],
  52624. 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 ])",
  52625. referencedClasses: [],
  52626. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52627. }),
  52628. $globals.CollectionTest);
  52629. $core.addMethod(
  52630. $core.method({
  52631. selector: "testAnyOne",
  52632. protocol: "tests",
  52633. fn: function (){
  52634. var self=this,$self=this;
  52635. return $core.withContext(function($ctx1) {
  52636. var $2,$1;
  52637. $self._should_raise_((function(){
  52638. return $core.withContext(function($ctx2) {
  52639. return $recv($recv($self._collectionClass())._new())._anyOne();
  52640. $ctx2.sendIdx["anyOne"]=1;
  52641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52642. }),$globals.Error);
  52643. $2=$self._collection();
  52644. $ctx1.sendIdx["collection"]=1;
  52645. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52646. $self._assert_($1);
  52647. return self;
  52648. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52649. },
  52650. args: [],
  52651. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52652. referencedClasses: ["Error"],
  52653. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52654. }),
  52655. $globals.CollectionTest);
  52656. $core.addMethod(
  52657. $core.method({
  52658. selector: "testAnySatisfy",
  52659. protocol: "tests",
  52660. fn: function (){
  52661. var self=this,$self=this;
  52662. var anyOne;
  52663. return $core.withContext(function($ctx1) {
  52664. var $1,$3,$2;
  52665. $1=$self._collection();
  52666. $ctx1.sendIdx["collection"]=1;
  52667. anyOne=$recv($1)._anyOne();
  52668. $3=$self._collection();
  52669. $ctx1.sendIdx["collection"]=2;
  52670. $2=$recv($3)._anySatisfy_((function(each){
  52671. return $core.withContext(function($ctx2) {
  52672. return $recv(each).__eq(anyOne);
  52673. $ctx2.sendIdx["="]=1;
  52674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52675. }));
  52676. $ctx1.sendIdx["anySatisfy:"]=1;
  52677. $self._assert_($2);
  52678. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52679. return $core.withContext(function($ctx2) {
  52680. return $recv(each).__eq($recv($globals.Object)._new());
  52681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52682. })));
  52683. return self;
  52684. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52685. },
  52686. args: [],
  52687. 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 ])",
  52688. referencedClasses: ["Object"],
  52689. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52690. }),
  52691. $globals.CollectionTest);
  52692. $core.addMethod(
  52693. $core.method({
  52694. selector: "testAsArray",
  52695. protocol: "tests",
  52696. fn: function (){
  52697. var self=this,$self=this;
  52698. return $core.withContext(function($ctx1) {
  52699. var $1;
  52700. $1=$self._collection();
  52701. $ctx1.sendIdx["collection"]=1;
  52702. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52703. return self;
  52704. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52705. },
  52706. args: [],
  52707. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52708. referencedClasses: [],
  52709. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52710. }),
  52711. $globals.CollectionTest);
  52712. $core.addMethod(
  52713. $core.method({
  52714. selector: "testAsOrderedCollection",
  52715. protocol: "tests",
  52716. fn: function (){
  52717. var self=this,$self=this;
  52718. return $core.withContext(function($ctx1) {
  52719. var $1;
  52720. $1=$self._collection();
  52721. $ctx1.sendIdx["collection"]=1;
  52722. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52723. return self;
  52724. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52725. },
  52726. args: [],
  52727. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52728. referencedClasses: [],
  52729. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52730. }),
  52731. $globals.CollectionTest);
  52732. $core.addMethod(
  52733. $core.method({
  52734. selector: "testAsSet",
  52735. protocol: "tests",
  52736. fn: function (){
  52737. var self=this,$self=this;
  52738. var c,set;
  52739. return $core.withContext(function($ctx1) {
  52740. c=$self._collectionWithDuplicates();
  52741. set=$recv(c)._asSet();
  52742. $self._assert_equals_($recv(set)._size(),(6));
  52743. $recv(c)._do_((function(each){
  52744. return $core.withContext(function($ctx2) {
  52745. return $self._assert_($recv(set)._includes_(each));
  52746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52747. }));
  52748. return self;
  52749. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52750. },
  52751. args: [],
  52752. 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) ]",
  52753. referencedClasses: [],
  52754. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52755. }),
  52756. $globals.CollectionTest);
  52757. $core.addMethod(
  52758. $core.method({
  52759. selector: "testCollect",
  52760. protocol: "tests",
  52761. fn: function (){
  52762. var self=this,$self=this;
  52763. return $core.withContext(function($ctx1) {
  52764. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52765. $2=$self._collection();
  52766. $ctx1.sendIdx["collection"]=1;
  52767. $1=$recv($2)._collect_((function(each){
  52768. return each;
  52769. }));
  52770. $ctx1.sendIdx["collect:"]=1;
  52771. $3=$self._collection();
  52772. $ctx1.sendIdx["collection"]=2;
  52773. $self._assert_equals_($1,$3);
  52774. $ctx1.sendIdx["assert:equals:"]=1;
  52775. $5=$self._collectionWithNewValue();
  52776. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52777. $4=$recv($5)._collect_((function(each){
  52778. return each;
  52779. }));
  52780. $ctx1.sendIdx["collect:"]=2;
  52781. $self._assert_equals_($4,$self._collectionWithNewValue());
  52782. $ctx1.sendIdx["assert:equals:"]=2;
  52783. $8=$self._collectionClass();
  52784. $ctx1.sendIdx["collectionClass"]=1;
  52785. $7=$recv($8)._new();
  52786. $ctx1.sendIdx["new"]=1;
  52787. $6=$recv($7)._collect_((function(each){
  52788. return $core.withContext(function($ctx2) {
  52789. return $recv(each)._printString();
  52790. $ctx2.sendIdx["printString"]=1;
  52791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52792. }));
  52793. $ctx1.sendIdx["collect:"]=3;
  52794. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52795. $ctx1.sendIdx["assert:equals:"]=3;
  52796. $11=$self._collection();
  52797. $ctx1.sendIdx["collection"]=3;
  52798. $10=$recv($11)._collect_((function(){
  52799. return $core.withContext(function($ctx2) {
  52800. return $self._sampleNewValue();
  52801. $ctx2.sendIdx["sampleNewValue"]=1;
  52802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52803. }));
  52804. $ctx1.sendIdx["collect:"]=4;
  52805. $9=$recv($10)._detect_((function(){
  52806. return true;
  52807. }));
  52808. $self._assert_equals_($9,$self._sampleNewValue());
  52809. $ctx1.sendIdx["assert:equals:"]=4;
  52810. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52811. return $core.withContext(function($ctx2) {
  52812. return $recv(each)._printString();
  52813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52814. })),$self._collectionOfPrintStrings());
  52815. return self;
  52816. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52817. },
  52818. args: [],
  52819. 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",
  52820. referencedClasses: [],
  52821. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52822. }),
  52823. $globals.CollectionTest);
  52824. $core.addMethod(
  52825. $core.method({
  52826. selector: "testComma",
  52827. protocol: "tests",
  52828. fn: function (){
  52829. var self=this,$self=this;
  52830. return $core.withContext(function($ctx1) {
  52831. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52832. $2=$self._collection();
  52833. $ctx1.sendIdx["collection"]=1;
  52834. $4=$self._collectionClass();
  52835. $ctx1.sendIdx["collectionClass"]=1;
  52836. $3=$recv($4)._new();
  52837. $ctx1.sendIdx["new"]=1;
  52838. $1=$recv($2).__comma($3);
  52839. $ctx1.sendIdx[","]=1;
  52840. $5=$self._collection();
  52841. $ctx1.sendIdx["collection"]=2;
  52842. $self._assert_equals_($1,$5);
  52843. $ctx1.sendIdx["assert:equals:"]=1;
  52844. $8=$self._collectionClass();
  52845. $ctx1.sendIdx["collectionClass"]=2;
  52846. $7=$recv($8)._new();
  52847. $ctx1.sendIdx["new"]=2;
  52848. $9=$self._collection();
  52849. $ctx1.sendIdx["collection"]=3;
  52850. $6=$recv($7).__comma($9);
  52851. $ctx1.sendIdx[","]=2;
  52852. $10=$self._collection();
  52853. $ctx1.sendIdx["collection"]=4;
  52854. $self._assert_equals_($6,$10);
  52855. $ctx1.sendIdx["assert:equals:"]=2;
  52856. $13=$self._collectionClass();
  52857. $ctx1.sendIdx["collectionClass"]=3;
  52858. $12=$recv($13)._new();
  52859. $ctx1.sendIdx["new"]=3;
  52860. $15=$self._collectionClass();
  52861. $ctx1.sendIdx["collectionClass"]=4;
  52862. $14=$recv($15)._new();
  52863. $ctx1.sendIdx["new"]=4;
  52864. $11=$recv($12).__comma($14);
  52865. $ctx1.sendIdx[","]=3;
  52866. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52867. $ctx1.sendIdx["assert:equals:"]=3;
  52868. $17=$self._collection();
  52869. $ctx1.sendIdx["collection"]=5;
  52870. $18=$self._sampleNewValueAsCollection();
  52871. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52872. $16=$recv($17).__comma($18);
  52873. $ctx1.sendIdx[","]=4;
  52874. $19=$self._collectionWithNewValue();
  52875. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52876. $self._assert_equals_($16,$19);
  52877. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52878. return self;
  52879. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52880. },
  52881. args: [],
  52882. 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",
  52883. referencedClasses: [],
  52884. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52885. }),
  52886. $globals.CollectionTest);
  52887. $core.addMethod(
  52888. $core.method({
  52889. selector: "testCopy",
  52890. protocol: "tests",
  52891. fn: function (){
  52892. var self=this,$self=this;
  52893. return $core.withContext(function($ctx1) {
  52894. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52895. $3=$self._collectionClass();
  52896. $ctx1.sendIdx["collectionClass"]=1;
  52897. $2=$recv($3)._new();
  52898. $ctx1.sendIdx["new"]=1;
  52899. $1=$recv($2)._copy();
  52900. $ctx1.sendIdx["copy"]=1;
  52901. $5=$self._collectionClass();
  52902. $ctx1.sendIdx["collectionClass"]=2;
  52903. $4=$recv($5)._new();
  52904. $ctx1.sendIdx["new"]=2;
  52905. $self._assert_equals_($1,$4);
  52906. $ctx1.sendIdx["assert:equals:"]=1;
  52907. $7=$self._collection();
  52908. $ctx1.sendIdx["collection"]=1;
  52909. $6=$recv($7)._copy();
  52910. $ctx1.sendIdx["copy"]=2;
  52911. $8=$self._collection();
  52912. $ctx1.sendIdx["collection"]=2;
  52913. $self._assert_equals_($6,$8);
  52914. $ctx1.sendIdx["assert:equals:"]=2;
  52915. $10=$self._collectionWithNewValue();
  52916. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52917. $9=$recv($10)._copy();
  52918. $ctx1.sendIdx["copy"]=3;
  52919. $11=$self._collectionWithNewValue();
  52920. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52921. $self._assert_equals_($9,$11);
  52922. $15=$self._collectionClass();
  52923. $ctx1.sendIdx["collectionClass"]=3;
  52924. $14=$recv($15)._new();
  52925. $ctx1.sendIdx["new"]=3;
  52926. $13=$recv($14)._copy();
  52927. $ctx1.sendIdx["copy"]=4;
  52928. $16=$self._collection();
  52929. $ctx1.sendIdx["collection"]=3;
  52930. $12=$recv($13).__eq($16);
  52931. $ctx1.sendIdx["="]=1;
  52932. $self._deny_($12);
  52933. $ctx1.sendIdx["deny:"]=1;
  52934. $19=$self._collection();
  52935. $ctx1.sendIdx["collection"]=4;
  52936. $18=$recv($19)._copy();
  52937. $ctx1.sendIdx["copy"]=5;
  52938. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52939. $ctx1.sendIdx["="]=2;
  52940. $self._deny_($17);
  52941. $ctx1.sendIdx["deny:"]=2;
  52942. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52943. return self;
  52944. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52945. },
  52946. args: [],
  52947. 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",
  52948. referencedClasses: [],
  52949. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52950. }),
  52951. $globals.CollectionTest);
  52952. $core.addMethod(
  52953. $core.method({
  52954. selector: "testCopySeparates",
  52955. protocol: "tests",
  52956. fn: function (){
  52957. var self=this,$self=this;
  52958. var original,copy;
  52959. return $core.withContext(function($ctx1) {
  52960. original=$self._collection();
  52961. $ctx1.sendIdx["collection"]=1;
  52962. copy=$recv(original)._copy();
  52963. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52964. $self._assert_($recv(original).__eq($self._collection()));
  52965. return self;
  52966. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52967. },
  52968. args: [],
  52969. 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",
  52970. referencedClasses: [],
  52971. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52972. }),
  52973. $globals.CollectionTest);
  52974. $core.addMethod(
  52975. $core.method({
  52976. selector: "testDetect",
  52977. protocol: "tests",
  52978. fn: function (){
  52979. var self=this,$self=this;
  52980. return $core.withContext(function($ctx1) {
  52981. var $1,$2,$3,$4,$6,$5,$7;
  52982. $self._shouldnt_raise_((function(){
  52983. return $core.withContext(function($ctx2) {
  52984. $1=$self._collection();
  52985. $ctx2.sendIdx["collection"]=1;
  52986. return $recv($1)._detect_((function(){
  52987. return true;
  52988. }));
  52989. $ctx2.sendIdx["detect:"]=1;
  52990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52991. }),$globals.Error);
  52992. $self._should_raise_((function(){
  52993. return $core.withContext(function($ctx2) {
  52994. $2=$self._collection();
  52995. $ctx2.sendIdx["collection"]=2;
  52996. return $recv($2)._detect_((function(){
  52997. return false;
  52998. }));
  52999. $ctx2.sendIdx["detect:"]=2;
  53000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53001. }),$globals.Error);
  53002. $ctx1.sendIdx["should:raise:"]=1;
  53003. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53004. return true;
  53005. }));
  53006. $ctx1.sendIdx["detect:"]=3;
  53007. $4=$self._sampleNewValue();
  53008. $ctx1.sendIdx["sampleNewValue"]=1;
  53009. $self._assert_equals_($3,$4);
  53010. $ctx1.sendIdx["assert:equals:"]=1;
  53011. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53012. return $core.withContext(function($ctx2) {
  53013. $6=$self._sampleNewValue();
  53014. $ctx2.sendIdx["sampleNewValue"]=2;
  53015. return $recv(each).__eq($6);
  53016. $ctx2.sendIdx["="]=1;
  53017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53018. }));
  53019. $ctx1.sendIdx["detect:"]=4;
  53020. $7=$self._sampleNewValue();
  53021. $ctx1.sendIdx["sampleNewValue"]=3;
  53022. $self._assert_equals_($5,$7);
  53023. $self._should_raise_((function(){
  53024. return $core.withContext(function($ctx2) {
  53025. return $recv($self._collection())._detect_((function(each){
  53026. return $core.withContext(function($ctx3) {
  53027. return $recv(each).__eq($self._sampleNewValue());
  53028. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53029. }));
  53030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53031. }),$globals.Error);
  53032. return self;
  53033. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53034. },
  53035. args: [],
  53036. 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",
  53037. referencedClasses: ["Error"],
  53038. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53039. }),
  53040. $globals.CollectionTest);
  53041. $core.addMethod(
  53042. $core.method({
  53043. selector: "testDetectIfNone",
  53044. protocol: "tests",
  53045. fn: function (){
  53046. var self=this,$self=this;
  53047. var sentinel;
  53048. return $core.withContext(function($ctx1) {
  53049. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53050. sentinel=$recv($globals.Object)._new();
  53051. $3=$self._collection();
  53052. $ctx1.sendIdx["collection"]=1;
  53053. $2=$recv($3)._detect_ifNone_((function(){
  53054. return true;
  53055. }),(function(){
  53056. return sentinel;
  53057. }));
  53058. $ctx1.sendIdx["detect:ifNone:"]=1;
  53059. $1=$recv($2).__tild_eq(sentinel);
  53060. $self._assert_($1);
  53061. $5=$self._collection();
  53062. $ctx1.sendIdx["collection"]=2;
  53063. $4=$recv($5)._detect_ifNone_((function(){
  53064. return false;
  53065. }),(function(){
  53066. return sentinel;
  53067. }));
  53068. $ctx1.sendIdx["detect:ifNone:"]=2;
  53069. $self._assert_equals_($4,sentinel);
  53070. $ctx1.sendIdx["assert:equals:"]=1;
  53071. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53072. return true;
  53073. }),(function(){
  53074. return sentinel;
  53075. }));
  53076. $ctx1.sendIdx["detect:ifNone:"]=3;
  53077. $7=$self._sampleNewValue();
  53078. $ctx1.sendIdx["sampleNewValue"]=1;
  53079. $self._assert_equals_($6,$7);
  53080. $ctx1.sendIdx["assert:equals:"]=2;
  53081. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53082. return $core.withContext(function($ctx2) {
  53083. $9=$self._sampleNewValue();
  53084. $ctx2.sendIdx["sampleNewValue"]=2;
  53085. return $recv(each).__eq($9);
  53086. $ctx2.sendIdx["="]=1;
  53087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53088. }),(function(){
  53089. return sentinel;
  53090. }));
  53091. $ctx1.sendIdx["detect:ifNone:"]=4;
  53092. $10=$self._sampleNewValue();
  53093. $ctx1.sendIdx["sampleNewValue"]=3;
  53094. $self._assert_equals_($8,$10);
  53095. $ctx1.sendIdx["assert:equals:"]=3;
  53096. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53097. return $core.withContext(function($ctx2) {
  53098. return $recv(each).__eq($self._sampleNewValue());
  53099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53100. }),(function(){
  53101. return sentinel;
  53102. })),sentinel);
  53103. return self;
  53104. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53105. },
  53106. args: [],
  53107. 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",
  53108. referencedClasses: ["Object"],
  53109. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53110. }),
  53111. $globals.CollectionTest);
  53112. $core.addMethod(
  53113. $core.method({
  53114. selector: "testDo",
  53115. protocol: "tests",
  53116. fn: function (){
  53117. var self=this,$self=this;
  53118. var newCollection;
  53119. return $core.withContext(function($ctx1) {
  53120. var $1,$2;
  53121. newCollection=$recv($globals.OrderedCollection)._new();
  53122. $ctx1.sendIdx["new"]=1;
  53123. $1=$self._collection();
  53124. $ctx1.sendIdx["collection"]=1;
  53125. $recv($1)._do_((function(each){
  53126. return $core.withContext(function($ctx2) {
  53127. return $recv(newCollection)._add_(each);
  53128. $ctx2.sendIdx["add:"]=1;
  53129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53130. }));
  53131. $ctx1.sendIdx["do:"]=1;
  53132. $self._assertSameContents_as_($self._collection(),newCollection);
  53133. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53134. newCollection=$recv($globals.OrderedCollection)._new();
  53135. $2=$self._collectionWithDuplicates();
  53136. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53137. $recv($2)._do_((function(each){
  53138. return $core.withContext(function($ctx2) {
  53139. return $recv(newCollection)._add_(each);
  53140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53141. }));
  53142. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53143. return self;
  53144. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53145. },
  53146. args: [],
  53147. 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",
  53148. referencedClasses: ["OrderedCollection"],
  53149. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53150. }),
  53151. $globals.CollectionTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "testEquality",
  53155. protocol: "tests",
  53156. fn: function (){
  53157. var self=this,$self=this;
  53158. return $core.withContext(function($ctx1) {
  53159. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53160. $2=$self._collectionClass();
  53161. $ctx1.sendIdx["collectionClass"]=1;
  53162. $1=$recv($2)._new();
  53163. $ctx1.sendIdx["new"]=1;
  53164. $4=$self._collectionClass();
  53165. $ctx1.sendIdx["collectionClass"]=2;
  53166. $3=$recv($4)._new();
  53167. $ctx1.sendIdx["new"]=2;
  53168. $self._assert_equals_($1,$3);
  53169. $ctx1.sendIdx["assert:equals:"]=1;
  53170. $5=$self._collection();
  53171. $ctx1.sendIdx["collection"]=1;
  53172. $6=$self._collection();
  53173. $ctx1.sendIdx["collection"]=2;
  53174. $self._assert_equals_($5,$6);
  53175. $ctx1.sendIdx["assert:equals:"]=2;
  53176. $7=$self._collectionWithNewValue();
  53177. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53178. $8=$self._collectionWithNewValue();
  53179. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53180. $self._assert_equals_($7,$8);
  53181. $11=$self._collectionClass();
  53182. $ctx1.sendIdx["collectionClass"]=3;
  53183. $10=$recv($11)._new();
  53184. $ctx1.sendIdx["new"]=3;
  53185. $12=$self._collection();
  53186. $ctx1.sendIdx["collection"]=3;
  53187. $9=$recv($10).__eq($12);
  53188. $ctx1.sendIdx["="]=1;
  53189. $self._deny_($9);
  53190. $ctx1.sendIdx["deny:"]=1;
  53191. $14=$self._collection();
  53192. $ctx1.sendIdx["collection"]=4;
  53193. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53194. $ctx1.sendIdx["="]=2;
  53195. $self._deny_($13);
  53196. $ctx1.sendIdx["deny:"]=2;
  53197. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53198. return self;
  53199. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53200. },
  53201. args: [],
  53202. 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",
  53203. referencedClasses: [],
  53204. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53205. }),
  53206. $globals.CollectionTest);
  53207. $core.addMethod(
  53208. $core.method({
  53209. selector: "testIfEmptyFamily",
  53210. protocol: "tests",
  53211. fn: function (){
  53212. var self=this,$self=this;
  53213. return $core.withContext(function($ctx1) {
  53214. 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;
  53215. $3=$self._collectionClass();
  53216. $ctx1.sendIdx["collectionClass"]=1;
  53217. $2=$recv($3)._new();
  53218. $ctx1.sendIdx["new"]=1;
  53219. $1=$recv($2)._ifEmpty_((function(){
  53220. return (42);
  53221. }));
  53222. $ctx1.sendIdx["ifEmpty:"]=1;
  53223. $self._assert_equals_($1,(42));
  53224. $ctx1.sendIdx["assert:equals:"]=1;
  53225. $5=$self._collection();
  53226. $ctx1.sendIdx["collection"]=1;
  53227. $4=$recv($5)._ifEmpty_((function(){
  53228. return (42);
  53229. }));
  53230. $6=$self._collection();
  53231. $ctx1.sendIdx["collection"]=2;
  53232. $self._assert_equals_($4,$6);
  53233. $ctx1.sendIdx["assert:equals:"]=2;
  53234. $9=$self._collectionClass();
  53235. $ctx1.sendIdx["collectionClass"]=2;
  53236. $8=$recv($9)._new();
  53237. $ctx1.sendIdx["new"]=2;
  53238. $7=$recv($8)._ifNotEmpty_((function(){
  53239. return (42);
  53240. }));
  53241. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53242. $11=$self._collectionClass();
  53243. $ctx1.sendIdx["collectionClass"]=3;
  53244. $10=$recv($11)._new();
  53245. $ctx1.sendIdx["new"]=3;
  53246. $self._assert_equals_($7,$10);
  53247. $ctx1.sendIdx["assert:equals:"]=3;
  53248. $13=$self._collection();
  53249. $ctx1.sendIdx["collection"]=3;
  53250. $12=$recv($13)._ifNotEmpty_((function(){
  53251. return (42);
  53252. }));
  53253. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53254. $self._assert_equals_($12,(42));
  53255. $ctx1.sendIdx["assert:equals:"]=4;
  53256. $15=$self._collection();
  53257. $ctx1.sendIdx["collection"]=4;
  53258. $14=$recv($15)._ifNotEmpty_((function(col){
  53259. return col;
  53260. }));
  53261. $16=$self._collection();
  53262. $ctx1.sendIdx["collection"]=5;
  53263. $self._assert_equals_($14,$16);
  53264. $ctx1.sendIdx["assert:equals:"]=5;
  53265. $19=$self._collectionClass();
  53266. $ctx1.sendIdx["collectionClass"]=4;
  53267. $18=$recv($19)._new();
  53268. $ctx1.sendIdx["new"]=4;
  53269. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53270. return (42);
  53271. }),(function(){
  53272. return (999);
  53273. }));
  53274. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53275. $self._assert_equals_($17,(42));
  53276. $ctx1.sendIdx["assert:equals:"]=6;
  53277. $21=$self._collection();
  53278. $ctx1.sendIdx["collection"]=6;
  53279. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53280. return (42);
  53281. }),(function(){
  53282. return (999);
  53283. }));
  53284. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53285. $self._assert_equals_($20,(999));
  53286. $ctx1.sendIdx["assert:equals:"]=7;
  53287. $23=$self._collection();
  53288. $ctx1.sendIdx["collection"]=7;
  53289. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53290. return (42);
  53291. }),(function(col){
  53292. return col;
  53293. }));
  53294. $24=$self._collection();
  53295. $ctx1.sendIdx["collection"]=8;
  53296. $self._assert_equals_($22,$24);
  53297. $ctx1.sendIdx["assert:equals:"]=8;
  53298. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53299. return (42);
  53300. }),(function(){
  53301. return (999);
  53302. }));
  53303. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53304. $self._assert_equals_($25,(999));
  53305. $ctx1.sendIdx["assert:equals:"]=9;
  53306. $27=$self._collection();
  53307. $ctx1.sendIdx["collection"]=9;
  53308. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53309. return (42);
  53310. }),(function(){
  53311. return (999);
  53312. }));
  53313. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53314. $self._assert_equals_($26,(42));
  53315. $ctx1.sendIdx["assert:equals:"]=10;
  53316. $29=$self._collection();
  53317. $ctx1.sendIdx["collection"]=10;
  53318. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53319. return col;
  53320. }),(function(){
  53321. return (999);
  53322. }));
  53323. $self._assert_equals_($28,$self._collection());
  53324. return self;
  53325. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53326. },
  53327. args: [],
  53328. 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.",
  53329. referencedClasses: [],
  53330. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53331. }),
  53332. $globals.CollectionTest);
  53333. $core.addMethod(
  53334. $core.method({
  53335. selector: "testIsEmpty",
  53336. protocol: "tests",
  53337. fn: function (){
  53338. var self=this,$self=this;
  53339. return $core.withContext(function($ctx1) {
  53340. var $1;
  53341. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53342. $ctx1.sendIdx["isEmpty"]=1;
  53343. $self._assert_($1);
  53344. $self._deny_($recv($self._collection())._isEmpty());
  53345. return self;
  53346. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53347. },
  53348. args: [],
  53349. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53350. referencedClasses: [],
  53351. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53352. }),
  53353. $globals.CollectionTest);
  53354. $core.addMethod(
  53355. $core.method({
  53356. selector: "testNoneSatisfy",
  53357. protocol: "tests",
  53358. fn: function (){
  53359. var self=this,$self=this;
  53360. var anyOne;
  53361. return $core.withContext(function($ctx1) {
  53362. var $1,$3,$2;
  53363. $1=$self._collection();
  53364. $ctx1.sendIdx["collection"]=1;
  53365. anyOne=$recv($1)._anyOne();
  53366. $3=$self._collection();
  53367. $ctx1.sendIdx["collection"]=2;
  53368. $2=$recv($3)._noneSatisfy_((function(each){
  53369. return $core.withContext(function($ctx2) {
  53370. return $recv(each).__eq(anyOne);
  53371. $ctx2.sendIdx["="]=1;
  53372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53373. }));
  53374. $ctx1.sendIdx["noneSatisfy:"]=1;
  53375. $self._deny_($2);
  53376. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53377. return $core.withContext(function($ctx2) {
  53378. return $recv(each).__eq($recv($globals.Object)._new());
  53379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53380. })));
  53381. return self;
  53382. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53383. },
  53384. args: [],
  53385. 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 ])",
  53386. referencedClasses: ["Object"],
  53387. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53388. }),
  53389. $globals.CollectionTest);
  53390. $core.addMethod(
  53391. $core.method({
  53392. selector: "testRegression1224",
  53393. protocol: "tests",
  53394. fn: function (){
  53395. var self=this,$self=this;
  53396. return $core.withContext(function($ctx1) {
  53397. var $3,$2,$1;
  53398. $3=$recv($self._collectionClass())._new();
  53399. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53400. }));
  53401. $2=$recv($3)._yourself();
  53402. $1=$recv($2)._size();
  53403. $self._assert_equals_($1,(0));
  53404. return self;
  53405. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53406. },
  53407. args: [],
  53408. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53409. referencedClasses: [],
  53410. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53411. }),
  53412. $globals.CollectionTest);
  53413. $core.addMethod(
  53414. $core.method({
  53415. selector: "testRemoveAll",
  53416. protocol: "tests",
  53417. fn: function (){
  53418. var self=this,$self=this;
  53419. return $core.withContext(function($ctx1) {
  53420. var $2,$1;
  53421. $2=$self._collection();
  53422. $recv($2)._removeAll();
  53423. $1=$recv($2)._yourself();
  53424. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53425. return self;
  53426. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53427. },
  53428. args: [],
  53429. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53430. referencedClasses: [],
  53431. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53432. }),
  53433. $globals.CollectionTest);
  53434. $core.addMethod(
  53435. $core.method({
  53436. selector: "testSelect",
  53437. protocol: "tests",
  53438. fn: function (){
  53439. var self=this,$self=this;
  53440. return $core.withContext(function($ctx1) {
  53441. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53442. $2=$self._collection();
  53443. $ctx1.sendIdx["collection"]=1;
  53444. $1=$recv($2)._select_((function(){
  53445. return false;
  53446. }));
  53447. $ctx1.sendIdx["select:"]=1;
  53448. $4=$self._collectionClass();
  53449. $ctx1.sendIdx["collectionClass"]=1;
  53450. $3=$recv($4)._new();
  53451. $ctx1.sendIdx["new"]=1;
  53452. $self._assert_equals_($1,$3);
  53453. $ctx1.sendIdx["assert:equals:"]=1;
  53454. $6=$self._collection();
  53455. $ctx1.sendIdx["collection"]=2;
  53456. $5=$recv($6)._select_((function(){
  53457. return true;
  53458. }));
  53459. $ctx1.sendIdx["select:"]=2;
  53460. $7=$self._collection();
  53461. $ctx1.sendIdx["collection"]=3;
  53462. $self._assert_equals_($5,$7);
  53463. $ctx1.sendIdx["assert:equals:"]=2;
  53464. $9=$self._collectionWithNewValue();
  53465. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53466. $8=$recv($9)._select_((function(each){
  53467. return $core.withContext(function($ctx2) {
  53468. $10=$self._sampleNewValue();
  53469. $ctx2.sendIdx["sampleNewValue"]=1;
  53470. return $recv(each).__eq($10);
  53471. $ctx2.sendIdx["="]=1;
  53472. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53473. }));
  53474. $ctx1.sendIdx["select:"]=3;
  53475. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53476. $ctx1.sendIdx["assert:equals:"]=3;
  53477. $12=$self._collectionWithNewValue();
  53478. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53479. $11=$recv($12)._select_((function(each){
  53480. return $core.withContext(function($ctx2) {
  53481. $13=$self._sampleNewValue();
  53482. $ctx2.sendIdx["sampleNewValue"]=2;
  53483. return $recv(each).__tild_eq($13);
  53484. $ctx2.sendIdx["~="]=1;
  53485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53486. }));
  53487. $ctx1.sendIdx["select:"]=4;
  53488. $14=$self._collection();
  53489. $ctx1.sendIdx["collection"]=4;
  53490. $self._assert_equals_($11,$14);
  53491. $ctx1.sendIdx["assert:equals:"]=4;
  53492. $16=$self._collection();
  53493. $ctx1.sendIdx["collection"]=5;
  53494. $15=$recv($16)._select_((function(each){
  53495. return $core.withContext(function($ctx2) {
  53496. $17=$self._sampleNewValue();
  53497. $ctx2.sendIdx["sampleNewValue"]=3;
  53498. return $recv(each).__eq($17);
  53499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53500. }));
  53501. $ctx1.sendIdx["select:"]=5;
  53502. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53503. $ctx1.sendIdx["assert:equals:"]=5;
  53504. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53505. return $core.withContext(function($ctx2) {
  53506. return $recv(each).__tild_eq($self._sampleNewValue());
  53507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53508. })),$self._collection());
  53509. return self;
  53510. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53511. },
  53512. args: [],
  53513. 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",
  53514. referencedClasses: [],
  53515. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53516. }),
  53517. $globals.CollectionTest);
  53518. $core.addMethod(
  53519. $core.method({
  53520. selector: "testSelectThenCollect",
  53521. protocol: "tests",
  53522. fn: function (){
  53523. var self=this,$self=this;
  53524. return $core.withContext(function($ctx1) {
  53525. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53526. $2=$self._collection();
  53527. $ctx1.sendIdx["collection"]=1;
  53528. $1=$recv($2)._select_thenCollect_((function(){
  53529. return false;
  53530. }),"isString");
  53531. $ctx1.sendIdx["select:thenCollect:"]=1;
  53532. $4=$self._collectionClass();
  53533. $ctx1.sendIdx["collectionClass"]=1;
  53534. $3=$recv($4)._new();
  53535. $ctx1.sendIdx["new"]=1;
  53536. $self._assert_equals_($1,$3);
  53537. $ctx1.sendIdx["assert:equals:"]=1;
  53538. $6=$self._collection();
  53539. $ctx1.sendIdx["collection"]=2;
  53540. $5=$recv($6)._select_thenCollect_((function(){
  53541. return true;
  53542. }),(function(x){
  53543. return x;
  53544. }));
  53545. $ctx1.sendIdx["select:thenCollect:"]=2;
  53546. $7=$self._collection();
  53547. $ctx1.sendIdx["collection"]=3;
  53548. $self._assert_equals_($5,$7);
  53549. $ctx1.sendIdx["assert:equals:"]=2;
  53550. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53551. return $core.withContext(function($ctx2) {
  53552. $9=$self._sampleNewValue();
  53553. $ctx2.sendIdx["sampleNewValue"]=1;
  53554. return $recv(each).__eq($9);
  53555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53556. }),(function(x){
  53557. return x;
  53558. }));
  53559. $ctx1.sendIdx["select:thenCollect:"]=3;
  53560. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53561. $ctx1.sendIdx["assert:equals:"]=3;
  53562. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53563. return $core.withContext(function($ctx2) {
  53564. return $recv(each).__tild_eq($self._sampleNewValue());
  53565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53566. }),"printString"),$self._collectionOfPrintStrings());
  53567. return self;
  53568. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53569. },
  53570. args: [],
  53571. source: "testSelectThenCollect\x0a\x09self assert: (self collection select: [ false ] thenCollect: #isString) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ] thenCollect: [:x|x]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ] thenCollect: [:x|x]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ] thenCollect: #printString) equals: self collectionOfPrintStrings",
  53572. referencedClasses: [],
  53573. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53574. }),
  53575. $globals.CollectionTest);
  53576. $core.addMethod(
  53577. $core.method({
  53578. selector: "testSingle",
  53579. protocol: "tests",
  53580. fn: function (){
  53581. var self=this,$self=this;
  53582. return $core.withContext(function($ctx1) {
  53583. $self._should_raise_((function(){
  53584. return $core.withContext(function($ctx2) {
  53585. return $recv($recv($self._collectionClass())._new())._single();
  53586. $ctx2.sendIdx["single"]=1;
  53587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53588. }),$globals.Error);
  53589. $ctx1.sendIdx["should:raise:"]=1;
  53590. $self._should_raise_((function(){
  53591. return $core.withContext(function($ctx2) {
  53592. return $recv($self._collection())._single();
  53593. $ctx2.sendIdx["single"]=2;
  53594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53595. }),$globals.Error);
  53596. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53597. return self;
  53598. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53599. },
  53600. args: [],
  53601. source: "testSingle\x0a\x09self should: [ self collectionClass new single ] raise: Error.\x0a\x09self should: [ self collection single ] raise: Error.\x0a\x09self assert: self sampleNewValueAsCollection single equals: self sampleNewValue",
  53602. referencedClasses: ["Error"],
  53603. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53604. }),
  53605. $globals.CollectionTest);
  53606. $core.addMethod(
  53607. $core.method({
  53608. selector: "testSize",
  53609. protocol: "tests",
  53610. fn: function (){
  53611. var self=this,$self=this;
  53612. return $core.withContext(function($ctx1) {
  53613. var $1,$2;
  53614. $1=$recv($recv($self._collectionClass())._new())._size();
  53615. $ctx1.sendIdx["size"]=1;
  53616. $self._assert_equals_($1,(0));
  53617. $ctx1.sendIdx["assert:equals:"]=1;
  53618. $2=$recv($self._sampleNewValueAsCollection())._size();
  53619. $ctx1.sendIdx["size"]=2;
  53620. $self._assert_equals_($2,(1));
  53621. $ctx1.sendIdx["assert:equals:"]=2;
  53622. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53623. return self;
  53624. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53625. },
  53626. args: [],
  53627. 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",
  53628. referencedClasses: [],
  53629. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53630. }),
  53631. $globals.CollectionTest);
  53632. $core.addMethod(
  53633. $core.method({
  53634. selector: "collectionClass",
  53635. protocol: "fixture",
  53636. fn: function (){
  53637. var self=this,$self=this;
  53638. return nil;
  53639. },
  53640. args: [],
  53641. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53642. referencedClasses: [],
  53643. messageSends: []
  53644. }),
  53645. $globals.CollectionTest.a$cls);
  53646. $core.addMethod(
  53647. $core.method({
  53648. selector: "isAbstract",
  53649. protocol: "testing",
  53650. fn: function (){
  53651. var self=this,$self=this;
  53652. return $core.withContext(function($ctx1) {
  53653. return $recv($self._collectionClass())._isNil();
  53654. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53655. },
  53656. args: [],
  53657. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53658. referencedClasses: [],
  53659. messageSends: ["isNil", "collectionClass"]
  53660. }),
  53661. $globals.CollectionTest.a$cls);
  53662. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53663. $core.addMethod(
  53664. $core.method({
  53665. selector: "collectionWithNewValue",
  53666. protocol: "fixture",
  53667. fn: function (){
  53668. var self=this,$self=this;
  53669. return $core.withContext(function($ctx1) {
  53670. $self._subclassResponsibility();
  53671. return self;
  53672. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53673. },
  53674. args: [],
  53675. 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",
  53676. referencedClasses: [],
  53677. messageSends: ["subclassResponsibility"]
  53678. }),
  53679. $globals.IndexableCollectionTest);
  53680. $core.addMethod(
  53681. $core.method({
  53682. selector: "nonIndexesDo:",
  53683. protocol: "fixture",
  53684. fn: function (aBlock){
  53685. var self=this,$self=this;
  53686. return $core.withContext(function($ctx1) {
  53687. $self._subclassResponsibility();
  53688. return self;
  53689. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53690. },
  53691. args: ["aBlock"],
  53692. source: "nonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  53693. referencedClasses: [],
  53694. messageSends: ["subclassResponsibility"]
  53695. }),
  53696. $globals.IndexableCollectionTest);
  53697. $core.addMethod(
  53698. $core.method({
  53699. selector: "sampleNewIndex",
  53700. protocol: "fixture",
  53701. fn: function (){
  53702. var self=this,$self=this;
  53703. return $core.withContext(function($ctx1) {
  53704. $self._subclassResponsibility();
  53705. return self;
  53706. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53707. },
  53708. args: [],
  53709. 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",
  53710. referencedClasses: [],
  53711. messageSends: ["subclassResponsibility"]
  53712. }),
  53713. $globals.IndexableCollectionTest);
  53714. $core.addMethod(
  53715. $core.method({
  53716. selector: "samplesDo:",
  53717. protocol: "fixture",
  53718. fn: function (aBlock){
  53719. var self=this,$self=this;
  53720. return $core.withContext(function($ctx1) {
  53721. $self._subclassResponsibility();
  53722. return self;
  53723. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53724. },
  53725. args: ["aBlock"],
  53726. 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",
  53727. referencedClasses: [],
  53728. messageSends: ["subclassResponsibility"]
  53729. }),
  53730. $globals.IndexableCollectionTest);
  53731. $core.addMethod(
  53732. $core.method({
  53733. selector: "testAt",
  53734. protocol: "tests",
  53735. fn: function (){
  53736. var self=this,$self=this;
  53737. return $core.withContext(function($ctx1) {
  53738. var $1;
  53739. $self._nonIndexesDo_((function(each){
  53740. return $core.withContext(function($ctx2) {
  53741. return $self._should_raise_((function(){
  53742. return $core.withContext(function($ctx3) {
  53743. $1=$self._collection();
  53744. $ctx3.sendIdx["collection"]=1;
  53745. return $recv($1)._at_(each);
  53746. $ctx3.sendIdx["at:"]=1;
  53747. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53748. }),$globals.Error);
  53749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53750. }));
  53751. $self._samplesDo_((function(index,value){
  53752. return $core.withContext(function($ctx2) {
  53753. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53754. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53755. }));
  53756. return self;
  53757. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53758. },
  53759. args: [],
  53760. 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 ]",
  53761. referencedClasses: ["Error"],
  53762. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53763. }),
  53764. $globals.IndexableCollectionTest);
  53765. $core.addMethod(
  53766. $core.method({
  53767. selector: "testAtIfAbsent",
  53768. protocol: "tests",
  53769. fn: function (){
  53770. var self=this,$self=this;
  53771. return $core.withContext(function($ctx1) {
  53772. var $2,$1,$3;
  53773. $self._nonIndexesDo_((function(each){
  53774. return $core.withContext(function($ctx2) {
  53775. $2=$self._collection();
  53776. $ctx2.sendIdx["collection"]=1;
  53777. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53778. return $core.withContext(function($ctx3) {
  53779. return $self._sampleNewValue();
  53780. $ctx3.sendIdx["sampleNewValue"]=1;
  53781. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53782. }));
  53783. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53784. $3=$self._sampleNewValue();
  53785. $ctx2.sendIdx["sampleNewValue"]=2;
  53786. return $self._assert_equals_($1,$3);
  53787. $ctx2.sendIdx["assert:equals:"]=1;
  53788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53789. }));
  53790. $self._samplesDo_((function(index,value){
  53791. return $core.withContext(function($ctx2) {
  53792. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53793. return $core.withContext(function($ctx3) {
  53794. return $self._sampleNewValue();
  53795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53796. })),value);
  53797. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53798. }));
  53799. return self;
  53800. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53801. },
  53802. args: [],
  53803. 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 ].",
  53804. referencedClasses: [],
  53805. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53806. }),
  53807. $globals.IndexableCollectionTest);
  53808. $core.addMethod(
  53809. $core.method({
  53810. selector: "testAtIfAbsentPut",
  53811. protocol: "tests",
  53812. fn: function (){
  53813. var self=this,$self=this;
  53814. var newCollection;
  53815. return $core.withContext(function($ctx1) {
  53816. var $1;
  53817. newCollection=$self._collection();
  53818. $ctx1.sendIdx["collection"]=1;
  53819. $self._samplesDo_((function(index,value){
  53820. return $core.withContext(function($ctx2) {
  53821. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53822. return $core.withContext(function($ctx3) {
  53823. return $self._sampleNewValue();
  53824. $ctx3.sendIdx["sampleNewValue"]=1;
  53825. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53826. }));
  53827. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53828. return $self._assert_equals_($1,value);
  53829. $ctx2.sendIdx["assert:equals:"]=1;
  53830. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53831. }));
  53832. $self._assert_equals_(newCollection,$self._collection());
  53833. $ctx1.sendIdx["assert:equals:"]=2;
  53834. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53835. return $core.withContext(function($ctx2) {
  53836. return $self._sampleNewValue();
  53837. $ctx2.sendIdx["sampleNewValue"]=2;
  53838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53839. })),$self._sampleNewValue());
  53840. $ctx1.sendIdx["assert:equals:"]=3;
  53841. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53842. return self;
  53843. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53844. },
  53845. args: [],
  53846. 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",
  53847. referencedClasses: [],
  53848. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53849. }),
  53850. $globals.IndexableCollectionTest);
  53851. $core.addMethod(
  53852. $core.method({
  53853. selector: "testAtIfPresent",
  53854. protocol: "tests",
  53855. fn: function (){
  53856. var self=this,$self=this;
  53857. var visited,sentinel;
  53858. return $core.withContext(function($ctx1) {
  53859. var $2,$1,$4,$3;
  53860. sentinel=$recv($globals.Object)._new();
  53861. $self._nonIndexesDo_((function(each){
  53862. return $core.withContext(function($ctx2) {
  53863. visited=nil;
  53864. $2=$self._collection();
  53865. $ctx2.sendIdx["collection"]=1;
  53866. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53867. visited=value1;
  53868. return sentinel;
  53869. }));
  53870. $ctx2.sendIdx["at:ifPresent:"]=1;
  53871. $self._assert_equals_($1,nil);
  53872. $ctx2.sendIdx["assert:equals:"]=1;
  53873. return $self._assert_($recv(visited)._isNil());
  53874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53875. }));
  53876. $self._samplesDo_((function(index,value){
  53877. return $core.withContext(function($ctx2) {
  53878. visited=nil;
  53879. $4=$self._collection();
  53880. $ctx2.sendIdx["collection"]=2;
  53881. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53882. visited=value2;
  53883. return sentinel;
  53884. }));
  53885. $self._assert_equals_($3,sentinel);
  53886. $ctx2.sendIdx["assert:equals:"]=2;
  53887. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53888. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53889. }));
  53890. return self;
  53891. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53892. },
  53893. args: [],
  53894. 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) ]",
  53895. referencedClasses: ["Object"],
  53896. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53897. }),
  53898. $globals.IndexableCollectionTest);
  53899. $core.addMethod(
  53900. $core.method({
  53901. selector: "testAtIfPresentIfAbsent",
  53902. protocol: "tests",
  53903. fn: function (){
  53904. var self=this,$self=this;
  53905. var visited,sentinel;
  53906. return $core.withContext(function($ctx1) {
  53907. var $2,$1,$3,$5,$4;
  53908. sentinel=$recv($globals.Object)._new();
  53909. $self._nonIndexesDo_((function(each){
  53910. return $core.withContext(function($ctx2) {
  53911. visited=nil;
  53912. $2=$self._collection();
  53913. $ctx2.sendIdx["collection"]=1;
  53914. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53915. visited=value1;
  53916. return sentinel;
  53917. }),(function(){
  53918. return $core.withContext(function($ctx3) {
  53919. return $self._sampleNewValue();
  53920. $ctx3.sendIdx["sampleNewValue"]=1;
  53921. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53922. }));
  53923. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53924. $3=$self._sampleNewValue();
  53925. $ctx2.sendIdx["sampleNewValue"]=2;
  53926. $self._assert_equals_($1,$3);
  53927. $ctx2.sendIdx["assert:equals:"]=1;
  53928. return $self._assert_($recv(visited)._isNil());
  53929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53930. }));
  53931. $self._samplesDo_((function(index,value){
  53932. return $core.withContext(function($ctx2) {
  53933. visited=nil;
  53934. $5=$self._collection();
  53935. $ctx2.sendIdx["collection"]=2;
  53936. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53937. visited=value2;
  53938. return sentinel;
  53939. }),(function(){
  53940. return $core.withContext(function($ctx3) {
  53941. return $self._sampleNewValue();
  53942. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53943. }));
  53944. $self._assert_equals_($4,sentinel);
  53945. $ctx2.sendIdx["assert:equals:"]=2;
  53946. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53947. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53948. }));
  53949. return self;
  53950. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53951. },
  53952. args: [],
  53953. 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) ]",
  53954. referencedClasses: ["Object"],
  53955. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53956. }),
  53957. $globals.IndexableCollectionTest);
  53958. $core.addMethod(
  53959. $core.method({
  53960. selector: "testAtPut",
  53961. protocol: "tests",
  53962. fn: function (){
  53963. var self=this,$self=this;
  53964. var newCollection;
  53965. return $core.withContext(function($ctx1) {
  53966. newCollection=$self._collection();
  53967. $ctx1.sendIdx["collection"]=1;
  53968. $self._samplesDo_((function(index,value){
  53969. return $core.withContext(function($ctx2) {
  53970. return $recv(newCollection)._at_put_(index,value);
  53971. $ctx2.sendIdx["at:put:"]=1;
  53972. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53973. }));
  53974. $self._assert_equals_(newCollection,$self._collection());
  53975. $ctx1.sendIdx["assert:equals:"]=1;
  53976. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53977. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53978. return self;
  53979. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53980. },
  53981. args: [],
  53982. 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",
  53983. referencedClasses: [],
  53984. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53985. }),
  53986. $globals.IndexableCollectionTest);
  53987. $core.addMethod(
  53988. $core.method({
  53989. selector: "testIndexOf",
  53990. protocol: "tests",
  53991. fn: function (){
  53992. var self=this,$self=this;
  53993. return $core.withContext(function($ctx1) {
  53994. var $1;
  53995. $self._should_raise_((function(){
  53996. return $core.withContext(function($ctx2) {
  53997. $1=$self._collection();
  53998. $ctx2.sendIdx["collection"]=1;
  53999. return $recv($1)._indexOf_($self._sampleNewValue());
  54000. $ctx2.sendIdx["indexOf:"]=1;
  54001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54002. }),$globals.Error);
  54003. $self._samplesDo_((function(index,value){
  54004. return $core.withContext(function($ctx2) {
  54005. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54006. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54007. }));
  54008. return self;
  54009. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54010. },
  54011. args: [],
  54012. 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 ]",
  54013. referencedClasses: ["Error"],
  54014. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54015. }),
  54016. $globals.IndexableCollectionTest);
  54017. $core.addMethod(
  54018. $core.method({
  54019. selector: "testIndexOfWithNull",
  54020. protocol: "tests",
  54021. fn: function (){
  54022. var self=this,$self=this;
  54023. var jsNull;
  54024. return $core.withContext(function($ctx1) {
  54025. var $2,$1;
  54026. jsNull=$recv($globals.JSON)._parse_("null");
  54027. $self._samplesDo_((function(index,value){
  54028. return $core.withContext(function($ctx2) {
  54029. $2=$self._collection();
  54030. $recv($2)._at_put_(index,jsNull);
  54031. $1=$recv($2)._indexOf_(jsNull);
  54032. return $self._assert_equals_($1,index);
  54033. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54034. }));
  54035. return self;
  54036. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54037. },
  54038. args: [],
  54039. 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 ]",
  54040. referencedClasses: ["JSON"],
  54041. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54042. }),
  54043. $globals.IndexableCollectionTest);
  54044. $core.addMethod(
  54045. $core.method({
  54046. selector: "testWithIndexDo",
  54047. protocol: "tests",
  54048. fn: function (){
  54049. var self=this,$self=this;
  54050. var collection;
  54051. return $core.withContext(function($ctx1) {
  54052. collection=$self._collection();
  54053. $ctx1.sendIdx["collection"]=1;
  54054. $recv($self._collection())._withIndexDo_((function(each,index){
  54055. return $core.withContext(function($ctx2) {
  54056. return $self._assert_equals_($recv(collection)._at_(index),each);
  54057. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54058. }));
  54059. return self;
  54060. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54061. },
  54062. args: [],
  54063. 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 ]",
  54064. referencedClasses: [],
  54065. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54066. }),
  54067. $globals.IndexableCollectionTest);
  54068. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54069. $core.addMethod(
  54070. $core.method({
  54071. selector: "collectionKeys",
  54072. protocol: "fixture",
  54073. fn: function (){
  54074. var self=this,$self=this;
  54075. return $core.withContext(function($ctx1) {
  54076. $self._subclassResponsibility();
  54077. return self;
  54078. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54079. },
  54080. args: [],
  54081. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54082. referencedClasses: [],
  54083. messageSends: ["subclassResponsibility"]
  54084. }),
  54085. $globals.AssociativeCollectionTest);
  54086. $core.addMethod(
  54087. $core.method({
  54088. selector: "collectionValues",
  54089. protocol: "fixture",
  54090. fn: function (){
  54091. var self=this,$self=this;
  54092. return $core.withContext(function($ctx1) {
  54093. $self._subclassResponsibility();
  54094. return self;
  54095. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54096. },
  54097. args: [],
  54098. source: "collectionValues\x0a\x09self subclassResponsibility",
  54099. referencedClasses: [],
  54100. messageSends: ["subclassResponsibility"]
  54101. }),
  54102. $globals.AssociativeCollectionTest);
  54103. $core.addMethod(
  54104. $core.method({
  54105. selector: "nonIndexesDo:",
  54106. protocol: "fixture",
  54107. fn: function (aBlock){
  54108. var self=this,$self=this;
  54109. return $core.withContext(function($ctx1) {
  54110. $recv(aBlock)._value_((5));
  54111. $ctx1.sendIdx["value:"]=1;
  54112. $recv(aBlock)._value_((function(){
  54113. }));
  54114. $ctx1.sendIdx["value:"]=2;
  54115. $recv(aBlock)._value_($recv($globals.Object)._new());
  54116. $ctx1.sendIdx["value:"]=3;
  54117. $recv(aBlock)._value_("z");
  54118. return self;
  54119. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54120. },
  54121. args: ["aBlock"],
  54122. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54123. referencedClasses: ["Object"],
  54124. messageSends: ["value:", "new"]
  54125. }),
  54126. $globals.AssociativeCollectionTest);
  54127. $core.addMethod(
  54128. $core.method({
  54129. selector: "sampleNewIndex",
  54130. protocol: "fixture",
  54131. fn: function (){
  54132. var self=this,$self=this;
  54133. return "new";
  54134. },
  54135. args: [],
  54136. source: "sampleNewIndex\x0a\x09^ 'new'",
  54137. referencedClasses: [],
  54138. messageSends: []
  54139. }),
  54140. $globals.AssociativeCollectionTest);
  54141. $core.addMethod(
  54142. $core.method({
  54143. selector: "samplesDo:",
  54144. protocol: "fixture",
  54145. fn: function (aBlock){
  54146. var self=this,$self=this;
  54147. return $core.withContext(function($ctx1) {
  54148. $recv(aBlock)._value_value_("a",(2));
  54149. return self;
  54150. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54151. },
  54152. args: ["aBlock"],
  54153. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54154. referencedClasses: [],
  54155. messageSends: ["value:value:"]
  54156. }),
  54157. $globals.AssociativeCollectionTest);
  54158. $core.addMethod(
  54159. $core.method({
  54160. selector: "testAddAll",
  54161. protocol: "tests",
  54162. fn: function (){
  54163. var self=this,$self=this;
  54164. return $core.withContext(function($ctx1) {
  54165. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54166. (
  54167. $ctx1.supercall = true,
  54168. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54169. $ctx1.supercall = false;
  54170. $2=$self._collection();
  54171. $ctx1.sendIdx["collection"]=1;
  54172. $3=$self._collection();
  54173. $ctx1.sendIdx["collection"]=2;
  54174. $recv($2)._addAll_($3);
  54175. $ctx1.sendIdx["addAll:"]=1;
  54176. $4=$recv($2)._yourself();
  54177. $ctx1.sendIdx["yourself"]=1;
  54178. $1=$4;
  54179. $5=$self._collection();
  54180. $ctx1.sendIdx["collection"]=3;
  54181. $self._assert_equals_($1,$5);
  54182. $ctx1.sendIdx["assert:equals:"]=1;
  54183. $7=$self._collection();
  54184. $ctx1.sendIdx["collection"]=4;
  54185. $8=$self._collectionWithNewValue();
  54186. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54187. $recv($7)._addAll_($8);
  54188. $ctx1.sendIdx["addAll:"]=2;
  54189. $9=$recv($7)._yourself();
  54190. $ctx1.sendIdx["yourself"]=2;
  54191. $6=$9;
  54192. $10=$self._collectionWithNewValue();
  54193. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54194. $self._assert_equals_($6,$10);
  54195. $ctx1.sendIdx["assert:equals:"]=2;
  54196. $12=$self._collectionWithNewValue();
  54197. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54198. $recv($12)._addAll_($self._collection());
  54199. $11=$recv($12)._yourself();
  54200. $self._assert_equals_($11,$self._collectionWithNewValue());
  54201. return self;
  54202. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54203. },
  54204. args: [],
  54205. 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",
  54206. referencedClasses: [],
  54207. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54208. }),
  54209. $globals.AssociativeCollectionTest);
  54210. $core.addMethod(
  54211. $core.method({
  54212. selector: "testAsDictionary",
  54213. protocol: "tests",
  54214. fn: function (){
  54215. var self=this,$self=this;
  54216. return $core.withContext(function($ctx1) {
  54217. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54218. return self;
  54219. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54220. },
  54221. args: [],
  54222. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54223. referencedClasses: ["Dictionary"],
  54224. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54225. }),
  54226. $globals.AssociativeCollectionTest);
  54227. $core.addMethod(
  54228. $core.method({
  54229. selector: "testAsHashedCollection",
  54230. protocol: "tests",
  54231. fn: function (){
  54232. var self=this,$self=this;
  54233. return $core.withContext(function($ctx1) {
  54234. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54235. return self;
  54236. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54237. },
  54238. args: [],
  54239. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54240. referencedClasses: ["HashedCollection"],
  54241. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54242. }),
  54243. $globals.AssociativeCollectionTest);
  54244. $core.addMethod(
  54245. $core.method({
  54246. selector: "testComma",
  54247. protocol: "tests",
  54248. fn: function (){
  54249. var self=this,$self=this;
  54250. return $core.withContext(function($ctx1) {
  54251. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54252. (
  54253. $ctx1.supercall = true,
  54254. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54255. $ctx1.supercall = false;
  54256. $2=$self._collection();
  54257. $ctx1.sendIdx["collection"]=1;
  54258. $3=$self._collection();
  54259. $ctx1.sendIdx["collection"]=2;
  54260. $1=$recv($2).__comma($3);
  54261. $ctx1.sendIdx[","]=1;
  54262. $4=$self._collection();
  54263. $ctx1.sendIdx["collection"]=3;
  54264. $self._assert_equals_($1,$4);
  54265. $ctx1.sendIdx["assert:equals:"]=1;
  54266. $6=$self._collection();
  54267. $ctx1.sendIdx["collection"]=4;
  54268. $7=$self._collectionWithNewValue();
  54269. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54270. $5=$recv($6).__comma($7);
  54271. $ctx1.sendIdx[","]=2;
  54272. $8=$self._collectionWithNewValue();
  54273. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54274. $self._assert_equals_($5,$8);
  54275. $ctx1.sendIdx["assert:equals:"]=2;
  54276. $10=$self._collectionWithNewValue();
  54277. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54278. $9=$recv($10).__comma($self._collection());
  54279. $self._assert_equals_($9,$self._collectionWithNewValue());
  54280. return self;
  54281. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54282. },
  54283. args: [],
  54284. 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",
  54285. referencedClasses: [],
  54286. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54287. }),
  54288. $globals.AssociativeCollectionTest);
  54289. $core.addMethod(
  54290. $core.method({
  54291. selector: "testFrom",
  54292. protocol: "tests",
  54293. fn: function (){
  54294. var self=this,$self=this;
  54295. var associations;
  54296. return $core.withContext(function($ctx1) {
  54297. var $1;
  54298. $1="a".__minus_gt((1));
  54299. $ctx1.sendIdx["->"]=1;
  54300. associations=[$1,"b".__minus_gt((2))];
  54301. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54302. return self;
  54303. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54304. },
  54305. args: [],
  54306. 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 }.",
  54307. referencedClasses: [],
  54308. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54309. }),
  54310. $globals.AssociativeCollectionTest);
  54311. $core.addMethod(
  54312. $core.method({
  54313. selector: "testKeys",
  54314. protocol: "tests",
  54315. fn: function (){
  54316. var self=this,$self=this;
  54317. return $core.withContext(function($ctx1) {
  54318. var $2,$1,$3,$4;
  54319. $2=$recv($recv($self._collectionClass())._new())._keys();
  54320. $ctx1.sendIdx["keys"]=1;
  54321. $1=$recv($2)._isEmpty();
  54322. $self._assert_($1);
  54323. $3=$recv($self._collection())._keys();
  54324. $ctx1.sendIdx["keys"]=2;
  54325. $4=$self._collectionKeys();
  54326. $ctx1.sendIdx["collectionKeys"]=1;
  54327. $self._assertSameContents_as_($3,$4);
  54328. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54329. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54330. return self;
  54331. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54332. },
  54333. args: [],
  54334. 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 }",
  54335. referencedClasses: [],
  54336. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54337. }),
  54338. $globals.AssociativeCollectionTest);
  54339. $core.addMethod(
  54340. $core.method({
  54341. selector: "testNewFromPairs",
  54342. protocol: "tests",
  54343. fn: function (){
  54344. var self=this,$self=this;
  54345. var flattenedAssociations;
  54346. return $core.withContext(function($ctx1) {
  54347. flattenedAssociations=["a",(1),"b",(2)];
  54348. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54349. return self;
  54350. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54351. },
  54352. args: [],
  54353. 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 }.",
  54354. referencedClasses: [],
  54355. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54356. }),
  54357. $globals.AssociativeCollectionTest);
  54358. $core.addMethod(
  54359. $core.method({
  54360. selector: "testPrintString",
  54361. protocol: "tests",
  54362. fn: function (){
  54363. var self=this,$self=this;
  54364. return $core.withContext(function($ctx1) {
  54365. var $3,$2,$1,$4;
  54366. $3=$self._collectionClass();
  54367. $ctx1.sendIdx["collectionClass"]=1;
  54368. $2=$recv($3)._new();
  54369. $recv($2)._at_put_("firstname","James");
  54370. $ctx1.sendIdx["at:put:"]=1;
  54371. $recv($2)._at_put_("lastname","Bond");
  54372. $1=$recv($2)._printString();
  54373. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54374. $ctx1.sendIdx[","]=1;
  54375. $self._assert_equals_($1,$4);
  54376. return self;
  54377. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54378. },
  54379. args: [],
  54380. 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'')'",
  54381. referencedClasses: [],
  54382. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54383. }),
  54384. $globals.AssociativeCollectionTest);
  54385. $core.addMethod(
  54386. $core.method({
  54387. selector: "testRemoveKey",
  54388. protocol: "tests",
  54389. fn: function (){
  54390. var self=this,$self=this;
  54391. return $core.withContext(function($ctx1) {
  54392. var $1,$2,$3,$5,$6,$4,$8,$7;
  54393. $self._nonIndexesDo_((function(each){
  54394. var collection;
  54395. return $core.withContext(function($ctx2) {
  54396. collection=$self._collection();
  54397. $ctx2.sendIdx["collection"]=1;
  54398. $self._should_raise_((function(){
  54399. return $core.withContext(function($ctx3) {
  54400. return $recv(collection)._removeKey_(each);
  54401. $ctx3.sendIdx["removeKey:"]=1;
  54402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54403. }),$globals.Error);
  54404. $1=collection;
  54405. $2=$self._collection();
  54406. $ctx2.sendIdx["collection"]=2;
  54407. return $self._assert_equals_($1,$2);
  54408. $ctx2.sendIdx["assert:equals:"]=1;
  54409. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54410. }));
  54411. $self._samplesDo_((function(index,value){
  54412. var collection;
  54413. return $core.withContext(function($ctx2) {
  54414. collection=$self._collection();
  54415. $ctx2.sendIdx["collection"]=3;
  54416. $3=$recv(collection)._removeKey_(index);
  54417. $ctx2.sendIdx["removeKey:"]=2;
  54418. $self._assert_equals_($3,value);
  54419. $ctx2.sendIdx["assert:equals:"]=2;
  54420. $5=collection;
  54421. $6=$self._collection();
  54422. $ctx2.sendIdx["collection"]=4;
  54423. $4=$recv($5).__eq($6);
  54424. return $self._deny_($4);
  54425. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54426. }));
  54427. $8=$self._collectionWithNewValue();
  54428. $recv($8)._removeKey_($self._sampleNewIndex());
  54429. $7=$recv($8)._yourself();
  54430. $self._assert_equals_($7,$self._collection());
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54433. },
  54434. args: [],
  54435. 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",
  54436. referencedClasses: ["Error"],
  54437. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54438. }),
  54439. $globals.AssociativeCollectionTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "testRemoveKeyIfAbsent",
  54443. protocol: "tests",
  54444. fn: function (){
  54445. var self=this,$self=this;
  54446. return $core.withContext(function($ctx1) {
  54447. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54448. $self._nonIndexesDo_((function(each){
  54449. var collection;
  54450. return $core.withContext(function($ctx2) {
  54451. collection=$self._collection();
  54452. $ctx2.sendIdx["collection"]=1;
  54453. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54454. return $core.withContext(function($ctx3) {
  54455. return $self._sampleNewValue();
  54456. $ctx3.sendIdx["sampleNewValue"]=1;
  54457. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54458. }));
  54459. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54460. $2=$self._sampleNewValue();
  54461. $ctx2.sendIdx["sampleNewValue"]=2;
  54462. $self._assert_equals_($1,$2);
  54463. $ctx2.sendIdx["assert:equals:"]=1;
  54464. $3=collection;
  54465. $4=$self._collection();
  54466. $ctx2.sendIdx["collection"]=2;
  54467. return $self._assert_equals_($3,$4);
  54468. $ctx2.sendIdx["assert:equals:"]=2;
  54469. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54470. }));
  54471. $self._samplesDo_((function(index,value){
  54472. var collection;
  54473. return $core.withContext(function($ctx2) {
  54474. collection=$self._collection();
  54475. $ctx2.sendIdx["collection"]=3;
  54476. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54477. return $core.withContext(function($ctx3) {
  54478. return $self._sampleNewValue();
  54479. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54480. }));
  54481. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54482. $self._assert_equals_($5,value);
  54483. $ctx2.sendIdx["assert:equals:"]=3;
  54484. $7=collection;
  54485. $8=$self._collection();
  54486. $ctx2.sendIdx["collection"]=4;
  54487. $6=$recv($7).__eq($8);
  54488. return $self._deny_($6);
  54489. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54490. }));
  54491. $10=$self._collectionWithNewValue();
  54492. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54493. return $core.withContext(function($ctx2) {
  54494. return $self._assert_(false);
  54495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54496. }));
  54497. $9=$recv($10)._yourself();
  54498. $self._assert_equals_($9,$self._collection());
  54499. return self;
  54500. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54501. },
  54502. args: [],
  54503. 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",
  54504. referencedClasses: [],
  54505. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54506. }),
  54507. $globals.AssociativeCollectionTest);
  54508. $core.addMethod(
  54509. $core.method({
  54510. selector: "testValues",
  54511. protocol: "tests",
  54512. fn: function (){
  54513. var self=this,$self=this;
  54514. return $core.withContext(function($ctx1) {
  54515. var $2,$1,$3,$4;
  54516. $2=$recv($recv($self._collectionClass())._new())._values();
  54517. $ctx1.sendIdx["values"]=1;
  54518. $1=$recv($2)._isEmpty();
  54519. $self._assert_($1);
  54520. $3=$recv($self._collection())._values();
  54521. $ctx1.sendIdx["values"]=2;
  54522. $4=$self._collectionValues();
  54523. $ctx1.sendIdx["collectionValues"]=1;
  54524. $self._assertSameContents_as_($3,$4);
  54525. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54526. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54527. return self;
  54528. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54529. },
  54530. args: [],
  54531. 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 }",
  54532. referencedClasses: [],
  54533. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54534. }),
  54535. $globals.AssociativeCollectionTest);
  54536. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54537. $core.addMethod(
  54538. $core.method({
  54539. selector: "collection",
  54540. protocol: "fixture",
  54541. fn: function (){
  54542. var self=this,$self=this;
  54543. return $core.withContext(function($ctx1) {
  54544. var $1;
  54545. $1=$recv($globals.Dictionary)._new();
  54546. $recv($1)._at_put_((1),(1));
  54547. $ctx1.sendIdx["at:put:"]=1;
  54548. $recv($1)._at_put_("a",(2));
  54549. $ctx1.sendIdx["at:put:"]=2;
  54550. $recv($1)._at_put_(true,(3));
  54551. $ctx1.sendIdx["at:put:"]=3;
  54552. $recv($1)._at_put_((1).__at((3)),(-4));
  54553. $ctx1.sendIdx["at:put:"]=4;
  54554. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54555. return $recv($1)._yourself();
  54556. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54557. },
  54558. args: [],
  54559. 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",
  54560. referencedClasses: ["Dictionary"],
  54561. messageSends: ["at:put:", "new", "@", "yourself"]
  54562. }),
  54563. $globals.DictionaryTest);
  54564. $core.addMethod(
  54565. $core.method({
  54566. selector: "collectionKeys",
  54567. protocol: "fixture",
  54568. fn: function (){
  54569. var self=this,$self=this;
  54570. return $core.withContext(function($ctx1) {
  54571. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54572. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54573. },
  54574. args: [],
  54575. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54576. referencedClasses: [],
  54577. messageSends: ["@"]
  54578. }),
  54579. $globals.DictionaryTest);
  54580. $core.addMethod(
  54581. $core.method({
  54582. selector: "collectionOfPrintStrings",
  54583. protocol: "fixture",
  54584. fn: function (){
  54585. var self=this,$self=this;
  54586. return $core.withContext(function($ctx1) {
  54587. var $1;
  54588. $1=$recv($globals.Dictionary)._new();
  54589. $recv($1)._at_put_((1),"1");
  54590. $ctx1.sendIdx["at:put:"]=1;
  54591. $recv($1)._at_put_("a","2");
  54592. $ctx1.sendIdx["at:put:"]=2;
  54593. $recv($1)._at_put_(true,"3");
  54594. $ctx1.sendIdx["at:put:"]=3;
  54595. $recv($1)._at_put_((1).__at((3)),"-4");
  54596. $ctx1.sendIdx["at:put:"]=4;
  54597. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54598. return $recv($1)._yourself();
  54599. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54600. },
  54601. args: [],
  54602. 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",
  54603. referencedClasses: ["Dictionary"],
  54604. messageSends: ["at:put:", "new", "@", "yourself"]
  54605. }),
  54606. $globals.DictionaryTest);
  54607. $core.addMethod(
  54608. $core.method({
  54609. selector: "collectionSize",
  54610. protocol: "fixture",
  54611. fn: function (){
  54612. var self=this,$self=this;
  54613. return (5);
  54614. },
  54615. args: [],
  54616. source: "collectionSize\x0a\x09^ 5",
  54617. referencedClasses: [],
  54618. messageSends: []
  54619. }),
  54620. $globals.DictionaryTest);
  54621. $core.addMethod(
  54622. $core.method({
  54623. selector: "collectionValues",
  54624. protocol: "fixture",
  54625. fn: function (){
  54626. var self=this,$self=this;
  54627. return [(1),(2),(3),(-4),(9)];
  54628. },
  54629. args: [],
  54630. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54631. referencedClasses: [],
  54632. messageSends: []
  54633. }),
  54634. $globals.DictionaryTest);
  54635. $core.addMethod(
  54636. $core.method({
  54637. selector: "collectionWithDuplicates",
  54638. protocol: "fixture",
  54639. fn: function (){
  54640. var self=this,$self=this;
  54641. return $core.withContext(function($ctx1) {
  54642. var $1;
  54643. $1=$recv($globals.Dictionary)._new();
  54644. $recv($1)._at_put_((1),(1));
  54645. $ctx1.sendIdx["at:put:"]=1;
  54646. $recv($1)._at_put_("a",(2));
  54647. $ctx1.sendIdx["at:put:"]=2;
  54648. $recv($1)._at_put_(true,(3));
  54649. $ctx1.sendIdx["at:put:"]=3;
  54650. $recv($1)._at_put_((4),(-4));
  54651. $ctx1.sendIdx["at:put:"]=4;
  54652. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54653. $ctx1.sendIdx["at:put:"]=5;
  54654. $recv($1)._at_put_("b",(1));
  54655. $ctx1.sendIdx["at:put:"]=6;
  54656. $recv($1)._at_put_((3),(3));
  54657. $ctx1.sendIdx["at:put:"]=7;
  54658. $recv($1)._at_put_(false,(12));
  54659. return $recv($1)._yourself();
  54660. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54661. },
  54662. args: [],
  54663. 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",
  54664. referencedClasses: ["Dictionary"],
  54665. messageSends: ["at:put:", "new", "yourself"]
  54666. }),
  54667. $globals.DictionaryTest);
  54668. $core.addMethod(
  54669. $core.method({
  54670. selector: "collectionWithNewValue",
  54671. protocol: "fixture",
  54672. fn: function (){
  54673. var self=this,$self=this;
  54674. return $core.withContext(function($ctx1) {
  54675. var $1;
  54676. $1=$recv($globals.Dictionary)._new();
  54677. $recv($1)._at_put_((1),(1));
  54678. $ctx1.sendIdx["at:put:"]=1;
  54679. $recv($1)._at_put_("a",(2));
  54680. $ctx1.sendIdx["at:put:"]=2;
  54681. $recv($1)._at_put_(true,(3));
  54682. $ctx1.sendIdx["at:put:"]=3;
  54683. $recv($1)._at_put_((1).__at((3)),(-4));
  54684. $ctx1.sendIdx["at:put:"]=4;
  54685. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54686. $ctx1.sendIdx["at:put:"]=5;
  54687. $recv($1)._at_put_("new","N");
  54688. return $recv($1)._yourself();
  54689. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54690. },
  54691. args: [],
  54692. 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",
  54693. referencedClasses: ["Dictionary"],
  54694. messageSends: ["at:put:", "new", "@", "yourself"]
  54695. }),
  54696. $globals.DictionaryTest);
  54697. $core.addMethod(
  54698. $core.method({
  54699. selector: "sampleNewValueAsCollection",
  54700. protocol: "fixture",
  54701. fn: function (){
  54702. var self=this,$self=this;
  54703. return $core.withContext(function($ctx1) {
  54704. var $1;
  54705. $1=$recv($globals.Dictionary)._new();
  54706. $recv($1)._at_put_("new","N");
  54707. return $recv($1)._yourself();
  54708. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54709. },
  54710. args: [],
  54711. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54712. referencedClasses: ["Dictionary"],
  54713. messageSends: ["at:put:", "new", "yourself"]
  54714. }),
  54715. $globals.DictionaryTest);
  54716. $core.addMethod(
  54717. $core.method({
  54718. selector: "samplesDo:",
  54719. protocol: "fixture",
  54720. fn: function (aBlock){
  54721. var self=this,$self=this;
  54722. return $core.withContext(function($ctx1) {
  54723. (
  54724. $ctx1.supercall = true,
  54725. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54726. $ctx1.supercall = false;
  54727. $recv(aBlock)._value_value_(true,(3));
  54728. $ctx1.sendIdx["value:value:"]=1;
  54729. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54730. $ctx1.sendIdx["value:value:"]=2;
  54731. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54732. return self;
  54733. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54734. },
  54735. args: ["aBlock"],
  54736. 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",
  54737. referencedClasses: [],
  54738. messageSends: ["samplesDo:", "value:value:", "@"]
  54739. }),
  54740. $globals.DictionaryTest);
  54741. $core.addMethod(
  54742. $core.method({
  54743. selector: "testAccessing",
  54744. protocol: "tests",
  54745. fn: function (){
  54746. var self=this,$self=this;
  54747. var d;
  54748. return $core.withContext(function($ctx1) {
  54749. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54750. d=$recv($globals.Dictionary)._new();
  54751. $recv(d)._at_put_("hello","world");
  54752. $ctx1.sendIdx["at:put:"]=1;
  54753. $1=$recv(d)._at_("hello");
  54754. $ctx1.sendIdx["at:"]=1;
  54755. $self._assert_equals_($1,"world");
  54756. $ctx1.sendIdx["assert:equals:"]=1;
  54757. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54758. return nil;
  54759. }));
  54760. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54761. $self._assert_equals_($2,"world");
  54762. $ctx1.sendIdx["assert:equals:"]=2;
  54763. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54764. return nil;
  54765. }))).__eq("world"));
  54766. $ctx1.sendIdx["deny:"]=1;
  54767. $3=$recv(d)._includesKey_("hello");
  54768. $ctx1.sendIdx["includesKey:"]=1;
  54769. $self._assert_($3);
  54770. $ctx1.sendIdx["assert:"]=1;
  54771. $4=$recv(d)._includesKey_("foo");
  54772. $ctx1.sendIdx["includesKey:"]=2;
  54773. $self._deny_($4);
  54774. $ctx1.sendIdx["deny:"]=2;
  54775. $recv(d)._at_put_((1),(2));
  54776. $ctx1.sendIdx["at:put:"]=2;
  54777. $5=$recv(d)._at_((1));
  54778. $ctx1.sendIdx["at:"]=2;
  54779. $self._assert_equals_($5,(2));
  54780. $ctx1.sendIdx["assert:equals:"]=3;
  54781. $6=d;
  54782. $7=(1).__at((3));
  54783. $ctx1.sendIdx["@"]=1;
  54784. $recv($6)._at_put_($7,(3));
  54785. $9=d;
  54786. $10=(1).__at((3));
  54787. $ctx1.sendIdx["@"]=2;
  54788. $8=$recv($9)._at_($10);
  54789. $self._assert_equals_($8,(3));
  54790. $12=d;
  54791. $13=(1).__at((3));
  54792. $ctx1.sendIdx["@"]=3;
  54793. $11=$recv($12)._includesKey_($13);
  54794. $ctx1.sendIdx["includesKey:"]=3;
  54795. $self._assert_($11);
  54796. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54797. return self;
  54798. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54799. },
  54800. args: [],
  54801. 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)",
  54802. referencedClasses: ["Dictionary"],
  54803. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54804. }),
  54805. $globals.DictionaryTest);
  54806. $core.addMethod(
  54807. $core.method({
  54808. selector: "testDynamicDictionaries",
  54809. protocol: "tests",
  54810. fn: function (){
  54811. var self=this,$self=this;
  54812. return $core.withContext(function($ctx1) {
  54813. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54814. return self;
  54815. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54816. },
  54817. args: [],
  54818. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54819. referencedClasses: ["Dictionary"],
  54820. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54821. }),
  54822. $globals.DictionaryTest);
  54823. $core.addMethod(
  54824. $core.method({
  54825. selector: "collectionClass",
  54826. protocol: "fixture",
  54827. fn: function (){
  54828. var self=this,$self=this;
  54829. return $globals.Dictionary;
  54830. },
  54831. args: [],
  54832. source: "collectionClass\x0a\x09^ Dictionary",
  54833. referencedClasses: ["Dictionary"],
  54834. messageSends: []
  54835. }),
  54836. $globals.DictionaryTest.a$cls);
  54837. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54838. $core.addMethod(
  54839. $core.method({
  54840. selector: "collection",
  54841. protocol: "fixture",
  54842. fn: function (){
  54843. var self=this,$self=this;
  54844. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54845. },
  54846. args: [],
  54847. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54848. referencedClasses: [],
  54849. messageSends: []
  54850. }),
  54851. $globals.HashedCollectionTest);
  54852. $core.addMethod(
  54853. $core.method({
  54854. selector: "collectionKeys",
  54855. protocol: "fixture",
  54856. fn: function (){
  54857. var self=this,$self=this;
  54858. return ["b","a","c","d"];
  54859. },
  54860. args: [],
  54861. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54862. referencedClasses: [],
  54863. messageSends: []
  54864. }),
  54865. $globals.HashedCollectionTest);
  54866. $core.addMethod(
  54867. $core.method({
  54868. selector: "collectionOfPrintStrings",
  54869. protocol: "fixture",
  54870. fn: function (){
  54871. var self=this,$self=this;
  54872. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54873. },
  54874. args: [],
  54875. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54876. referencedClasses: [],
  54877. messageSends: []
  54878. }),
  54879. $globals.HashedCollectionTest);
  54880. $core.addMethod(
  54881. $core.method({
  54882. selector: "collectionSize",
  54883. protocol: "fixture",
  54884. fn: function (){
  54885. var self=this,$self=this;
  54886. return (4);
  54887. },
  54888. args: [],
  54889. source: "collectionSize\x0a\x09^ 4",
  54890. referencedClasses: [],
  54891. messageSends: []
  54892. }),
  54893. $globals.HashedCollectionTest);
  54894. $core.addMethod(
  54895. $core.method({
  54896. selector: "collectionValues",
  54897. protocol: "fixture",
  54898. fn: function (){
  54899. var self=this,$self=this;
  54900. return [(1),(2),(3),(-4)];
  54901. },
  54902. args: [],
  54903. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54904. referencedClasses: [],
  54905. messageSends: []
  54906. }),
  54907. $globals.HashedCollectionTest);
  54908. $core.addMethod(
  54909. $core.method({
  54910. selector: "collectionWithDuplicates",
  54911. protocol: "fixture",
  54912. fn: function (){
  54913. var self=this,$self=this;
  54914. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54915. },
  54916. args: [],
  54917. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54918. referencedClasses: [],
  54919. messageSends: []
  54920. }),
  54921. $globals.HashedCollectionTest);
  54922. $core.addMethod(
  54923. $core.method({
  54924. selector: "collectionWithNewValue",
  54925. protocol: "fixture",
  54926. fn: function (){
  54927. var self=this,$self=this;
  54928. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54929. },
  54930. args: [],
  54931. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54932. referencedClasses: [],
  54933. messageSends: []
  54934. }),
  54935. $globals.HashedCollectionTest);
  54936. $core.addMethod(
  54937. $core.method({
  54938. selector: "sampleNewValueAsCollection",
  54939. protocol: "fixture",
  54940. fn: function (){
  54941. var self=this,$self=this;
  54942. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54943. },
  54944. args: [],
  54945. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54946. referencedClasses: [],
  54947. messageSends: []
  54948. }),
  54949. $globals.HashedCollectionTest);
  54950. $core.addMethod(
  54951. $core.method({
  54952. selector: "testDynamicDictionaries",
  54953. protocol: "tests",
  54954. fn: function (){
  54955. var self=this,$self=this;
  54956. return $core.withContext(function($ctx1) {
  54957. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54958. return self;
  54959. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54960. },
  54961. args: [],
  54962. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54963. referencedClasses: ["HashedCollection"],
  54964. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54965. }),
  54966. $globals.HashedCollectionTest);
  54967. $core.addMethod(
  54968. $core.method({
  54969. selector: "collectionClass",
  54970. protocol: "fixture",
  54971. fn: function (){
  54972. var self=this,$self=this;
  54973. return $globals.HashedCollection;
  54974. },
  54975. args: [],
  54976. source: "collectionClass\x0a\x09^ HashedCollection",
  54977. referencedClasses: ["HashedCollection"],
  54978. messageSends: []
  54979. }),
  54980. $globals.HashedCollectionTest.a$cls);
  54981. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54982. $core.addMethod(
  54983. $core.method({
  54984. selector: "collectionFirst",
  54985. protocol: "fixture",
  54986. fn: function (){
  54987. var self=this,$self=this;
  54988. return $core.withContext(function($ctx1) {
  54989. $self._subclassResponsibility();
  54990. return self;
  54991. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54992. },
  54993. args: [],
  54994. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54995. referencedClasses: [],
  54996. messageSends: ["subclassResponsibility"]
  54997. }),
  54998. $globals.SequenceableCollectionTest);
  54999. $core.addMethod(
  55000. $core.method({
  55001. selector: "collectionFirstTwo",
  55002. protocol: "fixture",
  55003. fn: function (){
  55004. var self=this,$self=this;
  55005. return $core.withContext(function($ctx1) {
  55006. $self._subclassResponsibility();
  55007. return self;
  55008. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55009. },
  55010. args: [],
  55011. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55012. referencedClasses: [],
  55013. messageSends: ["subclassResponsibility"]
  55014. }),
  55015. $globals.SequenceableCollectionTest);
  55016. $core.addMethod(
  55017. $core.method({
  55018. selector: "collectionLast",
  55019. protocol: "fixture",
  55020. fn: function (){
  55021. var self=this,$self=this;
  55022. return $core.withContext(function($ctx1) {
  55023. $self._subclassResponsibility();
  55024. return self;
  55025. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55026. },
  55027. args: [],
  55028. source: "collectionLast\x0a\x09self subclassResponsibility",
  55029. referencedClasses: [],
  55030. messageSends: ["subclassResponsibility"]
  55031. }),
  55032. $globals.SequenceableCollectionTest);
  55033. $core.addMethod(
  55034. $core.method({
  55035. selector: "collectionLastTwo",
  55036. protocol: "fixture",
  55037. fn: function (){
  55038. var self=this,$self=this;
  55039. return $core.withContext(function($ctx1) {
  55040. $self._subclassResponsibility();
  55041. return self;
  55042. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55043. },
  55044. args: [],
  55045. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55046. referencedClasses: [],
  55047. messageSends: ["subclassResponsibility"]
  55048. }),
  55049. $globals.SequenceableCollectionTest);
  55050. $core.addMethod(
  55051. $core.method({
  55052. selector: "nonIndexesDo:",
  55053. protocol: "fixture",
  55054. fn: function (aBlock){
  55055. var self=this,$self=this;
  55056. return $core.withContext(function($ctx1) {
  55057. $recv(aBlock)._value_((0));
  55058. $ctx1.sendIdx["value:"]=1;
  55059. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55060. $ctx1.sendIdx["value:"]=2;
  55061. $recv(aBlock)._value_("z");
  55062. return self;
  55063. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55064. },
  55065. args: ["aBlock"],
  55066. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55067. referencedClasses: [],
  55068. messageSends: ["value:", "+", "collectionSize"]
  55069. }),
  55070. $globals.SequenceableCollectionTest);
  55071. $core.addMethod(
  55072. $core.method({
  55073. selector: "samplesDo:",
  55074. protocol: "fixture",
  55075. fn: function (aBlock){
  55076. var self=this,$self=this;
  55077. return $core.withContext(function($ctx1) {
  55078. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55079. $ctx1.sendIdx["value:value:"]=1;
  55080. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55081. return self;
  55082. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55083. },
  55084. args: ["aBlock"],
  55085. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55086. referencedClasses: [],
  55087. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55088. }),
  55089. $globals.SequenceableCollectionTest);
  55090. $core.addMethod(
  55091. $core.method({
  55092. selector: "testBeginsWith",
  55093. protocol: "tests",
  55094. fn: function (){
  55095. var self=this,$self=this;
  55096. return $core.withContext(function($ctx1) {
  55097. var $2,$1,$4,$5,$3,$7,$6;
  55098. $2=$self._collection();
  55099. $ctx1.sendIdx["collection"]=1;
  55100. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55101. $ctx1.sendIdx["beginsWith:"]=1;
  55102. $self._assert_($1);
  55103. $ctx1.sendIdx["assert:"]=1;
  55104. $4=$self._collection();
  55105. $ctx1.sendIdx["collection"]=2;
  55106. $5=$self._collection();
  55107. $ctx1.sendIdx["collection"]=3;
  55108. $3=$recv($4)._beginsWith_($5);
  55109. $ctx1.sendIdx["beginsWith:"]=2;
  55110. $self._assert_($3);
  55111. $ctx1.sendIdx["assert:"]=2;
  55112. $7=$self._collection();
  55113. $ctx1.sendIdx["collection"]=4;
  55114. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55115. $ctx1.sendIdx["beginsWith:"]=3;
  55116. $self._assert_($6);
  55117. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55118. return self;
  55119. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55120. },
  55121. args: [],
  55122. 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)",
  55123. referencedClasses: [],
  55124. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55125. }),
  55126. $globals.SequenceableCollectionTest);
  55127. $core.addMethod(
  55128. $core.method({
  55129. selector: "testEndsWith",
  55130. protocol: "tests",
  55131. fn: function (){
  55132. var self=this,$self=this;
  55133. return $core.withContext(function($ctx1) {
  55134. var $2,$1,$4,$5,$3,$7,$6;
  55135. $2=$self._collection();
  55136. $ctx1.sendIdx["collection"]=1;
  55137. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55138. $ctx1.sendIdx["endsWith:"]=1;
  55139. $self._assert_($1);
  55140. $ctx1.sendIdx["assert:"]=1;
  55141. $4=$self._collection();
  55142. $ctx1.sendIdx["collection"]=2;
  55143. $5=$self._collection();
  55144. $ctx1.sendIdx["collection"]=3;
  55145. $3=$recv($4)._endsWith_($5);
  55146. $ctx1.sendIdx["endsWith:"]=2;
  55147. $self._assert_($3);
  55148. $ctx1.sendIdx["assert:"]=2;
  55149. $7=$self._collection();
  55150. $ctx1.sendIdx["collection"]=4;
  55151. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55152. $ctx1.sendIdx["endsWith:"]=3;
  55153. $self._assert_($6);
  55154. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55155. return self;
  55156. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55157. },
  55158. args: [],
  55159. 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)",
  55160. referencedClasses: [],
  55161. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55162. }),
  55163. $globals.SequenceableCollectionTest);
  55164. $core.addMethod(
  55165. $core.method({
  55166. selector: "testFirst",
  55167. protocol: "tests",
  55168. fn: function (){
  55169. var self=this,$self=this;
  55170. return $core.withContext(function($ctx1) {
  55171. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55172. return self;
  55173. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55174. },
  55175. args: [],
  55176. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55177. referencedClasses: [],
  55178. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55179. }),
  55180. $globals.SequenceableCollectionTest);
  55181. $core.addMethod(
  55182. $core.method({
  55183. selector: "testFirstN",
  55184. protocol: "tests",
  55185. fn: function (){
  55186. var self=this,$self=this;
  55187. return $core.withContext(function($ctx1) {
  55188. var $2,$1,$4,$3,$6,$5,$7;
  55189. $2=$self._collection();
  55190. $ctx1.sendIdx["collection"]=1;
  55191. $1=$recv($2)._first_((2));
  55192. $ctx1.sendIdx["first:"]=1;
  55193. $self._assert_equals_($1,$self._collectionFirstTwo());
  55194. $ctx1.sendIdx["assert:equals:"]=1;
  55195. $4=$self._collection();
  55196. $ctx1.sendIdx["collection"]=2;
  55197. $3=$recv($4)._first_((0));
  55198. $ctx1.sendIdx["first:"]=2;
  55199. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55200. $ctx1.sendIdx["assert:equals:"]=2;
  55201. $6=$self._collection();
  55202. $ctx1.sendIdx["collection"]=3;
  55203. $5=$recv($6)._first_($self._collectionSize());
  55204. $ctx1.sendIdx["first:"]=3;
  55205. $7=$self._collection();
  55206. $ctx1.sendIdx["collection"]=4;
  55207. $self._assert_equals_($5,$7);
  55208. $self._should_raise_((function(){
  55209. return $core.withContext(function($ctx2) {
  55210. return $recv($self._collection())._first_((33));
  55211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55212. }),$globals.Error);
  55213. return self;
  55214. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55215. },
  55216. args: [],
  55217. 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",
  55218. referencedClasses: ["Error"],
  55219. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55220. }),
  55221. $globals.SequenceableCollectionTest);
  55222. $core.addMethod(
  55223. $core.method({
  55224. selector: "testFourth",
  55225. protocol: "tests",
  55226. fn: function (){
  55227. var self=this,$self=this;
  55228. return $core.withContext(function($ctx1) {
  55229. var $2,$1;
  55230. $2=$self._collection();
  55231. $ctx1.sendIdx["collection"]=1;
  55232. $1=$recv($2)._fourth();
  55233. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55234. return self;
  55235. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55236. },
  55237. args: [],
  55238. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55239. referencedClasses: [],
  55240. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55241. }),
  55242. $globals.SequenceableCollectionTest);
  55243. $core.addMethod(
  55244. $core.method({
  55245. selector: "testIndexOfStartingAt",
  55246. protocol: "tests",
  55247. fn: function (){
  55248. var self=this,$self=this;
  55249. var jsNull;
  55250. return $core.withContext(function($ctx1) {
  55251. var $2,$1,$4,$3;
  55252. jsNull=$recv($globals.JSON)._parse_("null");
  55253. $self._samplesDo_((function(index,value){
  55254. return $core.withContext(function($ctx2) {
  55255. $2=$self._collection();
  55256. $ctx2.sendIdx["collection"]=1;
  55257. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55258. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55259. $self._assert_equals_($1,index);
  55260. $ctx2.sendIdx["assert:equals:"]=1;
  55261. $4=$self._collection();
  55262. $ctx2.sendIdx["collection"]=2;
  55263. $3=$recv($4)._indexOf_startingAt_(value,index);
  55264. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55265. $self._assert_equals_($3,index);
  55266. $ctx2.sendIdx["assert:equals:"]=2;
  55267. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55268. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55269. }));
  55270. return self;
  55271. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55272. },
  55273. args: [],
  55274. 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 ]",
  55275. referencedClasses: ["JSON"],
  55276. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55277. }),
  55278. $globals.SequenceableCollectionTest);
  55279. $core.addMethod(
  55280. $core.method({
  55281. selector: "testIndexOfStartingAtWithNull",
  55282. protocol: "tests",
  55283. fn: function (){
  55284. var self=this,$self=this;
  55285. var jsNull;
  55286. return $core.withContext(function($ctx1) {
  55287. var $1,$2;
  55288. jsNull=$recv($globals.JSON)._parse_("null");
  55289. $self._samplesDo_((function(index,value){
  55290. var collection;
  55291. return $core.withContext(function($ctx2) {
  55292. collection=$self._collection();
  55293. $recv(collection)._at_put_(index,jsNull);
  55294. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55295. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55296. $self._assert_equals_($1,index);
  55297. $ctx2.sendIdx["assert:equals:"]=1;
  55298. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55299. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55300. $self._assert_equals_($2,index);
  55301. $ctx2.sendIdx["assert:equals:"]=2;
  55302. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55303. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55304. }));
  55305. return self;
  55306. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55307. },
  55308. args: [],
  55309. 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 ]",
  55310. referencedClasses: ["JSON"],
  55311. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55312. }),
  55313. $globals.SequenceableCollectionTest);
  55314. $core.addMethod(
  55315. $core.method({
  55316. selector: "testLast",
  55317. protocol: "tests",
  55318. fn: function (){
  55319. var self=this,$self=this;
  55320. return $core.withContext(function($ctx1) {
  55321. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55322. return self;
  55323. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55324. },
  55325. args: [],
  55326. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55327. referencedClasses: [],
  55328. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55329. }),
  55330. $globals.SequenceableCollectionTest);
  55331. $core.addMethod(
  55332. $core.method({
  55333. selector: "testLastN",
  55334. protocol: "tests",
  55335. fn: function (){
  55336. var self=this,$self=this;
  55337. return $core.withContext(function($ctx1) {
  55338. var $2,$1,$4,$3,$6,$5,$7;
  55339. $2=$self._collection();
  55340. $ctx1.sendIdx["collection"]=1;
  55341. $1=$recv($2)._last_((2));
  55342. $ctx1.sendIdx["last:"]=1;
  55343. $self._assert_equals_($1,$self._collectionLastTwo());
  55344. $ctx1.sendIdx["assert:equals:"]=1;
  55345. $4=$self._collection();
  55346. $ctx1.sendIdx["collection"]=2;
  55347. $3=$recv($4)._last_((0));
  55348. $ctx1.sendIdx["last:"]=2;
  55349. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55350. $ctx1.sendIdx["assert:equals:"]=2;
  55351. $6=$self._collection();
  55352. $ctx1.sendIdx["collection"]=3;
  55353. $5=$recv($6)._last_($self._collectionSize());
  55354. $ctx1.sendIdx["last:"]=3;
  55355. $7=$self._collection();
  55356. $ctx1.sendIdx["collection"]=4;
  55357. $self._assert_equals_($5,$7);
  55358. $self._should_raise_((function(){
  55359. return $core.withContext(function($ctx2) {
  55360. return $recv($self._collection())._last_((33));
  55361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55362. }),$globals.Error);
  55363. return self;
  55364. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55365. },
  55366. args: [],
  55367. 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",
  55368. referencedClasses: ["Error"],
  55369. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55370. }),
  55371. $globals.SequenceableCollectionTest);
  55372. $core.addMethod(
  55373. $core.method({
  55374. selector: "testSecond",
  55375. protocol: "tests",
  55376. fn: function (){
  55377. var self=this,$self=this;
  55378. return $core.withContext(function($ctx1) {
  55379. var $2,$1;
  55380. $2=$self._collection();
  55381. $ctx1.sendIdx["collection"]=1;
  55382. $1=$recv($2)._second();
  55383. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55384. return self;
  55385. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55386. },
  55387. args: [],
  55388. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55389. referencedClasses: [],
  55390. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55391. }),
  55392. $globals.SequenceableCollectionTest);
  55393. $core.addMethod(
  55394. $core.method({
  55395. selector: "testThird",
  55396. protocol: "tests",
  55397. fn: function (){
  55398. var self=this,$self=this;
  55399. return $core.withContext(function($ctx1) {
  55400. var $2,$1;
  55401. $2=$self._collection();
  55402. $ctx1.sendIdx["collection"]=1;
  55403. $1=$recv($2)._third();
  55404. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55405. return self;
  55406. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55407. },
  55408. args: [],
  55409. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55410. referencedClasses: [],
  55411. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55412. }),
  55413. $globals.SequenceableCollectionTest);
  55414. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55415. $core.addMethod(
  55416. $core.method({
  55417. selector: "collection",
  55418. protocol: "fixture",
  55419. fn: function (){
  55420. var self=this,$self=this;
  55421. return [(1), (2), (3), (-4)];
  55422. },
  55423. args: [],
  55424. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55425. referencedClasses: [],
  55426. messageSends: []
  55427. }),
  55428. $globals.ArrayTest);
  55429. $core.addMethod(
  55430. $core.method({
  55431. selector: "collectionFirst",
  55432. protocol: "fixture",
  55433. fn: function (){
  55434. var self=this,$self=this;
  55435. return (1);
  55436. },
  55437. args: [],
  55438. source: "collectionFirst\x0a\x09^ 1",
  55439. referencedClasses: [],
  55440. messageSends: []
  55441. }),
  55442. $globals.ArrayTest);
  55443. $core.addMethod(
  55444. $core.method({
  55445. selector: "collectionFirstTwo",
  55446. protocol: "fixture",
  55447. fn: function (){
  55448. var self=this,$self=this;
  55449. return [(1), (2)];
  55450. },
  55451. args: [],
  55452. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55453. referencedClasses: [],
  55454. messageSends: []
  55455. }),
  55456. $globals.ArrayTest);
  55457. $core.addMethod(
  55458. $core.method({
  55459. selector: "collectionLast",
  55460. protocol: "fixture",
  55461. fn: function (){
  55462. var self=this,$self=this;
  55463. return (-4);
  55464. },
  55465. args: [],
  55466. source: "collectionLast\x0a\x09^ -4",
  55467. referencedClasses: [],
  55468. messageSends: []
  55469. }),
  55470. $globals.ArrayTest);
  55471. $core.addMethod(
  55472. $core.method({
  55473. selector: "collectionLastTwo",
  55474. protocol: "fixture",
  55475. fn: function (){
  55476. var self=this,$self=this;
  55477. return [(3), (-4)];
  55478. },
  55479. args: [],
  55480. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55481. referencedClasses: [],
  55482. messageSends: []
  55483. }),
  55484. $globals.ArrayTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "collectionOfPrintStrings",
  55488. protocol: "fixture",
  55489. fn: function (){
  55490. var self=this,$self=this;
  55491. return ["1", "2", "3", "-4"];
  55492. },
  55493. args: [],
  55494. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55495. referencedClasses: [],
  55496. messageSends: []
  55497. }),
  55498. $globals.ArrayTest);
  55499. $core.addMethod(
  55500. $core.method({
  55501. selector: "collectionSize",
  55502. protocol: "fixture",
  55503. fn: function (){
  55504. var self=this,$self=this;
  55505. return (4);
  55506. },
  55507. args: [],
  55508. source: "collectionSize\x0a\x09^ 4",
  55509. referencedClasses: [],
  55510. messageSends: []
  55511. }),
  55512. $globals.ArrayTest);
  55513. $core.addMethod(
  55514. $core.method({
  55515. selector: "collectionWithDuplicates",
  55516. protocol: "fixture",
  55517. fn: function (){
  55518. var self=this,$self=this;
  55519. return ["a", "b", "c", (1), (2), (1), "a", []];
  55520. },
  55521. args: [],
  55522. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55523. referencedClasses: [],
  55524. messageSends: []
  55525. }),
  55526. $globals.ArrayTest);
  55527. $core.addMethod(
  55528. $core.method({
  55529. selector: "collectionWithNewValue",
  55530. protocol: "fixture",
  55531. fn: function (){
  55532. var self=this,$self=this;
  55533. return [(1), (2), (3), (-4), "N"];
  55534. },
  55535. args: [],
  55536. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55537. referencedClasses: [],
  55538. messageSends: []
  55539. }),
  55540. $globals.ArrayTest);
  55541. $core.addMethod(
  55542. $core.method({
  55543. selector: "sampleNewIndex",
  55544. protocol: "fixture",
  55545. fn: function (){
  55546. var self=this,$self=this;
  55547. return (5);
  55548. },
  55549. args: [],
  55550. source: "sampleNewIndex\x0a\x09^ 5",
  55551. referencedClasses: [],
  55552. messageSends: []
  55553. }),
  55554. $globals.ArrayTest);
  55555. $core.addMethod(
  55556. $core.method({
  55557. selector: "samplesDo:",
  55558. protocol: "fixture",
  55559. fn: function (aBlock){
  55560. var self=this,$self=this;
  55561. return $core.withContext(function($ctx1) {
  55562. (
  55563. $ctx1.supercall = true,
  55564. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55565. $ctx1.supercall = false;
  55566. $recv(aBlock)._value_value_((3),(3));
  55567. return self;
  55568. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55569. },
  55570. args: ["aBlock"],
  55571. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55572. referencedClasses: [],
  55573. messageSends: ["samplesDo:", "value:value:"]
  55574. }),
  55575. $globals.ArrayTest);
  55576. $core.addMethod(
  55577. $core.method({
  55578. selector: "testAdd",
  55579. protocol: "tests",
  55580. fn: function (){
  55581. var self=this,$self=this;
  55582. var array;
  55583. return $core.withContext(function($ctx1) {
  55584. array=$self._collection();
  55585. $recv(array)._add_((6));
  55586. $self._assert_equals_($recv(array)._last(),(6));
  55587. return self;
  55588. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55589. },
  55590. args: [],
  55591. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55592. referencedClasses: [],
  55593. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55594. }),
  55595. $globals.ArrayTest);
  55596. $core.addMethod(
  55597. $core.method({
  55598. selector: "testAddFirst",
  55599. protocol: "tests",
  55600. fn: function (){
  55601. var self=this,$self=this;
  55602. return $core.withContext(function($ctx1) {
  55603. var $3,$2,$1;
  55604. $3=$self._collection();
  55605. $recv($3)._addFirst_((0));
  55606. $2=$recv($3)._yourself();
  55607. $1=$recv($2)._first();
  55608. $self._assert_equals_($1,(0));
  55609. return self;
  55610. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55611. },
  55612. args: [],
  55613. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55614. referencedClasses: [],
  55615. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55616. }),
  55617. $globals.ArrayTest);
  55618. $core.addMethod(
  55619. $core.method({
  55620. selector: "testPrintString",
  55621. protocol: "tests",
  55622. fn: function (){
  55623. var self=this,$self=this;
  55624. var array;
  55625. return $core.withContext(function($ctx1) {
  55626. var $1,$2,$3,$4,$5,$6,$7,$8;
  55627. array=$recv($globals.Array)._new();
  55628. $1=$recv(array)._printString();
  55629. $ctx1.sendIdx["printString"]=1;
  55630. $self._assert_equals_($1,"an Array ()");
  55631. $ctx1.sendIdx["assert:equals:"]=1;
  55632. $2=array;
  55633. $recv($2)._add_((1));
  55634. $ctx1.sendIdx["add:"]=1;
  55635. $3=$recv($2)._add_((3));
  55636. $ctx1.sendIdx["add:"]=2;
  55637. $4=$recv(array)._printString();
  55638. $ctx1.sendIdx["printString"]=2;
  55639. $self._assert_equals_($4,"an Array (1 3)");
  55640. $ctx1.sendIdx["assert:equals:"]=2;
  55641. $recv(array)._add_("foo");
  55642. $5=$recv(array)._printString();
  55643. $ctx1.sendIdx["printString"]=3;
  55644. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55645. $ctx1.sendIdx["assert:equals:"]=3;
  55646. $6=array;
  55647. $recv($6)._remove_((1));
  55648. $ctx1.sendIdx["remove:"]=1;
  55649. $recv($6)._remove_((3));
  55650. $7=$recv(array)._printString();
  55651. $ctx1.sendIdx["printString"]=4;
  55652. $self._assert_equals_($7,"an Array ('foo')");
  55653. $ctx1.sendIdx["assert:equals:"]=4;
  55654. $recv(array)._addLast_((3));
  55655. $ctx1.sendIdx["addLast:"]=1;
  55656. $8=$recv(array)._printString();
  55657. $ctx1.sendIdx["printString"]=5;
  55658. $self._assert_equals_($8,"an Array ('foo' 3)");
  55659. $ctx1.sendIdx["assert:equals:"]=5;
  55660. $recv(array)._addLast_((3));
  55661. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55662. return self;
  55663. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55664. },
  55665. args: [],
  55666. 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)'.",
  55667. referencedClasses: ["Array"],
  55668. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55669. }),
  55670. $globals.ArrayTest);
  55671. $core.addMethod(
  55672. $core.method({
  55673. selector: "testRemove",
  55674. protocol: "tests",
  55675. fn: function (){
  55676. var self=this,$self=this;
  55677. var array;
  55678. return $core.withContext(function($ctx1) {
  55679. array=[(1), (2), (3), (4), (5)];
  55680. $recv(array)._remove_((3));
  55681. $ctx1.sendIdx["remove:"]=1;
  55682. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55683. $self._should_raise_((function(){
  55684. return $core.withContext(function($ctx2) {
  55685. return $recv(array)._remove_((3));
  55686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55687. }),$globals.Error);
  55688. return self;
  55689. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55690. },
  55691. args: [],
  55692. 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",
  55693. referencedClasses: ["Error"],
  55694. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55695. }),
  55696. $globals.ArrayTest);
  55697. $core.addMethod(
  55698. $core.method({
  55699. selector: "testRemoveFromTo",
  55700. protocol: "tests",
  55701. fn: function (){
  55702. var self=this,$self=this;
  55703. return $core.withContext(function($ctx1) {
  55704. var $1,$2;
  55705. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55706. $ctx1.sendIdx["removeFrom:to:"]=1;
  55707. $self._assert_equals_($1,[(4)]);
  55708. $ctx1.sendIdx["assert:equals:"]=1;
  55709. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55710. $ctx1.sendIdx["removeFrom:to:"]=2;
  55711. $self._assert_equals_($2,[(1), (4)]);
  55712. $ctx1.sendIdx["assert:equals:"]=2;
  55713. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55714. return self;
  55715. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55716. },
  55717. args: [],
  55718. 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)",
  55719. referencedClasses: [],
  55720. messageSends: ["assert:equals:", "removeFrom:to:"]
  55721. }),
  55722. $globals.ArrayTest);
  55723. $core.addMethod(
  55724. $core.method({
  55725. selector: "testRemoveIndex",
  55726. protocol: "tests",
  55727. fn: function (){
  55728. var self=this,$self=this;
  55729. return $core.withContext(function($ctx1) {
  55730. var $1,$2;
  55731. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55732. $ctx1.sendIdx["removeIndex:"]=1;
  55733. $self._assert_equals_($1,[(1), (3), (4)]);
  55734. $ctx1.sendIdx["assert:equals:"]=1;
  55735. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55736. $ctx1.sendIdx["removeIndex:"]=2;
  55737. $self._assert_equals_($2,[(2), (3), (4)]);
  55738. $ctx1.sendIdx["assert:equals:"]=2;
  55739. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55740. return self;
  55741. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55742. },
  55743. args: [],
  55744. 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: #()",
  55745. referencedClasses: [],
  55746. messageSends: ["assert:equals:", "removeIndex:"]
  55747. }),
  55748. $globals.ArrayTest);
  55749. $core.addMethod(
  55750. $core.method({
  55751. selector: "testRemoveLast",
  55752. protocol: "tests",
  55753. fn: function (){
  55754. var self=this,$self=this;
  55755. var array;
  55756. return $core.withContext(function($ctx1) {
  55757. array=[(1), (2)];
  55758. $recv(array)._removeLast();
  55759. $self._assert_equals_($recv(array)._last(),(1));
  55760. return self;
  55761. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55762. },
  55763. args: [],
  55764. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55765. referencedClasses: [],
  55766. messageSends: ["removeLast", "assert:equals:", "last"]
  55767. }),
  55768. $globals.ArrayTest);
  55769. $core.addMethod(
  55770. $core.method({
  55771. selector: "testReversed",
  55772. protocol: "tests",
  55773. fn: function (){
  55774. var self=this,$self=this;
  55775. var array;
  55776. return $core.withContext(function($ctx1) {
  55777. array=[(5), (4), (3), (2), (1)];
  55778. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55779. return self;
  55780. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55781. },
  55782. args: [],
  55783. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55784. referencedClasses: [],
  55785. messageSends: ["assert:equals:", "reversed"]
  55786. }),
  55787. $globals.ArrayTest);
  55788. $core.addMethod(
  55789. $core.method({
  55790. selector: "testSort",
  55791. protocol: "tests",
  55792. fn: function (){
  55793. var self=this,$self=this;
  55794. var array;
  55795. return $core.withContext(function($ctx1) {
  55796. array=[(10), (1), (5)];
  55797. $recv(array)._sort();
  55798. $self._assert_equals_(array,[(1), (5), (10)]);
  55799. return self;
  55800. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55801. },
  55802. args: [],
  55803. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55804. referencedClasses: [],
  55805. messageSends: ["sort", "assert:equals:"]
  55806. }),
  55807. $globals.ArrayTest);
  55808. $core.addMethod(
  55809. $core.method({
  55810. selector: "collectionClass",
  55811. protocol: "fixture",
  55812. fn: function (){
  55813. var self=this,$self=this;
  55814. return $globals.Array;
  55815. },
  55816. args: [],
  55817. source: "collectionClass\x0a\x09^ Array",
  55818. referencedClasses: ["Array"],
  55819. messageSends: []
  55820. }),
  55821. $globals.ArrayTest.a$cls);
  55822. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55823. $core.addMethod(
  55824. $core.method({
  55825. selector: "collection",
  55826. protocol: "fixture",
  55827. fn: function (){
  55828. var self=this,$self=this;
  55829. return "helLo";
  55830. },
  55831. args: [],
  55832. source: "collection\x0a\x09^ 'helLo'",
  55833. referencedClasses: [],
  55834. messageSends: []
  55835. }),
  55836. $globals.StringTest);
  55837. $core.addMethod(
  55838. $core.method({
  55839. selector: "collectionFirst",
  55840. protocol: "fixture",
  55841. fn: function (){
  55842. var self=this,$self=this;
  55843. return "h";
  55844. },
  55845. args: [],
  55846. source: "collectionFirst\x0a\x09^ 'h'",
  55847. referencedClasses: [],
  55848. messageSends: []
  55849. }),
  55850. $globals.StringTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "collectionFirstTwo",
  55854. protocol: "fixture",
  55855. fn: function (){
  55856. var self=this,$self=this;
  55857. return "he";
  55858. },
  55859. args: [],
  55860. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55861. referencedClasses: [],
  55862. messageSends: []
  55863. }),
  55864. $globals.StringTest);
  55865. $core.addMethod(
  55866. $core.method({
  55867. selector: "collectionLast",
  55868. protocol: "fixture",
  55869. fn: function (){
  55870. var self=this,$self=this;
  55871. return "o";
  55872. },
  55873. args: [],
  55874. source: "collectionLast\x0a\x09^ 'o'",
  55875. referencedClasses: [],
  55876. messageSends: []
  55877. }),
  55878. $globals.StringTest);
  55879. $core.addMethod(
  55880. $core.method({
  55881. selector: "collectionLastTwo",
  55882. protocol: "fixture",
  55883. fn: function (){
  55884. var self=this,$self=this;
  55885. return "Lo";
  55886. },
  55887. args: [],
  55888. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55889. referencedClasses: [],
  55890. messageSends: []
  55891. }),
  55892. $globals.StringTest);
  55893. $core.addMethod(
  55894. $core.method({
  55895. selector: "collectionOfPrintStrings",
  55896. protocol: "fixture",
  55897. fn: function (){
  55898. var self=this,$self=this;
  55899. return "'h''e''l''L''o'";
  55900. },
  55901. args: [],
  55902. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55903. referencedClasses: [],
  55904. messageSends: []
  55905. }),
  55906. $globals.StringTest);
  55907. $core.addMethod(
  55908. $core.method({
  55909. selector: "collectionSize",
  55910. protocol: "fixture",
  55911. fn: function (){
  55912. var self=this,$self=this;
  55913. return (5);
  55914. },
  55915. args: [],
  55916. source: "collectionSize\x0a\x09^ 5",
  55917. referencedClasses: [],
  55918. messageSends: []
  55919. }),
  55920. $globals.StringTest);
  55921. $core.addMethod(
  55922. $core.method({
  55923. selector: "collectionWithDuplicates",
  55924. protocol: "fixture",
  55925. fn: function (){
  55926. var self=this,$self=this;
  55927. return "abbaerten";
  55928. },
  55929. args: [],
  55930. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55931. referencedClasses: [],
  55932. messageSends: []
  55933. }),
  55934. $globals.StringTest);
  55935. $core.addMethod(
  55936. $core.method({
  55937. selector: "collectionWithNewValue",
  55938. protocol: "fixture",
  55939. fn: function (){
  55940. var self=this,$self=this;
  55941. return "helLoN";
  55942. },
  55943. args: [],
  55944. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55945. referencedClasses: [],
  55946. messageSends: []
  55947. }),
  55948. $globals.StringTest);
  55949. $core.addMethod(
  55950. $core.method({
  55951. selector: "sampleNewValueAsCollection",
  55952. protocol: "fixture",
  55953. fn: function (){
  55954. var self=this,$self=this;
  55955. return "N";
  55956. },
  55957. args: [],
  55958. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55959. referencedClasses: [],
  55960. messageSends: []
  55961. }),
  55962. $globals.StringTest);
  55963. $core.addMethod(
  55964. $core.method({
  55965. selector: "samplesDo:",
  55966. protocol: "fixture",
  55967. fn: function (aBlock){
  55968. var self=this,$self=this;
  55969. return $core.withContext(function($ctx1) {
  55970. (
  55971. $ctx1.supercall = true,
  55972. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55973. $ctx1.supercall = false;
  55974. $recv(aBlock)._value_value_((3),"l");
  55975. return self;
  55976. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55977. },
  55978. args: ["aBlock"],
  55979. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55980. referencedClasses: [],
  55981. messageSends: ["samplesDo:", "value:value:"]
  55982. }),
  55983. $globals.StringTest);
  55984. $core.addMethod(
  55985. $core.method({
  55986. selector: "testAddAll",
  55987. protocol: "tests",
  55988. fn: function (){
  55989. var self=this,$self=this;
  55990. return $core.withContext(function($ctx1) {
  55991. var $1;
  55992. $self._should_raise_((function(){
  55993. return $core.withContext(function($ctx2) {
  55994. $1=$self._collection();
  55995. $ctx2.sendIdx["collection"]=1;
  55996. return $recv($1)._addAll_($self._collection());
  55997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55998. }),$globals.Error);
  55999. return self;
  56000. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56001. },
  56002. args: [],
  56003. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56004. referencedClasses: ["Error"],
  56005. messageSends: ["should:raise:", "addAll:", "collection"]
  56006. }),
  56007. $globals.StringTest);
  56008. $core.addMethod(
  56009. $core.method({
  56010. selector: "testAddRemove",
  56011. protocol: "tests",
  56012. fn: function (){
  56013. var self=this,$self=this;
  56014. return $core.withContext(function($ctx1) {
  56015. $self._should_raise_((function(){
  56016. return $core.withContext(function($ctx2) {
  56017. return "hello"._add_("a");
  56018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56019. }),$globals.Error);
  56020. $ctx1.sendIdx["should:raise:"]=1;
  56021. $self._should_raise_((function(){
  56022. return $core.withContext(function($ctx2) {
  56023. return "hello"._remove_("h");
  56024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56025. }),$globals.Error);
  56026. return self;
  56027. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56028. },
  56029. args: [],
  56030. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56031. referencedClasses: ["Error"],
  56032. messageSends: ["should:raise:", "add:", "remove:"]
  56033. }),
  56034. $globals.StringTest);
  56035. $core.addMethod(
  56036. $core.method({
  56037. selector: "testAsArray",
  56038. protocol: "tests",
  56039. fn: function (){
  56040. var self=this,$self=this;
  56041. return $core.withContext(function($ctx1) {
  56042. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56043. return self;
  56044. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56045. },
  56046. args: [],
  56047. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56048. referencedClasses: [],
  56049. messageSends: ["assert:equals:", "asArray"]
  56050. }),
  56051. $globals.StringTest);
  56052. $core.addMethod(
  56053. $core.method({
  56054. selector: "testAsLowerCase",
  56055. protocol: "tests",
  56056. fn: function (){
  56057. var self=this,$self=this;
  56058. return $core.withContext(function($ctx1) {
  56059. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56060. return self;
  56061. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56062. },
  56063. args: [],
  56064. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56065. referencedClasses: [],
  56066. messageSends: ["assert:equals:", "asLowercase"]
  56067. }),
  56068. $globals.StringTest);
  56069. $core.addMethod(
  56070. $core.method({
  56071. selector: "testAsNumber",
  56072. protocol: "tests",
  56073. fn: function (){
  56074. var self=this,$self=this;
  56075. return $core.withContext(function($ctx1) {
  56076. var $1,$2;
  56077. $1="3"._asNumber();
  56078. $ctx1.sendIdx["asNumber"]=1;
  56079. $self._assert_equals_($1,(3));
  56080. $ctx1.sendIdx["assert:equals:"]=1;
  56081. $2="-3"._asNumber();
  56082. $ctx1.sendIdx["asNumber"]=2;
  56083. $self._assert_equals_($2,(-3));
  56084. $ctx1.sendIdx["assert:equals:"]=2;
  56085. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56086. return self;
  56087. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56088. },
  56089. args: [],
  56090. 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.",
  56091. referencedClasses: [],
  56092. messageSends: ["assert:equals:", "asNumber"]
  56093. }),
  56094. $globals.StringTest);
  56095. $core.addMethod(
  56096. $core.method({
  56097. selector: "testAsUpperCase",
  56098. protocol: "tests",
  56099. fn: function (){
  56100. var self=this,$self=this;
  56101. return $core.withContext(function($ctx1) {
  56102. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56103. return self;
  56104. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56105. },
  56106. args: [],
  56107. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56108. referencedClasses: [],
  56109. messageSends: ["assert:equals:", "asUppercase"]
  56110. }),
  56111. $globals.StringTest);
  56112. $core.addMethod(
  56113. $core.method({
  56114. selector: "testAsciiValue",
  56115. protocol: "tests",
  56116. fn: function (){
  56117. var self=this,$self=this;
  56118. var characterA,characterU;
  56119. return $core.withContext(function($ctx1) {
  56120. var $1;
  56121. characterA="A";
  56122. characterU="U";
  56123. $1=$recv(characterA)._asciiValue();
  56124. $ctx1.sendIdx["asciiValue"]=1;
  56125. $self._assert_equals_($1,(65));
  56126. $ctx1.sendIdx["assert:equals:"]=1;
  56127. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56128. return self;
  56129. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56130. },
  56131. args: [],
  56132. 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",
  56133. referencedClasses: [],
  56134. messageSends: ["assert:equals:", "asciiValue"]
  56135. }),
  56136. $globals.StringTest);
  56137. $core.addMethod(
  56138. $core.method({
  56139. selector: "testAtIfAbsentPut",
  56140. protocol: "tests",
  56141. fn: function (){
  56142. var self=this,$self=this;
  56143. return $core.withContext(function($ctx1) {
  56144. $self._should_raise_((function(){
  56145. return $core.withContext(function($ctx2) {
  56146. return "hello"._at_ifAbsentPut_((6),(function(){
  56147. return "a";
  56148. }));
  56149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56150. }),$globals.Error);
  56151. return self;
  56152. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56153. },
  56154. args: [],
  56155. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56156. referencedClasses: ["Error"],
  56157. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56158. }),
  56159. $globals.StringTest);
  56160. $core.addMethod(
  56161. $core.method({
  56162. selector: "testAtPut",
  56163. protocol: "tests",
  56164. fn: function (){
  56165. var self=this,$self=this;
  56166. return $core.withContext(function($ctx1) {
  56167. $self._should_raise_((function(){
  56168. return $core.withContext(function($ctx2) {
  56169. return "hello"._at_put_((1),"a");
  56170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56171. }),$globals.Error);
  56172. return self;
  56173. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56174. },
  56175. args: [],
  56176. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56177. referencedClasses: ["Error"],
  56178. messageSends: ["should:raise:", "at:put:"]
  56179. }),
  56180. $globals.StringTest);
  56181. $core.addMethod(
  56182. $core.method({
  56183. selector: "testCapitalized",
  56184. protocol: "tests",
  56185. fn: function (){
  56186. var self=this,$self=this;
  56187. return $core.withContext(function($ctx1) {
  56188. var $1,$2,$3;
  56189. $1="test"._capitalized();
  56190. $ctx1.sendIdx["capitalized"]=1;
  56191. $self._assert_equals_($1,"Test");
  56192. $ctx1.sendIdx["assert:equals:"]=1;
  56193. $2="Test"._capitalized();
  56194. $ctx1.sendIdx["capitalized"]=2;
  56195. $self._assert_equals_($2,"Test");
  56196. $ctx1.sendIdx["assert:equals:"]=2;
  56197. $self._assert_equals_(""._capitalized(),"");
  56198. $ctx1.sendIdx["assert:equals:"]=3;
  56199. $3="Test"._isCapitalized();
  56200. $ctx1.sendIdx["isCapitalized"]=1;
  56201. $self._assert_equals_($3,true);
  56202. $ctx1.sendIdx["assert:equals:"]=4;
  56203. $self._assert_equals_("test"._isCapitalized(),false);
  56204. return self;
  56205. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56206. },
  56207. args: [],
  56208. 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.",
  56209. referencedClasses: [],
  56210. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56211. }),
  56212. $globals.StringTest);
  56213. $core.addMethod(
  56214. $core.method({
  56215. selector: "testCharCodeAt",
  56216. protocol: "tests",
  56217. fn: function (){
  56218. var self=this,$self=this;
  56219. return $core.withContext(function($ctx1) {
  56220. var $1,$2,$3,$4,$5;
  56221. $1="jackie"._charCodeAt_((1));
  56222. $ctx1.sendIdx["charCodeAt:"]=1;
  56223. $self._assert_equals_($1,(106));
  56224. $ctx1.sendIdx["assert:equals:"]=1;
  56225. $2="jackie"._charCodeAt_((2));
  56226. $ctx1.sendIdx["charCodeAt:"]=2;
  56227. $self._assert_equals_($2,(97));
  56228. $ctx1.sendIdx["assert:equals:"]=2;
  56229. $3="jackie"._charCodeAt_((3));
  56230. $ctx1.sendIdx["charCodeAt:"]=3;
  56231. $self._assert_equals_($3,(99));
  56232. $ctx1.sendIdx["assert:equals:"]=3;
  56233. $4="jackie"._charCodeAt_((4));
  56234. $ctx1.sendIdx["charCodeAt:"]=4;
  56235. $self._assert_equals_($4,(107));
  56236. $ctx1.sendIdx["assert:equals:"]=4;
  56237. $5="jackie"._charCodeAt_((5));
  56238. $ctx1.sendIdx["charCodeAt:"]=5;
  56239. $self._assert_equals_($5,(105));
  56240. $ctx1.sendIdx["assert:equals:"]=5;
  56241. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56242. return self;
  56243. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56244. },
  56245. args: [],
  56246. 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",
  56247. referencedClasses: [],
  56248. messageSends: ["assert:equals:", "charCodeAt:"]
  56249. }),
  56250. $globals.StringTest);
  56251. $core.addMethod(
  56252. $core.method({
  56253. selector: "testCopyFromTo",
  56254. protocol: "tests",
  56255. fn: function (){
  56256. var self=this,$self=this;
  56257. return $core.withContext(function($ctx1) {
  56258. var $1;
  56259. $1="jackie"._copyFrom_to_((1),(3));
  56260. $ctx1.sendIdx["copyFrom:to:"]=1;
  56261. $self._assert_equals_($1,"jac");
  56262. $ctx1.sendIdx["assert:equals:"]=1;
  56263. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56264. return self;
  56265. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56266. },
  56267. args: [],
  56268. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56269. referencedClasses: [],
  56270. messageSends: ["assert:equals:", "copyFrom:to:"]
  56271. }),
  56272. $globals.StringTest);
  56273. $core.addMethod(
  56274. $core.method({
  56275. selector: "testCopySeparates",
  56276. protocol: "tests",
  56277. fn: function (){
  56278. var self=this,$self=this;
  56279. return $core.withContext(function($ctx1) {
  56280. var $3,$2,$1;
  56281. $3=$self._collection();
  56282. $ctx1.sendIdx["collection"]=1;
  56283. $2=$recv($3)._copy();
  56284. $1=$recv($2).__eq_eq($self._collection());
  56285. $self._assert_($1);
  56286. return self;
  56287. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56288. },
  56289. args: [],
  56290. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56291. referencedClasses: [],
  56292. messageSends: ["assert:", "==", "copy", "collection"]
  56293. }),
  56294. $globals.StringTest);
  56295. $core.addMethod(
  56296. $core.method({
  56297. selector: "testCopyWithoutAll",
  56298. protocol: "tests",
  56299. fn: function (){
  56300. var self=this,$self=this;
  56301. return $core.withContext(function($ctx1) {
  56302. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56303. return self;
  56304. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56305. },
  56306. args: [],
  56307. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56308. referencedClasses: [],
  56309. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56310. }),
  56311. $globals.StringTest);
  56312. $core.addMethod(
  56313. $core.method({
  56314. selector: "testEquality",
  56315. protocol: "tests",
  56316. fn: function (){
  56317. var self=this,$self=this;
  56318. return $core.withContext(function($ctx1) {
  56319. var $1,$2,$3;
  56320. $self._assert_equals_("hello","hello");
  56321. $ctx1.sendIdx["assert:equals:"]=1;
  56322. $1="hello".__eq("world");
  56323. $ctx1.sendIdx["="]=1;
  56324. $self._deny_($1);
  56325. $ctx1.sendIdx["deny:"]=1;
  56326. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56327. })));
  56328. $ctx1.sendIdx["="]=2;
  56329. $self._deny_($2);
  56330. $ctx1.sendIdx["deny:"]=2;
  56331. $3="hello"._yourself();
  56332. $ctx1.sendIdx["yourself"]=1;
  56333. $self._assert_equals_("hello",$3);
  56334. $ctx1.sendIdx["assert:equals:"]=2;
  56335. $self._assert_equals_("hello"._yourself(),"hello");
  56336. $self._deny_("".__eq((0)));
  56337. return self;
  56338. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56339. },
  56340. args: [],
  56341. 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",
  56342. referencedClasses: [],
  56343. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56344. }),
  56345. $globals.StringTest);
  56346. $core.addMethod(
  56347. $core.method({
  56348. selector: "testIdentity",
  56349. protocol: "tests",
  56350. fn: function (){
  56351. var self=this,$self=this;
  56352. return $core.withContext(function($ctx1) {
  56353. var $1,$2,$4,$3,$5;
  56354. $1="hello".__eq_eq("hello");
  56355. $ctx1.sendIdx["=="]=1;
  56356. $self._assert_($1);
  56357. $ctx1.sendIdx["assert:"]=1;
  56358. $2="hello".__eq_eq("world");
  56359. $ctx1.sendIdx["=="]=2;
  56360. $self._deny_($2);
  56361. $ctx1.sendIdx["deny:"]=1;
  56362. $4="hello"._yourself();
  56363. $ctx1.sendIdx["yourself"]=1;
  56364. $3="hello".__eq_eq($4);
  56365. $ctx1.sendIdx["=="]=3;
  56366. $self._assert_($3);
  56367. $ctx1.sendIdx["assert:"]=2;
  56368. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56369. $ctx1.sendIdx["=="]=4;
  56370. $self._assert_($5);
  56371. $self._deny_("".__eq_eq((0)));
  56372. return self;
  56373. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56374. },
  56375. args: [],
  56376. 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",
  56377. referencedClasses: [],
  56378. messageSends: ["assert:", "==", "deny:", "yourself"]
  56379. }),
  56380. $globals.StringTest);
  56381. $core.addMethod(
  56382. $core.method({
  56383. selector: "testIncludesSubString",
  56384. protocol: "tests",
  56385. fn: function (){
  56386. var self=this,$self=this;
  56387. return $core.withContext(function($ctx1) {
  56388. var $1;
  56389. $1="amber"._includesSubString_("ber");
  56390. $ctx1.sendIdx["includesSubString:"]=1;
  56391. $self._assert_($1);
  56392. $self._deny_("amber"._includesSubString_("zork"));
  56393. return self;
  56394. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56395. },
  56396. args: [],
  56397. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56398. referencedClasses: [],
  56399. messageSends: ["assert:", "includesSubString:", "deny:"]
  56400. }),
  56401. $globals.StringTest);
  56402. $core.addMethod(
  56403. $core.method({
  56404. selector: "testIndexOfStartingAtWithNull",
  56405. protocol: "tests",
  56406. fn: function (){
  56407. var self=this,$self=this;
  56408. return self;
  56409. },
  56410. args: [],
  56411. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56412. referencedClasses: [],
  56413. messageSends: []
  56414. }),
  56415. $globals.StringTest);
  56416. $core.addMethod(
  56417. $core.method({
  56418. selector: "testIndexOfWithNull",
  56419. protocol: "tests",
  56420. fn: function (){
  56421. var self=this,$self=this;
  56422. return self;
  56423. },
  56424. args: [],
  56425. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56426. referencedClasses: [],
  56427. messageSends: []
  56428. }),
  56429. $globals.StringTest);
  56430. $core.addMethod(
  56431. $core.method({
  56432. selector: "testIsVowel",
  56433. protocol: "tests",
  56434. fn: function (){
  56435. var self=this,$self=this;
  56436. var vowel,consonant;
  56437. return $core.withContext(function($ctx1) {
  56438. var $1;
  56439. vowel="u";
  56440. consonant="z";
  56441. $1=$recv(vowel)._isVowel();
  56442. $ctx1.sendIdx["isVowel"]=1;
  56443. $self._assert_equals_($1,true);
  56444. $ctx1.sendIdx["assert:equals:"]=1;
  56445. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56446. return self;
  56447. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56448. },
  56449. args: [],
  56450. 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",
  56451. referencedClasses: [],
  56452. messageSends: ["assert:equals:", "isVowel"]
  56453. }),
  56454. $globals.StringTest);
  56455. $core.addMethod(
  56456. $core.method({
  56457. selector: "testJoin",
  56458. protocol: "tests",
  56459. fn: function (){
  56460. var self=this,$self=this;
  56461. return $core.withContext(function($ctx1) {
  56462. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56463. return self;
  56464. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56465. },
  56466. args: [],
  56467. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56468. referencedClasses: [],
  56469. messageSends: ["assert:equals:", "join:"]
  56470. }),
  56471. $globals.StringTest);
  56472. $core.addMethod(
  56473. $core.method({
  56474. selector: "testRegression1224",
  56475. protocol: "tests",
  56476. fn: function (){
  56477. var self=this,$self=this;
  56478. return $core.withContext(function($ctx1) {
  56479. var $2,$1;
  56480. $self._should_raise_((function(){
  56481. return $core.withContext(function($ctx2) {
  56482. $2=$recv($self._collectionClass())._new();
  56483. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56484. }));
  56485. $1=$recv($2)._yourself();
  56486. return $recv($1)._size();
  56487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56488. }),$globals.Error);
  56489. return self;
  56490. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56491. },
  56492. args: [],
  56493. source: "testRegression1224\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size ] raise: Error",
  56494. referencedClasses: ["Error"],
  56495. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56496. }),
  56497. $globals.StringTest);
  56498. $core.addMethod(
  56499. $core.method({
  56500. selector: "testRemoveAll",
  56501. protocol: "tests",
  56502. fn: function (){
  56503. var self=this,$self=this;
  56504. return $core.withContext(function($ctx1) {
  56505. $self._should_raise_((function(){
  56506. return $core.withContext(function($ctx2) {
  56507. return $recv($self._collection())._removeAll();
  56508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56509. }),$globals.Error);
  56510. return self;
  56511. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56512. },
  56513. args: [],
  56514. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56515. referencedClasses: ["Error"],
  56516. messageSends: ["should:raise:", "removeAll", "collection"]
  56517. }),
  56518. $globals.StringTest);
  56519. $core.addMethod(
  56520. $core.method({
  56521. selector: "testReversed",
  56522. protocol: "tests",
  56523. fn: function (){
  56524. var self=this,$self=this;
  56525. return $core.withContext(function($ctx1) {
  56526. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56527. return self;
  56528. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56529. },
  56530. args: [],
  56531. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56532. referencedClasses: [],
  56533. messageSends: ["assert:equals:", "reversed"]
  56534. }),
  56535. $globals.StringTest);
  56536. $core.addMethod(
  56537. $core.method({
  56538. selector: "testStreamContents",
  56539. protocol: "tests",
  56540. fn: function (){
  56541. var self=this,$self=this;
  56542. return $core.withContext(function($ctx1) {
  56543. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56544. return $core.withContext(function($ctx2) {
  56545. $recv(aStream)._nextPutAll_("hello");
  56546. $ctx2.sendIdx["nextPutAll:"]=1;
  56547. $recv(aStream)._space();
  56548. return $recv(aStream)._nextPutAll_("world");
  56549. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56550. })),"hello world");
  56551. return self;
  56552. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56553. },
  56554. args: [],
  56555. 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'",
  56556. referencedClasses: ["String"],
  56557. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56558. }),
  56559. $globals.StringTest);
  56560. $core.addMethod(
  56561. $core.method({
  56562. selector: "testSubStrings",
  56563. protocol: "tests",
  56564. fn: function (){
  56565. var self=this,$self=this;
  56566. return $core.withContext(function($ctx1) {
  56567. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56568. return self;
  56569. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56570. },
  56571. args: [],
  56572. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56573. referencedClasses: [],
  56574. messageSends: ["assert:equals:", "subStrings:"]
  56575. }),
  56576. $globals.StringTest);
  56577. $core.addMethod(
  56578. $core.method({
  56579. selector: "testTrim",
  56580. protocol: "tests",
  56581. fn: function (){
  56582. var self=this,$self=this;
  56583. return $core.withContext(function($ctx1) {
  56584. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56585. $ctx1.sendIdx["assert:equals:"]=1;
  56586. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56587. return self;
  56588. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56589. },
  56590. args: [],
  56591. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56592. referencedClasses: [],
  56593. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56594. }),
  56595. $globals.StringTest);
  56596. $core.addMethod(
  56597. $core.method({
  56598. selector: "testValue",
  56599. protocol: "tests",
  56600. fn: function (){
  56601. var self=this,$self=this;
  56602. return $core.withContext(function($ctx1) {
  56603. $self._assert_equals_("asString"._value_((1)),"1");
  56604. $ctx1.sendIdx["assert:equals:"]=1;
  56605. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56606. return self;
  56607. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56608. },
  56609. args: [],
  56610. 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')",
  56611. referencedClasses: [],
  56612. messageSends: ["assert:equals:", "value:", "collect:"]
  56613. }),
  56614. $globals.StringTest);
  56615. $core.addMethod(
  56616. $core.method({
  56617. selector: "collectionClass",
  56618. protocol: "fixture",
  56619. fn: function (){
  56620. var self=this,$self=this;
  56621. return $globals.String;
  56622. },
  56623. args: [],
  56624. source: "collectionClass\x0a\x09^ String",
  56625. referencedClasses: ["String"],
  56626. messageSends: []
  56627. }),
  56628. $globals.StringTest.a$cls);
  56629. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "collection",
  56633. protocol: "fixture",
  56634. fn: function (){
  56635. var self=this,$self=this;
  56636. return $core.withContext(function($ctx1) {
  56637. var $1;
  56638. $1=$recv($globals.Set)._new();
  56639. $recv($1)._add_($globals.Smalltalk);
  56640. $ctx1.sendIdx["add:"]=1;
  56641. $recv($1)._add_(nil);
  56642. $ctx1.sendIdx["add:"]=2;
  56643. $recv($1)._add_((3).__at((3)));
  56644. $ctx1.sendIdx["add:"]=3;
  56645. $recv($1)._add_(false);
  56646. $ctx1.sendIdx["add:"]=4;
  56647. $recv($1)._add_($self["@sampleBlock"]);
  56648. return $recv($1)._yourself();
  56649. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56650. },
  56651. args: [],
  56652. 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",
  56653. referencedClasses: ["Set", "Smalltalk"],
  56654. messageSends: ["add:", "new", "@", "yourself"]
  56655. }),
  56656. $globals.SetTest);
  56657. $core.addMethod(
  56658. $core.method({
  56659. selector: "collectionOfPrintStrings",
  56660. protocol: "fixture",
  56661. fn: function (){
  56662. var self=this,$self=this;
  56663. return $core.withContext(function($ctx1) {
  56664. var $1;
  56665. $1=$recv($globals.Set)._new();
  56666. $recv($1)._add_("a SmalltalkImage");
  56667. $ctx1.sendIdx["add:"]=1;
  56668. $recv($1)._add_("nil");
  56669. $ctx1.sendIdx["add:"]=2;
  56670. $recv($1)._add_("3@3");
  56671. $ctx1.sendIdx["add:"]=3;
  56672. $recv($1)._add_("false");
  56673. $ctx1.sendIdx["add:"]=4;
  56674. $recv($1)._add_("a BlockClosure");
  56675. return $recv($1)._yourself();
  56676. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56677. },
  56678. args: [],
  56679. 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",
  56680. referencedClasses: ["Set"],
  56681. messageSends: ["add:", "new", "yourself"]
  56682. }),
  56683. $globals.SetTest);
  56684. $core.addMethod(
  56685. $core.method({
  56686. selector: "collectionSize",
  56687. protocol: "fixture",
  56688. fn: function (){
  56689. var self=this,$self=this;
  56690. return (5);
  56691. },
  56692. args: [],
  56693. source: "collectionSize\x0a\x09^ 5",
  56694. referencedClasses: [],
  56695. messageSends: []
  56696. }),
  56697. $globals.SetTest);
  56698. $core.addMethod(
  56699. $core.method({
  56700. selector: "collectionWithDuplicates",
  56701. protocol: "fixture",
  56702. fn: function (){
  56703. var self=this,$self=this;
  56704. return $core.withContext(function($ctx1) {
  56705. var $1;
  56706. $1=$self._collection();
  56707. $recv($1)._add_((0));
  56708. return $recv($1)._yourself();
  56709. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56710. },
  56711. args: [],
  56712. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56713. referencedClasses: [],
  56714. messageSends: ["add:", "collection", "yourself"]
  56715. }),
  56716. $globals.SetTest);
  56717. $core.addMethod(
  56718. $core.method({
  56719. selector: "collectionWithNewValue",
  56720. protocol: "fixture",
  56721. fn: function (){
  56722. var self=this,$self=this;
  56723. return $core.withContext(function($ctx1) {
  56724. var $1;
  56725. $1=$recv($globals.Set)._new();
  56726. $recv($1)._add_($globals.Smalltalk);
  56727. $ctx1.sendIdx["add:"]=1;
  56728. $recv($1)._add_(nil);
  56729. $ctx1.sendIdx["add:"]=2;
  56730. $recv($1)._add_((3).__at((3)));
  56731. $ctx1.sendIdx["add:"]=3;
  56732. $recv($1)._add_("N");
  56733. $ctx1.sendIdx["add:"]=4;
  56734. $recv($1)._add_(false);
  56735. $ctx1.sendIdx["add:"]=5;
  56736. $recv($1)._add_($self["@sampleBlock"]);
  56737. return $recv($1)._yourself();
  56738. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56739. },
  56740. args: [],
  56741. 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",
  56742. referencedClasses: ["Set", "Smalltalk"],
  56743. messageSends: ["add:", "new", "@", "yourself"]
  56744. }),
  56745. $globals.SetTest);
  56746. $core.addMethod(
  56747. $core.method({
  56748. selector: "testAddAll",
  56749. protocol: "tests",
  56750. fn: function (){
  56751. var self=this,$self=this;
  56752. return $core.withContext(function($ctx1) {
  56753. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56754. (
  56755. $ctx1.supercall = true,
  56756. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56757. $ctx1.supercall = false;
  56758. $2=$self._collection();
  56759. $ctx1.sendIdx["collection"]=1;
  56760. $3=$self._collection();
  56761. $ctx1.sendIdx["collection"]=2;
  56762. $recv($2)._addAll_($3);
  56763. $ctx1.sendIdx["addAll:"]=1;
  56764. $4=$recv($2)._yourself();
  56765. $ctx1.sendIdx["yourself"]=1;
  56766. $1=$4;
  56767. $5=$self._collection();
  56768. $ctx1.sendIdx["collection"]=3;
  56769. $self._assert_equals_($1,$5);
  56770. $ctx1.sendIdx["assert:equals:"]=1;
  56771. $7=$self._collection();
  56772. $ctx1.sendIdx["collection"]=4;
  56773. $8=$self._collectionWithNewValue();
  56774. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56775. $recv($7)._addAll_($8);
  56776. $ctx1.sendIdx["addAll:"]=2;
  56777. $9=$recv($7)._yourself();
  56778. $ctx1.sendIdx["yourself"]=2;
  56779. $6=$9;
  56780. $10=$self._collectionWithNewValue();
  56781. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56782. $self._assert_equals_($6,$10);
  56783. $ctx1.sendIdx["assert:equals:"]=2;
  56784. $12=$self._collectionWithNewValue();
  56785. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56786. $recv($12)._addAll_($self._collection());
  56787. $11=$recv($12)._yourself();
  56788. $self._assert_equals_($11,$self._collectionWithNewValue());
  56789. return self;
  56790. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56791. },
  56792. args: [],
  56793. 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",
  56794. referencedClasses: [],
  56795. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56796. }),
  56797. $globals.SetTest);
  56798. $core.addMethod(
  56799. $core.method({
  56800. selector: "testAddRemove",
  56801. protocol: "tests",
  56802. fn: function (){
  56803. var self=this,$self=this;
  56804. var set;
  56805. return $core.withContext(function($ctx1) {
  56806. var $1,$2;
  56807. set=$recv($globals.Set)._new();
  56808. $self._assert_($recv(set)._isEmpty());
  56809. $ctx1.sendIdx["assert:"]=1;
  56810. $recv(set)._add_((3));
  56811. $ctx1.sendIdx["add:"]=1;
  56812. $1=$recv(set)._includes_((3));
  56813. $ctx1.sendIdx["includes:"]=1;
  56814. $self._assert_($1);
  56815. $ctx1.sendIdx["assert:"]=2;
  56816. $recv(set)._add_((5));
  56817. $2=$recv(set)._includes_((5));
  56818. $ctx1.sendIdx["includes:"]=2;
  56819. $self._assert_($2);
  56820. $recv(set)._remove_((3));
  56821. $self._deny_($recv(set)._includes_((3)));
  56822. return self;
  56823. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56824. },
  56825. args: [],
  56826. 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)",
  56827. referencedClasses: ["Set"],
  56828. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56829. }),
  56830. $globals.SetTest);
  56831. $core.addMethod(
  56832. $core.method({
  56833. selector: "testAt",
  56834. protocol: "tests",
  56835. fn: function (){
  56836. var self=this,$self=this;
  56837. return $core.withContext(function($ctx1) {
  56838. $self._should_raise_((function(){
  56839. return $core.withContext(function($ctx2) {
  56840. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56842. }),$globals.Error);
  56843. return self;
  56844. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56845. },
  56846. args: [],
  56847. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56848. referencedClasses: ["Set", "Error"],
  56849. messageSends: ["should:raise:", "at:put:", "new"]
  56850. }),
  56851. $globals.SetTest);
  56852. $core.addMethod(
  56853. $core.method({
  56854. selector: "testCollect",
  56855. protocol: "tests",
  56856. fn: function (){
  56857. var self=this,$self=this;
  56858. return $core.withContext(function($ctx1) {
  56859. var $2,$1;
  56860. (
  56861. $ctx1.supercall = true,
  56862. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56863. $ctx1.supercall = false;
  56864. $2=[(5), (6), (8)]._asSet();
  56865. $ctx1.sendIdx["asSet"]=1;
  56866. $1=$recv($2)._collect_((function(x){
  56867. return $core.withContext(function($ctx2) {
  56868. return $recv(x).__backslash_backslash((3));
  56869. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56870. }));
  56871. $self._assert_equals_($1,[(0), (2)]._asSet());
  56872. return self;
  56873. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56874. },
  56875. args: [],
  56876. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56877. referencedClasses: [],
  56878. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56879. }),
  56880. $globals.SetTest);
  56881. $core.addMethod(
  56882. $core.method({
  56883. selector: "testComma",
  56884. protocol: "tests",
  56885. fn: function (){
  56886. var self=this,$self=this;
  56887. return $core.withContext(function($ctx1) {
  56888. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56889. (
  56890. $ctx1.supercall = true,
  56891. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56892. $ctx1.supercall = false;
  56893. $2=$self._collection();
  56894. $ctx1.sendIdx["collection"]=1;
  56895. $3=$self._collection();
  56896. $ctx1.sendIdx["collection"]=2;
  56897. $1=$recv($2).__comma($3);
  56898. $ctx1.sendIdx[","]=1;
  56899. $4=$self._collection();
  56900. $ctx1.sendIdx["collection"]=3;
  56901. $self._assert_equals_($1,$4);
  56902. $ctx1.sendIdx["assert:equals:"]=1;
  56903. $6=$self._collection();
  56904. $ctx1.sendIdx["collection"]=4;
  56905. $7=$self._collectionWithNewValue();
  56906. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56907. $5=$recv($6).__comma($7);
  56908. $ctx1.sendIdx[","]=2;
  56909. $8=$self._collectionWithNewValue();
  56910. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56911. $self._assert_equals_($5,$8);
  56912. $ctx1.sendIdx["assert:equals:"]=2;
  56913. $10=$self._collectionWithNewValue();
  56914. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56915. $9=$recv($10).__comma($self._collection());
  56916. $self._assert_equals_($9,$self._collectionWithNewValue());
  56917. return self;
  56918. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56919. },
  56920. args: [],
  56921. 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",
  56922. referencedClasses: [],
  56923. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56924. }),
  56925. $globals.SetTest);
  56926. $core.addMethod(
  56927. $core.method({
  56928. selector: "testComparing",
  56929. protocol: "tests",
  56930. fn: function (){
  56931. var self=this,$self=this;
  56932. return $core.withContext(function($ctx1) {
  56933. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56934. $1=[(0), (2)]._asSet();
  56935. $ctx1.sendIdx["asSet"]=1;
  56936. $2=[(0), (2)]._asSet();
  56937. $ctx1.sendIdx["asSet"]=2;
  56938. $self._assert_equals_($1,$2);
  56939. $ctx1.sendIdx["assert:equals:"]=1;
  56940. $3=[(2), (0)]._asSet();
  56941. $ctx1.sendIdx["asSet"]=3;
  56942. $4=[(0), (2)]._asSet();
  56943. $ctx1.sendIdx["asSet"]=4;
  56944. $self._assert_equals_($3,$4);
  56945. $6=[(0), (2), (3)]._asSet();
  56946. $ctx1.sendIdx["asSet"]=5;
  56947. $7=[(0), (2)]._asSet();
  56948. $ctx1.sendIdx["asSet"]=6;
  56949. $5=$recv($6).__eq($7);
  56950. $ctx1.sendIdx["="]=1;
  56951. $self._deny_($5);
  56952. $ctx1.sendIdx["deny:"]=1;
  56953. $9=[(1), (2)]._asSet();
  56954. $ctx1.sendIdx["asSet"]=7;
  56955. $8=$recv($9).__eq([(0), (2)]._asSet());
  56956. $self._deny_($8);
  56957. return self;
  56958. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56959. },
  56960. args: [],
  56961. 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",
  56962. referencedClasses: [],
  56963. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56964. }),
  56965. $globals.SetTest);
  56966. $core.addMethod(
  56967. $core.method({
  56968. selector: "testPrintString",
  56969. protocol: "tests",
  56970. fn: function (){
  56971. var self=this,$self=this;
  56972. var set;
  56973. return $core.withContext(function($ctx1) {
  56974. var $1,$2,$3,$4,$5,$6,$7,$8;
  56975. set=$recv($globals.Set)._new();
  56976. $1=$recv(set)._printString();
  56977. $ctx1.sendIdx["printString"]=1;
  56978. $self._assert_equals_($1,"a Set ()");
  56979. $ctx1.sendIdx["assert:equals:"]=1;
  56980. $2=set;
  56981. $recv($2)._add_((1));
  56982. $ctx1.sendIdx["add:"]=1;
  56983. $3=$recv($2)._add_((3));
  56984. $ctx1.sendIdx["add:"]=2;
  56985. $4=$recv(set)._printString();
  56986. $ctx1.sendIdx["printString"]=2;
  56987. $self._assert_equals_($4,"a Set (1 3)");
  56988. $ctx1.sendIdx["assert:equals:"]=2;
  56989. $recv(set)._add_("foo");
  56990. $ctx1.sendIdx["add:"]=3;
  56991. $5=$recv(set)._printString();
  56992. $ctx1.sendIdx["printString"]=3;
  56993. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56994. $ctx1.sendIdx["assert:equals:"]=3;
  56995. $6=set;
  56996. $recv($6)._remove_((1));
  56997. $ctx1.sendIdx["remove:"]=1;
  56998. $recv($6)._remove_((3));
  56999. $7=$recv(set)._printString();
  57000. $ctx1.sendIdx["printString"]=4;
  57001. $self._assert_equals_($7,"a Set ('foo')");
  57002. $ctx1.sendIdx["assert:equals:"]=4;
  57003. $recv(set)._add_((3));
  57004. $ctx1.sendIdx["add:"]=4;
  57005. $8=$recv(set)._printString();
  57006. $ctx1.sendIdx["printString"]=5;
  57007. $self._assert_equals_($8,"a Set (3 'foo')");
  57008. $ctx1.sendIdx["assert:equals:"]=5;
  57009. $recv(set)._add_((3));
  57010. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57011. return self;
  57012. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57013. },
  57014. args: [],
  57015. 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'')'",
  57016. referencedClasses: ["Set"],
  57017. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57018. }),
  57019. $globals.SetTest);
  57020. $core.addMethod(
  57021. $core.method({
  57022. selector: "testRegression1225",
  57023. protocol: "tests",
  57024. fn: function (){
  57025. var self=this,$self=this;
  57026. return $core.withContext(function($ctx1) {
  57027. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  57028. return self;
  57029. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{},$globals.SetTest)});
  57030. },
  57031. args: [],
  57032. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  57033. referencedClasses: [],
  57034. messageSends: ["assert:equals:", "add:", "asSet"]
  57035. }),
  57036. $globals.SetTest);
  57037. $core.addMethod(
  57038. $core.method({
  57039. selector: "testRegression1226",
  57040. protocol: "tests",
  57041. fn: function (){
  57042. var self=this,$self=this;
  57043. return $core.withContext(function($ctx1) {
  57044. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  57045. return self;
  57046. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{},$globals.SetTest)});
  57047. },
  57048. args: [],
  57049. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  57050. referencedClasses: [],
  57051. messageSends: ["assert:equals:", "remove:", "asSet"]
  57052. }),
  57053. $globals.SetTest);
  57054. $core.addMethod(
  57055. $core.method({
  57056. selector: "testRegression1227",
  57057. protocol: "tests",
  57058. fn: function (){
  57059. var self=this,$self=this;
  57060. return $core.withContext(function($ctx1) {
  57061. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  57062. return (5);
  57063. })),(5));
  57064. return self;
  57065. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{},$globals.SetTest)});
  57066. },
  57067. args: [],
  57068. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  57069. referencedClasses: [],
  57070. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  57071. }),
  57072. $globals.SetTest);
  57073. $core.addMethod(
  57074. $core.method({
  57075. selector: "testRegression1228",
  57076. protocol: "tests",
  57077. fn: function (){
  57078. var self=this,$self=this;
  57079. return $core.withContext(function($ctx1) {
  57080. $self._should_raise_((function(){
  57081. return $core.withContext(function($ctx2) {
  57082. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  57083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57084. }),$globals.Error);
  57085. return self;
  57086. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{},$globals.SetTest)});
  57087. },
  57088. args: [],
  57089. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  57090. referencedClasses: ["Error"],
  57091. messageSends: ["should:raise:", "remove:", "asSet"]
  57092. }),
  57093. $globals.SetTest);
  57094. $core.addMethod(
  57095. $core.method({
  57096. selector: "testUnboxedObjects",
  57097. protocol: "tests",
  57098. fn: function (){
  57099. var self=this,$self=this;
  57100. return $core.withContext(function($ctx1) {
  57101. var $4,$3,$2,$1;
  57102. $4="foo"._yourself();
  57103. $ctx1.sendIdx["yourself"]=1;
  57104. $3=[$4,"foo"._yourself()];
  57105. $2=$recv($3)._asSet();
  57106. $1=$recv($2)._asArray();
  57107. $self._assert_equals_($1,["foo"]);
  57108. return self;
  57109. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57110. },
  57111. args: [],
  57112. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57113. referencedClasses: [],
  57114. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57115. }),
  57116. $globals.SetTest);
  57117. $core.addMethod(
  57118. $core.method({
  57119. selector: "testUnicity",
  57120. protocol: "tests",
  57121. fn: function (){
  57122. var self=this,$self=this;
  57123. var set;
  57124. return $core.withContext(function($ctx1) {
  57125. var $1;
  57126. set=$recv($globals.Set)._new();
  57127. $recv(set)._add_((21));
  57128. $ctx1.sendIdx["add:"]=1;
  57129. $recv(set)._add_("hello");
  57130. $ctx1.sendIdx["add:"]=2;
  57131. $recv(set)._add_((21));
  57132. $ctx1.sendIdx["add:"]=3;
  57133. $1=$recv(set)._size();
  57134. $ctx1.sendIdx["size"]=1;
  57135. $self._assert_equals_($1,(2));
  57136. $ctx1.sendIdx["assert:equals:"]=1;
  57137. $recv(set)._add_("hello");
  57138. $self._assert_equals_($recv(set)._size(),(2));
  57139. $ctx1.sendIdx["assert:equals:"]=2;
  57140. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57141. return self;
  57142. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57143. },
  57144. args: [],
  57145. 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')",
  57146. referencedClasses: ["Set"],
  57147. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57148. }),
  57149. $globals.SetTest);
  57150. $core.addMethod(
  57151. $core.method({
  57152. selector: "collectionClass",
  57153. protocol: "fixture",
  57154. fn: function (){
  57155. var self=this,$self=this;
  57156. return $globals.Set;
  57157. },
  57158. args: [],
  57159. source: "collectionClass\x0a\x09^ Set",
  57160. referencedClasses: ["Set"],
  57161. messageSends: []
  57162. }),
  57163. $globals.SetTest.a$cls);
  57164. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57165. $core.addMethod(
  57166. $core.method({
  57167. selector: "testShow",
  57168. protocol: "tests",
  57169. fn: function (){
  57170. var self=this,$self=this;
  57171. var originalTranscript;
  57172. return $core.withContext(function($ctx1) {
  57173. originalTranscript=$recv($globals.Transcript)._current();
  57174. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57175. $ctx1.sendIdx["register:"]=1;
  57176. $self._shouldnt_raise_((function(){
  57177. return $core.withContext(function($ctx2) {
  57178. return $recv($globals.Transcript)._show_("Hello console!");
  57179. $ctx2.sendIdx["show:"]=1;
  57180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57181. }),$globals.Error);
  57182. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57183. $self._shouldnt_raise_((function(){
  57184. return $core.withContext(function($ctx2) {
  57185. return $recv($globals.Transcript)._show_(console);
  57186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57187. }),$globals.Error);
  57188. $recv($globals.Transcript)._register_(originalTranscript);
  57189. return self;
  57190. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57191. },
  57192. args: [],
  57193. 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.",
  57194. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57195. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57196. }),
  57197. $globals.ConsoleTranscriptTest);
  57198. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57199. $core.addMethod(
  57200. $core.method({
  57201. selector: "testEquality",
  57202. protocol: "tests",
  57203. fn: function (){
  57204. var self=this,$self=this;
  57205. var now;
  57206. return $core.withContext(function($ctx1) {
  57207. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57208. now=$recv($globals.Date)._new();
  57209. $1=$recv(now).__eq(now);
  57210. $ctx1.sendIdx["="]=1;
  57211. $self._assert_($1);
  57212. $ctx1.sendIdx["assert:"]=1;
  57213. $3=now;
  57214. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57215. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57216. $2=$recv($3).__eq($4);
  57217. $ctx1.sendIdx["="]=2;
  57218. $self._deny_($2);
  57219. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57220. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57221. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57222. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57223. $5=$recv($6).__eq($7);
  57224. $ctx1.sendIdx["="]=3;
  57225. $self._assert_($5);
  57226. $ctx1.sendIdx["assert:"]=2;
  57227. $9=now;
  57228. $11=$recv(now)._asMilliseconds();
  57229. $ctx1.sendIdx["asMilliseconds"]=1;
  57230. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57231. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57232. $8=$recv($9).__eq($10);
  57233. $ctx1.sendIdx["="]=4;
  57234. $self._assert_($8);
  57235. $ctx1.sendIdx["assert:"]=3;
  57236. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57237. return self;
  57238. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57239. },
  57240. args: [],
  57241. 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",
  57242. referencedClasses: ["Date"],
  57243. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57244. }),
  57245. $globals.DateTest);
  57246. $core.addMethod(
  57247. $core.method({
  57248. selector: "testIdentity",
  57249. protocol: "tests",
  57250. fn: function (){
  57251. var self=this,$self=this;
  57252. var now;
  57253. return $core.withContext(function($ctx1) {
  57254. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57255. now=$recv($globals.Date)._new();
  57256. $1=$recv(now).__eq_eq(now);
  57257. $ctx1.sendIdx["=="]=1;
  57258. $self._assert_($1);
  57259. $3=now;
  57260. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57261. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57262. $2=$recv($3).__eq_eq($4);
  57263. $ctx1.sendIdx["=="]=2;
  57264. $self._deny_($2);
  57265. $ctx1.sendIdx["deny:"]=1;
  57266. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57267. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57268. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57269. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57270. $5=$recv($6).__eq_eq($7);
  57271. $ctx1.sendIdx["=="]=3;
  57272. $self._deny_($5);
  57273. $ctx1.sendIdx["deny:"]=2;
  57274. $9=now;
  57275. $11=$recv(now)._asMilliseconds();
  57276. $ctx1.sendIdx["asMilliseconds"]=1;
  57277. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57278. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57279. $8=$recv($9).__eq_eq($10);
  57280. $ctx1.sendIdx["=="]=4;
  57281. $self._deny_($8);
  57282. $ctx1.sendIdx["deny:"]=3;
  57283. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57284. return self;
  57285. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57286. },
  57287. args: [],
  57288. 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",
  57289. referencedClasses: ["Date"],
  57290. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57291. }),
  57292. $globals.DateTest);
  57293. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57294. $core.addMethod(
  57295. $core.method({
  57296. selector: "jsObject",
  57297. protocol: "accessing",
  57298. fn: function (){
  57299. var self=this,$self=this;
  57300. return $core.withContext(function($ctx1) {
  57301. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57302. return self;
  57303. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57304. },
  57305. args: [],
  57306. source: "jsObject\x0a\x09<inlineJS: \x0a\x09\x09'return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}'>",
  57307. referencedClasses: [],
  57308. messageSends: []
  57309. }),
  57310. $globals.JSObjectProxyTest);
  57311. $core.addMethod(
  57312. $core.method({
  57313. selector: "jsUndefined",
  57314. protocol: "accessing",
  57315. fn: function (){
  57316. var self=this,$self=this;
  57317. return $core.withContext(function($ctx1) {
  57318. return;
  57319. return self;
  57320. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57321. },
  57322. args: [],
  57323. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57324. referencedClasses: [],
  57325. messageSends: []
  57326. }),
  57327. $globals.JSObjectProxyTest);
  57328. $core.addMethod(
  57329. $core.method({
  57330. selector: "testAtIfAbsent",
  57331. protocol: "tests",
  57332. fn: function (){
  57333. var self=this,$self=this;
  57334. var testObject;
  57335. return $core.withContext(function($ctx1) {
  57336. var $1,$2,$3;
  57337. testObject=$self._jsObject();
  57338. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57339. return "Property does not exist";
  57340. }));
  57341. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57342. $self._assert_equals_($1,"Property does not exist");
  57343. $ctx1.sendIdx["assert:equals:"]=1;
  57344. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57345. return "Property does not exist";
  57346. }));
  57347. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57348. $self._assert_equals_($2,nil);
  57349. $ctx1.sendIdx["assert:equals:"]=2;
  57350. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57351. return "Property does not exist";
  57352. }));
  57353. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57354. $self._assert_equals_($3,(1));
  57355. $ctx1.sendIdx["assert:equals:"]=3;
  57356. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57357. return "Property does not exist";
  57358. })),nil);
  57359. return self;
  57360. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57361. },
  57362. args: [],
  57363. 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.",
  57364. referencedClasses: [],
  57365. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57366. }),
  57367. $globals.JSObjectProxyTest);
  57368. $core.addMethod(
  57369. $core.method({
  57370. selector: "testAtIfPresent",
  57371. protocol: "tests",
  57372. fn: function (){
  57373. var self=this,$self=this;
  57374. var testObject;
  57375. return $core.withContext(function($ctx1) {
  57376. var $2,$1,$4,$3,$6,$5;
  57377. testObject=$self._jsObject();
  57378. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57379. return $core.withContext(function($ctx2) {
  57380. $2=$recv(x)._asString();
  57381. $ctx2.sendIdx["asString"]=1;
  57382. return "hello ".__comma($2);
  57383. $ctx2.sendIdx[","]=1;
  57384. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57385. }));
  57386. $ctx1.sendIdx["at:ifPresent:"]=1;
  57387. $self._assert_equals_($1,nil);
  57388. $ctx1.sendIdx["assert:equals:"]=1;
  57389. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57390. return $core.withContext(function($ctx2) {
  57391. $4=$recv(x)._asString();
  57392. $ctx2.sendIdx["asString"]=2;
  57393. return "hello ".__comma($4);
  57394. $ctx2.sendIdx[","]=2;
  57395. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57396. }));
  57397. $ctx1.sendIdx["at:ifPresent:"]=2;
  57398. $self._assert_equals_($3,"hello nil");
  57399. $ctx1.sendIdx["assert:equals:"]=2;
  57400. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57401. return $core.withContext(function($ctx2) {
  57402. $6=$recv(x)._asString();
  57403. $ctx2.sendIdx["asString"]=3;
  57404. return "hello ".__comma($6);
  57405. $ctx2.sendIdx[","]=3;
  57406. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57407. }));
  57408. $ctx1.sendIdx["at:ifPresent:"]=3;
  57409. $self._assert_equals_($5,"hello 1");
  57410. $ctx1.sendIdx["assert:equals:"]=3;
  57411. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57412. return $core.withContext(function($ctx2) {
  57413. return "hello ".__comma($recv(x)._asString());
  57414. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57415. })),"hello nil");
  57416. return self;
  57417. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57418. },
  57419. args: [],
  57420. 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'.",
  57421. referencedClasses: [],
  57422. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57423. }),
  57424. $globals.JSObjectProxyTest);
  57425. $core.addMethod(
  57426. $core.method({
  57427. selector: "testAtIfPresentIfAbsent",
  57428. protocol: "tests",
  57429. fn: function (){
  57430. var self=this,$self=this;
  57431. var testObject;
  57432. return $core.withContext(function($ctx1) {
  57433. var $2,$1,$4,$3,$6,$5;
  57434. testObject=$self._jsObject();
  57435. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57436. return $core.withContext(function($ctx2) {
  57437. $2=$recv(x)._asString();
  57438. $ctx2.sendIdx["asString"]=1;
  57439. return "hello ".__comma($2);
  57440. $ctx2.sendIdx[","]=1;
  57441. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57442. }),(function(){
  57443. return "not present";
  57444. }));
  57445. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57446. $self._assert_equals_($1,"not present");
  57447. $ctx1.sendIdx["assert:equals:"]=1;
  57448. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57449. return $core.withContext(function($ctx2) {
  57450. $4=$recv(x)._asString();
  57451. $ctx2.sendIdx["asString"]=2;
  57452. return "hello ".__comma($4);
  57453. $ctx2.sendIdx[","]=2;
  57454. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57455. }),(function(){
  57456. return "not present";
  57457. }));
  57458. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57459. $self._assert_equals_($3,"hello nil");
  57460. $ctx1.sendIdx["assert:equals:"]=2;
  57461. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57462. return $core.withContext(function($ctx2) {
  57463. $6=$recv(x)._asString();
  57464. $ctx2.sendIdx["asString"]=3;
  57465. return "hello ".__comma($6);
  57466. $ctx2.sendIdx[","]=3;
  57467. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57468. }),(function(){
  57469. return "not present";
  57470. }));
  57471. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57472. $self._assert_equals_($5,"hello 1");
  57473. $ctx1.sendIdx["assert:equals:"]=3;
  57474. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57475. return $core.withContext(function($ctx2) {
  57476. return "hello ".__comma($recv(x)._asString());
  57477. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57478. }),(function(){
  57479. return "not present";
  57480. })),"hello nil");
  57481. return self;
  57482. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57483. },
  57484. args: [],
  57485. 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'.",
  57486. referencedClasses: [],
  57487. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57488. }),
  57489. $globals.JSObjectProxyTest);
  57490. $core.addMethod(
  57491. $core.method({
  57492. selector: "testAtPut",
  57493. protocol: "tests",
  57494. fn: function (){
  57495. var self=this,$self=this;
  57496. var testObject;
  57497. return $core.withContext(function($ctx1) {
  57498. var $2,$1;
  57499. testObject=$self._jsObject();
  57500. $2=$recv(testObject)._at_("abc");
  57501. $ctx1.sendIdx["at:"]=1;
  57502. $1=$recv($2).__tild_eq("xyz");
  57503. $self._assert_($1);
  57504. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57505. $ctx1.sendIdx["assert:equals:"]=1;
  57506. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57507. return self;
  57508. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57509. },
  57510. args: [],
  57511. 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'",
  57512. referencedClasses: [],
  57513. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57514. }),
  57515. $globals.JSObjectProxyTest);
  57516. $core.addMethod(
  57517. $core.method({
  57518. selector: "testComparison",
  57519. protocol: "tests",
  57520. fn: function (){
  57521. var self=this,$self=this;
  57522. return $core.withContext(function($ctx1) {
  57523. var $1,$2;
  57524. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57525. $1=$recv(console).__eq(console);
  57526. $ctx1.sendIdx["="]=1;
  57527. $self._assert_($1);
  57528. $2=$recv(console).__eq($recv($globals.Object)._new());
  57529. $ctx1.sendIdx["="]=2;
  57530. $self._deny_($2);
  57531. $ctx1.sendIdx["deny:"]=1;
  57532. $self._deny_($recv(console).__eq($self._jsObject()));
  57533. return self;
  57534. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57535. },
  57536. args: [],
  57537. 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",
  57538. referencedClasses: ["Object"],
  57539. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57540. }),
  57541. $globals.JSObjectProxyTest);
  57542. $core.addMethod(
  57543. $core.method({
  57544. selector: "testDNU",
  57545. protocol: "tests",
  57546. fn: function (){
  57547. var self=this,$self=this;
  57548. return $core.withContext(function($ctx1) {
  57549. $self._should_raise_((function(){
  57550. return $core.withContext(function($ctx2) {
  57551. return $recv($self._jsObject())._foo();
  57552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57553. }),$globals.MessageNotUnderstood);
  57554. return self;
  57555. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57556. },
  57557. args: [],
  57558. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57559. referencedClasses: ["MessageNotUnderstood"],
  57560. messageSends: ["should:raise:", "foo", "jsObject"]
  57561. }),
  57562. $globals.JSObjectProxyTest);
  57563. $core.addMethod(
  57564. $core.method({
  57565. selector: "testDNUWithAllowJavaScriptCalls",
  57566. protocol: "tests",
  57567. fn: function (){
  57568. var self=this,$self=this;
  57569. var jsObject;
  57570. return $core.withContext(function($ctx1) {
  57571. jsObject=[];
  57572. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57573. $self._should_raise_((function(){
  57574. return $core.withContext(function($ctx2) {
  57575. return $recv(jsObject)._foo();
  57576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57577. }),$globals.MessageNotUnderstood);
  57578. return self;
  57579. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57580. },
  57581. args: [],
  57582. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57583. referencedClasses: ["MessageNotUnderstood"],
  57584. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57585. }),
  57586. $globals.JSObjectProxyTest);
  57587. $core.addMethod(
  57588. $core.method({
  57589. selector: "testMessageSend",
  57590. protocol: "tests",
  57591. fn: function (){
  57592. var self=this,$self=this;
  57593. return $core.withContext(function($ctx1) {
  57594. var $2,$1,$4,$3;
  57595. $2=$self._jsObject();
  57596. $ctx1.sendIdx["jsObject"]=1;
  57597. $1=$recv($2)._a();
  57598. $self._assert_equals_($1,(1));
  57599. $ctx1.sendIdx["assert:equals:"]=1;
  57600. $4=$self._jsObject();
  57601. $ctx1.sendIdx["jsObject"]=2;
  57602. $3=$recv($4)._b();
  57603. $self._assert_equals_($3,(2));
  57604. $ctx1.sendIdx["assert:equals:"]=2;
  57605. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57606. return self;
  57607. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57608. },
  57609. args: [],
  57610. 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",
  57611. referencedClasses: [],
  57612. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57613. }),
  57614. $globals.JSObjectProxyTest);
  57615. $core.addMethod(
  57616. $core.method({
  57617. selector: "testMethodWithArguments",
  57618. protocol: "tests",
  57619. fn: function (){
  57620. var self=this,$self=this;
  57621. return $core.withContext(function($ctx1) {
  57622. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57623. return self;
  57624. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57625. },
  57626. args: [],
  57627. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57628. referencedClasses: [],
  57629. messageSends: ["assert:equals:", "c:", "jsObject"]
  57630. }),
  57631. $globals.JSObjectProxyTest);
  57632. $core.addMethod(
  57633. $core.method({
  57634. selector: "testNull",
  57635. protocol: "tests",
  57636. fn: function (){
  57637. var self=this,$self=this;
  57638. return $core.withContext(function($ctx1) {
  57639. var $2,$1;
  57640. $2=$recv($globals.JSObjectProxy)._null();
  57641. $ctx1.sendIdx["null"]=1;
  57642. $1=$recv($2)._isNil();
  57643. $self._assert_($1);
  57644. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57645. return self;
  57646. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57647. },
  57648. args: [],
  57649. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57650. referencedClasses: ["JSObjectProxy", "JSON"],
  57651. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57652. }),
  57653. $globals.JSObjectProxyTest);
  57654. $core.addMethod(
  57655. $core.method({
  57656. selector: "testPrinting",
  57657. protocol: "tests",
  57658. fn: function (){
  57659. var self=this,$self=this;
  57660. return $core.withContext(function($ctx1) {
  57661. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57662. return self;
  57663. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57664. },
  57665. args: [],
  57666. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57667. referencedClasses: [],
  57668. messageSends: ["assert:equals:", "printString", "jsObject"]
  57669. }),
  57670. $globals.JSObjectProxyTest);
  57671. $core.addMethod(
  57672. $core.method({
  57673. selector: "testPropertyThatReturnsEmptyString",
  57674. protocol: "tests",
  57675. fn: function (){
  57676. var self=this,$self=this;
  57677. var object;
  57678. return $core.withContext(function($ctx1) {
  57679. var $1;
  57680. object=$self._jsObject();
  57681. $1=$recv(object)._d();
  57682. $ctx1.sendIdx["d"]=1;
  57683. $self._assert_equals_($1,"");
  57684. $ctx1.sendIdx["assert:equals:"]=1;
  57685. $recv(object)._d_("hello");
  57686. $self._assert_equals_($recv(object)._d(),"hello");
  57687. return self;
  57688. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57689. },
  57690. args: [],
  57691. 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'",
  57692. referencedClasses: [],
  57693. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57694. }),
  57695. $globals.JSObjectProxyTest);
  57696. $core.addMethod(
  57697. $core.method({
  57698. selector: "testPropertyThatReturnsUndefined",
  57699. protocol: "tests",
  57700. fn: function (){
  57701. var self=this,$self=this;
  57702. var object;
  57703. return $core.withContext(function($ctx1) {
  57704. object=$self._jsObject();
  57705. $self._shouldnt_raise_((function(){
  57706. return $core.withContext(function($ctx2) {
  57707. return $recv(object)._e();
  57708. $ctx2.sendIdx["e"]=1;
  57709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57710. }),$globals.MessageNotUnderstood);
  57711. $self._assert_($recv($recv(object)._e())._isNil());
  57712. return self;
  57713. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57714. },
  57715. args: [],
  57716. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57717. referencedClasses: ["MessageNotUnderstood"],
  57718. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57719. }),
  57720. $globals.JSObjectProxyTest);
  57721. $core.addMethod(
  57722. $core.method({
  57723. selector: "testSetPropertyWithFalsyValue",
  57724. protocol: "tests",
  57725. fn: function (){
  57726. var self=this,$self=this;
  57727. var jsObject;
  57728. return $core.withContext(function($ctx1) {
  57729. var $1,$2,$3,$4,$5;
  57730. jsObject=$self._jsObject();
  57731. $1=$recv(jsObject)._a();
  57732. $ctx1.sendIdx["a"]=1;
  57733. $self._assert_equals_($1,(1));
  57734. $ctx1.sendIdx["assert:equals:"]=1;
  57735. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57736. $ctx1.sendIdx["a:"]=1;
  57737. $2=$recv(jsObject)._a();
  57738. $ctx1.sendIdx["a"]=2;
  57739. $self._assert_equals_($2,nil);
  57740. $ctx1.sendIdx["assert:equals:"]=2;
  57741. $recv(jsObject)._a_((0));
  57742. $ctx1.sendIdx["a:"]=2;
  57743. $3=$recv(jsObject)._a();
  57744. $ctx1.sendIdx["a"]=3;
  57745. $self._assert_equals_($3,(0));
  57746. $ctx1.sendIdx["assert:equals:"]=3;
  57747. $recv(jsObject)._a_($self._jsUndefined());
  57748. $ctx1.sendIdx["a:"]=3;
  57749. $4=$recv(jsObject)._a();
  57750. $ctx1.sendIdx["a"]=4;
  57751. $self._assert_equals_($4,nil);
  57752. $ctx1.sendIdx["assert:equals:"]=4;
  57753. $recv(jsObject)._a_("");
  57754. $ctx1.sendIdx["a:"]=4;
  57755. $5=$recv(jsObject)._a();
  57756. $ctx1.sendIdx["a"]=5;
  57757. $self._assert_equals_($5,"");
  57758. $ctx1.sendIdx["assert:equals:"]=5;
  57759. $recv(jsObject)._a_(false);
  57760. $self._assert_equals_($recv(jsObject)._a(),false);
  57761. return self;
  57762. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57763. },
  57764. args: [],
  57765. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57766. referencedClasses: ["JSObjectProxy"],
  57767. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57768. }),
  57769. $globals.JSObjectProxyTest);
  57770. $core.addMethod(
  57771. $core.method({
  57772. selector: "testUndefined",
  57773. protocol: "tests",
  57774. fn: function (){
  57775. var self=this,$self=this;
  57776. return $core.withContext(function($ctx1) {
  57777. var $2,$1;
  57778. $2=$recv($globals.JSObjectProxy)._undefined();
  57779. $ctx1.sendIdx["undefined"]=1;
  57780. $1=$recv($2)._isNil();
  57781. $self._assert_($1);
  57782. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57783. return self;
  57784. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57785. },
  57786. args: [],
  57787. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57788. referencedClasses: ["JSObjectProxy", "JSON"],
  57789. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57790. }),
  57791. $globals.JSObjectProxyTest);
  57792. $core.addMethod(
  57793. $core.method({
  57794. selector: "testValue",
  57795. protocol: "tests",
  57796. fn: function (){
  57797. var self=this,$self=this;
  57798. var testObject;
  57799. return $core.withContext(function($ctx1) {
  57800. testObject=$self._jsObject();
  57801. $recv(testObject)._at_put_("value","aValue");
  57802. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57803. return self;
  57804. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57805. },
  57806. args: [],
  57807. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57808. referencedClasses: [],
  57809. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57810. }),
  57811. $globals.JSObjectProxyTest);
  57812. $core.addMethod(
  57813. $core.method({
  57814. selector: "testYourself",
  57815. protocol: "tests",
  57816. fn: function (){
  57817. var self=this,$self=this;
  57818. var object;
  57819. return $core.withContext(function($ctx1) {
  57820. var $1;
  57821. $1=$self._jsObject();
  57822. $recv($1)._d_("test");
  57823. object=$recv($1)._yourself();
  57824. $self._assert_equals_($recv(object)._d(),"test");
  57825. return self;
  57826. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57827. },
  57828. args: [],
  57829. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57830. referencedClasses: [],
  57831. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57832. }),
  57833. $globals.JSObjectProxyTest);
  57834. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57835. $core.addMethod(
  57836. $core.method({
  57837. selector: "testCatchingException",
  57838. protocol: "tests",
  57839. fn: function (){
  57840. var self=this,$self=this;
  57841. return $core.withContext(function($ctx1) {
  57842. $recv((function(){
  57843. return $core.withContext(function($ctx2) {
  57844. return $self._throwException();
  57845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57846. }))._on_do_($globals.Error,(function(error){
  57847. return $core.withContext(function($ctx2) {
  57848. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57849. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57850. }));
  57851. return self;
  57852. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57853. },
  57854. args: [],
  57855. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57856. referencedClasses: ["Error"],
  57857. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57858. }),
  57859. $globals.JavaScriptExceptionTest);
  57860. $core.addMethod(
  57861. $core.method({
  57862. selector: "testRaisingException",
  57863. protocol: "tests",
  57864. fn: function (){
  57865. var self=this,$self=this;
  57866. return $core.withContext(function($ctx1) {
  57867. $self._should_raise_((function(){
  57868. return $core.withContext(function($ctx2) {
  57869. return $self._throwException();
  57870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57871. }),$globals.JavaScriptException);
  57872. return self;
  57873. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57874. },
  57875. args: [],
  57876. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57877. referencedClasses: ["JavaScriptException"],
  57878. messageSends: ["should:raise:", "throwException"]
  57879. }),
  57880. $globals.JavaScriptExceptionTest);
  57881. $core.addMethod(
  57882. $core.method({
  57883. selector: "throwException",
  57884. protocol: "helpers",
  57885. fn: function (){
  57886. var self=this,$self=this;
  57887. return $core.withContext(function($ctx1) {
  57888. throw "test";
  57889. return self;
  57890. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57891. },
  57892. args: [],
  57893. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57894. referencedClasses: [],
  57895. messageSends: []
  57896. }),
  57897. $globals.JavaScriptExceptionTest);
  57898. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57899. $core.addMethod(
  57900. $core.method({
  57901. selector: "testValue",
  57902. protocol: "tests",
  57903. fn: function (){
  57904. var self=this,$self=this;
  57905. var messageSend;
  57906. return $core.withContext(function($ctx1) {
  57907. var $1;
  57908. $1=$recv($globals.MessageSend)._new();
  57909. $ctx1.sendIdx["new"]=1;
  57910. $recv($1)._receiver_($recv($globals.Object)._new());
  57911. $recv($1)._selector_("asString");
  57912. messageSend=$recv($1)._yourself();
  57913. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57914. return self;
  57915. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57916. },
  57917. args: [],
  57918. 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'",
  57919. referencedClasses: ["MessageSend", "Object"],
  57920. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57921. }),
  57922. $globals.MessageSendTest);
  57923. $core.addMethod(
  57924. $core.method({
  57925. selector: "testValueWithArguments",
  57926. protocol: "tests",
  57927. fn: function (){
  57928. var self=this,$self=this;
  57929. var messageSend;
  57930. return $core.withContext(function($ctx1) {
  57931. var $1;
  57932. $1=$recv($globals.MessageSend)._new();
  57933. $recv($1)._receiver_((2));
  57934. $recv($1)._selector_("+");
  57935. messageSend=$recv($1)._yourself();
  57936. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57937. $ctx1.sendIdx["assert:equals:"]=1;
  57938. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57939. return self;
  57940. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57941. },
  57942. args: [],
  57943. 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",
  57944. referencedClasses: ["MessageSend"],
  57945. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57946. }),
  57947. $globals.MessageSendTest);
  57948. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57949. $core.addMethod(
  57950. $core.method({
  57951. selector: "codeGeneratorClass",
  57952. protocol: "accessing",
  57953. fn: function (){
  57954. var self=this,$self=this;
  57955. return $globals.CodeGenerator;
  57956. },
  57957. args: [],
  57958. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57959. referencedClasses: ["CodeGenerator"],
  57960. messageSends: []
  57961. }),
  57962. $globals.MethodInheritanceTest);
  57963. $core.addMethod(
  57964. $core.method({
  57965. selector: "compiler",
  57966. protocol: "factory",
  57967. fn: function (){
  57968. var self=this,$self=this;
  57969. return $core.withContext(function($ctx1) {
  57970. var $1;
  57971. $1=$recv($globals.Compiler)._new();
  57972. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57973. return $recv($1)._yourself();
  57974. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57975. },
  57976. args: [],
  57977. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57978. referencedClasses: ["Compiler"],
  57979. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57980. }),
  57981. $globals.MethodInheritanceTest);
  57982. $core.addMethod(
  57983. $core.method({
  57984. selector: "deinstallBottom",
  57985. protocol: "testing",
  57986. fn: function (){
  57987. var self=this,$self=this;
  57988. return $core.withContext(function($ctx1) {
  57989. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57990. return self;
  57991. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57992. },
  57993. args: [],
  57994. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57995. referencedClasses: [],
  57996. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57997. }),
  57998. $globals.MethodInheritanceTest);
  57999. $core.addMethod(
  58000. $core.method({
  58001. selector: "deinstallMiddle",
  58002. protocol: "testing",
  58003. fn: function (){
  58004. var self=this,$self=this;
  58005. return $core.withContext(function($ctx1) {
  58006. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58007. return self;
  58008. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58009. },
  58010. args: [],
  58011. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58012. referencedClasses: [],
  58013. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58014. }),
  58015. $globals.MethodInheritanceTest);
  58016. $core.addMethod(
  58017. $core.method({
  58018. selector: "deinstallTop",
  58019. protocol: "testing",
  58020. fn: function (){
  58021. var self=this,$self=this;
  58022. return $core.withContext(function($ctx1) {
  58023. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58024. return self;
  58025. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58026. },
  58027. args: [],
  58028. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58029. referencedClasses: [],
  58030. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58031. }),
  58032. $globals.MethodInheritanceTest);
  58033. $core.addMethod(
  58034. $core.method({
  58035. selector: "installBottom:",
  58036. protocol: "testing",
  58037. fn: function (aString){
  58038. var self=this,$self=this;
  58039. return $core.withContext(function($ctx1) {
  58040. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58041. return self;
  58042. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58043. },
  58044. args: ["aString"],
  58045. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58046. referencedClasses: [],
  58047. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58048. }),
  58049. $globals.MethodInheritanceTest);
  58050. $core.addMethod(
  58051. $core.method({
  58052. selector: "installMiddle:",
  58053. protocol: "testing",
  58054. fn: function (aString){
  58055. var self=this,$self=this;
  58056. return $core.withContext(function($ctx1) {
  58057. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58058. return self;
  58059. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58060. },
  58061. args: ["aString"],
  58062. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58063. referencedClasses: [],
  58064. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58065. }),
  58066. $globals.MethodInheritanceTest);
  58067. $core.addMethod(
  58068. $core.method({
  58069. selector: "installTop:",
  58070. protocol: "testing",
  58071. fn: function (aString){
  58072. var self=this,$self=this;
  58073. return $core.withContext(function($ctx1) {
  58074. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58075. return self;
  58076. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58077. },
  58078. args: ["aString"],
  58079. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58080. referencedClasses: [],
  58081. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58082. }),
  58083. $globals.MethodInheritanceTest);
  58084. $core.addMethod(
  58085. $core.method({
  58086. selector: "setUp",
  58087. protocol: "initialization",
  58088. fn: function (){
  58089. var self=this,$self=this;
  58090. return $core.withContext(function($ctx1) {
  58091. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58092. $ctx1.sendIdx["new"]=1;
  58093. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58094. $ctx1.sendIdx["new"]=2;
  58095. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58096. $self["@method"]=nil;
  58097. $self["@performBlock"]=(function(){
  58098. return $core.withContext(function($ctx2) {
  58099. return $self._error_("performBlock not initialized");
  58100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58101. });
  58102. return self;
  58103. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58104. },
  58105. args: [],
  58106. 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' ]",
  58107. referencedClasses: [],
  58108. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58109. }),
  58110. $globals.MethodInheritanceTest);
  58111. $core.addMethod(
  58112. $core.method({
  58113. selector: "shouldMNU",
  58114. protocol: "testing",
  58115. fn: function (){
  58116. var self=this,$self=this;
  58117. return $core.withContext(function($ctx1) {
  58118. $self._shouldMNUTop();
  58119. $self._shouldMNUMiddle();
  58120. $self._shouldMNUBottom();
  58121. return self;
  58122. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58123. },
  58124. args: [],
  58125. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58126. referencedClasses: [],
  58127. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58128. }),
  58129. $globals.MethodInheritanceTest);
  58130. $core.addMethod(
  58131. $core.method({
  58132. selector: "shouldMNUBottom",
  58133. protocol: "testing",
  58134. fn: function (){
  58135. var self=this,$self=this;
  58136. return $core.withContext(function($ctx1) {
  58137. $self._should_raise_((function(){
  58138. return $core.withContext(function($ctx2) {
  58139. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58141. }),$globals.MessageNotUnderstood);
  58142. return self;
  58143. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58144. },
  58145. args: [],
  58146. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58147. referencedClasses: ["MessageNotUnderstood"],
  58148. messageSends: ["should:raise:", "value:"]
  58149. }),
  58150. $globals.MethodInheritanceTest);
  58151. $core.addMethod(
  58152. $core.method({
  58153. selector: "shouldMNUMiddle",
  58154. protocol: "testing",
  58155. fn: function (){
  58156. var self=this,$self=this;
  58157. return $core.withContext(function($ctx1) {
  58158. $self._should_raise_((function(){
  58159. return $core.withContext(function($ctx2) {
  58160. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58162. }),$globals.MessageNotUnderstood);
  58163. return self;
  58164. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58165. },
  58166. args: [],
  58167. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58168. referencedClasses: ["MessageNotUnderstood"],
  58169. messageSends: ["should:raise:", "value:"]
  58170. }),
  58171. $globals.MethodInheritanceTest);
  58172. $core.addMethod(
  58173. $core.method({
  58174. selector: "shouldMNUTop",
  58175. protocol: "testing",
  58176. fn: function (){
  58177. var self=this,$self=this;
  58178. return $core.withContext(function($ctx1) {
  58179. $self._should_raise_((function(){
  58180. return $core.withContext(function($ctx2) {
  58181. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58183. }),$globals.MessageNotUnderstood);
  58184. return self;
  58185. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58186. },
  58187. args: [],
  58188. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58189. referencedClasses: ["MessageNotUnderstood"],
  58190. messageSends: ["should:raise:", "value:"]
  58191. }),
  58192. $globals.MethodInheritanceTest);
  58193. $core.addMethod(
  58194. $core.method({
  58195. selector: "shouldReturn:",
  58196. protocol: "testing",
  58197. fn: function (anObject){
  58198. var self=this,$self=this;
  58199. var result;
  58200. return $core.withContext(function($ctx1) {
  58201. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58202. $ctx1.sendIdx["value:"]=1;
  58203. $self._assert_equals_(["top",anObject],["top",result]);
  58204. $ctx1.sendIdx["assert:equals:"]=1;
  58205. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58206. $ctx1.sendIdx["value:"]=2;
  58207. $self._assert_equals_(["middle",anObject],["middle",result]);
  58208. $ctx1.sendIdx["assert:equals:"]=2;
  58209. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58210. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58211. return self;
  58212. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58213. },
  58214. args: ["anObject"],
  58215. 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 }",
  58216. referencedClasses: [],
  58217. messageSends: ["value:", "assert:equals:"]
  58218. }),
  58219. $globals.MethodInheritanceTest);
  58220. $core.addMethod(
  58221. $core.method({
  58222. selector: "shouldReturn:and:and:",
  58223. protocol: "testing",
  58224. fn: function (anObject,anObject2,anObject3){
  58225. var self=this,$self=this;
  58226. var result;
  58227. return $core.withContext(function($ctx1) {
  58228. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58229. $ctx1.sendIdx["value:"]=1;
  58230. $self._assert_equals_(["top",anObject],["top",result]);
  58231. $ctx1.sendIdx["assert:equals:"]=1;
  58232. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58233. $ctx1.sendIdx["value:"]=2;
  58234. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58235. $ctx1.sendIdx["assert:equals:"]=2;
  58236. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58237. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58238. return self;
  58239. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58240. },
  58241. args: ["anObject", "anObject2", "anObject3"],
  58242. 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 }",
  58243. referencedClasses: [],
  58244. messageSends: ["value:", "assert:equals:"]
  58245. }),
  58246. $globals.MethodInheritanceTest);
  58247. $core.addMethod(
  58248. $core.method({
  58249. selector: "targetClassBottom",
  58250. protocol: "accessing",
  58251. fn: function (){
  58252. var self=this,$self=this;
  58253. return $globals.JavaScriptException;
  58254. },
  58255. args: [],
  58256. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58257. referencedClasses: ["JavaScriptException"],
  58258. messageSends: []
  58259. }),
  58260. $globals.MethodInheritanceTest);
  58261. $core.addMethod(
  58262. $core.method({
  58263. selector: "targetClassMiddle",
  58264. protocol: "accessing",
  58265. fn: function (){
  58266. var self=this,$self=this;
  58267. return $globals.Error;
  58268. },
  58269. args: [],
  58270. source: "targetClassMiddle\x0a\x09^ Error",
  58271. referencedClasses: ["Error"],
  58272. messageSends: []
  58273. }),
  58274. $globals.MethodInheritanceTest);
  58275. $core.addMethod(
  58276. $core.method({
  58277. selector: "targetClassTop",
  58278. protocol: "accessing",
  58279. fn: function (){
  58280. var self=this,$self=this;
  58281. return $globals.Object;
  58282. },
  58283. args: [],
  58284. source: "targetClassTop\x0a\x09^ Object",
  58285. referencedClasses: ["Object"],
  58286. messageSends: []
  58287. }),
  58288. $globals.MethodInheritanceTest);
  58289. $core.addMethod(
  58290. $core.method({
  58291. selector: "tearDown",
  58292. protocol: "initialization",
  58293. fn: function (){
  58294. var self=this,$self=this;
  58295. return $core.withContext(function($ctx1) {
  58296. $recv((function(){
  58297. return $core.withContext(function($ctx2) {
  58298. return $self._deinstallTop();
  58299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58300. }))._on_do_($globals.Error,(function(){
  58301. }));
  58302. $ctx1.sendIdx["on:do:"]=1;
  58303. $recv((function(){
  58304. return $core.withContext(function($ctx2) {
  58305. return $self._deinstallMiddle();
  58306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58307. }))._on_do_($globals.Error,(function(){
  58308. }));
  58309. $ctx1.sendIdx["on:do:"]=2;
  58310. $recv((function(){
  58311. return $core.withContext(function($ctx2) {
  58312. return $self._deinstallBottom();
  58313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58314. }))._on_do_($globals.Error,(function(){
  58315. }));
  58316. return self;
  58317. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58318. },
  58319. args: [],
  58320. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58321. referencedClasses: ["Error"],
  58322. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58323. }),
  58324. $globals.MethodInheritanceTest);
  58325. $core.addMethod(
  58326. $core.method({
  58327. selector: "testMNU11",
  58328. protocol: "tests",
  58329. fn: function (){
  58330. var self=this,$self=this;
  58331. return $core.withContext(function($ctx1) {
  58332. $self["@performBlock"]=(function(x){
  58333. return $core.withContext(function($ctx2) {
  58334. return $recv(x)._foo();
  58335. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58336. });
  58337. $self._shouldMNU();
  58338. $ctx1.sendIdx["shouldMNU"]=1;
  58339. $self._installTop_("foo ^ false");
  58340. $ctx1.sendIdx["installTop:"]=1;
  58341. $self._installTop_("foo ^ true");
  58342. $self._deinstallTop();
  58343. $self._shouldMNU();
  58344. return self;
  58345. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58346. },
  58347. args: [],
  58348. 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",
  58349. referencedClasses: [],
  58350. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58351. }),
  58352. $globals.MethodInheritanceTest);
  58353. $core.addMethod(
  58354. $core.method({
  58355. selector: "testMNU22",
  58356. protocol: "tests",
  58357. fn: function (){
  58358. var self=this,$self=this;
  58359. return $core.withContext(function($ctx1) {
  58360. $self["@performBlock"]=(function(x){
  58361. return $core.withContext(function($ctx2) {
  58362. return $recv(x)._foo();
  58363. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58364. });
  58365. $self._shouldMNU();
  58366. $ctx1.sendIdx["shouldMNU"]=1;
  58367. $self._installMiddle_("foo ^ false");
  58368. $ctx1.sendIdx["installMiddle:"]=1;
  58369. $self._installMiddle_("foo ^ true");
  58370. $self._deinstallMiddle();
  58371. $self._shouldMNU();
  58372. return self;
  58373. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58374. },
  58375. args: [],
  58376. 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",
  58377. referencedClasses: [],
  58378. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58379. }),
  58380. $globals.MethodInheritanceTest);
  58381. $core.addMethod(
  58382. $core.method({
  58383. selector: "testReturns1",
  58384. protocol: "tests",
  58385. fn: function (){
  58386. var self=this,$self=this;
  58387. return $core.withContext(function($ctx1) {
  58388. $self["@performBlock"]=(function(x){
  58389. return $core.withContext(function($ctx2) {
  58390. return $recv(x)._foo();
  58391. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58392. });
  58393. $self._installTop_("foo ^ false");
  58394. $ctx1.sendIdx["installTop:"]=1;
  58395. $self._shouldReturn_(false);
  58396. $ctx1.sendIdx["shouldReturn:"]=1;
  58397. $self._installTop_("foo ^ true");
  58398. $self._shouldReturn_(true);
  58399. return self;
  58400. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58401. },
  58402. args: [],
  58403. 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",
  58404. referencedClasses: [],
  58405. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58406. }),
  58407. $globals.MethodInheritanceTest);
  58408. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58409. $core.addMethod(
  58410. $core.method({
  58411. selector: "testAbs",
  58412. protocol: "tests",
  58413. fn: function (){
  58414. var self=this,$self=this;
  58415. return $core.withContext(function($ctx1) {
  58416. var $1;
  58417. $1=(4)._abs();
  58418. $ctx1.sendIdx["abs"]=1;
  58419. $self._assert_equals_($1,(4));
  58420. $ctx1.sendIdx["assert:equals:"]=1;
  58421. $self._assert_equals_((-4)._abs(),(4));
  58422. return self;
  58423. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58424. },
  58425. args: [],
  58426. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58427. referencedClasses: [],
  58428. messageSends: ["assert:equals:", "abs"]
  58429. }),
  58430. $globals.NumberTest);
  58431. $core.addMethod(
  58432. $core.method({
  58433. selector: "testArithmetic",
  58434. protocol: "tests",
  58435. fn: function (){
  58436. var self=this,$self=this;
  58437. return $core.withContext(function($ctx1) {
  58438. var $1,$2,$3,$5,$4;
  58439. $1=(1.5).__plus((1));
  58440. $ctx1.sendIdx["+"]=1;
  58441. $self._assert_equals_($1,(2.5));
  58442. $ctx1.sendIdx["assert:equals:"]=1;
  58443. $2=(2).__minus((1));
  58444. $ctx1.sendIdx["-"]=1;
  58445. $self._assert_equals_($2,(1));
  58446. $ctx1.sendIdx["assert:equals:"]=2;
  58447. $self._assert_equals_((-2).__minus((1)),(-3));
  58448. $ctx1.sendIdx["assert:equals:"]=3;
  58449. $self._assert_equals_((12).__slash((2)),(6));
  58450. $ctx1.sendIdx["assert:equals:"]=4;
  58451. $3=(3).__star((4));
  58452. $ctx1.sendIdx["*"]=1;
  58453. $self._assert_equals_($3,(12));
  58454. $ctx1.sendIdx["assert:equals:"]=5;
  58455. $self._assert_equals_((7).__slash_slash((2)),(3));
  58456. $ctx1.sendIdx["assert:equals:"]=6;
  58457. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58458. $ctx1.sendIdx["assert:equals:"]=7;
  58459. $5=(1).__plus((2));
  58460. $ctx1.sendIdx["+"]=2;
  58461. $4=$recv($5).__star((3));
  58462. $ctx1.sendIdx["*"]=2;
  58463. $self._assert_equals_($4,(9));
  58464. $ctx1.sendIdx["assert:equals:"]=8;
  58465. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58466. return self;
  58467. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58468. },
  58469. args: [],
  58470. 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",
  58471. referencedClasses: [],
  58472. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58473. }),
  58474. $globals.NumberTest);
  58475. $core.addMethod(
  58476. $core.method({
  58477. selector: "testAsNumber",
  58478. protocol: "tests",
  58479. fn: function (){
  58480. var self=this,$self=this;
  58481. return $core.withContext(function($ctx1) {
  58482. $self._assert_equals_((3)._asNumber(),(3));
  58483. return self;
  58484. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58485. },
  58486. args: [],
  58487. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58488. referencedClasses: [],
  58489. messageSends: ["assert:equals:", "asNumber"]
  58490. }),
  58491. $globals.NumberTest);
  58492. $core.addMethod(
  58493. $core.method({
  58494. selector: "testBetweenAnd",
  58495. protocol: "tests",
  58496. fn: function (){
  58497. var self=this,$self=this;
  58498. return $core.withContext(function($ctx1) {
  58499. var $1,$3,$2,$5,$4;
  58500. $1=(4)._between_and_((3),(5));
  58501. $ctx1.sendIdx["between:and:"]=1;
  58502. $self._assert_($1);
  58503. $ctx1.sendIdx["assert:"]=1;
  58504. $3=(1)._between_and_((5),(6));
  58505. $ctx1.sendIdx["between:and:"]=2;
  58506. $2=$recv($3)._not();
  58507. $ctx1.sendIdx["not"]=1;
  58508. $self._assert_($2);
  58509. $ctx1.sendIdx["assert:"]=2;
  58510. $5=(90)._between_and_((67),(87));
  58511. $ctx1.sendIdx["between:and:"]=3;
  58512. $4=$recv($5)._not();
  58513. $self._assert_($4);
  58514. $ctx1.sendIdx["assert:"]=3;
  58515. $self._assert_((1)._between_and_((1),(1)));
  58516. return self;
  58517. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58518. },
  58519. args: [],
  58520. source: "testBetweenAnd\x0a\x09self assert: (4 between: 3 and: 5).\x0a\x09self assert: (1 between: 5 and: 6) not.\x0a\x09self assert: (90 between: 67 and: 87) not.\x0a\x09self assert: (1 between: 1 and: 1).",
  58521. referencedClasses: [],
  58522. messageSends: ["assert:", "between:and:", "not"]
  58523. }),
  58524. $globals.NumberTest);
  58525. $core.addMethod(
  58526. $core.method({
  58527. selector: "testBitAnd",
  58528. protocol: "tests",
  58529. fn: function (){
  58530. var self=this,$self=this;
  58531. return $core.withContext(function($ctx1) {
  58532. var $1,$2;
  58533. $1=(15)._bitAnd_((2));
  58534. $ctx1.sendIdx["bitAnd:"]=1;
  58535. $self._assert_equals_($1,(2));
  58536. $ctx1.sendIdx["assert:equals:"]=1;
  58537. $2=(15)._bitAnd_((15));
  58538. $ctx1.sendIdx["bitAnd:"]=2;
  58539. $self._assert_equals_($2,(15));
  58540. $ctx1.sendIdx["assert:equals:"]=2;
  58541. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58542. return self;
  58543. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58544. },
  58545. args: [],
  58546. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58547. referencedClasses: [],
  58548. messageSends: ["assert:equals:", "bitAnd:"]
  58549. }),
  58550. $globals.NumberTest);
  58551. $core.addMethod(
  58552. $core.method({
  58553. selector: "testBitNot",
  58554. protocol: "tests",
  58555. fn: function (){
  58556. var self=this,$self=this;
  58557. return $core.withContext(function($ctx1) {
  58558. var $1,$2;
  58559. $1=(2)._bitNot();
  58560. $ctx1.sendIdx["bitNot"]=1;
  58561. $self._assert_equals_($1,(-3));
  58562. $ctx1.sendIdx["assert:equals:"]=1;
  58563. $2=(-1)._bitNot();
  58564. $ctx1.sendIdx["bitNot"]=2;
  58565. $self._assert_equals_($2,(0));
  58566. $ctx1.sendIdx["assert:equals:"]=2;
  58567. $self._assert_equals_((-1022)._bitNot(),(1021));
  58568. return self;
  58569. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58570. },
  58571. args: [],
  58572. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58573. referencedClasses: [],
  58574. messageSends: ["assert:equals:", "bitNot"]
  58575. }),
  58576. $globals.NumberTest);
  58577. $core.addMethod(
  58578. $core.method({
  58579. selector: "testBitOr",
  58580. protocol: "tests",
  58581. fn: function (){
  58582. var self=this,$self=this;
  58583. return $core.withContext(function($ctx1) {
  58584. var $1,$2;
  58585. $1=(2)._bitOr_((4));
  58586. $ctx1.sendIdx["bitOr:"]=1;
  58587. $self._assert_equals_($1,(6));
  58588. $ctx1.sendIdx["assert:equals:"]=1;
  58589. $2=(7)._bitOr_((2));
  58590. $ctx1.sendIdx["bitOr:"]=2;
  58591. $self._assert_equals_($2,(7));
  58592. $ctx1.sendIdx["assert:equals:"]=2;
  58593. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58594. return self;
  58595. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58596. },
  58597. args: [],
  58598. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58599. referencedClasses: [],
  58600. messageSends: ["assert:equals:", "bitOr:"]
  58601. }),
  58602. $globals.NumberTest);
  58603. $core.addMethod(
  58604. $core.method({
  58605. selector: "testBitXor",
  58606. protocol: "tests",
  58607. fn: function (){
  58608. var self=this,$self=this;
  58609. return $core.withContext(function($ctx1) {
  58610. var $1,$2,$3;
  58611. $1=(2)._bitXor_((4));
  58612. $ctx1.sendIdx["bitXor:"]=1;
  58613. $self._assert_equals_($1,(6));
  58614. $ctx1.sendIdx["assert:equals:"]=1;
  58615. $2=(7)._bitXor_((2));
  58616. $ctx1.sendIdx["bitXor:"]=2;
  58617. $self._assert_equals_($2,(5));
  58618. $ctx1.sendIdx["assert:equals:"]=2;
  58619. $3=(-1)._bitXor_((1021));
  58620. $ctx1.sendIdx["bitXor:"]=3;
  58621. $self._assert_equals_($3,(-1022));
  58622. $ctx1.sendIdx["assert:equals:"]=3;
  58623. $self._assert_equals_((91)._bitXor_((91)),(0));
  58624. return self;
  58625. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58626. },
  58627. args: [],
  58628. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58629. referencedClasses: [],
  58630. messageSends: ["assert:equals:", "bitXor:"]
  58631. }),
  58632. $globals.NumberTest);
  58633. $core.addMethod(
  58634. $core.method({
  58635. selector: "testCeiling",
  58636. protocol: "tests",
  58637. fn: function (){
  58638. var self=this,$self=this;
  58639. return $core.withContext(function($ctx1) {
  58640. var $1,$2;
  58641. $1=(1.2)._ceiling();
  58642. $ctx1.sendIdx["ceiling"]=1;
  58643. $self._assert_equals_($1,(2));
  58644. $ctx1.sendIdx["assert:equals:"]=1;
  58645. $2=(-1.2)._ceiling();
  58646. $ctx1.sendIdx["ceiling"]=2;
  58647. $self._assert_equals_($2,(-1));
  58648. $ctx1.sendIdx["assert:equals:"]=2;
  58649. $self._assert_equals_((1)._ceiling(),(1));
  58650. return self;
  58651. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58652. },
  58653. args: [],
  58654. 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.",
  58655. referencedClasses: [],
  58656. messageSends: ["assert:equals:", "ceiling"]
  58657. }),
  58658. $globals.NumberTest);
  58659. $core.addMethod(
  58660. $core.method({
  58661. selector: "testComparison",
  58662. protocol: "tests",
  58663. fn: function (){
  58664. var self=this,$self=this;
  58665. return $core.withContext(function($ctx1) {
  58666. var $1,$2,$3,$4;
  58667. $1=(3).__gt((2));
  58668. $ctx1.sendIdx[">"]=1;
  58669. $self._assert_($1);
  58670. $ctx1.sendIdx["assert:"]=1;
  58671. $2=(2).__lt((3));
  58672. $ctx1.sendIdx["<"]=1;
  58673. $self._assert_($2);
  58674. $ctx1.sendIdx["assert:"]=2;
  58675. $self._deny_((3).__lt((2)));
  58676. $ctx1.sendIdx["deny:"]=1;
  58677. $self._deny_((2).__gt((3)));
  58678. $3=(3).__gt_eq((3));
  58679. $ctx1.sendIdx[">="]=1;
  58680. $self._assert_($3);
  58681. $ctx1.sendIdx["assert:"]=3;
  58682. $self._assert_((3.1).__gt_eq((3)));
  58683. $ctx1.sendIdx["assert:"]=4;
  58684. $4=(3).__lt_eq((3));
  58685. $ctx1.sendIdx["<="]=1;
  58686. $self._assert_($4);
  58687. $ctx1.sendIdx["assert:"]=5;
  58688. $self._assert_((3).__lt_eq((3.1)));
  58689. return self;
  58690. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58691. },
  58692. args: [],
  58693. 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",
  58694. referencedClasses: [],
  58695. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58696. }),
  58697. $globals.NumberTest);
  58698. $core.addMethod(
  58699. $core.method({
  58700. selector: "testCopying",
  58701. protocol: "tests",
  58702. fn: function (){
  58703. var self=this,$self=this;
  58704. return $core.withContext(function($ctx1) {
  58705. var $1;
  58706. $1=$recv((1)._copy()).__eq_eq((1));
  58707. $ctx1.sendIdx["=="]=1;
  58708. $self._assert_($1);
  58709. $ctx1.sendIdx["assert:"]=1;
  58710. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58711. return self;
  58712. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58713. },
  58714. args: [],
  58715. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58716. referencedClasses: [],
  58717. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58718. }),
  58719. $globals.NumberTest);
  58720. $core.addMethod(
  58721. $core.method({
  58722. selector: "testDegreesToRadians",
  58723. protocol: "tests",
  58724. fn: function (){
  58725. var self=this,$self=this;
  58726. return $core.withContext(function($ctx1) {
  58727. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58728. return self;
  58729. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58730. },
  58731. args: [],
  58732. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58733. referencedClasses: ["Number"],
  58734. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58735. }),
  58736. $globals.NumberTest);
  58737. $core.addMethod(
  58738. $core.method({
  58739. selector: "testEquality",
  58740. protocol: "tests",
  58741. fn: function (){
  58742. var self=this,$self=this;
  58743. return $core.withContext(function($ctx1) {
  58744. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58745. $1=(1).__eq((1));
  58746. $ctx1.sendIdx["="]=1;
  58747. $self._assert_($1);
  58748. $ctx1.sendIdx["assert:"]=1;
  58749. $2=(0).__eq((0));
  58750. $ctx1.sendIdx["="]=2;
  58751. $self._assert_($2);
  58752. $ctx1.sendIdx["assert:"]=2;
  58753. $3=(1).__eq((0));
  58754. $ctx1.sendIdx["="]=3;
  58755. $self._deny_($3);
  58756. $ctx1.sendIdx["deny:"]=1;
  58757. $5=(1)._yourself();
  58758. $ctx1.sendIdx["yourself"]=1;
  58759. $4=$recv($5).__eq((1));
  58760. $ctx1.sendIdx["="]=4;
  58761. $self._assert_($4);
  58762. $ctx1.sendIdx["assert:"]=3;
  58763. $7=(1)._yourself();
  58764. $ctx1.sendIdx["yourself"]=2;
  58765. $6=(1).__eq($7);
  58766. $ctx1.sendIdx["="]=5;
  58767. $self._assert_($6);
  58768. $ctx1.sendIdx["assert:"]=4;
  58769. $9=(1)._yourself();
  58770. $ctx1.sendIdx["yourself"]=3;
  58771. $8=$recv($9).__eq((1)._yourself());
  58772. $ctx1.sendIdx["="]=6;
  58773. $self._assert_($8);
  58774. $10=(0).__eq(false);
  58775. $ctx1.sendIdx["="]=7;
  58776. $self._deny_($10);
  58777. $ctx1.sendIdx["deny:"]=2;
  58778. $11=false.__eq((0));
  58779. $ctx1.sendIdx["="]=8;
  58780. $self._deny_($11);
  58781. $ctx1.sendIdx["deny:"]=3;
  58782. $12="".__eq((0));
  58783. $ctx1.sendIdx["="]=9;
  58784. $self._deny_($12);
  58785. $ctx1.sendIdx["deny:"]=4;
  58786. $self._deny_((0).__eq(""));
  58787. return self;
  58788. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58789. },
  58790. args: [],
  58791. 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 = ''",
  58792. referencedClasses: [],
  58793. messageSends: ["assert:", "=", "deny:", "yourself"]
  58794. }),
  58795. $globals.NumberTest);
  58796. $core.addMethod(
  58797. $core.method({
  58798. selector: "testFloor",
  58799. protocol: "tests",
  58800. fn: function (){
  58801. var self=this,$self=this;
  58802. return $core.withContext(function($ctx1) {
  58803. var $1,$2;
  58804. $1=(1.2)._floor();
  58805. $ctx1.sendIdx["floor"]=1;
  58806. $self._assert_equals_($1,(1));
  58807. $ctx1.sendIdx["assert:equals:"]=1;
  58808. $2=(-1.2)._floor();
  58809. $ctx1.sendIdx["floor"]=2;
  58810. $self._assert_equals_($2,(-2));
  58811. $ctx1.sendIdx["assert:equals:"]=2;
  58812. $self._assert_equals_((1)._floor(),(1));
  58813. return self;
  58814. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58815. },
  58816. args: [],
  58817. 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.",
  58818. referencedClasses: [],
  58819. messageSends: ["assert:equals:", "floor"]
  58820. }),
  58821. $globals.NumberTest);
  58822. $core.addMethod(
  58823. $core.method({
  58824. selector: "testHexNumbers",
  58825. protocol: "tests",
  58826. fn: function (){
  58827. var self=this,$self=this;
  58828. return $core.withContext(function($ctx1) {
  58829. var $1,$2,$3,$4,$5;
  58830. $self._assert_equals_((9),(9));
  58831. $ctx1.sendIdx["assert:equals:"]=1;
  58832. $1=(10)._truncated();
  58833. $ctx1.sendIdx["truncated"]=1;
  58834. $self._assert_equals_($1,(10));
  58835. $ctx1.sendIdx["assert:equals:"]=2;
  58836. $2=(11)._truncated();
  58837. $ctx1.sendIdx["truncated"]=2;
  58838. $self._assert_equals_($2,(11));
  58839. $ctx1.sendIdx["assert:equals:"]=3;
  58840. $3=(12)._truncated();
  58841. $ctx1.sendIdx["truncated"]=3;
  58842. $self._assert_equals_($3,(12));
  58843. $ctx1.sendIdx["assert:equals:"]=4;
  58844. $4=(13)._truncated();
  58845. $ctx1.sendIdx["truncated"]=4;
  58846. $self._assert_equals_($4,(13));
  58847. $ctx1.sendIdx["assert:equals:"]=5;
  58848. $5=(14)._truncated();
  58849. $ctx1.sendIdx["truncated"]=5;
  58850. $self._assert_equals_($5,(14));
  58851. $ctx1.sendIdx["assert:equals:"]=6;
  58852. $self._assert_equals_((15)._truncated(),(15));
  58853. return self;
  58854. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58855. },
  58856. args: [],
  58857. 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",
  58858. referencedClasses: [],
  58859. messageSends: ["assert:equals:", "truncated"]
  58860. }),
  58861. $globals.NumberTest);
  58862. $core.addMethod(
  58863. $core.method({
  58864. selector: "testIdentity",
  58865. protocol: "tests",
  58866. fn: function (){
  58867. var self=this,$self=this;
  58868. return $core.withContext(function($ctx1) {
  58869. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58870. $1=(1).__eq_eq((1));
  58871. $ctx1.sendIdx["=="]=1;
  58872. $self._assert_($1);
  58873. $ctx1.sendIdx["assert:"]=1;
  58874. $2=(0).__eq_eq((0));
  58875. $ctx1.sendIdx["=="]=2;
  58876. $self._assert_($2);
  58877. $ctx1.sendIdx["assert:"]=2;
  58878. $3=(1).__eq_eq((0));
  58879. $ctx1.sendIdx["=="]=3;
  58880. $self._deny_($3);
  58881. $ctx1.sendIdx["deny:"]=1;
  58882. $5=(1)._yourself();
  58883. $ctx1.sendIdx["yourself"]=1;
  58884. $4=$recv($5).__eq_eq((1));
  58885. $ctx1.sendIdx["=="]=4;
  58886. $self._assert_($4);
  58887. $ctx1.sendIdx["assert:"]=3;
  58888. $7=(1)._yourself();
  58889. $ctx1.sendIdx["yourself"]=2;
  58890. $6=(1).__eq_eq($7);
  58891. $ctx1.sendIdx["=="]=5;
  58892. $self._assert_($6);
  58893. $ctx1.sendIdx["assert:"]=4;
  58894. $9=(1)._yourself();
  58895. $ctx1.sendIdx["yourself"]=3;
  58896. $8=$recv($9).__eq_eq((1)._yourself());
  58897. $ctx1.sendIdx["=="]=6;
  58898. $self._assert_($8);
  58899. $self._deny_((1).__eq_eq((2)));
  58900. return self;
  58901. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58902. },
  58903. args: [],
  58904. 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",
  58905. referencedClasses: [],
  58906. messageSends: ["assert:", "==", "deny:", "yourself"]
  58907. }),
  58908. $globals.NumberTest);
  58909. $core.addMethod(
  58910. $core.method({
  58911. selector: "testInvalidHexNumbers",
  58912. protocol: "tests",
  58913. fn: function (){
  58914. var self=this,$self=this;
  58915. return $core.withContext(function($ctx1) {
  58916. $self._should_raise_((function(){
  58917. return $core.withContext(function($ctx2) {
  58918. return (16)._rG();
  58919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58920. }),$globals.MessageNotUnderstood);
  58921. $ctx1.sendIdx["should:raise:"]=1;
  58922. $self._should_raise_((function(){
  58923. return $core.withContext(function($ctx2) {
  58924. return (16)._rg();
  58925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58926. }),$globals.MessageNotUnderstood);
  58927. $ctx1.sendIdx["should:raise:"]=2;
  58928. $self._should_raise_((function(){
  58929. return $core.withContext(function($ctx2) {
  58930. return (16)._rH();
  58931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58932. }),$globals.MessageNotUnderstood);
  58933. $ctx1.sendIdx["should:raise:"]=3;
  58934. $self._should_raise_((function(){
  58935. return $core.withContext(function($ctx2) {
  58936. return (16)._rh();
  58937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58938. }),$globals.MessageNotUnderstood);
  58939. $ctx1.sendIdx["should:raise:"]=4;
  58940. $self._should_raise_((function(){
  58941. return $core.withContext(function($ctx2) {
  58942. return (16)._rI();
  58943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58944. }),$globals.MessageNotUnderstood);
  58945. $ctx1.sendIdx["should:raise:"]=5;
  58946. $self._should_raise_((function(){
  58947. return $core.withContext(function($ctx2) {
  58948. return (16)._ri();
  58949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58950. }),$globals.MessageNotUnderstood);
  58951. $ctx1.sendIdx["should:raise:"]=6;
  58952. $self._should_raise_((function(){
  58953. return $core.withContext(function($ctx2) {
  58954. return (16)._rJ();
  58955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58956. }),$globals.MessageNotUnderstood);
  58957. $ctx1.sendIdx["should:raise:"]=7;
  58958. $self._should_raise_((function(){
  58959. return $core.withContext(function($ctx2) {
  58960. return (16)._rj();
  58961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58962. }),$globals.MessageNotUnderstood);
  58963. $ctx1.sendIdx["should:raise:"]=8;
  58964. $self._should_raise_((function(){
  58965. return $core.withContext(function($ctx2) {
  58966. return (16)._rK();
  58967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58968. }),$globals.MessageNotUnderstood);
  58969. $ctx1.sendIdx["should:raise:"]=9;
  58970. $self._should_raise_((function(){
  58971. return $core.withContext(function($ctx2) {
  58972. return (16)._rk();
  58973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58974. }),$globals.MessageNotUnderstood);
  58975. $ctx1.sendIdx["should:raise:"]=10;
  58976. $self._should_raise_((function(){
  58977. return $core.withContext(function($ctx2) {
  58978. return (16)._rL();
  58979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58980. }),$globals.MessageNotUnderstood);
  58981. $ctx1.sendIdx["should:raise:"]=11;
  58982. $self._should_raise_((function(){
  58983. return $core.withContext(function($ctx2) {
  58984. return (16)._rl();
  58985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58986. }),$globals.MessageNotUnderstood);
  58987. $ctx1.sendIdx["should:raise:"]=12;
  58988. $self._should_raise_((function(){
  58989. return $core.withContext(function($ctx2) {
  58990. return (16)._rM();
  58991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58992. }),$globals.MessageNotUnderstood);
  58993. $ctx1.sendIdx["should:raise:"]=13;
  58994. $self._should_raise_((function(){
  58995. return $core.withContext(function($ctx2) {
  58996. return (16)._rm();
  58997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58998. }),$globals.MessageNotUnderstood);
  58999. $ctx1.sendIdx["should:raise:"]=14;
  59000. $self._should_raise_((function(){
  59001. return $core.withContext(function($ctx2) {
  59002. return (16)._rN();
  59003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59004. }),$globals.MessageNotUnderstood);
  59005. $ctx1.sendIdx["should:raise:"]=15;
  59006. $self._should_raise_((function(){
  59007. return $core.withContext(function($ctx2) {
  59008. return (16)._rn();
  59009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59010. }),$globals.MessageNotUnderstood);
  59011. $ctx1.sendIdx["should:raise:"]=16;
  59012. $self._should_raise_((function(){
  59013. return $core.withContext(function($ctx2) {
  59014. return (16)._rO();
  59015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59016. }),$globals.MessageNotUnderstood);
  59017. $ctx1.sendIdx["should:raise:"]=17;
  59018. $self._should_raise_((function(){
  59019. return $core.withContext(function($ctx2) {
  59020. return (16)._ro();
  59021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59022. }),$globals.MessageNotUnderstood);
  59023. $ctx1.sendIdx["should:raise:"]=18;
  59024. $self._should_raise_((function(){
  59025. return $core.withContext(function($ctx2) {
  59026. return (16)._rP();
  59027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59028. }),$globals.MessageNotUnderstood);
  59029. $ctx1.sendIdx["should:raise:"]=19;
  59030. $self._should_raise_((function(){
  59031. return $core.withContext(function($ctx2) {
  59032. return (16)._rp();
  59033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59034. }),$globals.MessageNotUnderstood);
  59035. $ctx1.sendIdx["should:raise:"]=20;
  59036. $self._should_raise_((function(){
  59037. return $core.withContext(function($ctx2) {
  59038. return (16)._rQ();
  59039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59040. }),$globals.MessageNotUnderstood);
  59041. $ctx1.sendIdx["should:raise:"]=21;
  59042. $self._should_raise_((function(){
  59043. return $core.withContext(function($ctx2) {
  59044. return (16)._rq();
  59045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59046. }),$globals.MessageNotUnderstood);
  59047. $ctx1.sendIdx["should:raise:"]=22;
  59048. $self._should_raise_((function(){
  59049. return $core.withContext(function($ctx2) {
  59050. return (16)._rR();
  59051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59052. }),$globals.MessageNotUnderstood);
  59053. $ctx1.sendIdx["should:raise:"]=23;
  59054. $self._should_raise_((function(){
  59055. return $core.withContext(function($ctx2) {
  59056. return (16)._rr();
  59057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59058. }),$globals.MessageNotUnderstood);
  59059. $ctx1.sendIdx["should:raise:"]=24;
  59060. $self._should_raise_((function(){
  59061. return $core.withContext(function($ctx2) {
  59062. return (16)._rS();
  59063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59064. }),$globals.MessageNotUnderstood);
  59065. $ctx1.sendIdx["should:raise:"]=25;
  59066. $self._should_raise_((function(){
  59067. return $core.withContext(function($ctx2) {
  59068. return (16)._rs();
  59069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59070. }),$globals.MessageNotUnderstood);
  59071. $ctx1.sendIdx["should:raise:"]=26;
  59072. $self._should_raise_((function(){
  59073. return $core.withContext(function($ctx2) {
  59074. return (16)._rT();
  59075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59076. }),$globals.MessageNotUnderstood);
  59077. $ctx1.sendIdx["should:raise:"]=27;
  59078. $self._should_raise_((function(){
  59079. return $core.withContext(function($ctx2) {
  59080. return (16)._rt();
  59081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59082. }),$globals.MessageNotUnderstood);
  59083. $ctx1.sendIdx["should:raise:"]=28;
  59084. $self._should_raise_((function(){
  59085. return $core.withContext(function($ctx2) {
  59086. return (16)._rU();
  59087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59088. }),$globals.MessageNotUnderstood);
  59089. $ctx1.sendIdx["should:raise:"]=29;
  59090. $self._should_raise_((function(){
  59091. return $core.withContext(function($ctx2) {
  59092. return (16)._ru();
  59093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59094. }),$globals.MessageNotUnderstood);
  59095. $ctx1.sendIdx["should:raise:"]=30;
  59096. $self._should_raise_((function(){
  59097. return $core.withContext(function($ctx2) {
  59098. return (16)._rV();
  59099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59100. }),$globals.MessageNotUnderstood);
  59101. $ctx1.sendIdx["should:raise:"]=31;
  59102. $self._should_raise_((function(){
  59103. return $core.withContext(function($ctx2) {
  59104. return (16)._rv();
  59105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59106. }),$globals.MessageNotUnderstood);
  59107. $ctx1.sendIdx["should:raise:"]=32;
  59108. $self._should_raise_((function(){
  59109. return $core.withContext(function($ctx2) {
  59110. return (16)._rW();
  59111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59112. }),$globals.MessageNotUnderstood);
  59113. $ctx1.sendIdx["should:raise:"]=33;
  59114. $self._should_raise_((function(){
  59115. return $core.withContext(function($ctx2) {
  59116. return (16)._rw();
  59117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59118. }),$globals.MessageNotUnderstood);
  59119. $ctx1.sendIdx["should:raise:"]=34;
  59120. $self._should_raise_((function(){
  59121. return $core.withContext(function($ctx2) {
  59122. return (16)._rX();
  59123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59124. }),$globals.MessageNotUnderstood);
  59125. $ctx1.sendIdx["should:raise:"]=35;
  59126. $self._should_raise_((function(){
  59127. return $core.withContext(function($ctx2) {
  59128. return (16)._rx();
  59129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59130. }),$globals.MessageNotUnderstood);
  59131. $ctx1.sendIdx["should:raise:"]=36;
  59132. $self._should_raise_((function(){
  59133. return $core.withContext(function($ctx2) {
  59134. return (16)._rY();
  59135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59136. }),$globals.MessageNotUnderstood);
  59137. $ctx1.sendIdx["should:raise:"]=37;
  59138. $self._should_raise_((function(){
  59139. return $core.withContext(function($ctx2) {
  59140. return (16)._ry();
  59141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59142. }),$globals.MessageNotUnderstood);
  59143. $ctx1.sendIdx["should:raise:"]=38;
  59144. $self._should_raise_((function(){
  59145. return $core.withContext(function($ctx2) {
  59146. return (16)._rZ();
  59147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59148. }),$globals.MessageNotUnderstood);
  59149. $ctx1.sendIdx["should:raise:"]=39;
  59150. $self._should_raise_((function(){
  59151. return $core.withContext(function($ctx2) {
  59152. return (16)._rz();
  59153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59154. }),$globals.MessageNotUnderstood);
  59155. $ctx1.sendIdx["should:raise:"]=40;
  59156. $self._should_raise_((function(){
  59157. return $core.withContext(function($ctx2) {
  59158. return (11259375)._Z();
  59159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59160. }),$globals.MessageNotUnderstood);
  59161. return self;
  59162. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59163. },
  59164. args: [],
  59165. 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.",
  59166. referencedClasses: ["MessageNotUnderstood"],
  59167. 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"]
  59168. }),
  59169. $globals.NumberTest);
  59170. $core.addMethod(
  59171. $core.method({
  59172. selector: "testLog",
  59173. protocol: "tests",
  59174. fn: function (){
  59175. var self=this,$self=this;
  59176. return $core.withContext(function($ctx1) {
  59177. $self._assert_equals_((10000)._log(),(4));
  59178. $ctx1.sendIdx["assert:equals:"]=1;
  59179. $self._assert_equals_((512)._log_((2)),(9));
  59180. $ctx1.sendIdx["assert:equals:"]=2;
  59181. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59182. return self;
  59183. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59184. },
  59185. args: [],
  59186. 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.",
  59187. referencedClasses: ["Number"],
  59188. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59189. }),
  59190. $globals.NumberTest);
  59191. $core.addMethod(
  59192. $core.method({
  59193. selector: "testMinMax",
  59194. protocol: "tests",
  59195. fn: function (){
  59196. var self=this,$self=this;
  59197. return $core.withContext(function($ctx1) {
  59198. var $1,$2;
  59199. $self._assert_equals_((2)._max_((5)),(5));
  59200. $ctx1.sendIdx["assert:equals:"]=1;
  59201. $self._assert_equals_((2)._min_((5)),(2));
  59202. $ctx1.sendIdx["assert:equals:"]=2;
  59203. $1=(2)._min_max_((5),(3));
  59204. $ctx1.sendIdx["min:max:"]=1;
  59205. $self._assert_equals_($1,(3));
  59206. $ctx1.sendIdx["assert:equals:"]=3;
  59207. $2=(7)._min_max_((5),(3));
  59208. $ctx1.sendIdx["min:max:"]=2;
  59209. $self._assert_equals_($2,(5));
  59210. $ctx1.sendIdx["assert:equals:"]=4;
  59211. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59212. return self;
  59213. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59214. },
  59215. args: [],
  59216. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2.\x0a\x09self assert: (2 min: 5 max: 3) equals: 3.\x0a\x09self assert: (7 min: 5 max: 3) equals: 5.\x0a\x09self assert: (4 min: 5 max: 3) equals: 4.",
  59217. referencedClasses: [],
  59218. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59219. }),
  59220. $globals.NumberTest);
  59221. $core.addMethod(
  59222. $core.method({
  59223. selector: "testNegated",
  59224. protocol: "tests",
  59225. fn: function (){
  59226. var self=this,$self=this;
  59227. return $core.withContext(function($ctx1) {
  59228. var $1;
  59229. $1=(3)._negated();
  59230. $ctx1.sendIdx["negated"]=1;
  59231. $self._assert_equals_($1,(-3));
  59232. $ctx1.sendIdx["assert:equals:"]=1;
  59233. $self._assert_equals_((-3)._negated(),(3));
  59234. return self;
  59235. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59236. },
  59237. args: [],
  59238. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59239. referencedClasses: [],
  59240. messageSends: ["assert:equals:", "negated"]
  59241. }),
  59242. $globals.NumberTest);
  59243. $core.addMethod(
  59244. $core.method({
  59245. selector: "testPrintShowingDecimalPlaces",
  59246. protocol: "tests",
  59247. fn: function (){
  59248. var self=this,$self=this;
  59249. return $core.withContext(function($ctx1) {
  59250. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59251. $1=(23)._printShowingDecimalPlaces_((2));
  59252. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59253. $self._assert_equals_($1,"23.00");
  59254. $ctx1.sendIdx["assert:equals:"]=1;
  59255. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59256. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59257. $self._assert_equals_($2,"23.57");
  59258. $ctx1.sendIdx["assert:equals:"]=2;
  59259. $4=(234.567)._negated();
  59260. $ctx1.sendIdx["negated"]=1;
  59261. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59262. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59263. $self._assert_equals_($3,"-234.56700");
  59264. $ctx1.sendIdx["assert:equals:"]=3;
  59265. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59266. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59267. $self._assert_equals_($5,"23");
  59268. $ctx1.sendIdx["assert:equals:"]=4;
  59269. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59270. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59271. $self._assert_equals_($6,"24");
  59272. $ctx1.sendIdx["assert:equals:"]=5;
  59273. $8=(23.4567)._negated();
  59274. $ctx1.sendIdx["negated"]=2;
  59275. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59276. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59277. $self._assert_equals_($7,"-23");
  59278. $ctx1.sendIdx["assert:equals:"]=6;
  59279. $10=(23.5567)._negated();
  59280. $ctx1.sendIdx["negated"]=3;
  59281. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59282. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59283. $self._assert_equals_($9,"-24");
  59284. $ctx1.sendIdx["assert:equals:"]=7;
  59285. $11=(100000000)._printShowingDecimalPlaces_((1));
  59286. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59287. $self._assert_equals_($11,"100000000.0");
  59288. $ctx1.sendIdx["assert:equals:"]=8;
  59289. $12=(0.98)._printShowingDecimalPlaces_((5));
  59290. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59291. $self._assert_equals_($12,"0.98000");
  59292. $ctx1.sendIdx["assert:equals:"]=9;
  59293. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59294. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59295. $self._assert_equals_($13,"-0.98");
  59296. $ctx1.sendIdx["assert:equals:"]=10;
  59297. $14=(2.567)._printShowingDecimalPlaces_((2));
  59298. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59299. $self._assert_equals_($14,"2.57");
  59300. $ctx1.sendIdx["assert:equals:"]=11;
  59301. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59302. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59303. $self._assert_equals_($15,"-2.57");
  59304. $ctx1.sendIdx["assert:equals:"]=12;
  59305. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59306. return self;
  59307. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59308. },
  59309. args: [],
  59310. 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'.",
  59311. referencedClasses: [],
  59312. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59313. }),
  59314. $globals.NumberTest);
  59315. $core.addMethod(
  59316. $core.method({
  59317. selector: "testPrintStringBase",
  59318. protocol: "tests",
  59319. fn: function (){
  59320. var self=this,$self=this;
  59321. return $core.withContext(function($ctx1) {
  59322. var $1,$2,$3;
  59323. $1=(15)._printStringBase_((2));
  59324. $ctx1.sendIdx["printStringBase:"]=1;
  59325. $self._assert_equals_($1,"1111");
  59326. $ctx1.sendIdx["assert:equals:"]=1;
  59327. $2=(15)._printStringBase_((16));
  59328. $ctx1.sendIdx["printStringBase:"]=2;
  59329. $self._assert_equals_($2,"f");
  59330. $ctx1.sendIdx["assert:equals:"]=2;
  59331. $3=(256)._printStringBase_((16));
  59332. $ctx1.sendIdx["printStringBase:"]=3;
  59333. $self._assert_equals_($3,"100");
  59334. $ctx1.sendIdx["assert:equals:"]=3;
  59335. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59336. return self;
  59337. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59338. },
  59339. args: [],
  59340. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59341. referencedClasses: [],
  59342. messageSends: ["assert:equals:", "printStringBase:"]
  59343. }),
  59344. $globals.NumberTest);
  59345. $core.addMethod(
  59346. $core.method({
  59347. selector: "testRadiansToDegrees",
  59348. protocol: "tests",
  59349. fn: function (){
  59350. var self=this,$self=this;
  59351. return $core.withContext(function($ctx1) {
  59352. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59353. return self;
  59354. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59355. },
  59356. args: [],
  59357. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59358. referencedClasses: ["Number"],
  59359. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59360. }),
  59361. $globals.NumberTest);
  59362. $core.addMethod(
  59363. $core.method({
  59364. selector: "testRaisedTo",
  59365. protocol: "tests",
  59366. fn: function (){
  59367. var self=this,$self=this;
  59368. return $core.withContext(function($ctx1) {
  59369. var $1,$2,$3;
  59370. $1=(2)._raisedTo_((4));
  59371. $ctx1.sendIdx["raisedTo:"]=1;
  59372. $self._assert_equals_($1,(16));
  59373. $ctx1.sendIdx["assert:equals:"]=1;
  59374. $2=(2)._raisedTo_((0));
  59375. $ctx1.sendIdx["raisedTo:"]=2;
  59376. $self._assert_equals_($2,(1));
  59377. $ctx1.sendIdx["assert:equals:"]=2;
  59378. $3=(2)._raisedTo_((-3));
  59379. $ctx1.sendIdx["raisedTo:"]=3;
  59380. $self._assert_equals_($3,(0.125));
  59381. $ctx1.sendIdx["assert:equals:"]=3;
  59382. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59383. $ctx1.sendIdx["assert:equals:"]=4;
  59384. $self._assert_equals_((2).__star_star((4)),(16));
  59385. return self;
  59386. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59387. },
  59388. args: [],
  59389. 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.",
  59390. referencedClasses: [],
  59391. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59392. }),
  59393. $globals.NumberTest);
  59394. $core.addMethod(
  59395. $core.method({
  59396. selector: "testRounded",
  59397. protocol: "tests",
  59398. fn: function (){
  59399. var self=this,$self=this;
  59400. return $core.withContext(function($ctx1) {
  59401. var $1,$2;
  59402. $1=(3)._rounded();
  59403. $ctx1.sendIdx["rounded"]=1;
  59404. $self._assert_equals_($1,(3));
  59405. $ctx1.sendIdx["assert:equals:"]=1;
  59406. $2=(3.212)._rounded();
  59407. $ctx1.sendIdx["rounded"]=2;
  59408. $self._assert_equals_($2,(3));
  59409. $ctx1.sendIdx["assert:equals:"]=2;
  59410. $self._assert_equals_((3.51)._rounded(),(4));
  59411. return self;
  59412. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59413. },
  59414. args: [],
  59415. 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",
  59416. referencedClasses: [],
  59417. messageSends: ["assert:equals:", "rounded"]
  59418. }),
  59419. $globals.NumberTest);
  59420. $core.addMethod(
  59421. $core.method({
  59422. selector: "testSign",
  59423. protocol: "tests",
  59424. fn: function (){
  59425. var self=this,$self=this;
  59426. return $core.withContext(function($ctx1) {
  59427. var $1,$2;
  59428. $1=(5)._sign();
  59429. $ctx1.sendIdx["sign"]=1;
  59430. $self._assert_equals_($1,(1));
  59431. $ctx1.sendIdx["assert:equals:"]=1;
  59432. $2=(0)._sign();
  59433. $ctx1.sendIdx["sign"]=2;
  59434. $self._assert_equals_($2,(0));
  59435. $ctx1.sendIdx["assert:equals:"]=2;
  59436. $self._assert_equals_((-1.4)._sign(),(-1));
  59437. return self;
  59438. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59439. },
  59440. args: [],
  59441. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59442. referencedClasses: [],
  59443. messageSends: ["assert:equals:", "sign"]
  59444. }),
  59445. $globals.NumberTest);
  59446. $core.addMethod(
  59447. $core.method({
  59448. selector: "testSqrt",
  59449. protocol: "tests",
  59450. fn: function (){
  59451. var self=this,$self=this;
  59452. return $core.withContext(function($ctx1) {
  59453. var $1;
  59454. $1=(4)._sqrt();
  59455. $ctx1.sendIdx["sqrt"]=1;
  59456. $self._assert_equals_($1,(2));
  59457. $ctx1.sendIdx["assert:equals:"]=1;
  59458. $self._assert_equals_((16)._sqrt(),(4));
  59459. return self;
  59460. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59461. },
  59462. args: [],
  59463. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59464. referencedClasses: [],
  59465. messageSends: ["assert:equals:", "sqrt"]
  59466. }),
  59467. $globals.NumberTest);
  59468. $core.addMethod(
  59469. $core.method({
  59470. selector: "testSquared",
  59471. protocol: "tests",
  59472. fn: function (){
  59473. var self=this,$self=this;
  59474. return $core.withContext(function($ctx1) {
  59475. $self._assert_equals_((4)._squared(),(16));
  59476. return self;
  59477. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59478. },
  59479. args: [],
  59480. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59481. referencedClasses: [],
  59482. messageSends: ["assert:equals:", "squared"]
  59483. }),
  59484. $globals.NumberTest);
  59485. $core.addMethod(
  59486. $core.method({
  59487. selector: "testTimesRepeat",
  59488. protocol: "tests",
  59489. fn: function (){
  59490. var self=this,$self=this;
  59491. var i;
  59492. return $core.withContext(function($ctx1) {
  59493. i=(0);
  59494. (0)._timesRepeat_((function(){
  59495. return $core.withContext(function($ctx2) {
  59496. i=$recv(i).__plus((1));
  59497. $ctx2.sendIdx["+"]=1;
  59498. return i;
  59499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59500. }));
  59501. $ctx1.sendIdx["timesRepeat:"]=1;
  59502. $self._assert_equals_(i,(0));
  59503. $ctx1.sendIdx["assert:equals:"]=1;
  59504. (5)._timesRepeat_((function(){
  59505. return $core.withContext(function($ctx2) {
  59506. i=$recv(i).__plus((1));
  59507. return i;
  59508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59509. }));
  59510. $self._assert_equals_(i,(5));
  59511. return self;
  59512. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59513. },
  59514. args: [],
  59515. 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",
  59516. referencedClasses: [],
  59517. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59518. }),
  59519. $globals.NumberTest);
  59520. $core.addMethod(
  59521. $core.method({
  59522. selector: "testTo",
  59523. protocol: "tests",
  59524. fn: function (){
  59525. var self=this,$self=this;
  59526. return $core.withContext(function($ctx1) {
  59527. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59528. return self;
  59529. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59530. },
  59531. args: [],
  59532. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59533. referencedClasses: [],
  59534. messageSends: ["assert:equals:", "to:"]
  59535. }),
  59536. $globals.NumberTest);
  59537. $core.addMethod(
  59538. $core.method({
  59539. selector: "testToBy",
  59540. protocol: "tests",
  59541. fn: function (){
  59542. var self=this,$self=this;
  59543. return $core.withContext(function($ctx1) {
  59544. var $1;
  59545. $1=(0)._to_by_((6),(2));
  59546. $ctx1.sendIdx["to:by:"]=1;
  59547. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59548. $self._should_raise_((function(){
  59549. return $core.withContext(function($ctx2) {
  59550. return (1)._to_by_((4),(0));
  59551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59552. }),$globals.Error);
  59553. return self;
  59554. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59555. },
  59556. args: [],
  59557. 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",
  59558. referencedClasses: ["Error"],
  59559. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59560. }),
  59561. $globals.NumberTest);
  59562. $core.addMethod(
  59563. $core.method({
  59564. selector: "testTrigonometry",
  59565. protocol: "tests",
  59566. fn: function (){
  59567. var self=this,$self=this;
  59568. return $core.withContext(function($ctx1) {
  59569. var $1;
  59570. $self._assert_equals_((0)._cos(),(1));
  59571. $ctx1.sendIdx["assert:equals:"]=1;
  59572. $self._assert_equals_((0)._sin(),(0));
  59573. $ctx1.sendIdx["assert:equals:"]=2;
  59574. $self._assert_equals_((0)._tan(),(0));
  59575. $ctx1.sendIdx["assert:equals:"]=3;
  59576. $self._assert_equals_((1)._arcCos(),(0));
  59577. $ctx1.sendIdx["assert:equals:"]=4;
  59578. $self._assert_equals_((0)._arcSin(),(0));
  59579. $ctx1.sendIdx["assert:equals:"]=5;
  59580. $self._assert_equals_((0)._arcTan(),(0));
  59581. $ctx1.sendIdx["assert:equals:"]=6;
  59582. $1=(0)._arcTan_((1));
  59583. $ctx1.sendIdx["arcTan:"]=1;
  59584. $self._assert_equals_($1,(0));
  59585. $ctx1.sendIdx["assert:equals:"]=7;
  59586. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59587. return self;
  59588. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59589. },
  59590. args: [],
  59591. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.\x0a\x09\x0a\x09self assert: (0 arcTan: 1) equals: 0.\x0a\x09self assert: (1 arcTan: 0) equals: (Number pi / 2)",
  59592. referencedClasses: ["Number"],
  59593. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59594. }),
  59595. $globals.NumberTest);
  59596. $core.addMethod(
  59597. $core.method({
  59598. selector: "testTruncated",
  59599. protocol: "tests",
  59600. fn: function (){
  59601. var self=this,$self=this;
  59602. return $core.withContext(function($ctx1) {
  59603. var $1,$2;
  59604. $1=(3)._truncated();
  59605. $ctx1.sendIdx["truncated"]=1;
  59606. $self._assert_equals_($1,(3));
  59607. $ctx1.sendIdx["assert:equals:"]=1;
  59608. $2=(3.212)._truncated();
  59609. $ctx1.sendIdx["truncated"]=2;
  59610. $self._assert_equals_($2,(3));
  59611. $ctx1.sendIdx["assert:equals:"]=2;
  59612. $self._assert_equals_((3.51)._truncated(),(3));
  59613. return self;
  59614. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59615. },
  59616. args: [],
  59617. 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",
  59618. referencedClasses: [],
  59619. messageSends: ["assert:equals:", "truncated"]
  59620. }),
  59621. $globals.NumberTest);
  59622. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59623. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59624. $core.addMethod(
  59625. $core.method({
  59626. selector: "foo",
  59627. protocol: "not yet classified",
  59628. fn: function (){
  59629. var self=this,$self=this;
  59630. return $self["@foo"];
  59631. },
  59632. args: [],
  59633. source: "foo\x0a\x09^ foo",
  59634. referencedClasses: [],
  59635. messageSends: []
  59636. }),
  59637. $globals.ObjectMock);
  59638. $core.addMethod(
  59639. $core.method({
  59640. selector: "foo:",
  59641. protocol: "not yet classified",
  59642. fn: function (anObject){
  59643. var self=this,$self=this;
  59644. $self["@foo"]=anObject;
  59645. return self;
  59646. },
  59647. args: ["anObject"],
  59648. source: "foo: anObject\x0a\x09foo := anObject",
  59649. referencedClasses: [],
  59650. messageSends: []
  59651. }),
  59652. $globals.ObjectMock);
  59653. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59654. $core.addMethod(
  59655. $core.method({
  59656. selector: "notDefined",
  59657. protocol: "tests",
  59658. fn: function (){
  59659. var self=this,$self=this;
  59660. return $core.withContext(function($ctx1) {
  59661. return void 0;;
  59662. return self;
  59663. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59664. },
  59665. args: [],
  59666. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59667. referencedClasses: [],
  59668. messageSends: []
  59669. }),
  59670. $globals.ObjectTest);
  59671. $core.addMethod(
  59672. $core.method({
  59673. selector: "testBasicAccess",
  59674. protocol: "tests",
  59675. fn: function (){
  59676. var self=this,$self=this;
  59677. var o;
  59678. return $core.withContext(function($ctx1) {
  59679. var $1;
  59680. o=$recv($globals.Object)._new();
  59681. $recv(o)._basicAt_put_("a",(1));
  59682. $1=$recv(o)._basicAt_("a");
  59683. $ctx1.sendIdx["basicAt:"]=1;
  59684. $self._assert_equals_($1,(1));
  59685. $ctx1.sendIdx["assert:equals:"]=1;
  59686. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59687. return self;
  59688. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59689. },
  59690. args: [],
  59691. 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",
  59692. referencedClasses: ["Object"],
  59693. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59694. }),
  59695. $globals.ObjectTest);
  59696. $core.addMethod(
  59697. $core.method({
  59698. selector: "testBasicPerform",
  59699. protocol: "tests",
  59700. fn: function (){
  59701. var self=this,$self=this;
  59702. var o;
  59703. return $core.withContext(function($ctx1) {
  59704. o=$recv($globals.Object)._new();
  59705. $recv(o)._basicAt_put_("func",(function(){
  59706. return "hello";
  59707. }));
  59708. $ctx1.sendIdx["basicAt:put:"]=1;
  59709. $recv(o)._basicAt_put_("func2",(function(a){
  59710. return $core.withContext(function($ctx2) {
  59711. return $recv(a).__plus((1));
  59712. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59713. }));
  59714. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59715. $ctx1.sendIdx["assert:equals:"]=1;
  59716. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59717. return self;
  59718. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59719. },
  59720. args: [],
  59721. 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",
  59722. referencedClasses: ["Object"],
  59723. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59724. }),
  59725. $globals.ObjectTest);
  59726. $core.addMethod(
  59727. $core.method({
  59728. selector: "testDNU",
  59729. protocol: "tests",
  59730. fn: function (){
  59731. var self=this,$self=this;
  59732. return $core.withContext(function($ctx1) {
  59733. $self._should_raise_((function(){
  59734. return $core.withContext(function($ctx2) {
  59735. return $recv($recv($globals.Object)._new())._foo();
  59736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59737. }),$globals.MessageNotUnderstood);
  59738. return self;
  59739. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59740. },
  59741. args: [],
  59742. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59743. referencedClasses: ["Object", "MessageNotUnderstood"],
  59744. messageSends: ["should:raise:", "foo", "new"]
  59745. }),
  59746. $globals.ObjectTest);
  59747. $core.addMethod(
  59748. $core.method({
  59749. selector: "testEquality",
  59750. protocol: "tests",
  59751. fn: function (){
  59752. var self=this,$self=this;
  59753. var o;
  59754. return $core.withContext(function($ctx1) {
  59755. var $1,$2,$4,$3;
  59756. o=$recv($globals.Object)._new();
  59757. $ctx1.sendIdx["new"]=1;
  59758. $1=$recv(o).__eq($recv($globals.Object)._new());
  59759. $ctx1.sendIdx["="]=1;
  59760. $self._deny_($1);
  59761. $2=$recv(o).__eq(o);
  59762. $ctx1.sendIdx["="]=2;
  59763. $self._assert_($2);
  59764. $ctx1.sendIdx["assert:"]=1;
  59765. $4=$recv(o)._yourself();
  59766. $ctx1.sendIdx["yourself"]=1;
  59767. $3=$recv($4).__eq(o);
  59768. $ctx1.sendIdx["="]=3;
  59769. $self._assert_($3);
  59770. $ctx1.sendIdx["assert:"]=2;
  59771. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59772. return self;
  59773. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59774. },
  59775. args: [],
  59776. 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)",
  59777. referencedClasses: ["Object"],
  59778. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59779. }),
  59780. $globals.ObjectTest);
  59781. $core.addMethod(
  59782. $core.method({
  59783. selector: "testHalt",
  59784. protocol: "tests",
  59785. fn: function (){
  59786. var self=this,$self=this;
  59787. return $core.withContext(function($ctx1) {
  59788. $self._should_raise_((function(){
  59789. return $core.withContext(function($ctx2) {
  59790. return $recv($recv($globals.Object)._new())._halt();
  59791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59792. }),$globals.Error);
  59793. return self;
  59794. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59795. },
  59796. args: [],
  59797. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59798. referencedClasses: ["Object", "Error"],
  59799. messageSends: ["should:raise:", "halt", "new"]
  59800. }),
  59801. $globals.ObjectTest);
  59802. $core.addMethod(
  59803. $core.method({
  59804. selector: "testIdentity",
  59805. protocol: "tests",
  59806. fn: function (){
  59807. var self=this,$self=this;
  59808. var o;
  59809. return $core.withContext(function($ctx1) {
  59810. var $1,$2,$4,$3;
  59811. o=$recv($globals.Object)._new();
  59812. $ctx1.sendIdx["new"]=1;
  59813. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59814. $ctx1.sendIdx["=="]=1;
  59815. $self._deny_($1);
  59816. $2=$recv(o).__eq_eq(o);
  59817. $ctx1.sendIdx["=="]=2;
  59818. $self._assert_($2);
  59819. $ctx1.sendIdx["assert:"]=1;
  59820. $4=$recv(o)._yourself();
  59821. $ctx1.sendIdx["yourself"]=1;
  59822. $3=$recv($4).__eq_eq(o);
  59823. $ctx1.sendIdx["=="]=3;
  59824. $self._assert_($3);
  59825. $ctx1.sendIdx["assert:"]=2;
  59826. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59827. return self;
  59828. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59829. },
  59830. args: [],
  59831. 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",
  59832. referencedClasses: ["Object"],
  59833. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59834. }),
  59835. $globals.ObjectTest);
  59836. $core.addMethod(
  59837. $core.method({
  59838. selector: "testIfNil",
  59839. protocol: "tests",
  59840. fn: function (){
  59841. var self=this,$self=this;
  59842. return $core.withContext(function($ctx1) {
  59843. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59844. $2=$recv($globals.Object)._new();
  59845. $ctx1.sendIdx["new"]=1;
  59846. $1=$recv($2)._isNil();
  59847. $self._deny_($1);
  59848. $ctx1.sendIdx["deny:"]=1;
  59849. $5=$recv($globals.Object)._new();
  59850. $ctx1.sendIdx["new"]=2;
  59851. if(($receiver = $5) == null || $receiver.a$nil){
  59852. $4=true;
  59853. } else {
  59854. $4=$5;
  59855. }
  59856. $3=$recv($4).__eq(true);
  59857. $self._deny_($3);
  59858. $7=$recv($globals.Object)._new();
  59859. $ctx1.sendIdx["new"]=3;
  59860. if(($receiver = $7) == null || $receiver.a$nil){
  59861. $6=$7;
  59862. } else {
  59863. $6=true;
  59864. }
  59865. $self._assert_equals_($6,true);
  59866. $ctx1.sendIdx["assert:equals:"]=1;
  59867. $9=$recv($globals.Object)._new();
  59868. $ctx1.sendIdx["new"]=4;
  59869. if(($receiver = $9) == null || $receiver.a$nil){
  59870. $8=false;
  59871. } else {
  59872. $8=true;
  59873. }
  59874. $self._assert_equals_($8,true);
  59875. $ctx1.sendIdx["assert:equals:"]=2;
  59876. $11=$recv($globals.Object)._new();
  59877. if(($receiver = $11) == null || $receiver.a$nil){
  59878. $10=false;
  59879. } else {
  59880. $10=true;
  59881. }
  59882. $self._assert_equals_($10,true);
  59883. return self;
  59884. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59885. },
  59886. args: [],
  59887. 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",
  59888. referencedClasses: ["Object"],
  59889. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59890. }),
  59891. $globals.ObjectTest);
  59892. $core.addMethod(
  59893. $core.method({
  59894. selector: "testInstVars",
  59895. protocol: "tests",
  59896. fn: function (){
  59897. var self=this,$self=this;
  59898. var o;
  59899. return $core.withContext(function($ctx1) {
  59900. var $1,$2;
  59901. o=$recv($globals.ObjectMock)._new();
  59902. $1=$recv(o)._instVarAt_("foo");
  59903. $ctx1.sendIdx["instVarAt:"]=1;
  59904. $self._assert_equals_($1,nil);
  59905. $ctx1.sendIdx["assert:equals:"]=1;
  59906. $recv(o)._instVarAt_put_("foo",(1));
  59907. $2=$recv(o)._instVarAt_("foo");
  59908. $ctx1.sendIdx["instVarAt:"]=2;
  59909. $self._assert_equals_($2,(1));
  59910. $ctx1.sendIdx["assert:equals:"]=2;
  59911. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59912. return self;
  59913. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59914. },
  59915. args: [],
  59916. 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",
  59917. referencedClasses: ["ObjectMock"],
  59918. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59919. }),
  59920. $globals.ObjectTest);
  59921. $core.addMethod(
  59922. $core.method({
  59923. selector: "testNilUndefined",
  59924. protocol: "tests",
  59925. fn: function (){
  59926. var self=this,$self=this;
  59927. return $core.withContext(function($ctx1) {
  59928. $self._assert_equals_($self._notDefined(),nil);
  59929. return self;
  59930. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59931. },
  59932. args: [],
  59933. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59934. referencedClasses: [],
  59935. messageSends: ["assert:equals:", "notDefined"]
  59936. }),
  59937. $globals.ObjectTest);
  59938. $core.addMethod(
  59939. $core.method({
  59940. selector: "testYourself",
  59941. protocol: "tests",
  59942. fn: function (){
  59943. var self=this,$self=this;
  59944. var o;
  59945. return $core.withContext(function($ctx1) {
  59946. o=$recv($globals.ObjectMock)._new();
  59947. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59948. return self;
  59949. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59950. },
  59951. args: [],
  59952. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59953. referencedClasses: ["ObjectMock"],
  59954. messageSends: ["new", "assert:", "==", "yourself"]
  59955. }),
  59956. $globals.ObjectTest);
  59957. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59958. $core.addMethod(
  59959. $core.method({
  59960. selector: "testAccessing",
  59961. protocol: "tests",
  59962. fn: function (){
  59963. var self=this,$self=this;
  59964. return $core.withContext(function($ctx1) {
  59965. var $2,$1,$3,$6,$5,$4;
  59966. $2=$recv($globals.Point)._x_y_((3),(4));
  59967. $ctx1.sendIdx["x:y:"]=1;
  59968. $1=$recv($2)._x();
  59969. $ctx1.sendIdx["x"]=1;
  59970. $self._assert_equals_($1,(3));
  59971. $ctx1.sendIdx["assert:equals:"]=1;
  59972. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59973. $ctx1.sendIdx["y"]=1;
  59974. $self._assert_equals_($3,(4));
  59975. $ctx1.sendIdx["assert:equals:"]=2;
  59976. $6=$recv($globals.Point)._new();
  59977. $ctx1.sendIdx["new"]=1;
  59978. $5=$recv($6)._x_((3));
  59979. $4=$recv($5)._x();
  59980. $self._assert_equals_($4,(3));
  59981. $ctx1.sendIdx["assert:equals:"]=3;
  59982. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59983. return self;
  59984. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59985. },
  59986. args: [],
  59987. 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",
  59988. referencedClasses: ["Point"],
  59989. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59990. }),
  59991. $globals.PointTest);
  59992. $core.addMethod(
  59993. $core.method({
  59994. selector: "testAngle",
  59995. protocol: "tests",
  59996. fn: function (){
  59997. var self=this,$self=this;
  59998. return $core.withContext(function($ctx1) {
  59999. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60000. return self;
  60001. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60002. },
  60003. args: [],
  60004. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60005. referencedClasses: ["Number"],
  60006. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60007. }),
  60008. $globals.PointTest);
  60009. $core.addMethod(
  60010. $core.method({
  60011. selector: "testArithmetic",
  60012. protocol: "tests",
  60013. fn: function (){
  60014. var self=this,$self=this;
  60015. return $core.withContext(function($ctx1) {
  60016. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60017. $2=(3).__at((4));
  60018. $ctx1.sendIdx["@"]=1;
  60019. $3=(3).__at((4));
  60020. $ctx1.sendIdx["@"]=2;
  60021. $1=$recv($2).__star($3);
  60022. $4=$recv($globals.Point)._x_y_((9),(16));
  60023. $ctx1.sendIdx["x:y:"]=1;
  60024. $self._assert_equals_($1,$4);
  60025. $ctx1.sendIdx["assert:equals:"]=1;
  60026. $6=(3).__at((4));
  60027. $ctx1.sendIdx["@"]=3;
  60028. $7=(3).__at((4));
  60029. $ctx1.sendIdx["@"]=4;
  60030. $5=$recv($6).__plus($7);
  60031. $8=$recv($globals.Point)._x_y_((6),(8));
  60032. $ctx1.sendIdx["x:y:"]=2;
  60033. $self._assert_equals_($5,$8);
  60034. $ctx1.sendIdx["assert:equals:"]=2;
  60035. $10=(3).__at((4));
  60036. $ctx1.sendIdx["@"]=5;
  60037. $11=(3).__at((4));
  60038. $ctx1.sendIdx["@"]=6;
  60039. $9=$recv($10).__minus($11);
  60040. $12=$recv($globals.Point)._x_y_((0),(0));
  60041. $ctx1.sendIdx["x:y:"]=3;
  60042. $self._assert_equals_($9,$12);
  60043. $ctx1.sendIdx["assert:equals:"]=3;
  60044. $14=(6).__at((8));
  60045. $ctx1.sendIdx["@"]=7;
  60046. $13=$recv($14).__slash((3).__at((4)));
  60047. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60048. return self;
  60049. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60050. },
  60051. args: [],
  60052. 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)",
  60053. referencedClasses: ["Point"],
  60054. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60055. }),
  60056. $globals.PointTest);
  60057. $core.addMethod(
  60058. $core.method({
  60059. selector: "testAt",
  60060. protocol: "tests",
  60061. fn: function (){
  60062. var self=this,$self=this;
  60063. return $core.withContext(function($ctx1) {
  60064. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60065. return self;
  60066. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60067. },
  60068. args: [],
  60069. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60070. referencedClasses: ["Point"],
  60071. messageSends: ["assert:equals:", "@", "x:y:"]
  60072. }),
  60073. $globals.PointTest);
  60074. $core.addMethod(
  60075. $core.method({
  60076. selector: "testComparison",
  60077. protocol: "tests",
  60078. fn: function (){
  60079. var self=this,$self=this;
  60080. return $core.withContext(function($ctx1) {
  60081. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60082. $2=(3).__at((4));
  60083. $ctx1.sendIdx["@"]=1;
  60084. $3=(4).__at((5));
  60085. $ctx1.sendIdx["@"]=2;
  60086. $1=$recv($2).__lt($3);
  60087. $ctx1.sendIdx["<"]=1;
  60088. $self._assert_($1);
  60089. $ctx1.sendIdx["assert:"]=1;
  60090. $5=(3).__at((4));
  60091. $ctx1.sendIdx["@"]=3;
  60092. $6=(4).__at((4));
  60093. $ctx1.sendIdx["@"]=4;
  60094. $4=$recv($5).__lt($6);
  60095. $self._deny_($4);
  60096. $ctx1.sendIdx["deny:"]=1;
  60097. $8=(4).__at((5));
  60098. $ctx1.sendIdx["@"]=5;
  60099. $9=(4).__at((5));
  60100. $ctx1.sendIdx["@"]=6;
  60101. $7=$recv($8).__lt_eq($9);
  60102. $ctx1.sendIdx["<="]=1;
  60103. $self._assert_($7);
  60104. $ctx1.sendIdx["assert:"]=2;
  60105. $11=(4).__at((5));
  60106. $ctx1.sendIdx["@"]=7;
  60107. $12=(3).__at((5));
  60108. $ctx1.sendIdx["@"]=8;
  60109. $10=$recv($11).__lt_eq($12);
  60110. $self._deny_($10);
  60111. $ctx1.sendIdx["deny:"]=2;
  60112. $14=(5).__at((6));
  60113. $ctx1.sendIdx["@"]=9;
  60114. $15=(4).__at((5));
  60115. $ctx1.sendIdx["@"]=10;
  60116. $13=$recv($14).__gt($15);
  60117. $ctx1.sendIdx[">"]=1;
  60118. $self._assert_($13);
  60119. $ctx1.sendIdx["assert:"]=3;
  60120. $17=(5).__at((6));
  60121. $ctx1.sendIdx["@"]=11;
  60122. $18=(6).__at((6));
  60123. $ctx1.sendIdx["@"]=12;
  60124. $16=$recv($17).__gt($18);
  60125. $self._deny_($16);
  60126. $ctx1.sendIdx["deny:"]=3;
  60127. $20=(4).__at((5));
  60128. $ctx1.sendIdx["@"]=13;
  60129. $21=(4).__at((5));
  60130. $ctx1.sendIdx["@"]=14;
  60131. $19=$recv($20).__gt_eq($21);
  60132. $ctx1.sendIdx[">="]=1;
  60133. $self._assert_($19);
  60134. $23=(4).__at((5));
  60135. $ctx1.sendIdx["@"]=15;
  60136. $22=$recv($23).__gt_eq((5).__at((5)));
  60137. $self._deny_($22);
  60138. return self;
  60139. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60140. },
  60141. args: [],
  60142. 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)",
  60143. referencedClasses: [],
  60144. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60145. }),
  60146. $globals.PointTest);
  60147. $core.addMethod(
  60148. $core.method({
  60149. selector: "testDotProduct",
  60150. protocol: "tests",
  60151. fn: function (){
  60152. var self=this,$self=this;
  60153. return $core.withContext(function($ctx1) {
  60154. var $2,$1;
  60155. $2=(2).__at((3));
  60156. $ctx1.sendIdx["@"]=1;
  60157. $1=$recv($2)._dotProduct_((3).__at((7)));
  60158. $self._assert_equals_($1,(27));
  60159. return self;
  60160. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60161. },
  60162. args: [],
  60163. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60164. referencedClasses: [],
  60165. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60166. }),
  60167. $globals.PointTest);
  60168. $core.addMethod(
  60169. $core.method({
  60170. selector: "testEgality",
  60171. protocol: "tests",
  60172. fn: function (){
  60173. var self=this,$self=this;
  60174. return $core.withContext(function($ctx1) {
  60175. var $2,$3,$1,$5,$4;
  60176. $2=(3).__at((4));
  60177. $ctx1.sendIdx["@"]=1;
  60178. $3=(3).__at((4));
  60179. $ctx1.sendIdx["@"]=2;
  60180. $1=$recv($2).__eq($3);
  60181. $ctx1.sendIdx["="]=1;
  60182. $self._assert_($1);
  60183. $5=(3).__at((5));
  60184. $ctx1.sendIdx["@"]=3;
  60185. $4=$recv($5).__eq((3).__at((6)));
  60186. $self._deny_($4);
  60187. return self;
  60188. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60189. },
  60190. args: [],
  60191. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60192. referencedClasses: [],
  60193. messageSends: ["assert:", "=", "@", "deny:"]
  60194. }),
  60195. $globals.PointTest);
  60196. $core.addMethod(
  60197. $core.method({
  60198. selector: "testNew",
  60199. protocol: "tests",
  60200. fn: function (){
  60201. var self=this,$self=this;
  60202. return $core.withContext(function($ctx1) {
  60203. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60204. $3=$recv($globals.Point)._new();
  60205. $ctx1.sendIdx["new"]=1;
  60206. $2=$recv($3)._x_((3));
  60207. $ctx1.sendIdx["x:"]=1;
  60208. $1=$recv($2)._y();
  60209. $ctx1.sendIdx["y"]=1;
  60210. $self._assert_equals_($1,nil);
  60211. $ctx1.sendIdx["assert:equals:"]=1;
  60212. $7=$recv($globals.Point)._new();
  60213. $ctx1.sendIdx["new"]=2;
  60214. $6=$recv($7)._x_((3));
  60215. $5=$recv($6)._x();
  60216. $ctx1.sendIdx["x"]=1;
  60217. $4=$recv($5).__eq((0));
  60218. $ctx1.sendIdx["="]=1;
  60219. $self._deny_($4);
  60220. $ctx1.sendIdx["deny:"]=1;
  60221. $10=$recv($globals.Point)._new();
  60222. $ctx1.sendIdx["new"]=3;
  60223. $9=$recv($10)._y_((4));
  60224. $ctx1.sendIdx["y:"]=1;
  60225. $8=$recv($9)._x();
  60226. $self._assert_equals_($8,nil);
  60227. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60228. return self;
  60229. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60230. },
  60231. args: [],
  60232. 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",
  60233. referencedClasses: ["Point"],
  60234. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60235. }),
  60236. $globals.PointTest);
  60237. $core.addMethod(
  60238. $core.method({
  60239. selector: "testNormal",
  60240. protocol: "tests",
  60241. fn: function (){
  60242. var self=this,$self=this;
  60243. return $core.withContext(function($ctx1) {
  60244. var $2,$1;
  60245. $2=(1).__at((0));
  60246. $ctx1.sendIdx["@"]=1;
  60247. $1=$recv($2)._normal();
  60248. $self._assert_equals_($1,(0).__at((1)));
  60249. return self;
  60250. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60251. },
  60252. args: [],
  60253. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60254. referencedClasses: [],
  60255. messageSends: ["assert:equals:", "normal", "@"]
  60256. }),
  60257. $globals.PointTest);
  60258. $core.addMethod(
  60259. $core.method({
  60260. selector: "testNormalized",
  60261. protocol: "tests",
  60262. fn: function (){
  60263. var self=this,$self=this;
  60264. return $core.withContext(function($ctx1) {
  60265. var $2,$1,$3,$5,$4;
  60266. $2=(0).__at((2));
  60267. $ctx1.sendIdx["@"]=1;
  60268. $1=$recv($2)._normalized();
  60269. $ctx1.sendIdx["normalized"]=1;
  60270. $3=(0).__at((1));
  60271. $ctx1.sendIdx["@"]=2;
  60272. $self._assert_equals_($1,$3);
  60273. $ctx1.sendIdx["assert:equals:"]=1;
  60274. $5=(0).__at((0));
  60275. $ctx1.sendIdx["@"]=3;
  60276. $4=$recv($5)._normalized();
  60277. $self._assert_equals_($4,(0).__at((0)));
  60278. return self;
  60279. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60280. },
  60281. args: [],
  60282. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60283. referencedClasses: [],
  60284. messageSends: ["assert:equals:", "normalized", "@"]
  60285. }),
  60286. $globals.PointTest);
  60287. $core.addMethod(
  60288. $core.method({
  60289. selector: "testPolarCoordinates",
  60290. protocol: "tests",
  60291. fn: function (){
  60292. var self=this,$self=this;
  60293. return $core.withContext(function($ctx1) {
  60294. var $2,$1;
  60295. $2=(1).__at((0));
  60296. $ctx1.sendIdx["@"]=1;
  60297. $1=$recv($2)._r();
  60298. $ctx1.sendIdx["r"]=1;
  60299. $self._assert_equals_($1,(1));
  60300. $ctx1.sendIdx["assert:equals:"]=1;
  60301. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60302. return self;
  60303. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60304. },
  60305. args: [],
  60306. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60307. referencedClasses: [],
  60308. messageSends: ["assert:equals:", "r", "@"]
  60309. }),
  60310. $globals.PointTest);
  60311. $core.addMethod(
  60312. $core.method({
  60313. selector: "testRectangleCreation",
  60314. protocol: "tests",
  60315. fn: function (){
  60316. var self=this,$self=this;
  60317. return $core.withContext(function($ctx1) {
  60318. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60319. $2=(1).__at((1));
  60320. $ctx1.sendIdx["@"]=1;
  60321. $3=(2).__at((2));
  60322. $ctx1.sendIdx["@"]=2;
  60323. $1=$recv($2)._corner_($3);
  60324. $5=(1).__at((1));
  60325. $ctx1.sendIdx["@"]=3;
  60326. $6=(2).__at((2));
  60327. $ctx1.sendIdx["@"]=4;
  60328. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60329. $self._assert_equals_($1,$4);
  60330. $ctx1.sendIdx["assert:equals:"]=1;
  60331. $8=(1).__at((1));
  60332. $ctx1.sendIdx["@"]=5;
  60333. $9=(2).__at((2));
  60334. $ctx1.sendIdx["@"]=6;
  60335. $7=$recv($8)._rectangle_($9);
  60336. $11=(1).__at((1));
  60337. $ctx1.sendIdx["@"]=7;
  60338. $12=(2).__at((2));
  60339. $ctx1.sendIdx["@"]=8;
  60340. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60341. $self._assert_equals_($7,$10);
  60342. $ctx1.sendIdx["assert:equals:"]=2;
  60343. $14=(1).__at((1));
  60344. $ctx1.sendIdx["@"]=9;
  60345. $15=(2).__at((2));
  60346. $ctx1.sendIdx["@"]=10;
  60347. $13=$recv($14)._extent_($15);
  60348. $17=(1).__at((1));
  60349. $ctx1.sendIdx["@"]=11;
  60350. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60351. $self._assert_equals_($13,$16);
  60352. return self;
  60353. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60354. },
  60355. args: [],
  60356. source: "testRectangleCreation\x0a\x09self assert: (1@1 corner: 2@2) equals: (Rectangle origin: 1@1 corner: 2@2).\x0a\x09self assert: (1@1 rectangle: 2@2) equals: (Rectangle point: 1@1 point: 2@2).\x0a\x09self assert: (1@1 extent: 2@2) equals: (Rectangle origin: 1@1 extent: 2@2)",
  60357. referencedClasses: ["Rectangle"],
  60358. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60359. }),
  60360. $globals.PointTest);
  60361. $core.addMethod(
  60362. $core.method({
  60363. selector: "testTranslateBy",
  60364. protocol: "tests",
  60365. fn: function (){
  60366. var self=this,$self=this;
  60367. return $core.withContext(function($ctx1) {
  60368. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60369. $2=(3).__at((3));
  60370. $ctx1.sendIdx["@"]=1;
  60371. $3=(0).__at((1));
  60372. $ctx1.sendIdx["@"]=2;
  60373. $1=$recv($2)._translateBy_($3);
  60374. $ctx1.sendIdx["translateBy:"]=1;
  60375. $4=(3).__at((4));
  60376. $ctx1.sendIdx["@"]=3;
  60377. $self._assert_equals_($1,$4);
  60378. $ctx1.sendIdx["assert:equals:"]=1;
  60379. $6=(3).__at((3));
  60380. $ctx1.sendIdx["@"]=4;
  60381. $8=(1)._negated();
  60382. $ctx1.sendIdx["negated"]=1;
  60383. $7=(0).__at($8);
  60384. $ctx1.sendIdx["@"]=5;
  60385. $5=$recv($6)._translateBy_($7);
  60386. $ctx1.sendIdx["translateBy:"]=2;
  60387. $9=(3).__at((2));
  60388. $ctx1.sendIdx["@"]=6;
  60389. $self._assert_equals_($5,$9);
  60390. $ctx1.sendIdx["assert:equals:"]=2;
  60391. $11=(3).__at((3));
  60392. $ctx1.sendIdx["@"]=7;
  60393. $12=(2).__at((3));
  60394. $ctx1.sendIdx["@"]=8;
  60395. $10=$recv($11)._translateBy_($12);
  60396. $ctx1.sendIdx["translateBy:"]=3;
  60397. $13=(5).__at((6));
  60398. $ctx1.sendIdx["@"]=9;
  60399. $self._assert_equals_($10,$13);
  60400. $ctx1.sendIdx["assert:equals:"]=3;
  60401. $15=(3).__at((3));
  60402. $ctx1.sendIdx["@"]=10;
  60403. $16=$recv((3)._negated()).__at((0));
  60404. $ctx1.sendIdx["@"]=11;
  60405. $14=$recv($15)._translateBy_($16);
  60406. $self._assert_equals_($14,(0).__at((3)));
  60407. return self;
  60408. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60409. },
  60410. args: [],
  60411. 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.",
  60412. referencedClasses: [],
  60413. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60414. }),
  60415. $globals.PointTest);
  60416. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60417. $core.addMethod(
  60418. $core.method({
  60419. selector: "testNextIfAbsent",
  60420. protocol: "tests",
  60421. fn: function (){
  60422. var self=this,$self=this;
  60423. var queue;
  60424. return $core.withContext(function($ctx1) {
  60425. var $2,$1;
  60426. queue=$recv($globals.Queue)._new();
  60427. $recv(queue)._nextPut_("index1");
  60428. $2=$recv(queue)._nextIfAbsent_("empty");
  60429. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60430. $1=$recv($2).__eq("index1");
  60431. $ctx1.sendIdx["="]=1;
  60432. $self._assert_($1);
  60433. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60434. return self;
  60435. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60436. },
  60437. args: [],
  60438. 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'",
  60439. referencedClasses: ["Queue"],
  60440. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60441. }),
  60442. $globals.QueueTest);
  60443. $core.addMethod(
  60444. $core.method({
  60445. selector: "testQueueNext",
  60446. protocol: "tests",
  60447. fn: function (){
  60448. var self=this,$self=this;
  60449. var queue;
  60450. return $core.withContext(function($ctx1) {
  60451. var $1,$3,$2,$5,$4;
  60452. queue=$recv($globals.Queue)._new();
  60453. $1=queue;
  60454. $recv($1)._nextPut_("index1");
  60455. $ctx1.sendIdx["nextPut:"]=1;
  60456. $recv($1)._nextPut_("index2");
  60457. $3=$recv(queue)._next();
  60458. $ctx1.sendIdx["next"]=1;
  60459. $2=$recv($3).__eq("index1");
  60460. $ctx1.sendIdx["="]=1;
  60461. $self._assert_($2);
  60462. $5=$recv(queue)._next();
  60463. $ctx1.sendIdx["next"]=2;
  60464. $4=$recv($5).__eq("index");
  60465. $self._deny_($4);
  60466. $self._should_raise_((function(){
  60467. return $core.withContext(function($ctx2) {
  60468. return $recv(queue)._next();
  60469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60470. }),$globals.Error);
  60471. return self;
  60472. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60473. },
  60474. args: [],
  60475. 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",
  60476. referencedClasses: ["Queue", "Error"],
  60477. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60478. }),
  60479. $globals.QueueTest);
  60480. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60481. $core.addMethod(
  60482. $core.method({
  60483. selector: "testAtRandomNumber",
  60484. protocol: "tests",
  60485. fn: function (){
  60486. var self=this,$self=this;
  60487. var val;
  60488. return $core.withContext(function($ctx1) {
  60489. (100)._timesRepeat_((function(){
  60490. return $core.withContext(function($ctx2) {
  60491. val=(10)._atRandom();
  60492. $self._assert_($recv(val).__gt((0)));
  60493. $ctx2.sendIdx["assert:"]=1;
  60494. return $self._assert_($recv(val).__lt((11)));
  60495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60496. }));
  60497. return self;
  60498. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60499. },
  60500. args: [],
  60501. 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]",
  60502. referencedClasses: [],
  60503. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60504. }),
  60505. $globals.RandomTest);
  60506. $core.addMethod(
  60507. $core.method({
  60508. selector: "testAtRandomSequenceableCollection",
  60509. protocol: "tests",
  60510. fn: function (){
  60511. var self=this,$self=this;
  60512. var val;
  60513. return $core.withContext(function($ctx1) {
  60514. var $3,$4,$2,$1;
  60515. (100)._timesRepeat_((function(){
  60516. return $core.withContext(function($ctx2) {
  60517. val="abc"._atRandom();
  60518. $3=$recv(val).__eq("a");
  60519. $ctx2.sendIdx["="]=1;
  60520. $4=$recv(val).__eq("b");
  60521. $ctx2.sendIdx["="]=2;
  60522. $2=$recv($3).__or($4);
  60523. $1=$recv($2).__or($recv(val).__eq("c"));
  60524. $ctx2.sendIdx["|"]=1;
  60525. return $self._assert_($1);
  60526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60527. }));
  60528. return self;
  60529. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60530. },
  60531. args: [],
  60532. 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].",
  60533. referencedClasses: [],
  60534. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60535. }),
  60536. $globals.RandomTest);
  60537. $core.addMethod(
  60538. $core.method({
  60539. selector: "textNext",
  60540. protocol: "tests",
  60541. fn: function (){
  60542. var self=this,$self=this;
  60543. return $core.withContext(function($ctx1) {
  60544. var $1;
  60545. (10000)._timesRepeat_((function(){
  60546. var current,next;
  60547. return $core.withContext(function($ctx2) {
  60548. next=$recv($recv($globals.Random)._new())._next();
  60549. $self._assert_($recv(next).__gt_eq((0)));
  60550. $ctx2.sendIdx["assert:"]=1;
  60551. $self._assert_($recv(next).__lt((1)));
  60552. $1=$recv(current).__eq(next);
  60553. $ctx2.sendIdx["="]=1;
  60554. $self._deny_($1);
  60555. return $recv(next).__eq(current);
  60556. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60557. }));
  60558. return self;
  60559. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60560. },
  60561. args: [],
  60562. 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 ]",
  60563. referencedClasses: ["Random"],
  60564. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60565. }),
  60566. $globals.RandomTest);
  60567. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60568. $core.addMethod(
  60569. $core.method({
  60570. selector: "testContainsPoint",
  60571. protocol: "tests",
  60572. fn: function (){
  60573. var self=this,$self=this;
  60574. var rect;
  60575. return $core.withContext(function($ctx1) {
  60576. var $1,$2,$4,$5,$3;
  60577. $1=(0).__at((0));
  60578. $ctx1.sendIdx["@"]=1;
  60579. $2=(4).__at((4));
  60580. $ctx1.sendIdx["@"]=2;
  60581. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60582. $4=rect;
  60583. $5=(1).__at((2));
  60584. $ctx1.sendIdx["@"]=3;
  60585. $3=$recv($4)._containsPoint_($5);
  60586. $ctx1.sendIdx["containsPoint:"]=1;
  60587. $self._assert_($3);
  60588. $ctx1.sendIdx["assert:"]=1;
  60589. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60590. return self;
  60591. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60592. },
  60593. args: [],
  60594. source: "testContainsPoint\x0a\x09| rect |\x0a\x09rect := Rectangle origin: 0@0 corner: 4@4.\x0a\x09\x0a\x09self assert: (rect containsPoint: 1@2).\x0a\x09self assert: (rect containsPoint: 5@4) not.",
  60595. referencedClasses: ["Rectangle"],
  60596. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60597. }),
  60598. $globals.RectangleTest);
  60599. $core.addMethod(
  60600. $core.method({
  60601. selector: "testContainsRect",
  60602. protocol: "tests",
  60603. fn: function (){
  60604. var self=this,$self=this;
  60605. return $core.withContext(function($ctx1) {
  60606. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60607. $3=(0).__at((0));
  60608. $ctx1.sendIdx["@"]=1;
  60609. $4=(6).__at((6));
  60610. $ctx1.sendIdx["@"]=2;
  60611. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60612. $ctx1.sendIdx["origin:corner:"]=1;
  60613. $6=(1).__at((1));
  60614. $ctx1.sendIdx["@"]=3;
  60615. $7=(5).__at((5));
  60616. $ctx1.sendIdx["@"]=4;
  60617. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60618. $ctx1.sendIdx["origin:corner:"]=2;
  60619. $1=$recv($2)._containsRect_($5);
  60620. $ctx1.sendIdx["containsRect:"]=1;
  60621. $self._assert_($1);
  60622. $ctx1.sendIdx["assert:"]=1;
  60623. $11=(0).__at((0));
  60624. $ctx1.sendIdx["@"]=5;
  60625. $12=(6).__at((6));
  60626. $ctx1.sendIdx["@"]=6;
  60627. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60628. $ctx1.sendIdx["origin:corner:"]=3;
  60629. $14=(1).__at((-1));
  60630. $ctx1.sendIdx["@"]=7;
  60631. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60632. $9=$recv($10)._containsRect_($13);
  60633. $8=$recv($9)._not();
  60634. $self._assert_($8);
  60635. return self;
  60636. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60637. },
  60638. args: [],
  60639. source: "testContainsRect\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@1 corner: 5@5)).\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@(-1) corner: 5@5)) not.",
  60640. referencedClasses: ["Rectangle"],
  60641. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60642. }),
  60643. $globals.RectangleTest);
  60644. $core.addMethod(
  60645. $core.method({
  60646. selector: "testOriginExtent",
  60647. protocol: "tests",
  60648. fn: function (){
  60649. var self=this,$self=this;
  60650. var rectangle;
  60651. return $core.withContext(function($ctx1) {
  60652. var $1,$2,$3,$4;
  60653. $1=(3).__at((4));
  60654. $ctx1.sendIdx["@"]=1;
  60655. $2=(7).__at((8));
  60656. $ctx1.sendIdx["@"]=2;
  60657. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60658. $3=$recv(rectangle)._origin();
  60659. $4=(3).__at((4));
  60660. $ctx1.sendIdx["@"]=3;
  60661. $self._assert_equals_($3,$4);
  60662. $ctx1.sendIdx["assert:equals:"]=1;
  60663. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60664. return self;
  60665. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60666. },
  60667. args: [],
  60668. source: "testOriginExtent\x0a\x09| rectangle |\x0a\x09rectangle := Rectangle origin: 3@4 extent: 7@8.\x0a\x09\x0a\x09self assert: rectangle origin equals: 3@4.\x0a\x09self assert: rectangle corner equals: 10@12.",
  60669. referencedClasses: ["Rectangle"],
  60670. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60671. }),
  60672. $globals.RectangleTest);
  60673. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60674. $core.addMethod(
  60675. $core.method({
  60676. selector: "collectionClass",
  60677. protocol: "accessing",
  60678. fn: function (){
  60679. var self=this,$self=this;
  60680. return $core.withContext(function($ctx1) {
  60681. return $recv($self._class())._collectionClass();
  60682. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60683. },
  60684. args: [],
  60685. source: "collectionClass\x0a\x09^ self class collectionClass",
  60686. referencedClasses: [],
  60687. messageSends: ["collectionClass", "class"]
  60688. }),
  60689. $globals.StreamTest);
  60690. $core.addMethod(
  60691. $core.method({
  60692. selector: "newCollection",
  60693. protocol: "accessing",
  60694. fn: function (){
  60695. var self=this,$self=this;
  60696. return $core.withContext(function($ctx1) {
  60697. return $recv($self._collectionClass())._new();
  60698. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60699. },
  60700. args: [],
  60701. source: "newCollection\x0a\x09^ self collectionClass new",
  60702. referencedClasses: [],
  60703. messageSends: ["new", "collectionClass"]
  60704. }),
  60705. $globals.StreamTest);
  60706. $core.addMethod(
  60707. $core.method({
  60708. selector: "newStream",
  60709. protocol: "accessing",
  60710. fn: function (){
  60711. var self=this,$self=this;
  60712. return $core.withContext(function($ctx1) {
  60713. return $recv($recv($self._collectionClass())._new())._stream();
  60714. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60715. },
  60716. args: [],
  60717. source: "newStream\x0a\x09^ self collectionClass new stream",
  60718. referencedClasses: [],
  60719. messageSends: ["stream", "new", "collectionClass"]
  60720. }),
  60721. $globals.StreamTest);
  60722. $core.addMethod(
  60723. $core.method({
  60724. selector: "testAtStartAtEnd",
  60725. protocol: "tests",
  60726. fn: function (){
  60727. var self=this,$self=this;
  60728. var stream;
  60729. return $core.withContext(function($ctx1) {
  60730. var $1,$2,$3,$4;
  60731. stream=$self._newStream();
  60732. $1=$recv(stream)._atStart();
  60733. $ctx1.sendIdx["atStart"]=1;
  60734. $self._assert_($1);
  60735. $ctx1.sendIdx["assert:"]=1;
  60736. $2=$recv(stream)._atEnd();
  60737. $ctx1.sendIdx["atEnd"]=1;
  60738. $self._assert_($2);
  60739. $ctx1.sendIdx["assert:"]=2;
  60740. $recv(stream)._nextPutAll_($self._newCollection());
  60741. $3=$recv(stream)._atEnd();
  60742. $ctx1.sendIdx["atEnd"]=2;
  60743. $self._assert_($3);
  60744. $4=$recv(stream)._atStart();
  60745. $ctx1.sendIdx["atStart"]=2;
  60746. $self._deny_($4);
  60747. $ctx1.sendIdx["deny:"]=1;
  60748. $recv(stream)._position_((1));
  60749. $self._deny_($recv(stream)._atEnd());
  60750. $ctx1.sendIdx["deny:"]=2;
  60751. $self._deny_($recv(stream)._atStart());
  60752. return self;
  60753. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60754. },
  60755. args: [],
  60756. 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",
  60757. referencedClasses: [],
  60758. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60759. }),
  60760. $globals.StreamTest);
  60761. $core.addMethod(
  60762. $core.method({
  60763. selector: "testContents",
  60764. protocol: "tests",
  60765. fn: function (){
  60766. var self=this,$self=this;
  60767. var stream;
  60768. return $core.withContext(function($ctx1) {
  60769. var $1,$2;
  60770. stream=$self._newStream();
  60771. $1=stream;
  60772. $2=$self._newCollection();
  60773. $ctx1.sendIdx["newCollection"]=1;
  60774. $recv($1)._nextPutAll_($2);
  60775. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60776. return self;
  60777. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60778. },
  60779. args: [],
  60780. 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",
  60781. referencedClasses: [],
  60782. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60783. }),
  60784. $globals.StreamTest);
  60785. $core.addMethod(
  60786. $core.method({
  60787. selector: "testIsEmpty",
  60788. protocol: "tests",
  60789. fn: function (){
  60790. var self=this,$self=this;
  60791. var stream;
  60792. return $core.withContext(function($ctx1) {
  60793. var $1;
  60794. stream=$self._newStream();
  60795. $1=$recv(stream)._isEmpty();
  60796. $ctx1.sendIdx["isEmpty"]=1;
  60797. $self._assert_($1);
  60798. $recv(stream)._nextPutAll_($self._newCollection());
  60799. $self._deny_($recv(stream)._isEmpty());
  60800. return self;
  60801. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60802. },
  60803. args: [],
  60804. 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",
  60805. referencedClasses: [],
  60806. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60807. }),
  60808. $globals.StreamTest);
  60809. $core.addMethod(
  60810. $core.method({
  60811. selector: "testPosition",
  60812. protocol: "tests",
  60813. fn: function (){
  60814. var self=this,$self=this;
  60815. var collection,stream;
  60816. return $core.withContext(function($ctx1) {
  60817. var $1,$2,$3;
  60818. collection=$self._newCollection();
  60819. stream=$self._newStream();
  60820. $recv(stream)._nextPutAll_(collection);
  60821. $1=$recv(stream)._position();
  60822. $ctx1.sendIdx["position"]=1;
  60823. $self._assert_equals_($1,$recv(collection)._size());
  60824. $ctx1.sendIdx["assert:equals:"]=1;
  60825. $recv(stream)._position_((0));
  60826. $2=$recv(stream)._position();
  60827. $ctx1.sendIdx["position"]=2;
  60828. $self._assert_equals_($2,(0));
  60829. $ctx1.sendIdx["assert:equals:"]=2;
  60830. $recv(stream)._next();
  60831. $ctx1.sendIdx["next"]=1;
  60832. $3=$recv(stream)._position();
  60833. $ctx1.sendIdx["position"]=3;
  60834. $self._assert_equals_($3,(1));
  60835. $ctx1.sendIdx["assert:equals:"]=3;
  60836. $recv(stream)._next();
  60837. $self._assert_equals_($recv(stream)._position(),(2));
  60838. return self;
  60839. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60840. },
  60841. args: [],
  60842. 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",
  60843. referencedClasses: [],
  60844. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60845. }),
  60846. $globals.StreamTest);
  60847. $core.addMethod(
  60848. $core.method({
  60849. selector: "testReading",
  60850. protocol: "tests",
  60851. fn: function (){
  60852. var self=this,$self=this;
  60853. var stream,collection;
  60854. return $core.withContext(function($ctx1) {
  60855. var $1,$2;
  60856. collection=$self._newCollection();
  60857. stream=$self._newStream();
  60858. $1=stream;
  60859. $recv($1)._nextPutAll_(collection);
  60860. $recv($1)._position_((0));
  60861. $recv(collection)._do_((function(each){
  60862. return $core.withContext(function($ctx2) {
  60863. $2=$recv(stream)._next();
  60864. $ctx2.sendIdx["next"]=1;
  60865. return $self._assert_equals_($2,each);
  60866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60867. }));
  60868. $self._assert_($recv($recv(stream)._next())._isNil());
  60869. return self;
  60870. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60871. },
  60872. args: [],
  60873. 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",
  60874. referencedClasses: [],
  60875. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60876. }),
  60877. $globals.StreamTest);
  60878. $core.addMethod(
  60879. $core.method({
  60880. selector: "testStreamContents",
  60881. protocol: "tests",
  60882. fn: function (){
  60883. var self=this,$self=this;
  60884. return self;
  60885. },
  60886. args: [],
  60887. source: "testStreamContents",
  60888. referencedClasses: [],
  60889. messageSends: []
  60890. }),
  60891. $globals.StreamTest);
  60892. $core.addMethod(
  60893. $core.method({
  60894. selector: "testWrite",
  60895. protocol: "tests",
  60896. fn: function (){
  60897. var self=this,$self=this;
  60898. var stream,collection;
  60899. return $core.withContext(function($ctx1) {
  60900. collection=$self._newCollection();
  60901. stream=$self._newStream();
  60902. $recv(collection)._do_((function(each){
  60903. return $core.withContext(function($ctx2) {
  60904. return $recv(stream).__lt_lt(each);
  60905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60906. }));
  60907. $self._assert_equals_($recv(stream)._contents(),collection);
  60908. return self;
  60909. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60910. },
  60911. args: [],
  60912. 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",
  60913. referencedClasses: [],
  60914. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60915. }),
  60916. $globals.StreamTest);
  60917. $core.addMethod(
  60918. $core.method({
  60919. selector: "testWriting",
  60920. protocol: "tests",
  60921. fn: function (){
  60922. var self=this,$self=this;
  60923. var stream,collection;
  60924. return $core.withContext(function($ctx1) {
  60925. var $1;
  60926. collection=$self._newCollection();
  60927. stream=$self._newStream();
  60928. $ctx1.sendIdx["newStream"]=1;
  60929. $recv(collection)._do_((function(each){
  60930. return $core.withContext(function($ctx2) {
  60931. return $recv(stream)._nextPut_(each);
  60932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60933. }));
  60934. $1=$recv(stream)._contents();
  60935. $ctx1.sendIdx["contents"]=1;
  60936. $self._assert_equals_($1,collection);
  60937. $ctx1.sendIdx["assert:equals:"]=1;
  60938. stream=$self._newStream();
  60939. $recv(stream)._nextPutAll_(collection);
  60940. $self._assert_equals_($recv(stream)._contents(),collection);
  60941. return self;
  60942. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60943. },
  60944. args: [],
  60945. 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",
  60946. referencedClasses: [],
  60947. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60948. }),
  60949. $globals.StreamTest);
  60950. $core.addMethod(
  60951. $core.method({
  60952. selector: "collectionClass",
  60953. protocol: "accessing",
  60954. fn: function (){
  60955. var self=this,$self=this;
  60956. return nil;
  60957. },
  60958. args: [],
  60959. source: "collectionClass\x0a\x09^ nil",
  60960. referencedClasses: [],
  60961. messageSends: []
  60962. }),
  60963. $globals.StreamTest.a$cls);
  60964. $core.addMethod(
  60965. $core.method({
  60966. selector: "isAbstract",
  60967. protocol: "testing",
  60968. fn: function (){
  60969. var self=this,$self=this;
  60970. return $core.withContext(function($ctx1) {
  60971. return $recv($self._collectionClass())._isNil();
  60972. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60973. },
  60974. args: [],
  60975. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60976. referencedClasses: [],
  60977. messageSends: ["isNil", "collectionClass"]
  60978. }),
  60979. $globals.StreamTest.a$cls);
  60980. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60981. $core.addMethod(
  60982. $core.method({
  60983. selector: "newCollection",
  60984. protocol: "accessing",
  60985. fn: function (){
  60986. var self=this,$self=this;
  60987. return $core.withContext(function($ctx1) {
  60988. return [true,(1),(3).__at((4)),"foo"];
  60989. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60990. },
  60991. args: [],
  60992. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60993. referencedClasses: [],
  60994. messageSends: ["@"]
  60995. }),
  60996. $globals.ArrayStreamTest);
  60997. $core.addMethod(
  60998. $core.method({
  60999. selector: "collectionClass",
  61000. protocol: "accessing",
  61001. fn: function (){
  61002. var self=this,$self=this;
  61003. return $globals.Array;
  61004. },
  61005. args: [],
  61006. source: "collectionClass\x0a\x09^ Array",
  61007. referencedClasses: ["Array"],
  61008. messageSends: []
  61009. }),
  61010. $globals.ArrayStreamTest.a$cls);
  61011. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61012. $core.addMethod(
  61013. $core.method({
  61014. selector: "newCollection",
  61015. protocol: "accessing",
  61016. fn: function (){
  61017. var self=this,$self=this;
  61018. return "hello world";
  61019. },
  61020. args: [],
  61021. source: "newCollection\x0a\x09^ 'hello world'",
  61022. referencedClasses: [],
  61023. messageSends: []
  61024. }),
  61025. $globals.StringStreamTest);
  61026. $core.addMethod(
  61027. $core.method({
  61028. selector: "collectionClass",
  61029. protocol: "accessing",
  61030. fn: function (){
  61031. var self=this,$self=this;
  61032. return $globals.String;
  61033. },
  61034. args: [],
  61035. source: "collectionClass\x0a\x09^ String",
  61036. referencedClasses: ["String"],
  61037. messageSends: []
  61038. }),
  61039. $globals.StringStreamTest.a$cls);
  61040. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61041. $core.addMethod(
  61042. $core.method({
  61043. selector: "testCopying",
  61044. protocol: "tests",
  61045. fn: function (){
  61046. var self=this,$self=this;
  61047. return $core.withContext(function($ctx1) {
  61048. $self._assert_equals_(nil._copy(),nil);
  61049. return self;
  61050. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61051. },
  61052. args: [],
  61053. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61054. referencedClasses: [],
  61055. messageSends: ["assert:equals:", "copy"]
  61056. }),
  61057. $globals.UndefinedTest);
  61058. $core.addMethod(
  61059. $core.method({
  61060. selector: "testDeepCopy",
  61061. protocol: "tests",
  61062. fn: function (){
  61063. var self=this,$self=this;
  61064. return $core.withContext(function($ctx1) {
  61065. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61066. return self;
  61067. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61068. },
  61069. args: [],
  61070. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61071. referencedClasses: [],
  61072. messageSends: ["assert:", "=", "deepCopy"]
  61073. }),
  61074. $globals.UndefinedTest);
  61075. $core.addMethod(
  61076. $core.method({
  61077. selector: "testIfNil",
  61078. protocol: "tests",
  61079. fn: function (){
  61080. var self=this,$self=this;
  61081. return $core.withContext(function($ctx1) {
  61082. var $1,$3,$2,$4,$6,$5,$receiver;
  61083. if(($receiver = nil) == null || $receiver.a$nil){
  61084. $1=true;
  61085. } else {
  61086. $1=nil;
  61087. }
  61088. $self._assert_equals_($1,true);
  61089. $ctx1.sendIdx["assert:equals:"]=1;
  61090. if(($receiver = nil) == null || $receiver.a$nil){
  61091. $3=nil;
  61092. } else {
  61093. $3=true;
  61094. }
  61095. $2=$recv($3).__eq(true);
  61096. $ctx1.sendIdx["="]=1;
  61097. $self._deny_($2);
  61098. $ctx1.sendIdx["deny:"]=1;
  61099. if(($receiver = nil) == null || $receiver.a$nil){
  61100. $4=true;
  61101. } else {
  61102. $4=false;
  61103. }
  61104. $self._assert_equals_($4,true);
  61105. if(($receiver = nil) == null || $receiver.a$nil){
  61106. $6=false;
  61107. } else {
  61108. $6=true;
  61109. }
  61110. $5=$recv($6).__eq(true);
  61111. $self._deny_($5);
  61112. return self;
  61113. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61114. },
  61115. args: [],
  61116. 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",
  61117. referencedClasses: [],
  61118. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61119. }),
  61120. $globals.UndefinedTest);
  61121. $core.addMethod(
  61122. $core.method({
  61123. selector: "testIsNil",
  61124. protocol: "tests",
  61125. fn: function (){
  61126. var self=this,$self=this;
  61127. return $core.withContext(function($ctx1) {
  61128. $self._assert_(nil._isNil());
  61129. $self._deny_(nil._notNil());
  61130. return self;
  61131. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61132. },
  61133. args: [],
  61134. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61135. referencedClasses: [],
  61136. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61137. }),
  61138. $globals.UndefinedTest);
  61139. });
  61140. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61141. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61142. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61143. var $pkg = $core.addPackage("Platform-DOM-Tests");
  61144. $pkg.innerEval = function (expr) { return eval(expr); };
  61145. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61146. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61147. $core.addMethod(
  61148. $core.method({
  61149. selector: "testEntityConversion",
  61150. protocol: "testing",
  61151. fn: function (){
  61152. var self=this,$self=this;
  61153. return $core.withContext(function($ctx1) {
  61154. var $1;
  61155. $1=$recv($globals.PlatformDom)._isFeasible();
  61156. if($core.assert($1)){
  61157. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61158. }
  61159. return self;
  61160. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61161. },
  61162. args: [],
  61163. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61164. referencedClasses: ["PlatformDom"],
  61165. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61166. }),
  61167. $globals.PlatformDomTest);
  61168. $core.addMethod(
  61169. $core.method({
  61170. selector: "testTextContentDoesNotRunScript",
  61171. protocol: "testing",
  61172. fn: function (){
  61173. var self=this,$self=this;
  61174. return $core.withContext(function($ctx1) {
  61175. var $1;
  61176. $1=$recv($globals.PlatformDom)._isFeasible();
  61177. if($core.assert($1)){
  61178. $self._shouldnt_raise_((function(){
  61179. return $core.withContext(function($ctx2) {
  61180. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61182. }),$globals.Error);
  61183. }
  61184. return self;
  61185. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61186. },
  61187. args: [],
  61188. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61189. referencedClasses: ["PlatformDom", "Error"],
  61190. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61191. }),
  61192. $globals.PlatformDomTest);
  61193. });
  61194. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61195. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61196. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61197. var $pkg = $core.addPackage("SUnit-Tests");
  61198. $pkg.innerEval = function (expr) { return eval(expr); };
  61199. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61200. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61201. $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.";
  61202. $core.addMethod(
  61203. $core.method({
  61204. selector: "setUp",
  61205. protocol: "running",
  61206. fn: function (){
  61207. var self=this,$self=this;
  61208. return $core.withContext(function($ctx1) {
  61209. $self["@empty"]=$recv($globals.Set)._new();
  61210. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61211. return self;
  61212. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61213. },
  61214. args: [],
  61215. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61216. referencedClasses: ["Set"],
  61217. messageSends: ["new", "with:with:"]
  61218. }),
  61219. $globals.ExampleSetTest);
  61220. $core.addMethod(
  61221. $core.method({
  61222. selector: "testAdd",
  61223. protocol: "tests",
  61224. fn: function (){
  61225. var self=this,$self=this;
  61226. return $core.withContext(function($ctx1) {
  61227. $recv($self["@empty"])._add_((5));
  61228. $self._assert_($recv($self["@empty"])._includes_((5)));
  61229. return self;
  61230. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61231. },
  61232. args: [],
  61233. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61234. referencedClasses: [],
  61235. messageSends: ["add:", "assert:", "includes:"]
  61236. }),
  61237. $globals.ExampleSetTest);
  61238. $core.addMethod(
  61239. $core.method({
  61240. selector: "testGrow",
  61241. protocol: "tests",
  61242. fn: function (){
  61243. var self=this,$self=this;
  61244. return $core.withContext(function($ctx1) {
  61245. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61246. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61247. return self;
  61248. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61249. },
  61250. args: [],
  61251. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61252. referencedClasses: [],
  61253. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61254. }),
  61255. $globals.ExampleSetTest);
  61256. $core.addMethod(
  61257. $core.method({
  61258. selector: "testIllegal",
  61259. protocol: "tests",
  61260. fn: function (){
  61261. var self=this,$self=this;
  61262. return $core.withContext(function($ctx1) {
  61263. $self._should_raise_((function(){
  61264. return $core.withContext(function($ctx2) {
  61265. return $recv($self["@empty"])._at_((5));
  61266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61267. }),$globals.Error);
  61268. $ctx1.sendIdx["should:raise:"]=1;
  61269. $self._should_raise_((function(){
  61270. return $core.withContext(function($ctx2) {
  61271. return $recv($self["@empty"])._at_put_((5),"abc");
  61272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61273. }),$globals.Error);
  61274. return self;
  61275. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61276. },
  61277. args: [],
  61278. 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",
  61279. referencedClasses: ["Error"],
  61280. messageSends: ["should:raise:", "at:", "at:put:"]
  61281. }),
  61282. $globals.ExampleSetTest);
  61283. $core.addMethod(
  61284. $core.method({
  61285. selector: "testIncludes",
  61286. protocol: "tests",
  61287. fn: function (){
  61288. var self=this,$self=this;
  61289. return $core.withContext(function($ctx1) {
  61290. var $1;
  61291. $1=$recv($self["@full"])._includes_((5));
  61292. $ctx1.sendIdx["includes:"]=1;
  61293. $self._assert_($1);
  61294. $ctx1.sendIdx["assert:"]=1;
  61295. $self._assert_($recv($self["@full"])._includes_("abc"));
  61296. return self;
  61297. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61298. },
  61299. args: [],
  61300. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61301. referencedClasses: [],
  61302. messageSends: ["assert:", "includes:"]
  61303. }),
  61304. $globals.ExampleSetTest);
  61305. $core.addMethod(
  61306. $core.method({
  61307. selector: "testOccurrences",
  61308. protocol: "tests",
  61309. fn: function (){
  61310. var self=this,$self=this;
  61311. return $core.withContext(function($ctx1) {
  61312. var $1,$2;
  61313. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61314. $ctx1.sendIdx["occurrencesOf:"]=1;
  61315. $self._assert_equals_($1,(0));
  61316. $ctx1.sendIdx["assert:equals:"]=1;
  61317. $2=$recv($self["@full"])._occurrencesOf_((5));
  61318. $ctx1.sendIdx["occurrencesOf:"]=2;
  61319. $self._assert_equals_($2,(1));
  61320. $ctx1.sendIdx["assert:equals:"]=2;
  61321. $recv($self["@full"])._add_((5));
  61322. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61323. return self;
  61324. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61325. },
  61326. args: [],
  61327. 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",
  61328. referencedClasses: [],
  61329. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61330. }),
  61331. $globals.ExampleSetTest);
  61332. $core.addMethod(
  61333. $core.method({
  61334. selector: "testRemove",
  61335. protocol: "tests",
  61336. fn: function (){
  61337. var self=this,$self=this;
  61338. return $core.withContext(function($ctx1) {
  61339. var $1;
  61340. $recv($self["@full"])._remove_((5));
  61341. $1=$recv($self["@full"])._includes_("abc");
  61342. $ctx1.sendIdx["includes:"]=1;
  61343. $self._assert_($1);
  61344. $self._deny_($recv($self["@full"])._includes_((5)));
  61345. return self;
  61346. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61347. },
  61348. args: [],
  61349. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61350. referencedClasses: [],
  61351. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61352. }),
  61353. $globals.ExampleSetTest);
  61354. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61355. $core.addMethod(
  61356. $core.method({
  61357. selector: "fakeError",
  61358. protocol: "helpers",
  61359. fn: function (){
  61360. var self=this,$self=this;
  61361. return $core.withContext(function($ctx1) {
  61362. $self["@flag"]="bad";
  61363. $self._timeout_((30));
  61364. $self["@flag"]=$recv($self._async_((function(){
  61365. return $core.withContext(function($ctx2) {
  61366. $self["@flag"]="ok";
  61367. return $self._error_("Intentional");
  61368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61369. })))._valueWithTimeout_((20));
  61370. return self;
  61371. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61372. },
  61373. args: [],
  61374. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61375. referencedClasses: [],
  61376. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61377. }),
  61378. $globals.SUnitAsyncTest);
  61379. $core.addMethod(
  61380. $core.method({
  61381. selector: "fakeErrorFailingInTearDown",
  61382. protocol: "helpers",
  61383. fn: function (){
  61384. var self=this,$self=this;
  61385. return $core.withContext(function($ctx1) {
  61386. $self["@flag"]="bad";
  61387. $self._timeout_((30));
  61388. $self["@flag"]=$recv($self._async_((function(){
  61389. return $core.withContext(function($ctx2) {
  61390. return $self._error_("Intentional");
  61391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61392. })))._valueWithTimeout_((20));
  61393. return self;
  61394. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61395. },
  61396. args: [],
  61397. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61398. referencedClasses: [],
  61399. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61400. }),
  61401. $globals.SUnitAsyncTest);
  61402. $core.addMethod(
  61403. $core.method({
  61404. selector: "fakeFailure",
  61405. protocol: "helpers",
  61406. fn: function (){
  61407. var self=this,$self=this;
  61408. return $core.withContext(function($ctx1) {
  61409. $self["@flag"]="bad";
  61410. $self._timeout_((30));
  61411. $self["@flag"]=$recv($self._async_((function(){
  61412. return $core.withContext(function($ctx2) {
  61413. $self["@flag"]="ok";
  61414. return $self._assert_(false);
  61415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61416. })))._valueWithTimeout_((20));
  61417. return self;
  61418. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61419. },
  61420. args: [],
  61421. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61422. referencedClasses: [],
  61423. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61424. }),
  61425. $globals.SUnitAsyncTest);
  61426. $core.addMethod(
  61427. $core.method({
  61428. selector: "fakeMultipleTimeoutFailing",
  61429. protocol: "helpers",
  61430. fn: function (){
  61431. var self=this,$self=this;
  61432. return $core.withContext(function($ctx1) {
  61433. var $1;
  61434. $self._timeout_((100));
  61435. $ctx1.sendIdx["timeout:"]=1;
  61436. $1=$self._async_((function(){
  61437. return $core.withContext(function($ctx2) {
  61438. $self._timeout_((20));
  61439. return $recv($self._async_((function(){
  61440. return $core.withContext(function($ctx3) {
  61441. return $self._finished();
  61442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61443. })))._valueWithTimeout_((30));
  61444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61445. }));
  61446. $ctx1.sendIdx["async:"]=1;
  61447. $recv($1)._valueWithTimeout_((20));
  61448. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61449. return self;
  61450. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61451. },
  61452. args: [],
  61453. 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",
  61454. referencedClasses: [],
  61455. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61456. }),
  61457. $globals.SUnitAsyncTest);
  61458. $core.addMethod(
  61459. $core.method({
  61460. selector: "fakeMultipleTimeoutPassing",
  61461. protocol: "helpers",
  61462. fn: function (){
  61463. var self=this,$self=this;
  61464. return $core.withContext(function($ctx1) {
  61465. var $1;
  61466. $self._timeout_((20));
  61467. $ctx1.sendIdx["timeout:"]=1;
  61468. $1=$self._async_((function(){
  61469. return $core.withContext(function($ctx2) {
  61470. $self._timeout_((40));
  61471. return $recv($self._async_((function(){
  61472. return $core.withContext(function($ctx3) {
  61473. return $self._finished();
  61474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61475. })))._valueWithTimeout_((20));
  61476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61477. }));
  61478. $ctx1.sendIdx["async:"]=1;
  61479. $recv($1)._valueWithTimeout_((10));
  61480. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61481. return self;
  61482. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61483. },
  61484. args: [],
  61485. 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",
  61486. referencedClasses: [],
  61487. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61488. }),
  61489. $globals.SUnitAsyncTest);
  61490. $core.addMethod(
  61491. $core.method({
  61492. selector: "fakeTimeout",
  61493. protocol: "helpers",
  61494. fn: function (){
  61495. var self=this,$self=this;
  61496. return $core.withContext(function($ctx1) {
  61497. $self._timeout_((10));
  61498. $recv($self._async_((function(){
  61499. return $core.withContext(function($ctx2) {
  61500. return $self._finished();
  61501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61502. })))._valueWithTimeout_((20));
  61503. return self;
  61504. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61505. },
  61506. args: [],
  61507. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61508. referencedClasses: [],
  61509. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61510. }),
  61511. $globals.SUnitAsyncTest);
  61512. $core.addMethod(
  61513. $core.method({
  61514. selector: "selectorSetOf:",
  61515. protocol: "private",
  61516. fn: function (aCollection){
  61517. var self=this,$self=this;
  61518. return $core.withContext(function($ctx1) {
  61519. return $recv($recv(aCollection)._collect_((function(each){
  61520. return $core.withContext(function($ctx2) {
  61521. return $recv(each)._selector();
  61522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61523. })))._asSet();
  61524. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61525. },
  61526. args: ["aCollection"],
  61527. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61528. referencedClasses: [],
  61529. messageSends: ["asSet", "collect:", "selector"]
  61530. }),
  61531. $globals.SUnitAsyncTest);
  61532. $core.addMethod(
  61533. $core.method({
  61534. selector: "setUp",
  61535. protocol: "running",
  61536. fn: function (){
  61537. var self=this,$self=this;
  61538. $self["@flag"]="ok";
  61539. return self;
  61540. },
  61541. args: [],
  61542. source: "setUp\x0a\x09flag := 'ok'",
  61543. referencedClasses: [],
  61544. messageSends: []
  61545. }),
  61546. $globals.SUnitAsyncTest);
  61547. $core.addMethod(
  61548. $core.method({
  61549. selector: "tearDown",
  61550. protocol: "running",
  61551. fn: function (){
  61552. var self=this,$self=this;
  61553. return $core.withContext(function($ctx1) {
  61554. $self._assert_equals_("ok",$self["@flag"]);
  61555. return self;
  61556. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61557. },
  61558. args: [],
  61559. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61560. referencedClasses: [],
  61561. messageSends: ["assert:equals:"]
  61562. }),
  61563. $globals.SUnitAsyncTest);
  61564. $core.addMethod(
  61565. $core.method({
  61566. selector: "testAsyncErrorsAndFailures",
  61567. protocol: "tests",
  61568. fn: function (){
  61569. var self=this,$self=this;
  61570. var suite,runner,result,assertBlock;
  61571. return $core.withContext(function($ctx1) {
  61572. var $1,$2,$3,$4;
  61573. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61574. return $core.withContext(function($ctx2) {
  61575. return $recv($self._class())._selector_(each);
  61576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61577. }));
  61578. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61579. $self._timeout_((200));
  61580. result=$recv(runner)._result();
  61581. $ctx1.sendIdx["result"]=1;
  61582. assertBlock=$self._async_((function(){
  61583. return $core.withContext(function($ctx2) {
  61584. $1=$self._selectorSetOf_($recv(result)._errors());
  61585. $ctx2.sendIdx["selectorSetOf:"]=1;
  61586. $2=["fakeError"]._asSet();
  61587. $ctx2.sendIdx["asSet"]=1;
  61588. $self._assert_equals_($1,$2);
  61589. $ctx2.sendIdx["assert:equals:"]=1;
  61590. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61591. return $self._finished();
  61592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61593. }));
  61594. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61595. return $core.withContext(function($ctx2) {
  61596. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61597. if($core.assert($3)){
  61598. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61599. return $recv($4)._ifTrue_(assertBlock);
  61600. }
  61601. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61602. }));
  61603. $recv(runner)._run();
  61604. return self;
  61605. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61606. },
  61607. args: [],
  61608. 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",
  61609. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61610. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61611. }),
  61612. $globals.SUnitAsyncTest);
  61613. $core.addMethod(
  61614. $core.method({
  61615. selector: "testAsyncNeedsTimeout",
  61616. protocol: "tests",
  61617. fn: function (){
  61618. var self=this,$self=this;
  61619. return $core.withContext(function($ctx1) {
  61620. $self._should_raise_((function(){
  61621. return $core.withContext(function($ctx2) {
  61622. return $self._async_((function(){
  61623. }));
  61624. $ctx2.sendIdx["async:"]=1;
  61625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61626. }),$globals.Error);
  61627. $self._timeout_((0));
  61628. $self._shouldnt_raise_((function(){
  61629. return $core.withContext(function($ctx2) {
  61630. return $self._async_((function(){
  61631. }));
  61632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61633. }),$globals.Error);
  61634. $self._finished();
  61635. return self;
  61636. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61637. },
  61638. args: [],
  61639. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61640. referencedClasses: ["Error"],
  61641. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61642. }),
  61643. $globals.SUnitAsyncTest);
  61644. $core.addMethod(
  61645. $core.method({
  61646. selector: "testFinishedNeedsTimeout",
  61647. protocol: "tests",
  61648. fn: function (){
  61649. var self=this,$self=this;
  61650. return $core.withContext(function($ctx1) {
  61651. $self._should_raise_((function(){
  61652. return $core.withContext(function($ctx2) {
  61653. return $self._finished();
  61654. $ctx2.sendIdx["finished"]=1;
  61655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61656. }),$globals.Error);
  61657. $self._timeout_((0));
  61658. $self._shouldnt_raise_((function(){
  61659. return $core.withContext(function($ctx2) {
  61660. return $self._finished();
  61661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61662. }),$globals.Error);
  61663. return self;
  61664. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61665. },
  61666. args: [],
  61667. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61668. referencedClasses: ["Error"],
  61669. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61670. }),
  61671. $globals.SUnitAsyncTest);
  61672. $core.addMethod(
  61673. $core.method({
  61674. selector: "testIsAsyncReturnsCorrectValues",
  61675. protocol: "tests",
  61676. fn: function (){
  61677. var self=this,$self=this;
  61678. return $core.withContext(function($ctx1) {
  61679. var $1,$2;
  61680. $1=$self._isAsync();
  61681. $ctx1.sendIdx["isAsync"]=1;
  61682. $self._deny_($1);
  61683. $ctx1.sendIdx["deny:"]=1;
  61684. $self._timeout_((0));
  61685. $2=$self._isAsync();
  61686. $ctx1.sendIdx["isAsync"]=2;
  61687. $self._assert_($2);
  61688. $self._finished();
  61689. $self._deny_($self._isAsync());
  61690. return self;
  61691. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61692. },
  61693. args: [],
  61694. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61695. referencedClasses: [],
  61696. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61697. }),
  61698. $globals.SUnitAsyncTest);
  61699. $core.addMethod(
  61700. $core.method({
  61701. selector: "testPass",
  61702. protocol: "tests",
  61703. fn: function (){
  61704. var self=this,$self=this;
  61705. return $core.withContext(function($ctx1) {
  61706. $self["@flag"]="bad";
  61707. $self._timeout_((10));
  61708. $self["@flag"]=$recv($self._async_((function(){
  61709. return $core.withContext(function($ctx2) {
  61710. $self._assert_(true);
  61711. $self._finished();
  61712. $self["@flag"]="ok";
  61713. return $self["@flag"];
  61714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61715. })))._valueWithTimeout_((5));
  61716. return self;
  61717. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61718. },
  61719. args: [],
  61720. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61721. referencedClasses: [],
  61722. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61723. }),
  61724. $globals.SUnitAsyncTest);
  61725. $core.addMethod(
  61726. $core.method({
  61727. selector: "testTimeouts",
  61728. protocol: "tests",
  61729. fn: function (){
  61730. var self=this,$self=this;
  61731. var suite,runner,result,assertBlock;
  61732. return $core.withContext(function($ctx1) {
  61733. var $1,$2,$3;
  61734. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61735. return $core.withContext(function($ctx2) {
  61736. return $recv($self._class())._selector_(each);
  61737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61738. }));
  61739. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61740. $self._timeout_((200));
  61741. result=$recv(runner)._result();
  61742. $ctx1.sendIdx["result"]=1;
  61743. assertBlock=$self._async_((function(){
  61744. return $core.withContext(function($ctx2) {
  61745. $1=$self._selectorSetOf_($recv(result)._errors());
  61746. $ctx2.sendIdx["selectorSetOf:"]=1;
  61747. $self._assert_equals_($1,$recv($globals.Set)._new());
  61748. $ctx2.sendIdx["assert:equals:"]=1;
  61749. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61750. return $self._finished();
  61751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61752. }));
  61753. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61754. return $core.withContext(function($ctx2) {
  61755. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61756. if($core.assert($2)){
  61757. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61758. return $recv($3)._ifTrue_(assertBlock);
  61759. }
  61760. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61761. }));
  61762. $recv(runner)._run();
  61763. return self;
  61764. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61765. },
  61766. args: [],
  61767. 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",
  61768. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61769. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61770. }),
  61771. $globals.SUnitAsyncTest);
  61772. $core.addMethod(
  61773. $core.method({
  61774. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61775. protocol: "tests",
  61776. fn: function (){
  61777. var self=this,$self=this;
  61778. var x;
  61779. return $core.withContext(function($ctx1) {
  61780. var $1;
  61781. $self["@flag"]="bad";
  61782. $self._timeout_((10));
  61783. x=(0);
  61784. $1=$self._async_((function(){
  61785. return $core.withContext(function($ctx2) {
  61786. $self._finished();
  61787. $ctx2.sendIdx["finished"]=1;
  61788. $self["@flag"]="ok";
  61789. x=$recv(x).__plus((1));
  61790. $ctx2.sendIdx["+"]=1;
  61791. return $self._assert_equals_(x,(1));
  61792. $ctx2.sendIdx["assert:equals:"]=1;
  61793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61794. }));
  61795. $ctx1.sendIdx["async:"]=1;
  61796. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61797. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61798. $self["@flag"]=$recv($self._async_((function(){
  61799. return $core.withContext(function($ctx2) {
  61800. $self._finished();
  61801. $self["@flag"]="ok";
  61802. x=$recv(x).__plus((1));
  61803. return $self._assert_equals_(x,(1));
  61804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61805. })))._valueWithTimeout_((0));
  61806. return self;
  61807. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61808. },
  61809. args: [],
  61810. 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.",
  61811. referencedClasses: [],
  61812. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61813. }),
  61814. $globals.SUnitAsyncTest);
  61815. });
  61816. define('amber/devel',[
  61817. './lang',
  61818. './brikz', // pre-fetch, dep of ./boot
  61819. './kernel-checks', // pre-fetch, dep of ./boot
  61820. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61821. './kernel-language', // pre-fetch, dep of ./boot
  61822. './boot', // pre-fetch, class loader
  61823. './deploy', // pre-fetch, dep of ./lang
  61824. // --- packages of the development only Amber begin here ---
  61825. 'amber_core/Platform-DOM',
  61826. 'amber_core/SUnit',
  61827. 'amber_core/Compiler-Tests',
  61828. 'amber_core/Kernel-Tests',
  61829. 'amber_core/Platform-DOM-Tests',
  61830. 'amber_core/SUnit-Tests'
  61831. // --- packages of the development only Amber end here ---
  61832. ], function (amber) {
  61833. return amber;
  61834. });
  61835. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61836. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61837. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61838. var $pkg = $core.addPackage("Platform-Node");
  61839. $pkg.innerEval = function (expr) { return eval(expr); };
  61840. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61841. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61842. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61843. $core.addMethod(
  61844. $core.method({
  61845. selector: "globals",
  61846. protocol: "accessing",
  61847. fn: function (){
  61848. var self=this,$self=this;
  61849. return global;
  61850. },
  61851. args: [],
  61852. source: "globals\x0a\x09^ global",
  61853. referencedClasses: [],
  61854. messageSends: []
  61855. }),
  61856. $globals.NodePlatform);
  61857. $core.addMethod(
  61858. $core.method({
  61859. selector: "newXhr",
  61860. protocol: "accessing",
  61861. fn: function (){
  61862. var self=this,$self=this;
  61863. return $core.withContext(function($ctx1) {
  61864. var $receiver;
  61865. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61866. $self._error_("XMLHttpRequest not available.");
  61867. } else {
  61868. return $recv($globals.XMLHttpRequest)._new();
  61869. }
  61870. return self;
  61871. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61872. },
  61873. args: [],
  61874. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61875. referencedClasses: ["XMLHttpRequest"],
  61876. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61877. }),
  61878. $globals.NodePlatform);
  61879. $core.addMethod(
  61880. $core.method({
  61881. selector: "initialize",
  61882. protocol: "testing",
  61883. fn: function (){
  61884. var self=this,$self=this;
  61885. return $core.withContext(function($ctx1) {
  61886. var $1;
  61887. $1=$self._isFeasible();
  61888. if($core.assert($1)){
  61889. $recv($globals.Platform)._registerIfNone_($self._new());
  61890. }
  61891. return self;
  61892. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61893. },
  61894. args: [],
  61895. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61896. referencedClasses: ["Platform"],
  61897. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61898. }),
  61899. $globals.NodePlatform.a$cls);
  61900. $core.addMethod(
  61901. $core.method({
  61902. selector: "isFeasible",
  61903. protocol: "testing",
  61904. fn: function (){
  61905. var self=this,$self=this;
  61906. return $core.withContext(function($ctx1) {
  61907. return typeof global !== "undefined";
  61908. return self;
  61909. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61910. },
  61911. args: [],
  61912. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61913. referencedClasses: [],
  61914. messageSends: []
  61915. }),
  61916. $globals.NodePlatform.a$cls);
  61917. });
  61918. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61919. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61920. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61921. var $pkg = $core.addPackage("AmberCli");
  61922. $pkg.innerEval = function (expr) { return eval(expr); };
  61923. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  61924. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61925. $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.";
  61926. $core.addMethod(
  61927. $core.method({
  61928. selector: "commandLineSwitches",
  61929. protocol: "commandline",
  61930. fn: function (){
  61931. var self=this,$self=this;
  61932. var switches;
  61933. return $core.withContext(function($ctx1) {
  61934. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61935. return $core.withContext(function($ctx2) {
  61936. return $recv(each)._selector();
  61937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61938. }));
  61939. $ctx1.sendIdx["collect:"]=1;
  61940. switches=$recv(switches)._select_((function(each){
  61941. return $core.withContext(function($ctx2) {
  61942. return $recv(each)._match_("^[^:]*:$");
  61943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61944. }));
  61945. switches=$recv(switches)._collect_((function(each){
  61946. return $core.withContext(function($ctx2) {
  61947. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61949. }));
  61950. return switches;
  61951. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61952. },
  61953. args: [],
  61954. 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",
  61955. referencedClasses: [],
  61956. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61957. }),
  61958. $globals.AmberCli.a$cls);
  61959. $core.addMethod(
  61960. $core.method({
  61961. selector: "config:",
  61962. protocol: "commands",
  61963. fn: function (args){
  61964. var self=this,$self=this;
  61965. return $core.withContext(function($ctx1) {
  61966. $recv($recv($globals.Configurator)._new())._start();
  61967. return self;
  61968. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61969. },
  61970. args: ["args"],
  61971. source: "config: args\x0a\x09Configurator new start",
  61972. referencedClasses: ["Configurator"],
  61973. messageSends: ["start", "new"]
  61974. }),
  61975. $globals.AmberCli.a$cls);
  61976. $core.addMethod(
  61977. $core.method({
  61978. selector: "handleArguments:",
  61979. protocol: "commandline",
  61980. fn: function (args){
  61981. var self=this,$self=this;
  61982. var selector;
  61983. return $core.withContext(function($ctx1) {
  61984. var $1;
  61985. $1=$recv(args)._first();
  61986. $ctx1.sendIdx["first"]=1;
  61987. selector=$self._selectorForCommandLineSwitch_($1);
  61988. $recv(args)._remove_($recv(args)._first());
  61989. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61990. return self;
  61991. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61992. },
  61993. args: ["args"],
  61994. 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)",
  61995. referencedClasses: ["Array"],
  61996. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61997. }),
  61998. $globals.AmberCli.a$cls);
  61999. $core.addMethod(
  62000. $core.method({
  62001. selector: "help:",
  62002. protocol: "commands",
  62003. fn: function (args){
  62004. var self=this,$self=this;
  62005. return $core.withContext(function($ctx1) {
  62006. $recv($globals.Transcript)._show_("Available commands");
  62007. $recv($self._commandLineSwitches())._do_((function(each){
  62008. return $core.withContext(function($ctx2) {
  62009. return $recv(console)._log_(each);
  62010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62011. }));
  62012. return self;
  62013. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62014. },
  62015. args: ["args"],
  62016. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62017. referencedClasses: ["Transcript"],
  62018. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62019. }),
  62020. $globals.AmberCli.a$cls);
  62021. $core.addMethod(
  62022. $core.method({
  62023. selector: "init:",
  62024. protocol: "commands",
  62025. fn: function (args){
  62026. var self=this,$self=this;
  62027. return $core.withContext(function($ctx1) {
  62028. $recv($recv($globals.Initer)._new())._start();
  62029. return self;
  62030. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62031. },
  62032. args: ["args"],
  62033. source: "init: args\x0a\x09Initer new start",
  62034. referencedClasses: ["Initer"],
  62035. messageSends: ["start", "new"]
  62036. }),
  62037. $globals.AmberCli.a$cls);
  62038. $core.addMethod(
  62039. $core.method({
  62040. selector: "main",
  62041. protocol: "startup",
  62042. fn: function (){
  62043. var self=this,$self=this;
  62044. var args,packageJSON;
  62045. return $core.withContext(function($ctx1) {
  62046. var $7,$6,$5,$4,$3,$2,$1;
  62047. var $early={};
  62048. try {
  62049. packageJSON=$recv(require)._value_("../package.json");
  62050. $7=$recv(packageJSON)._version();
  62051. $ctx1.sendIdx["version"]=1;
  62052. $6="Welcome to Amber CLI version ".__comma($7);
  62053. $5=$recv($6).__comma(" (Amber ");
  62054. $ctx1.sendIdx[","]=5;
  62055. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62056. $ctx1.sendIdx[","]=4;
  62057. $3=$recv($4).__comma(", NodeJS ");
  62058. $ctx1.sendIdx[","]=3;
  62059. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62060. $ctx1.sendIdx[","]=2;
  62061. $1=$recv($2).__comma(").");
  62062. $ctx1.sendIdx[","]=1;
  62063. $recv($globals.Transcript)._show_($1);
  62064. args=$recv(process)._argv();
  62065. $recv(args)._removeFrom_to_((1),(2));
  62066. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62067. return $core.withContext(function($ctx2) {
  62068. return $self._help_(nil);
  62069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62070. }),(function(){
  62071. return $core.withContext(function($ctx2) {
  62072. throw $early=[$self._handleArguments_(args)];
  62073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62074. }));
  62075. return self;
  62076. }
  62077. catch(e) {if(e===$early)return e[0]; throw e}
  62078. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62079. },
  62080. args: [],
  62081. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args packageJSON |\x0a\x09\x0a\x09packageJSON := require value: '../package.json'.\x0a\x09Transcript show: 'Welcome to Amber CLI version ', packageJSON version, ' (Amber ', Smalltalk version, ', NodeJS ', process versions node, ').'.\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09args\x0a\x09\x09ifEmpty: [self help: nil]\x0a\x09\x09ifNotEmpty: [^self handleArguments: args]",
  62082. referencedClasses: ["Transcript", "Smalltalk"],
  62083. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62084. }),
  62085. $globals.AmberCli.a$cls);
  62086. $core.addMethod(
  62087. $core.method({
  62088. selector: "repl:",
  62089. protocol: "commands",
  62090. fn: function (args){
  62091. var self=this,$self=this;
  62092. return $core.withContext(function($ctx1) {
  62093. return $recv($recv($globals.Repl)._new())._createInterface();
  62094. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62095. },
  62096. args: ["args"],
  62097. source: "repl: args\x0a\x09^ Repl new createInterface",
  62098. referencedClasses: ["Repl"],
  62099. messageSends: ["createInterface", "new"]
  62100. }),
  62101. $globals.AmberCli.a$cls);
  62102. $core.addMethod(
  62103. $core.method({
  62104. selector: "selectorForCommandLineSwitch:",
  62105. protocol: "commandline",
  62106. fn: function (aSwitch){
  62107. var self=this,$self=this;
  62108. var command,selector;
  62109. return $core.withContext(function($ctx1) {
  62110. var $1;
  62111. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62112. if($core.assert($1)){
  62113. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62114. return $core.withContext(function($ctx2) {
  62115. return $recv($recv(each)._second())._asUppercase();
  62116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62117. }))).__comma(":");
  62118. selector;
  62119. } else {
  62120. selector="help:";
  62121. selector;
  62122. }
  62123. return selector;
  62124. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62125. },
  62126. args: ["aSwitch"],
  62127. 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",
  62128. referencedClasses: [],
  62129. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62130. }),
  62131. $globals.AmberCli.a$cls);
  62132. $core.addMethod(
  62133. $core.method({
  62134. selector: "serve:",
  62135. protocol: "commands",
  62136. fn: function (args){
  62137. var self=this,$self=this;
  62138. return $core.withContext(function($ctx1) {
  62139. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62140. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62141. },
  62142. args: ["args"],
  62143. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62144. referencedClasses: ["FileServer"],
  62145. messageSends: ["start", "createServerWithArguments:"]
  62146. }),
  62147. $globals.AmberCli.a$cls);
  62148. $core.addMethod(
  62149. $core.method({
  62150. selector: "version:",
  62151. protocol: "commands",
  62152. fn: function (arguments_){
  62153. var self=this,$self=this;
  62154. return self;
  62155. },
  62156. args: ["arguments"],
  62157. source: "version: arguments",
  62158. referencedClasses: [],
  62159. messageSends: []
  62160. }),
  62161. $globals.AmberCli.a$cls);
  62162. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62163. $core.addMethod(
  62164. $core.method({
  62165. selector: "dirname",
  62166. protocol: "private",
  62167. fn: function (){
  62168. var self=this,$self=this;
  62169. return $core.withContext(function($ctx1) {
  62170. return __dirname;
  62171. return self;
  62172. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62173. },
  62174. args: [],
  62175. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62176. referencedClasses: [],
  62177. messageSends: []
  62178. }),
  62179. $globals.BaseFileManipulator);
  62180. $core.addMethod(
  62181. $core.method({
  62182. selector: "initialize",
  62183. protocol: "initialization",
  62184. fn: function (){
  62185. var self=this,$self=this;
  62186. return $core.withContext(function($ctx1) {
  62187. (
  62188. $ctx1.supercall = true,
  62189. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62190. $ctx1.supercall = false;
  62191. $self["@path"]=$recv(require)._value_("path");
  62192. $ctx1.sendIdx["value:"]=1;
  62193. $self["@fs"]=$recv(require)._value_("fs");
  62194. return self;
  62195. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62196. },
  62197. args: [],
  62198. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62199. referencedClasses: [],
  62200. messageSends: ["initialize", "value:"]
  62201. }),
  62202. $globals.BaseFileManipulator);
  62203. $core.addMethod(
  62204. $core.method({
  62205. selector: "rootDirname",
  62206. protocol: "private",
  62207. fn: function (){
  62208. var self=this,$self=this;
  62209. return $core.withContext(function($ctx1) {
  62210. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62211. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62212. },
  62213. args: [],
  62214. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62215. referencedClasses: [],
  62216. messageSends: ["join:with:", "dirname"]
  62217. }),
  62218. $globals.BaseFileManipulator);
  62219. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62220. $core.addMethod(
  62221. $core.method({
  62222. selector: "initialize",
  62223. protocol: "initialization",
  62224. fn: function (){
  62225. var self=this,$self=this;
  62226. return $core.withContext(function($ctx1) {
  62227. (
  62228. $ctx1.supercall = true,
  62229. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62230. $ctx1.supercall = false;
  62231. return self;
  62232. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62233. },
  62234. args: [],
  62235. source: "initialize\x0a\x09super initialize",
  62236. referencedClasses: [],
  62237. messageSends: ["initialize"]
  62238. }),
  62239. $globals.Configurator);
  62240. $core.addMethod(
  62241. $core.method({
  62242. selector: "start",
  62243. protocol: "action",
  62244. fn: function (){
  62245. var self=this,$self=this;
  62246. return $core.withContext(function($ctx1) {
  62247. var $receiver;
  62248. $self._writeConfigThenDo_((function(err){
  62249. return $core.withContext(function($ctx2) {
  62250. if(($receiver = err) == null || $receiver.a$nil){
  62251. return $recv(process)._exit();
  62252. } else {
  62253. return $recv(process)._exit_((111));
  62254. }
  62255. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62256. }));
  62257. return self;
  62258. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62259. },
  62260. args: [],
  62261. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62262. referencedClasses: [],
  62263. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62264. }),
  62265. $globals.Configurator);
  62266. $core.addMethod(
  62267. $core.method({
  62268. selector: "writeConfigThenDo:",
  62269. protocol: "action",
  62270. fn: function (aBlock){
  62271. var self=this,$self=this;
  62272. return $core.withContext(function($ctx1) {
  62273. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62274. return self;
  62275. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62276. },
  62277. args: ["aBlock"],
  62278. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62279. referencedClasses: [],
  62280. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62281. }),
  62282. $globals.Configurator);
  62283. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62284. $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.";
  62285. $core.addMethod(
  62286. $core.method({
  62287. selector: "base64Decode:",
  62288. protocol: "private",
  62289. fn: function (aString){
  62290. var self=this,$self=this;
  62291. return $core.withContext(function($ctx1) {
  62292. return (new Buffer(aString, "base64").toString());
  62293. return self;
  62294. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62295. },
  62296. args: ["aString"],
  62297. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62298. referencedClasses: [],
  62299. messageSends: []
  62300. }),
  62301. $globals.FileServer);
  62302. $core.addMethod(
  62303. $core.method({
  62304. selector: "basePath",
  62305. protocol: "accessing",
  62306. fn: function (){
  62307. var self=this,$self=this;
  62308. return $core.withContext(function($ctx1) {
  62309. var $1,$receiver;
  62310. $1=$self["@basePath"];
  62311. if(($receiver = $1) == null || $receiver.a$nil){
  62312. return $recv($self._class())._defaultBasePath();
  62313. } else {
  62314. return $1;
  62315. }
  62316. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62317. },
  62318. args: [],
  62319. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62320. referencedClasses: [],
  62321. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62322. }),
  62323. $globals.FileServer);
  62324. $core.addMethod(
  62325. $core.method({
  62326. selector: "basePath:",
  62327. protocol: "accessing",
  62328. fn: function (aString){
  62329. var self=this,$self=this;
  62330. return $core.withContext(function($ctx1) {
  62331. $self["@basePath"]=aString;
  62332. $self._validateBasePath();
  62333. return self;
  62334. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62335. },
  62336. args: ["aString"],
  62337. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62338. referencedClasses: [],
  62339. messageSends: ["validateBasePath"]
  62340. }),
  62341. $globals.FileServer);
  62342. $core.addMethod(
  62343. $core.method({
  62344. selector: "checkDirectoryLayout",
  62345. protocol: "initialization",
  62346. fn: function (){
  62347. var self=this,$self=this;
  62348. return $core.withContext(function($ctx1) {
  62349. var $1;
  62350. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62351. if(!$core.assert($1)){
  62352. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62353. $ctx1.sendIdx["warn:"]=1;
  62354. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62355. $ctx1.sendIdx["warn:"]=2;
  62356. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62357. $ctx1.sendIdx["warn:"]=3;
  62358. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62359. }
  62360. return self;
  62361. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62362. },
  62363. args: [],
  62364. 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.'].",
  62365. referencedClasses: [],
  62366. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62367. }),
  62368. $globals.FileServer);
  62369. $core.addMethod(
  62370. $core.method({
  62371. selector: "fallbackPage",
  62372. protocol: "accessing",
  62373. fn: function (){
  62374. var self=this,$self=this;
  62375. return $self["@fallbackPage"];
  62376. },
  62377. args: [],
  62378. source: "fallbackPage\x0a\x09^ fallbackPage",
  62379. referencedClasses: [],
  62380. messageSends: []
  62381. }),
  62382. $globals.FileServer);
  62383. $core.addMethod(
  62384. $core.method({
  62385. selector: "fallbackPage:",
  62386. protocol: "accessing",
  62387. fn: function (aString){
  62388. var self=this,$self=this;
  62389. $self["@fallbackPage"]=aString;
  62390. return self;
  62391. },
  62392. args: ["aString"],
  62393. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62394. referencedClasses: [],
  62395. messageSends: []
  62396. }),
  62397. $globals.FileServer);
  62398. $core.addMethod(
  62399. $core.method({
  62400. selector: "handleGETRequest:respondTo:",
  62401. protocol: "request handling",
  62402. fn: function (aRequest,aResponse){
  62403. var self=this,$self=this;
  62404. var uri,filename;
  62405. return $core.withContext(function($ctx1) {
  62406. var $1;
  62407. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62408. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62409. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62410. return $core.withContext(function($ctx2) {
  62411. if($core.assert(aBoolean)){
  62412. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62413. if($core.assert($1)){
  62414. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62415. } else {
  62416. return $self._respondFileNamed_to_(filename,aResponse);
  62417. }
  62418. } else {
  62419. return $self._respondNotFoundTo_(aResponse);
  62420. }
  62421. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62422. }));
  62423. return self;
  62424. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62425. },
  62426. args: ["aRequest", "aResponse"],
  62427. 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]]]",
  62428. referencedClasses: [],
  62429. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62430. }),
  62431. $globals.FileServer);
  62432. $core.addMethod(
  62433. $core.method({
  62434. selector: "handleOPTIONSRequest:respondTo:",
  62435. protocol: "request handling",
  62436. fn: function (aRequest,aResponse){
  62437. var self=this,$self=this;
  62438. return $core.withContext(function($ctx1) {
  62439. $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)]));
  62440. $recv(aResponse)._end();
  62441. return self;
  62442. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62443. },
  62444. args: ["aRequest", "aResponse"],
  62445. 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",
  62446. referencedClasses: [],
  62447. messageSends: ["writeHead:options:", "end"]
  62448. }),
  62449. $globals.FileServer);
  62450. $core.addMethod(
  62451. $core.method({
  62452. selector: "handlePUTRequest:respondTo:",
  62453. protocol: "request handling",
  62454. fn: function (aRequest,aResponse){
  62455. var self=this,$self=this;
  62456. var file,stream;
  62457. return $core.withContext(function($ctx1) {
  62458. var $1,$2,$3,$4;
  62459. $1=$self._isAuthenticated_(aRequest);
  62460. if(!$core.assert($1)){
  62461. $self._respondAuthenticationRequiredTo_(aResponse);
  62462. return nil;
  62463. }
  62464. file=".".__comma($recv(aRequest)._url());
  62465. $ctx1.sendIdx[","]=1;
  62466. stream=$recv($self["@fs"])._createWriteStream_(file);
  62467. $recv(stream)._on_do_("error",(function(error){
  62468. return $core.withContext(function($ctx2) {
  62469. $2=console;
  62470. $3="Error creating WriteStream for file ".__comma(file);
  62471. $ctx2.sendIdx[","]=2;
  62472. $recv($2)._warn_($3);
  62473. $ctx2.sendIdx["warn:"]=1;
  62474. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62475. $ctx2.sendIdx["warn:"]=2;
  62476. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62477. return $self._respondNotCreatedTo_(aResponse);
  62478. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62479. }));
  62480. $ctx1.sendIdx["on:do:"]=1;
  62481. $recv(stream)._on_do_("close",(function(){
  62482. return $core.withContext(function($ctx2) {
  62483. return $self._respondCreatedTo_(aResponse);
  62484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62485. }));
  62486. $ctx1.sendIdx["on:do:"]=2;
  62487. $recv(aRequest)._setEncoding_("utf8");
  62488. $recv(aRequest)._on_do_("data",(function(data){
  62489. return $core.withContext(function($ctx2) {
  62490. return $recv(stream)._write_(data);
  62491. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62492. }));
  62493. $ctx1.sendIdx["on:do:"]=3;
  62494. $recv(aRequest)._on_do_("end",(function(){
  62495. return $core.withContext(function($ctx2) {
  62496. $4=$recv(stream)._writable();
  62497. if($core.assert($4)){
  62498. return $recv(stream)._end();
  62499. }
  62500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62501. }));
  62502. return self;
  62503. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62504. },
  62505. args: ["aRequest", "aResponse"],
  62506. 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]]",
  62507. referencedClasses: [],
  62508. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62509. }),
  62510. $globals.FileServer);
  62511. $core.addMethod(
  62512. $core.method({
  62513. selector: "handleRequest:respondTo:",
  62514. protocol: "request handling",
  62515. fn: function (aRequest,aResponse){
  62516. var self=this,$self=this;
  62517. return $core.withContext(function($ctx1) {
  62518. var $2,$1,$4,$3,$5;
  62519. $2=$recv(aRequest)._method();
  62520. $ctx1.sendIdx["method"]=1;
  62521. $1=$recv($2).__eq("PUT");
  62522. $ctx1.sendIdx["="]=1;
  62523. if($core.assert($1)){
  62524. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62525. }
  62526. $4=$recv(aRequest)._method();
  62527. $ctx1.sendIdx["method"]=2;
  62528. $3=$recv($4).__eq("GET");
  62529. $ctx1.sendIdx["="]=2;
  62530. if($core.assert($3)){
  62531. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62532. }
  62533. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62534. if($core.assert($5)){
  62535. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62536. }
  62537. return self;
  62538. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62539. },
  62540. args: ["aRequest", "aResponse"],
  62541. 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]",
  62542. referencedClasses: [],
  62543. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62544. }),
  62545. $globals.FileServer);
  62546. $core.addMethod(
  62547. $core.method({
  62548. selector: "host",
  62549. protocol: "accessing",
  62550. fn: function (){
  62551. var self=this,$self=this;
  62552. return $self["@host"];
  62553. },
  62554. args: [],
  62555. source: "host\x0a\x09^ host",
  62556. referencedClasses: [],
  62557. messageSends: []
  62558. }),
  62559. $globals.FileServer);
  62560. $core.addMethod(
  62561. $core.method({
  62562. selector: "host:",
  62563. protocol: "accessing",
  62564. fn: function (hostname){
  62565. var self=this,$self=this;
  62566. $self["@host"]=hostname;
  62567. return self;
  62568. },
  62569. args: ["hostname"],
  62570. source: "host: hostname\x0a\x09host := hostname",
  62571. referencedClasses: [],
  62572. messageSends: []
  62573. }),
  62574. $globals.FileServer);
  62575. $core.addMethod(
  62576. $core.method({
  62577. selector: "initialize",
  62578. protocol: "initialization",
  62579. fn: function (){
  62580. var self=this,$self=this;
  62581. return $core.withContext(function($ctx1) {
  62582. var $1;
  62583. (
  62584. $ctx1.supercall = true,
  62585. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62586. $ctx1.supercall = false;
  62587. $self["@http"]=$self._require_("http");
  62588. $ctx1.sendIdx["require:"]=1;
  62589. $self["@util"]=$self._require_("util");
  62590. $ctx1.sendIdx["require:"]=2;
  62591. $self["@url"]=$self._require_("url");
  62592. $1=$self._class();
  62593. $ctx1.sendIdx["class"]=1;
  62594. $self["@host"]=$recv($1)._defaultHost();
  62595. $self["@port"]=$recv($self._class())._defaultPort();
  62596. $self["@username"]=nil;
  62597. $self["@password"]=nil;
  62598. $self["@fallbackPage"]=nil;
  62599. return self;
  62600. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62601. },
  62602. args: [],
  62603. 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.",
  62604. referencedClasses: [],
  62605. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62606. }),
  62607. $globals.FileServer);
  62608. $core.addMethod(
  62609. $core.method({
  62610. selector: "isAuthenticated:",
  62611. protocol: "private",
  62612. fn: function (aRequest){
  62613. var self=this,$self=this;
  62614. var header,token,auth,parts;
  62615. return $core.withContext(function($ctx1) {
  62616. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62617. var $early={};
  62618. try {
  62619. $2=$recv($self["@username"])._isNil();
  62620. $ctx1.sendIdx["isNil"]=1;
  62621. $1=$recv($2)._and_((function(){
  62622. return $core.withContext(function($ctx2) {
  62623. return $recv($self["@password"])._isNil();
  62624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62625. }));
  62626. $ctx1.sendIdx["and:"]=1;
  62627. if($core.assert($1)){
  62628. return true;
  62629. }
  62630. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62631. $ctx1.sendIdx["at:"]=1;
  62632. if(($receiver = $3) == null || $receiver.a$nil){
  62633. header="";
  62634. } else {
  62635. header=$3;
  62636. }
  62637. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62638. throw $early=[false];
  62639. }),(function(){
  62640. return $core.withContext(function($ctx2) {
  62641. $4=$recv(header)._tokenize_(" ");
  62642. $ctx2.sendIdx["tokenize:"]=1;
  62643. if(($receiver = $4) == null || $receiver.a$nil){
  62644. token="";
  62645. } else {
  62646. token=$4;
  62647. }
  62648. $5=$recv(token)._at_((2));
  62649. $ctx2.sendIdx["at:"]=2;
  62650. auth=$self._base64Decode_($5);
  62651. parts=$recv(auth)._tokenize_(":");
  62652. $8=$self["@username"];
  62653. $9=$recv(parts)._at_((1));
  62654. $ctx2.sendIdx["at:"]=3;
  62655. $7=$recv($8).__eq($9);
  62656. $ctx2.sendIdx["="]=1;
  62657. $6=$recv($7)._and_((function(){
  62658. return $core.withContext(function($ctx3) {
  62659. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62660. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62661. }));
  62662. if($core.assert($6)){
  62663. throw $early=[true];
  62664. } else {
  62665. throw $early=[false];
  62666. }
  62667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62668. }));
  62669. return self;
  62670. }
  62671. catch(e) {if(e===$early)return e[0]; throw e}
  62672. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62673. },
  62674. args: ["aRequest"],
  62675. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^ true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09header\x0a\x09ifEmpty: [^ false]\x0a\x09ifNotEmpty: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^ true]\x0a\x09\x09\x09ifFalse: [^ false]\x0a\x09].",
  62676. referencedClasses: [],
  62677. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62678. }),
  62679. $globals.FileServer);
  62680. $core.addMethod(
  62681. $core.method({
  62682. selector: "password:",
  62683. protocol: "accessing",
  62684. fn: function (aPassword){
  62685. var self=this,$self=this;
  62686. $self["@password"]=aPassword;
  62687. return self;
  62688. },
  62689. args: ["aPassword"],
  62690. source: "password: aPassword\x0a\x09password := aPassword.",
  62691. referencedClasses: [],
  62692. messageSends: []
  62693. }),
  62694. $globals.FileServer);
  62695. $core.addMethod(
  62696. $core.method({
  62697. selector: "port",
  62698. protocol: "accessing",
  62699. fn: function (){
  62700. var self=this,$self=this;
  62701. return $self["@port"];
  62702. },
  62703. args: [],
  62704. source: "port\x0a\x09^ port",
  62705. referencedClasses: [],
  62706. messageSends: []
  62707. }),
  62708. $globals.FileServer);
  62709. $core.addMethod(
  62710. $core.method({
  62711. selector: "port:",
  62712. protocol: "accessing",
  62713. fn: function (aNumber){
  62714. var self=this,$self=this;
  62715. $self["@port"]=aNumber;
  62716. return self;
  62717. },
  62718. args: ["aNumber"],
  62719. source: "port: aNumber\x0a\x09port := aNumber",
  62720. referencedClasses: [],
  62721. messageSends: []
  62722. }),
  62723. $globals.FileServer);
  62724. $core.addMethod(
  62725. $core.method({
  62726. selector: "require:",
  62727. protocol: "private",
  62728. fn: function (aModuleString){
  62729. var self=this,$self=this;
  62730. return $core.withContext(function($ctx1) {
  62731. return $recv(require)._value_(aModuleString);
  62732. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62733. },
  62734. args: ["aModuleString"],
  62735. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62736. referencedClasses: [],
  62737. messageSends: ["value:"]
  62738. }),
  62739. $globals.FileServer);
  62740. $core.addMethod(
  62741. $core.method({
  62742. selector: "respondAuthenticationRequiredTo:",
  62743. protocol: "request handling",
  62744. fn: function (aResponse){
  62745. var self=this,$self=this;
  62746. return $core.withContext(function($ctx1) {
  62747. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62748. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62749. $recv(aResponse)._end();
  62750. return self;
  62751. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62752. },
  62753. args: ["aResponse"],
  62754. 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.",
  62755. referencedClasses: [],
  62756. messageSends: ["writeHead:options:", "write:", "end"]
  62757. }),
  62758. $globals.FileServer);
  62759. $core.addMethod(
  62760. $core.method({
  62761. selector: "respondCreatedTo:",
  62762. protocol: "request handling",
  62763. fn: function (aResponse){
  62764. var self=this,$self=this;
  62765. return $core.withContext(function($ctx1) {
  62766. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62767. $recv(aResponse)._end();
  62768. return self;
  62769. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62770. },
  62771. args: ["aResponse"],
  62772. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62773. referencedClasses: [],
  62774. messageSends: ["writeHead:options:", "end"]
  62775. }),
  62776. $globals.FileServer);
  62777. $core.addMethod(
  62778. $core.method({
  62779. selector: "respondDirectoryNamed:from:to:",
  62780. protocol: "request handling",
  62781. fn: function (aDirname,aUrl,aResponse){
  62782. var self=this,$self=this;
  62783. return $core.withContext(function($ctx1) {
  62784. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62785. $2=$recv(aUrl)._pathname();
  62786. $ctx1.sendIdx["pathname"]=1;
  62787. $1=$recv($2)._endsWith_("/");
  62788. if($core.assert($1)){
  62789. $3=$recv(aDirname).__comma("index.html");
  62790. $ctx1.sendIdx[","]=1;
  62791. $self._respondFileNamed_to_($3,aResponse);
  62792. } else {
  62793. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62794. $7=$recv(aUrl)._search();
  62795. if(($receiver = $7) == null || $receiver.a$nil){
  62796. $6="";
  62797. } else {
  62798. $6=$7;
  62799. }
  62800. $4=$recv($5).__comma($6);
  62801. $ctx1.sendIdx[","]=2;
  62802. $self._respondRedirect_to_($4,aResponse);
  62803. }
  62804. return self;
  62805. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62806. },
  62807. args: ["aDirname", "aUrl", "aResponse"],
  62808. 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]",
  62809. referencedClasses: [],
  62810. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62811. }),
  62812. $globals.FileServer);
  62813. $core.addMethod(
  62814. $core.method({
  62815. selector: "respondFileNamed:to:",
  62816. protocol: "request handling",
  62817. fn: function (aFilename,aResponse){
  62818. var self=this,$self=this;
  62819. var type,filename;
  62820. return $core.withContext(function($ctx1) {
  62821. var $1,$2,$3,$4;
  62822. filename=aFilename;
  62823. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62824. return $core.withContext(function($ctx2) {
  62825. $1=$recv(ex)._notNil();
  62826. if($core.assert($1)){
  62827. $2=console;
  62828. $3=$recv(filename).__comma(" does not exist");
  62829. $ctx2.sendIdx[","]=1;
  62830. $recv($2)._log_($3);
  62831. return $self._respondNotFoundTo_(aResponse);
  62832. } else {
  62833. type=$recv($self._class())._mimeTypeFor_(filename);
  62834. $4=$recv(type).__eq("application/javascript");
  62835. if($core.assert($4)){
  62836. type=$recv(type).__comma(";charset=utf-8");
  62837. type;
  62838. }
  62839. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62840. $recv(aResponse)._write_encoding_(file,"binary");
  62841. return $recv(aResponse)._end();
  62842. }
  62843. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62844. }));
  62845. return self;
  62846. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62847. },
  62848. args: ["aFilename", "aResponse"],
  62849. 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]]",
  62850. referencedClasses: [],
  62851. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62852. }),
  62853. $globals.FileServer);
  62854. $core.addMethod(
  62855. $core.method({
  62856. selector: "respondInternalErrorTo:",
  62857. protocol: "request handling",
  62858. fn: function (aResponse){
  62859. var self=this,$self=this;
  62860. return $core.withContext(function($ctx1) {
  62861. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62862. $recv(aResponse)._write_("500 Internal server error");
  62863. $recv(aResponse)._end();
  62864. return self;
  62865. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62866. },
  62867. args: ["aResponse"],
  62868. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62869. referencedClasses: [],
  62870. messageSends: ["writeHead:options:", "write:", "end"]
  62871. }),
  62872. $globals.FileServer);
  62873. $core.addMethod(
  62874. $core.method({
  62875. selector: "respondNotCreatedTo:",
  62876. protocol: "request handling",
  62877. fn: function (aResponse){
  62878. var self=this,$self=this;
  62879. return $core.withContext(function($ctx1) {
  62880. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62881. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62882. $recv(aResponse)._end();
  62883. return self;
  62884. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62885. },
  62886. args: ["aResponse"],
  62887. 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.",
  62888. referencedClasses: [],
  62889. messageSends: ["writeHead:options:", "write:", "end"]
  62890. }),
  62891. $globals.FileServer);
  62892. $core.addMethod(
  62893. $core.method({
  62894. selector: "respondNotFoundTo:",
  62895. protocol: "request handling",
  62896. fn: function (aResponse){
  62897. var self=this,$self=this;
  62898. return $core.withContext(function($ctx1) {
  62899. var $2,$1;
  62900. $2=$self._fallbackPage();
  62901. $ctx1.sendIdx["fallbackPage"]=1;
  62902. $1=$recv($2)._isNil();
  62903. if(!$core.assert($1)){
  62904. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62905. }
  62906. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62907. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62908. $ctx1.sendIdx["write:"]=1;
  62909. $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>");
  62910. $ctx1.sendIdx["write:"]=2;
  62911. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62912. $ctx1.sendIdx["write:"]=3;
  62913. $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>");
  62914. $ctx1.sendIdx["write:"]=4;
  62915. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62916. $ctx1.sendIdx["write:"]=5;
  62917. $recv(aResponse)._write_("</ul></p></body></html>");
  62918. $recv(aResponse)._end();
  62919. return self;
  62920. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62921. },
  62922. args: ["aResponse"],
  62923. 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",
  62924. referencedClasses: [],
  62925. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62926. }),
  62927. $globals.FileServer);
  62928. $core.addMethod(
  62929. $core.method({
  62930. selector: "respondOKTo:",
  62931. protocol: "request handling",
  62932. fn: function (aResponse){
  62933. var self=this,$self=this;
  62934. return $core.withContext(function($ctx1) {
  62935. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62936. $recv(aResponse)._end();
  62937. return self;
  62938. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62939. },
  62940. args: ["aResponse"],
  62941. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62942. referencedClasses: [],
  62943. messageSends: ["writeHead:options:", "end"]
  62944. }),
  62945. $globals.FileServer);
  62946. $core.addMethod(
  62947. $core.method({
  62948. selector: "respondRedirect:to:",
  62949. protocol: "request handling",
  62950. fn: function (aString,aResponse){
  62951. var self=this,$self=this;
  62952. return $core.withContext(function($ctx1) {
  62953. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62954. $recv(aResponse)._end();
  62955. return self;
  62956. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62957. },
  62958. args: ["aString", "aResponse"],
  62959. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62960. referencedClasses: [],
  62961. messageSends: ["writeHead:options:", "end"]
  62962. }),
  62963. $globals.FileServer);
  62964. $core.addMethod(
  62965. $core.method({
  62966. selector: "start",
  62967. protocol: "starting",
  62968. fn: function (){
  62969. var self=this,$self=this;
  62970. return $core.withContext(function($ctx1) {
  62971. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62972. $self._checkDirectoryLayout();
  62973. $1=$recv($self["@http"])._createServer_((function(request,response){
  62974. return $core.withContext(function($ctx2) {
  62975. return $self._handleRequest_respondTo_(request,response);
  62976. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62977. }));
  62978. $recv($1)._on_do_("error",(function(error){
  62979. return $core.withContext(function($ctx2) {
  62980. $2=console;
  62981. $3="Error starting server: ".__comma(error);
  62982. $ctx2.sendIdx[","]=1;
  62983. return $recv($2)._log_($3);
  62984. $ctx2.sendIdx["log:"]=1;
  62985. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62986. }));
  62987. $ctx1.sendIdx["on:do:"]=1;
  62988. $recv($1)._on_do_("listening",(function(){
  62989. return $core.withContext(function($ctx2) {
  62990. $4=console;
  62991. $8=$self._host();
  62992. $ctx2.sendIdx["host"]=1;
  62993. $7="Starting file server on http://".__comma($8);
  62994. $6=$recv($7).__comma(":");
  62995. $ctx2.sendIdx[","]=3;
  62996. $10=$self._port();
  62997. $ctx2.sendIdx["port"]=1;
  62998. $9=$recv($10)._asString();
  62999. $5=$recv($6).__comma($9);
  63000. $ctx2.sendIdx[","]=2;
  63001. return $recv($4)._log_($5);
  63002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63003. }));
  63004. $recv($1)._listen_host_($self._port(),$self._host());
  63005. return self;
  63006. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63007. },
  63008. args: [],
  63009. 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.",
  63010. referencedClasses: [],
  63011. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63012. }),
  63013. $globals.FileServer);
  63014. $core.addMethod(
  63015. $core.method({
  63016. selector: "startOn:",
  63017. protocol: "starting",
  63018. fn: function (aPort){
  63019. var self=this,$self=this;
  63020. return $core.withContext(function($ctx1) {
  63021. $self._port_(aPort);
  63022. $self._start();
  63023. return self;
  63024. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63025. },
  63026. args: ["aPort"],
  63027. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63028. referencedClasses: [],
  63029. messageSends: ["port:", "start"]
  63030. }),
  63031. $globals.FileServer);
  63032. $core.addMethod(
  63033. $core.method({
  63034. selector: "username:",
  63035. protocol: "accessing",
  63036. fn: function (aUsername){
  63037. var self=this,$self=this;
  63038. $self["@username"]=aUsername;
  63039. return self;
  63040. },
  63041. args: ["aUsername"],
  63042. source: "username: aUsername\x0a\x09username := aUsername.",
  63043. referencedClasses: [],
  63044. messageSends: []
  63045. }),
  63046. $globals.FileServer);
  63047. $core.addMethod(
  63048. $core.method({
  63049. selector: "validateBasePath",
  63050. protocol: "private",
  63051. fn: function (){
  63052. var self=this,$self=this;
  63053. return $core.withContext(function($ctx1) {
  63054. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63055. $1=$self["@fs"];
  63056. $2=$self._basePath();
  63057. $ctx1.sendIdx["basePath"]=1;
  63058. $recv($1)._stat_then_($2,(function(err,stat){
  63059. return $core.withContext(function($ctx2) {
  63060. if(($receiver = err) == null || $receiver.a$nil){
  63061. $3=$recv(stat)._isDirectory();
  63062. if(!$core.assert($3)){
  63063. $4=console;
  63064. $7=$self._basePath();
  63065. $ctx2.sendIdx["basePath"]=2;
  63066. $6="Warning: --base-path parameter ".__comma($7);
  63067. $ctx2.sendIdx[","]=2;
  63068. $5=$recv($6).__comma(" is not a directory.");
  63069. $ctx2.sendIdx[","]=1;
  63070. return $recv($4)._warn_($5);
  63071. $ctx2.sendIdx["warn:"]=1;
  63072. }
  63073. } else {
  63074. $8=console;
  63075. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63076. $ctx2.sendIdx[","]=3;
  63077. return $recv($8)._warn_($9);
  63078. }
  63079. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63080. }));
  63081. return self;
  63082. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63083. },
  63084. args: [],
  63085. 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.' ]].",
  63086. referencedClasses: [],
  63087. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63088. }),
  63089. $globals.FileServer);
  63090. $core.addMethod(
  63091. $core.method({
  63092. selector: "withBasePath:",
  63093. protocol: "private",
  63094. fn: function (aBaseRelativePath){
  63095. var self=this,$self=this;
  63096. return $core.withContext(function($ctx1) {
  63097. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63098. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63099. },
  63100. args: ["aBaseRelativePath"],
  63101. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63102. referencedClasses: [],
  63103. messageSends: ["join:with:", "basePath"]
  63104. }),
  63105. $globals.FileServer);
  63106. $core.addMethod(
  63107. $core.method({
  63108. selector: "writeData:toFileNamed:",
  63109. protocol: "private",
  63110. fn: function (data,aFilename){
  63111. var self=this,$self=this;
  63112. return $core.withContext(function($ctx1) {
  63113. $recv(console)._log_(aFilename);
  63114. return self;
  63115. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63116. },
  63117. args: ["data", "aFilename"],
  63118. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63119. referencedClasses: [],
  63120. messageSends: ["log:"]
  63121. }),
  63122. $globals.FileServer);
  63123. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63124. $core.addMethod(
  63125. $core.method({
  63126. selector: "commandLineSwitches",
  63127. protocol: "accessing",
  63128. fn: function (){
  63129. var self=this,$self=this;
  63130. var switches;
  63131. return $core.withContext(function($ctx1) {
  63132. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63133. return $core.withContext(function($ctx2) {
  63134. return $recv(each)._selector();
  63135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63136. }));
  63137. $ctx1.sendIdx["collect:"]=1;
  63138. switches=$recv(switches)._select_((function(each){
  63139. return $core.withContext(function($ctx2) {
  63140. return $recv(each)._match_("^[^:]*:$");
  63141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63142. }));
  63143. switches=$recv(switches)._collect_((function(each){
  63144. return $core.withContext(function($ctx2) {
  63145. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63146. $ctx2.sendIdx["replace:with:"]=1;
  63147. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63148. }));
  63149. return switches;
  63150. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63151. },
  63152. args: [],
  63153. 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",
  63154. referencedClasses: [],
  63155. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63156. }),
  63157. $globals.FileServer.a$cls);
  63158. $core.addMethod(
  63159. $core.method({
  63160. selector: "createServerWithArguments:",
  63161. protocol: "initialization",
  63162. fn: function (options){
  63163. var self=this,$self=this;
  63164. var server,popFront,front,optionName,optionValue,switches;
  63165. return $core.withContext(function($ctx1) {
  63166. var $1,$2,$3,$4,$5,$6,$7,$8;
  63167. var $early={};
  63168. try {
  63169. switches=$self._commandLineSwitches();
  63170. server=$self._new();
  63171. $recv(options)._ifEmpty_((function(){
  63172. throw $early=[server];
  63173. }));
  63174. $1=$recv($recv(options)._size())._even();
  63175. if(!$core.assert($1)){
  63176. $recv(console)._log_("Using default parameters.");
  63177. $ctx1.sendIdx["log:"]=1;
  63178. $2=console;
  63179. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63180. $ctx1.sendIdx[","]=1;
  63181. $recv($2)._log_($3);
  63182. $ctx1.sendIdx["log:"]=2;
  63183. $4=console;
  63184. $5="Use any of the following ones: ".__comma(switches);
  63185. $ctx1.sendIdx[","]=2;
  63186. $recv($4)._log_($5);
  63187. $ctx1.sendIdx["log:"]=3;
  63188. return server;
  63189. }
  63190. popFront=(function(args){
  63191. return $core.withContext(function($ctx2) {
  63192. front=$recv(args)._first();
  63193. $recv(args)._remove_(front);
  63194. return front;
  63195. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63196. });
  63197. $recv((function(){
  63198. return $core.withContext(function($ctx2) {
  63199. return $recv(options)._notEmpty();
  63200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63201. }))._whileTrue_((function(){
  63202. return $core.withContext(function($ctx2) {
  63203. optionName=$recv(popFront)._value_(options);
  63204. $ctx2.sendIdx["value:"]=1;
  63205. optionValue=$recv(popFront)._value_(options);
  63206. $6=$recv(switches)._includes_(optionName);
  63207. if($core.assert($6)){
  63208. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63209. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63210. } else {
  63211. $7=console;
  63212. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63213. $ctx2.sendIdx[","]=3;
  63214. $recv($7)._log_($8);
  63215. $ctx2.sendIdx["log:"]=4;
  63216. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63217. }
  63218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63219. }));
  63220. return server;
  63221. }
  63222. catch(e) {if(e===$early)return e[0]; throw e}
  63223. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63224. },
  63225. args: ["options"],
  63226. 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.",
  63227. referencedClasses: ["Array"],
  63228. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63229. }),
  63230. $globals.FileServer.a$cls);
  63231. $core.addMethod(
  63232. $core.method({
  63233. selector: "defaultBasePath",
  63234. protocol: "accessing",
  63235. fn: function (){
  63236. var self=this,$self=this;
  63237. return "./";
  63238. },
  63239. args: [],
  63240. source: "defaultBasePath\x0a\x09^ './'",
  63241. referencedClasses: [],
  63242. messageSends: []
  63243. }),
  63244. $globals.FileServer.a$cls);
  63245. $core.addMethod(
  63246. $core.method({
  63247. selector: "defaultHost",
  63248. protocol: "accessing",
  63249. fn: function (){
  63250. var self=this,$self=this;
  63251. return "127.0.0.1";
  63252. },
  63253. args: [],
  63254. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63255. referencedClasses: [],
  63256. messageSends: []
  63257. }),
  63258. $globals.FileServer.a$cls);
  63259. $core.addMethod(
  63260. $core.method({
  63261. selector: "defaultMimeTypes",
  63262. protocol: "accessing",
  63263. fn: function (){
  63264. var self=this,$self=this;
  63265. 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"]);
  63266. },
  63267. args: [],
  63268. 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}",
  63269. referencedClasses: [],
  63270. messageSends: []
  63271. }),
  63272. $globals.FileServer.a$cls);
  63273. $core.addMethod(
  63274. $core.method({
  63275. selector: "defaultPort",
  63276. protocol: "accessing",
  63277. fn: function (){
  63278. var self=this,$self=this;
  63279. return (4000);
  63280. },
  63281. args: [],
  63282. source: "defaultPort\x0a\x09^ 4000",
  63283. referencedClasses: [],
  63284. messageSends: []
  63285. }),
  63286. $globals.FileServer.a$cls);
  63287. $core.addMethod(
  63288. $core.method({
  63289. selector: "main",
  63290. protocol: "initialization",
  63291. fn: function (){
  63292. var self=this,$self=this;
  63293. var fileServer,args;
  63294. return $core.withContext(function($ctx1) {
  63295. var $1;
  63296. var $early={};
  63297. try {
  63298. args=$recv(process)._argv();
  63299. $recv(args)._removeFrom_to_((1),(3));
  63300. $recv(args)._detect_ifNone_((function(each){
  63301. return $core.withContext(function($ctx2) {
  63302. $1=$recv(each).__eq("--help");
  63303. if($core.assert($1)){
  63304. return $recv($globals.FileServer)._printHelp();
  63305. }
  63306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63307. }),(function(){
  63308. return $core.withContext(function($ctx2) {
  63309. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63310. throw $early=[$recv(fileServer)._start()];
  63311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63312. }));
  63313. return self;
  63314. }
  63315. catch(e) {if(e===$early)return e[0]; throw e}
  63316. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63317. },
  63318. args: [],
  63319. 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]",
  63320. referencedClasses: ["FileServer"],
  63321. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63322. }),
  63323. $globals.FileServer.a$cls);
  63324. $core.addMethod(
  63325. $core.method({
  63326. selector: "mimeTypeFor:",
  63327. protocol: "accessing",
  63328. fn: function (aString){
  63329. var self=this,$self=this;
  63330. return $core.withContext(function($ctx1) {
  63331. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63332. return "text/plain";
  63333. }));
  63334. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63335. },
  63336. args: ["aString"],
  63337. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63338. referencedClasses: [],
  63339. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63340. }),
  63341. $globals.FileServer.a$cls);
  63342. $core.addMethod(
  63343. $core.method({
  63344. selector: "mimeTypes",
  63345. protocol: "accessing",
  63346. fn: function (){
  63347. var self=this,$self=this;
  63348. return $core.withContext(function($ctx1) {
  63349. var $1,$receiver;
  63350. $1=$self["@mimeTypes"];
  63351. if(($receiver = $1) == null || $receiver.a$nil){
  63352. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63353. return $self["@mimeTypes"];
  63354. } else {
  63355. return $1;
  63356. }
  63357. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63358. },
  63359. args: [],
  63360. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63361. referencedClasses: [],
  63362. messageSends: ["ifNil:", "defaultMimeTypes"]
  63363. }),
  63364. $globals.FileServer.a$cls);
  63365. $core.addMethod(
  63366. $core.method({
  63367. selector: "printHelp",
  63368. protocol: "accessing",
  63369. fn: function (){
  63370. var self=this,$self=this;
  63371. return $core.withContext(function($ctx1) {
  63372. $recv(console)._log_("Available commandline options are:");
  63373. $ctx1.sendIdx["log:"]=1;
  63374. $recv(console)._log_("--help");
  63375. $ctx1.sendIdx["log:"]=2;
  63376. $recv($self._commandLineSwitches())._do_((function(each){
  63377. return $core.withContext(function($ctx2) {
  63378. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63380. }));
  63381. return self;
  63382. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63383. },
  63384. args: [],
  63385. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63386. referencedClasses: [],
  63387. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63388. }),
  63389. $globals.FileServer.a$cls);
  63390. $core.addMethod(
  63391. $core.method({
  63392. selector: "selectorForCommandLineSwitch:",
  63393. protocol: "accessing",
  63394. fn: function (aSwitch){
  63395. var self=this,$self=this;
  63396. return $core.withContext(function($ctx1) {
  63397. var $1;
  63398. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63399. return $core.withContext(function($ctx2) {
  63400. return $recv($recv(each)._second())._asUppercase();
  63401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63402. }));
  63403. $ctx1.sendIdx["replace:with:"]=1;
  63404. return $recv($1).__comma(":");
  63405. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63406. },
  63407. args: ["aSwitch"],
  63408. 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 ]), ':'",
  63409. referencedClasses: [],
  63410. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63411. }),
  63412. $globals.FileServer.a$cls);
  63413. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63414. $core.addMethod(
  63415. $core.method({
  63416. selector: "finishMessage",
  63417. protocol: "action",
  63418. fn: function (){
  63419. var self=this,$self=this;
  63420. return $core.withContext(function($ctx1) {
  63421. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63422. $recv((function(){
  63423. }))._valueWithTimeout_((600));
  63424. return self;
  63425. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63426. },
  63427. args: [],
  63428. 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",
  63429. referencedClasses: ["String"],
  63430. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63431. }),
  63432. $globals.Initer);
  63433. $core.addMethod(
  63434. $core.method({
  63435. selector: "gruntInitThenDo:",
  63436. protocol: "action",
  63437. fn: function (aBlock){
  63438. var self=this,$self=this;
  63439. var child,sanitizedTemplatePath;
  63440. return $core.withContext(function($ctx1) {
  63441. var $1,$3,$2;
  63442. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63443. $ctx1.sendIdx["replace:with:"]=1;
  63444. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63445. $1=child;
  63446. $recv($1)._on_do_("error",aBlock);
  63447. $ctx1.sendIdx["on:do:"]=1;
  63448. $recv($1)._on_do_("close",(function(code){
  63449. return $core.withContext(function($ctx2) {
  63450. $3=$recv(code).__eq((0));
  63451. if($core.assert($3)){
  63452. $2=nil;
  63453. } else {
  63454. $2=code;
  63455. }
  63456. return $recv(aBlock)._value_($2);
  63457. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63458. }));
  63459. return self;
  63460. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63461. },
  63462. args: ["aBlock"],
  63463. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63464. referencedClasses: [],
  63465. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63466. }),
  63467. $globals.Initer);
  63468. $core.addMethod(
  63469. $core.method({
  63470. selector: "initProjectThenDo:",
  63471. protocol: "action",
  63472. fn: function (aBlock){
  63473. var self=this,$self=this;
  63474. var child;
  63475. return $core.withContext(function($ctx1) {
  63476. var $1;
  63477. child=$recv($self["@childProcess"])._exec_thenDo_("npm run init",aBlock);
  63478. $1=$recv(child)._stdout();
  63479. $ctx1.sendIdx["stdout"]=1;
  63480. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63481. return self;
  63482. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63483. },
  63484. args: ["aBlock"],
  63485. source: "initProjectThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm run init'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  63486. referencedClasses: [],
  63487. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63488. }),
  63489. $globals.Initer);
  63490. $core.addMethod(
  63491. $core.method({
  63492. selector: "initialize",
  63493. protocol: "initialization",
  63494. fn: function (){
  63495. var self=this,$self=this;
  63496. return $core.withContext(function($ctx1) {
  63497. (
  63498. $ctx1.supercall = true,
  63499. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63500. $ctx1.supercall = false;
  63501. $self["@childProcess"]=$recv(require)._value_("child_process");
  63502. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63503. return self;
  63504. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63505. },
  63506. args: [],
  63507. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63508. referencedClasses: [],
  63509. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63510. }),
  63511. $globals.Initer);
  63512. $core.addMethod(
  63513. $core.method({
  63514. selector: "npmScriptForModule:named:",
  63515. protocol: "npm",
  63516. fn: function (aString,anotherString){
  63517. var self=this,$self=this;
  63518. var modulePath,packageJson,binSection,scriptPath;
  63519. return $core.withContext(function($ctx1) {
  63520. var $1,$3,$4,$2,$5;
  63521. $1=$self["@path"];
  63522. $3=$recv(require)._provided();
  63523. $4=$recv(aString).__comma("/package.json");
  63524. $ctx1.sendIdx[","]=1;
  63525. $2=$recv($3)._resolve_($4);
  63526. modulePath=$recv($1)._dirname_($2);
  63527. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63528. binSection=$recv(packageJson)._at_("bin");
  63529. $ctx1.sendIdx["at:"]=1;
  63530. $5=$recv(binSection)._isString();
  63531. if($core.assert($5)){
  63532. scriptPath=binSection;
  63533. } else {
  63534. scriptPath=$recv(binSection)._at_(anotherString);
  63535. }
  63536. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63537. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63538. },
  63539. args: ["aString", "anotherString"],
  63540. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63541. referencedClasses: ["Smalltalk"],
  63542. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63543. }),
  63544. $globals.Initer);
  63545. $core.addMethod(
  63546. $core.method({
  63547. selector: "start",
  63548. protocol: "action",
  63549. fn: function (){
  63550. var self=this,$self=this;
  63551. return $core.withContext(function($ctx1) {
  63552. var $1,$2,$3,$receiver;
  63553. $self._gruntInitThenDo_((function(error){
  63554. return $core.withContext(function($ctx2) {
  63555. if(($receiver = error) == null || $receiver.a$nil){
  63556. return $self._initProjectThenDo_((function(error2){
  63557. return $core.withContext(function($ctx3) {
  63558. if(($receiver = error2) == null || $receiver.a$nil){
  63559. $self._finishMessage();
  63560. return $recv(process)._exit();
  63561. } else {
  63562. $3=console;
  63563. $recv($3)._log_("npm run init exec error:");
  63564. $ctx3.sendIdx["log:"]=3;
  63565. $recv($3)._log_(error2);
  63566. return $recv(process)._exit_((105));
  63567. }
  63568. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63569. }));
  63570. } else {
  63571. $1=console;
  63572. $recv($1)._log_("grunt-init exec error:");
  63573. $ctx2.sendIdx["log:"]=1;
  63574. $2=$recv($1)._log_(error);
  63575. $ctx2.sendIdx["log:"]=2;
  63576. return $recv(process)._exit_((101));
  63577. $ctx2.sendIdx["exit:"]=1;
  63578. }
  63579. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63580. }));
  63581. return self;
  63582. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63583. },
  63584. args: [],
  63585. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self initProjectThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm run init exec error:'; log: error2.\x0a\x09\x09process exit: 105 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]",
  63586. referencedClasses: [],
  63587. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  63588. }),
  63589. $globals.Initer);
  63590. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63591. $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.";
  63592. $core.addMethod(
  63593. $core.method({
  63594. selector: "addVariableNamed:to:",
  63595. protocol: "private",
  63596. fn: function (aString,anObject){
  63597. var self=this,$self=this;
  63598. var newClass,newObject;
  63599. return $core.withContext(function($ctx1) {
  63600. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63601. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63602. newObject=$recv(newClass)._new();
  63603. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63604. return newObject;
  63605. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63606. },
  63607. args: ["aString", "anObject"],
  63608. 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",
  63609. referencedClasses: [],
  63610. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63611. }),
  63612. $globals.Repl);
  63613. $core.addMethod(
  63614. $core.method({
  63615. selector: "assignNewVariable:do:",
  63616. protocol: "private",
  63617. fn: function (buffer,aBlock){
  63618. var self=this,$self=this;
  63619. return $core.withContext(function($ctx1) {
  63620. var $2,$3,$1,$receiver;
  63621. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63622. var varName,value;
  63623. return $core.withContext(function($ctx2) {
  63624. if(($receiver = name) == null || $receiver.a$nil){
  63625. varName=$self._nextResultName();
  63626. } else {
  63627. varName=name;
  63628. }
  63629. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63630. $recv((function(){
  63631. return $core.withContext(function($ctx3) {
  63632. $2=$recv(varName).__comma(" := ");
  63633. if(($receiver = expr) == null || $receiver.a$nil){
  63634. $3=buffer;
  63635. } else {
  63636. $3=expr;
  63637. }
  63638. $1=$recv($2).__comma($3);
  63639. $ctx3.sendIdx[","]=1;
  63640. value=$self._eval_on_($1,$self["@session"]);
  63641. return value;
  63642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63643. }))._on_do_($globals.Error,(function(e){
  63644. return $core.withContext(function($ctx3) {
  63645. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63646. value=nil;
  63647. return value;
  63648. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63649. }));
  63650. return $recv(aBlock)._value_value_(varName,value);
  63651. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63652. }));
  63653. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63654. },
  63655. args: ["buffer", "aBlock"],
  63656. 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]",
  63657. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63658. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63659. }),
  63660. $globals.Repl);
  63661. $core.addMethod(
  63662. $core.method({
  63663. selector: "clearScreen",
  63664. protocol: "actions",
  63665. fn: function (){
  63666. var self=this,$self=this;
  63667. var esc,cls;
  63668. return $core.withContext(function($ctx1) {
  63669. var $1;
  63670. esc=$recv($globals.String)._fromCharCode_((27));
  63671. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63672. $ctx1.sendIdx[","]=2;
  63673. cls=$recv($1).__comma("[0;0f");
  63674. $ctx1.sendIdx[","]=1;
  63675. $recv($recv(process)._stdout())._write_(cls);
  63676. $recv($self["@interface"])._prompt();
  63677. return self;
  63678. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63679. },
  63680. args: [],
  63681. 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",
  63682. referencedClasses: ["String"],
  63683. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63684. }),
  63685. $globals.Repl);
  63686. $core.addMethod(
  63687. $core.method({
  63688. selector: "close",
  63689. protocol: "actions",
  63690. fn: function (){
  63691. var self=this,$self=this;
  63692. return $core.withContext(function($ctx1) {
  63693. $recv($recv(process)._stdin())._destroy();
  63694. return self;
  63695. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63696. },
  63697. args: [],
  63698. source: "close\x0a\x09process stdin destroy",
  63699. referencedClasses: [],
  63700. messageSends: ["destroy", "stdin"]
  63701. }),
  63702. $globals.Repl);
  63703. $core.addMethod(
  63704. $core.method({
  63705. selector: "commands",
  63706. protocol: "accessing",
  63707. fn: function (){
  63708. var self=this,$self=this;
  63709. return $self["@commands"];
  63710. },
  63711. args: [],
  63712. source: "commands\x0a\x09^ commands",
  63713. referencedClasses: [],
  63714. messageSends: []
  63715. }),
  63716. $globals.Repl);
  63717. $core.addMethod(
  63718. $core.method({
  63719. selector: "createInterface",
  63720. protocol: "actions",
  63721. fn: function (){
  63722. var self=this,$self=this;
  63723. return $core.withContext(function($ctx1) {
  63724. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63725. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63726. return $core.withContext(function($ctx2) {
  63727. return $self._processLine_(buffer);
  63728. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63729. }));
  63730. $ctx1.sendIdx["on:do:"]=1;
  63731. $recv($self["@interface"])._on_do_("close",(function(){
  63732. return $core.withContext(function($ctx2) {
  63733. return $self._close();
  63734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63735. }));
  63736. $self._printWelcome();
  63737. $self._setupHotkeys();
  63738. $self._setPrompt();
  63739. $recv($self["@interface"])._prompt();
  63740. return self;
  63741. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63742. },
  63743. args: [],
  63744. 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",
  63745. referencedClasses: [],
  63746. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63747. }),
  63748. $globals.Repl);
  63749. $core.addMethod(
  63750. $core.method({
  63751. selector: "encapsulateVariable:withValue:in:",
  63752. protocol: "private",
  63753. fn: function (aString,anObject,aClass){
  63754. var self=this,$self=this;
  63755. var compiler;
  63756. return $core.withContext(function($ctx1) {
  63757. var $1,$4,$3,$2,$5,$6;
  63758. compiler=$recv($globals.Compiler)._new();
  63759. $1=compiler;
  63760. $4=$recv(aString).__comma(": anObject ^ ");
  63761. $ctx1.sendIdx[","]=3;
  63762. $3=$recv($4).__comma(aString);
  63763. $ctx1.sendIdx[","]=2;
  63764. $2=$recv($3).__comma(" := anObject");
  63765. $ctx1.sendIdx[","]=1;
  63766. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63767. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63768. $5=compiler;
  63769. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63770. $ctx1.sendIdx[","]=4;
  63771. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63772. return self;
  63773. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63774. },
  63775. args: ["aString", "anObject", "aClass"],
  63776. 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'.",
  63777. referencedClasses: ["Compiler"],
  63778. messageSends: ["new", "install:forClass:protocol:", ","]
  63779. }),
  63780. $globals.Repl);
  63781. $core.addMethod(
  63782. $core.method({
  63783. selector: "eval:",
  63784. protocol: "actions",
  63785. fn: function (buffer){
  63786. var self=this,$self=this;
  63787. return $core.withContext(function($ctx1) {
  63788. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63789. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63790. },
  63791. args: ["buffer"],
  63792. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63793. referencedClasses: ["DoIt"],
  63794. messageSends: ["eval:on:", "new"]
  63795. }),
  63796. $globals.Repl);
  63797. $core.addMethod(
  63798. $core.method({
  63799. selector: "eval:on:",
  63800. protocol: "actions",
  63801. fn: function (buffer,anObject){
  63802. var self=this,$self=this;
  63803. var result;
  63804. return $core.withContext(function($ctx1) {
  63805. var $1;
  63806. $recv(buffer)._ifNotEmpty_((function(){
  63807. return $core.withContext(function($ctx2) {
  63808. return $recv((function(){
  63809. return $core.withContext(function($ctx3) {
  63810. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63811. return result;
  63812. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63813. }))._tryCatch_((function(e){
  63814. return $core.withContext(function($ctx3) {
  63815. $1=$recv(e)._isSmalltalkError();
  63816. if($core.assert($1)){
  63817. return $recv(e)._pass();
  63818. } else {
  63819. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63820. }
  63821. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63822. }));
  63823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63824. }));
  63825. return result;
  63826. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63827. },
  63828. args: ["buffer", "anObject"],
  63829. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63830. referencedClasses: ["Compiler"],
  63831. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63832. }),
  63833. $globals.Repl);
  63834. $core.addMethod(
  63835. $core.method({
  63836. selector: "executeCommand:",
  63837. protocol: "private",
  63838. fn: function (aString){
  63839. var self=this,$self=this;
  63840. return $core.withContext(function($ctx1) {
  63841. var $1;
  63842. var $early={};
  63843. try {
  63844. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63845. return $core.withContext(function($ctx2) {
  63846. $1=$recv(names)._includes_(aString);
  63847. if($core.assert($1)){
  63848. $recv(cmd)._value();
  63849. throw $early=[true];
  63850. }
  63851. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63852. }));
  63853. return false;
  63854. }
  63855. catch(e) {if(e===$early)return e[0]; throw e}
  63856. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63857. },
  63858. args: ["aString"],
  63859. 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",
  63860. referencedClasses: [],
  63861. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63862. }),
  63863. $globals.Repl);
  63864. $core.addMethod(
  63865. $core.method({
  63866. selector: "initialize",
  63867. protocol: "initialization",
  63868. fn: function (){
  63869. var self=this,$self=this;
  63870. return $core.withContext(function($ctx1) {
  63871. (
  63872. $ctx1.supercall = true,
  63873. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63874. $ctx1.supercall = false;
  63875. $self["@session"]=$recv($globals.DoIt)._new();
  63876. $self["@readline"]=$recv(require)._value_("readline");
  63877. $ctx1.sendIdx["value:"]=1;
  63878. $self["@util"]=$recv(require)._value_("util");
  63879. $self._setupCommands();
  63880. return self;
  63881. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63882. },
  63883. args: [],
  63884. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63885. referencedClasses: ["DoIt"],
  63886. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63887. }),
  63888. $globals.Repl);
  63889. $core.addMethod(
  63890. $core.method({
  63891. selector: "instanceVariableNamesFor:",
  63892. protocol: "private",
  63893. fn: function (aClass){
  63894. var self=this,$self=this;
  63895. return $core.withContext(function($ctx1) {
  63896. var $1,$2,$receiver;
  63897. $1=$recv(aClass)._superclass();
  63898. $ctx1.sendIdx["superclass"]=1;
  63899. if(($receiver = $1) == null || $receiver.a$nil){
  63900. return $recv(aClass)._instanceVariableNames();
  63901. } else {
  63902. $2=$recv(aClass)._instanceVariableNames();
  63903. $ctx1.sendIdx["instanceVariableNames"]=1;
  63904. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63905. }
  63906. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63907. },
  63908. args: ["aClass"],
  63909. 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]",
  63910. referencedClasses: [],
  63911. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63912. }),
  63913. $globals.Repl);
  63914. $core.addMethod(
  63915. $core.method({
  63916. selector: "isIdentifier:",
  63917. protocol: "private",
  63918. fn: function (aString){
  63919. var self=this,$self=this;
  63920. return $core.withContext(function($ctx1) {
  63921. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63922. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63923. },
  63924. args: ["aString"],
  63925. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63926. referencedClasses: [],
  63927. messageSends: ["match:", "asRegexp"]
  63928. }),
  63929. $globals.Repl);
  63930. $core.addMethod(
  63931. $core.method({
  63932. selector: "isVariableDefined:",
  63933. protocol: "private",
  63934. fn: function (aString){
  63935. var self=this,$self=this;
  63936. return $core.withContext(function($ctx1) {
  63937. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63938. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63939. },
  63940. args: ["aString"],
  63941. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63942. referencedClasses: [],
  63943. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63944. }),
  63945. $globals.Repl);
  63946. $core.addMethod(
  63947. $core.method({
  63948. selector: "nextResultName",
  63949. protocol: "private",
  63950. fn: function (){
  63951. var self=this,$self=this;
  63952. return $core.withContext(function($ctx1) {
  63953. var $1,$receiver;
  63954. $1=$self["@resultCount"];
  63955. if(($receiver = $1) == null || $receiver.a$nil){
  63956. $self["@resultCount"]=(1);
  63957. } else {
  63958. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63959. }
  63960. return "res".__comma($recv($self["@resultCount"])._asString());
  63961. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63962. },
  63963. args: [],
  63964. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63965. referencedClasses: [],
  63966. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63967. }),
  63968. $globals.Repl);
  63969. $core.addMethod(
  63970. $core.method({
  63971. selector: "onKeyPress:",
  63972. protocol: "private",
  63973. fn: function (key){
  63974. var self=this,$self=this;
  63975. return $core.withContext(function($ctx1) {
  63976. var $1;
  63977. $1=$recv($recv(key)._ctrl())._and_((function(){
  63978. return $core.withContext(function($ctx2) {
  63979. return $recv($recv(key)._name()).__eq("l");
  63980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63981. }));
  63982. if($core.assert($1)){
  63983. $self._clearScreen();
  63984. }
  63985. return self;
  63986. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63987. },
  63988. args: ["key"],
  63989. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63990. referencedClasses: [],
  63991. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63992. }),
  63993. $globals.Repl);
  63994. $core.addMethod(
  63995. $core.method({
  63996. selector: "parseAssignment:do:",
  63997. protocol: "private",
  63998. fn: function (aString,aBlock){
  63999. var self=this,$self=this;
  64000. var assignment;
  64001. return $core.withContext(function($ctx1) {
  64002. var $2,$1;
  64003. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64004. return $core.withContext(function($ctx2) {
  64005. return $recv(s)._trimBoth();
  64006. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64007. }));
  64008. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64009. return $core.withContext(function($ctx2) {
  64010. $2=$recv(assignment)._first();
  64011. $ctx2.sendIdx["first"]=1;
  64012. return $self._isIdentifier_($2);
  64013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64014. }));
  64015. if($core.assert($1)){
  64016. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64017. $ctx1.sendIdx["value:value:"]=1;
  64018. } else {
  64019. return $recv(aBlock)._value_value_(nil,nil);
  64020. }
  64021. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64022. },
  64023. args: ["aString", "aBlock"],
  64024. 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 ]",
  64025. referencedClasses: [],
  64026. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64027. }),
  64028. $globals.Repl);
  64029. $core.addMethod(
  64030. $core.method({
  64031. selector: "presentResultNamed:withValue:",
  64032. protocol: "private",
  64033. fn: function (varName,value){
  64034. var self=this,$self=this;
  64035. return $core.withContext(function($ctx1) {
  64036. var $3,$2,$1;
  64037. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64038. $ctx1.sendIdx[","]=3;
  64039. $2=$recv($3).__comma(" = ");
  64040. $ctx1.sendIdx[","]=2;
  64041. $1=$recv($2).__comma($recv(value)._asString());
  64042. $ctx1.sendIdx[","]=1;
  64043. $recv($globals.Transcript)._show_($1);
  64044. $recv($globals.Transcript)._cr();
  64045. $recv($self["@interface"])._prompt();
  64046. return self;
  64047. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64048. },
  64049. args: ["varName", "value"],
  64050. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64051. referencedClasses: ["Transcript"],
  64052. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64053. }),
  64054. $globals.Repl);
  64055. $core.addMethod(
  64056. $core.method({
  64057. selector: "printWelcome",
  64058. protocol: "actions",
  64059. fn: function (){
  64060. var self=this,$self=this;
  64061. return $core.withContext(function($ctx1) {
  64062. $recv($globals.Transcript)._show_("Type :q to exit.");
  64063. $recv($globals.Transcript)._cr();
  64064. return self;
  64065. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64066. },
  64067. args: [],
  64068. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64069. referencedClasses: ["Transcript"],
  64070. messageSends: ["show:", "cr"]
  64071. }),
  64072. $globals.Repl);
  64073. $core.addMethod(
  64074. $core.method({
  64075. selector: "processLine:",
  64076. protocol: "private",
  64077. fn: function (buffer){
  64078. var self=this,$self=this;
  64079. var show;
  64080. return $core.withContext(function($ctx1) {
  64081. var $1,$2;
  64082. show=(function(varName,value){
  64083. return $core.withContext(function($ctx2) {
  64084. return $self._presentResultNamed_withValue_(varName,value);
  64085. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64086. });
  64087. $1=$self._executeCommand_(buffer);
  64088. if(!$core.assert($1)){
  64089. $2=$self._isVariableDefined_(buffer);
  64090. if($core.assert($2)){
  64091. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64092. } else {
  64093. $self._assignNewVariable_do_(buffer,show);
  64094. }
  64095. }
  64096. return self;
  64097. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64098. },
  64099. args: ["buffer"],
  64100. 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]]",
  64101. referencedClasses: [],
  64102. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64103. }),
  64104. $globals.Repl);
  64105. $core.addMethod(
  64106. $core.method({
  64107. selector: "prompt",
  64108. protocol: "accessing",
  64109. fn: function (){
  64110. var self=this,$self=this;
  64111. return "amber >> ";
  64112. },
  64113. args: [],
  64114. source: "prompt\x0a\x09^ 'amber >> '",
  64115. referencedClasses: [],
  64116. messageSends: []
  64117. }),
  64118. $globals.Repl);
  64119. $core.addMethod(
  64120. $core.method({
  64121. selector: "setPreviousVariablesFor:from:",
  64122. protocol: "private",
  64123. fn: function (newObject,oldObject){
  64124. var self=this,$self=this;
  64125. return $core.withContext(function($ctx1) {
  64126. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64127. return $core.withContext(function($ctx2) {
  64128. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64130. }));
  64131. return self;
  64132. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64133. },
  64134. args: ["newObject", "oldObject"],
  64135. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64136. referencedClasses: [],
  64137. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64138. }),
  64139. $globals.Repl);
  64140. $core.addMethod(
  64141. $core.method({
  64142. selector: "setPrompt",
  64143. protocol: "actions",
  64144. fn: function (){
  64145. var self=this,$self=this;
  64146. return $core.withContext(function($ctx1) {
  64147. $recv($self["@interface"])._setPrompt_($self._prompt());
  64148. return self;
  64149. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64150. },
  64151. args: [],
  64152. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64153. referencedClasses: [],
  64154. messageSends: ["setPrompt:", "prompt"]
  64155. }),
  64156. $globals.Repl);
  64157. $core.addMethod(
  64158. $core.method({
  64159. selector: "setupCommands",
  64160. protocol: "initialization",
  64161. fn: function (){
  64162. var self=this,$self=this;
  64163. return $core.withContext(function($ctx1) {
  64164. var $2,$1;
  64165. $2=$recv([":q"]).__minus_gt((function(){
  64166. return $core.withContext(function($ctx2) {
  64167. return $recv(process)._exit();
  64168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64169. }));
  64170. $ctx1.sendIdx["->"]=1;
  64171. $1=[$2,$recv([""]).__minus_gt((function(){
  64172. return $core.withContext(function($ctx2) {
  64173. return $recv($self["@interface"])._prompt();
  64174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64175. }))];
  64176. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64177. return self;
  64178. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64179. },
  64180. args: [],
  64181. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64182. referencedClasses: ["Dictionary"],
  64183. messageSends: ["from:", "->", "exit", "prompt"]
  64184. }),
  64185. $globals.Repl);
  64186. $core.addMethod(
  64187. $core.method({
  64188. selector: "setupHotkeys",
  64189. protocol: "initialization",
  64190. fn: function (){
  64191. var self=this,$self=this;
  64192. return $core.withContext(function($ctx1) {
  64193. var $receiver;
  64194. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64195. return $core.withContext(function($ctx2) {
  64196. if(($receiver = key) == null || $receiver.a$nil){
  64197. return key;
  64198. } else {
  64199. return $self._onKeyPress_(key);
  64200. }
  64201. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64202. }));
  64203. return self;
  64204. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64205. },
  64206. args: [],
  64207. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64208. referencedClasses: [],
  64209. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64210. }),
  64211. $globals.Repl);
  64212. $core.addMethod(
  64213. $core.method({
  64214. selector: "subclass:withVariable:",
  64215. protocol: "private",
  64216. fn: function (aClass,varName){
  64217. var self=this,$self=this;
  64218. return $core.withContext(function($ctx1) {
  64219. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64220. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64221. },
  64222. args: ["aClass", "varName"],
  64223. 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'",
  64224. referencedClasses: ["ClassBuilder"],
  64225. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64226. }),
  64227. $globals.Repl);
  64228. $core.addMethod(
  64229. $core.method({
  64230. selector: "subclassNameFor:",
  64231. protocol: "private",
  64232. fn: function (aClass){
  64233. var self=this,$self=this;
  64234. return $core.withContext(function($ctx1) {
  64235. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64236. $2=$recv(aClass)._name();
  64237. $ctx1.sendIdx["name"]=1;
  64238. $1=$recv($2)._matchesOf_("\x5cd+$");
  64239. $ctx1.sendIdx["matchesOf:"]=1;
  64240. if(($receiver = $1) == null || $receiver.a$nil){
  64241. return $recv($recv(aClass)._name()).__comma("2");
  64242. } else {
  64243. var counter;
  64244. $6=$recv(aClass)._name();
  64245. $ctx1.sendIdx["name"]=2;
  64246. $5=$recv($6)._matchesOf_("\x5cd+$");
  64247. $4=$recv($5)._first();
  64248. $3=$recv($4)._asNumber();
  64249. counter=$recv($3).__plus((1));
  64250. $7=$recv(aClass)._name();
  64251. $ctx1.sendIdx["name"]=3;
  64252. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64253. }
  64254. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64255. },
  64256. args: ["aClass"],
  64257. 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'].",
  64258. referencedClasses: [],
  64259. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64260. }),
  64261. $globals.Repl);
  64262. $core.addMethod(
  64263. $core.method({
  64264. selector: "main",
  64265. protocol: "initialization",
  64266. fn: function (){
  64267. var self=this,$self=this;
  64268. return $core.withContext(function($ctx1) {
  64269. $recv($self._new())._createInterface();
  64270. return self;
  64271. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64272. },
  64273. args: [],
  64274. source: "main\x0a\x09self new createInterface",
  64275. referencedClasses: [],
  64276. messageSends: ["createInterface", "new"]
  64277. }),
  64278. $globals.Repl.a$cls);
  64279. });
  64280. (function () {
  64281. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64282. amber.initialize().then(function () {
  64283. amber.globals.AmberCli._main();
  64284. });
  64285. });
  64286. }());
  64287. require(["app"]);
  64288. });
  64289. define.require('__wrap__');
  64290. }((function amdefine(module, requireFn) {
  64291. 'use strict';
  64292. var defineCache = {},
  64293. loaderCache = {},
  64294. alreadyCalled = false,
  64295. path = require('path'),
  64296. makeRequire, stringRequire;
  64297. /**
  64298. * Trims the . and .. from an array of path segments.
  64299. * It will keep a leading path segment if a .. will become
  64300. * the first path segment, to help with module name lookups,
  64301. * which act like paths, but can be remapped. But the end result,
  64302. * all paths that use this function should look normalized.
  64303. * NOTE: this method MODIFIES the input array.
  64304. * @param {Array} ary the array of path segments.
  64305. */
  64306. function trimDots(ary) {
  64307. var i, part;
  64308. for (i = 0; ary[i]; i+= 1) {
  64309. part = ary[i];
  64310. if (part === '.') {
  64311. ary.splice(i, 1);
  64312. i -= 1;
  64313. } else if (part === '..') {
  64314. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64315. //End of the line. Keep at least one non-dot
  64316. //path segment at the front so it can be mapped
  64317. //correctly to disk. Otherwise, there is likely
  64318. //no path mapping for a path starting with '..'.
  64319. //This can still fail, but catches the most reasonable
  64320. //uses of ..
  64321. break;
  64322. } else if (i > 0) {
  64323. ary.splice(i - 1, 2);
  64324. i -= 2;
  64325. }
  64326. }
  64327. }
  64328. }
  64329. function normalize(name, baseName) {
  64330. var baseParts;
  64331. //Adjust any relative paths.
  64332. if (name && name.charAt(0) === '.') {
  64333. //If have a base name, try to normalize against it,
  64334. //otherwise, assume it is a top-level require that will
  64335. //be relative to baseUrl in the end.
  64336. if (baseName) {
  64337. baseParts = baseName.split('/');
  64338. baseParts = baseParts.slice(0, baseParts.length - 1);
  64339. baseParts = baseParts.concat(name.split('/'));
  64340. trimDots(baseParts);
  64341. name = baseParts.join('/');
  64342. }
  64343. }
  64344. return name;
  64345. }
  64346. /**
  64347. * Create the normalize() function passed to a loader plugin's
  64348. * normalize method.
  64349. */
  64350. function makeNormalize(relName) {
  64351. return function (name) {
  64352. return normalize(name, relName);
  64353. };
  64354. }
  64355. function makeLoad(id) {
  64356. function load(value) {
  64357. loaderCache[id] = value;
  64358. }
  64359. load.fromText = function (id, text) {
  64360. //This one is difficult because the text can/probably uses
  64361. //define, and any relative paths and requires should be relative
  64362. //to that id was it would be found on disk. But this would require
  64363. //bootstrapping a module/require fairly deeply from node core.
  64364. //Not sure how best to go about that yet.
  64365. throw new Error('amdefine does not implement load.fromText');
  64366. };
  64367. return load;
  64368. }
  64369. makeRequire = function (systemRequire, exports, module, relId) {
  64370. function amdRequire(deps, callback) {
  64371. if (typeof deps === 'string') {
  64372. //Synchronous, single module require('')
  64373. return stringRequire(systemRequire, exports, module, deps, relId);
  64374. } else {
  64375. //Array of dependencies with a callback.
  64376. //Convert the dependencies to modules.
  64377. deps = deps.map(function (depName) {
  64378. return stringRequire(systemRequire, exports, module, depName, relId);
  64379. });
  64380. //Wait for next tick to call back the require call.
  64381. if (callback) {
  64382. process.nextTick(function () {
  64383. callback.apply(null, deps);
  64384. });
  64385. }
  64386. }
  64387. }
  64388. amdRequire.toUrl = function (filePath) {
  64389. if (filePath.indexOf('.') === 0) {
  64390. return normalize(filePath, path.dirname(module.filename));
  64391. } else {
  64392. return filePath;
  64393. }
  64394. };
  64395. return amdRequire;
  64396. };
  64397. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64398. requireFn = requireFn || function req() {
  64399. return module.require.apply(module, arguments);
  64400. };
  64401. function runFactory(id, deps, factory) {
  64402. var r, e, m, result;
  64403. if (id) {
  64404. e = loaderCache[id] = {};
  64405. m = {
  64406. id: id,
  64407. uri: __filename,
  64408. exports: e
  64409. };
  64410. r = makeRequire(requireFn, e, m, id);
  64411. } else {
  64412. //Only support one define call per file
  64413. if (alreadyCalled) {
  64414. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64415. }
  64416. alreadyCalled = true;
  64417. //Use the real variables from node
  64418. //Use module.exports for exports, since
  64419. //the exports in here is amdefine exports.
  64420. e = module.exports;
  64421. m = module;
  64422. r = makeRequire(requireFn, e, m, module.id);
  64423. }
  64424. //If there are dependencies, they are strings, so need
  64425. //to convert them to dependency values.
  64426. if (deps) {
  64427. deps = deps.map(function (depName) {
  64428. return r(depName);
  64429. });
  64430. }
  64431. //Call the factory with the right dependencies.
  64432. if (typeof factory === 'function') {
  64433. result = factory.apply(m.exports, deps);
  64434. } else {
  64435. result = factory;
  64436. }
  64437. if (result !== undefined) {
  64438. m.exports = result;
  64439. if (id) {
  64440. loaderCache[id] = m.exports;
  64441. }
  64442. }
  64443. }
  64444. stringRequire = function (systemRequire, exports, module, id, relId) {
  64445. //Split the ID by a ! so that
  64446. var index = id.indexOf('!'),
  64447. originalId = id,
  64448. prefix, plugin;
  64449. if (index === -1) {
  64450. id = normalize(id, relId);
  64451. //Straight module lookup. If it is one of the special dependencies,
  64452. //deal with it, otherwise, delegate to node.
  64453. if (id === 'require') {
  64454. return makeRequire(systemRequire, exports, module, relId);
  64455. } else if (id === 'exports') {
  64456. return exports;
  64457. } else if (id === 'module') {
  64458. return module;
  64459. } else if (loaderCache.hasOwnProperty(id)) {
  64460. return loaderCache[id];
  64461. } else if (defineCache[id]) {
  64462. runFactory.apply(null, defineCache[id]);
  64463. return loaderCache[id];
  64464. } else {
  64465. if(systemRequire) {
  64466. return systemRequire(originalId);
  64467. } else {
  64468. throw new Error('No module with ID: ' + id);
  64469. }
  64470. }
  64471. } else {
  64472. //There is a plugin in play.
  64473. prefix = id.substring(0, index);
  64474. id = id.substring(index + 1, id.length);
  64475. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64476. if (plugin.normalize) {
  64477. id = plugin.normalize(id, makeNormalize(relId));
  64478. } else {
  64479. //Normalize the ID normally.
  64480. id = normalize(id, relId);
  64481. }
  64482. if (loaderCache[id]) {
  64483. return loaderCache[id];
  64484. } else {
  64485. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64486. return loaderCache[id];
  64487. }
  64488. }
  64489. };
  64490. //Create a define function specific to the module asking for amdefine.
  64491. function define(id, deps, factory) {
  64492. if (Array.isArray(id)) {
  64493. factory = deps;
  64494. deps = id;
  64495. id = undefined;
  64496. } else if (typeof id !== 'string') {
  64497. factory = id;
  64498. id = deps = undefined;
  64499. }
  64500. if (deps && !Array.isArray(deps)) {
  64501. factory = deps;
  64502. deps = undefined;
  64503. }
  64504. if (!deps) {
  64505. deps = ['require', 'exports', 'module'];
  64506. }
  64507. //Set up properties for this module. If an ID, then use
  64508. //internal cache. If no ID, then use the external variables
  64509. //for this node module.
  64510. if (id) {
  64511. //Put the module in deep freeze until there is a
  64512. //require call for it.
  64513. defineCache[id] = [id, deps, factory];
  64514. } else {
  64515. runFactory(id, deps, factory);
  64516. }
  64517. }
  64518. //define.require, which has access to all the values in the
  64519. //cache. Useful for AMD modules that all have IDs in the file,
  64520. //but need to finally export a value to node based on one of those
  64521. //IDs.
  64522. define.require = function (id) {
  64523. if (loaderCache[id]) {
  64524. return loaderCache[id];
  64525. }
  64526. if (defineCache[id]) {
  64527. runFactory.apply(null, defineCache[id]);
  64528. return loaderCache[id];
  64529. }
  64530. };
  64531. define.amd = {};
  64532. return define;
  64533. }(module)), require));