amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define(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.6+9869a4bc
  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. if (isFunction(callback)) {
  949. return promise.then(function (value) {
  950. return constructor.resolve(callback()).then(function () {
  951. return value;
  952. });
  953. }, function (reason) {
  954. return constructor.resolve(callback()).then(function () {
  955. throw reason;
  956. });
  957. });
  958. }
  959. return promise.then(callback, callback);
  960. };
  961. return Promise;
  962. }();
  963. Promise$1.prototype.then = then;
  964. Promise$1.all = all;
  965. Promise$1.race = race;
  966. Promise$1.resolve = resolve$1;
  967. Promise$1.reject = reject$1;
  968. Promise$1._setScheduler = setScheduler;
  969. Promise$1._setAsap = setAsap;
  970. Promise$1._asap = asap;
  971. /*global self*/
  972. function polyfill() {
  973. var local = void 0;
  974. if (typeof global !== 'undefined') {
  975. local = global;
  976. } else if (typeof self !== 'undefined') {
  977. local = self;
  978. } else {
  979. try {
  980. local = Function('return this')();
  981. } catch (e) {
  982. throw new Error('polyfill failed because global object is unavailable in this environment');
  983. }
  984. }
  985. var P = local.Promise;
  986. if (P) {
  987. var promiseToString = null;
  988. try {
  989. promiseToString = Object.prototype.toString.call(P.resolve());
  990. } catch (e) {
  991. // silently ignored
  992. }
  993. if (promiseToString === '[object Promise]' && !P.cast) {
  994. return;
  995. }
  996. }
  997. local.Promise = Promise$1;
  998. }
  999. // Strange compat..
  1000. Promise$1.polyfill = polyfill;
  1001. Promise$1.Promise = Promise$1;
  1002. return Promise$1;
  1003. })));
  1004. //# sourceMappingURL=es6-promise.map
  1005. ;
  1006. //jshint eqnull:true
  1007. define('amber/kernel-checks',[],function () {
  1008. "use strict";
  1009. function assert (fn) {
  1010. try {
  1011. if (fn()) return;
  1012. } catch (ex) {
  1013. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1014. }
  1015. throw new Error("Assertion failed:\n" + fn);
  1016. }
  1017. assert(function () {
  1018. return !("hasOwnProperty" in Object.create(null));
  1019. });
  1020. assert(function () {
  1021. return Object.getPrototypeOf(Object.create(null)) === null;
  1022. });
  1023. assert(function () {
  1024. var p = {};
  1025. return Object.getPrototypeOf(Object.create(p)) === p;
  1026. });
  1027. // assert(function () {
  1028. // return new Function("return this")().Object === Object;
  1029. // });
  1030. // assert(function () {
  1031. // return Object.create(new Function("return this")()).Object === Object;
  1032. // });
  1033. assert(function () {
  1034. return typeof global !== "undefined";
  1035. });
  1036. assert(function () {
  1037. return global.Object === Object;
  1038. });
  1039. assert(function () {
  1040. return Object.create(global).Object === Object;
  1041. });
  1042. assert(function () {
  1043. return (function () {
  1044. return this;
  1045. }).apply(void 0) === void 0;
  1046. });
  1047. assert(function () {
  1048. return (function () {
  1049. return this;
  1050. }).apply(null) === null;
  1051. });
  1052. assert(function () {
  1053. return (function () {
  1054. return this;
  1055. }).apply(3) === 3;
  1056. });
  1057. assert(function () {
  1058. return (function () {
  1059. return this;
  1060. }).apply("foo") === "foo";
  1061. });
  1062. assert(function () {
  1063. return (function () {
  1064. return this;
  1065. }).apply(true) === true;
  1066. });
  1067. assert(function () {
  1068. var o = Object.freeze({});
  1069. try {
  1070. o.foo = "bar";
  1071. } catch (ex) {
  1072. }
  1073. return o.foo == null;
  1074. });
  1075. assert(function () {
  1076. return typeof Promise === "function";
  1077. });
  1078. assert(function () {
  1079. return typeof Promise.resolve === "function";
  1080. });
  1081. assert(function () {
  1082. return typeof Promise.reject === "function";
  1083. });
  1084. assert(function () {
  1085. return typeof new Promise(function () {
  1086. }).then === "function";
  1087. });
  1088. });
  1089. define('amber/brikz',[], function () {
  1090. return function Brikz(api, apiKey, initKey, backupKey) {
  1091. "use strict";
  1092. //jshint eqnull:true
  1093. var backup = {};
  1094. apiKey = apiKey || 'exports';
  1095. initKey = initKey || '__init__';
  1096. backupKey = backupKey || 'backup';
  1097. function mixin(src, target, what) {
  1098. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1099. if (src == null) {
  1100. target[keys[i]] = undefined;
  1101. } else {
  1102. var value = src[keys[i]];
  1103. if (typeof value !== "undefined") {
  1104. target[keys[i]] = value;
  1105. }
  1106. }
  1107. }
  1108. return target;
  1109. }
  1110. return function brikz() {
  1111. Object.keys(backup).forEach(function (key) {
  1112. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1113. });
  1114. var oapi = mixin(api, {}),
  1115. order = [],
  1116. chk = {};
  1117. function ensure(key) {
  1118. var b = brikz[key],
  1119. bak = backup[key];
  1120. while (typeof b === "function") {
  1121. (b.deps || []).forEach(ensure);
  1122. b[backupKey] = bak;
  1123. mixin(null, api, api);
  1124. b = new b(brikz, api);
  1125. }
  1126. brikz[key] = b;
  1127. if (b && !chk[key]) {
  1128. chk[key] = true;
  1129. order.push(b);
  1130. }
  1131. if (b && !b[apiKey]) {
  1132. b[apiKey] = mixin(api, {});
  1133. }
  1134. }
  1135. Object.keys(brikz).forEach(ensure);
  1136. mixin(oapi, mixin(null, api, api));
  1137. order.forEach(function (brik) {
  1138. mixin(brik[apiKey] || {}, api);
  1139. });
  1140. order.forEach(function (brik) {
  1141. if (brik[initKey]) {
  1142. brik[initKey]();
  1143. if (brik[initKey].once) {
  1144. delete brik[initKey];
  1145. }
  1146. }
  1147. });
  1148. backup = mixin(brikz, {});
  1149. };
  1150. };
  1151. });
  1152. //jshint eqnull:true
  1153. define('amber/kernel-fundamentals',[],function () {
  1154. "use strict";
  1155. function inherits (child, parent) {
  1156. child.prototype = Object.create(parent.prototype, {
  1157. constructor: {
  1158. value: child,
  1159. enumerable: false, configurable: true, writable: true
  1160. }
  1161. });
  1162. return child;
  1163. }
  1164. function SmalltalkGlobalsBrik (brikz, st) {
  1165. var globals = Object.create(global);
  1166. globals.SmalltalkSettings = {};
  1167. this.globals = globals;
  1168. }
  1169. function EventBrik (brikz, st) {
  1170. var emit = {};
  1171. this.emit = emit;
  1172. this.declareEvent = function (event) {
  1173. if (!emit[event]) emit[event] = function () {
  1174. };
  1175. }
  1176. }
  1177. function RootBrik (brikz, st) {
  1178. /* Smalltalk foundational objects */
  1179. var coreFns = this.coreFns = {};
  1180. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1181. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1182. Detached roots (eg. wrapped JS classes like Number or Date)
  1183. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1184. function SmalltalkRoot () {
  1185. }
  1186. function SmalltalkProtoObject () {
  1187. }
  1188. function SmalltalkObject () {
  1189. }
  1190. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1191. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1192. this.Root = SmalltalkRoot;
  1193. this.Object = SmalltalkObject;
  1194. }
  1195. function SelectorsBrik (brikz, st) {
  1196. var selectorSet = Object.create(null);
  1197. var selectors = this.selectors = [];
  1198. this.registerSelector = function (stSelector) {
  1199. if (selectorSet[stSelector]) return false;
  1200. selectors.push(stSelector);
  1201. return selectorSet[stSelector] = true;
  1202. };
  1203. st.allSelectors = function () {
  1204. return selectors;
  1205. };
  1206. }
  1207. function PackagesBrik (brikz, st) {
  1208. st.packageDescriptors = {};
  1209. /* Add a package load descriptor to the system */
  1210. st.addPackage = function (name, properties) {
  1211. if (!name) return null;
  1212. return st.packageDescriptors[name] = {properties: properties};
  1213. };
  1214. }
  1215. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1216. function BehaviorsBrik (brikz, st) {
  1217. var globals = brikz.smalltalkGlobals.globals;
  1218. var addElement = brikz.arraySet.addElement;
  1219. var removeElement = brikz.arraySet.removeElement;
  1220. /* Smalltalk classes and traits */
  1221. var traitsOrClasses = [];
  1222. this.buildTraitOrClass = function (category, builder) {
  1223. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1224. if (traitOrClass) {
  1225. builder.updateExisting(traitOrClass);
  1226. } else {
  1227. traitOrClass = builder.make();
  1228. traitOrClass.category = category;
  1229. addTraitOrClass(traitOrClass);
  1230. }
  1231. return traitOrClass;
  1232. };
  1233. function addTraitOrClass (traitOrClass) {
  1234. globals[traitOrClass.name] = traitOrClass;
  1235. addElement(traitsOrClasses, traitOrClass);
  1236. traitOrClass.added();
  1237. }
  1238. function removeTraitOrClass (traitOrClass) {
  1239. traitOrClass.removed();
  1240. removeElement(traitsOrClasses, traitOrClass);
  1241. delete globals[traitOrClass.name];
  1242. }
  1243. this.removeTraitOrClass = removeTraitOrClass;
  1244. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1245. }
  1246. MethodsBrik.deps = ["event", "selectors", "root"];
  1247. function MethodsBrik (brikz, st) {
  1248. var registerSelector = brikz.selectors.registerSelector;
  1249. var SmalltalkObject = brikz.root.Object;
  1250. var coreFns = brikz.root.coreFns;
  1251. var emit = brikz.event.emit;
  1252. var declareEvent = brikz.event.declareEvent;
  1253. function SmalltalkMethod () {
  1254. }
  1255. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1256. /* Smalltalk method object. To add a method to a class,
  1257. use api.addMethod() */
  1258. st.method = function (spec) {
  1259. var that = new SmalltalkMethod();
  1260. that.selector = spec.selector;
  1261. that.args = spec.args || [];
  1262. that.protocol = spec.protocol;
  1263. that.source = spec.source;
  1264. that.pragmas = spec.pragmas;
  1265. that.messageSends = spec.messageSends || [];
  1266. // TODO remove .referencedClasses, have .referencedGlobals
  1267. that.referencedClasses = spec.referencedClasses || [];
  1268. that.fn = spec.fn;
  1269. return that;
  1270. };
  1271. /* Add/remove a method to/from a class */
  1272. st.addMethod = function (method, traitOrBehavior) {
  1273. if (method.owner != null) {
  1274. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1275. }
  1276. method.owner = traitOrBehavior;
  1277. registerNewSelectors(method);
  1278. traitOrBehavior.localMethods[method.selector] = method;
  1279. updateMethod(method.selector, traitOrBehavior);
  1280. };
  1281. declareEvent("selectorsAdded");
  1282. function registerNewSelectors (method) {
  1283. var newSelectors = [];
  1284. function selectorInUse (stSelector) {
  1285. if (registerSelector(stSelector)) {
  1286. newSelectors.push(stSelector);
  1287. }
  1288. }
  1289. selectorInUse(method.selector);
  1290. method.messageSends.forEach(selectorInUse);
  1291. emit.selectorsAdded(newSelectors);
  1292. }
  1293. st.removeMethod = function (method, traitOrBehavior) {
  1294. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1295. delete traitOrBehavior.localMethods[method.selector];
  1296. updateMethod(method.selector, traitOrBehavior);
  1297. };
  1298. this.setupMethods = function (traitOrBehavior) {
  1299. traitOrBehavior.localMethods = Object.create(null);
  1300. traitOrBehavior.methods = Object.create(null);
  1301. };
  1302. declareEvent("methodReplaced");
  1303. function updateMethod (selector, traitOrBehavior) {
  1304. var oldMethod = traitOrBehavior.methods[selector],
  1305. newMethod = traitOrBehavior.localMethods[selector];
  1306. if (oldMethod == null && newMethod == null) {
  1307. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1308. return;
  1309. }
  1310. if (newMethod === oldMethod) return;
  1311. if (newMethod != null) {
  1312. if (newMethod.methodClass && newMethod.methodClass !== traitOrBehavior) {
  1313. console.warn("Resetting methodClass of " + newMethod.methodClass.name + " >> " + selector + " to " + traitOrBehavior.name);
  1314. }
  1315. newMethod.methodClass = traitOrBehavior;
  1316. traitOrBehavior.methods[selector] = newMethod;
  1317. traitOrBehavior.methodAdded(newMethod);
  1318. } else {
  1319. delete traitOrBehavior.methods[selector];
  1320. traitOrBehavior.methodRemoved(oldMethod);
  1321. }
  1322. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1323. }
  1324. this.updateMethod = updateMethod;
  1325. }
  1326. function ArraySetBrik (brikz, st) {
  1327. st.addElement = this.addElement = function (array, el) {
  1328. if (typeof el === 'undefined') {
  1329. return;
  1330. }
  1331. if (array.indexOf(el) === -1) {
  1332. array.push(el);
  1333. }
  1334. };
  1335. st.removeElement = this.removeElement = function (array, el) {
  1336. var i = array.indexOf(el);
  1337. if (i !== -1) {
  1338. array.splice(i, 1);
  1339. }
  1340. };
  1341. }
  1342. NilBrik.deps = ["root"];
  1343. function NilBrik (brikz, st) {
  1344. var SmalltalkObject = brikz.root.Object;
  1345. var coreFns = brikz.root.coreFns;
  1346. function SmalltalkNil () {
  1347. }
  1348. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1349. this.nilAsReceiver = new SmalltalkNil();
  1350. this.nilAsValue = this.nilAsReceiver; // TODO null
  1351. // Adds an `a$nil` property to the `nil` object. When sending
  1352. // nil objects from one environment to another, doing
  1353. // `anObject == nil` (in JavaScript) does not always answer
  1354. // true as the referenced nil object might come from the other
  1355. // environment.
  1356. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1357. value: true,
  1358. enumerable: false, configurable: false, writable: false
  1359. });
  1360. }
  1361. /* Making smalltalk that has basic building blocks */
  1362. function configureWithFundamentals (brikz) {
  1363. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1364. brikz.root = RootBrik;
  1365. brikz.nil = NilBrik;
  1366. brikz.event = EventBrik;
  1367. brikz.arraySet = ArraySetBrik;
  1368. brikz.selectors = SelectorsBrik;
  1369. brikz.packages = PackagesBrik;
  1370. brikz.behaviors = BehaviorsBrik;
  1371. brikz.methods = MethodsBrik;
  1372. brikz();
  1373. }
  1374. return configureWithFundamentals;
  1375. });
  1376. //jshint eqnull:true
  1377. define('amber/kernel-language',[],function () {
  1378. "use strict";
  1379. function inherits (child, parent) {
  1380. child.prototype = Object.create(parent.prototype, {
  1381. constructor: {
  1382. value: child,
  1383. enumerable: false, configurable: true, writable: true
  1384. }
  1385. });
  1386. return child;
  1387. }
  1388. function defineMethod (klass, name, method) {
  1389. Object.defineProperty(klass.prototype, name, {
  1390. value: method,
  1391. enumerable: false, configurable: true, writable: true
  1392. });
  1393. }
  1394. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1395. function TraitsBrik (brikz, st) {
  1396. var coreFns = brikz.root.coreFns;
  1397. var SmalltalkObject = brikz.root.Object;
  1398. var setupMethods = brikz.methods.setupMethods;
  1399. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1400. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1401. var emit = brikz.event.emit;
  1402. var declareEvent = brikz.event.declareEvent;
  1403. function SmalltalkTrait () {
  1404. }
  1405. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1406. SmalltalkTrait.prototype.trait = true;
  1407. defineMethod(SmalltalkTrait, "toString", function () {
  1408. return 'Smalltalk Trait ' + this.name;
  1409. });
  1410. declareEvent("traitAdded");
  1411. defineMethod(SmalltalkTrait, "added", function () {
  1412. emit.traitAdded(this);
  1413. });
  1414. declareEvent("traitRemoved");
  1415. defineMethod(SmalltalkTrait, "removed", function () {
  1416. emit.traitRemoved(this);
  1417. });
  1418. declareEvent("traitMethodAdded");
  1419. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1420. var self = this;
  1421. this.traitUsers.forEach(function (each) {
  1422. traitMethodChanged(method.selector, method, self, each);
  1423. });
  1424. emit.traitMethodAdded(method, this);
  1425. });
  1426. declareEvent("traitMethodRemoved");
  1427. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1428. var self = this;
  1429. this.traitUsers.forEach(function (each) {
  1430. traitMethodChanged(method.selector, null, self, each);
  1431. });
  1432. emit.traitMethodRemoved(method, this);
  1433. });
  1434. function traitBuilder (traitName) {
  1435. return {
  1436. name: traitName,
  1437. make: function () {
  1438. var that = new SmalltalkTrait();
  1439. that.name = traitName;
  1440. that.traitUsers = [];
  1441. setupMethods(that);
  1442. return that;
  1443. },
  1444. updateExisting: function (trait) {
  1445. }
  1446. };
  1447. }
  1448. st.addTrait = function (className, category) {
  1449. return buildTraitOrClass(category, traitBuilder(className));
  1450. };
  1451. }
  1452. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1453. function MethodCompositionBrik (brikz, st) {
  1454. var updateMethod = brikz.methods.updateMethod;
  1455. var addElement = brikz.arraySet.addElement;
  1456. var removeElement = brikz.arraySet.removeElement;
  1457. function aliased (selector, method) {
  1458. var result = st.method(method);
  1459. if (method.selector !== selector) {
  1460. result.selector = selector;
  1461. result.source = '"Aliased as ' + selector + '"\n' + method.source;
  1462. }
  1463. result.owner = method.owner;
  1464. return result;
  1465. }
  1466. function deleteKeysFrom (keys, obj) {
  1467. keys.forEach(function (each) {
  1468. delete obj[each];
  1469. });
  1470. }
  1471. function fillTraitTransformation (traitTransformation, obj) {
  1472. // assert(Object.getOwnProperties(obj).length === 0)
  1473. var traitMethods = traitTransformation.trait.methods;
  1474. Object.keys(traitMethods).forEach(function (selector) {
  1475. obj[selector] = aliased(selector, traitMethods[selector]);
  1476. });
  1477. var traitAliases = traitTransformation.aliases;
  1478. if (traitAliases) {
  1479. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1480. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1481. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1482. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1483. });
  1484. }
  1485. var traitExclusions = traitTransformation.exclusions;
  1486. if (traitExclusions) {
  1487. deleteKeysFrom(traitExclusions, obj);
  1488. }
  1489. return obj;
  1490. }
  1491. function buildCompositionChain (traitComposition) {
  1492. return traitComposition.reduce(function (soFar, each) {
  1493. return fillTraitTransformation(each, Object.create(soFar));
  1494. }, null);
  1495. }
  1496. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1497. var oldLocalMethods = traitOrBehavior.localMethods,
  1498. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1499. Object.keys(oldLocalMethods).forEach(function (selector) {
  1500. newLocalMethods[selector] = oldLocalMethods[selector];
  1501. });
  1502. var selector;
  1503. traitOrBehavior.localMethods = newLocalMethods;
  1504. for (selector in newLocalMethods) {
  1505. updateMethod(selector, traitOrBehavior);
  1506. }
  1507. for (selector in oldLocalMethods) {
  1508. updateMethod(selector, traitOrBehavior);
  1509. }
  1510. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1511. removeElement(each.trait.traitUsers, traitOrBehavior);
  1512. });
  1513. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1514. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1515. addElement(each.trait.traitUsers, traitOrBehavior);
  1516. });
  1517. };
  1518. function aliasesOfSelector (selector, traitAliases) {
  1519. if (!traitAliases) return [selector];
  1520. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1521. return traitAliases[aliasSelector] === selector
  1522. });
  1523. if (!traitAliases[selector]) result.push(selector);
  1524. return result;
  1525. }
  1526. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1527. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1528. changes.forEach(function (aliasSelector) {
  1529. obj[aliasSelector] = aliased(aliasSelector, method);
  1530. });
  1531. var traitExclusions = traitTransformation.exclusions;
  1532. if (traitExclusions) {
  1533. deleteKeysFrom(traitExclusions, obj);
  1534. }
  1535. return changes;
  1536. }
  1537. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1538. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1539. deleteKeysFrom(changes, obj);
  1540. return changes;
  1541. }
  1542. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  1543. var traitComposition = traitOrBehavior.traitComposition,
  1544. chain = traitOrBehavior.localMethods,
  1545. changes = [];
  1546. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1547. chain = Object.getPrototypeOf(chain);
  1548. var traitTransformation = traitComposition[i];
  1549. if (traitTransformation.trait !== trait) continue;
  1550. changes.push.apply(changes, method ?
  1551. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1552. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1553. }
  1554. // assert(chain === null);
  1555. changes.forEach(function (each) {
  1556. updateMethod(each, traitOrBehavior);
  1557. });
  1558. }
  1559. this.traitMethodChanged = traitMethodChanged;
  1560. }
  1561. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  1562. function ClassesBrik (brikz, st) {
  1563. var SmalltalkRoot = brikz.root.Root;
  1564. var coreFns = brikz.root.coreFns;
  1565. var globals = brikz.smalltalkGlobals.globals;
  1566. var SmalltalkObject = brikz.root.Object;
  1567. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1568. var setupMethods = brikz.methods.setupMethods;
  1569. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  1570. var addElement = brikz.arraySet.addElement;
  1571. var removeElement = brikz.arraySet.removeElement;
  1572. var emit = brikz.event.emit;
  1573. var declareEvent = brikz.event.declareEvent;
  1574. function SmalltalkBehavior () {
  1575. }
  1576. function SmalltalkClass () {
  1577. }
  1578. function SmalltalkMetaclass () {
  1579. }
  1580. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  1581. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1582. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1583. // Fake root class of the system.
  1584. // Effective superclass of all classes created with `nil subclass: ...`.
  1585. var nilAsClass = this.nilAsClass = {
  1586. fn: SmalltalkRoot,
  1587. subclasses: [],
  1588. a$cls: {fn: SmalltalkClass}
  1589. };
  1590. SmalltalkMetaclass.prototype.meta = true;
  1591. defineMethod(SmalltalkClass, "toString", function () {
  1592. return 'Smalltalk ' + this.name;
  1593. });
  1594. defineMethod(SmalltalkMetaclass, "toString", function () {
  1595. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  1596. });
  1597. declareEvent("classAdded");
  1598. defineMethod(SmalltalkClass, "added", function () {
  1599. addSubclass(this);
  1600. emit.classAdded(this);
  1601. });
  1602. declareEvent("classRemoved");
  1603. defineMethod(SmalltalkClass, "removed", function () {
  1604. emit.classRemoved(this);
  1605. removeSubclass(this);
  1606. });
  1607. declareEvent("behaviorMethodAdded");
  1608. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1609. emit.behaviorMethodAdded(method, this);
  1610. });
  1611. declareEvent("behaviorMethodRemove");
  1612. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1613. emit.behaviorMethodRemoved(method, this);
  1614. });
  1615. // TODO remove, ["@foo"] backward compatibility
  1616. function installIvarCompat (klass) {
  1617. var ivars = klass.slots;
  1618. ivars.forEach(function (ivar) {
  1619. Object.defineProperty(klass.fn.prototype, "@" + ivar, {
  1620. get: function () {
  1621. return this[ivar];
  1622. },
  1623. set: function (value) {
  1624. return this[ivar] = value;
  1625. },
  1626. enumerable: false,
  1627. configurable: true
  1628. });
  1629. });
  1630. }
  1631. this.installIvarCompat = installIvarCompat;
  1632. function setSlots (klass, slots) {
  1633. slots.forEach(function (name) {
  1634. if (!name.match(/^[a-zA-Z][a-zA-Z0-9]*$/))
  1635. throw new Error("Wrong identifier name: " + name);
  1636. });
  1637. klass.slots = slots;
  1638. installIvarCompat(klass);
  1639. }
  1640. st.setSlots = setSlots;
  1641. // TODO remove, .iVarNames backward compatibility
  1642. Object.defineProperty(SmalltalkBehavior.prototype, "iVarNames", {
  1643. enumerable: true,
  1644. configurable: true,
  1645. get: function () {
  1646. return this.slots;
  1647. },
  1648. set: function (instanceVariableNames) {
  1649. setSlots(this, instanceVariableNames);
  1650. }
  1651. });
  1652. this.bootstrapHierarchy = function () {
  1653. nilAsClass.a$cls = globals.Class;
  1654. nilAsClass.subclasses.forEach(function (each) {
  1655. each.a$cls.superclass = globals.Class;
  1656. addSubclass(each.a$cls);
  1657. });
  1658. };
  1659. /* Smalltalk class creation. A class is an instance of an automatically
  1660. created metaclass object. Newly created classes (not their metaclass)
  1661. should be added to the system, see smalltalk.addClass().
  1662. Superclass linking is *not* handled here, see api.initialize() */
  1663. function classBuilder (className, superclass, fn) {
  1664. var logicalSuperclass = superclass;
  1665. if (superclass == null || superclass.a$nil) {
  1666. superclass = nilAsClass;
  1667. logicalSuperclass = null;
  1668. }
  1669. function klass () {
  1670. var that = metaclass().instanceClass;
  1671. that.superclass = logicalSuperclass;
  1672. that.fn = fn || inherits(function () {
  1673. }, superclass.fn);
  1674. that.slots = [];
  1675. that.name = className;
  1676. that.subclasses = [];
  1677. setupMethods(that);
  1678. return that;
  1679. }
  1680. function metaclass () {
  1681. var that = new SmalltalkMetaclass();
  1682. that.superclass = superclass.a$cls;
  1683. that.fn = inherits(function () {
  1684. }, that.superclass.fn);
  1685. that.slots = [];
  1686. that.instanceClass = new that.fn();
  1687. wireKlass(that);
  1688. setupMethods(that);
  1689. return that;
  1690. }
  1691. return {
  1692. name: className,
  1693. make: klass,
  1694. updateExisting: function (klass) {
  1695. if (klass.superclass != logicalSuperclass || fn && fn !== klass.fn)
  1696. throw new Error("Incompatible change of class: " + klass.name);
  1697. }
  1698. };
  1699. }
  1700. function wireKlass (klass) {
  1701. Object.defineProperty(klass.fn.prototype, "a$cls", {
  1702. value: klass,
  1703. enumerable: false, configurable: true, writable: true
  1704. });
  1705. }
  1706. this.wireKlass = wireKlass;
  1707. /* Add a class to the system, creating a new one if needed.
  1708. A Package is lazily created if one with given name does not exist. */
  1709. st.addClass = function (className, superclass, category) {
  1710. // TODO remove, backward compatibility
  1711. if (arguments[3]) {
  1712. var added = st.addClass(className, superclass, arguments[3]);
  1713. setSlots(added, category);
  1714. return added;
  1715. }
  1716. // While subclassing nil is allowed, it might be an error, so
  1717. // warn about it.
  1718. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  1719. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1720. }
  1721. return buildTraitOrClass(category, classBuilder(className, superclass, coreFns[className]));
  1722. };
  1723. st.removeClass = removeTraitOrClass;
  1724. function addSubclass (klass) {
  1725. addElement((klass.superclass || nilAsClass).subclasses, klass);
  1726. }
  1727. function removeSubclass (klass) {
  1728. removeElement((klass.superclass || nilAsClass).subclasses, klass);
  1729. }
  1730. function metaSubclasses (metaclass) {
  1731. return metaclass.instanceClass.subclasses
  1732. .filter(function (each) {
  1733. return !each.meta;
  1734. })
  1735. .map(function (each) {
  1736. return each.a$cls;
  1737. });
  1738. }
  1739. st.metaSubclasses = metaSubclasses;
  1740. st.traverseClassTree = function (klass, fn) {
  1741. var queue = [klass], sentinel = {};
  1742. for (var i = 0; i < queue.length; ++i) {
  1743. var item = queue[i];
  1744. if (fn(item, sentinel) === sentinel) continue;
  1745. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1746. queue.push.apply(queue, subclasses);
  1747. }
  1748. };
  1749. }
  1750. /* Making smalltalk that can load */
  1751. function configureWithHierarchy (brikz) {
  1752. brikz.traits = TraitsBrik;
  1753. brikz.composition = MethodCompositionBrik;
  1754. brikz.classes = ClassesBrik;
  1755. brikz();
  1756. }
  1757. return configureWithHierarchy;
  1758. });
  1759. //jshint eqnull:true
  1760. define('amber/kernel-runtime',[],function () {
  1761. "use strict";
  1762. function defineMethod (klass, name, method) {
  1763. Object.defineProperty(klass.prototype, name, {
  1764. value: method,
  1765. enumerable: false, configurable: true, writable: true
  1766. });
  1767. }
  1768. function installJSMethod (obj, jsSelector, fn) {
  1769. Object.defineProperty(obj, jsSelector, {
  1770. value: fn,
  1771. enumerable: false, configurable: true, writable: true
  1772. });
  1773. }
  1774. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1775. function RuntimeSelectorsBrik (brikz, st) {
  1776. var selectors = brikz.selectors.selectors;
  1777. var globals = brikz.smalltalkGlobals.globals;
  1778. var nilAsClass = brikz.classes.nilAsClass;
  1779. var st2js = brikz.selectorConversion.st2js;
  1780. var jsSelectors = this.jsSelectors = [];
  1781. /* Method not implemented handlers */
  1782. function installNewSelectors (newSelectors, targetClasses) {
  1783. newSelectors.forEach(function (selector) {
  1784. var jsSelector = st2js(selector);
  1785. jsSelectors.push(jsSelector);
  1786. var fn = createDnuHandler(selector);
  1787. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1788. targetClasses.forEach(function (target) {
  1789. installJSMethod(target.fn.prototype, jsSelector, fn);
  1790. });
  1791. });
  1792. }
  1793. this.installNewSelectors = installNewSelectors;
  1794. /* Dnu handler method */
  1795. function createDnuHandler (stSelector) {
  1796. return function () {
  1797. return globals.Message._selector_arguments_notUnderstoodBy_(
  1798. stSelector, [].slice.call(arguments), this
  1799. );
  1800. };
  1801. }
  1802. installNewSelectors(selectors, []);
  1803. }
  1804. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1805. function RuntimeClassesBrik (brikz, st) {
  1806. var globals = brikz.smalltalkGlobals.globals;
  1807. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1808. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1809. var installMethod = brikz.runtimeMethods.installMethod;
  1810. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1811. var wireKlass = brikz.classes.wireKlass;
  1812. var installIvarCompat = brikz.classes.installIvarCompat;
  1813. var emit = brikz.event.emit;
  1814. var detachedRootClasses = [];
  1815. function markClassDetachedRoot (klass) {
  1816. klass.detachedRoot = true;
  1817. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1818. return klass.detachedRoot;
  1819. });
  1820. }
  1821. emit.selectorsAdded = function (newSelectors) {
  1822. installNewSelectors(newSelectors, detachedRootClasses);
  1823. };
  1824. /* Initialize a class in its class hierarchy. Handle both classes and
  1825. metaclasses. */
  1826. function initClassAndMetaclass (klass) {
  1827. initClass(klass);
  1828. if (klass.a$cls && !klass.meta) {
  1829. initClass(klass.a$cls);
  1830. }
  1831. }
  1832. traitsOrClasses.forEach(function (traitOrClass) {
  1833. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1834. });
  1835. function installStHooks () {
  1836. emit.classAdded = function (klass) {
  1837. initClassAndMetaclass(klass);
  1838. klass._enterOrganization();
  1839. };
  1840. emit.traitAdded = function (trait) {
  1841. trait._enterOrganization();
  1842. };
  1843. emit.classRemoved = function (klass) {
  1844. klass._leaveOrganization();
  1845. };
  1846. emit.traitRemoved = function (trait) {
  1847. trait._leaveOrganization();
  1848. };
  1849. }
  1850. this.installStHooks = installStHooks;
  1851. emit.classAdded = function (klass) {
  1852. initClassAndMetaclass(klass);
  1853. };
  1854. function initClass (klass) {
  1855. wireKlass(klass);
  1856. if (klass.detachedRoot) {
  1857. copySuperclass(klass);
  1858. }
  1859. installMethods(klass);
  1860. }
  1861. function copySuperclass (klass) {
  1862. var myproto = klass.fn.prototype,
  1863. superproto = klass.superclass.fn.prototype;
  1864. jsSelectors.forEach(function (jsSelector) {
  1865. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1866. });
  1867. }
  1868. function installMethods (klass) {
  1869. var methods = klass.methods;
  1870. Object.keys(methods).forEach(function (selector) {
  1871. installMethod(methods[selector], klass);
  1872. });
  1873. }
  1874. /* Create an alias for an existing class */
  1875. st.alias = function (traitOrClass, alias) {
  1876. globals[alias] = traitOrClass;
  1877. };
  1878. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1879. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1880. markClassDetachedRoot(klass);
  1881. klass.fn = constructor;
  1882. installIvarCompat(klass);
  1883. initClass(klass);
  1884. };
  1885. }
  1886. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1887. function FrameBindingBrik (brikz, st) {
  1888. var globals = brikz.smalltalkGlobals.globals;
  1889. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1890. setClassConstructor(globals.Number, Number);
  1891. setClassConstructor(globals.BlockClosure, Function);
  1892. setClassConstructor(globals.Boolean, Boolean);
  1893. setClassConstructor(globals.Date, Date);
  1894. setClassConstructor(globals.String, String);
  1895. setClassConstructor(globals.Array, Array);
  1896. setClassConstructor(globals.RegularExpression, RegExp);
  1897. setClassConstructor(globals.Error, Error);
  1898. setClassConstructor(globals.Promise, Promise);
  1899. this.__init__ = function () {
  1900. st.alias(globals.Array, "OrderedCollection");
  1901. st.alias(globals.Date, "Time");
  1902. }
  1903. }
  1904. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1905. function RuntimeMethodsBrik (brikz, st) {
  1906. var st2js = brikz.selectorConversion.st2js;
  1907. var emit = brikz.event.emit;
  1908. function installMethod (method, klass) {
  1909. var jsSelector = method.jsSelector;
  1910. if (!jsSelector) {
  1911. jsSelector = method.jsSelector = st2js(method.selector);
  1912. }
  1913. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1914. }
  1915. this.installMethod = installMethod;
  1916. emit.behaviorMethodAdded = function (method, klass) {
  1917. installMethod(method, klass);
  1918. propagateMethodChange(klass, method, klass);
  1919. };
  1920. emit.behaviorMethodRemoved = function (method, klass) {
  1921. delete klass.fn.prototype[method.jsSelector];
  1922. propagateMethodChange(klass, method, null);
  1923. };
  1924. function installStHooks () {
  1925. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1926. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1927. };
  1928. }
  1929. this.installStHooks = installStHooks;
  1930. function propagateMethodChange (klass, method, exclude) {
  1931. var selector = method.selector;
  1932. var jsSelector = method.jsSelector;
  1933. st.traverseClassTree(klass, function (subclass, sentinel) {
  1934. if (subclass === exclude) return;
  1935. if (subclass.methods[selector]) return sentinel;
  1936. if (subclass.detachedRoot) {
  1937. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1938. }
  1939. });
  1940. }
  1941. }
  1942. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1943. function PrimitivesBrik (brikz, st) {
  1944. var globals = brikz.smalltalkGlobals.globals;
  1945. /* Converts a JavaScript object to valid Smalltalk Object */
  1946. st.readJSObject = function (js) {
  1947. if (js == null) return null;
  1948. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1949. else if (js.constructor !== Object) return js;
  1950. var pairs = [];
  1951. for (var i in js) {
  1952. pairs.push(i, st.readJSObject(js[i]));
  1953. }
  1954. return globals.Dictionary._newFromPairs_(pairs);
  1955. };
  1956. /* Boolean assertion */
  1957. st.assert = function (shouldBeBoolean) {
  1958. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1959. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1960. shouldBeBoolean = shouldBeBoolean.valueOf();
  1961. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1962. }
  1963. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1964. };
  1965. }
  1966. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1967. function RuntimeBrik (brikz, st) {
  1968. var globals = brikz.smalltalkGlobals.globals;
  1969. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1970. function SmalltalkMethodContext (home, setup) {
  1971. // TODO lazy fill of .sendIdx
  1972. this.sendIdx = {};
  1973. // TODO very likely .senderContext, not .homeContext here
  1974. this.homeContext = home;
  1975. this.setup = setup;
  1976. }
  1977. // Fallbacks
  1978. SmalltalkMethodContext.prototype.supercall = false;
  1979. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1980. SmalltalkMethodContext.prototype.receiver = null;
  1981. SmalltalkMethodContext.prototype.selector = null;
  1982. SmalltalkMethodContext.prototype.outerContext = null;
  1983. SmalltalkMethodContext.prototype.index = 0;
  1984. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals) {
  1985. this.receiver = receiver;
  1986. this.selector = selector;
  1987. if (locals != null) this.locals = locals;
  1988. if (this.homeContext) {
  1989. this.homeContext.evaluatedSelector = selector;
  1990. }
  1991. });
  1992. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1993. if (locals != null) this.locals = locals;
  1994. this.outerContext = ctx;
  1995. if (index) this.index = index;
  1996. });
  1997. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1998. /* This is the current call context object.
  1999. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  2000. In JS code, use api.getThisContext() (see below).
  2001. */
  2002. var thisContext = null;
  2003. /*
  2004. Runs worker function so that error handler is not set up
  2005. if there isn't one. This is accomplished by unconditional
  2006. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  2007. which then stops error handler setup (see st.withContext above).
  2008. The effect is, $core.seamless(fn)'s exceptions are not
  2009. handed into ST error handler and caller should process them.
  2010. */
  2011. st.seamless = function (worker) {
  2012. var oldContext = thisContext;
  2013. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  2014. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  2015. });
  2016. var result = worker(thisContext);
  2017. thisContext = oldContext;
  2018. return result;
  2019. };
  2020. function resultWithErrorHandling (worker) {
  2021. try {
  2022. return worker(thisContext);
  2023. } catch (error) {
  2024. globals.ErrorHandler._handleError_(error);
  2025. thisContext = null;
  2026. // Rethrow the error in any case.
  2027. throw error;
  2028. }
  2029. }
  2030. /*
  2031. Standard way to run within context.
  2032. Sets up error handler if entering first ST context in a stack.
  2033. */
  2034. st.withContext = function (worker, setup) {
  2035. var oldContext = thisContext;
  2036. thisContext = new SmalltalkMethodContext(thisContext, setup);
  2037. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  2038. thisContext = oldContext;
  2039. return result;
  2040. };
  2041. /* Handle thisContext pseudo variable */
  2042. st.getThisContext = function () {
  2043. if (!thisContext) return null;
  2044. for (var frame = thisContext; frame; frame = frame.homeContext) {
  2045. frame.setup(frame);
  2046. }
  2047. return thisContext;
  2048. };
  2049. }
  2050. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  2051. function MessageSendBrik (brikz, st) {
  2052. var globals = brikz.smalltalkGlobals.globals;
  2053. var nilAsReceiver = brikz.root.nilAsReceiver;
  2054. /* Send message programmatically. Used to implement #perform: & Co. */
  2055. st.send2 = function (self, selector, args, klass) {
  2056. if (self == null) {
  2057. self = nilAsReceiver;
  2058. }
  2059. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  2060. return method != null ?
  2061. method.apply(self, args || []) :
  2062. globals.Message._selector_arguments_notUnderstoodBy_(
  2063. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  2064. );
  2065. };
  2066. function wrapJavaScript (o) {
  2067. return globals.JSObjectProxy._on_(o);
  2068. }
  2069. st.wrapJavaScript = wrapJavaScript;
  2070. /* If the object property is a function, then call it, except if it starts with
  2071. an uppercase character (we probably want to answer the function itself in this
  2072. case and send it #new from Amber).
  2073. */
  2074. st.accessJavaScript = function (self, propertyName, args) {
  2075. var propertyValue = self[propertyName];
  2076. if (typeof propertyValue === "function" && !(args.length === 0 && /^[A-Z]/.test(propertyName)))
  2077. return propertyValue.apply(self, args);
  2078. switch (args.length) {
  2079. case 0:
  2080. return propertyValue;
  2081. case 1:
  2082. self[propertyName] = args[0];
  2083. return self;
  2084. default:
  2085. throw new Error("Cannot interpret " + propertyName + " with " + args.length + " arguments; field is a " + typeof propertyValue + ", not a function")
  2086. }
  2087. };
  2088. }
  2089. function SelectorConversionBrik (brikz, st) {
  2090. var st2jsMemo = Object.create(null);
  2091. /* Convert a Smalltalk selector into a JS selector */
  2092. function st2js (string) {
  2093. return '_' + string
  2094. .replace(/:/g, '_')
  2095. .replace(/[\&]/g, '_and')
  2096. .replace(/[\|]/g, '_or')
  2097. .replace(/[+]/g, '_plus')
  2098. .replace(/-/g, '_minus')
  2099. .replace(/[*]/g, '_star')
  2100. .replace(/[\/]/g, '_slash')
  2101. .replace(/[\\]/g, '_backslash')
  2102. .replace(/[\~]/g, '_tild')
  2103. .replace(/%/g, '_percent')
  2104. .replace(/>/g, '_gt')
  2105. .replace(/</g, '_lt')
  2106. .replace(/=/g, '_eq')
  2107. .replace(/,/g, '_comma')
  2108. .replace(/[@]/g, '_at');
  2109. };
  2110. st.st2js = function (stSelector) {
  2111. return st2jsMemo[stSelector] || st2js(stSelector);
  2112. };
  2113. this.st2js = function (stSelector) {
  2114. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  2115. };
  2116. /* Convert a string to a valid smalltalk selector.
  2117. if you modify the following functions, also change st2js
  2118. accordingly */
  2119. st.js2st = function (selector) {
  2120. if (selector.match(/^__/)) {
  2121. return binaryJsToSt(selector);
  2122. } else {
  2123. return keywordJsToSt(selector);
  2124. }
  2125. };
  2126. function keywordJsToSt (selector) {
  2127. return selector.replace(/^_/, '').replace(/_/g, ':');
  2128. }
  2129. function binaryJsToSt (selector) {
  2130. return selector
  2131. .replace(/^_/, '')
  2132. .replace(/_and/g, '&')
  2133. .replace(/_or/g, '|')
  2134. .replace(/_plus/g, '+')
  2135. .replace(/_minus/g, '-')
  2136. .replace(/_star/g, '*')
  2137. .replace(/_slash/g, '/')
  2138. .replace(/_backslash/g, '\\')
  2139. .replace(/_tild/g, '~')
  2140. .replace(/_percent/g, '%')
  2141. .replace(/_gt/g, '>')
  2142. .replace(/_lt/g, '<')
  2143. .replace(/_eq/g, '=')
  2144. .replace(/_comma/g, ',')
  2145. .replace(/_at/g, '@');
  2146. }
  2147. st.st2prop = function (stSelector) {
  2148. var colonPosition = stSelector.indexOf(':');
  2149. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  2150. };
  2151. }
  2152. StartImageBrik.deps = ["smalltalkGlobals", "runtimeClasses", "runtimeMethods"];
  2153. function StartImageBrik (brikz, st) {
  2154. var globals = brikz.smalltalkGlobals.globals;
  2155. this.run = function () {
  2156. brikz.runtimeClasses.installStHooks();
  2157. brikz.runtimeMethods.installStHooks();
  2158. return globals.AmberBootstrapInitialization._run();
  2159. };
  2160. }
  2161. /* Making smalltalk that can run */
  2162. function configureWithRuntime (brikz) {
  2163. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  2164. brikz.runtimeClasses = RuntimeClassesBrik;
  2165. brikz.frameBinding = FrameBindingBrik;
  2166. brikz.runtimeMethods = RuntimeMethodsBrik;
  2167. brikz.messageSend = MessageSendBrik;
  2168. brikz.runtime = RuntimeBrik;
  2169. brikz.primitives = PrimitivesBrik;
  2170. brikz.selectorConversion = SelectorConversionBrik;
  2171. brikz.startImage = StartImageBrik;
  2172. brikz();
  2173. }
  2174. return configureWithRuntime;
  2175. });
  2176. /* ====================================================================
  2177. |
  2178. | Amber Smalltalk
  2179. | http://amber-lang.net
  2180. |
  2181. ======================================================================
  2182. ======================================================================
  2183. |
  2184. | Copyright (c) 2010-2014
  2185. | Nicolas Petton <petton.nicolas@gmail.com>
  2186. |
  2187. | Copyright (c) 2012-2019
  2188. | The Amber team https://lolg.it/org/amber/members
  2189. | Amber contributors (see /CONTRIBUTORS)
  2190. |
  2191. | Amber is released under the MIT license
  2192. |
  2193. | Permission is hereby granted, free of charge, to any person obtaining
  2194. | a copy of this software and associated documentation files (the
  2195. | 'Software'), to deal in the Software without restriction, including
  2196. | without limitation the rights to use, copy, modify, merge, publish,
  2197. | distribute, sublicense, and/or sell copies of the Software, and to
  2198. | permit persons to whom the Software is furnished to do so, subject to
  2199. | the following conditions:
  2200. |
  2201. | The above copyright notice and this permission notice shall be
  2202. | included in all copies or substantial portions of the Software.
  2203. |
  2204. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2205. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2206. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2207. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2208. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2209. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2210. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2211. |
  2212. ==================================================================== */
  2213. //jshint eqnull:true
  2214. define('amber/boot',[
  2215. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2216. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2217. "use strict";
  2218. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2219. require(['./kernel-runtime'], resolve, reject);
  2220. });
  2221. function SmalltalkInitBrik (brikz, st) {
  2222. var initialized = false;
  2223. /* Smalltalk initialization. Called on page load */
  2224. st.initialize = function () {
  2225. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2226. if (initialized) return;
  2227. brikz.classes.bootstrapHierarchy();
  2228. configureWithRuntime(brikz);
  2229. return Promise.resolve(brikz.startImage.run())
  2230. .then(function () {
  2231. initialized = true;
  2232. });
  2233. });
  2234. };
  2235. }
  2236. /* Adds AMD and requirejs related methods to the api */
  2237. function AMDBrik (brikz, st) {
  2238. st.amdRequire = require;
  2239. st.defaultTransportType = st.defaultTransportType || "amd";
  2240. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber/core";
  2241. }
  2242. /* Defines asReceiver to be present at load time */
  2243. /* (logically it belongs more to PrimitiveBrik) */
  2244. AsReceiverBrik.deps = ["nil"];
  2245. function AsReceiverBrik (brikz, st) {
  2246. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2247. /**
  2248. * This function is used all over the compiled amber code.
  2249. * It takes any value (JavaScript or Smalltalk)
  2250. * and returns a proper Amber Smalltalk receiver.
  2251. *
  2252. * null or undefined -> nilAsReceiver,
  2253. * object having Smalltalk signature -> unchanged,
  2254. * otherwise wrapped foreign (JS) object
  2255. */
  2256. this.asReceiver = function (o) {
  2257. if (o == null) return nilAsReceiver;
  2258. else if (o.a$cls != null) return o;
  2259. else return st.wrapJavaScript(o);
  2260. };
  2261. }
  2262. var api = {};
  2263. var brikz = Brikz(api);
  2264. configureWithFundamentals(brikz);
  2265. configureWithHierarchy(brikz);
  2266. brikz.asReceiver = AsReceiverBrik;
  2267. brikz.stInit = SmalltalkInitBrik;
  2268. brikz.amd = AMDBrik;
  2269. brikz();
  2270. // TODO deprecated, remove
  2271. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2272. enumerable: true,
  2273. configurable: true,
  2274. get: function () {
  2275. return this.String;
  2276. }
  2277. });
  2278. return {
  2279. api: api,
  2280. nilAsReceiver: brikz.nil.nilAsReceiver,
  2281. nilAsValue: brikz.nil.nilAsValue,
  2282. nilAsClass: brikz.classes.nilAsClass,
  2283. globals: brikz.smalltalkGlobals.globals,
  2284. asReceiver: brikz.asReceiver.asReceiver
  2285. };
  2286. });
  2287. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2288. var globals = boot.globals,
  2289. exports = {},
  2290. api = boot.api,
  2291. nil = boot.nilAsReceiver;
  2292. // API
  2293. exports.popupHelios = function () {
  2294. require(['helios/index'], function (helios) {
  2295. helios.popup();
  2296. }, function (err) {
  2297. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2298. });
  2299. };
  2300. Object.defineProperty(exports, "api", {
  2301. value: api,
  2302. enumerable: true, configurable: true, writable: false
  2303. });
  2304. Object.defineProperty(exports, "globals", {
  2305. value: globals,
  2306. enumerable: true, configurable: true, writable: false
  2307. });
  2308. Object.defineProperty(exports, "nil", {
  2309. value: nil,
  2310. enumerable: true, configurable: true, writable: false
  2311. });
  2312. function mixinToSettings (source) {
  2313. var settings = globals.SmalltalkSettings;
  2314. Object.keys(source).forEach(function (key) {
  2315. settings[key] = source[key];
  2316. });
  2317. }
  2318. function settingsInLocalStorage () {
  2319. //jshint evil:true
  2320. var storage = 'localStorage' in global && global.localStorage;
  2321. if (storage) {
  2322. var fromStorage;
  2323. try {
  2324. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2325. } catch (ex) {
  2326. // pass
  2327. }
  2328. mixinToSettings(fromStorage || {});
  2329. if (typeof window !== "undefined") {
  2330. window.addEventListener('beforeunload', function () {
  2331. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2332. });
  2333. }
  2334. }
  2335. }
  2336. exports.initialize = function (options) {
  2337. return new Promise(function (resolve) {
  2338. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2339. settingsInLocalStorage();
  2340. mixinToSettings(options || {});
  2341. resolve(api.initialize());
  2342. });
  2343. };
  2344. exports.loadPackages = function (modules) {
  2345. return new Promise(function (resolve, reject) {
  2346. require(modules, resolve, reject);
  2347. }).then(function () {
  2348. return globals.Smalltalk._postLoad();
  2349. });
  2350. };
  2351. exports.beClean = function () {
  2352. return globals.Smalltalk._beClean();
  2353. };
  2354. // Exports
  2355. return exports;
  2356. });
  2357. define('amber/core/Kernel-Helpers',["amber/boot", "require"], function($boot,requirejs){"use strict";
  2358. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2359. var $pkg = $core.addPackage("Kernel-Helpers");
  2360. $pkg.innerEval = function (expr) { return eval(expr); };
  2361. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2362. $core.addTrait("TPragmator", "Kernel-Helpers");
  2363. $core.addMethod(
  2364. $core.method({
  2365. selector: "canProcessPragma:",
  2366. protocol: "pragma processing",
  2367. fn: function (aMessage){
  2368. var self=this,$self=this;
  2369. var selector;
  2370. return $core.withContext(function($ctx1) {
  2371. selector=$recv(aMessage)._selector();
  2372. return $recv($self._respondsTo_(selector))._and_((function(){
  2373. return $core.withContext(function($ctx2) {
  2374. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  2375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2376. }));
  2377. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector})});
  2378. },
  2379. args: ["aMessage"],
  2380. 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]",
  2381. referencedClasses: [],
  2382. pragmas: [],
  2383. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  2384. }),
  2385. $globals.TPragmator);
  2386. $core.addMethod(
  2387. $core.method({
  2388. selector: "processPragma:",
  2389. protocol: "pragma processing",
  2390. fn: function (aMessage){
  2391. var self=this,$self=this;
  2392. return $core.withContext(function($ctx1) {
  2393. var $1;
  2394. $1=$self._canProcessPragma_(aMessage);
  2395. if($core.assert($1)){
  2396. return $recv(aMessage)._sendTo_(self);
  2397. }
  2398. return self;
  2399. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage})});
  2400. },
  2401. args: ["aMessage"],
  2402. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  2403. referencedClasses: [],
  2404. pragmas: [],
  2405. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  2406. }),
  2407. $globals.TPragmator);
  2408. $core.addMethod(
  2409. $core.method({
  2410. selector: "processPragmas:",
  2411. protocol: "pragma processing",
  2412. fn: function (aCollection){
  2413. var self=this,$self=this;
  2414. return $core.withContext(function($ctx1) {
  2415. $recv(aCollection)._do_((function(each){
  2416. return $core.withContext(function($ctx2) {
  2417. return $self._processPragma_(each);
  2418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2419. }));
  2420. return self;
  2421. }, function($ctx1) {$ctx1.fill(self,"processPragmas:",{aCollection:aCollection})});
  2422. },
  2423. args: ["aCollection"],
  2424. source: "processPragmas: aCollection\x0a\x09aCollection do: [ :each | self processPragma: each ]",
  2425. referencedClasses: [],
  2426. pragmas: [],
  2427. messageSends: ["do:", "processPragma:"]
  2428. }),
  2429. $globals.TPragmator);
  2430. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2431. $core.addMethod(
  2432. $core.method({
  2433. selector: "subclass:",
  2434. protocol: "class creation",
  2435. fn: function (aString){
  2436. var self=this,$self=this;
  2437. return $core.withContext(function($ctx1) {
  2438. return $self._subclass_slots_package_(aString,[],nil);
  2439. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString})});
  2440. },
  2441. args: ["aString"],
  2442. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: #() package: nil",
  2443. referencedClasses: [],
  2444. pragmas: [],
  2445. messageSends: ["subclass:slots:package:"]
  2446. }),
  2447. $globals.TSubclassable);
  2448. $core.addMethod(
  2449. $core.method({
  2450. selector: "subclass:instanceVariableNames:",
  2451. protocol: "class creation",
  2452. fn: function (aString,anotherString){
  2453. var self=this,$self=this;
  2454. return $core.withContext(function($ctx1) {
  2455. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2456. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString})});
  2457. },
  2458. args: ["aString", "anotherString"],
  2459. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2460. referencedClasses: [],
  2461. pragmas: [],
  2462. messageSends: ["subclass:instanceVariableNames:package:"]
  2463. }),
  2464. $globals.TSubclassable);
  2465. $core.addMethod(
  2466. $core.method({
  2467. selector: "subclass:instanceVariableNames:category:",
  2468. protocol: "class creation",
  2469. fn: function (aString,aString2,aString3){
  2470. var self=this,$self=this;
  2471. return $core.withContext(function($ctx1) {
  2472. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2473. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3})});
  2474. },
  2475. args: ["aString", "aString2", "aString3"],
  2476. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2477. referencedClasses: [],
  2478. pragmas: [],
  2479. messageSends: ["subclass:instanceVariableNames:package:"]
  2480. }),
  2481. $globals.TSubclassable);
  2482. $core.addMethod(
  2483. $core.method({
  2484. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2485. protocol: "class creation",
  2486. fn: function (aString,aString2,classVars,pools,aString3){
  2487. var self=this,$self=this;
  2488. return $core.withContext(function($ctx1) {
  2489. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2490. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2491. },
  2492. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2493. 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",
  2494. referencedClasses: [],
  2495. pragmas: [],
  2496. messageSends: ["subclass:instanceVariableNames:package:"]
  2497. }),
  2498. $globals.TSubclassable);
  2499. $core.addMethod(
  2500. $core.method({
  2501. selector: "subclass:instanceVariableNames:package:",
  2502. protocol: "class creation",
  2503. fn: function (aString,aString2,aString3){
  2504. var self=this,$self=this;
  2505. return $core.withContext(function($ctx1) {
  2506. return $self._subclass_slots_package_(aString,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2507. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3})});
  2508. },
  2509. args: ["aString", "aString2", "aString3"],
  2510. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2511. referencedClasses: [],
  2512. pragmas: [],
  2513. messageSends: ["subclass:slots:package:", "instanceVariablesStringAsSlotList"]
  2514. }),
  2515. $globals.TSubclassable);
  2516. $core.addMethod(
  2517. $core.method({
  2518. selector: "subclass:slots:",
  2519. protocol: "class creation",
  2520. fn: function (aString,aCollection){
  2521. var self=this,$self=this;
  2522. return $core.withContext(function($ctx1) {
  2523. return $self._subclass_slots_package_(aString,aCollection,nil);
  2524. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:",{aString:aString,aCollection:aCollection})});
  2525. },
  2526. args: ["aString", "aCollection"],
  2527. source: "subclass: aString slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aCollection package: nil",
  2528. referencedClasses: [],
  2529. pragmas: [],
  2530. messageSends: ["subclass:slots:package:"]
  2531. }),
  2532. $globals.TSubclassable);
  2533. $core.addMethod(
  2534. $core.method({
  2535. selector: "subclass:slots:classVariables:package:",
  2536. protocol: "class creation",
  2537. fn: function (aString,aCollection,anObject,anotherString){
  2538. var self=this,$self=this;
  2539. return $core.withContext(function($ctx1) {
  2540. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2541. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherString:anotherString})});
  2542. },
  2543. args: ["aString", "aCollection", "anObject", "anotherString"],
  2544. source: "subclass: aString slots: aCollection classVariables: anObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2545. referencedClasses: ["ClassBuilder"],
  2546. pragmas: [],
  2547. messageSends: ["superclass:subclass:slots:package:", "new"]
  2548. }),
  2549. $globals.TSubclassable);
  2550. $core.addMethod(
  2551. $core.method({
  2552. selector: "subclass:slots:classVariables:poolDictionaries:package:",
  2553. protocol: "class creation",
  2554. fn: function (aString,aCollection,anObject,anotherObject,anotherString){
  2555. var self=this,$self=this;
  2556. return $core.withContext(function($ctx1) {
  2557. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2558. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:poolDictionaries:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherObject:anotherObject,anotherString:anotherString})});
  2559. },
  2560. args: ["aString", "aCollection", "anObject", "anotherObject", "anotherString"],
  2561. source: "subclass: aString slots: aCollection classVariables: anObject poolDictionaries: anotherObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2562. referencedClasses: ["ClassBuilder"],
  2563. pragmas: [],
  2564. messageSends: ["superclass:subclass:slots:package:", "new"]
  2565. }),
  2566. $globals.TSubclassable);
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "subclass:slots:package:",
  2570. protocol: "class creation",
  2571. fn: function (aString,aCollection,anotherString){
  2572. var self=this,$self=this;
  2573. return $core.withContext(function($ctx1) {
  2574. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2575. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:package:",{aString:aString,aCollection:aCollection,anotherString:anotherString})});
  2576. },
  2577. args: ["aString", "aCollection", "anotherString"],
  2578. source: "subclass: aString slots: aCollection package: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2579. referencedClasses: ["ClassBuilder"],
  2580. pragmas: [],
  2581. messageSends: ["superclass:subclass:slots:package:", "new"]
  2582. }),
  2583. $globals.TSubclassable);
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "subclass:uses:",
  2587. protocol: "class creation",
  2588. fn: function (aString,aTraitCompositionDescription){
  2589. var self=this,$self=this;
  2590. return $core.withContext(function($ctx1) {
  2591. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,[],nil);
  2592. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription})});
  2593. },
  2594. args: ["aString", "aTraitCompositionDescription"],
  2595. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: #() package: nil",
  2596. referencedClasses: [],
  2597. pragmas: [],
  2598. messageSends: ["subclass:uses:slots:package:"]
  2599. }),
  2600. $globals.TSubclassable);
  2601. $core.addMethod(
  2602. $core.method({
  2603. selector: "subclass:uses:instanceVariableNames:",
  2604. protocol: "class creation",
  2605. fn: function (aString,aTraitCompositionDescription,anotherString){
  2606. var self=this,$self=this;
  2607. return $core.withContext(function($ctx1) {
  2608. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2609. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString})});
  2610. },
  2611. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2612. 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",
  2613. referencedClasses: [],
  2614. pragmas: [],
  2615. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2616. }),
  2617. $globals.TSubclassable);
  2618. $core.addMethod(
  2619. $core.method({
  2620. selector: "subclass:uses:instanceVariableNames:category:",
  2621. protocol: "class creation",
  2622. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2623. var self=this,$self=this;
  2624. return $core.withContext(function($ctx1) {
  2625. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2626. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2627. },
  2628. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2629. 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",
  2630. referencedClasses: [],
  2631. pragmas: [],
  2632. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2633. }),
  2634. $globals.TSubclassable);
  2635. $core.addMethod(
  2636. $core.method({
  2637. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2638. protocol: "class creation",
  2639. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2640. var self=this,$self=this;
  2641. return $core.withContext(function($ctx1) {
  2642. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2643. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2644. },
  2645. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2646. 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",
  2647. referencedClasses: [],
  2648. pragmas: [],
  2649. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2650. }),
  2651. $globals.TSubclassable);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "subclass:uses:instanceVariableNames:package:",
  2655. protocol: "class creation",
  2656. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2657. var self=this,$self=this;
  2658. return $core.withContext(function($ctx1) {
  2659. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2660. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2661. },
  2662. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2663. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2664. referencedClasses: [],
  2665. pragmas: [],
  2666. messageSends: ["subclass:uses:slots:package:", "instanceVariablesStringAsSlotList"]
  2667. }),
  2668. $globals.TSubclassable);
  2669. $core.addMethod(
  2670. $core.method({
  2671. selector: "subclass:uses:slots:",
  2672. protocol: "class creation",
  2673. fn: function (aString,aTraitCompositionDescription,aCollection){
  2674. var self=this,$self=this;
  2675. return $core.withContext(function($ctx1) {
  2676. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,aCollection,nil);
  2677. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  2678. },
  2679. args: ["aString", "aTraitCompositionDescription", "aCollection"],
  2680. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aCollection package: nil",
  2681. referencedClasses: [],
  2682. pragmas: [],
  2683. messageSends: ["subclass:uses:slots:package:"]
  2684. }),
  2685. $globals.TSubclassable);
  2686. $core.addMethod(
  2687. $core.method({
  2688. selector: "subclass:uses:slots:package:",
  2689. protocol: "class creation",
  2690. fn: function (aString,aTraitCompositionDescription,aCollection,aString3){
  2691. var self=this,$self=this;
  2692. var cls;
  2693. return $core.withContext(function($ctx1) {
  2694. cls=$self._subclass_slots_package_(aString,aCollection,aString3);
  2695. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2696. return cls;
  2697. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,aString3:aString3,cls:cls})});
  2698. },
  2699. args: ["aString", "aTraitCompositionDescription", "aCollection", "aString3"],
  2700. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString slots: aCollection package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2701. referencedClasses: [],
  2702. pragmas: [],
  2703. messageSends: ["subclass:slots:package:", "setTraitComposition:", "asTraitComposition"]
  2704. }),
  2705. $globals.TSubclassable);
  2706. });
  2707. define('amber/core/Kernel-Objects',["amber/boot", "require", "amber/core/Kernel-Helpers"], function($boot,requirejs){"use strict";
  2708. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2709. var $pkg = $core.addPackage("Kernel-Objects");
  2710. $pkg.innerEval = function (expr) { return eval(expr); };
  2711. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2712. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2713. $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.";
  2714. $core.addMethod(
  2715. $core.method({
  2716. selector: "=",
  2717. protocol: "comparing",
  2718. fn: function (anObject){
  2719. var self=this,$self=this;
  2720. return $core.withContext(function($ctx1) {
  2721. return $self.__eq_eq(anObject);
  2722. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  2723. },
  2724. args: ["anObject"],
  2725. source: "= anObject\x0a\x09^ self == anObject",
  2726. referencedClasses: [],
  2727. pragmas: [],
  2728. messageSends: ["=="]
  2729. }),
  2730. $globals.ProtoObject);
  2731. $core.addMethod(
  2732. $core.method({
  2733. selector: "==",
  2734. protocol: "comparing",
  2735. fn: function (anObject){
  2736. var self=this,$self=this;
  2737. return $core.withContext(function($ctx1) {
  2738. return self === anObject;
  2739. return self;
  2740. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  2741. },
  2742. args: ["anObject"],
  2743. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2744. referencedClasses: [],
  2745. pragmas: [["inlineJS:", ["return self === anObject"]]],
  2746. messageSends: []
  2747. }),
  2748. $globals.ProtoObject);
  2749. $core.addMethod(
  2750. $core.method({
  2751. selector: "asString",
  2752. protocol: "converting",
  2753. fn: function (){
  2754. var self=this,$self=this;
  2755. return $core.withContext(function($ctx1) {
  2756. return $self._printString();
  2757. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  2758. },
  2759. args: [],
  2760. source: "asString\x0a\x09^ self printString",
  2761. referencedClasses: [],
  2762. pragmas: [],
  2763. messageSends: ["printString"]
  2764. }),
  2765. $globals.ProtoObject);
  2766. $core.addMethod(
  2767. $core.method({
  2768. selector: "class",
  2769. protocol: "accessing",
  2770. fn: function (){
  2771. var self=this,$self=this;
  2772. return $core.withContext(function($ctx1) {
  2773. return $self.a$cls;
  2774. return self;
  2775. }, function($ctx1) {$ctx1.fill(self,"class",{})});
  2776. },
  2777. args: [],
  2778. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2779. referencedClasses: [],
  2780. pragmas: [["inlineJS:", ["return $self.a$cls"]]],
  2781. messageSends: []
  2782. }),
  2783. $globals.ProtoObject);
  2784. $core.addMethod(
  2785. $core.method({
  2786. selector: "doesNotUnderstand:",
  2787. protocol: "error handling",
  2788. fn: function (aMessage){
  2789. var self=this,$self=this;
  2790. return $core.withContext(function($ctx1) {
  2791. var $1;
  2792. $1=$recv($globals.MessageNotUnderstood)._new();
  2793. $recv($1)._receiver_(self);
  2794. $recv($1)._message_(aMessage);
  2795. $recv($1)._signal();
  2796. return self;
  2797. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  2798. },
  2799. args: ["aMessage"],
  2800. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2801. referencedClasses: ["MessageNotUnderstood"],
  2802. pragmas: [],
  2803. messageSends: ["receiver:", "new", "message:", "signal"]
  2804. }),
  2805. $globals.ProtoObject);
  2806. $core.addMethod(
  2807. $core.method({
  2808. selector: "evaluate:on:",
  2809. protocol: "evaluating",
  2810. fn: function (aString,anEvaluator){
  2811. var self=this,$self=this;
  2812. return $core.withContext(function($ctx1) {
  2813. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2814. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  2815. },
  2816. args: ["aString", "anEvaluator"],
  2817. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2818. referencedClasses: [],
  2819. pragmas: [],
  2820. messageSends: ["evaluate:receiver:"]
  2821. }),
  2822. $globals.ProtoObject);
  2823. $core.addMethod(
  2824. $core.method({
  2825. selector: "identityHash",
  2826. protocol: "accessing",
  2827. fn: function (){
  2828. var self=this,$self=this;
  2829. return $core.withContext(function($ctx1) {
  2830. self._deprecatedAPI();
  2831. var hash=self.identityHash;
  2832. if (hash) return hash;
  2833. hash=$core.nextId();
  2834. Object.defineProperty(self, 'identityHash', {value:hash});
  2835. return hash;
  2836. ;
  2837. return self;
  2838. }, function($ctx1) {$ctx1.fill(self,"identityHash",{})});
  2839. },
  2840. args: [],
  2841. 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'>",
  2842. referencedClasses: [],
  2843. pragmas: [["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"]]],
  2844. messageSends: []
  2845. }),
  2846. $globals.ProtoObject);
  2847. $core.addMethod(
  2848. $core.method({
  2849. selector: "ifNil:",
  2850. protocol: "testing",
  2851. fn: function (aBlock){
  2852. var self=this,$self=this;
  2853. return self;
  2854. },
  2855. args: ["aBlock"],
  2856. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2857. referencedClasses: [],
  2858. pragmas: [],
  2859. messageSends: []
  2860. }),
  2861. $globals.ProtoObject);
  2862. $core.addMethod(
  2863. $core.method({
  2864. selector: "ifNil:ifNotNil:",
  2865. protocol: "testing",
  2866. fn: function (aBlock,anotherBlock){
  2867. var self=this,$self=this;
  2868. return $core.withContext(function($ctx1) {
  2869. return $recv(anotherBlock)._value_(self);
  2870. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2871. },
  2872. args: ["aBlock", "anotherBlock"],
  2873. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2874. referencedClasses: [],
  2875. pragmas: [],
  2876. messageSends: ["value:"]
  2877. }),
  2878. $globals.ProtoObject);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "ifNotNil:",
  2882. protocol: "testing",
  2883. fn: function (aBlock){
  2884. var self=this,$self=this;
  2885. return $core.withContext(function($ctx1) {
  2886. return $recv(aBlock)._value_(self);
  2887. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock})});
  2888. },
  2889. args: ["aBlock"],
  2890. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2891. referencedClasses: [],
  2892. pragmas: [],
  2893. messageSends: ["value:"]
  2894. }),
  2895. $globals.ProtoObject);
  2896. $core.addMethod(
  2897. $core.method({
  2898. selector: "ifNotNil:ifNil:",
  2899. protocol: "testing",
  2900. fn: function (aBlock,anotherBlock){
  2901. var self=this,$self=this;
  2902. return $core.withContext(function($ctx1) {
  2903. return $recv(aBlock)._value_(self);
  2904. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2905. },
  2906. args: ["aBlock", "anotherBlock"],
  2907. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2908. referencedClasses: [],
  2909. pragmas: [],
  2910. messageSends: ["value:"]
  2911. }),
  2912. $globals.ProtoObject);
  2913. $core.addMethod(
  2914. $core.method({
  2915. selector: "initialize",
  2916. protocol: "initialization",
  2917. fn: function (){
  2918. var self=this,$self=this;
  2919. return self;
  2920. },
  2921. args: [],
  2922. source: "initialize",
  2923. referencedClasses: [],
  2924. pragmas: [],
  2925. messageSends: []
  2926. }),
  2927. $globals.ProtoObject);
  2928. $core.addMethod(
  2929. $core.method({
  2930. selector: "inspect",
  2931. protocol: "inspecting",
  2932. fn: function (){
  2933. var self=this,$self=this;
  2934. return $core.withContext(function($ctx1) {
  2935. $recv($globals.Inspector)._inspect_(self);
  2936. return self;
  2937. }, function($ctx1) {$ctx1.fill(self,"inspect",{})});
  2938. },
  2939. args: [],
  2940. source: "inspect\x0a\x09Inspector inspect: self",
  2941. referencedClasses: ["Inspector"],
  2942. pragmas: [],
  2943. messageSends: ["inspect:"]
  2944. }),
  2945. $globals.ProtoObject);
  2946. $core.addMethod(
  2947. $core.method({
  2948. selector: "inspectOn:",
  2949. protocol: "inspecting",
  2950. fn: function (anInspector){
  2951. var self=this,$self=this;
  2952. return self;
  2953. },
  2954. args: ["anInspector"],
  2955. source: "inspectOn: anInspector",
  2956. referencedClasses: [],
  2957. pragmas: [],
  2958. messageSends: []
  2959. }),
  2960. $globals.ProtoObject);
  2961. $core.addMethod(
  2962. $core.method({
  2963. selector: "instVarAt:",
  2964. protocol: "accessing",
  2965. fn: function (aString){
  2966. var self=this,$self=this;
  2967. return $core.withContext(function($ctx1) {
  2968. return $self[aString];
  2969. return self;
  2970. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString})});
  2971. },
  2972. args: ["aString"],
  2973. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[aString]'>",
  2974. referencedClasses: [],
  2975. pragmas: [["inlineJS:", ["return $self[aString]"]]],
  2976. messageSends: []
  2977. }),
  2978. $globals.ProtoObject);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "instVarAt:put:",
  2982. protocol: "accessing",
  2983. fn: function (aString,anObject){
  2984. var self=this,$self=this;
  2985. return $core.withContext(function($ctx1) {
  2986. $self[aString] = anObject;
  2987. return self;
  2988. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject})});
  2989. },
  2990. args: ["aString", "anObject"],
  2991. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[aString] = anObject'>",
  2992. referencedClasses: [],
  2993. pragmas: [["inlineJS:", ["$self[aString] = anObject"]]],
  2994. messageSends: []
  2995. }),
  2996. $globals.ProtoObject);
  2997. $core.addMethod(
  2998. $core.method({
  2999. selector: "isKindOf:",
  3000. protocol: "testing",
  3001. fn: function (aClass){
  3002. var self=this,$self=this;
  3003. return $core.withContext(function($ctx1) {
  3004. var $1;
  3005. $1=$self._isMemberOf_(aClass);
  3006. if($core.assert($1)){
  3007. return true;
  3008. } else {
  3009. return $recv($self._class())._inheritsFrom_(aClass);
  3010. }
  3011. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass})});
  3012. },
  3013. args: ["aClass"],
  3014. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  3015. referencedClasses: [],
  3016. pragmas: [],
  3017. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  3018. }),
  3019. $globals.ProtoObject);
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "isNil",
  3023. protocol: "testing",
  3024. fn: function (){
  3025. var self=this,$self=this;
  3026. return false;
  3027. },
  3028. args: [],
  3029. source: "isNil\x0a\x09^ false",
  3030. referencedClasses: [],
  3031. pragmas: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.ProtoObject);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "notNil",
  3038. protocol: "testing",
  3039. fn: function (){
  3040. var self=this,$self=this;
  3041. return true;
  3042. },
  3043. args: [],
  3044. source: "notNil\x0a\x09^ true",
  3045. referencedClasses: [],
  3046. pragmas: [],
  3047. messageSends: []
  3048. }),
  3049. $globals.ProtoObject);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "perform:",
  3053. protocol: "message handling",
  3054. fn: function (aString){
  3055. var self=this,$self=this;
  3056. return $core.withContext(function($ctx1) {
  3057. return $self._perform_withArguments_(aString,[]);
  3058. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString})});
  3059. },
  3060. args: ["aString"],
  3061. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  3062. referencedClasses: [],
  3063. pragmas: [],
  3064. messageSends: ["perform:withArguments:"]
  3065. }),
  3066. $globals.ProtoObject);
  3067. $core.addMethod(
  3068. $core.method({
  3069. selector: "perform:withArguments:",
  3070. protocol: "message handling",
  3071. fn: function (aString,aCollection){
  3072. var self=this,$self=this;
  3073. return $core.withContext(function($ctx1) {
  3074. return $core.send2(self, aString, aCollection);
  3075. return self;
  3076. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection})});
  3077. },
  3078. args: ["aString", "aCollection"],
  3079. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  3080. referencedClasses: [],
  3081. pragmas: [["inlineJS:", ["return $core.send2(self, aString, aCollection)"]]],
  3082. messageSends: []
  3083. }),
  3084. $globals.ProtoObject);
  3085. $core.addMethod(
  3086. $core.method({
  3087. selector: "printOn:",
  3088. protocol: "printing",
  3089. fn: function (aStream){
  3090. var self=this,$self=this;
  3091. return $core.withContext(function($ctx1) {
  3092. var $5,$4,$3,$2,$1;
  3093. $5=$self._class();
  3094. $ctx1.sendIdx["class"]=1;
  3095. $4=$recv($5)._name();
  3096. $ctx1.sendIdx["name"]=1;
  3097. $3=$recv($4)._first();
  3098. $2=$recv($3)._isVowel();
  3099. if($core.assert($2)){
  3100. $1="an ";
  3101. } else {
  3102. $1="a ";
  3103. }
  3104. $recv(aStream)._nextPutAll_($1);
  3105. $ctx1.sendIdx["nextPutAll:"]=1;
  3106. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3107. return self;
  3108. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  3109. },
  3110. args: ["aStream"],
  3111. 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",
  3112. referencedClasses: [],
  3113. pragmas: [],
  3114. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3115. }),
  3116. $globals.ProtoObject);
  3117. $core.addMethod(
  3118. $core.method({
  3119. selector: "printString",
  3120. protocol: "printing",
  3121. fn: function (){
  3122. var self=this,$self=this;
  3123. return $core.withContext(function($ctx1) {
  3124. return $recv($globals.String)._streamContents_((function(str){
  3125. return $core.withContext(function($ctx2) {
  3126. return $self._printOn_(str);
  3127. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3128. }));
  3129. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  3130. },
  3131. args: [],
  3132. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3133. referencedClasses: ["String"],
  3134. pragmas: [],
  3135. messageSends: ["streamContents:", "printOn:"]
  3136. }),
  3137. $globals.ProtoObject);
  3138. $core.addMethod(
  3139. $core.method({
  3140. selector: "yourself",
  3141. protocol: "accessing",
  3142. fn: function (){
  3143. var self=this,$self=this;
  3144. return self;
  3145. },
  3146. args: [],
  3147. source: "yourself\x0a\x09^ self",
  3148. referencedClasses: [],
  3149. pragmas: [],
  3150. messageSends: []
  3151. }),
  3152. $globals.ProtoObject);
  3153. $core.addMethod(
  3154. $core.method({
  3155. selector: "~=",
  3156. protocol: "comparing",
  3157. fn: function (anObject){
  3158. var self=this,$self=this;
  3159. return $core.withContext(function($ctx1) {
  3160. var $1;
  3161. $1=$recv($self.__eq(anObject)).__eq(false);
  3162. $ctx1.sendIdx["="]=1;
  3163. return $1;
  3164. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject})});
  3165. },
  3166. args: ["anObject"],
  3167. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3168. referencedClasses: [],
  3169. pragmas: [],
  3170. messageSends: ["="]
  3171. }),
  3172. $globals.ProtoObject);
  3173. $core.addMethod(
  3174. $core.method({
  3175. selector: "~~",
  3176. protocol: "comparing",
  3177. fn: function (anObject){
  3178. var self=this,$self=this;
  3179. return $core.withContext(function($ctx1) {
  3180. return $recv($self.__eq_eq(anObject)).__eq(false);
  3181. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject})});
  3182. },
  3183. args: ["anObject"],
  3184. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3185. referencedClasses: [],
  3186. pragmas: [],
  3187. messageSends: ["=", "=="]
  3188. }),
  3189. $globals.ProtoObject);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "initialize",
  3193. protocol: "initialization",
  3194. fn: function (){
  3195. var self=this,$self=this;
  3196. return self;
  3197. },
  3198. args: [],
  3199. source: "initialize",
  3200. referencedClasses: [],
  3201. pragmas: [],
  3202. messageSends: []
  3203. }),
  3204. $globals.ProtoObject.a$cls);
  3205. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3206. $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.";
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "->",
  3210. protocol: "converting",
  3211. fn: function (anObject){
  3212. var self=this,$self=this;
  3213. return $core.withContext(function($ctx1) {
  3214. return $recv($globals.Association)._key_value_(self,anObject);
  3215. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject})});
  3216. },
  3217. args: ["anObject"],
  3218. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3219. referencedClasses: ["Association"],
  3220. pragmas: [],
  3221. messageSends: ["key:value:"]
  3222. }),
  3223. $globals.Object);
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "asJSONString",
  3227. protocol: "converting",
  3228. fn: function (){
  3229. var self=this,$self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3232. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{})});
  3233. },
  3234. args: [],
  3235. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3236. referencedClasses: ["JSON"],
  3237. pragmas: [],
  3238. messageSends: ["stringify:", "asJavaScriptObject"]
  3239. }),
  3240. $globals.Object);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "asJavaScriptObject",
  3244. protocol: "converting",
  3245. fn: function (){
  3246. var self=this,$self=this;
  3247. var variables;
  3248. return $core.withContext(function($ctx1) {
  3249. variables=$recv($globals.HashedCollection)._new();
  3250. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3251. return $core.withContext(function($ctx2) {
  3252. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3254. }));
  3255. return variables;
  3256. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables})});
  3257. },
  3258. args: [],
  3259. 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",
  3260. referencedClasses: ["HashedCollection"],
  3261. pragmas: [],
  3262. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3263. }),
  3264. $globals.Object);
  3265. $core.addMethod(
  3266. $core.method({
  3267. selector: "asJavaScriptSource",
  3268. protocol: "converting",
  3269. fn: function (){
  3270. var self=this,$self=this;
  3271. return $core.withContext(function($ctx1) {
  3272. return $self._asString();
  3273. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3274. },
  3275. args: [],
  3276. source: "asJavaScriptSource\x0a\x09^ self asString",
  3277. referencedClasses: [],
  3278. pragmas: [],
  3279. messageSends: ["asString"]
  3280. }),
  3281. $globals.Object);
  3282. $core.addMethod(
  3283. $core.method({
  3284. selector: "basicAt:",
  3285. protocol: "accessing",
  3286. fn: function (aString){
  3287. var self=this,$self=this;
  3288. return $core.withContext(function($ctx1) {
  3289. return self[aString];
  3290. return self;
  3291. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString})});
  3292. },
  3293. args: ["aString"],
  3294. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3295. referencedClasses: [],
  3296. pragmas: [["inlineJS:", ["return self[aString]"]]],
  3297. messageSends: []
  3298. }),
  3299. $globals.Object);
  3300. $core.addMethod(
  3301. $core.method({
  3302. selector: "basicAt:put:",
  3303. protocol: "accessing",
  3304. fn: function (aString,anObject){
  3305. var self=this,$self=this;
  3306. return $core.withContext(function($ctx1) {
  3307. return self[aString] = anObject;
  3308. return self;
  3309. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject})});
  3310. },
  3311. args: ["aString", "anObject"],
  3312. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3313. referencedClasses: [],
  3314. pragmas: [["inlineJS:", ["return self[aString] = anObject"]]],
  3315. messageSends: []
  3316. }),
  3317. $globals.Object);
  3318. $core.addMethod(
  3319. $core.method({
  3320. selector: "basicDelete:",
  3321. protocol: "accessing",
  3322. fn: function (aString){
  3323. var self=this,$self=this;
  3324. return $core.withContext(function($ctx1) {
  3325. delete self[aString]; return aString;
  3326. return self;
  3327. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString})});
  3328. },
  3329. args: ["aString"],
  3330. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3331. referencedClasses: [],
  3332. pragmas: [["inlineJS:", ["delete self[aString]; return aString"]]],
  3333. messageSends: []
  3334. }),
  3335. $globals.Object);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: "basicPerform:",
  3339. protocol: "message handling",
  3340. fn: function (aString){
  3341. var self=this,$self=this;
  3342. return $core.withContext(function($ctx1) {
  3343. return $self._basicPerform_withArguments_(aString,[]);
  3344. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString})});
  3345. },
  3346. args: ["aString"],
  3347. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3348. referencedClasses: [],
  3349. pragmas: [],
  3350. messageSends: ["basicPerform:withArguments:"]
  3351. }),
  3352. $globals.Object);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "basicPerform:withArguments:",
  3356. protocol: "message handling",
  3357. fn: function (aString,aCollection){
  3358. var self=this,$self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. return self[aString].apply(self, aCollection);;
  3361. return self;
  3362. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection})});
  3363. },
  3364. args: ["aString", "aCollection"],
  3365. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3366. referencedClasses: [],
  3367. pragmas: [["inlineJS:", ["return self[aString].apply(self, aCollection);"]]],
  3368. messageSends: []
  3369. }),
  3370. $globals.Object);
  3371. $core.addMethod(
  3372. $core.method({
  3373. selector: "browse",
  3374. protocol: "browsing",
  3375. fn: function (){
  3376. var self=this,$self=this;
  3377. return $core.withContext(function($ctx1) {
  3378. $recv($globals.Finder)._findClass_($self._class());
  3379. return self;
  3380. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  3381. },
  3382. args: [],
  3383. source: "browse\x0a\x09Finder findClass: self class",
  3384. referencedClasses: ["Finder"],
  3385. pragmas: [],
  3386. messageSends: ["findClass:", "class"]
  3387. }),
  3388. $globals.Object);
  3389. $core.addMethod(
  3390. $core.method({
  3391. selector: "copy",
  3392. protocol: "copying",
  3393. fn: function (){
  3394. var self=this,$self=this;
  3395. return $core.withContext(function($ctx1) {
  3396. return $recv($self._shallowCopy())._postCopy();
  3397. }, function($ctx1) {$ctx1.fill(self,"copy",{})});
  3398. },
  3399. args: [],
  3400. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3401. referencedClasses: [],
  3402. pragmas: [],
  3403. messageSends: ["postCopy", "shallowCopy"]
  3404. }),
  3405. $globals.Object);
  3406. $core.addMethod(
  3407. $core.method({
  3408. selector: "deepCopy",
  3409. protocol: "copying",
  3410. fn: function (){
  3411. var self=this,$self=this;
  3412. return $core.withContext(function($ctx1) {
  3413. var copy = self.a$cls._new();
  3414. Object.keys(self).forEach(function (i) {
  3415. copy[i] = $recv(self[i])._deepCopy();
  3416. });
  3417. return copy;
  3418. ;
  3419. return self;
  3420. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  3421. },
  3422. args: [],
  3423. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3424. referencedClasses: [],
  3425. pragmas: [["inlineJS:", ["\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09"]]],
  3426. messageSends: []
  3427. }),
  3428. $globals.Object);
  3429. $core.addMethod(
  3430. $core.method({
  3431. selector: "deprecatedAPI",
  3432. protocol: "error handling",
  3433. fn: function (){
  3434. var self=this,$self=this;
  3435. return $core.withContext(function($ctx1) {
  3436. var $1,$6,$5,$4,$8,$7,$3,$2;
  3437. $1=console;
  3438. $6=$core.getThisContext()._home();
  3439. $ctx1.sendIdx["home"]=1;
  3440. $5=$recv($6)._asString();
  3441. $ctx1.sendIdx["asString"]=1;
  3442. $4=$recv($5).__comma(" is deprecated! (in ");
  3443. $8=$recv($core.getThisContext()._home())._home();
  3444. $ctx1.sendIdx["home"]=2;
  3445. $7=$recv($8)._asString();
  3446. $3=$recv($4).__comma($7);
  3447. $ctx1.sendIdx[","]=2;
  3448. $2=$recv($3).__comma(")");
  3449. $ctx1.sendIdx[","]=1;
  3450. $recv($1)._warn_($2);
  3451. return self;
  3452. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{})});
  3453. },
  3454. args: [],
  3455. 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, ')'.",
  3456. referencedClasses: [],
  3457. pragmas: [],
  3458. messageSends: ["warn:", ",", "asString", "home"]
  3459. }),
  3460. $globals.Object);
  3461. $core.addMethod(
  3462. $core.method({
  3463. selector: "deprecatedAPI:",
  3464. protocol: "error handling",
  3465. fn: function (aString){
  3466. var self=this,$self=this;
  3467. return $core.withContext(function($ctx1) {
  3468. var $1,$6,$5,$4,$8,$7,$3,$2;
  3469. $1=console;
  3470. $6=$core.getThisContext()._home();
  3471. $ctx1.sendIdx["home"]=1;
  3472. $5=$recv($6)._asString();
  3473. $ctx1.sendIdx["asString"]=1;
  3474. $4=$recv($5).__comma(" is deprecated! (in ");
  3475. $8=$recv($core.getThisContext()._home())._home();
  3476. $ctx1.sendIdx["home"]=2;
  3477. $7=$recv($8)._asString();
  3478. $3=$recv($4).__comma($7);
  3479. $ctx1.sendIdx[","]=2;
  3480. $2=$recv($3).__comma(")");
  3481. $ctx1.sendIdx[","]=1;
  3482. $recv($1)._warn_($2);
  3483. $ctx1.sendIdx["warn:"]=1;
  3484. $recv(console)._warn_(aString);
  3485. return self;
  3486. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString})});
  3487. },
  3488. args: ["aString"],
  3489. 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",
  3490. referencedClasses: [],
  3491. pragmas: [],
  3492. messageSends: ["warn:", ",", "asString", "home"]
  3493. }),
  3494. $globals.Object);
  3495. $core.addMethod(
  3496. $core.method({
  3497. selector: "error:",
  3498. protocol: "error handling",
  3499. fn: function (aString){
  3500. var self=this,$self=this;
  3501. return $core.withContext(function($ctx1) {
  3502. $recv($globals.Error)._signal_(aString);
  3503. return self;
  3504. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString})});
  3505. },
  3506. args: ["aString"],
  3507. source: "error: aString\x0a\x09Error signal: aString",
  3508. referencedClasses: ["Error"],
  3509. pragmas: [],
  3510. messageSends: ["signal:"]
  3511. }),
  3512. $globals.Object);
  3513. $core.addMethod(
  3514. $core.method({
  3515. selector: "halt",
  3516. protocol: "error handling",
  3517. fn: function (){
  3518. var self=this,$self=this;
  3519. return $core.withContext(function($ctx1) {
  3520. $recv($globals.Halt)._signal();
  3521. return self;
  3522. }, function($ctx1) {$ctx1.fill(self,"halt",{})});
  3523. },
  3524. args: [],
  3525. source: "halt\x0a\x09Halt signal",
  3526. referencedClasses: ["Halt"],
  3527. pragmas: [],
  3528. messageSends: ["signal"]
  3529. }),
  3530. $globals.Object);
  3531. $core.addMethod(
  3532. $core.method({
  3533. selector: "in:",
  3534. protocol: "evaluating",
  3535. fn: function (aValuable){
  3536. var self=this,$self=this;
  3537. return $core.withContext(function($ctx1) {
  3538. return $recv(aValuable)._value_(self);
  3539. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  3540. },
  3541. args: ["aValuable"],
  3542. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3543. referencedClasses: [],
  3544. pragmas: [],
  3545. messageSends: ["value:"]
  3546. }),
  3547. $globals.Object);
  3548. $core.addMethod(
  3549. $core.method({
  3550. selector: "isBehavior",
  3551. protocol: "testing",
  3552. fn: function (){
  3553. var self=this,$self=this;
  3554. return false;
  3555. },
  3556. args: [],
  3557. source: "isBehavior\x0a\x09^ false",
  3558. referencedClasses: [],
  3559. pragmas: [],
  3560. messageSends: []
  3561. }),
  3562. $globals.Object);
  3563. $core.addMethod(
  3564. $core.method({
  3565. selector: "isBoolean",
  3566. protocol: "testing",
  3567. fn: function (){
  3568. var self=this,$self=this;
  3569. return false;
  3570. },
  3571. args: [],
  3572. source: "isBoolean\x0a\x09^ false",
  3573. referencedClasses: [],
  3574. pragmas: [],
  3575. messageSends: []
  3576. }),
  3577. $globals.Object);
  3578. $core.addMethod(
  3579. $core.method({
  3580. selector: "isClass",
  3581. protocol: "testing",
  3582. fn: function (){
  3583. var self=this,$self=this;
  3584. return false;
  3585. },
  3586. args: [],
  3587. source: "isClass\x0a\x09^ false",
  3588. referencedClasses: [],
  3589. pragmas: [],
  3590. messageSends: []
  3591. }),
  3592. $globals.Object);
  3593. $core.addMethod(
  3594. $core.method({
  3595. selector: "isCompiledMethod",
  3596. protocol: "testing",
  3597. fn: function (){
  3598. var self=this,$self=this;
  3599. return false;
  3600. },
  3601. args: [],
  3602. source: "isCompiledMethod\x0a\x09^ false",
  3603. referencedClasses: [],
  3604. pragmas: [],
  3605. messageSends: []
  3606. }),
  3607. $globals.Object);
  3608. $core.addMethod(
  3609. $core.method({
  3610. selector: "isImmutable",
  3611. protocol: "testing",
  3612. fn: function (){
  3613. var self=this,$self=this;
  3614. return false;
  3615. },
  3616. args: [],
  3617. source: "isImmutable\x0a\x09^ false",
  3618. referencedClasses: [],
  3619. pragmas: [],
  3620. messageSends: []
  3621. }),
  3622. $globals.Object);
  3623. $core.addMethod(
  3624. $core.method({
  3625. selector: "isMemberOf:",
  3626. protocol: "testing",
  3627. fn: function (aClass){
  3628. var self=this,$self=this;
  3629. return $core.withContext(function($ctx1) {
  3630. return $recv($self._class()).__eq(aClass);
  3631. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass})});
  3632. },
  3633. args: ["aClass"],
  3634. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3635. referencedClasses: [],
  3636. pragmas: [],
  3637. messageSends: ["=", "class"]
  3638. }),
  3639. $globals.Object);
  3640. $core.addMethod(
  3641. $core.method({
  3642. selector: "isMetaclass",
  3643. protocol: "testing",
  3644. fn: function (){
  3645. var self=this,$self=this;
  3646. return false;
  3647. },
  3648. args: [],
  3649. source: "isMetaclass\x0a\x09^ false",
  3650. referencedClasses: [],
  3651. pragmas: [],
  3652. messageSends: []
  3653. }),
  3654. $globals.Object);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "isNumber",
  3658. protocol: "testing",
  3659. fn: function (){
  3660. var self=this,$self=this;
  3661. return false;
  3662. },
  3663. args: [],
  3664. source: "isNumber\x0a\x09^ false",
  3665. referencedClasses: [],
  3666. pragmas: [],
  3667. messageSends: []
  3668. }),
  3669. $globals.Object);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "isPackage",
  3673. protocol: "testing",
  3674. fn: function (){
  3675. var self=this,$self=this;
  3676. return false;
  3677. },
  3678. args: [],
  3679. source: "isPackage\x0a\x09^ false",
  3680. referencedClasses: [],
  3681. pragmas: [],
  3682. messageSends: []
  3683. }),
  3684. $globals.Object);
  3685. $core.addMethod(
  3686. $core.method({
  3687. selector: "isParseFailure",
  3688. protocol: "testing",
  3689. fn: function (){
  3690. var self=this,$self=this;
  3691. return false;
  3692. },
  3693. args: [],
  3694. source: "isParseFailure\x0a\x09^ false",
  3695. referencedClasses: [],
  3696. pragmas: [],
  3697. messageSends: []
  3698. }),
  3699. $globals.Object);
  3700. $core.addMethod(
  3701. $core.method({
  3702. selector: "isString",
  3703. protocol: "testing",
  3704. fn: function (){
  3705. var self=this,$self=this;
  3706. return false;
  3707. },
  3708. args: [],
  3709. source: "isString\x0a\x09^ false",
  3710. referencedClasses: [],
  3711. pragmas: [],
  3712. messageSends: []
  3713. }),
  3714. $globals.Object);
  3715. $core.addMethod(
  3716. $core.method({
  3717. selector: "isSymbol",
  3718. protocol: "testing",
  3719. fn: function (){
  3720. var self=this,$self=this;
  3721. return false;
  3722. },
  3723. args: [],
  3724. source: "isSymbol\x0a\x09^ false",
  3725. referencedClasses: [],
  3726. pragmas: [],
  3727. messageSends: []
  3728. }),
  3729. $globals.Object);
  3730. $core.addMethod(
  3731. $core.method({
  3732. selector: "postCopy",
  3733. protocol: "copying",
  3734. fn: function (){
  3735. var self=this,$self=this;
  3736. return self;
  3737. },
  3738. args: [],
  3739. source: "postCopy",
  3740. referencedClasses: [],
  3741. pragmas: [],
  3742. messageSends: []
  3743. }),
  3744. $globals.Object);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "putOn:",
  3748. protocol: "streaming",
  3749. fn: function (aStream){
  3750. var self=this,$self=this;
  3751. return $core.withContext(function($ctx1) {
  3752. $recv(aStream)._nextPut_(self);
  3753. return self;
  3754. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  3755. },
  3756. args: ["aStream"],
  3757. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3758. referencedClasses: [],
  3759. pragmas: [],
  3760. messageSends: ["nextPut:"]
  3761. }),
  3762. $globals.Object);
  3763. $core.addMethod(
  3764. $core.method({
  3765. selector: "respondsTo:",
  3766. protocol: "testing",
  3767. fn: function (aSelector){
  3768. var self=this,$self=this;
  3769. return $core.withContext(function($ctx1) {
  3770. return $recv($self._class())._canUnderstand_(aSelector);
  3771. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector})});
  3772. },
  3773. args: ["aSelector"],
  3774. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3775. referencedClasses: [],
  3776. pragmas: [],
  3777. messageSends: ["canUnderstand:", "class"]
  3778. }),
  3779. $globals.Object);
  3780. $core.addMethod(
  3781. $core.method({
  3782. selector: "shallowCopy",
  3783. protocol: "copying",
  3784. fn: function (){
  3785. var self=this,$self=this;
  3786. return $core.withContext(function($ctx1) {
  3787. var copy = self.a$cls._new();
  3788. Object.keys(self).forEach(function(i) {
  3789. copy[i] = self[i];
  3790. });
  3791. return copy;
  3792. ;
  3793. return self;
  3794. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  3795. },
  3796. args: [],
  3797. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3798. referencedClasses: [],
  3799. pragmas: [["inlineJS:", ["\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09"]]],
  3800. messageSends: []
  3801. }),
  3802. $globals.Object);
  3803. $core.addMethod(
  3804. $core.method({
  3805. selector: "shouldNotImplement",
  3806. protocol: "error handling",
  3807. fn: function (){
  3808. var self=this,$self=this;
  3809. return $core.withContext(function($ctx1) {
  3810. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3811. return self;
  3812. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{})});
  3813. },
  3814. args: [],
  3815. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3816. referencedClasses: [],
  3817. pragmas: [],
  3818. messageSends: ["error:", ",", "name", "class"]
  3819. }),
  3820. $globals.Object);
  3821. $core.addMethod(
  3822. $core.method({
  3823. selector: "size",
  3824. protocol: "accessing",
  3825. fn: function (){
  3826. var self=this,$self=this;
  3827. return $core.withContext(function($ctx1) {
  3828. $self._error_("Object not indexable");
  3829. return self;
  3830. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  3831. },
  3832. args: [],
  3833. source: "size\x0a\x09self error: 'Object not indexable'",
  3834. referencedClasses: [],
  3835. pragmas: [],
  3836. messageSends: ["error:"]
  3837. }),
  3838. $globals.Object);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "subclassResponsibility",
  3842. protocol: "error handling",
  3843. fn: function (){
  3844. var self=this,$self=this;
  3845. return $core.withContext(function($ctx1) {
  3846. $self._error_("This method is a responsibility of a subclass");
  3847. return self;
  3848. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{})});
  3849. },
  3850. args: [],
  3851. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3852. referencedClasses: [],
  3853. pragmas: [],
  3854. messageSends: ["error:"]
  3855. }),
  3856. $globals.Object);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "value",
  3860. protocol: "evaluating",
  3861. fn: function (){
  3862. var self=this,$self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self.valueOf();
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  3867. },
  3868. args: [],
  3869. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3870. referencedClasses: [],
  3871. pragmas: [["inlineJS:", ["return self.valueOf()"]]],
  3872. messageSends: []
  3873. }),
  3874. $globals.Object);
  3875. $core.addMethod(
  3876. $core.method({
  3877. selector: "accessorProtocolWith:",
  3878. protocol: "helios",
  3879. fn: function (aGenerator){
  3880. var self=this,$self=this;
  3881. return $core.withContext(function($ctx1) {
  3882. $recv(aGenerator)._accessorProtocolForObject();
  3883. return self;
  3884. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator})});
  3885. },
  3886. args: ["aGenerator"],
  3887. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3888. referencedClasses: [],
  3889. pragmas: [],
  3890. messageSends: ["accessorProtocolForObject"]
  3891. }),
  3892. $globals.Object.a$cls);
  3893. $core.addMethod(
  3894. $core.method({
  3895. selector: "accessorsSourceCodesWith:",
  3896. protocol: "helios",
  3897. fn: function (aGenerator){
  3898. var self=this,$self=this;
  3899. return $core.withContext(function($ctx1) {
  3900. $recv(aGenerator)._accessorsForObject();
  3901. return self;
  3902. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator})});
  3903. },
  3904. args: ["aGenerator"],
  3905. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3906. referencedClasses: [],
  3907. pragmas: [],
  3908. messageSends: ["accessorsForObject"]
  3909. }),
  3910. $globals.Object.a$cls);
  3911. $core.addMethod(
  3912. $core.method({
  3913. selector: "initialize",
  3914. protocol: "initialization",
  3915. fn: function (){
  3916. var self=this,$self=this;
  3917. return self;
  3918. },
  3919. args: [],
  3920. source: "initialize\x0a\x09\x22no op\x22",
  3921. referencedClasses: [],
  3922. pragmas: [],
  3923. messageSends: []
  3924. }),
  3925. $globals.Object.a$cls);
  3926. $core.addMethod(
  3927. $core.method({
  3928. selector: "initializeProtocolWith:",
  3929. protocol: "helios",
  3930. fn: function (aGenerator){
  3931. var self=this,$self=this;
  3932. return $core.withContext(function($ctx1) {
  3933. $recv(aGenerator)._initializeProtocolForObject();
  3934. return self;
  3935. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator})});
  3936. },
  3937. args: ["aGenerator"],
  3938. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3939. referencedClasses: [],
  3940. pragmas: [],
  3941. messageSends: ["initializeProtocolForObject"]
  3942. }),
  3943. $globals.Object.a$cls);
  3944. $core.addMethod(
  3945. $core.method({
  3946. selector: "initializeSourceCodesWith:",
  3947. protocol: "helios",
  3948. fn: function (aGenerator){
  3949. var self=this,$self=this;
  3950. return $core.withContext(function($ctx1) {
  3951. $recv(aGenerator)._initializeForObject();
  3952. return self;
  3953. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator})});
  3954. },
  3955. args: ["aGenerator"],
  3956. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3957. referencedClasses: [],
  3958. pragmas: [],
  3959. messageSends: ["initializeForObject"]
  3960. }),
  3961. $globals.Object.a$cls);
  3962. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3963. $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: [ ... ]";
  3964. $core.addMethod(
  3965. $core.method({
  3966. selector: "&",
  3967. protocol: "controlling",
  3968. fn: function (aBoolean){
  3969. var self=this,$self=this;
  3970. return $core.withContext(function($ctx1) {
  3971. if(self == true) {
  3972. return aBoolean;
  3973. } else {
  3974. return false;
  3975. }
  3976. ;
  3977. return self;
  3978. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean})});
  3979. },
  3980. args: ["aBoolean"],
  3981. 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'>",
  3982. referencedClasses: [],
  3983. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09"]]],
  3984. messageSends: []
  3985. }),
  3986. $globals.Boolean);
  3987. $core.addMethod(
  3988. $core.method({
  3989. selector: "==",
  3990. protocol: "comparing",
  3991. fn: function (aBoolean){
  3992. var self=this,$self=this;
  3993. return $core.withContext(function($ctx1) {
  3994. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3995. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3996. else return false;;
  3997. return self;
  3998. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean})});
  3999. },
  4000. args: ["aBoolean"],
  4001. 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'>",
  4002. referencedClasses: [],
  4003. pragmas: [["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;"]]],
  4004. messageSends: []
  4005. }),
  4006. $globals.Boolean);
  4007. $core.addMethod(
  4008. $core.method({
  4009. selector: "and:",
  4010. protocol: "controlling",
  4011. fn: function (aBlock){
  4012. var self=this,$self=this;
  4013. return $core.withContext(function($ctx1) {
  4014. if($core.assert(self)){
  4015. return $recv(aBlock)._value();
  4016. } else {
  4017. return false;
  4018. }
  4019. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock})});
  4020. },
  4021. args: ["aBlock"],
  4022. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  4023. referencedClasses: [],
  4024. pragmas: [],
  4025. messageSends: ["ifTrue:ifFalse:", "value"]
  4026. }),
  4027. $globals.Boolean);
  4028. $core.addMethod(
  4029. $core.method({
  4030. selector: "asBit",
  4031. protocol: "converting",
  4032. fn: function (){
  4033. var self=this,$self=this;
  4034. return $core.withContext(function($ctx1) {
  4035. if($core.assert(self)){
  4036. return (1);
  4037. } else {
  4038. return (0);
  4039. }
  4040. }, function($ctx1) {$ctx1.fill(self,"asBit",{})});
  4041. },
  4042. args: [],
  4043. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  4044. referencedClasses: [],
  4045. pragmas: [],
  4046. messageSends: ["ifTrue:ifFalse:"]
  4047. }),
  4048. $globals.Boolean);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "asJavaScriptObject",
  4052. protocol: "converting",
  4053. fn: function (){
  4054. var self=this,$self=this;
  4055. return self;
  4056. },
  4057. args: [],
  4058. source: "asJavaScriptObject\x0a\x09^ self",
  4059. referencedClasses: [],
  4060. pragmas: [],
  4061. messageSends: []
  4062. }),
  4063. $globals.Boolean);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "asString",
  4067. protocol: "converting",
  4068. fn: function (){
  4069. var self=this,$self=this;
  4070. return $core.withContext(function($ctx1) {
  4071. return self.toString();
  4072. return self;
  4073. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  4074. },
  4075. args: [],
  4076. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4077. referencedClasses: [],
  4078. pragmas: [["inlineJS:", ["return self.toString()"]]],
  4079. messageSends: []
  4080. }),
  4081. $globals.Boolean);
  4082. $core.addMethod(
  4083. $core.method({
  4084. selector: "deepCopy",
  4085. protocol: "copying",
  4086. fn: function (){
  4087. var self=this,$self=this;
  4088. return self;
  4089. },
  4090. args: [],
  4091. source: "deepCopy\x0a\x09^ self",
  4092. referencedClasses: [],
  4093. pragmas: [],
  4094. messageSends: []
  4095. }),
  4096. $globals.Boolean);
  4097. $core.addMethod(
  4098. $core.method({
  4099. selector: "ifFalse:",
  4100. protocol: "controlling",
  4101. fn: function (aBlock){
  4102. var self=this,$self=this;
  4103. return $core.withContext(function($ctx1) {
  4104. return $self._ifTrue_ifFalse_((function(){
  4105. }),aBlock);
  4106. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock})});
  4107. },
  4108. args: ["aBlock"],
  4109. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  4110. referencedClasses: [],
  4111. pragmas: [],
  4112. messageSends: ["ifTrue:ifFalse:"]
  4113. }),
  4114. $globals.Boolean);
  4115. $core.addMethod(
  4116. $core.method({
  4117. selector: "ifFalse:ifTrue:",
  4118. protocol: "controlling",
  4119. fn: function (aBlock,anotherBlock){
  4120. var self=this,$self=this;
  4121. return $core.withContext(function($ctx1) {
  4122. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  4123. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4124. },
  4125. args: ["aBlock", "anotherBlock"],
  4126. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  4127. referencedClasses: [],
  4128. pragmas: [],
  4129. messageSends: ["ifTrue:ifFalse:"]
  4130. }),
  4131. $globals.Boolean);
  4132. $core.addMethod(
  4133. $core.method({
  4134. selector: "ifTrue:",
  4135. protocol: "controlling",
  4136. fn: function (aBlock){
  4137. var self=this,$self=this;
  4138. return $core.withContext(function($ctx1) {
  4139. return $self._ifTrue_ifFalse_(aBlock,(function(){
  4140. }));
  4141. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock})});
  4142. },
  4143. args: ["aBlock"],
  4144. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  4145. referencedClasses: [],
  4146. pragmas: [],
  4147. messageSends: ["ifTrue:ifFalse:"]
  4148. }),
  4149. $globals.Boolean);
  4150. $core.addMethod(
  4151. $core.method({
  4152. selector: "ifTrue:ifFalse:",
  4153. protocol: "controlling",
  4154. fn: function (aBlock,anotherBlock){
  4155. var self=this,$self=this;
  4156. return $core.withContext(function($ctx1) {
  4157. if(self == true) {
  4158. return aBlock._value();
  4159. } else {
  4160. return anotherBlock._value();
  4161. }
  4162. ;
  4163. return self;
  4164. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4165. },
  4166. args: ["aBlock", "anotherBlock"],
  4167. 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'>",
  4168. referencedClasses: [],
  4169. pragmas: [["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"]]],
  4170. messageSends: []
  4171. }),
  4172. $globals.Boolean);
  4173. $core.addMethod(
  4174. $core.method({
  4175. selector: "isBoolean",
  4176. protocol: "testing",
  4177. fn: function (){
  4178. var self=this,$self=this;
  4179. return true;
  4180. },
  4181. args: [],
  4182. source: "isBoolean\x0a\x09^ true",
  4183. referencedClasses: [],
  4184. pragmas: [],
  4185. messageSends: []
  4186. }),
  4187. $globals.Boolean);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "isImmutable",
  4191. protocol: "testing",
  4192. fn: function (){
  4193. var self=this,$self=this;
  4194. return true;
  4195. },
  4196. args: [],
  4197. source: "isImmutable\x0a\x09^ true",
  4198. referencedClasses: [],
  4199. pragmas: [],
  4200. messageSends: []
  4201. }),
  4202. $globals.Boolean);
  4203. $core.addMethod(
  4204. $core.method({
  4205. selector: "not",
  4206. protocol: "controlling",
  4207. fn: function (){
  4208. var self=this,$self=this;
  4209. return $core.withContext(function($ctx1) {
  4210. return $self.__eq(false);
  4211. }, function($ctx1) {$ctx1.fill(self,"not",{})});
  4212. },
  4213. args: [],
  4214. source: "not\x0a\x09^ self = false",
  4215. referencedClasses: [],
  4216. pragmas: [],
  4217. messageSends: ["="]
  4218. }),
  4219. $globals.Boolean);
  4220. $core.addMethod(
  4221. $core.method({
  4222. selector: "or:",
  4223. protocol: "controlling",
  4224. fn: function (aBlock){
  4225. var self=this,$self=this;
  4226. return $core.withContext(function($ctx1) {
  4227. if($core.assert(self)){
  4228. return true;
  4229. } else {
  4230. return $recv(aBlock)._value();
  4231. }
  4232. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock})});
  4233. },
  4234. args: ["aBlock"],
  4235. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4236. referencedClasses: [],
  4237. pragmas: [],
  4238. messageSends: ["ifTrue:ifFalse:", "value"]
  4239. }),
  4240. $globals.Boolean);
  4241. $core.addMethod(
  4242. $core.method({
  4243. selector: "printOn:",
  4244. protocol: "printing",
  4245. fn: function (aStream){
  4246. var self=this,$self=this;
  4247. return $core.withContext(function($ctx1) {
  4248. $recv(aStream)._nextPutAll_($self._asString());
  4249. return self;
  4250. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4251. },
  4252. args: ["aStream"],
  4253. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4254. referencedClasses: [],
  4255. pragmas: [],
  4256. messageSends: ["nextPutAll:", "asString"]
  4257. }),
  4258. $globals.Boolean);
  4259. $core.addMethod(
  4260. $core.method({
  4261. selector: "shallowCopy",
  4262. protocol: "copying",
  4263. fn: function (){
  4264. var self=this,$self=this;
  4265. return self;
  4266. },
  4267. args: [],
  4268. source: "shallowCopy\x0a\x09^ self",
  4269. referencedClasses: [],
  4270. pragmas: [],
  4271. messageSends: []
  4272. }),
  4273. $globals.Boolean);
  4274. $core.addMethod(
  4275. $core.method({
  4276. selector: "|",
  4277. protocol: "controlling",
  4278. fn: function (aBoolean){
  4279. var self=this,$self=this;
  4280. return $core.withContext(function($ctx1) {
  4281. if(self == true) {
  4282. return true;
  4283. } else {
  4284. return aBoolean;
  4285. }
  4286. ;
  4287. return self;
  4288. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean})});
  4289. },
  4290. args: ["aBoolean"],
  4291. 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'>",
  4292. referencedClasses: [],
  4293. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09"]]],
  4294. messageSends: []
  4295. }),
  4296. $globals.Boolean);
  4297. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4298. $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.).";
  4299. $core.addMethod(
  4300. $core.method({
  4301. selector: "+",
  4302. protocol: "arithmetic",
  4303. fn: function (aNumber){
  4304. var self=this,$self=this;
  4305. return $core.withContext(function($ctx1) {
  4306. return new Date($self.getTime() + aNumber);
  4307. return self;
  4308. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  4309. },
  4310. args: ["aNumber"],
  4311. source: "+ aNumber\x0a\x09<inlineJS: 'return new Date($self.getTime() + aNumber)'>",
  4312. referencedClasses: [],
  4313. pragmas: [["inlineJS:", ["return new Date($self.getTime() + aNumber)"]]],
  4314. messageSends: []
  4315. }),
  4316. $globals.Date);
  4317. $core.addMethod(
  4318. $core.method({
  4319. selector: "-",
  4320. protocol: "arithmetic",
  4321. fn: function (aDate){
  4322. var self=this,$self=this;
  4323. return $core.withContext(function($ctx1) {
  4324. return self - aDate;
  4325. return self;
  4326. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate})});
  4327. },
  4328. args: ["aDate"],
  4329. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4330. referencedClasses: [],
  4331. pragmas: [["inlineJS:", ["return self - aDate"]]],
  4332. messageSends: []
  4333. }),
  4334. $globals.Date);
  4335. $core.addMethod(
  4336. $core.method({
  4337. selector: "<",
  4338. protocol: "comparing",
  4339. fn: function (aDate){
  4340. var self=this,$self=this;
  4341. return $core.withContext(function($ctx1) {
  4342. return self < aDate;
  4343. return self;
  4344. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate})});
  4345. },
  4346. args: ["aDate"],
  4347. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4348. referencedClasses: [],
  4349. pragmas: [["inlineJS:", ["return self < aDate"]]],
  4350. messageSends: []
  4351. }),
  4352. $globals.Date);
  4353. $core.addMethod(
  4354. $core.method({
  4355. selector: "<=",
  4356. protocol: "comparing",
  4357. fn: function (aDate){
  4358. var self=this,$self=this;
  4359. return $core.withContext(function($ctx1) {
  4360. return self <= aDate;
  4361. return self;
  4362. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate})});
  4363. },
  4364. args: ["aDate"],
  4365. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4366. referencedClasses: [],
  4367. pragmas: [["inlineJS:", ["return self <= aDate"]]],
  4368. messageSends: []
  4369. }),
  4370. $globals.Date);
  4371. $core.addMethod(
  4372. $core.method({
  4373. selector: "=",
  4374. protocol: "comparing",
  4375. fn: function (aDate){
  4376. var self=this,$self=this;
  4377. return $core.withContext(function($ctx1) {
  4378. var $2,$1,$3;
  4379. $2=$recv(aDate)._class();
  4380. $ctx1.sendIdx["class"]=1;
  4381. $1=$recv($2).__eq_eq($self._class());
  4382. $ctx1.sendIdx["=="]=1;
  4383. return $recv($1)._and_((function(){
  4384. return $core.withContext(function($ctx2) {
  4385. $3=$self._asMilliseconds();
  4386. $ctx2.sendIdx["asMilliseconds"]=1;
  4387. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4389. }));
  4390. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate})});
  4391. },
  4392. args: ["aDate"],
  4393. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4394. referencedClasses: [],
  4395. pragmas: [],
  4396. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4397. }),
  4398. $globals.Date);
  4399. $core.addMethod(
  4400. $core.method({
  4401. selector: ">",
  4402. protocol: "comparing",
  4403. fn: function (aDate){
  4404. var self=this,$self=this;
  4405. return $core.withContext(function($ctx1) {
  4406. return self > aDate;
  4407. return self;
  4408. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate})});
  4409. },
  4410. args: ["aDate"],
  4411. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4412. referencedClasses: [],
  4413. pragmas: [["inlineJS:", ["return self > aDate"]]],
  4414. messageSends: []
  4415. }),
  4416. $globals.Date);
  4417. $core.addMethod(
  4418. $core.method({
  4419. selector: ">=",
  4420. protocol: "comparing",
  4421. fn: function (aDate){
  4422. var self=this,$self=this;
  4423. return $core.withContext(function($ctx1) {
  4424. return self >= aDate;
  4425. return self;
  4426. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate})});
  4427. },
  4428. args: ["aDate"],
  4429. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4430. referencedClasses: [],
  4431. pragmas: [["inlineJS:", ["return self >= aDate"]]],
  4432. messageSends: []
  4433. }),
  4434. $globals.Date);
  4435. $core.addMethod(
  4436. $core.method({
  4437. selector: "asDateString",
  4438. protocol: "converting",
  4439. fn: function (){
  4440. var self=this,$self=this;
  4441. return $core.withContext(function($ctx1) {
  4442. return self.toDateString();
  4443. return self;
  4444. }, function($ctx1) {$ctx1.fill(self,"asDateString",{})});
  4445. },
  4446. args: [],
  4447. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4448. referencedClasses: [],
  4449. pragmas: [["inlineJS:", ["return self.toDateString()"]]],
  4450. messageSends: []
  4451. }),
  4452. $globals.Date);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "asLocaleString",
  4456. protocol: "converting",
  4457. fn: function (){
  4458. var self=this,$self=this;
  4459. return $core.withContext(function($ctx1) {
  4460. return self.toLocaleString();
  4461. return self;
  4462. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{})});
  4463. },
  4464. args: [],
  4465. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4466. referencedClasses: [],
  4467. pragmas: [["inlineJS:", ["return self.toLocaleString()"]]],
  4468. messageSends: []
  4469. }),
  4470. $globals.Date);
  4471. $core.addMethod(
  4472. $core.method({
  4473. selector: "asMilliseconds",
  4474. protocol: "converting",
  4475. fn: function (){
  4476. var self=this,$self=this;
  4477. return $core.withContext(function($ctx1) {
  4478. return $self._time();
  4479. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{})});
  4480. },
  4481. args: [],
  4482. source: "asMilliseconds\x0a\x09^ self time",
  4483. referencedClasses: [],
  4484. pragmas: [],
  4485. messageSends: ["time"]
  4486. }),
  4487. $globals.Date);
  4488. $core.addMethod(
  4489. $core.method({
  4490. selector: "asNumber",
  4491. protocol: "converting",
  4492. fn: function (){
  4493. var self=this,$self=this;
  4494. return $core.withContext(function($ctx1) {
  4495. return $self._asMilliseconds();
  4496. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  4497. },
  4498. args: [],
  4499. source: "asNumber\x0a\x09^ self asMilliseconds",
  4500. referencedClasses: [],
  4501. pragmas: [],
  4502. messageSends: ["asMilliseconds"]
  4503. }),
  4504. $globals.Date);
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "asString",
  4508. protocol: "converting",
  4509. fn: function (){
  4510. var self=this,$self=this;
  4511. return $core.withContext(function($ctx1) {
  4512. return self.toString();
  4513. return self;
  4514. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  4515. },
  4516. args: [],
  4517. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4518. referencedClasses: [],
  4519. pragmas: [["inlineJS:", ["return self.toString()"]]],
  4520. messageSends: []
  4521. }),
  4522. $globals.Date);
  4523. $core.addMethod(
  4524. $core.method({
  4525. selector: "asTimeString",
  4526. protocol: "converting",
  4527. fn: function (){
  4528. var self=this,$self=this;
  4529. return $core.withContext(function($ctx1) {
  4530. return self.toTimeString();
  4531. return self;
  4532. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{})});
  4533. },
  4534. args: [],
  4535. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4536. referencedClasses: [],
  4537. pragmas: [["inlineJS:", ["return self.toTimeString()"]]],
  4538. messageSends: []
  4539. }),
  4540. $globals.Date);
  4541. $core.addMethod(
  4542. $core.method({
  4543. selector: "day",
  4544. protocol: "accessing",
  4545. fn: function (){
  4546. var self=this,$self=this;
  4547. return $core.withContext(function($ctx1) {
  4548. return $self._dayOfWeek();
  4549. }, function($ctx1) {$ctx1.fill(self,"day",{})});
  4550. },
  4551. args: [],
  4552. source: "day\x0a\x09^ self dayOfWeek",
  4553. referencedClasses: [],
  4554. pragmas: [],
  4555. messageSends: ["dayOfWeek"]
  4556. }),
  4557. $globals.Date);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "day:",
  4561. protocol: "accessing",
  4562. fn: function (aNumber){
  4563. var self=this,$self=this;
  4564. return $core.withContext(function($ctx1) {
  4565. $self._dayOfWeek_(aNumber);
  4566. return self;
  4567. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber})});
  4568. },
  4569. args: ["aNumber"],
  4570. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4571. referencedClasses: [],
  4572. pragmas: [],
  4573. messageSends: ["dayOfWeek:"]
  4574. }),
  4575. $globals.Date);
  4576. $core.addMethod(
  4577. $core.method({
  4578. selector: "dayOfMonth",
  4579. protocol: "accessing",
  4580. fn: function (){
  4581. var self=this,$self=this;
  4582. return $core.withContext(function($ctx1) {
  4583. return self.getDate();
  4584. return self;
  4585. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{})});
  4586. },
  4587. args: [],
  4588. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4589. referencedClasses: [],
  4590. pragmas: [["inlineJS:", ["return self.getDate()"]]],
  4591. messageSends: []
  4592. }),
  4593. $globals.Date);
  4594. $core.addMethod(
  4595. $core.method({
  4596. selector: "dayOfMonth:",
  4597. protocol: "accessing",
  4598. fn: function (aNumber){
  4599. var self=this,$self=this;
  4600. return $core.withContext(function($ctx1) {
  4601. self.setDate(aNumber);
  4602. return self;
  4603. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber})});
  4604. },
  4605. args: ["aNumber"],
  4606. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4607. referencedClasses: [],
  4608. pragmas: [["inlineJS:", ["self.setDate(aNumber)"]]],
  4609. messageSends: []
  4610. }),
  4611. $globals.Date);
  4612. $core.addMethod(
  4613. $core.method({
  4614. selector: "dayOfWeek",
  4615. protocol: "accessing",
  4616. fn: function (){
  4617. var self=this,$self=this;
  4618. return $core.withContext(function($ctx1) {
  4619. return self.getDay() + 1;
  4620. return self;
  4621. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{})});
  4622. },
  4623. args: [],
  4624. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4625. referencedClasses: [],
  4626. pragmas: [["inlineJS:", ["return self.getDay() + 1"]]],
  4627. messageSends: []
  4628. }),
  4629. $globals.Date);
  4630. $core.addMethod(
  4631. $core.method({
  4632. selector: "dayOfWeek:",
  4633. protocol: "accessing",
  4634. fn: function (aNumber){
  4635. var self=this,$self=this;
  4636. return $core.withContext(function($ctx1) {
  4637. return self.setDay(aNumber - 1);
  4638. return self;
  4639. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber})});
  4640. },
  4641. args: ["aNumber"],
  4642. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4643. referencedClasses: [],
  4644. pragmas: [["inlineJS:", ["return self.setDay(aNumber - 1)"]]],
  4645. messageSends: []
  4646. }),
  4647. $globals.Date);
  4648. $core.addMethod(
  4649. $core.method({
  4650. selector: "hours",
  4651. protocol: "accessing",
  4652. fn: function (){
  4653. var self=this,$self=this;
  4654. return $core.withContext(function($ctx1) {
  4655. return self.getHours();
  4656. return self;
  4657. }, function($ctx1) {$ctx1.fill(self,"hours",{})});
  4658. },
  4659. args: [],
  4660. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4661. referencedClasses: [],
  4662. pragmas: [["inlineJS:", ["return self.getHours()"]]],
  4663. messageSends: []
  4664. }),
  4665. $globals.Date);
  4666. $core.addMethod(
  4667. $core.method({
  4668. selector: "hours:",
  4669. protocol: "accessing",
  4670. fn: function (aNumber){
  4671. var self=this,$self=this;
  4672. return $core.withContext(function($ctx1) {
  4673. self.setHours(aNumber);
  4674. return self;
  4675. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber})});
  4676. },
  4677. args: ["aNumber"],
  4678. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4679. referencedClasses: [],
  4680. pragmas: [["inlineJS:", ["self.setHours(aNumber)"]]],
  4681. messageSends: []
  4682. }),
  4683. $globals.Date);
  4684. $core.addMethod(
  4685. $core.method({
  4686. selector: "milliseconds",
  4687. protocol: "accessing",
  4688. fn: function (){
  4689. var self=this,$self=this;
  4690. return $core.withContext(function($ctx1) {
  4691. return self.getMilliseconds();
  4692. return self;
  4693. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{})});
  4694. },
  4695. args: [],
  4696. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4697. referencedClasses: [],
  4698. pragmas: [["inlineJS:", ["return self.getMilliseconds()"]]],
  4699. messageSends: []
  4700. }),
  4701. $globals.Date);
  4702. $core.addMethod(
  4703. $core.method({
  4704. selector: "milliseconds:",
  4705. protocol: "accessing",
  4706. fn: function (aNumber){
  4707. var self=this,$self=this;
  4708. return $core.withContext(function($ctx1) {
  4709. self.setMilliseconds(aNumber);
  4710. return self;
  4711. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber})});
  4712. },
  4713. args: ["aNumber"],
  4714. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4715. referencedClasses: [],
  4716. pragmas: [["inlineJS:", ["self.setMilliseconds(aNumber)"]]],
  4717. messageSends: []
  4718. }),
  4719. $globals.Date);
  4720. $core.addMethod(
  4721. $core.method({
  4722. selector: "minutes",
  4723. protocol: "accessing",
  4724. fn: function (){
  4725. var self=this,$self=this;
  4726. return $core.withContext(function($ctx1) {
  4727. return self.getMinutes();
  4728. return self;
  4729. }, function($ctx1) {$ctx1.fill(self,"minutes",{})});
  4730. },
  4731. args: [],
  4732. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4733. referencedClasses: [],
  4734. pragmas: [["inlineJS:", ["return self.getMinutes()"]]],
  4735. messageSends: []
  4736. }),
  4737. $globals.Date);
  4738. $core.addMethod(
  4739. $core.method({
  4740. selector: "minutes:",
  4741. protocol: "accessing",
  4742. fn: function (aNumber){
  4743. var self=this,$self=this;
  4744. return $core.withContext(function($ctx1) {
  4745. self.setMinutes(aNumber);
  4746. return self;
  4747. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber})});
  4748. },
  4749. args: ["aNumber"],
  4750. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4751. referencedClasses: [],
  4752. pragmas: [["inlineJS:", ["self.setMinutes(aNumber)"]]],
  4753. messageSends: []
  4754. }),
  4755. $globals.Date);
  4756. $core.addMethod(
  4757. $core.method({
  4758. selector: "month",
  4759. protocol: "accessing",
  4760. fn: function (){
  4761. var self=this,$self=this;
  4762. return $core.withContext(function($ctx1) {
  4763. return self.getMonth() + 1;
  4764. return self;
  4765. }, function($ctx1) {$ctx1.fill(self,"month",{})});
  4766. },
  4767. args: [],
  4768. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4769. referencedClasses: [],
  4770. pragmas: [["inlineJS:", ["return self.getMonth() + 1"]]],
  4771. messageSends: []
  4772. }),
  4773. $globals.Date);
  4774. $core.addMethod(
  4775. $core.method({
  4776. selector: "month:",
  4777. protocol: "accessing",
  4778. fn: function (aNumber){
  4779. var self=this,$self=this;
  4780. return $core.withContext(function($ctx1) {
  4781. self.setMonth(aNumber - 1);
  4782. return self;
  4783. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber})});
  4784. },
  4785. args: ["aNumber"],
  4786. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4787. referencedClasses: [],
  4788. pragmas: [["inlineJS:", ["self.setMonth(aNumber - 1)"]]],
  4789. messageSends: []
  4790. }),
  4791. $globals.Date);
  4792. $core.addMethod(
  4793. $core.method({
  4794. selector: "printOn:",
  4795. protocol: "printing",
  4796. fn: function (aStream){
  4797. var self=this,$self=this;
  4798. return $core.withContext(function($ctx1) {
  4799. $recv(aStream)._nextPutAll_($self._asString());
  4800. return self;
  4801. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4802. },
  4803. args: ["aStream"],
  4804. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4805. referencedClasses: [],
  4806. pragmas: [],
  4807. messageSends: ["nextPutAll:", "asString"]
  4808. }),
  4809. $globals.Date);
  4810. $core.addMethod(
  4811. $core.method({
  4812. selector: "seconds",
  4813. protocol: "accessing",
  4814. fn: function (){
  4815. var self=this,$self=this;
  4816. return $core.withContext(function($ctx1) {
  4817. return self.getSeconds();
  4818. return self;
  4819. }, function($ctx1) {$ctx1.fill(self,"seconds",{})});
  4820. },
  4821. args: [],
  4822. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4823. referencedClasses: [],
  4824. pragmas: [["inlineJS:", ["return self.getSeconds()"]]],
  4825. messageSends: []
  4826. }),
  4827. $globals.Date);
  4828. $core.addMethod(
  4829. $core.method({
  4830. selector: "seconds:",
  4831. protocol: "accessing",
  4832. fn: function (aNumber){
  4833. var self=this,$self=this;
  4834. return $core.withContext(function($ctx1) {
  4835. self.setSeconds(aNumber);
  4836. return self;
  4837. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber})});
  4838. },
  4839. args: ["aNumber"],
  4840. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4841. referencedClasses: [],
  4842. pragmas: [["inlineJS:", ["self.setSeconds(aNumber)"]]],
  4843. messageSends: []
  4844. }),
  4845. $globals.Date);
  4846. $core.addMethod(
  4847. $core.method({
  4848. selector: "time",
  4849. protocol: "accessing",
  4850. fn: function (){
  4851. var self=this,$self=this;
  4852. return $core.withContext(function($ctx1) {
  4853. return self.getTime();
  4854. return self;
  4855. }, function($ctx1) {$ctx1.fill(self,"time",{})});
  4856. },
  4857. args: [],
  4858. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4859. referencedClasses: [],
  4860. pragmas: [["inlineJS:", ["return self.getTime()"]]],
  4861. messageSends: []
  4862. }),
  4863. $globals.Date);
  4864. $core.addMethod(
  4865. $core.method({
  4866. selector: "time:",
  4867. protocol: "accessing",
  4868. fn: function (aNumber){
  4869. var self=this,$self=this;
  4870. return $core.withContext(function($ctx1) {
  4871. self.setTime(aNumber);
  4872. return self;
  4873. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber})});
  4874. },
  4875. args: ["aNumber"],
  4876. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4877. referencedClasses: [],
  4878. pragmas: [["inlineJS:", ["self.setTime(aNumber)"]]],
  4879. messageSends: []
  4880. }),
  4881. $globals.Date);
  4882. $core.addMethod(
  4883. $core.method({
  4884. selector: "year",
  4885. protocol: "accessing",
  4886. fn: function (){
  4887. var self=this,$self=this;
  4888. return $core.withContext(function($ctx1) {
  4889. return self.getFullYear();
  4890. return self;
  4891. }, function($ctx1) {$ctx1.fill(self,"year",{})});
  4892. },
  4893. args: [],
  4894. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4895. referencedClasses: [],
  4896. pragmas: [["inlineJS:", ["return self.getFullYear()"]]],
  4897. messageSends: []
  4898. }),
  4899. $globals.Date);
  4900. $core.addMethod(
  4901. $core.method({
  4902. selector: "year:",
  4903. protocol: "accessing",
  4904. fn: function (aNumber){
  4905. var self=this,$self=this;
  4906. return $core.withContext(function($ctx1) {
  4907. self.setFullYear(aNumber);
  4908. return self;
  4909. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber})});
  4910. },
  4911. args: ["aNumber"],
  4912. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4913. referencedClasses: [],
  4914. pragmas: [["inlineJS:", ["self.setFullYear(aNumber)"]]],
  4915. messageSends: []
  4916. }),
  4917. $globals.Date);
  4918. $core.addMethod(
  4919. $core.method({
  4920. selector: "classTag",
  4921. protocol: "accessing",
  4922. fn: function (){
  4923. var self=this,$self=this;
  4924. return "magnitude";
  4925. },
  4926. args: [],
  4927. 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'",
  4928. referencedClasses: [],
  4929. pragmas: [],
  4930. messageSends: []
  4931. }),
  4932. $globals.Date.a$cls);
  4933. $core.addMethod(
  4934. $core.method({
  4935. selector: "fromMilliseconds:",
  4936. protocol: "instance creation",
  4937. fn: function (aNumber){
  4938. var self=this,$self=this;
  4939. return $core.withContext(function($ctx1) {
  4940. return $self._new_(aNumber);
  4941. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber})});
  4942. },
  4943. args: ["aNumber"],
  4944. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4945. referencedClasses: [],
  4946. pragmas: [],
  4947. messageSends: ["new:"]
  4948. }),
  4949. $globals.Date.a$cls);
  4950. $core.addMethod(
  4951. $core.method({
  4952. selector: "fromSeconds:",
  4953. protocol: "instance creation",
  4954. fn: function (aNumber){
  4955. var self=this,$self=this;
  4956. return $core.withContext(function($ctx1) {
  4957. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4958. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber})});
  4959. },
  4960. args: ["aNumber"],
  4961. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4962. referencedClasses: [],
  4963. pragmas: [],
  4964. messageSends: ["fromMilliseconds:", "*"]
  4965. }),
  4966. $globals.Date.a$cls);
  4967. $core.addMethod(
  4968. $core.method({
  4969. selector: "fromString:",
  4970. protocol: "instance creation",
  4971. fn: function (aString){
  4972. var self=this,$self=this;
  4973. return $core.withContext(function($ctx1) {
  4974. return $self._new_(aString);
  4975. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  4976. },
  4977. args: ["aString"],
  4978. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4979. referencedClasses: [],
  4980. pragmas: [],
  4981. messageSends: ["new:"]
  4982. }),
  4983. $globals.Date.a$cls);
  4984. $core.addMethod(
  4985. $core.method({
  4986. selector: "millisecondsToRun:",
  4987. protocol: "instance creation",
  4988. fn: function (aBlock){
  4989. var self=this,$self=this;
  4990. var t;
  4991. return $core.withContext(function($ctx1) {
  4992. t=$recv($globals.Date)._now();
  4993. $ctx1.sendIdx["now"]=1;
  4994. $recv(aBlock)._value();
  4995. return $recv($recv($globals.Date)._now()).__minus(t);
  4996. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t})});
  4997. },
  4998. args: ["aBlock"],
  4999. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  5000. referencedClasses: ["Date"],
  5001. pragmas: [],
  5002. messageSends: ["now", "value", "-"]
  5003. }),
  5004. $globals.Date.a$cls);
  5005. $core.addMethod(
  5006. $core.method({
  5007. selector: "new:",
  5008. protocol: "instance creation",
  5009. fn: function (anObject){
  5010. var self=this,$self=this;
  5011. return $core.withContext(function($ctx1) {
  5012. return new Date(anObject);
  5013. return self;
  5014. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject})});
  5015. },
  5016. args: ["anObject"],
  5017. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  5018. referencedClasses: [],
  5019. pragmas: [["inlineJS:", ["return new Date(anObject)"]]],
  5020. messageSends: []
  5021. }),
  5022. $globals.Date.a$cls);
  5023. $core.addMethod(
  5024. $core.method({
  5025. selector: "now",
  5026. protocol: "instance creation",
  5027. fn: function (){
  5028. var self=this,$self=this;
  5029. return $core.withContext(function($ctx1) {
  5030. return $self._today();
  5031. }, function($ctx1) {$ctx1.fill(self,"now",{})});
  5032. },
  5033. args: [],
  5034. source: "now\x0a\x09^ self today",
  5035. referencedClasses: [],
  5036. pragmas: [],
  5037. messageSends: ["today"]
  5038. }),
  5039. $globals.Date.a$cls);
  5040. $core.addMethod(
  5041. $core.method({
  5042. selector: "today",
  5043. protocol: "instance creation",
  5044. fn: function (){
  5045. var self=this,$self=this;
  5046. return $core.withContext(function($ctx1) {
  5047. return $self._new();
  5048. }, function($ctx1) {$ctx1.fill(self,"today",{})});
  5049. },
  5050. args: [],
  5051. source: "today\x0a\x09^ self new",
  5052. referencedClasses: [],
  5053. pragmas: [],
  5054. messageSends: ["new"]
  5055. }),
  5056. $globals.Date.a$cls);
  5057. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  5058. $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 ].";
  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 self & aNumber;
  5067. return self;
  5068. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber})});
  5069. },
  5070. args: ["aNumber"],
  5071. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5072. referencedClasses: [],
  5073. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  5074. messageSends: []
  5075. }),
  5076. $globals.Number);
  5077. $core.addMethod(
  5078. $core.method({
  5079. selector: "*",
  5080. protocol: "arithmetic",
  5081. fn: function (aNumber){
  5082. var self=this,$self=this;
  5083. return $core.withContext(function($ctx1) {
  5084. return self * aNumber;
  5085. return self;
  5086. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber})});
  5087. },
  5088. args: ["aNumber"],
  5089. source: "* aNumber\x0a\x09<inlineJS: 'return self * aNumber'>",
  5090. referencedClasses: [],
  5091. pragmas: [["inlineJS:", ["return self * aNumber"]]],
  5092. messageSends: []
  5093. }),
  5094. $globals.Number);
  5095. $core.addMethod(
  5096. $core.method({
  5097. selector: "**",
  5098. protocol: "mathematical functions",
  5099. fn: function (exponent){
  5100. var self=this,$self=this;
  5101. return $core.withContext(function($ctx1) {
  5102. return $self._raisedTo_(exponent);
  5103. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent})});
  5104. },
  5105. args: ["exponent"],
  5106. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  5107. referencedClasses: [],
  5108. pragmas: [],
  5109. messageSends: ["raisedTo:"]
  5110. }),
  5111. $globals.Number);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "+",
  5115. protocol: "arithmetic",
  5116. fn: function (aNumber){
  5117. var self=this,$self=this;
  5118. return $core.withContext(function($ctx1) {
  5119. return self + aNumber;
  5120. return self;
  5121. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  5122. },
  5123. args: ["aNumber"],
  5124. source: "+ aNumber\x0a\x09<inlineJS: 'return self + aNumber'>",
  5125. referencedClasses: [],
  5126. pragmas: [["inlineJS:", ["return self + aNumber"]]],
  5127. messageSends: []
  5128. }),
  5129. $globals.Number);
  5130. $core.addMethod(
  5131. $core.method({
  5132. selector: "-",
  5133. protocol: "arithmetic",
  5134. fn: function (aNumber){
  5135. var self=this,$self=this;
  5136. return $core.withContext(function($ctx1) {
  5137. return self - aNumber;
  5138. return self;
  5139. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber})});
  5140. },
  5141. args: ["aNumber"],
  5142. source: "- aNumber\x0a\x09<inlineJS: 'return self - aNumber'>",
  5143. referencedClasses: [],
  5144. pragmas: [["inlineJS:", ["return self - aNumber"]]],
  5145. messageSends: []
  5146. }),
  5147. $globals.Number);
  5148. $core.addMethod(
  5149. $core.method({
  5150. selector: "/",
  5151. protocol: "arithmetic",
  5152. fn: function (aNumber){
  5153. var self=this,$self=this;
  5154. return $core.withContext(function($ctx1) {
  5155. return self / aNumber;
  5156. return self;
  5157. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber})});
  5158. },
  5159. args: ["aNumber"],
  5160. source: "/ aNumber\x0a\x09<inlineJS: 'return self / aNumber'>",
  5161. referencedClasses: [],
  5162. pragmas: [["inlineJS:", ["return self / aNumber"]]],
  5163. messageSends: []
  5164. }),
  5165. $globals.Number);
  5166. $core.addMethod(
  5167. $core.method({
  5168. selector: "//",
  5169. protocol: "arithmetic",
  5170. fn: function (aNumber){
  5171. var self=this,$self=this;
  5172. return $core.withContext(function($ctx1) {
  5173. return $recv($self.__slash(aNumber))._floor();
  5174. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber})});
  5175. },
  5176. args: ["aNumber"],
  5177. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  5178. referencedClasses: [],
  5179. pragmas: [],
  5180. messageSends: ["floor", "/"]
  5181. }),
  5182. $globals.Number);
  5183. $core.addMethod(
  5184. $core.method({
  5185. selector: "<",
  5186. protocol: "comparing",
  5187. fn: function (aNumber){
  5188. var self=this,$self=this;
  5189. return $core.withContext(function($ctx1) {
  5190. return self < aNumber;
  5191. return self;
  5192. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber})});
  5193. },
  5194. args: ["aNumber"],
  5195. source: "< aNumber\x0a\x09<inlineJS: 'return self < aNumber'>",
  5196. referencedClasses: [],
  5197. pragmas: [["inlineJS:", ["return self < aNumber"]]],
  5198. messageSends: []
  5199. }),
  5200. $globals.Number);
  5201. $core.addMethod(
  5202. $core.method({
  5203. selector: "<=",
  5204. protocol: "comparing",
  5205. fn: function (aNumber){
  5206. var self=this,$self=this;
  5207. return $core.withContext(function($ctx1) {
  5208. return self <= aNumber;
  5209. return self;
  5210. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber})});
  5211. },
  5212. args: ["aNumber"],
  5213. source: "<= aNumber\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5214. referencedClasses: [],
  5215. pragmas: [["inlineJS:", ["return self <= aNumber"]]],
  5216. messageSends: []
  5217. }),
  5218. $globals.Number);
  5219. $core.addMethod(
  5220. $core.method({
  5221. selector: "==",
  5222. protocol: "comparing",
  5223. fn: function (aNumber){
  5224. var self=this,$self=this;
  5225. return $core.withContext(function($ctx1) {
  5226. if (typeof aNumber === "number") return Number(self) === aNumber;
  5227. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5228. else return false;;
  5229. return self;
  5230. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber})});
  5231. },
  5232. args: ["aNumber"],
  5233. 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'>",
  5234. referencedClasses: [],
  5235. pragmas: [["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;"]]],
  5236. messageSends: []
  5237. }),
  5238. $globals.Number);
  5239. $core.addMethod(
  5240. $core.method({
  5241. selector: ">",
  5242. protocol: "comparing",
  5243. fn: function (aNumber){
  5244. var self=this,$self=this;
  5245. return $core.withContext(function($ctx1) {
  5246. return self > aNumber;
  5247. return self;
  5248. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber})});
  5249. },
  5250. args: ["aNumber"],
  5251. source: "> aNumber\x0a\x09<inlineJS: 'return self > aNumber'>",
  5252. referencedClasses: [],
  5253. pragmas: [["inlineJS:", ["return self > aNumber"]]],
  5254. messageSends: []
  5255. }),
  5256. $globals.Number);
  5257. $core.addMethod(
  5258. $core.method({
  5259. selector: ">=",
  5260. protocol: "comparing",
  5261. fn: function (aNumber){
  5262. var self=this,$self=this;
  5263. return $core.withContext(function($ctx1) {
  5264. return self >= aNumber;
  5265. return self;
  5266. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber})});
  5267. },
  5268. args: ["aNumber"],
  5269. source: ">= aNumber\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5270. referencedClasses: [],
  5271. pragmas: [["inlineJS:", ["return self >= aNumber"]]],
  5272. messageSends: []
  5273. }),
  5274. $globals.Number);
  5275. $core.addMethod(
  5276. $core.method({
  5277. selector: "@",
  5278. protocol: "converting",
  5279. fn: function (aNumber){
  5280. var self=this,$self=this;
  5281. return $core.withContext(function($ctx1) {
  5282. return $recv($globals.Point)._x_y_(self,aNumber);
  5283. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber})});
  5284. },
  5285. args: ["aNumber"],
  5286. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5287. referencedClasses: ["Point"],
  5288. pragmas: [],
  5289. messageSends: ["x:y:"]
  5290. }),
  5291. $globals.Number);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "\x5c\x5c",
  5295. protocol: "arithmetic",
  5296. fn: function (aNumber){
  5297. var self=this,$self=this;
  5298. return $core.withContext(function($ctx1) {
  5299. return self % aNumber;
  5300. return self;
  5301. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber})});
  5302. },
  5303. args: ["aNumber"],
  5304. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5305. referencedClasses: [],
  5306. pragmas: [["inlineJS:", ["return self % aNumber"]]],
  5307. messageSends: []
  5308. }),
  5309. $globals.Number);
  5310. $core.addMethod(
  5311. $core.method({
  5312. selector: "abs",
  5313. protocol: "arithmetic",
  5314. fn: function (){
  5315. var self=this,$self=this;
  5316. return $core.withContext(function($ctx1) {
  5317. return Math.abs(self);;
  5318. return self;
  5319. }, function($ctx1) {$ctx1.fill(self,"abs",{})});
  5320. },
  5321. args: [],
  5322. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5323. referencedClasses: [],
  5324. pragmas: [["inlineJS:", ["return Math.abs(self);"]]],
  5325. messageSends: []
  5326. }),
  5327. $globals.Number);
  5328. $core.addMethod(
  5329. $core.method({
  5330. selector: "arcCos",
  5331. protocol: "mathematical functions",
  5332. fn: function (){
  5333. var self=this,$self=this;
  5334. return $core.withContext(function($ctx1) {
  5335. return Math.acos(self);;
  5336. return self;
  5337. }, function($ctx1) {$ctx1.fill(self,"arcCos",{})});
  5338. },
  5339. args: [],
  5340. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5341. referencedClasses: [],
  5342. pragmas: [["inlineJS:", ["return Math.acos(self);"]]],
  5343. messageSends: []
  5344. }),
  5345. $globals.Number);
  5346. $core.addMethod(
  5347. $core.method({
  5348. selector: "arcSin",
  5349. protocol: "mathematical functions",
  5350. fn: function (){
  5351. var self=this,$self=this;
  5352. return $core.withContext(function($ctx1) {
  5353. return Math.asin(self);;
  5354. return self;
  5355. }, function($ctx1) {$ctx1.fill(self,"arcSin",{})});
  5356. },
  5357. args: [],
  5358. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5359. referencedClasses: [],
  5360. pragmas: [["inlineJS:", ["return Math.asin(self);"]]],
  5361. messageSends: []
  5362. }),
  5363. $globals.Number);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "arcTan",
  5367. protocol: "mathematical functions",
  5368. fn: function (){
  5369. var self=this,$self=this;
  5370. return $core.withContext(function($ctx1) {
  5371. return Math.atan(self);;
  5372. return self;
  5373. }, function($ctx1) {$ctx1.fill(self,"arcTan",{})});
  5374. },
  5375. args: [],
  5376. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5377. referencedClasses: [],
  5378. pragmas: [["inlineJS:", ["return Math.atan(self);"]]],
  5379. messageSends: []
  5380. }),
  5381. $globals.Number);
  5382. $core.addMethod(
  5383. $core.method({
  5384. selector: "arcTan:",
  5385. protocol: "mathematical functions",
  5386. fn: function (aNumber){
  5387. var self=this,$self=this;
  5388. return $core.withContext(function($ctx1) {
  5389. return Math.atan2(self, aNumber);;
  5390. return self;
  5391. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber})});
  5392. },
  5393. args: ["aNumber"],
  5394. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5395. referencedClasses: [],
  5396. pragmas: [["inlineJS:", ["return Math.atan2(self, aNumber);"]]],
  5397. messageSends: []
  5398. }),
  5399. $globals.Number);
  5400. $core.addMethod(
  5401. $core.method({
  5402. selector: "asJavaScriptObject",
  5403. protocol: "converting",
  5404. fn: function (){
  5405. var self=this,$self=this;
  5406. return self;
  5407. },
  5408. args: [],
  5409. source: "asJavaScriptObject\x0a\x09^ self",
  5410. referencedClasses: [],
  5411. pragmas: [],
  5412. messageSends: []
  5413. }),
  5414. $globals.Number);
  5415. $core.addMethod(
  5416. $core.method({
  5417. selector: "asJavaScriptSource",
  5418. protocol: "converting",
  5419. fn: function (){
  5420. var self=this,$self=this;
  5421. return $core.withContext(function($ctx1) {
  5422. var $1;
  5423. $1=$recv("(".__comma($self._printString())).__comma(")");
  5424. $ctx1.sendIdx[","]=1;
  5425. return $1;
  5426. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5427. },
  5428. args: [],
  5429. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5430. referencedClasses: [],
  5431. pragmas: [],
  5432. messageSends: [",", "printString"]
  5433. }),
  5434. $globals.Number);
  5435. $core.addMethod(
  5436. $core.method({
  5437. selector: "asNumber",
  5438. protocol: "converting",
  5439. fn: function (){
  5440. var self=this,$self=this;
  5441. return self;
  5442. },
  5443. args: [],
  5444. source: "asNumber\x0a\x09^ self",
  5445. referencedClasses: [],
  5446. pragmas: [],
  5447. messageSends: []
  5448. }),
  5449. $globals.Number);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "asPoint",
  5453. protocol: "converting",
  5454. fn: function (){
  5455. var self=this,$self=this;
  5456. return $core.withContext(function($ctx1) {
  5457. return $recv($globals.Point)._x_y_(self,self);
  5458. }, function($ctx1) {$ctx1.fill(self,"asPoint",{})});
  5459. },
  5460. args: [],
  5461. source: "asPoint\x0a\x09^ Point x: self y: self",
  5462. referencedClasses: ["Point"],
  5463. pragmas: [],
  5464. messageSends: ["x:y:"]
  5465. }),
  5466. $globals.Number);
  5467. $core.addMethod(
  5468. $core.method({
  5469. selector: "asString",
  5470. protocol: "converting",
  5471. fn: function (){
  5472. var self=this,$self=this;
  5473. return $core.withContext(function($ctx1) {
  5474. return String(self);
  5475. return self;
  5476. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  5477. },
  5478. args: [],
  5479. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5480. referencedClasses: [],
  5481. pragmas: [["inlineJS:", ["return String(self)"]]],
  5482. messageSends: []
  5483. }),
  5484. $globals.Number);
  5485. $core.addMethod(
  5486. $core.method({
  5487. selector: "atRandom",
  5488. protocol: "converting",
  5489. fn: function (){
  5490. var self=this,$self=this;
  5491. return $core.withContext(function($ctx1) {
  5492. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5493. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  5494. },
  5495. args: [],
  5496. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5497. referencedClasses: ["Random"],
  5498. pragmas: [],
  5499. messageSends: ["+", "truncated", "*", "next", "new"]
  5500. }),
  5501. $globals.Number);
  5502. $core.addMethod(
  5503. $core.method({
  5504. selector: "between:and:",
  5505. protocol: "testing",
  5506. fn: function (min,max){
  5507. var self=this,$self=this;
  5508. return $core.withContext(function($ctx1) {
  5509. return $recv($self.__gt_eq(min))._and_((function(){
  5510. return $core.withContext(function($ctx2) {
  5511. return $self.__lt_eq(max);
  5512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5513. }));
  5514. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max})});
  5515. },
  5516. args: ["min", "max"],
  5517. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5518. referencedClasses: [],
  5519. pragmas: [],
  5520. messageSends: ["and:", ">=", "<="]
  5521. }),
  5522. $globals.Number);
  5523. $core.addMethod(
  5524. $core.method({
  5525. selector: "bitAnd:",
  5526. protocol: "converting",
  5527. fn: function (aNumber){
  5528. var self=this,$self=this;
  5529. return $core.withContext(function($ctx1) {
  5530. return self & aNumber;
  5531. return self;
  5532. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber})});
  5533. },
  5534. args: ["aNumber"],
  5535. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5536. referencedClasses: [],
  5537. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  5538. messageSends: []
  5539. }),
  5540. $globals.Number);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "bitNot",
  5544. protocol: "converting",
  5545. fn: function (){
  5546. var self=this,$self=this;
  5547. return $core.withContext(function($ctx1) {
  5548. return ~self;
  5549. return self;
  5550. }, function($ctx1) {$ctx1.fill(self,"bitNot",{})});
  5551. },
  5552. args: [],
  5553. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5554. referencedClasses: [],
  5555. pragmas: [["inlineJS:", ["return ~self"]]],
  5556. messageSends: []
  5557. }),
  5558. $globals.Number);
  5559. $core.addMethod(
  5560. $core.method({
  5561. selector: "bitOr:",
  5562. protocol: "converting",
  5563. fn: function (aNumber){
  5564. var self=this,$self=this;
  5565. return $core.withContext(function($ctx1) {
  5566. return self | aNumber;
  5567. return self;
  5568. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber})});
  5569. },
  5570. args: ["aNumber"],
  5571. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5572. referencedClasses: [],
  5573. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  5574. messageSends: []
  5575. }),
  5576. $globals.Number);
  5577. $core.addMethod(
  5578. $core.method({
  5579. selector: "bitXor:",
  5580. protocol: "converting",
  5581. fn: function (aNumber){
  5582. var self=this,$self=this;
  5583. return $core.withContext(function($ctx1) {
  5584. return self ^ aNumber;
  5585. return self;
  5586. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber})});
  5587. },
  5588. args: ["aNumber"],
  5589. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5590. referencedClasses: [],
  5591. pragmas: [["inlineJS:", ["return self ^ aNumber"]]],
  5592. messageSends: []
  5593. }),
  5594. $globals.Number);
  5595. $core.addMethod(
  5596. $core.method({
  5597. selector: "ceiling",
  5598. protocol: "converting",
  5599. fn: function (){
  5600. var self=this,$self=this;
  5601. return $core.withContext(function($ctx1) {
  5602. return Math.ceil(self);;
  5603. return self;
  5604. }, function($ctx1) {$ctx1.fill(self,"ceiling",{})});
  5605. },
  5606. args: [],
  5607. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5608. referencedClasses: [],
  5609. pragmas: [["inlineJS:", ["return Math.ceil(self);"]]],
  5610. messageSends: []
  5611. }),
  5612. $globals.Number);
  5613. $core.addMethod(
  5614. $core.method({
  5615. selector: "copy",
  5616. protocol: "copying",
  5617. fn: function (){
  5618. var self=this,$self=this;
  5619. return self;
  5620. },
  5621. args: [],
  5622. source: "copy\x0a\x09^ self",
  5623. referencedClasses: [],
  5624. pragmas: [],
  5625. messageSends: []
  5626. }),
  5627. $globals.Number);
  5628. $core.addMethod(
  5629. $core.method({
  5630. selector: "cos",
  5631. protocol: "mathematical functions",
  5632. fn: function (){
  5633. var self=this,$self=this;
  5634. return $core.withContext(function($ctx1) {
  5635. return Math.cos(self);;
  5636. return self;
  5637. }, function($ctx1) {$ctx1.fill(self,"cos",{})});
  5638. },
  5639. args: [],
  5640. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5641. referencedClasses: [],
  5642. pragmas: [["inlineJS:", ["return Math.cos(self);"]]],
  5643. messageSends: []
  5644. }),
  5645. $globals.Number);
  5646. $core.addMethod(
  5647. $core.method({
  5648. selector: "deepCopy",
  5649. protocol: "copying",
  5650. fn: function (){
  5651. var self=this,$self=this;
  5652. return $core.withContext(function($ctx1) {
  5653. return $self._copy();
  5654. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5655. },
  5656. args: [],
  5657. source: "deepCopy\x0a\x09^ self copy",
  5658. referencedClasses: [],
  5659. pragmas: [],
  5660. messageSends: ["copy"]
  5661. }),
  5662. $globals.Number);
  5663. $core.addMethod(
  5664. $core.method({
  5665. selector: "degreesToRadians",
  5666. protocol: "converting",
  5667. fn: function (){
  5668. var self=this,$self=this;
  5669. return $core.withContext(function($ctx1) {
  5670. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5671. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{})});
  5672. },
  5673. args: [],
  5674. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5675. referencedClasses: ["Number"],
  5676. pragmas: [],
  5677. messageSends: ["*", "radiansPerDegree"]
  5678. }),
  5679. $globals.Number);
  5680. $core.addMethod(
  5681. $core.method({
  5682. selector: "even",
  5683. protocol: "testing",
  5684. fn: function (){
  5685. var self=this,$self=this;
  5686. return $core.withContext(function($ctx1) {
  5687. return (0).__eq($self.__backslash_backslash((2)));
  5688. }, function($ctx1) {$ctx1.fill(self,"even",{})});
  5689. },
  5690. args: [],
  5691. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5692. referencedClasses: [],
  5693. pragmas: [],
  5694. messageSends: ["=", "\x5c\x5c"]
  5695. }),
  5696. $globals.Number);
  5697. $core.addMethod(
  5698. $core.method({
  5699. selector: "floor",
  5700. protocol: "converting",
  5701. fn: function (){
  5702. var self=this,$self=this;
  5703. return $core.withContext(function($ctx1) {
  5704. return Math.floor(self);;
  5705. return self;
  5706. }, function($ctx1) {$ctx1.fill(self,"floor",{})});
  5707. },
  5708. args: [],
  5709. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5710. referencedClasses: [],
  5711. pragmas: [["inlineJS:", ["return Math.floor(self);"]]],
  5712. messageSends: []
  5713. }),
  5714. $globals.Number);
  5715. $core.addMethod(
  5716. $core.method({
  5717. selector: "isImmutable",
  5718. protocol: "testing",
  5719. fn: function (){
  5720. var self=this,$self=this;
  5721. return true;
  5722. },
  5723. args: [],
  5724. source: "isImmutable\x0a\x09^ true",
  5725. referencedClasses: [],
  5726. pragmas: [],
  5727. messageSends: []
  5728. }),
  5729. $globals.Number);
  5730. $core.addMethod(
  5731. $core.method({
  5732. selector: "isNumber",
  5733. protocol: "testing",
  5734. fn: function (){
  5735. var self=this,$self=this;
  5736. return true;
  5737. },
  5738. args: [],
  5739. source: "isNumber\x0a\x09^ true",
  5740. referencedClasses: [],
  5741. pragmas: [],
  5742. messageSends: []
  5743. }),
  5744. $globals.Number);
  5745. $core.addMethod(
  5746. $core.method({
  5747. selector: "isZero",
  5748. protocol: "testing",
  5749. fn: function (){
  5750. var self=this,$self=this;
  5751. return $core.withContext(function($ctx1) {
  5752. return $self.__eq((0));
  5753. }, function($ctx1) {$ctx1.fill(self,"isZero",{})});
  5754. },
  5755. args: [],
  5756. source: "isZero\x0a\x09^ self = 0",
  5757. referencedClasses: [],
  5758. pragmas: [],
  5759. messageSends: ["="]
  5760. }),
  5761. $globals.Number);
  5762. $core.addMethod(
  5763. $core.method({
  5764. selector: "ln",
  5765. protocol: "mathematical functions",
  5766. fn: function (){
  5767. var self=this,$self=this;
  5768. return $core.withContext(function($ctx1) {
  5769. return Math.log(self);;
  5770. return self;
  5771. }, function($ctx1) {$ctx1.fill(self,"ln",{})});
  5772. },
  5773. args: [],
  5774. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5775. referencedClasses: [],
  5776. pragmas: [["inlineJS:", ["return Math.log(self);"]]],
  5777. messageSends: []
  5778. }),
  5779. $globals.Number);
  5780. $core.addMethod(
  5781. $core.method({
  5782. selector: "ln1p",
  5783. protocol: "mathematical functions",
  5784. fn: function (){
  5785. var self=this,$self=this;
  5786. return $core.withContext(function($ctx1) {
  5787. return Math.log1p(self);;
  5788. return self;
  5789. }, function($ctx1) {$ctx1.fill(self,"ln1p",{})});
  5790. },
  5791. args: [],
  5792. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5793. referencedClasses: [],
  5794. pragmas: [["inlineJS:", ["return Math.log1p(self);"]]],
  5795. messageSends: []
  5796. }),
  5797. $globals.Number);
  5798. $core.addMethod(
  5799. $core.method({
  5800. selector: "log",
  5801. protocol: "mathematical functions",
  5802. fn: function (){
  5803. var self=this,$self=this;
  5804. return $core.withContext(function($ctx1) {
  5805. return Math.log(self) / Math.LN10;;
  5806. return self;
  5807. }, function($ctx1) {$ctx1.fill(self,"log",{})});
  5808. },
  5809. args: [],
  5810. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5811. referencedClasses: [],
  5812. pragmas: [["inlineJS:", ["return Math.log(self) / Math.LN10;"]]],
  5813. messageSends: []
  5814. }),
  5815. $globals.Number);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "log:",
  5819. protocol: "mathematical functions",
  5820. fn: function (aNumber){
  5821. var self=this,$self=this;
  5822. return $core.withContext(function($ctx1) {
  5823. return Math.log(self) / Math.log(aNumber);;
  5824. return self;
  5825. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber})});
  5826. },
  5827. args: ["aNumber"],
  5828. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5829. referencedClasses: [],
  5830. pragmas: [["inlineJS:", ["return Math.log(self) / Math.log(aNumber);"]]],
  5831. messageSends: []
  5832. }),
  5833. $globals.Number);
  5834. $core.addMethod(
  5835. $core.method({
  5836. selector: "max:",
  5837. protocol: "arithmetic",
  5838. fn: function (aNumber){
  5839. var self=this,$self=this;
  5840. return $core.withContext(function($ctx1) {
  5841. return Math.max(self, aNumber);;
  5842. return self;
  5843. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber})});
  5844. },
  5845. args: ["aNumber"],
  5846. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5847. referencedClasses: [],
  5848. pragmas: [["inlineJS:", ["return Math.max(self, aNumber);"]]],
  5849. messageSends: []
  5850. }),
  5851. $globals.Number);
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "min:",
  5855. protocol: "arithmetic",
  5856. fn: function (aNumber){
  5857. var self=this,$self=this;
  5858. return $core.withContext(function($ctx1) {
  5859. return Math.min(self, aNumber);;
  5860. return self;
  5861. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber})});
  5862. },
  5863. args: ["aNumber"],
  5864. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5865. referencedClasses: [],
  5866. pragmas: [["inlineJS:", ["return Math.min(self, aNumber);"]]],
  5867. messageSends: []
  5868. }),
  5869. $globals.Number);
  5870. $core.addMethod(
  5871. $core.method({
  5872. selector: "min:max:",
  5873. protocol: "arithmetic",
  5874. fn: function (aMin,aMax){
  5875. var self=this,$self=this;
  5876. return $core.withContext(function($ctx1) {
  5877. return $recv($self._min_(aMin))._max_(aMax);
  5878. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax})});
  5879. },
  5880. args: ["aMin", "aMax"],
  5881. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5882. referencedClasses: [],
  5883. pragmas: [],
  5884. messageSends: ["max:", "min:"]
  5885. }),
  5886. $globals.Number);
  5887. $core.addMethod(
  5888. $core.method({
  5889. selector: "negated",
  5890. protocol: "arithmetic",
  5891. fn: function (){
  5892. var self=this,$self=this;
  5893. return $core.withContext(function($ctx1) {
  5894. return (0).__minus(self);
  5895. }, function($ctx1) {$ctx1.fill(self,"negated",{})});
  5896. },
  5897. args: [],
  5898. source: "negated\x0a\x09^ 0 - self",
  5899. referencedClasses: [],
  5900. pragmas: [],
  5901. messageSends: ["-"]
  5902. }),
  5903. $globals.Number);
  5904. $core.addMethod(
  5905. $core.method({
  5906. selector: "negative",
  5907. protocol: "testing",
  5908. fn: function (){
  5909. var self=this,$self=this;
  5910. return $core.withContext(function($ctx1) {
  5911. return $self.__lt((0));
  5912. }, function($ctx1) {$ctx1.fill(self,"negative",{})});
  5913. },
  5914. args: [],
  5915. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5916. referencedClasses: [],
  5917. pragmas: [],
  5918. messageSends: ["<"]
  5919. }),
  5920. $globals.Number);
  5921. $core.addMethod(
  5922. $core.method({
  5923. selector: "odd",
  5924. protocol: "testing",
  5925. fn: function (){
  5926. var self=this,$self=this;
  5927. return $core.withContext(function($ctx1) {
  5928. return $recv($self._even())._not();
  5929. }, function($ctx1) {$ctx1.fill(self,"odd",{})});
  5930. },
  5931. args: [],
  5932. source: "odd\x0a\x09^ self even not",
  5933. referencedClasses: [],
  5934. pragmas: [],
  5935. messageSends: ["not", "even"]
  5936. }),
  5937. $globals.Number);
  5938. $core.addMethod(
  5939. $core.method({
  5940. selector: "positive",
  5941. protocol: "testing",
  5942. fn: function (){
  5943. var self=this,$self=this;
  5944. return $core.withContext(function($ctx1) {
  5945. return $self.__gt_eq((0));
  5946. }, function($ctx1) {$ctx1.fill(self,"positive",{})});
  5947. },
  5948. args: [],
  5949. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5950. referencedClasses: [],
  5951. pragmas: [],
  5952. messageSends: [">="]
  5953. }),
  5954. $globals.Number);
  5955. $core.addMethod(
  5956. $core.method({
  5957. selector: "printOn:",
  5958. protocol: "printing",
  5959. fn: function (aStream){
  5960. var self=this,$self=this;
  5961. return $core.withContext(function($ctx1) {
  5962. $recv(aStream)._nextPutAll_($self._asString());
  5963. return self;
  5964. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  5965. },
  5966. args: ["aStream"],
  5967. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5968. referencedClasses: [],
  5969. pragmas: [],
  5970. messageSends: ["nextPutAll:", "asString"]
  5971. }),
  5972. $globals.Number);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "printShowingDecimalPlaces:",
  5976. protocol: "printing",
  5977. fn: function (placesDesired){
  5978. var self=this,$self=this;
  5979. return $core.withContext(function($ctx1) {
  5980. return self.toFixed(placesDesired);
  5981. return self;
  5982. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired})});
  5983. },
  5984. args: ["placesDesired"],
  5985. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5986. referencedClasses: [],
  5987. pragmas: [["inlineJS:", ["return self.toFixed(placesDesired)"]]],
  5988. messageSends: []
  5989. }),
  5990. $globals.Number);
  5991. $core.addMethod(
  5992. $core.method({
  5993. selector: "printStringBase:",
  5994. protocol: "converting",
  5995. fn: function (aBase){
  5996. var self=this,$self=this;
  5997. return $core.withContext(function($ctx1) {
  5998. return self.toString(aBase);
  5999. return self;
  6000. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase})});
  6001. },
  6002. args: ["aBase"],
  6003. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  6004. referencedClasses: [],
  6005. pragmas: [["inlineJS:", ["return self.toString(aBase)"]]],
  6006. messageSends: []
  6007. }),
  6008. $globals.Number);
  6009. $core.addMethod(
  6010. $core.method({
  6011. selector: "radiansToDegrees",
  6012. protocol: "converting",
  6013. fn: function (){
  6014. var self=this,$self=this;
  6015. return $core.withContext(function($ctx1) {
  6016. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  6017. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{})});
  6018. },
  6019. args: [],
  6020. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  6021. referencedClasses: ["Number"],
  6022. pragmas: [],
  6023. messageSends: ["/", "radiansPerDegree"]
  6024. }),
  6025. $globals.Number);
  6026. $core.addMethod(
  6027. $core.method({
  6028. selector: "raisedTo:",
  6029. protocol: "mathematical functions",
  6030. fn: function (exponent){
  6031. var self=this,$self=this;
  6032. return $core.withContext(function($ctx1) {
  6033. return Math.pow(self, exponent);;
  6034. return self;
  6035. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent})});
  6036. },
  6037. args: ["exponent"],
  6038. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  6039. referencedClasses: [],
  6040. pragmas: [["inlineJS:", ["return Math.pow(self, exponent);"]]],
  6041. messageSends: []
  6042. }),
  6043. $globals.Number);
  6044. $core.addMethod(
  6045. $core.method({
  6046. selector: "rounded",
  6047. protocol: "converting",
  6048. fn: function (){
  6049. var self=this,$self=this;
  6050. return $core.withContext(function($ctx1) {
  6051. return Math.round(self);;
  6052. return self;
  6053. }, function($ctx1) {$ctx1.fill(self,"rounded",{})});
  6054. },
  6055. args: [],
  6056. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  6057. referencedClasses: [],
  6058. pragmas: [["inlineJS:", ["return Math.round(self);"]]],
  6059. messageSends: []
  6060. }),
  6061. $globals.Number);
  6062. $core.addMethod(
  6063. $core.method({
  6064. selector: "sign",
  6065. protocol: "mathematical functions",
  6066. fn: function (){
  6067. var self=this,$self=this;
  6068. return $core.withContext(function($ctx1) {
  6069. var $1,$2;
  6070. $1=$self._isZero();
  6071. if($core.assert($1)){
  6072. return (0);
  6073. }
  6074. $2=$self._positive();
  6075. if($core.assert($2)){
  6076. return (1);
  6077. } else {
  6078. return (-1);
  6079. }
  6080. return self;
  6081. }, function($ctx1) {$ctx1.fill(self,"sign",{})});
  6082. },
  6083. args: [],
  6084. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  6085. referencedClasses: [],
  6086. pragmas: [],
  6087. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  6088. }),
  6089. $globals.Number);
  6090. $core.addMethod(
  6091. $core.method({
  6092. selector: "sin",
  6093. protocol: "mathematical functions",
  6094. fn: function (){
  6095. var self=this,$self=this;
  6096. return $core.withContext(function($ctx1) {
  6097. return Math.sin(self);;
  6098. return self;
  6099. }, function($ctx1) {$ctx1.fill(self,"sin",{})});
  6100. },
  6101. args: [],
  6102. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  6103. referencedClasses: [],
  6104. pragmas: [["inlineJS:", ["return Math.sin(self);"]]],
  6105. messageSends: []
  6106. }),
  6107. $globals.Number);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "sqrt",
  6111. protocol: "mathematical functions",
  6112. fn: function (){
  6113. var self=this,$self=this;
  6114. return $core.withContext(function($ctx1) {
  6115. return Math.sqrt(self);
  6116. return self;
  6117. }, function($ctx1) {$ctx1.fill(self,"sqrt",{})});
  6118. },
  6119. args: [],
  6120. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  6121. referencedClasses: [],
  6122. pragmas: [["inlineJS:", ["return Math.sqrt(self)"]]],
  6123. messageSends: []
  6124. }),
  6125. $globals.Number);
  6126. $core.addMethod(
  6127. $core.method({
  6128. selector: "squared",
  6129. protocol: "mathematical functions",
  6130. fn: function (){
  6131. var self=this,$self=this;
  6132. return $core.withContext(function($ctx1) {
  6133. return $self.__star(self);
  6134. }, function($ctx1) {$ctx1.fill(self,"squared",{})});
  6135. },
  6136. args: [],
  6137. source: "squared\x0a\x09^ self * self",
  6138. referencedClasses: [],
  6139. pragmas: [],
  6140. messageSends: ["*"]
  6141. }),
  6142. $globals.Number);
  6143. $core.addMethod(
  6144. $core.method({
  6145. selector: "tan",
  6146. protocol: "mathematical functions",
  6147. fn: function (){
  6148. var self=this,$self=this;
  6149. return $core.withContext(function($ctx1) {
  6150. return Math.tan(self);;
  6151. return self;
  6152. }, function($ctx1) {$ctx1.fill(self,"tan",{})});
  6153. },
  6154. args: [],
  6155. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  6156. referencedClasses: [],
  6157. pragmas: [["inlineJS:", ["return Math.tan(self);"]]],
  6158. messageSends: []
  6159. }),
  6160. $globals.Number);
  6161. $core.addMethod(
  6162. $core.method({
  6163. selector: "timesRepeat:",
  6164. protocol: "enumerating",
  6165. fn: function (aBlock){
  6166. var self=this,$self=this;
  6167. var count;
  6168. return $core.withContext(function($ctx1) {
  6169. count=(1);
  6170. $recv((function(){
  6171. return $core.withContext(function($ctx2) {
  6172. return $recv(count).__gt(self);
  6173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6174. }))._whileFalse_((function(){
  6175. return $core.withContext(function($ctx2) {
  6176. $recv(aBlock)._value();
  6177. count=$recv(count).__plus((1));
  6178. return count;
  6179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6180. }));
  6181. return self;
  6182. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count})});
  6183. },
  6184. args: ["aBlock"],
  6185. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  6186. referencedClasses: [],
  6187. pragmas: [],
  6188. messageSends: ["whileFalse:", ">", "value", "+"]
  6189. }),
  6190. $globals.Number);
  6191. $core.addMethod(
  6192. $core.method({
  6193. selector: "to:",
  6194. protocol: "converting",
  6195. fn: function (aNumber){
  6196. var self=this,$self=this;
  6197. var array,first,last,count;
  6198. return $core.withContext(function($ctx1) {
  6199. first=$self._truncated();
  6200. $ctx1.sendIdx["truncated"]=1;
  6201. last=$recv($recv(aNumber)._truncated()).__plus((1));
  6202. $ctx1.sendIdx["+"]=1;
  6203. count=(1);
  6204. array=$recv($globals.Array)._new();
  6205. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  6206. return $core.withContext(function($ctx2) {
  6207. $recv(array)._at_put_(count,first);
  6208. count=$recv(count).__plus((1));
  6209. $ctx2.sendIdx["+"]=2;
  6210. first=$recv(first).__plus((1));
  6211. return first;
  6212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6213. }));
  6214. return array;
  6215. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count})});
  6216. },
  6217. args: ["aNumber"],
  6218. 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",
  6219. referencedClasses: ["Array"],
  6220. pragmas: [],
  6221. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  6222. }),
  6223. $globals.Number);
  6224. $core.addMethod(
  6225. $core.method({
  6226. selector: "to:by:",
  6227. protocol: "converting",
  6228. fn: function (stop,step){
  6229. var self=this,$self=this;
  6230. var array,value,pos;
  6231. return $core.withContext(function($ctx1) {
  6232. var $1,$2;
  6233. value=self;
  6234. array=$recv($globals.Array)._new();
  6235. pos=(1);
  6236. $1=$recv(step).__eq((0));
  6237. if($core.assert($1)){
  6238. $self._error_("step must be non-zero");
  6239. }
  6240. $2=$recv(step).__lt((0));
  6241. if($core.assert($2)){
  6242. $recv((function(){
  6243. return $core.withContext(function($ctx2) {
  6244. return $recv(value).__gt_eq(stop);
  6245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6246. }))._whileTrue_((function(){
  6247. return $core.withContext(function($ctx2) {
  6248. $recv(array)._at_put_(pos,value);
  6249. $ctx2.sendIdx["at:put:"]=1;
  6250. pos=$recv(pos).__plus((1));
  6251. $ctx2.sendIdx["+"]=1;
  6252. value=$recv(value).__plus(step);
  6253. $ctx2.sendIdx["+"]=2;
  6254. return value;
  6255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6256. }));
  6257. $ctx1.sendIdx["whileTrue:"]=1;
  6258. } else {
  6259. $recv((function(){
  6260. return $core.withContext(function($ctx2) {
  6261. return $recv(value).__lt_eq(stop);
  6262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6263. }))._whileTrue_((function(){
  6264. return $core.withContext(function($ctx2) {
  6265. $recv(array)._at_put_(pos,value);
  6266. pos=$recv(pos).__plus((1));
  6267. $ctx2.sendIdx["+"]=3;
  6268. value=$recv(value).__plus(step);
  6269. return value;
  6270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6271. }));
  6272. }
  6273. return array;
  6274. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos})});
  6275. },
  6276. args: ["stop", "step"],
  6277. 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",
  6278. referencedClasses: ["Array"],
  6279. pragmas: [],
  6280. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6281. }),
  6282. $globals.Number);
  6283. $core.addMethod(
  6284. $core.method({
  6285. selector: "to:by:do:",
  6286. protocol: "enumerating",
  6287. fn: function (stop,step,aBlock){
  6288. var self=this,$self=this;
  6289. var value;
  6290. return $core.withContext(function($ctx1) {
  6291. var $1,$2;
  6292. value=self;
  6293. $1=$recv(step).__eq((0));
  6294. if($core.assert($1)){
  6295. $self._error_("step must be non-zero");
  6296. }
  6297. $2=$recv(step).__lt((0));
  6298. if($core.assert($2)){
  6299. $recv((function(){
  6300. return $core.withContext(function($ctx2) {
  6301. return $recv(value).__gt_eq(stop);
  6302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6303. }))._whileTrue_((function(){
  6304. return $core.withContext(function($ctx2) {
  6305. $recv(aBlock)._value_(value);
  6306. $ctx2.sendIdx["value:"]=1;
  6307. value=$recv(value).__plus(step);
  6308. $ctx2.sendIdx["+"]=1;
  6309. return value;
  6310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6311. }));
  6312. $ctx1.sendIdx["whileTrue:"]=1;
  6313. } else {
  6314. $recv((function(){
  6315. return $core.withContext(function($ctx2) {
  6316. return $recv(value).__lt_eq(stop);
  6317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6318. }))._whileTrue_((function(){
  6319. return $core.withContext(function($ctx2) {
  6320. $recv(aBlock)._value_(value);
  6321. value=$recv(value).__plus(step);
  6322. return value;
  6323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6324. }));
  6325. }
  6326. return self;
  6327. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value})});
  6328. },
  6329. args: ["stop", "step", "aBlock"],
  6330. 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 ]]",
  6331. referencedClasses: [],
  6332. pragmas: [],
  6333. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6334. }),
  6335. $globals.Number);
  6336. $core.addMethod(
  6337. $core.method({
  6338. selector: "to:do:",
  6339. protocol: "enumerating",
  6340. fn: function (stop,aBlock){
  6341. var self=this,$self=this;
  6342. var nextValue;
  6343. return $core.withContext(function($ctx1) {
  6344. nextValue=self;
  6345. $recv((function(){
  6346. return $core.withContext(function($ctx2) {
  6347. return $recv(nextValue).__lt_eq(stop);
  6348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6349. }))._whileTrue_((function(){
  6350. return $core.withContext(function($ctx2) {
  6351. $recv(aBlock)._value_(nextValue);
  6352. nextValue=$recv(nextValue).__plus((1));
  6353. return nextValue;
  6354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6355. }));
  6356. return self;
  6357. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue})});
  6358. },
  6359. args: ["stop", "aBlock"],
  6360. 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 ]",
  6361. referencedClasses: [],
  6362. pragmas: [],
  6363. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6364. }),
  6365. $globals.Number);
  6366. $core.addMethod(
  6367. $core.method({
  6368. selector: "truncated",
  6369. protocol: "converting",
  6370. fn: function (){
  6371. var self=this,$self=this;
  6372. return $core.withContext(function($ctx1) {
  6373. if(self >= 0) {
  6374. return Math.floor(self);
  6375. } else {
  6376. return Math.floor(self * (-1)) * (-1);
  6377. };
  6378. ;
  6379. return self;
  6380. }, function($ctx1) {$ctx1.fill(self,"truncated",{})});
  6381. },
  6382. args: [],
  6383. 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'>",
  6384. referencedClasses: [],
  6385. pragmas: [["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"]]],
  6386. messageSends: []
  6387. }),
  6388. $globals.Number);
  6389. $core.addMethod(
  6390. $core.method({
  6391. selector: "|",
  6392. protocol: "converting",
  6393. fn: function (aNumber){
  6394. var self=this,$self=this;
  6395. return $core.withContext(function($ctx1) {
  6396. return self | aNumber;
  6397. return self;
  6398. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber})});
  6399. },
  6400. args: ["aNumber"],
  6401. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6402. referencedClasses: [],
  6403. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  6404. messageSends: []
  6405. }),
  6406. $globals.Number);
  6407. $core.addMethod(
  6408. $core.method({
  6409. selector: "classTag",
  6410. protocol: "accessing",
  6411. fn: function (){
  6412. var self=this,$self=this;
  6413. return "magnitude";
  6414. },
  6415. args: [],
  6416. 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'",
  6417. referencedClasses: [],
  6418. pragmas: [],
  6419. messageSends: []
  6420. }),
  6421. $globals.Number.a$cls);
  6422. $core.addMethod(
  6423. $core.method({
  6424. selector: "e",
  6425. protocol: "instance creation",
  6426. fn: function (){
  6427. var self=this,$self=this;
  6428. return $core.withContext(function($ctx1) {
  6429. return Math.E;;
  6430. return self;
  6431. }, function($ctx1) {$ctx1.fill(self,"e",{})});
  6432. },
  6433. args: [],
  6434. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6435. referencedClasses: [],
  6436. pragmas: [["inlineJS:", ["return Math.E;"]]],
  6437. messageSends: []
  6438. }),
  6439. $globals.Number.a$cls);
  6440. $core.addMethod(
  6441. $core.method({
  6442. selector: "pi",
  6443. protocol: "instance creation",
  6444. fn: function (){
  6445. var self=this,$self=this;
  6446. return $core.withContext(function($ctx1) {
  6447. return Math.PI;
  6448. return self;
  6449. }, function($ctx1) {$ctx1.fill(self,"pi",{})});
  6450. },
  6451. args: [],
  6452. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6453. referencedClasses: [],
  6454. pragmas: [["inlineJS:", ["return Math.PI"]]],
  6455. messageSends: []
  6456. }),
  6457. $globals.Number.a$cls);
  6458. $core.addMethod(
  6459. $core.method({
  6460. selector: "radiansPerDegree",
  6461. protocol: "instance creation",
  6462. fn: function (){
  6463. var self=this,$self=this;
  6464. return $core.withContext(function($ctx1) {
  6465. return $recv($self._pi()).__slash((180));
  6466. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{})});
  6467. },
  6468. args: [],
  6469. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6470. referencedClasses: [],
  6471. pragmas: [],
  6472. messageSends: ["/", "pi"]
  6473. }),
  6474. $globals.Number.a$cls);
  6475. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6476. $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";
  6477. $core.addMethod(
  6478. $core.method({
  6479. selector: "*",
  6480. protocol: "arithmetic",
  6481. fn: function (aPoint){
  6482. var self=this,$self=this;
  6483. return $core.withContext(function($ctx1) {
  6484. var $2,$4,$3,$1,$6,$5;
  6485. $2=$self._x();
  6486. $ctx1.sendIdx["x"]=1;
  6487. $4=$recv(aPoint)._asPoint();
  6488. $ctx1.sendIdx["asPoint"]=1;
  6489. $3=$recv($4)._x();
  6490. $1=$recv($2).__star($3);
  6491. $ctx1.sendIdx["*"]=1;
  6492. $6=$self._y();
  6493. $ctx1.sendIdx["y"]=1;
  6494. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6495. return $recv($globals.Point)._x_y_($1,$5);
  6496. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint})});
  6497. },
  6498. args: ["aPoint"],
  6499. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6500. referencedClasses: ["Point"],
  6501. pragmas: [],
  6502. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6503. }),
  6504. $globals.Point);
  6505. $core.addMethod(
  6506. $core.method({
  6507. selector: "+",
  6508. protocol: "arithmetic",
  6509. fn: function (aPoint){
  6510. var self=this,$self=this;
  6511. return $core.withContext(function($ctx1) {
  6512. var $2,$4,$3,$1,$6,$5;
  6513. $2=$self._x();
  6514. $ctx1.sendIdx["x"]=1;
  6515. $4=$recv(aPoint)._asPoint();
  6516. $ctx1.sendIdx["asPoint"]=1;
  6517. $3=$recv($4)._x();
  6518. $1=$recv($2).__plus($3);
  6519. $ctx1.sendIdx["+"]=1;
  6520. $6=$self._y();
  6521. $ctx1.sendIdx["y"]=1;
  6522. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6523. return $recv($globals.Point)._x_y_($1,$5);
  6524. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint})});
  6525. },
  6526. args: ["aPoint"],
  6527. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6528. referencedClasses: ["Point"],
  6529. pragmas: [],
  6530. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6531. }),
  6532. $globals.Point);
  6533. $core.addMethod(
  6534. $core.method({
  6535. selector: "-",
  6536. protocol: "arithmetic",
  6537. fn: function (aPoint){
  6538. var self=this,$self=this;
  6539. return $core.withContext(function($ctx1) {
  6540. var $2,$4,$3,$1,$6,$5;
  6541. $2=$self._x();
  6542. $ctx1.sendIdx["x"]=1;
  6543. $4=$recv(aPoint)._asPoint();
  6544. $ctx1.sendIdx["asPoint"]=1;
  6545. $3=$recv($4)._x();
  6546. $1=$recv($2).__minus($3);
  6547. $ctx1.sendIdx["-"]=1;
  6548. $6=$self._y();
  6549. $ctx1.sendIdx["y"]=1;
  6550. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6551. return $recv($globals.Point)._x_y_($1,$5);
  6552. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint})});
  6553. },
  6554. args: ["aPoint"],
  6555. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6556. referencedClasses: ["Point"],
  6557. pragmas: [],
  6558. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6559. }),
  6560. $globals.Point);
  6561. $core.addMethod(
  6562. $core.method({
  6563. selector: "/",
  6564. protocol: "arithmetic",
  6565. fn: function (aPoint){
  6566. var self=this,$self=this;
  6567. return $core.withContext(function($ctx1) {
  6568. var $2,$4,$3,$1,$6,$5;
  6569. $2=$self._x();
  6570. $ctx1.sendIdx["x"]=1;
  6571. $4=$recv(aPoint)._asPoint();
  6572. $ctx1.sendIdx["asPoint"]=1;
  6573. $3=$recv($4)._x();
  6574. $1=$recv($2).__slash($3);
  6575. $ctx1.sendIdx["/"]=1;
  6576. $6=$self._y();
  6577. $ctx1.sendIdx["y"]=1;
  6578. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6579. return $recv($globals.Point)._x_y_($1,$5);
  6580. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint})});
  6581. },
  6582. args: ["aPoint"],
  6583. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6584. referencedClasses: ["Point"],
  6585. pragmas: [],
  6586. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6587. }),
  6588. $globals.Point);
  6589. $core.addMethod(
  6590. $core.method({
  6591. selector: "<",
  6592. protocol: "comparing",
  6593. fn: function (aPoint){
  6594. var self=this,$self=this;
  6595. return $core.withContext(function($ctx1) {
  6596. var $2,$1,$3;
  6597. $2=$self._x();
  6598. $ctx1.sendIdx["x"]=1;
  6599. $1=$recv($2).__lt($recv(aPoint)._x());
  6600. $ctx1.sendIdx["<"]=1;
  6601. return $recv($1)._and_((function(){
  6602. return $core.withContext(function($ctx2) {
  6603. $3=$self._y();
  6604. $ctx2.sendIdx["y"]=1;
  6605. return $recv($3).__lt($recv(aPoint)._y());
  6606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6607. }));
  6608. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint})});
  6609. },
  6610. args: ["aPoint"],
  6611. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6612. referencedClasses: [],
  6613. pragmas: [],
  6614. messageSends: ["and:", "<", "x", "y"]
  6615. }),
  6616. $globals.Point);
  6617. $core.addMethod(
  6618. $core.method({
  6619. selector: "<=",
  6620. protocol: "comparing",
  6621. fn: function (aPoint){
  6622. var self=this,$self=this;
  6623. return $core.withContext(function($ctx1) {
  6624. var $2,$1,$3;
  6625. $2=$self._x();
  6626. $ctx1.sendIdx["x"]=1;
  6627. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6628. $ctx1.sendIdx["<="]=1;
  6629. return $recv($1)._and_((function(){
  6630. return $core.withContext(function($ctx2) {
  6631. $3=$self._y();
  6632. $ctx2.sendIdx["y"]=1;
  6633. return $recv($3).__lt_eq($recv(aPoint)._y());
  6634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6635. }));
  6636. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint})});
  6637. },
  6638. args: ["aPoint"],
  6639. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6640. referencedClasses: [],
  6641. pragmas: [],
  6642. messageSends: ["and:", "<=", "x", "y"]
  6643. }),
  6644. $globals.Point);
  6645. $core.addMethod(
  6646. $core.method({
  6647. selector: "=",
  6648. protocol: "comparing",
  6649. fn: function (aPoint){
  6650. var self=this,$self=this;
  6651. return $core.withContext(function($ctx1) {
  6652. var $2,$1,$4,$3,$6,$5;
  6653. $2=$recv(aPoint)._class();
  6654. $ctx1.sendIdx["class"]=1;
  6655. $1=$recv($2).__eq($self._class());
  6656. $ctx1.sendIdx["="]=1;
  6657. return $recv($1)._and_((function(){
  6658. return $core.withContext(function($ctx2) {
  6659. $4=$recv(aPoint)._x();
  6660. $ctx2.sendIdx["x"]=1;
  6661. $3=$recv($4).__eq($self._x());
  6662. $ctx2.sendIdx["="]=2;
  6663. $6=$recv(aPoint)._y();
  6664. $ctx2.sendIdx["y"]=1;
  6665. $5=$recv($6).__eq($self._y());
  6666. return $recv($3).__and($5);
  6667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6668. }));
  6669. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint})});
  6670. },
  6671. args: ["aPoint"],
  6672. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6673. referencedClasses: [],
  6674. pragmas: [],
  6675. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6676. }),
  6677. $globals.Point);
  6678. $core.addMethod(
  6679. $core.method({
  6680. selector: ">",
  6681. protocol: "comparing",
  6682. fn: function (aPoint){
  6683. var self=this,$self=this;
  6684. return $core.withContext(function($ctx1) {
  6685. var $2,$1,$3;
  6686. $2=$self._x();
  6687. $ctx1.sendIdx["x"]=1;
  6688. $1=$recv($2).__gt($recv(aPoint)._x());
  6689. $ctx1.sendIdx[">"]=1;
  6690. return $recv($1)._and_((function(){
  6691. return $core.withContext(function($ctx2) {
  6692. $3=$self._y();
  6693. $ctx2.sendIdx["y"]=1;
  6694. return $recv($3).__gt($recv(aPoint)._y());
  6695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6696. }));
  6697. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint})});
  6698. },
  6699. args: ["aPoint"],
  6700. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6701. referencedClasses: [],
  6702. pragmas: [],
  6703. messageSends: ["and:", ">", "x", "y"]
  6704. }),
  6705. $globals.Point);
  6706. $core.addMethod(
  6707. $core.method({
  6708. selector: ">=",
  6709. protocol: "comparing",
  6710. fn: function (aPoint){
  6711. var self=this,$self=this;
  6712. return $core.withContext(function($ctx1) {
  6713. var $2,$1,$3;
  6714. $2=$self._x();
  6715. $ctx1.sendIdx["x"]=1;
  6716. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6717. $ctx1.sendIdx[">="]=1;
  6718. return $recv($1)._and_((function(){
  6719. return $core.withContext(function($ctx2) {
  6720. $3=$self._y();
  6721. $ctx2.sendIdx["y"]=1;
  6722. return $recv($3).__gt_eq($recv(aPoint)._y());
  6723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6724. }));
  6725. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint})});
  6726. },
  6727. args: ["aPoint"],
  6728. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6729. referencedClasses: [],
  6730. pragmas: [],
  6731. messageSends: ["and:", ">=", "x", "y"]
  6732. }),
  6733. $globals.Point);
  6734. $core.addMethod(
  6735. $core.method({
  6736. selector: "angle",
  6737. protocol: "geometry",
  6738. fn: function (){
  6739. var self=this,$self=this;
  6740. return $core.withContext(function($ctx1) {
  6741. return $recv($self._y())._arcTan_($self._x());
  6742. }, function($ctx1) {$ctx1.fill(self,"angle",{})});
  6743. },
  6744. args: [],
  6745. source: "angle\x0a\x09^ self y arcTan: self x",
  6746. referencedClasses: [],
  6747. pragmas: [],
  6748. messageSends: ["arcTan:", "y", "x"]
  6749. }),
  6750. $globals.Point);
  6751. $core.addMethod(
  6752. $core.method({
  6753. selector: "asPoint",
  6754. protocol: "converting",
  6755. fn: function (){
  6756. var self=this,$self=this;
  6757. return self;
  6758. },
  6759. args: [],
  6760. source: "asPoint\x0a\x09^ self",
  6761. referencedClasses: [],
  6762. pragmas: [],
  6763. messageSends: []
  6764. }),
  6765. $globals.Point);
  6766. $core.addMethod(
  6767. $core.method({
  6768. selector: "corner:",
  6769. protocol: "rectangle creation",
  6770. fn: function (aPoint){
  6771. var self=this,$self=this;
  6772. return $core.withContext(function($ctx1) {
  6773. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6774. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint})});
  6775. },
  6776. args: ["aPoint"],
  6777. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6778. referencedClasses: ["Rectangle"],
  6779. pragmas: [],
  6780. messageSends: ["origin:corner:"]
  6781. }),
  6782. $globals.Point);
  6783. $core.addMethod(
  6784. $core.method({
  6785. selector: "dist:",
  6786. protocol: "transforming",
  6787. fn: function (aPoint){
  6788. var self=this,$self=this;
  6789. var dx,dy;
  6790. return $core.withContext(function($ctx1) {
  6791. var $2,$1;
  6792. dx=$recv($recv(aPoint)._x()).__minus($self.x);
  6793. $ctx1.sendIdx["-"]=1;
  6794. dy=$recv($recv(aPoint)._y()).__minus($self.y);
  6795. $2=$recv(dx).__star(dx);
  6796. $ctx1.sendIdx["*"]=1;
  6797. $1=$recv($2).__plus($recv(dy).__star(dy));
  6798. return $recv($1)._sqrt();
  6799. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy})});
  6800. },
  6801. args: ["aPoint"],
  6802. 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",
  6803. referencedClasses: [],
  6804. pragmas: [],
  6805. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6806. }),
  6807. $globals.Point);
  6808. $core.addMethod(
  6809. $core.method({
  6810. selector: "dotProduct:",
  6811. protocol: "point functions",
  6812. fn: function (aPoint){
  6813. var self=this,$self=this;
  6814. return $core.withContext(function($ctx1) {
  6815. var $1;
  6816. $1=$recv($self.x).__star($recv(aPoint)._x());
  6817. $ctx1.sendIdx["*"]=1;
  6818. return $recv($1).__plus($recv($self.y).__star($recv(aPoint)._y()));
  6819. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint})});
  6820. },
  6821. args: ["aPoint"],
  6822. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6823. referencedClasses: [],
  6824. pragmas: [],
  6825. messageSends: ["+", "*", "x", "y"]
  6826. }),
  6827. $globals.Point);
  6828. $core.addMethod(
  6829. $core.method({
  6830. selector: "extent:",
  6831. protocol: "rectangle creation",
  6832. fn: function (aPoint){
  6833. var self=this,$self=this;
  6834. return $core.withContext(function($ctx1) {
  6835. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6836. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint})});
  6837. },
  6838. args: ["aPoint"],
  6839. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6840. referencedClasses: ["Rectangle"],
  6841. pragmas: [],
  6842. messageSends: ["origin:extent:"]
  6843. }),
  6844. $globals.Point);
  6845. $core.addMethod(
  6846. $core.method({
  6847. selector: "normal",
  6848. protocol: "point functions",
  6849. fn: function (){
  6850. var self=this,$self=this;
  6851. var n,d;
  6852. return $core.withContext(function($ctx1) {
  6853. var $4,$3,$6,$5,$2,$1;
  6854. n=$recv($recv($self.y)._negated()).__at($self.x);
  6855. $ctx1.sendIdx["@"]=1;
  6856. $4=$recv(n)._x();
  6857. $ctx1.sendIdx["x"]=1;
  6858. $3=$recv($4).__star($recv(n)._x());
  6859. $ctx1.sendIdx["*"]=1;
  6860. $6=$recv(n)._y();
  6861. $ctx1.sendIdx["y"]=1;
  6862. $5=$recv($6).__star($recv(n)._y());
  6863. d=$recv($3).__plus($5);
  6864. $2=d;
  6865. $1=$recv($2).__eq((0));
  6866. if($core.assert($1)){
  6867. return (-1).__at((0));
  6868. }
  6869. return $recv(n).__slash($recv(d)._sqrt());
  6870. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d})});
  6871. },
  6872. args: [],
  6873. 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",
  6874. referencedClasses: [],
  6875. pragmas: [],
  6876. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6877. }),
  6878. $globals.Point);
  6879. $core.addMethod(
  6880. $core.method({
  6881. selector: "normalized",
  6882. protocol: "point functions",
  6883. fn: function (){
  6884. var self=this,$self=this;
  6885. var r;
  6886. return $core.withContext(function($ctx1) {
  6887. var $1,$2,$3;
  6888. r=$self._r();
  6889. $1=$recv(r).__eq((0));
  6890. if($core.assert($1)){
  6891. $2=$recv($globals.Point)._x_y_((0),(0));
  6892. $ctx1.sendIdx["x:y:"]=1;
  6893. return $2;
  6894. } else {
  6895. $3=$recv($self.x).__slash(r);
  6896. $ctx1.sendIdx["/"]=1;
  6897. return $recv($globals.Point)._x_y_($3,$recv($self.y).__slash(r));
  6898. }
  6899. return self;
  6900. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r})});
  6901. },
  6902. args: [],
  6903. 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 ]",
  6904. referencedClasses: ["Point"],
  6905. pragmas: [],
  6906. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6907. }),
  6908. $globals.Point);
  6909. $core.addMethod(
  6910. $core.method({
  6911. selector: "printOn:",
  6912. protocol: "printing",
  6913. fn: function (aStream){
  6914. var self=this,$self=this;
  6915. return $core.withContext(function($ctx1) {
  6916. var $1;
  6917. $recv($self.x)._printOn_(aStream);
  6918. $ctx1.sendIdx["printOn:"]=1;
  6919. $recv(aStream)._nextPutAll_("@");
  6920. $1=$recv($recv($self.y)._notNil())._and_((function(){
  6921. return $core.withContext(function($ctx2) {
  6922. return $recv($self.y)._negative();
  6923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6924. }));
  6925. if($core.assert($1)){
  6926. $recv(aStream)._space();
  6927. }
  6928. $recv($self.y)._printOn_(aStream);
  6929. return self;
  6930. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6931. },
  6932. args: ["aStream"],
  6933. 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",
  6934. referencedClasses: [],
  6935. pragmas: [],
  6936. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6937. }),
  6938. $globals.Point);
  6939. $core.addMethod(
  6940. $core.method({
  6941. selector: "r",
  6942. protocol: "polar coordinates",
  6943. fn: function (){
  6944. var self=this,$self=this;
  6945. return $core.withContext(function($ctx1) {
  6946. var $2,$1;
  6947. $2=$recv($self.x).__star($self.x);
  6948. $ctx1.sendIdx["*"]=1;
  6949. $1=$recv($2).__plus($recv($self.y).__star($self.y));
  6950. return $recv($1)._sqrt();
  6951. }, function($ctx1) {$ctx1.fill(self,"r",{})});
  6952. },
  6953. args: [],
  6954. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6955. referencedClasses: [],
  6956. pragmas: [],
  6957. messageSends: ["sqrt", "+", "*"]
  6958. }),
  6959. $globals.Point);
  6960. $core.addMethod(
  6961. $core.method({
  6962. selector: "rectangle:",
  6963. protocol: "rectangle creation",
  6964. fn: function (aPoint){
  6965. var self=this,$self=this;
  6966. return $core.withContext(function($ctx1) {
  6967. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6968. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint})});
  6969. },
  6970. args: ["aPoint"],
  6971. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6972. referencedClasses: ["Rectangle"],
  6973. pragmas: [],
  6974. messageSends: ["point:point:"]
  6975. }),
  6976. $globals.Point);
  6977. $core.addMethod(
  6978. $core.method({
  6979. selector: "translateBy:",
  6980. protocol: "transforming",
  6981. fn: function (delta){
  6982. var self=this,$self=this;
  6983. return $core.withContext(function($ctx1) {
  6984. var $1;
  6985. $1=$recv($recv(delta)._x()).__plus($self.x);
  6986. $ctx1.sendIdx["+"]=1;
  6987. return $recv($1).__at($recv($recv(delta)._y()).__plus($self.y));
  6988. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta})});
  6989. },
  6990. args: ["delta"],
  6991. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6992. referencedClasses: [],
  6993. pragmas: [],
  6994. messageSends: ["@", "+", "x", "y"]
  6995. }),
  6996. $globals.Point);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "x",
  7000. protocol: "accessing",
  7001. fn: function (){
  7002. var self=this,$self=this;
  7003. return $self.x;
  7004. },
  7005. args: [],
  7006. source: "x\x0a\x09^ x",
  7007. referencedClasses: [],
  7008. pragmas: [],
  7009. messageSends: []
  7010. }),
  7011. $globals.Point);
  7012. $core.addMethod(
  7013. $core.method({
  7014. selector: "x:",
  7015. protocol: "accessing",
  7016. fn: function (aNumber){
  7017. var self=this,$self=this;
  7018. $self.x=aNumber;
  7019. return self;
  7020. },
  7021. args: ["aNumber"],
  7022. source: "x: aNumber\x0a\x09x := aNumber",
  7023. referencedClasses: [],
  7024. pragmas: [],
  7025. messageSends: []
  7026. }),
  7027. $globals.Point);
  7028. $core.addMethod(
  7029. $core.method({
  7030. selector: "y",
  7031. protocol: "accessing",
  7032. fn: function (){
  7033. var self=this,$self=this;
  7034. return $self.y;
  7035. },
  7036. args: [],
  7037. source: "y\x0a\x09^ y",
  7038. referencedClasses: [],
  7039. pragmas: [],
  7040. messageSends: []
  7041. }),
  7042. $globals.Point);
  7043. $core.addMethod(
  7044. $core.method({
  7045. selector: "y:",
  7046. protocol: "accessing",
  7047. fn: function (aNumber){
  7048. var self=this,$self=this;
  7049. $self.y=aNumber;
  7050. return self;
  7051. },
  7052. args: ["aNumber"],
  7053. source: "y: aNumber\x0a\x09y := aNumber",
  7054. referencedClasses: [],
  7055. pragmas: [],
  7056. messageSends: []
  7057. }),
  7058. $globals.Point);
  7059. $core.addMethod(
  7060. $core.method({
  7061. selector: "classTag",
  7062. protocol: "accessing",
  7063. fn: function (){
  7064. var self=this,$self=this;
  7065. return "magnitude";
  7066. },
  7067. args: [],
  7068. 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'",
  7069. referencedClasses: [],
  7070. pragmas: [],
  7071. messageSends: []
  7072. }),
  7073. $globals.Point.a$cls);
  7074. $core.addMethod(
  7075. $core.method({
  7076. selector: "x:y:",
  7077. protocol: "instance creation",
  7078. fn: function (aNumber,anotherNumber){
  7079. var self=this,$self=this;
  7080. return $core.withContext(function($ctx1) {
  7081. var $1;
  7082. $1=$self._new();
  7083. $recv($1)._x_(aNumber);
  7084. $recv($1)._y_(anotherNumber);
  7085. return $recv($1)._yourself();
  7086. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  7087. },
  7088. args: ["aNumber", "anotherNumber"],
  7089. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  7090. referencedClasses: [],
  7091. pragmas: [],
  7092. messageSends: ["x:", "new", "y:", "yourself"]
  7093. }),
  7094. $globals.Point.a$cls);
  7095. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  7096. $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'`.";
  7097. $core.addMethod(
  7098. $core.method({
  7099. selector: "next",
  7100. protocol: "accessing",
  7101. fn: function (){
  7102. var self=this,$self=this;
  7103. return $core.withContext(function($ctx1) {
  7104. return Math.random();
  7105. return self;
  7106. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7107. },
  7108. args: [],
  7109. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  7110. referencedClasses: [],
  7111. pragmas: [["inlineJS:", ["return Math.random()"]]],
  7112. messageSends: []
  7113. }),
  7114. $globals.Random);
  7115. $core.addMethod(
  7116. $core.method({
  7117. selector: "next:",
  7118. protocol: "accessing",
  7119. fn: function (anInteger){
  7120. var self=this,$self=this;
  7121. return $core.withContext(function($ctx1) {
  7122. return $recv((1)._to_(anInteger))._collect_((function(each){
  7123. return $core.withContext(function($ctx2) {
  7124. return $self._next();
  7125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7126. }));
  7127. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger})});
  7128. },
  7129. args: ["anInteger"],
  7130. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  7131. referencedClasses: [],
  7132. pragmas: [],
  7133. messageSends: ["collect:", "to:", "next"]
  7134. }),
  7135. $globals.Random);
  7136. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  7137. $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.";
  7138. $core.addMethod(
  7139. $core.method({
  7140. selector: "=",
  7141. protocol: "testing",
  7142. fn: function (aRectangle){
  7143. var self=this,$self=this;
  7144. return $core.withContext(function($ctx1) {
  7145. var $1;
  7146. $1=$recv($self.origin).__eq($recv(aRectangle)._origin());
  7147. $ctx1.sendIdx["="]=1;
  7148. return $recv($1)._and_((function(){
  7149. return $core.withContext(function($ctx2) {
  7150. return $recv($self.corner).__eq($recv(aRectangle)._corner());
  7151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7152. }));
  7153. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle})});
  7154. },
  7155. args: ["aRectangle"],
  7156. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  7157. referencedClasses: [],
  7158. pragmas: [],
  7159. messageSends: ["and:", "=", "origin", "corner"]
  7160. }),
  7161. $globals.Rectangle);
  7162. $core.addMethod(
  7163. $core.method({
  7164. selector: "containsPoint:",
  7165. protocol: "testing",
  7166. fn: function (aPoint){
  7167. var self=this,$self=this;
  7168. return $core.withContext(function($ctx1) {
  7169. return $recv($recv($self.origin).__lt_eq(aPoint))._and_((function(){
  7170. return $core.withContext(function($ctx2) {
  7171. return $recv($self.corner).__gt_eq(aPoint);
  7172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7173. }));
  7174. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint})});
  7175. },
  7176. args: ["aPoint"],
  7177. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  7178. referencedClasses: [],
  7179. pragmas: [],
  7180. messageSends: ["and:", "<=", ">="]
  7181. }),
  7182. $globals.Rectangle);
  7183. $core.addMethod(
  7184. $core.method({
  7185. selector: "containsRect:",
  7186. protocol: "testing",
  7187. fn: function (aRect){
  7188. var self=this,$self=this;
  7189. return $core.withContext(function($ctx1) {
  7190. return $recv($recv($recv(aRect)._origin()).__gt_eq($self.origin))._and_((function(){
  7191. return $core.withContext(function($ctx2) {
  7192. return $recv($recv(aRect)._corner()).__lt_eq($self.corner);
  7193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7194. }));
  7195. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect})});
  7196. },
  7197. args: ["aRect"],
  7198. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  7199. referencedClasses: [],
  7200. pragmas: [],
  7201. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  7202. }),
  7203. $globals.Rectangle);
  7204. $core.addMethod(
  7205. $core.method({
  7206. selector: "corner",
  7207. protocol: "accessing",
  7208. fn: function (){
  7209. var self=this,$self=this;
  7210. return $self.corner;
  7211. },
  7212. args: [],
  7213. source: "corner\x0a\x09^ corner",
  7214. referencedClasses: [],
  7215. pragmas: [],
  7216. messageSends: []
  7217. }),
  7218. $globals.Rectangle);
  7219. $core.addMethod(
  7220. $core.method({
  7221. selector: "origin",
  7222. protocol: "accessing",
  7223. fn: function (){
  7224. var self=this,$self=this;
  7225. return $self.origin;
  7226. },
  7227. args: [],
  7228. source: "origin\x0a\x09^ origin",
  7229. referencedClasses: [],
  7230. pragmas: [],
  7231. messageSends: []
  7232. }),
  7233. $globals.Rectangle);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "printOn:",
  7237. protocol: "testing",
  7238. fn: function (aStream){
  7239. var self=this,$self=this;
  7240. return $core.withContext(function($ctx1) {
  7241. $recv($self.origin)._printOn_(aStream);
  7242. $ctx1.sendIdx["printOn:"]=1;
  7243. $recv(aStream)._nextPutAll_(" corner: ");
  7244. $recv($self.corner)._printOn_(aStream);
  7245. return self;
  7246. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7247. },
  7248. args: ["aStream"],
  7249. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  7250. referencedClasses: [],
  7251. pragmas: [],
  7252. messageSends: ["printOn:", "nextPutAll:"]
  7253. }),
  7254. $globals.Rectangle);
  7255. $core.addMethod(
  7256. $core.method({
  7257. selector: "setPoint:point:",
  7258. protocol: "private",
  7259. fn: function (pt1,pt2){
  7260. var self=this,$self=this;
  7261. return $core.withContext(function($ctx1) {
  7262. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  7263. $2=$recv(pt1)._x();
  7264. $ctx1.sendIdx["x"]=1;
  7265. $3=$recv(pt2)._x();
  7266. $ctx1.sendIdx["x"]=2;
  7267. $1=$recv($2)._min_($3);
  7268. $ctx1.sendIdx["min:"]=1;
  7269. $5=$recv(pt1)._y();
  7270. $ctx1.sendIdx["y"]=1;
  7271. $6=$recv(pt2)._y();
  7272. $ctx1.sendIdx["y"]=2;
  7273. $4=$recv($5)._min_($6);
  7274. $self.origin=$recv($1).__at($4);
  7275. $ctx1.sendIdx["@"]=1;
  7276. $8=$recv(pt1)._x();
  7277. $ctx1.sendIdx["x"]=3;
  7278. $7=$recv($8)._max_($recv(pt2)._x());
  7279. $ctx1.sendIdx["max:"]=1;
  7280. $10=$recv(pt1)._y();
  7281. $ctx1.sendIdx["y"]=3;
  7282. $9=$recv($10)._max_($recv(pt2)._y());
  7283. $self.corner=$recv($7).__at($9);
  7284. return self;
  7285. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2})});
  7286. },
  7287. args: ["pt1", "pt2"],
  7288. 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).",
  7289. referencedClasses: [],
  7290. pragmas: [],
  7291. messageSends: ["@", "min:", "x", "y", "max:"]
  7292. }),
  7293. $globals.Rectangle);
  7294. $core.addMethod(
  7295. $core.method({
  7296. selector: "origin:corner:",
  7297. protocol: "instance creation",
  7298. fn: function (anOrigin,aCorner){
  7299. var self=this,$self=this;
  7300. return $core.withContext(function($ctx1) {
  7301. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7302. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner})});
  7303. },
  7304. args: ["anOrigin", "aCorner"],
  7305. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7306. referencedClasses: [],
  7307. pragmas: [],
  7308. messageSends: ["setPoint:point:", "basicNew"]
  7309. }),
  7310. $globals.Rectangle.a$cls);
  7311. $core.addMethod(
  7312. $core.method({
  7313. selector: "origin:extent:",
  7314. protocol: "instance creation",
  7315. fn: function (anOrigin,anExtent){
  7316. var self=this,$self=this;
  7317. return $core.withContext(function($ctx1) {
  7318. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7319. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent})});
  7320. },
  7321. args: ["anOrigin", "anExtent"],
  7322. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7323. referencedClasses: [],
  7324. pragmas: [],
  7325. messageSends: ["setPoint:point:", "basicNew", "+"]
  7326. }),
  7327. $globals.Rectangle.a$cls);
  7328. $core.addMethod(
  7329. $core.method({
  7330. selector: "point:point:",
  7331. protocol: "instance creation",
  7332. fn: function (anOrigin,aCorner){
  7333. var self=this,$self=this;
  7334. return $core.withContext(function($ctx1) {
  7335. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7336. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner})});
  7337. },
  7338. args: ["anOrigin", "aCorner"],
  7339. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7340. referencedClasses: [],
  7341. pragmas: [],
  7342. messageSends: ["setPoint:point:", "basicNew"]
  7343. }),
  7344. $globals.Rectangle.a$cls);
  7345. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7346. $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`.";
  7347. $core.addMethod(
  7348. $core.method({
  7349. selector: "==",
  7350. protocol: "testing",
  7351. fn: function (anObject){
  7352. var self=this,$self=this;
  7353. return $core.withContext(function($ctx1) {
  7354. return $recv(anObject)._isNil();
  7355. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  7356. },
  7357. args: ["anObject"],
  7358. source: "== anObject\x0a\x09^ anObject isNil",
  7359. referencedClasses: [],
  7360. pragmas: [],
  7361. messageSends: ["isNil"]
  7362. }),
  7363. $globals.UndefinedObject);
  7364. $core.addMethod(
  7365. $core.method({
  7366. selector: "asJavaScriptObject",
  7367. protocol: "converting",
  7368. fn: function (){
  7369. var self=this,$self=this;
  7370. return null;
  7371. },
  7372. args: [],
  7373. source: "asJavaScriptObject\x0a\x09^ null",
  7374. referencedClasses: [],
  7375. pragmas: [],
  7376. messageSends: []
  7377. }),
  7378. $globals.UndefinedObject);
  7379. $core.addMethod(
  7380. $core.method({
  7381. selector: "deepCopy",
  7382. protocol: "copying",
  7383. fn: function (){
  7384. var self=this,$self=this;
  7385. return self;
  7386. },
  7387. args: [],
  7388. source: "deepCopy\x0a\x09^ self",
  7389. referencedClasses: [],
  7390. pragmas: [],
  7391. messageSends: []
  7392. }),
  7393. $globals.UndefinedObject);
  7394. $core.addMethod(
  7395. $core.method({
  7396. selector: "identityHash",
  7397. protocol: "accessing",
  7398. fn: function (){
  7399. var self=this,$self=this;
  7400. return "NIL";
  7401. },
  7402. args: [],
  7403. source: "identityHash\x0a\x09^ 'NIL'",
  7404. referencedClasses: [],
  7405. pragmas: [],
  7406. messageSends: []
  7407. }),
  7408. $globals.UndefinedObject);
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "ifNil:",
  7412. protocol: "testing",
  7413. fn: function (aBlock){
  7414. var self=this,$self=this;
  7415. return $core.withContext(function($ctx1) {
  7416. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7417. }));
  7418. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock})});
  7419. },
  7420. args: ["aBlock"],
  7421. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7422. referencedClasses: [],
  7423. pragmas: [],
  7424. messageSends: ["ifNil:ifNotNil:"]
  7425. }),
  7426. $globals.UndefinedObject);
  7427. $core.addMethod(
  7428. $core.method({
  7429. selector: "ifNil:ifNotNil:",
  7430. protocol: "testing",
  7431. fn: function (aBlock,anotherBlock){
  7432. var self=this,$self=this;
  7433. return $core.withContext(function($ctx1) {
  7434. return $recv(aBlock)._value();
  7435. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7436. },
  7437. args: ["aBlock", "anotherBlock"],
  7438. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7439. referencedClasses: [],
  7440. pragmas: [],
  7441. messageSends: ["value"]
  7442. }),
  7443. $globals.UndefinedObject);
  7444. $core.addMethod(
  7445. $core.method({
  7446. selector: "ifNotNil:",
  7447. protocol: "testing",
  7448. fn: function (aBlock){
  7449. var self=this,$self=this;
  7450. return self;
  7451. },
  7452. args: ["aBlock"],
  7453. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7454. referencedClasses: [],
  7455. pragmas: [],
  7456. messageSends: []
  7457. }),
  7458. $globals.UndefinedObject);
  7459. $core.addMethod(
  7460. $core.method({
  7461. selector: "ifNotNil:ifNil:",
  7462. protocol: "testing",
  7463. fn: function (aBlock,anotherBlock){
  7464. var self=this,$self=this;
  7465. return $core.withContext(function($ctx1) {
  7466. return $recv(anotherBlock)._value();
  7467. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7468. },
  7469. args: ["aBlock", "anotherBlock"],
  7470. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7471. referencedClasses: [],
  7472. pragmas: [],
  7473. messageSends: ["value"]
  7474. }),
  7475. $globals.UndefinedObject);
  7476. $core.addMethod(
  7477. $core.method({
  7478. selector: "isImmutable",
  7479. protocol: "testing",
  7480. fn: function (){
  7481. var self=this,$self=this;
  7482. return true;
  7483. },
  7484. args: [],
  7485. source: "isImmutable\x0a\x09^ true",
  7486. referencedClasses: [],
  7487. pragmas: [],
  7488. messageSends: []
  7489. }),
  7490. $globals.UndefinedObject);
  7491. $core.addMethod(
  7492. $core.method({
  7493. selector: "isNil",
  7494. protocol: "testing",
  7495. fn: function (){
  7496. var self=this,$self=this;
  7497. return true;
  7498. },
  7499. args: [],
  7500. source: "isNil\x0a\x09^ true",
  7501. referencedClasses: [],
  7502. pragmas: [],
  7503. messageSends: []
  7504. }),
  7505. $globals.UndefinedObject);
  7506. $core.addMethod(
  7507. $core.method({
  7508. selector: "notNil",
  7509. protocol: "testing",
  7510. fn: function (){
  7511. var self=this,$self=this;
  7512. return false;
  7513. },
  7514. args: [],
  7515. source: "notNil\x0a\x09^ false",
  7516. referencedClasses: [],
  7517. pragmas: [],
  7518. messageSends: []
  7519. }),
  7520. $globals.UndefinedObject);
  7521. $core.addMethod(
  7522. $core.method({
  7523. selector: "printOn:",
  7524. protocol: "printing",
  7525. fn: function (aStream){
  7526. var self=this,$self=this;
  7527. return $core.withContext(function($ctx1) {
  7528. $recv(aStream)._nextPutAll_("nil");
  7529. return self;
  7530. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7531. },
  7532. args: ["aStream"],
  7533. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7534. referencedClasses: [],
  7535. pragmas: [],
  7536. messageSends: ["nextPutAll:"]
  7537. }),
  7538. $globals.UndefinedObject);
  7539. $core.addMethod(
  7540. $core.method({
  7541. selector: "shallowCopy",
  7542. protocol: "copying",
  7543. fn: function (){
  7544. var self=this,$self=this;
  7545. return self;
  7546. },
  7547. args: [],
  7548. source: "shallowCopy\x0a\x09^ self",
  7549. referencedClasses: [],
  7550. pragmas: [],
  7551. messageSends: []
  7552. }),
  7553. $globals.UndefinedObject);
  7554. $core.addMethod(
  7555. $core.method({
  7556. selector: "value",
  7557. protocol: "evaluating",
  7558. fn: function (){
  7559. var self=this,$self=this;
  7560. return $core.withContext(function($ctx1) {
  7561. return null;
  7562. return self;
  7563. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  7564. },
  7565. args: [],
  7566. source: "value\x0a\x09<inlineJS: 'return null'>",
  7567. referencedClasses: [],
  7568. pragmas: [["inlineJS:", ["return null"]]],
  7569. messageSends: []
  7570. }),
  7571. $globals.UndefinedObject);
  7572. $core.addMethod(
  7573. $core.method({
  7574. selector: "new",
  7575. protocol: "instance creation",
  7576. fn: function (){
  7577. var self=this,$self=this;
  7578. return $core.withContext(function($ctx1) {
  7579. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7580. return self;
  7581. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  7582. },
  7583. args: [],
  7584. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7585. referencedClasses: [],
  7586. pragmas: [],
  7587. messageSends: ["error:"]
  7588. }),
  7589. $globals.UndefinedObject.a$cls);
  7590. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7591. });
  7592. define('amber/core/Kernel-Collections',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  7593. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7594. var $pkg = $core.addPackage("Kernel-Collections");
  7595. $pkg.innerEval = function (expr) { return eval(expr); };
  7596. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  7597. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7598. $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:`";
  7599. $core.addMethod(
  7600. $core.method({
  7601. selector: "=",
  7602. protocol: "comparing",
  7603. fn: function (anAssociation){
  7604. var self=this,$self=this;
  7605. return $core.withContext(function($ctx1) {
  7606. var $3,$2,$5,$4,$6,$1;
  7607. $3=$self._class();
  7608. $ctx1.sendIdx["class"]=1;
  7609. $2=$recv($3).__eq($recv(anAssociation)._class());
  7610. $ctx1.sendIdx["="]=1;
  7611. $1=$recv($2)._and_((function(){
  7612. return $core.withContext(function($ctx2) {
  7613. $5=$self._key();
  7614. $ctx2.sendIdx["key"]=1;
  7615. $4=$recv($5).__eq($recv(anAssociation)._key());
  7616. $ctx2.sendIdx["="]=2;
  7617. return $recv($4)._and_((function(){
  7618. return $core.withContext(function($ctx3) {
  7619. $6=$self._value();
  7620. $ctx3.sendIdx["value"]=1;
  7621. return $recv($6).__eq($recv(anAssociation)._value());
  7622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7623. }));
  7624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7625. }));
  7626. $ctx1.sendIdx["and:"]=1;
  7627. return $1;
  7628. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  7629. },
  7630. args: ["anAssociation"],
  7631. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7632. referencedClasses: [],
  7633. pragmas: [],
  7634. messageSends: ["and:", "=", "class", "key", "value"]
  7635. }),
  7636. $globals.Association);
  7637. $core.addMethod(
  7638. $core.method({
  7639. selector: "key",
  7640. protocol: "accessing",
  7641. fn: function (){
  7642. var self=this,$self=this;
  7643. return $self.key;
  7644. },
  7645. args: [],
  7646. source: "key\x0a\x09^ key",
  7647. referencedClasses: [],
  7648. pragmas: [],
  7649. messageSends: []
  7650. }),
  7651. $globals.Association);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "key:",
  7655. protocol: "accessing",
  7656. fn: function (aKey){
  7657. var self=this,$self=this;
  7658. $self.key=aKey;
  7659. return self;
  7660. },
  7661. args: ["aKey"],
  7662. source: "key: aKey\x0a\x09key := aKey",
  7663. referencedClasses: [],
  7664. pragmas: [],
  7665. messageSends: []
  7666. }),
  7667. $globals.Association);
  7668. $core.addMethod(
  7669. $core.method({
  7670. selector: "printOn:",
  7671. protocol: "printing",
  7672. fn: function (aStream){
  7673. var self=this,$self=this;
  7674. return $core.withContext(function($ctx1) {
  7675. $recv($self._key())._printOn_(aStream);
  7676. $ctx1.sendIdx["printOn:"]=1;
  7677. $recv(aStream)._nextPutAll_(" -> ");
  7678. $recv($self._value())._printOn_(aStream);
  7679. return self;
  7680. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7681. },
  7682. args: ["aStream"],
  7683. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7684. referencedClasses: [],
  7685. pragmas: [],
  7686. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7687. }),
  7688. $globals.Association);
  7689. $core.addMethod(
  7690. $core.method({
  7691. selector: "value",
  7692. protocol: "accessing",
  7693. fn: function (){
  7694. var self=this,$self=this;
  7695. return $self.value;
  7696. },
  7697. args: [],
  7698. source: "value\x0a\x09^ value",
  7699. referencedClasses: [],
  7700. pragmas: [],
  7701. messageSends: []
  7702. }),
  7703. $globals.Association);
  7704. $core.addMethod(
  7705. $core.method({
  7706. selector: "value:",
  7707. protocol: "accessing",
  7708. fn: function (aValue){
  7709. var self=this,$self=this;
  7710. $self.value=aValue;
  7711. return self;
  7712. },
  7713. args: ["aValue"],
  7714. source: "value: aValue\x0a\x09value := aValue",
  7715. referencedClasses: [],
  7716. pragmas: [],
  7717. messageSends: []
  7718. }),
  7719. $globals.Association);
  7720. $core.addMethod(
  7721. $core.method({
  7722. selector: "key:value:",
  7723. protocol: "instance creation",
  7724. fn: function (aKey,aValue){
  7725. var self=this,$self=this;
  7726. return $core.withContext(function($ctx1) {
  7727. var $1;
  7728. $1=$self._new();
  7729. $recv($1)._key_(aKey);
  7730. $recv($1)._value_(aValue);
  7731. return $recv($1)._yourself();
  7732. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  7733. },
  7734. args: ["aKey", "aValue"],
  7735. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7736. referencedClasses: [],
  7737. pragmas: [],
  7738. messageSends: ["key:", "new", "value:", "yourself"]
  7739. }),
  7740. $globals.Association.a$cls);
  7741. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7742. $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`.";
  7743. $core.addMethod(
  7744. $core.method({
  7745. selector: "bucketOfElement:",
  7746. protocol: "accessing",
  7747. fn: function (anObject){
  7748. var self=this,$self=this;
  7749. return $core.withContext(function($ctx1) {
  7750. var hash = $self.hashBlock(anObject);
  7751. if (!hash) return null;
  7752. var buckets = $self.buckets,
  7753. bucket = buckets[hash];
  7754. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7755. return bucket;
  7756. ;
  7757. return self;
  7758. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  7759. },
  7760. args: ["anObject"],
  7761. 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'>",
  7762. referencedClasses: [],
  7763. pragmas: [["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"]]],
  7764. messageSends: []
  7765. }),
  7766. $globals.BucketStore);
  7767. $core.addMethod(
  7768. $core.method({
  7769. selector: "do:",
  7770. protocol: "enumerating",
  7771. fn: function (aBlock){
  7772. var self=this,$self=this;
  7773. return $core.withContext(function($ctx1) {
  7774. var buckets = $self.buckets;
  7775. var keys = Object.keys(buckets);
  7776. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7777. ;
  7778. return self;
  7779. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7780. },
  7781. args: ["aBlock"],
  7782. 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'>",
  7783. referencedClasses: [],
  7784. pragmas: [["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"]]],
  7785. messageSends: []
  7786. }),
  7787. $globals.BucketStore);
  7788. $core.addMethod(
  7789. $core.method({
  7790. selector: "hashBlock:",
  7791. protocol: "accessing",
  7792. fn: function (aBlock){
  7793. var self=this,$self=this;
  7794. $self.hashBlock=aBlock;
  7795. return self;
  7796. },
  7797. args: ["aBlock"],
  7798. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7799. referencedClasses: [],
  7800. pragmas: [],
  7801. messageSends: []
  7802. }),
  7803. $globals.BucketStore);
  7804. $core.addMethod(
  7805. $core.method({
  7806. selector: "initialize",
  7807. protocol: "initialization",
  7808. fn: function (){
  7809. var self=this,$self=this;
  7810. return $core.withContext(function($ctx1) {
  7811. (
  7812. $ctx1.supercall = true,
  7813. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7814. $ctx1.supercall = false;
  7815. $self._removeAll();
  7816. return self;
  7817. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7818. },
  7819. args: [],
  7820. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7821. referencedClasses: [],
  7822. pragmas: [],
  7823. messageSends: ["initialize", "removeAll"]
  7824. }),
  7825. $globals.BucketStore);
  7826. $core.addMethod(
  7827. $core.method({
  7828. selector: "newBucket",
  7829. protocol: "private",
  7830. fn: function (){
  7831. var self=this,$self=this;
  7832. return $core.withContext(function($ctx1) {
  7833. $self._subclassResponsibility();
  7834. return self;
  7835. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  7836. },
  7837. args: [],
  7838. source: "newBucket\x0a\x09self subclassResponsibility",
  7839. referencedClasses: [],
  7840. pragmas: [],
  7841. messageSends: ["subclassResponsibility"]
  7842. }),
  7843. $globals.BucketStore);
  7844. $core.addMethod(
  7845. $core.method({
  7846. selector: "removeAll",
  7847. protocol: "adding/removing",
  7848. fn: function (){
  7849. var self=this,$self=this;
  7850. return $core.withContext(function($ctx1) {
  7851. $self.buckets = Object.create(null);;
  7852. return self;
  7853. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7854. },
  7855. args: [],
  7856. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  7857. referencedClasses: [],
  7858. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  7859. messageSends: []
  7860. }),
  7861. $globals.BucketStore);
  7862. $core.addMethod(
  7863. $core.method({
  7864. selector: "hashBlock:",
  7865. protocol: "instance creation",
  7866. fn: function (aBlock){
  7867. var self=this,$self=this;
  7868. return $core.withContext(function($ctx1) {
  7869. var $1;
  7870. $1=$self._new();
  7871. $recv($1)._hashBlock_(aBlock);
  7872. return $recv($1)._yourself();
  7873. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  7874. },
  7875. args: ["aBlock"],
  7876. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7877. referencedClasses: [],
  7878. pragmas: [],
  7879. messageSends: ["hashBlock:", "new", "yourself"]
  7880. }),
  7881. $globals.BucketStore.a$cls);
  7882. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7883. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7884. $core.addMethod(
  7885. $core.method({
  7886. selector: "newBucket",
  7887. protocol: "private",
  7888. fn: function (){
  7889. var self=this,$self=this;
  7890. return [];
  7891. },
  7892. args: [],
  7893. source: "newBucket\x0a\x09^ #()",
  7894. referencedClasses: [],
  7895. pragmas: [],
  7896. messageSends: []
  7897. }),
  7898. $globals.ArrayBucketStore);
  7899. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7900. $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.";
  7901. $core.addMethod(
  7902. $core.method({
  7903. selector: ",",
  7904. protocol: "copying",
  7905. fn: function (aCollection){
  7906. var self=this,$self=this;
  7907. return $core.withContext(function($ctx1) {
  7908. var $1;
  7909. $1=$self._copy();
  7910. $recv($1)._addAll_(aCollection);
  7911. return $recv($1)._yourself();
  7912. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  7913. },
  7914. args: ["aCollection"],
  7915. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7916. referencedClasses: [],
  7917. pragmas: [],
  7918. messageSends: ["addAll:", "copy", "yourself"]
  7919. }),
  7920. $globals.Collection);
  7921. $core.addMethod(
  7922. $core.method({
  7923. selector: "add:",
  7924. protocol: "adding/removing",
  7925. fn: function (anObject){
  7926. var self=this,$self=this;
  7927. return $core.withContext(function($ctx1) {
  7928. $self._subclassResponsibility();
  7929. return self;
  7930. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  7931. },
  7932. args: ["anObject"],
  7933. source: "add: anObject\x0a\x09self subclassResponsibility",
  7934. referencedClasses: [],
  7935. pragmas: [],
  7936. messageSends: ["subclassResponsibility"]
  7937. }),
  7938. $globals.Collection);
  7939. $core.addMethod(
  7940. $core.method({
  7941. selector: "addAll:",
  7942. protocol: "adding/removing",
  7943. fn: function (aCollection){
  7944. var self=this,$self=this;
  7945. return $core.withContext(function($ctx1) {
  7946. $recv(aCollection)._do_((function(each){
  7947. return $core.withContext(function($ctx2) {
  7948. return $self._add_(each);
  7949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7950. }));
  7951. return aCollection;
  7952. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  7953. },
  7954. args: ["aCollection"],
  7955. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7956. referencedClasses: [],
  7957. pragmas: [],
  7958. messageSends: ["do:", "add:"]
  7959. }),
  7960. $globals.Collection);
  7961. $core.addMethod(
  7962. $core.method({
  7963. selector: "allSatisfy:",
  7964. protocol: "enumerating",
  7965. fn: function (aBlock){
  7966. var self=this,$self=this;
  7967. return $core.withContext(function($ctx1) {
  7968. var $1;
  7969. var $early={};
  7970. try {
  7971. $self._do_((function(each){
  7972. return $core.withContext(function($ctx2) {
  7973. $1=$recv(aBlock)._value_(each);
  7974. if(!$core.assert($1)){
  7975. throw $early=[false];
  7976. }
  7977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7978. }));
  7979. return true;
  7980. }
  7981. catch(e) {if(e===$early)return e[0]; throw e}
  7982. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  7983. },
  7984. args: ["aBlock"],
  7985. 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",
  7986. referencedClasses: [],
  7987. pragmas: [],
  7988. messageSends: ["do:", "ifFalse:", "value:"]
  7989. }),
  7990. $globals.Collection);
  7991. $core.addMethod(
  7992. $core.method({
  7993. selector: "anyOne",
  7994. protocol: "accessing",
  7995. fn: function (){
  7996. var self=this,$self=this;
  7997. return $core.withContext(function($ctx1) {
  7998. var $early={};
  7999. try {
  8000. $self._ifEmpty_((function(){
  8001. return $core.withContext(function($ctx2) {
  8002. return $self._error_("Collection is empty");
  8003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8004. }));
  8005. $self._do_((function(each){
  8006. throw $early=[each];
  8007. }));
  8008. return self;
  8009. }
  8010. catch(e) {if(e===$early)return e[0]; throw e}
  8011. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  8012. },
  8013. args: [],
  8014. 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 ]",
  8015. referencedClasses: [],
  8016. pragmas: [],
  8017. messageSends: ["ifEmpty:", "error:", "do:"]
  8018. }),
  8019. $globals.Collection);
  8020. $core.addMethod(
  8021. $core.method({
  8022. selector: "anySatisfy:",
  8023. protocol: "enumerating",
  8024. fn: function (aBlock){
  8025. var self=this,$self=this;
  8026. return $core.withContext(function($ctx1) {
  8027. var $1;
  8028. var $early={};
  8029. try {
  8030. $self._do_((function(each){
  8031. return $core.withContext(function($ctx2) {
  8032. $1=$recv(aBlock)._value_(each);
  8033. if($core.assert($1)){
  8034. throw $early=[true];
  8035. }
  8036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8037. }));
  8038. return false;
  8039. }
  8040. catch(e) {if(e===$early)return e[0]; throw e}
  8041. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  8042. },
  8043. args: ["aBlock"],
  8044. 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",
  8045. referencedClasses: [],
  8046. pragmas: [],
  8047. messageSends: ["do:", "ifTrue:", "value:"]
  8048. }),
  8049. $globals.Collection);
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "asArray",
  8053. protocol: "converting",
  8054. fn: function (){
  8055. var self=this,$self=this;
  8056. return $core.withContext(function($ctx1) {
  8057. return $recv($globals.Array)._withAll_(self);
  8058. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  8059. },
  8060. args: [],
  8061. source: "asArray\x0a\x09^ Array withAll: self",
  8062. referencedClasses: ["Array"],
  8063. pragmas: [],
  8064. messageSends: ["withAll:"]
  8065. }),
  8066. $globals.Collection);
  8067. $core.addMethod(
  8068. $core.method({
  8069. selector: "asJavaScriptObject",
  8070. protocol: "converting",
  8071. fn: function (){
  8072. var self=this,$self=this;
  8073. return $core.withContext(function($ctx1) {
  8074. return $recv($self._asArray())._collect_((function(each){
  8075. return $core.withContext(function($ctx2) {
  8076. return $recv(each)._asJavaScriptObject();
  8077. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8078. }));
  8079. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  8080. },
  8081. args: [],
  8082. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  8083. referencedClasses: [],
  8084. pragmas: [],
  8085. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  8086. }),
  8087. $globals.Collection);
  8088. $core.addMethod(
  8089. $core.method({
  8090. selector: "asOrderedCollection",
  8091. protocol: "converting",
  8092. fn: function (){
  8093. var self=this,$self=this;
  8094. return $core.withContext(function($ctx1) {
  8095. return $self._asArray();
  8096. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  8097. },
  8098. args: [],
  8099. source: "asOrderedCollection\x0a\x09^ self asArray",
  8100. referencedClasses: [],
  8101. pragmas: [],
  8102. messageSends: ["asArray"]
  8103. }),
  8104. $globals.Collection);
  8105. $core.addMethod(
  8106. $core.method({
  8107. selector: "asSet",
  8108. protocol: "converting",
  8109. fn: function (){
  8110. var self=this,$self=this;
  8111. return $core.withContext(function($ctx1) {
  8112. return $recv($globals.Set)._withAll_(self);
  8113. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  8114. },
  8115. args: [],
  8116. source: "asSet\x0a\x09^ Set withAll: self",
  8117. referencedClasses: ["Set"],
  8118. pragmas: [],
  8119. messageSends: ["withAll:"]
  8120. }),
  8121. $globals.Collection);
  8122. $core.addMethod(
  8123. $core.method({
  8124. selector: "collect:",
  8125. protocol: "enumerating",
  8126. fn: function (aBlock){
  8127. var self=this,$self=this;
  8128. var stream;
  8129. return $core.withContext(function($ctx1) {
  8130. stream=$recv($recv($self._class())._new())._writeStream();
  8131. $self._do_((function(each){
  8132. return $core.withContext(function($ctx2) {
  8133. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  8134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8135. }));
  8136. return $recv(stream)._contents();
  8137. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  8138. },
  8139. args: ["aBlock"],
  8140. 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",
  8141. referencedClasses: [],
  8142. pragmas: [],
  8143. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  8144. }),
  8145. $globals.Collection);
  8146. $core.addMethod(
  8147. $core.method({
  8148. selector: "copyWith:",
  8149. protocol: "copying",
  8150. fn: function (anObject){
  8151. var self=this,$self=this;
  8152. return $core.withContext(function($ctx1) {
  8153. var $1;
  8154. $1=$self._copy();
  8155. $recv($1)._add_(anObject);
  8156. return $recv($1)._yourself();
  8157. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  8158. },
  8159. args: ["anObject"],
  8160. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  8161. referencedClasses: [],
  8162. pragmas: [],
  8163. messageSends: ["add:", "copy", "yourself"]
  8164. }),
  8165. $globals.Collection);
  8166. $core.addMethod(
  8167. $core.method({
  8168. selector: "copyWithAll:",
  8169. protocol: "copying",
  8170. fn: function (aCollection){
  8171. var self=this,$self=this;
  8172. return $core.withContext(function($ctx1) {
  8173. $self._deprecatedAPI_("Use #, instead.");
  8174. return $self.__comma(aCollection);
  8175. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  8176. },
  8177. args: ["aCollection"],
  8178. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  8179. referencedClasses: [],
  8180. pragmas: [],
  8181. messageSends: ["deprecatedAPI:", ","]
  8182. }),
  8183. $globals.Collection);
  8184. $core.addMethod(
  8185. $core.method({
  8186. selector: "copyWithout:",
  8187. protocol: "copying",
  8188. fn: function (anObject){
  8189. var self=this,$self=this;
  8190. return $core.withContext(function($ctx1) {
  8191. return $self._reject_((function(each){
  8192. return $core.withContext(function($ctx2) {
  8193. return $recv(each).__eq(anObject);
  8194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8195. }));
  8196. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  8197. },
  8198. args: ["anObject"],
  8199. 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 ]",
  8200. referencedClasses: [],
  8201. pragmas: [],
  8202. messageSends: ["reject:", "="]
  8203. }),
  8204. $globals.Collection);
  8205. $core.addMethod(
  8206. $core.method({
  8207. selector: "copyWithoutAll:",
  8208. protocol: "copying",
  8209. fn: function (aCollection){
  8210. var self=this,$self=this;
  8211. return $core.withContext(function($ctx1) {
  8212. return $self._reject_((function(each){
  8213. return $core.withContext(function($ctx2) {
  8214. return $recv(aCollection)._includes_(each);
  8215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8216. }));
  8217. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  8218. },
  8219. args: ["aCollection"],
  8220. 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 ]",
  8221. referencedClasses: [],
  8222. pragmas: [],
  8223. messageSends: ["reject:", "includes:"]
  8224. }),
  8225. $globals.Collection);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "deepCopy",
  8229. protocol: "copying",
  8230. fn: function (){
  8231. var self=this,$self=this;
  8232. return $core.withContext(function($ctx1) {
  8233. return $self._collect_((function(each){
  8234. return $core.withContext(function($ctx2) {
  8235. return $recv(each)._deepCopy();
  8236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8237. }));
  8238. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  8239. },
  8240. args: [],
  8241. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  8242. referencedClasses: [],
  8243. pragmas: [],
  8244. messageSends: ["collect:", "deepCopy"]
  8245. }),
  8246. $globals.Collection);
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "detect:",
  8250. protocol: "enumerating",
  8251. fn: function (aBlock){
  8252. var self=this,$self=this;
  8253. return $core.withContext(function($ctx1) {
  8254. return $self._detect_ifNone_(aBlock,(function(){
  8255. return $core.withContext(function($ctx2) {
  8256. return $self._errorNotFound();
  8257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8258. }));
  8259. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  8260. },
  8261. args: ["aBlock"],
  8262. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  8263. referencedClasses: [],
  8264. pragmas: [],
  8265. messageSends: ["detect:ifNone:", "errorNotFound"]
  8266. }),
  8267. $globals.Collection);
  8268. $core.addMethod(
  8269. $core.method({
  8270. selector: "detect:ifNone:",
  8271. protocol: "enumerating",
  8272. fn: function (aBlock,anotherBlock){
  8273. var self=this,$self=this;
  8274. return $core.withContext(function($ctx1) {
  8275. var $1;
  8276. var $early={};
  8277. try {
  8278. $self._do_((function(each){
  8279. return $core.withContext(function($ctx2) {
  8280. $1=$recv(aBlock)._value_(each);
  8281. if($core.assert($1)){
  8282. throw $early=[each];
  8283. }
  8284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8285. }));
  8286. return $recv(anotherBlock)._value();
  8287. }
  8288. catch(e) {if(e===$early)return e[0]; throw e}
  8289. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8290. },
  8291. args: ["aBlock", "anotherBlock"],
  8292. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  8293. referencedClasses: [],
  8294. pragmas: [],
  8295. messageSends: ["do:", "ifTrue:", "value:", "value"]
  8296. }),
  8297. $globals.Collection);
  8298. $core.addMethod(
  8299. $core.method({
  8300. selector: "do:",
  8301. protocol: "enumerating",
  8302. fn: function (aBlock){
  8303. var self=this,$self=this;
  8304. return $core.withContext(function($ctx1) {
  8305. $self._subclassResponsibility();
  8306. return self;
  8307. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  8308. },
  8309. args: ["aBlock"],
  8310. source: "do: aBlock\x0a\x09self subclassResponsibility",
  8311. referencedClasses: [],
  8312. pragmas: [],
  8313. messageSends: ["subclassResponsibility"]
  8314. }),
  8315. $globals.Collection);
  8316. $core.addMethod(
  8317. $core.method({
  8318. selector: "do:separatedBy:",
  8319. protocol: "enumerating",
  8320. fn: function (aBlock,anotherBlock){
  8321. var self=this,$self=this;
  8322. var actionBeforeElement;
  8323. return $core.withContext(function($ctx1) {
  8324. actionBeforeElement=(function(){
  8325. actionBeforeElement=anotherBlock;
  8326. return actionBeforeElement;
  8327. });
  8328. $self._do_((function(each){
  8329. return $core.withContext(function($ctx2) {
  8330. $recv(actionBeforeElement)._value();
  8331. return $recv(aBlock)._value_(each);
  8332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8333. }));
  8334. return self;
  8335. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  8336. },
  8337. args: ["aBlock", "anotherBlock"],
  8338. 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 ]",
  8339. referencedClasses: [],
  8340. pragmas: [],
  8341. messageSends: ["do:", "value", "value:"]
  8342. }),
  8343. $globals.Collection);
  8344. $core.addMethod(
  8345. $core.method({
  8346. selector: "errorNotFound",
  8347. protocol: "error handling",
  8348. fn: function (){
  8349. var self=this,$self=this;
  8350. return $core.withContext(function($ctx1) {
  8351. $self._error_("Object is not in the collection");
  8352. return self;
  8353. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  8354. },
  8355. args: [],
  8356. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8357. referencedClasses: [],
  8358. pragmas: [],
  8359. messageSends: ["error:"]
  8360. }),
  8361. $globals.Collection);
  8362. $core.addMethod(
  8363. $core.method({
  8364. selector: "ifEmpty:",
  8365. protocol: "testing",
  8366. fn: function (aBlock){
  8367. var self=this,$self=this;
  8368. return $core.withContext(function($ctx1) {
  8369. var $1;
  8370. $1=$self._isEmpty();
  8371. if($core.assert($1)){
  8372. return $recv(aBlock)._value();
  8373. } else {
  8374. return self;
  8375. }
  8376. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  8377. },
  8378. args: ["aBlock"],
  8379. 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 ]",
  8380. referencedClasses: [],
  8381. pragmas: [],
  8382. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8383. }),
  8384. $globals.Collection);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "ifEmpty:ifNotEmpty:",
  8388. protocol: "testing",
  8389. fn: function (aBlock,anotherBlock){
  8390. var self=this,$self=this;
  8391. return $core.withContext(function($ctx1) {
  8392. var $1;
  8393. $1=$self._isEmpty();
  8394. if($core.assert($1)){
  8395. return $recv(aBlock)._value();
  8396. } else {
  8397. return $recv(anotherBlock)._value_(self);
  8398. }
  8399. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8400. },
  8401. args: ["aBlock", "anotherBlock"],
  8402. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8403. referencedClasses: [],
  8404. pragmas: [],
  8405. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8406. }),
  8407. $globals.Collection);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "ifNotEmpty:",
  8411. protocol: "testing",
  8412. fn: function (aBlock){
  8413. var self=this,$self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. var $1;
  8416. $1=$self._notEmpty();
  8417. if($core.assert($1)){
  8418. return $recv(aBlock)._value_(self);
  8419. } else {
  8420. return self;
  8421. }
  8422. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  8423. },
  8424. args: ["aBlock"],
  8425. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8426. referencedClasses: [],
  8427. pragmas: [],
  8428. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8429. }),
  8430. $globals.Collection);
  8431. $core.addMethod(
  8432. $core.method({
  8433. selector: "ifNotEmpty:ifEmpty:",
  8434. protocol: "testing",
  8435. fn: function (aBlock,anotherBlock){
  8436. var self=this,$self=this;
  8437. return $core.withContext(function($ctx1) {
  8438. var $1;
  8439. $1=$self._notEmpty();
  8440. if($core.assert($1)){
  8441. return $recv(aBlock)._value_(self);
  8442. } else {
  8443. return $recv(anotherBlock)._value();
  8444. }
  8445. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8446. },
  8447. args: ["aBlock", "anotherBlock"],
  8448. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8449. referencedClasses: [],
  8450. pragmas: [],
  8451. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8452. }),
  8453. $globals.Collection);
  8454. $core.addMethod(
  8455. $core.method({
  8456. selector: "includes:",
  8457. protocol: "testing",
  8458. fn: function (anObject){
  8459. var self=this,$self=this;
  8460. return $core.withContext(function($ctx1) {
  8461. return $self._anySatisfy_((function(each){
  8462. return $core.withContext(function($ctx2) {
  8463. return $recv(each).__eq(anObject);
  8464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8465. }));
  8466. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  8467. },
  8468. args: ["anObject"],
  8469. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8470. referencedClasses: [],
  8471. pragmas: [],
  8472. messageSends: ["anySatisfy:", "="]
  8473. }),
  8474. $globals.Collection);
  8475. $core.addMethod(
  8476. $core.method({
  8477. selector: "inject:into:",
  8478. protocol: "enumerating",
  8479. fn: function (anObject,aBlock){
  8480. var self=this,$self=this;
  8481. var result;
  8482. return $core.withContext(function($ctx1) {
  8483. result=anObject;
  8484. $self._do_((function(each){
  8485. return $core.withContext(function($ctx2) {
  8486. result=$recv(aBlock)._value_value_(result,each);
  8487. return result;
  8488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8489. }));
  8490. return result;
  8491. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  8492. },
  8493. args: ["anObject", "aBlock"],
  8494. 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",
  8495. referencedClasses: [],
  8496. pragmas: [],
  8497. messageSends: ["do:", "value:value:"]
  8498. }),
  8499. $globals.Collection);
  8500. $core.addMethod(
  8501. $core.method({
  8502. selector: "intersection:",
  8503. protocol: "enumerating",
  8504. fn: function (aCollection){
  8505. var self=this,$self=this;
  8506. var set,outputSet;
  8507. return $core.withContext(function($ctx1) {
  8508. var $2,$1;
  8509. set=$self._asSet();
  8510. outputSet=$recv($globals.Set)._new();
  8511. $recv(aCollection)._do_((function(each){
  8512. return $core.withContext(function($ctx2) {
  8513. $2=$recv(set)._includes_(each);
  8514. $ctx2.sendIdx["includes:"]=1;
  8515. $1=$recv($2)._and_((function(){
  8516. return $core.withContext(function($ctx3) {
  8517. return $recv($recv(outputSet)._includes_(each))._not();
  8518. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8519. }));
  8520. if($core.assert($1)){
  8521. return $recv(outputSet)._add_(each);
  8522. }
  8523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8524. }));
  8525. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8526. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  8527. },
  8528. args: ["aCollection"],
  8529. 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",
  8530. referencedClasses: ["Set"],
  8531. pragmas: [],
  8532. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8533. }),
  8534. $globals.Collection);
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "isEmpty",
  8538. protocol: "testing",
  8539. fn: function (){
  8540. var self=this,$self=this;
  8541. return $core.withContext(function($ctx1) {
  8542. return $recv($self._size()).__eq((0));
  8543. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8544. },
  8545. args: [],
  8546. source: "isEmpty\x0a\x09^ self size = 0",
  8547. referencedClasses: [],
  8548. pragmas: [],
  8549. messageSends: ["=", "size"]
  8550. }),
  8551. $globals.Collection);
  8552. $core.addMethod(
  8553. $core.method({
  8554. selector: "noneSatisfy:",
  8555. protocol: "enumerating",
  8556. fn: function (aBlock){
  8557. var self=this,$self=this;
  8558. return $core.withContext(function($ctx1) {
  8559. var $1;
  8560. var $early={};
  8561. try {
  8562. $self._do_((function(item){
  8563. return $core.withContext(function($ctx2) {
  8564. $1=$recv(aBlock)._value_(item);
  8565. if($core.assert($1)){
  8566. throw $early=[false];
  8567. }
  8568. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8569. }));
  8570. return true;
  8571. }
  8572. catch(e) {if(e===$early)return e[0]; throw e}
  8573. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  8574. },
  8575. args: ["aBlock"],
  8576. 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",
  8577. referencedClasses: [],
  8578. pragmas: [],
  8579. messageSends: ["do:", "ifTrue:", "value:"]
  8580. }),
  8581. $globals.Collection);
  8582. $core.addMethod(
  8583. $core.method({
  8584. selector: "notEmpty",
  8585. protocol: "testing",
  8586. fn: function (){
  8587. var self=this,$self=this;
  8588. return $core.withContext(function($ctx1) {
  8589. return $recv($self._isEmpty())._not();
  8590. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  8591. },
  8592. args: [],
  8593. source: "notEmpty\x0a\x09^ self isEmpty not",
  8594. referencedClasses: [],
  8595. pragmas: [],
  8596. messageSends: ["not", "isEmpty"]
  8597. }),
  8598. $globals.Collection);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "occurrencesOf:",
  8602. protocol: "accessing",
  8603. fn: function (anObject){
  8604. var self=this,$self=this;
  8605. var tally;
  8606. return $core.withContext(function($ctx1) {
  8607. var $1;
  8608. tally=(0);
  8609. $self._do_((function(each){
  8610. return $core.withContext(function($ctx2) {
  8611. $1=$recv(anObject).__eq(each);
  8612. if($core.assert($1)){
  8613. tally=$recv(tally).__plus((1));
  8614. return tally;
  8615. }
  8616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8617. }));
  8618. return tally;
  8619. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  8620. },
  8621. args: ["anObject"],
  8622. 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",
  8623. referencedClasses: [],
  8624. pragmas: [],
  8625. messageSends: ["do:", "ifTrue:", "=", "+"]
  8626. }),
  8627. $globals.Collection);
  8628. $core.addMethod(
  8629. $core.method({
  8630. selector: "putOn:",
  8631. protocol: "streaming",
  8632. fn: function (aStream){
  8633. var self=this,$self=this;
  8634. return $core.withContext(function($ctx1) {
  8635. $self._do_((function(each){
  8636. return $core.withContext(function($ctx2) {
  8637. return $recv(each)._putOn_(aStream);
  8638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8639. }));
  8640. return self;
  8641. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  8642. },
  8643. args: ["aStream"],
  8644. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8645. referencedClasses: [],
  8646. pragmas: [],
  8647. messageSends: ["do:", "putOn:"]
  8648. }),
  8649. $globals.Collection);
  8650. $core.addMethod(
  8651. $core.method({
  8652. selector: "reject:",
  8653. protocol: "enumerating",
  8654. fn: function (aBlock){
  8655. var self=this,$self=this;
  8656. return $core.withContext(function($ctx1) {
  8657. return $self._select_((function(each){
  8658. return $core.withContext(function($ctx2) {
  8659. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8661. }));
  8662. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  8663. },
  8664. args: ["aBlock"],
  8665. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8666. referencedClasses: [],
  8667. pragmas: [],
  8668. messageSends: ["select:", "=", "value:"]
  8669. }),
  8670. $globals.Collection);
  8671. $core.addMethod(
  8672. $core.method({
  8673. selector: "remove:",
  8674. protocol: "adding/removing",
  8675. fn: function (anObject){
  8676. var self=this,$self=this;
  8677. return $core.withContext(function($ctx1) {
  8678. return $self._remove_ifAbsent_(anObject,(function(){
  8679. return $core.withContext(function($ctx2) {
  8680. return $self._errorNotFound();
  8681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8682. }));
  8683. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  8684. },
  8685. args: ["anObject"],
  8686. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8687. referencedClasses: [],
  8688. pragmas: [],
  8689. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8690. }),
  8691. $globals.Collection);
  8692. $core.addMethod(
  8693. $core.method({
  8694. selector: "remove:ifAbsent:",
  8695. protocol: "adding/removing",
  8696. fn: function (anObject,aBlock){
  8697. var self=this,$self=this;
  8698. return $core.withContext(function($ctx1) {
  8699. $self._subclassResponsibility();
  8700. return self;
  8701. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  8702. },
  8703. args: ["anObject", "aBlock"],
  8704. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8705. referencedClasses: [],
  8706. pragmas: [],
  8707. messageSends: ["subclassResponsibility"]
  8708. }),
  8709. $globals.Collection);
  8710. $core.addMethod(
  8711. $core.method({
  8712. selector: "removeAll",
  8713. protocol: "adding/removing",
  8714. fn: function (){
  8715. var self=this,$self=this;
  8716. return $core.withContext(function($ctx1) {
  8717. $self._subclassResponsibility();
  8718. return self;
  8719. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  8720. },
  8721. args: [],
  8722. source: "removeAll\x0a\x09self subclassResponsibility",
  8723. referencedClasses: [],
  8724. pragmas: [],
  8725. messageSends: ["subclassResponsibility"]
  8726. }),
  8727. $globals.Collection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "select:",
  8731. protocol: "enumerating",
  8732. fn: function (aBlock){
  8733. var self=this,$self=this;
  8734. var stream;
  8735. return $core.withContext(function($ctx1) {
  8736. var $1;
  8737. stream=$recv($recv($self._class())._new())._writeStream();
  8738. $self._do_((function(each){
  8739. return $core.withContext(function($ctx2) {
  8740. $1=$recv(aBlock)._value_(each);
  8741. if($core.assert($1)){
  8742. return $recv(stream)._nextPut_(each);
  8743. }
  8744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8745. }));
  8746. return $recv(stream)._contents();
  8747. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  8748. },
  8749. args: ["aBlock"],
  8750. 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",
  8751. referencedClasses: [],
  8752. pragmas: [],
  8753. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8754. }),
  8755. $globals.Collection);
  8756. $core.addMethod(
  8757. $core.method({
  8758. selector: "select:thenCollect:",
  8759. protocol: "enumerating",
  8760. fn: function (selectBlock,collectBlock){
  8761. var self=this,$self=this;
  8762. var stream;
  8763. return $core.withContext(function($ctx1) {
  8764. var $1;
  8765. stream=$recv($recv($self._class())._new())._writeStream();
  8766. $self._do_((function(each){
  8767. return $core.withContext(function($ctx2) {
  8768. $1=$recv(selectBlock)._value_(each);
  8769. $ctx2.sendIdx["value:"]=1;
  8770. if($core.assert($1)){
  8771. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8772. }
  8773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8774. }));
  8775. return $recv(stream)._contents();
  8776. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  8777. },
  8778. args: ["selectBlock", "collectBlock"],
  8779. 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",
  8780. referencedClasses: [],
  8781. pragmas: [],
  8782. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8783. }),
  8784. $globals.Collection);
  8785. $core.addMethod(
  8786. $core.method({
  8787. selector: "shallowCopy",
  8788. protocol: "copying",
  8789. fn: function (){
  8790. var self=this,$self=this;
  8791. return $core.withContext(function($ctx1) {
  8792. return $self._collect_((function(each){
  8793. return each;
  8794. }));
  8795. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  8796. },
  8797. args: [],
  8798. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8799. referencedClasses: [],
  8800. pragmas: [],
  8801. messageSends: ["collect:"]
  8802. }),
  8803. $globals.Collection);
  8804. $core.addMethod(
  8805. $core.method({
  8806. selector: "single",
  8807. protocol: "accessing",
  8808. fn: function (){
  8809. var self=this,$self=this;
  8810. return $core.withContext(function($ctx1) {
  8811. var $1;
  8812. $self._ifEmpty_((function(){
  8813. return $core.withContext(function($ctx2) {
  8814. return $self._error_("Collection is empty");
  8815. $ctx2.sendIdx["error:"]=1;
  8816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8817. }));
  8818. $1=$recv($self._size()).__gt((1));
  8819. if($core.assert($1)){
  8820. $self._error_("Collection holds more than one element");
  8821. }
  8822. return $self._anyOne();
  8823. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  8824. },
  8825. args: [],
  8826. 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",
  8827. referencedClasses: [],
  8828. pragmas: [],
  8829. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8830. }),
  8831. $globals.Collection);
  8832. $core.addMethod(
  8833. $core.method({
  8834. selector: "size",
  8835. protocol: "accessing",
  8836. fn: function (){
  8837. var self=this,$self=this;
  8838. return $core.withContext(function($ctx1) {
  8839. $self._subclassResponsibility();
  8840. return self;
  8841. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8842. },
  8843. args: [],
  8844. source: "size\x0a\x09self subclassResponsibility",
  8845. referencedClasses: [],
  8846. pragmas: [],
  8847. messageSends: ["subclassResponsibility"]
  8848. }),
  8849. $globals.Collection);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "classTag",
  8853. protocol: "accessing",
  8854. fn: function (){
  8855. var self=this,$self=this;
  8856. return "collection";
  8857. },
  8858. args: [],
  8859. 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'",
  8860. referencedClasses: [],
  8861. pragmas: [],
  8862. messageSends: []
  8863. }),
  8864. $globals.Collection.a$cls);
  8865. $core.addMethod(
  8866. $core.method({
  8867. selector: "new:",
  8868. protocol: "instance creation",
  8869. fn: function (anInteger){
  8870. var self=this,$self=this;
  8871. return $core.withContext(function($ctx1) {
  8872. return $self._new();
  8873. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  8874. },
  8875. args: ["anInteger"],
  8876. source: "new: anInteger\x0a\x09^ self new",
  8877. referencedClasses: [],
  8878. pragmas: [],
  8879. messageSends: ["new"]
  8880. }),
  8881. $globals.Collection.a$cls);
  8882. $core.addMethod(
  8883. $core.method({
  8884. selector: "with:",
  8885. protocol: "instance creation",
  8886. fn: function (anObject){
  8887. var self=this,$self=this;
  8888. return $core.withContext(function($ctx1) {
  8889. var $1;
  8890. $1=$self._new();
  8891. $recv($1)._add_(anObject);
  8892. return $recv($1)._yourself();
  8893. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  8894. },
  8895. args: ["anObject"],
  8896. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8897. referencedClasses: [],
  8898. pragmas: [],
  8899. messageSends: ["add:", "new", "yourself"]
  8900. }),
  8901. $globals.Collection.a$cls);
  8902. $core.addMethod(
  8903. $core.method({
  8904. selector: "with:with:",
  8905. protocol: "instance creation",
  8906. fn: function (anObject,anotherObject){
  8907. var self=this,$self=this;
  8908. return $core.withContext(function($ctx1) {
  8909. var $1;
  8910. $1=$self._new();
  8911. $recv($1)._add_(anObject);
  8912. $ctx1.sendIdx["add:"]=1;
  8913. $recv($1)._add_(anotherObject);
  8914. return $recv($1)._yourself();
  8915. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  8916. },
  8917. args: ["anObject", "anotherObject"],
  8918. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8919. referencedClasses: [],
  8920. pragmas: [],
  8921. messageSends: ["add:", "new", "yourself"]
  8922. }),
  8923. $globals.Collection.a$cls);
  8924. $core.addMethod(
  8925. $core.method({
  8926. selector: "with:with:with:",
  8927. protocol: "instance creation",
  8928. fn: function (firstObject,secondObject,thirdObject){
  8929. var self=this,$self=this;
  8930. return $core.withContext(function($ctx1) {
  8931. var $1;
  8932. $1=$self._new();
  8933. $recv($1)._add_(firstObject);
  8934. $ctx1.sendIdx["add:"]=1;
  8935. $recv($1)._add_(secondObject);
  8936. $ctx1.sendIdx["add:"]=2;
  8937. $recv($1)._add_(thirdObject);
  8938. return $recv($1)._yourself();
  8939. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  8940. },
  8941. args: ["firstObject", "secondObject", "thirdObject"],
  8942. 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",
  8943. referencedClasses: [],
  8944. pragmas: [],
  8945. messageSends: ["add:", "new", "yourself"]
  8946. }),
  8947. $globals.Collection.a$cls);
  8948. $core.addMethod(
  8949. $core.method({
  8950. selector: "withAll:",
  8951. protocol: "instance creation",
  8952. fn: function (aCollection){
  8953. var self=this,$self=this;
  8954. return $core.withContext(function($ctx1) {
  8955. var $1;
  8956. $1=$self._new();
  8957. $recv($1)._addAll_(aCollection);
  8958. return $recv($1)._yourself();
  8959. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  8960. },
  8961. args: ["aCollection"],
  8962. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8963. referencedClasses: [],
  8964. pragmas: [],
  8965. messageSends: ["addAll:", "new", "yourself"]
  8966. }),
  8967. $globals.Collection.a$cls);
  8968. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8969. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8970. $core.addMethod(
  8971. $core.method({
  8972. selector: "=",
  8973. protocol: "comparing",
  8974. fn: function (anAssocitativeCollection){
  8975. var self=this,$self=this;
  8976. return $core.withContext(function($ctx1) {
  8977. var $2,$1,$4,$3,$5;
  8978. $2=$self._class();
  8979. $ctx1.sendIdx["class"]=1;
  8980. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8981. $ctx1.sendIdx["="]=1;
  8982. if(!$core.assert($1)){
  8983. return false;
  8984. }
  8985. $4=$self._size();
  8986. $ctx1.sendIdx["size"]=1;
  8987. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8988. $ctx1.sendIdx["="]=2;
  8989. if(!$core.assert($3)){
  8990. return false;
  8991. }
  8992. $5=$self._associations();
  8993. $ctx1.sendIdx["associations"]=1;
  8994. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8995. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  8996. },
  8997. args: ["anAssocitativeCollection"],
  8998. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8999. referencedClasses: [],
  9000. pragmas: [],
  9001. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  9002. }),
  9003. $globals.AssociativeCollection);
  9004. $core.addMethod(
  9005. $core.method({
  9006. selector: "add:",
  9007. protocol: "adding/removing",
  9008. fn: function (anAssociation){
  9009. var self=this,$self=this;
  9010. return $core.withContext(function($ctx1) {
  9011. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  9012. return self;
  9013. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  9014. },
  9015. args: ["anAssociation"],
  9016. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  9017. referencedClasses: [],
  9018. pragmas: [],
  9019. messageSends: ["at:put:", "key", "value"]
  9020. }),
  9021. $globals.AssociativeCollection);
  9022. $core.addMethod(
  9023. $core.method({
  9024. selector: "addAll:",
  9025. protocol: "adding/removing",
  9026. fn: function (anAssociativeCollection){
  9027. var self=this,$self=this;
  9028. return $core.withContext(function($ctx1) {
  9029. (
  9030. $ctx1.supercall = true,
  9031. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  9032. $ctx1.supercall = false;
  9033. return anAssociativeCollection;
  9034. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  9035. },
  9036. args: ["anAssociativeCollection"],
  9037. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  9038. referencedClasses: [],
  9039. pragmas: [],
  9040. messageSends: ["addAll:", "associations"]
  9041. }),
  9042. $globals.AssociativeCollection);
  9043. $core.addMethod(
  9044. $core.method({
  9045. selector: "asDictionary",
  9046. protocol: "converting",
  9047. fn: function (){
  9048. var self=this,$self=this;
  9049. return $core.withContext(function($ctx1) {
  9050. return $recv($globals.Dictionary)._from_($self._associations());
  9051. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  9052. },
  9053. args: [],
  9054. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  9055. referencedClasses: ["Dictionary"],
  9056. pragmas: [],
  9057. messageSends: ["from:", "associations"]
  9058. }),
  9059. $globals.AssociativeCollection);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "asHashedCollection",
  9063. protocol: "converting",
  9064. fn: function (){
  9065. var self=this,$self=this;
  9066. return $core.withContext(function($ctx1) {
  9067. return $recv($globals.HashedCollection)._from_($self._associations());
  9068. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  9069. },
  9070. args: [],
  9071. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  9072. referencedClasses: ["HashedCollection"],
  9073. pragmas: [],
  9074. messageSends: ["from:", "associations"]
  9075. }),
  9076. $globals.AssociativeCollection);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "asJavaScriptObject",
  9080. protocol: "converting",
  9081. fn: function (){
  9082. var self=this,$self=this;
  9083. var hash;
  9084. return $core.withContext(function($ctx1) {
  9085. hash=$recv($globals.HashedCollection)._new();
  9086. $self._keysAndValuesDo_((function(key,value){
  9087. return $core.withContext(function($ctx2) {
  9088. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  9089. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9090. }));
  9091. return hash;
  9092. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  9093. },
  9094. args: [],
  9095. 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",
  9096. referencedClasses: ["HashedCollection"],
  9097. pragmas: [],
  9098. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  9099. }),
  9100. $globals.AssociativeCollection);
  9101. $core.addMethod(
  9102. $core.method({
  9103. selector: "associations",
  9104. protocol: "accessing",
  9105. fn: function (){
  9106. var self=this,$self=this;
  9107. var associations;
  9108. return $core.withContext(function($ctx1) {
  9109. associations=[];
  9110. $self._associationsDo_((function(each){
  9111. return $core.withContext(function($ctx2) {
  9112. return $recv(associations)._add_(each);
  9113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9114. }));
  9115. return associations;
  9116. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  9117. },
  9118. args: [],
  9119. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  9120. referencedClasses: [],
  9121. pragmas: [],
  9122. messageSends: ["associationsDo:", "add:"]
  9123. }),
  9124. $globals.AssociativeCollection);
  9125. $core.addMethod(
  9126. $core.method({
  9127. selector: "associationsDo:",
  9128. protocol: "enumerating",
  9129. fn: function (aBlock){
  9130. var self=this,$self=this;
  9131. return $core.withContext(function($ctx1) {
  9132. $self._keysAndValuesDo_((function(key,value){
  9133. return $core.withContext(function($ctx2) {
  9134. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  9135. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9136. }));
  9137. return self;
  9138. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  9139. },
  9140. args: ["aBlock"],
  9141. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  9142. referencedClasses: ["Association"],
  9143. pragmas: [],
  9144. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  9145. }),
  9146. $globals.AssociativeCollection);
  9147. $core.addMethod(
  9148. $core.method({
  9149. selector: "at:ifPresent:ifAbsent:",
  9150. protocol: "accessing",
  9151. fn: function (aKey,aBlock,anotherBlock){
  9152. var self=this,$self=this;
  9153. return $core.withContext(function($ctx1) {
  9154. var $1;
  9155. $1=$self._includesKey_(aKey);
  9156. if($core.assert($1)){
  9157. return $recv(aBlock)._value_($self._at_(aKey));
  9158. } else {
  9159. return $recv(anotherBlock)._value();
  9160. }
  9161. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  9162. },
  9163. args: ["aKey", "aBlock", "anotherBlock"],
  9164. 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 ]",
  9165. referencedClasses: [],
  9166. pragmas: [],
  9167. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  9168. }),
  9169. $globals.AssociativeCollection);
  9170. $core.addMethod(
  9171. $core.method({
  9172. selector: "collect:",
  9173. protocol: "enumerating",
  9174. fn: function (aBlock){
  9175. var self=this,$self=this;
  9176. var newDict;
  9177. return $core.withContext(function($ctx1) {
  9178. newDict=$recv($self._class())._new();
  9179. $self._keysAndValuesDo_((function(key,value){
  9180. return $core.withContext(function($ctx2) {
  9181. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  9182. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9183. }));
  9184. return newDict;
  9185. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  9186. },
  9187. args: ["aBlock"],
  9188. 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",
  9189. referencedClasses: [],
  9190. pragmas: [],
  9191. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  9192. }),
  9193. $globals.AssociativeCollection);
  9194. $core.addMethod(
  9195. $core.method({
  9196. selector: "deepCopy",
  9197. protocol: "copying",
  9198. fn: function (){
  9199. var self=this,$self=this;
  9200. var copy;
  9201. return $core.withContext(function($ctx1) {
  9202. copy=$recv($self._class())._new();
  9203. $self._keysAndValuesDo_((function(key,value){
  9204. return $core.withContext(function($ctx2) {
  9205. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  9206. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9207. }));
  9208. return copy;
  9209. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  9210. },
  9211. args: [],
  9212. 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",
  9213. referencedClasses: [],
  9214. pragmas: [],
  9215. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  9216. }),
  9217. $globals.AssociativeCollection);
  9218. $core.addMethod(
  9219. $core.method({
  9220. selector: "detect:ifNone:",
  9221. protocol: "enumerating",
  9222. fn: function (aBlock,anotherBlock){
  9223. var self=this,$self=this;
  9224. return $core.withContext(function($ctx1) {
  9225. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  9226. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9227. },
  9228. args: ["aBlock", "anotherBlock"],
  9229. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  9230. referencedClasses: [],
  9231. pragmas: [],
  9232. messageSends: ["detect:ifNone:", "values"]
  9233. }),
  9234. $globals.AssociativeCollection);
  9235. $core.addMethod(
  9236. $core.method({
  9237. selector: "do:",
  9238. protocol: "enumerating",
  9239. fn: function (aBlock){
  9240. var self=this,$self=this;
  9241. return $core.withContext(function($ctx1) {
  9242. $self._valuesDo_(aBlock);
  9243. return self;
  9244. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9245. },
  9246. args: ["aBlock"],
  9247. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  9248. referencedClasses: [],
  9249. pragmas: [],
  9250. messageSends: ["valuesDo:"]
  9251. }),
  9252. $globals.AssociativeCollection);
  9253. $core.addMethod(
  9254. $core.method({
  9255. selector: "includes:",
  9256. protocol: "enumerating",
  9257. fn: function (anObject){
  9258. var self=this,$self=this;
  9259. return $core.withContext(function($ctx1) {
  9260. return $recv($self._values())._includes_(anObject);
  9261. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  9262. },
  9263. args: ["anObject"],
  9264. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  9265. referencedClasses: [],
  9266. pragmas: [],
  9267. messageSends: ["includes:", "values"]
  9268. }),
  9269. $globals.AssociativeCollection);
  9270. $core.addMethod(
  9271. $core.method({
  9272. selector: "includesKey:",
  9273. protocol: "testing",
  9274. fn: function (aKey){
  9275. var self=this,$self=this;
  9276. return $core.withContext(function($ctx1) {
  9277. $self._subclassResponsibility();
  9278. return self;
  9279. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9280. },
  9281. args: ["aKey"],
  9282. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9283. referencedClasses: [],
  9284. pragmas: [],
  9285. messageSends: ["subclassResponsibility"]
  9286. }),
  9287. $globals.AssociativeCollection);
  9288. $core.addMethod(
  9289. $core.method({
  9290. selector: "indexOf:ifAbsent:",
  9291. protocol: "accessing",
  9292. fn: function (anObject,aBlock){
  9293. var self=this,$self=this;
  9294. return $core.withContext(function($ctx1) {
  9295. return $recv($self._keys())._detect_ifNone_((function(each){
  9296. return $core.withContext(function($ctx2) {
  9297. return $recv($self._at_(each)).__eq(anObject);
  9298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9299. }),aBlock);
  9300. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9301. },
  9302. args: ["anObject", "aBlock"],
  9303. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9304. referencedClasses: [],
  9305. pragmas: [],
  9306. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9307. }),
  9308. $globals.AssociativeCollection);
  9309. $core.addMethod(
  9310. $core.method({
  9311. selector: "keyAtValue:",
  9312. protocol: "accessing",
  9313. fn: function (anObject){
  9314. var self=this,$self=this;
  9315. return $core.withContext(function($ctx1) {
  9316. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9317. return $core.withContext(function($ctx2) {
  9318. return $self._errorNotFound();
  9319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9320. }));
  9321. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  9322. },
  9323. args: ["anObject"],
  9324. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9325. referencedClasses: [],
  9326. pragmas: [],
  9327. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9328. }),
  9329. $globals.AssociativeCollection);
  9330. $core.addMethod(
  9331. $core.method({
  9332. selector: "keyAtValue:ifAbsent:",
  9333. protocol: "accessing",
  9334. fn: function (anObject,aBlock){
  9335. var self=this,$self=this;
  9336. return $core.withContext(function($ctx1) {
  9337. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9338. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9339. },
  9340. args: ["anObject", "aBlock"],
  9341. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9342. referencedClasses: [],
  9343. pragmas: [],
  9344. messageSends: ["indexOf:ifAbsent:"]
  9345. }),
  9346. $globals.AssociativeCollection);
  9347. $core.addMethod(
  9348. $core.method({
  9349. selector: "keys",
  9350. protocol: "accessing",
  9351. fn: function (){
  9352. var self=this,$self=this;
  9353. return $core.withContext(function($ctx1) {
  9354. $self._subclassResponsibility();
  9355. return self;
  9356. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9357. },
  9358. args: [],
  9359. source: "keys\x0a\x09self subclassResponsibility",
  9360. referencedClasses: [],
  9361. pragmas: [],
  9362. messageSends: ["subclassResponsibility"]
  9363. }),
  9364. $globals.AssociativeCollection);
  9365. $core.addMethod(
  9366. $core.method({
  9367. selector: "keysAndValuesDo:",
  9368. protocol: "enumerating",
  9369. fn: function (aBlock){
  9370. var self=this,$self=this;
  9371. return $core.withContext(function($ctx1) {
  9372. $self._keysDo_((function(each){
  9373. return $core.withContext(function($ctx2) {
  9374. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9376. }));
  9377. return self;
  9378. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9379. },
  9380. args: ["aBlock"],
  9381. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9382. referencedClasses: [],
  9383. pragmas: [],
  9384. messageSends: ["keysDo:", "value:value:", "at:"]
  9385. }),
  9386. $globals.AssociativeCollection);
  9387. $core.addMethod(
  9388. $core.method({
  9389. selector: "keysDo:",
  9390. protocol: "enumerating",
  9391. fn: function (aBlock){
  9392. var self=this,$self=this;
  9393. return $core.withContext(function($ctx1) {
  9394. $self._subclassResponsibility();
  9395. return self;
  9396. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9397. },
  9398. args: ["aBlock"],
  9399. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9400. referencedClasses: [],
  9401. pragmas: [],
  9402. messageSends: ["subclassResponsibility"]
  9403. }),
  9404. $globals.AssociativeCollection);
  9405. $core.addMethod(
  9406. $core.method({
  9407. selector: "printOn:",
  9408. protocol: "printing",
  9409. fn: function (aStream){
  9410. var self=this,$self=this;
  9411. return $core.withContext(function($ctx1) {
  9412. (
  9413. $ctx1.supercall = true,
  9414. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9415. $ctx1.supercall = false;
  9416. $ctx1.sendIdx["printOn:"]=1;
  9417. $recv(aStream)._nextPutAll_(" (");
  9418. $ctx1.sendIdx["nextPutAll:"]=1;
  9419. $recv($self._associations())._do_separatedBy_((function(each){
  9420. return $core.withContext(function($ctx2) {
  9421. return $recv(each)._printOn_(aStream);
  9422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9423. }),(function(){
  9424. return $core.withContext(function($ctx2) {
  9425. return $recv(aStream)._nextPutAll_(" , ");
  9426. $ctx2.sendIdx["nextPutAll:"]=2;
  9427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9428. }));
  9429. $recv(aStream)._nextPutAll_(")");
  9430. return self;
  9431. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  9432. },
  9433. args: ["aStream"],
  9434. 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: ')'",
  9435. referencedClasses: [],
  9436. pragmas: [],
  9437. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9438. }),
  9439. $globals.AssociativeCollection);
  9440. $core.addMethod(
  9441. $core.method({
  9442. selector: "remove:ifAbsent:",
  9443. protocol: "adding/removing",
  9444. fn: function (aKey,aBlock){
  9445. var self=this,$self=this;
  9446. return $core.withContext(function($ctx1) {
  9447. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9448. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9449. },
  9450. args: ["aKey", "aBlock"],
  9451. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9452. referencedClasses: [],
  9453. pragmas: [],
  9454. messageSends: ["removeKey:ifAbsent:"]
  9455. }),
  9456. $globals.AssociativeCollection);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "removeAll",
  9460. protocol: "adding/removing",
  9461. fn: function (){
  9462. var self=this,$self=this;
  9463. return $core.withContext(function($ctx1) {
  9464. return $recv($self._keys())._do_((function(each){
  9465. return $core.withContext(function($ctx2) {
  9466. return $self._removeKey_(each);
  9467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9468. }));
  9469. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9470. },
  9471. args: [],
  9472. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9473. referencedClasses: [],
  9474. pragmas: [],
  9475. messageSends: ["do:", "keys", "removeKey:"]
  9476. }),
  9477. $globals.AssociativeCollection);
  9478. $core.addMethod(
  9479. $core.method({
  9480. selector: "removeKey:",
  9481. protocol: "adding/removing",
  9482. fn: function (aKey){
  9483. var self=this,$self=this;
  9484. return $core.withContext(function($ctx1) {
  9485. return $self._remove_(aKey);
  9486. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  9487. },
  9488. args: ["aKey"],
  9489. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9490. referencedClasses: [],
  9491. pragmas: [],
  9492. messageSends: ["remove:"]
  9493. }),
  9494. $globals.AssociativeCollection);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "removeKey:ifAbsent:",
  9498. protocol: "adding/removing",
  9499. fn: function (aKey,aBlock){
  9500. var self=this,$self=this;
  9501. return $core.withContext(function($ctx1) {
  9502. $self._subclassResponsibility();
  9503. return self;
  9504. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9505. },
  9506. args: ["aKey", "aBlock"],
  9507. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9508. referencedClasses: [],
  9509. pragmas: [],
  9510. messageSends: ["subclassResponsibility"]
  9511. }),
  9512. $globals.AssociativeCollection);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "select:",
  9516. protocol: "enumerating",
  9517. fn: function (aBlock){
  9518. var self=this,$self=this;
  9519. var newDict;
  9520. return $core.withContext(function($ctx1) {
  9521. var $1;
  9522. newDict=$recv($self._class())._new();
  9523. $self._keysAndValuesDo_((function(key,value){
  9524. return $core.withContext(function($ctx2) {
  9525. $1=$recv(aBlock)._value_(value);
  9526. if($core.assert($1)){
  9527. return $recv(newDict)._at_put_(key,value);
  9528. }
  9529. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9530. }));
  9531. return newDict;
  9532. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  9533. },
  9534. args: ["aBlock"],
  9535. 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",
  9536. referencedClasses: [],
  9537. pragmas: [],
  9538. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9539. }),
  9540. $globals.AssociativeCollection);
  9541. $core.addMethod(
  9542. $core.method({
  9543. selector: "select:thenCollect:",
  9544. protocol: "enumerating",
  9545. fn: function (selectBlock,collectBlock){
  9546. var self=this,$self=this;
  9547. var newDict;
  9548. return $core.withContext(function($ctx1) {
  9549. var $1;
  9550. newDict=$recv($self._class())._new();
  9551. $self._keysAndValuesDo_((function(key,value){
  9552. return $core.withContext(function($ctx2) {
  9553. $1=$recv(selectBlock)._value_(value);
  9554. $ctx2.sendIdx["value:"]=1;
  9555. if($core.assert($1)){
  9556. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9557. }
  9558. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9559. }));
  9560. return newDict;
  9561. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  9562. },
  9563. args: ["selectBlock", "collectBlock"],
  9564. 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",
  9565. referencedClasses: [],
  9566. pragmas: [],
  9567. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9568. }),
  9569. $globals.AssociativeCollection);
  9570. $core.addMethod(
  9571. $core.method({
  9572. selector: "shallowCopy",
  9573. protocol: "copying",
  9574. fn: function (){
  9575. var self=this,$self=this;
  9576. var copy;
  9577. return $core.withContext(function($ctx1) {
  9578. copy=$recv($self._class())._new();
  9579. $self._keysAndValuesDo_((function(key,value){
  9580. return $core.withContext(function($ctx2) {
  9581. return $recv(copy)._at_put_(key,value);
  9582. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9583. }));
  9584. return copy;
  9585. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  9586. },
  9587. args: [],
  9588. 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",
  9589. referencedClasses: [],
  9590. pragmas: [],
  9591. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9592. }),
  9593. $globals.AssociativeCollection);
  9594. $core.addMethod(
  9595. $core.method({
  9596. selector: "size",
  9597. protocol: "accessing",
  9598. fn: function (){
  9599. var self=this,$self=this;
  9600. return $core.withContext(function($ctx1) {
  9601. return $recv($self._keys())._size();
  9602. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9603. },
  9604. args: [],
  9605. source: "size\x0a\x09^ self keys size",
  9606. referencedClasses: [],
  9607. pragmas: [],
  9608. messageSends: ["size", "keys"]
  9609. }),
  9610. $globals.AssociativeCollection);
  9611. $core.addMethod(
  9612. $core.method({
  9613. selector: "values",
  9614. protocol: "accessing",
  9615. fn: function (){
  9616. var self=this,$self=this;
  9617. return $core.withContext(function($ctx1) {
  9618. $self._subclassResponsibility();
  9619. return self;
  9620. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  9621. },
  9622. args: [],
  9623. source: "values\x0a\x09self subclassResponsibility",
  9624. referencedClasses: [],
  9625. pragmas: [],
  9626. messageSends: ["subclassResponsibility"]
  9627. }),
  9628. $globals.AssociativeCollection);
  9629. $core.addMethod(
  9630. $core.method({
  9631. selector: "valuesDo:",
  9632. protocol: "enumerating",
  9633. fn: function (aBlock){
  9634. var self=this,$self=this;
  9635. return $core.withContext(function($ctx1) {
  9636. $self._subclassResponsibility();
  9637. return self;
  9638. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  9639. },
  9640. args: ["aBlock"],
  9641. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9642. referencedClasses: [],
  9643. pragmas: [],
  9644. messageSends: ["subclassResponsibility"]
  9645. }),
  9646. $globals.AssociativeCollection);
  9647. $core.addMethod(
  9648. $core.method({
  9649. selector: "withIndexDo:",
  9650. protocol: "enumerating",
  9651. fn: function (aBlock){
  9652. var self=this,$self=this;
  9653. return $core.withContext(function($ctx1) {
  9654. $self._keysAndValuesDo_((function(key,value){
  9655. return $core.withContext(function($ctx2) {
  9656. return $recv(aBlock)._value_value_(value,key);
  9657. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9658. }));
  9659. return self;
  9660. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9661. },
  9662. args: ["aBlock"],
  9663. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9664. referencedClasses: [],
  9665. pragmas: [],
  9666. messageSends: ["keysAndValuesDo:", "value:value:"]
  9667. }),
  9668. $globals.AssociativeCollection);
  9669. $core.addMethod(
  9670. $core.method({
  9671. selector: "from:",
  9672. protocol: "instance creation",
  9673. fn: function (aCollection){
  9674. var self=this,$self=this;
  9675. var newCollection;
  9676. return $core.withContext(function($ctx1) {
  9677. newCollection=$self._new();
  9678. $recv(aCollection)._do_((function(each){
  9679. return $core.withContext(function($ctx2) {
  9680. return $recv(newCollection)._add_(each);
  9681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9682. }));
  9683. return newCollection;
  9684. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  9685. },
  9686. args: ["aCollection"],
  9687. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9688. referencedClasses: [],
  9689. pragmas: [],
  9690. messageSends: ["new", "do:", "add:"]
  9691. }),
  9692. $globals.AssociativeCollection.a$cls);
  9693. $core.addMethod(
  9694. $core.method({
  9695. selector: "fromPairs:",
  9696. protocol: "instance creation",
  9697. fn: function (aCollection){
  9698. var self=this,$self=this;
  9699. return $core.withContext(function($ctx1) {
  9700. return $self._from_(aCollection);
  9701. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  9702. },
  9703. args: ["aCollection"],
  9704. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9705. referencedClasses: [],
  9706. pragmas: [],
  9707. messageSends: ["from:"]
  9708. }),
  9709. $globals.AssociativeCollection.a$cls);
  9710. $core.addMethod(
  9711. $core.method({
  9712. selector: "newFromPairs:",
  9713. protocol: "instance creation",
  9714. fn: function (aCollection){
  9715. var self=this,$self=this;
  9716. var newCollection;
  9717. return $core.withContext(function($ctx1) {
  9718. var $2,$1,$3,$4;
  9719. $2=$recv(aCollection)._size();
  9720. $ctx1.sendIdx["size"]=1;
  9721. $1=$recv($2)._even();
  9722. if(!$core.assert($1)){
  9723. $self._error_("#newFromPairs only accepts arrays of an even length");
  9724. }
  9725. newCollection=$self._new();
  9726. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9727. return $core.withContext(function($ctx2) {
  9728. $3=newCollection;
  9729. $4=$recv(aCollection)._at_(each);
  9730. $ctx2.sendIdx["at:"]=1;
  9731. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9733. }));
  9734. return newCollection;
  9735. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  9736. },
  9737. args: ["aCollection"],
  9738. 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",
  9739. referencedClasses: [],
  9740. pragmas: [],
  9741. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9742. }),
  9743. $globals.AssociativeCollection.a$cls);
  9744. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9745. $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.";
  9746. $core.addMethod(
  9747. $core.method({
  9748. selector: "at:ifAbsent:",
  9749. protocol: "accessing",
  9750. fn: function (aKey,aBlock){
  9751. var self=this,$self=this;
  9752. return $core.withContext(function($ctx1) {
  9753. var index = $self._positionOfKey_(aKey);
  9754. return index >=0 ? $self.values[index] : aBlock._value();
  9755. ;
  9756. return self;
  9757. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9758. },
  9759. args: ["aKey", "aBlock"],
  9760. 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'>",
  9761. referencedClasses: [],
  9762. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  9763. messageSends: []
  9764. }),
  9765. $globals.Dictionary);
  9766. $core.addMethod(
  9767. $core.method({
  9768. selector: "at:put:",
  9769. protocol: "accessing",
  9770. fn: function (aKey,aValue){
  9771. var self=this,$self=this;
  9772. return $core.withContext(function($ctx1) {
  9773. var index = $self._positionOfKey_(aKey);
  9774. if(index === -1) {
  9775. var keys = $self.keys;
  9776. index = keys.length;
  9777. keys.push(aKey);
  9778. }
  9779. return $self.values[index] = aValue;
  9780. ;
  9781. return self;
  9782. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  9783. },
  9784. args: ["aKey", "aValue"],
  9785. 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'>",
  9786. referencedClasses: [],
  9787. pragmas: [["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"]]],
  9788. messageSends: []
  9789. }),
  9790. $globals.Dictionary);
  9791. $core.addMethod(
  9792. $core.method({
  9793. selector: "includesKey:",
  9794. protocol: "testing",
  9795. fn: function (aKey){
  9796. var self=this,$self=this;
  9797. return $core.withContext(function($ctx1) {
  9798. return $self._positionOfKey_(aKey) >= 0;;
  9799. return self;
  9800. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9801. },
  9802. args: ["aKey"],
  9803. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9804. referencedClasses: [],
  9805. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  9806. messageSends: []
  9807. }),
  9808. $globals.Dictionary);
  9809. $core.addMethod(
  9810. $core.method({
  9811. selector: "indexOf:ifAbsent:",
  9812. protocol: "accessing",
  9813. fn: function (anObject,aBlock){
  9814. var self=this,$self=this;
  9815. var index;
  9816. return $core.withContext(function($ctx1) {
  9817. var $1;
  9818. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  9819. return (0);
  9820. }));
  9821. $1=$recv(index).__eq((0));
  9822. if($core.assert($1)){
  9823. return $recv(aBlock)._value();
  9824. } else {
  9825. return $recv($self.keys)._at_(index);
  9826. }
  9827. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  9828. },
  9829. args: ["anObject", "aBlock"],
  9830. 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 ]",
  9831. referencedClasses: [],
  9832. pragmas: [],
  9833. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9834. }),
  9835. $globals.Dictionary);
  9836. $core.addMethod(
  9837. $core.method({
  9838. selector: "initialize",
  9839. protocol: "initialization",
  9840. fn: function (){
  9841. var self=this,$self=this;
  9842. return $core.withContext(function($ctx1) {
  9843. (
  9844. $ctx1.supercall = true,
  9845. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9846. $ctx1.supercall = false;
  9847. $self.keys=[];
  9848. $self.values=[];
  9849. return self;
  9850. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9851. },
  9852. args: [],
  9853. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9854. referencedClasses: [],
  9855. pragmas: [],
  9856. messageSends: ["initialize"]
  9857. }),
  9858. $globals.Dictionary);
  9859. $core.addMethod(
  9860. $core.method({
  9861. selector: "keys",
  9862. protocol: "accessing",
  9863. fn: function (){
  9864. var self=this,$self=this;
  9865. return $core.withContext(function($ctx1) {
  9866. return $recv($self.keys)._copy();
  9867. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9868. },
  9869. args: [],
  9870. source: "keys\x0a\x09^ keys copy",
  9871. referencedClasses: [],
  9872. pragmas: [],
  9873. messageSends: ["copy"]
  9874. }),
  9875. $globals.Dictionary);
  9876. $core.addMethod(
  9877. $core.method({
  9878. selector: "keysAndValuesDo:",
  9879. protocol: "enumerating",
  9880. fn: function (aBlock){
  9881. var self=this,$self=this;
  9882. return $core.withContext(function($ctx1) {
  9883. return $recv($self.keys)._with_do_($self.values,aBlock);
  9884. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9885. },
  9886. args: ["aBlock"],
  9887. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9888. referencedClasses: [],
  9889. pragmas: [],
  9890. messageSends: ["with:do:"]
  9891. }),
  9892. $globals.Dictionary);
  9893. $core.addMethod(
  9894. $core.method({
  9895. selector: "keysDo:",
  9896. protocol: "enumerating",
  9897. fn: function (aBlock){
  9898. var self=this,$self=this;
  9899. return $core.withContext(function($ctx1) {
  9900. return $recv($self.keys)._do_(aBlock);
  9901. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9902. },
  9903. args: ["aBlock"],
  9904. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9905. referencedClasses: [],
  9906. pragmas: [],
  9907. messageSends: ["do:"]
  9908. }),
  9909. $globals.Dictionary);
  9910. $core.addMethod(
  9911. $core.method({
  9912. selector: "positionOfKey:",
  9913. protocol: "private",
  9914. fn: function (anObject){
  9915. var self=this,$self=this;
  9916. return $core.withContext(function($ctx1) {
  9917. var keys = $self.keys;
  9918. for(var i=0;i<keys.length;i++){
  9919. if(keys[i].__eq(anObject)) { return i;}
  9920. }
  9921. return -1;
  9922. ;
  9923. return self;
  9924. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  9925. },
  9926. args: ["anObject"],
  9927. 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'>",
  9928. referencedClasses: [],
  9929. pragmas: [["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"]]],
  9930. messageSends: []
  9931. }),
  9932. $globals.Dictionary);
  9933. $core.addMethod(
  9934. $core.method({
  9935. selector: "removeAll",
  9936. protocol: "adding/removing",
  9937. fn: function (){
  9938. var self=this,$self=this;
  9939. return $core.withContext(function($ctx1) {
  9940. $recv($self.keys)._removeAll();
  9941. $ctx1.sendIdx["removeAll"]=1;
  9942. $recv($self.values)._removeAll();
  9943. return self;
  9944. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9945. },
  9946. args: [],
  9947. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9948. referencedClasses: [],
  9949. pragmas: [],
  9950. messageSends: ["removeAll"]
  9951. }),
  9952. $globals.Dictionary);
  9953. $core.addMethod(
  9954. $core.method({
  9955. selector: "removeKey:ifAbsent:",
  9956. protocol: "adding/removing",
  9957. fn: function (aKey,aBlock){
  9958. var self=this,$self=this;
  9959. return $core.withContext(function($ctx1) {
  9960. var index = $self._positionOfKey_(aKey);
  9961. if(index === -1) {
  9962. return aBlock._value()
  9963. } else {
  9964. var keys = $self.keys, values = $self.values;
  9965. var value = values[index], l = keys.length;
  9966. keys[index] = keys[l-1];
  9967. keys.pop();
  9968. values[index] = values[l-1];
  9969. values.pop();
  9970. return value;
  9971. }
  9972. ;
  9973. return self;
  9974. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9975. },
  9976. args: ["aKey", "aBlock"],
  9977. 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'>",
  9978. referencedClasses: [],
  9979. pragmas: [["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"]]],
  9980. messageSends: []
  9981. }),
  9982. $globals.Dictionary);
  9983. $core.addMethod(
  9984. $core.method({
  9985. selector: "values",
  9986. protocol: "accessing",
  9987. fn: function (){
  9988. var self=this,$self=this;
  9989. return $self.values;
  9990. },
  9991. args: [],
  9992. source: "values\x0a\x09^ values",
  9993. referencedClasses: [],
  9994. pragmas: [],
  9995. messageSends: []
  9996. }),
  9997. $globals.Dictionary);
  9998. $core.addMethod(
  9999. $core.method({
  10000. selector: "valuesDo:",
  10001. protocol: "enumerating",
  10002. fn: function (aBlock){
  10003. var self=this,$self=this;
  10004. return $core.withContext(function($ctx1) {
  10005. return $recv($self.values)._do_(aBlock);
  10006. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  10007. },
  10008. args: ["aBlock"],
  10009. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  10010. referencedClasses: [],
  10011. pragmas: [],
  10012. messageSends: ["do:"]
  10013. }),
  10014. $globals.Dictionary);
  10015. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  10016. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  10017. $core.addMethod(
  10018. $core.method({
  10019. selector: "at:ifAbsent:",
  10020. protocol: "accessing",
  10021. fn: function (aKey,aBlock){
  10022. var self=this,$self=this;
  10023. return $core.withContext(function($ctx1) {
  10024. var $1;
  10025. $1=$self._includesKey_(aKey);
  10026. if($core.assert($1)){
  10027. return $self._basicAt_(aKey);
  10028. } else {
  10029. return $recv(aBlock)._value();
  10030. }
  10031. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  10032. },
  10033. args: ["aKey", "aBlock"],
  10034. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  10035. referencedClasses: [],
  10036. pragmas: [],
  10037. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  10038. }),
  10039. $globals.HashedCollection);
  10040. $core.addMethod(
  10041. $core.method({
  10042. selector: "at:put:",
  10043. protocol: "accessing",
  10044. fn: function (aKey,aValue){
  10045. var self=this,$self=this;
  10046. return $core.withContext(function($ctx1) {
  10047. return $self._basicAt_put_(aKey,aValue);
  10048. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  10049. },
  10050. args: ["aKey", "aValue"],
  10051. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  10052. referencedClasses: [],
  10053. pragmas: [],
  10054. messageSends: ["basicAt:put:"]
  10055. }),
  10056. $globals.HashedCollection);
  10057. $core.addMethod(
  10058. $core.method({
  10059. selector: "includesKey:",
  10060. protocol: "testing",
  10061. fn: function (aKey){
  10062. var self=this,$self=this;
  10063. return $core.withContext(function($ctx1) {
  10064. return self.hasOwnProperty(aKey);
  10065. return self;
  10066. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  10067. },
  10068. args: ["aKey"],
  10069. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  10070. referencedClasses: [],
  10071. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  10072. messageSends: []
  10073. }),
  10074. $globals.HashedCollection);
  10075. $core.addMethod(
  10076. $core.method({
  10077. selector: "keys",
  10078. protocol: "accessing",
  10079. fn: function (){
  10080. var self=this,$self=this;
  10081. return $core.withContext(function($ctx1) {
  10082. return Object.keys(self);
  10083. return self;
  10084. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  10085. },
  10086. args: [],
  10087. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  10088. referencedClasses: [],
  10089. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  10090. messageSends: []
  10091. }),
  10092. $globals.HashedCollection);
  10093. $core.addMethod(
  10094. $core.method({
  10095. selector: "keysDo:",
  10096. protocol: "enumerating",
  10097. fn: function (aBlock){
  10098. var self=this,$self=this;
  10099. return $core.withContext(function($ctx1) {
  10100. $recv($self._keys())._do_(aBlock);
  10101. return self;
  10102. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  10103. },
  10104. args: ["aBlock"],
  10105. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  10106. referencedClasses: [],
  10107. pragmas: [],
  10108. messageSends: ["do:", "keys"]
  10109. }),
  10110. $globals.HashedCollection);
  10111. $core.addMethod(
  10112. $core.method({
  10113. selector: "removeKey:ifAbsent:",
  10114. protocol: "adding/removing",
  10115. fn: function (aKey,aBlock){
  10116. var self=this,$self=this;
  10117. return $core.withContext(function($ctx1) {
  10118. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  10119. return $core.withContext(function($ctx2) {
  10120. $self._basicDelete_(aKey);
  10121. return removed;
  10122. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  10123. }),(function(){
  10124. return $core.withContext(function($ctx2) {
  10125. return $recv(aBlock)._value();
  10126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10127. }));
  10128. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  10129. },
  10130. args: ["aKey", "aBlock"],
  10131. 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 ]",
  10132. referencedClasses: [],
  10133. pragmas: [],
  10134. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  10135. }),
  10136. $globals.HashedCollection);
  10137. $core.addMethod(
  10138. $core.method({
  10139. selector: "values",
  10140. protocol: "accessing",
  10141. fn: function (){
  10142. var self=this,$self=this;
  10143. return $core.withContext(function($ctx1) {
  10144. return $self._keys().map(function(key){
  10145. return $self._at_(key);
  10146. });
  10147. ;
  10148. return self;
  10149. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  10150. },
  10151. args: [],
  10152. 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'>",
  10153. referencedClasses: [],
  10154. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  10155. messageSends: []
  10156. }),
  10157. $globals.HashedCollection);
  10158. $core.addMethod(
  10159. $core.method({
  10160. selector: "valuesDo:",
  10161. protocol: "enumerating",
  10162. fn: function (aBlock){
  10163. var self=this,$self=this;
  10164. return $core.withContext(function($ctx1) {
  10165. $recv($self._values())._do_(aBlock);
  10166. return self;
  10167. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  10168. },
  10169. args: ["aBlock"],
  10170. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  10171. referencedClasses: [],
  10172. pragmas: [],
  10173. messageSends: ["do:", "values"]
  10174. }),
  10175. $globals.HashedCollection);
  10176. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  10177. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  10178. $core.addMethod(
  10179. $core.method({
  10180. selector: "=",
  10181. protocol: "comparing",
  10182. fn: function (aCollection){
  10183. var self=this,$self=this;
  10184. return $core.withContext(function($ctx1) {
  10185. var $3,$2,$4,$1,$5;
  10186. var $early={};
  10187. try {
  10188. $3=$self._class();
  10189. $ctx1.sendIdx["class"]=1;
  10190. $2=$recv($3).__eq($recv(aCollection)._class());
  10191. $ctx1.sendIdx["="]=1;
  10192. $1=$recv($2)._and_((function(){
  10193. return $core.withContext(function($ctx2) {
  10194. $4=$self._size();
  10195. $ctx2.sendIdx["size"]=1;
  10196. return $recv($4).__eq($recv(aCollection)._size());
  10197. $ctx2.sendIdx["="]=2;
  10198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10199. }));
  10200. if(!$core.assert($1)){
  10201. return false;
  10202. }
  10203. $self._withIndexDo_((function(each,i){
  10204. return $core.withContext(function($ctx2) {
  10205. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  10206. if(!$core.assert($5)){
  10207. throw $early=[false];
  10208. }
  10209. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  10210. }));
  10211. return true;
  10212. }
  10213. catch(e) {if(e===$early)return e[0]; throw e}
  10214. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  10215. },
  10216. args: ["aCollection"],
  10217. 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",
  10218. referencedClasses: [],
  10219. pragmas: [],
  10220. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  10221. }),
  10222. $globals.SequenceableCollection);
  10223. $core.addMethod(
  10224. $core.method({
  10225. selector: "addLast:",
  10226. protocol: "adding/removing",
  10227. fn: function (anObject){
  10228. var self=this,$self=this;
  10229. return $core.withContext(function($ctx1) {
  10230. $self._add_(anObject);
  10231. return self;
  10232. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  10233. },
  10234. args: ["anObject"],
  10235. source: "addLast: anObject\x0a\x09self add: anObject",
  10236. referencedClasses: [],
  10237. pragmas: [],
  10238. messageSends: ["add:"]
  10239. }),
  10240. $globals.SequenceableCollection);
  10241. $core.addMethod(
  10242. $core.method({
  10243. selector: "allButFirst",
  10244. protocol: "accessing",
  10245. fn: function (){
  10246. var self=this,$self=this;
  10247. return $core.withContext(function($ctx1) {
  10248. return $self._copyFrom_to_((2),$self._size());
  10249. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  10250. },
  10251. args: [],
  10252. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  10253. referencedClasses: [],
  10254. pragmas: [],
  10255. messageSends: ["copyFrom:to:", "size"]
  10256. }),
  10257. $globals.SequenceableCollection);
  10258. $core.addMethod(
  10259. $core.method({
  10260. selector: "allButLast",
  10261. protocol: "accessing",
  10262. fn: function (){
  10263. var self=this,$self=this;
  10264. return $core.withContext(function($ctx1) {
  10265. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  10266. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  10267. },
  10268. args: [],
  10269. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  10270. referencedClasses: [],
  10271. pragmas: [],
  10272. messageSends: ["copyFrom:to:", "-", "size"]
  10273. }),
  10274. $globals.SequenceableCollection);
  10275. $core.addMethod(
  10276. $core.method({
  10277. selector: "anyOne",
  10278. protocol: "accessing",
  10279. fn: function (){
  10280. var self=this,$self=this;
  10281. return $core.withContext(function($ctx1) {
  10282. return $self._at_((1));
  10283. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  10284. },
  10285. args: [],
  10286. source: "anyOne\x0a\x09^ self at: 1",
  10287. referencedClasses: [],
  10288. pragmas: [],
  10289. messageSends: ["at:"]
  10290. }),
  10291. $globals.SequenceableCollection);
  10292. $core.addMethod(
  10293. $core.method({
  10294. selector: "atRandom",
  10295. protocol: "accessing",
  10296. fn: function (){
  10297. var self=this,$self=this;
  10298. return $core.withContext(function($ctx1) {
  10299. return $self._at_($recv($self._size())._atRandom());
  10300. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  10301. },
  10302. args: [],
  10303. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10304. referencedClasses: [],
  10305. pragmas: [],
  10306. messageSends: ["at:", "atRandom", "size"]
  10307. }),
  10308. $globals.SequenceableCollection);
  10309. $core.addMethod(
  10310. $core.method({
  10311. selector: "beginsWith:",
  10312. protocol: "testing",
  10313. fn: function (prefix){
  10314. var self=this,$self=this;
  10315. return $core.withContext(function($ctx1) {
  10316. var $2,$3,$1;
  10317. $2=$self._size();
  10318. $ctx1.sendIdx["size"]=1;
  10319. $3=$recv(prefix)._size();
  10320. $ctx1.sendIdx["size"]=2;
  10321. $1=$recv($2).__lt($3);
  10322. if($core.assert($1)){
  10323. return false;
  10324. }
  10325. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  10326. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  10327. },
  10328. args: ["prefix"],
  10329. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  10330. referencedClasses: [],
  10331. pragmas: [],
  10332. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10333. }),
  10334. $globals.SequenceableCollection);
  10335. $core.addMethod(
  10336. $core.method({
  10337. selector: "copyFrom:to:",
  10338. protocol: "copying",
  10339. fn: function (anIndex,anotherIndex){
  10340. var self=this,$self=this;
  10341. return $core.withContext(function($ctx1) {
  10342. $self._subclassResponsibility();
  10343. return self;
  10344. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  10345. },
  10346. args: ["anIndex", "anotherIndex"],
  10347. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10348. referencedClasses: [],
  10349. pragmas: [],
  10350. messageSends: ["subclassResponsibility"]
  10351. }),
  10352. $globals.SequenceableCollection);
  10353. $core.addMethod(
  10354. $core.method({
  10355. selector: "endsWith:",
  10356. protocol: "testing",
  10357. fn: function (suffix){
  10358. var self=this,$self=this;
  10359. return $core.withContext(function($ctx1) {
  10360. var $2,$3,$1;
  10361. $2=$self._size();
  10362. $ctx1.sendIdx["size"]=1;
  10363. $3=$recv(suffix)._size();
  10364. $ctx1.sendIdx["size"]=2;
  10365. $1=$recv($2).__lt($3);
  10366. if($core.assert($1)){
  10367. return false;
  10368. }
  10369. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10370. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  10371. },
  10372. args: ["suffix"],
  10373. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10374. referencedClasses: [],
  10375. pragmas: [],
  10376. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10377. }),
  10378. $globals.SequenceableCollection);
  10379. $core.addMethod(
  10380. $core.method({
  10381. selector: "first",
  10382. protocol: "accessing",
  10383. fn: function (){
  10384. var self=this,$self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. return $self._at_((1));
  10387. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  10388. },
  10389. args: [],
  10390. source: "first\x0a\x09^ self at: 1",
  10391. referencedClasses: [],
  10392. pragmas: [],
  10393. messageSends: ["at:"]
  10394. }),
  10395. $globals.SequenceableCollection);
  10396. $core.addMethod(
  10397. $core.method({
  10398. selector: "first:",
  10399. protocol: "accessing",
  10400. fn: function (aNumber){
  10401. var self=this,$self=this;
  10402. return $core.withContext(function($ctx1) {
  10403. var $1;
  10404. $1=$recv($self._size()).__lt(aNumber);
  10405. if($core.assert($1)){
  10406. $self._error_("Invalid number of elements");
  10407. }
  10408. return $self._copyFrom_to_((1),aNumber);
  10409. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  10410. },
  10411. args: ["aNumber"],
  10412. 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",
  10413. referencedClasses: [],
  10414. pragmas: [],
  10415. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10416. }),
  10417. $globals.SequenceableCollection);
  10418. $core.addMethod(
  10419. $core.method({
  10420. selector: "fourth",
  10421. protocol: "accessing",
  10422. fn: function (){
  10423. var self=this,$self=this;
  10424. return $core.withContext(function($ctx1) {
  10425. return $self._at_((4));
  10426. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  10427. },
  10428. args: [],
  10429. source: "fourth\x0a\x09^ self at: 4",
  10430. referencedClasses: [],
  10431. pragmas: [],
  10432. messageSends: ["at:"]
  10433. }),
  10434. $globals.SequenceableCollection);
  10435. $core.addMethod(
  10436. $core.method({
  10437. selector: "includes:",
  10438. protocol: "testing",
  10439. fn: function (anObject){
  10440. var self=this,$self=this;
  10441. return $core.withContext(function($ctx1) {
  10442. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10443. return nil;
  10444. })))._notNil();
  10445. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  10446. },
  10447. args: ["anObject"],
  10448. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10449. referencedClasses: [],
  10450. pragmas: [],
  10451. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10452. }),
  10453. $globals.SequenceableCollection);
  10454. $core.addMethod(
  10455. $core.method({
  10456. selector: "indexOf:startingAt:",
  10457. protocol: "accessing",
  10458. fn: function (anObject,start){
  10459. var self=this,$self=this;
  10460. return $core.withContext(function($ctx1) {
  10461. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10462. return (0);
  10463. }));
  10464. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  10465. },
  10466. args: ["anObject", "start"],
  10467. 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 ]",
  10468. referencedClasses: [],
  10469. pragmas: [],
  10470. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10471. }),
  10472. $globals.SequenceableCollection);
  10473. $core.addMethod(
  10474. $core.method({
  10475. selector: "indexOf:startingAt:ifAbsent:",
  10476. protocol: "accessing",
  10477. fn: function (anObject,start,aBlock){
  10478. var self=this,$self=this;
  10479. return $core.withContext(function($ctx1) {
  10480. $self._subclassResponsibility();
  10481. return self;
  10482. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  10483. },
  10484. args: ["anObject", "start", "aBlock"],
  10485. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10486. referencedClasses: [],
  10487. pragmas: [],
  10488. messageSends: ["subclassResponsibility"]
  10489. }),
  10490. $globals.SequenceableCollection);
  10491. $core.addMethod(
  10492. $core.method({
  10493. selector: "last",
  10494. protocol: "accessing",
  10495. fn: function (){
  10496. var self=this,$self=this;
  10497. return $core.withContext(function($ctx1) {
  10498. return $self._at_($self._size());
  10499. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  10500. },
  10501. args: [],
  10502. source: "last\x0a\x09^ self at: self size",
  10503. referencedClasses: [],
  10504. pragmas: [],
  10505. messageSends: ["at:", "size"]
  10506. }),
  10507. $globals.SequenceableCollection);
  10508. $core.addMethod(
  10509. $core.method({
  10510. selector: "last:",
  10511. protocol: "accessing",
  10512. fn: function (aNumber){
  10513. var self=this,$self=this;
  10514. return $core.withContext(function($ctx1) {
  10515. var $2,$1,$5,$4,$3;
  10516. $2=$self._size();
  10517. $ctx1.sendIdx["size"]=1;
  10518. $1=$recv($2).__lt(aNumber);
  10519. if($core.assert($1)){
  10520. $self._error_("Invalid number of elements");
  10521. }
  10522. $5=$self._size();
  10523. $ctx1.sendIdx["size"]=2;
  10524. $4=$recv($5).__minus(aNumber);
  10525. $3=$recv($4).__plus((1));
  10526. return $self._copyFrom_to_($3,$self._size());
  10527. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  10528. },
  10529. args: ["aNumber"],
  10530. 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",
  10531. referencedClasses: [],
  10532. pragmas: [],
  10533. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10534. }),
  10535. $globals.SequenceableCollection);
  10536. $core.addMethod(
  10537. $core.method({
  10538. selector: "newStream",
  10539. protocol: "streaming",
  10540. fn: function (){
  10541. var self=this,$self=this;
  10542. return $core.withContext(function($ctx1) {
  10543. return $recv($self._streamClass())._on_(self);
  10544. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  10545. },
  10546. args: [],
  10547. source: "newStream\x0a\x09^ self streamClass on: self",
  10548. referencedClasses: [],
  10549. pragmas: [],
  10550. messageSends: ["on:", "streamClass"]
  10551. }),
  10552. $globals.SequenceableCollection);
  10553. $core.addMethod(
  10554. $core.method({
  10555. selector: "readStream",
  10556. protocol: "streaming",
  10557. fn: function (){
  10558. var self=this,$self=this;
  10559. return $core.withContext(function($ctx1) {
  10560. return $self._stream();
  10561. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  10562. },
  10563. args: [],
  10564. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10565. referencedClasses: [],
  10566. pragmas: [],
  10567. messageSends: ["stream"]
  10568. }),
  10569. $globals.SequenceableCollection);
  10570. $core.addMethod(
  10571. $core.method({
  10572. selector: "removeLast",
  10573. protocol: "adding/removing",
  10574. fn: function (){
  10575. var self=this,$self=this;
  10576. return $core.withContext(function($ctx1) {
  10577. return $self._remove_($self._last());
  10578. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  10579. },
  10580. args: [],
  10581. source: "removeLast\x0a\x09^ self remove: self last",
  10582. referencedClasses: [],
  10583. pragmas: [],
  10584. messageSends: ["remove:", "last"]
  10585. }),
  10586. $globals.SequenceableCollection);
  10587. $core.addMethod(
  10588. $core.method({
  10589. selector: "reverseDo:",
  10590. protocol: "enumerating",
  10591. fn: function (aBlock){
  10592. var self=this,$self=this;
  10593. return $core.withContext(function($ctx1) {
  10594. $recv($self._reversed())._do_(aBlock);
  10595. return self;
  10596. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  10597. },
  10598. args: ["aBlock"],
  10599. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10600. referencedClasses: [],
  10601. pragmas: [],
  10602. messageSends: ["do:", "reversed"]
  10603. }),
  10604. $globals.SequenceableCollection);
  10605. $core.addMethod(
  10606. $core.method({
  10607. selector: "reversed",
  10608. protocol: "converting",
  10609. fn: function (){
  10610. var self=this,$self=this;
  10611. return $core.withContext(function($ctx1) {
  10612. $self._subclassResponsibility();
  10613. return self;
  10614. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  10615. },
  10616. args: [],
  10617. source: "reversed\x0a\x09self subclassResponsibility",
  10618. referencedClasses: [],
  10619. pragmas: [],
  10620. messageSends: ["subclassResponsibility"]
  10621. }),
  10622. $globals.SequenceableCollection);
  10623. $core.addMethod(
  10624. $core.method({
  10625. selector: "second",
  10626. protocol: "accessing",
  10627. fn: function (){
  10628. var self=this,$self=this;
  10629. return $core.withContext(function($ctx1) {
  10630. return $self._at_((2));
  10631. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  10632. },
  10633. args: [],
  10634. source: "second\x0a\x09^ self at: 2",
  10635. referencedClasses: [],
  10636. pragmas: [],
  10637. messageSends: ["at:"]
  10638. }),
  10639. $globals.SequenceableCollection);
  10640. $core.addMethod(
  10641. $core.method({
  10642. selector: "stream",
  10643. protocol: "streaming",
  10644. fn: function (){
  10645. var self=this,$self=this;
  10646. return $core.withContext(function($ctx1) {
  10647. return $self._newStream();
  10648. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  10649. },
  10650. args: [],
  10651. source: "stream\x0a\x09^ self newStream",
  10652. referencedClasses: [],
  10653. pragmas: [],
  10654. messageSends: ["newStream"]
  10655. }),
  10656. $globals.SequenceableCollection);
  10657. $core.addMethod(
  10658. $core.method({
  10659. selector: "streamClass",
  10660. protocol: "streaming",
  10661. fn: function (){
  10662. var self=this,$self=this;
  10663. return $core.withContext(function($ctx1) {
  10664. return $recv($self._class())._streamClass();
  10665. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  10666. },
  10667. args: [],
  10668. source: "streamClass\x0a\x09^ self class streamClass",
  10669. referencedClasses: [],
  10670. pragmas: [],
  10671. messageSends: ["streamClass", "class"]
  10672. }),
  10673. $globals.SequenceableCollection);
  10674. $core.addMethod(
  10675. $core.method({
  10676. selector: "third",
  10677. protocol: "accessing",
  10678. fn: function (){
  10679. var self=this,$self=this;
  10680. return $core.withContext(function($ctx1) {
  10681. return $self._at_((3));
  10682. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  10683. },
  10684. args: [],
  10685. source: "third\x0a\x09^ self at: 3",
  10686. referencedClasses: [],
  10687. pragmas: [],
  10688. messageSends: ["at:"]
  10689. }),
  10690. $globals.SequenceableCollection);
  10691. $core.addMethod(
  10692. $core.method({
  10693. selector: "writeStream",
  10694. protocol: "streaming",
  10695. fn: function (){
  10696. var self=this,$self=this;
  10697. return $core.withContext(function($ctx1) {
  10698. return $self._stream();
  10699. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  10700. },
  10701. args: [],
  10702. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10703. referencedClasses: [],
  10704. pragmas: [],
  10705. messageSends: ["stream"]
  10706. }),
  10707. $globals.SequenceableCollection);
  10708. $core.addMethod(
  10709. $core.method({
  10710. selector: "streamClass",
  10711. protocol: "accessing",
  10712. fn: function (){
  10713. var self=this,$self=this;
  10714. return $globals.Stream;
  10715. },
  10716. args: [],
  10717. source: "streamClass\x0a\x09\x09^ Stream",
  10718. referencedClasses: ["Stream"],
  10719. pragmas: [],
  10720. messageSends: []
  10721. }),
  10722. $globals.SequenceableCollection.a$cls);
  10723. $core.addMethod(
  10724. $core.method({
  10725. selector: "streamContents:",
  10726. protocol: "streaming",
  10727. fn: function (aBlock){
  10728. var self=this,$self=this;
  10729. var stream;
  10730. return $core.withContext(function($ctx1) {
  10731. stream=$recv($self._streamClass())._on_($self._new());
  10732. $recv(aBlock)._value_(stream);
  10733. return $recv(stream)._contents();
  10734. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  10735. },
  10736. args: ["aBlock"],
  10737. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10738. referencedClasses: [],
  10739. pragmas: [],
  10740. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10741. }),
  10742. $globals.SequenceableCollection.a$cls);
  10743. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10744. $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`.";
  10745. $core.addMethod(
  10746. $core.method({
  10747. selector: "add:",
  10748. protocol: "adding/removing",
  10749. fn: function (anObject){
  10750. var self=this,$self=this;
  10751. return $core.withContext(function($ctx1) {
  10752. self.push(anObject); return anObject;;
  10753. return self;
  10754. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  10755. },
  10756. args: ["anObject"],
  10757. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10758. referencedClasses: [],
  10759. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  10760. messageSends: []
  10761. }),
  10762. $globals.Array);
  10763. $core.addMethod(
  10764. $core.method({
  10765. selector: "addAll:",
  10766. protocol: "adding/removing",
  10767. fn: function (aCollection){
  10768. var self=this,$self=this;
  10769. return $core.withContext(function($ctx1) {
  10770. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10771. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10772. return aCollection;;
  10773. return self;
  10774. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  10775. },
  10776. args: ["aCollection"],
  10777. 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'>",
  10778. referencedClasses: [],
  10779. pragmas: [["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;"]]],
  10780. messageSends: []
  10781. }),
  10782. $globals.Array);
  10783. $core.addMethod(
  10784. $core.method({
  10785. selector: "addFirst:",
  10786. protocol: "adding/removing",
  10787. fn: function (anObject){
  10788. var self=this,$self=this;
  10789. return $core.withContext(function($ctx1) {
  10790. self.unshift(anObject); return anObject;;
  10791. return self;
  10792. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  10793. },
  10794. args: ["anObject"],
  10795. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10796. referencedClasses: [],
  10797. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  10798. messageSends: []
  10799. }),
  10800. $globals.Array);
  10801. $core.addMethod(
  10802. $core.method({
  10803. selector: "asJavaScriptSource",
  10804. protocol: "converting",
  10805. fn: function (){
  10806. var self=this,$self=this;
  10807. return $core.withContext(function($ctx1) {
  10808. var $1;
  10809. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10810. return $core.withContext(function($ctx2) {
  10811. return $recv(each)._asJavaScriptSource();
  10812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10813. })))._join_(", "))).__comma("]");
  10814. $ctx1.sendIdx[","]=1;
  10815. return $1;
  10816. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  10817. },
  10818. args: [],
  10819. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10820. referencedClasses: [],
  10821. pragmas: [],
  10822. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10823. }),
  10824. $globals.Array);
  10825. $core.addMethod(
  10826. $core.method({
  10827. selector: "at:put:",
  10828. protocol: "accessing",
  10829. fn: function (anIndex,anObject){
  10830. var self=this,$self=this;
  10831. return $core.withContext(function($ctx1) {
  10832. return self[anIndex - 1] = anObject;
  10833. return self;
  10834. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  10835. },
  10836. args: ["anIndex", "anObject"],
  10837. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10838. referencedClasses: [],
  10839. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  10840. messageSends: []
  10841. }),
  10842. $globals.Array);
  10843. $core.addMethod(
  10844. $core.method({
  10845. selector: "collect:",
  10846. protocol: "enumerating",
  10847. fn: function (aBlock){
  10848. var self=this,$self=this;
  10849. return $core.withContext(function($ctx1) {
  10850. return self.map(function(each) {return aBlock._value_(each)});
  10851. return self;
  10852. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  10853. },
  10854. args: ["aBlock"],
  10855. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10856. referencedClasses: [],
  10857. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  10858. messageSends: []
  10859. }),
  10860. $globals.Array);
  10861. $core.addMethod(
  10862. $core.method({
  10863. selector: "copyFrom:to:",
  10864. protocol: "copying",
  10865. fn: function (anIndex,anotherIndex){
  10866. var self=this,$self=this;
  10867. return $core.withContext(function($ctx1) {
  10868. if (anIndex >= 1 && anotherIndex <= self.length) {
  10869. return self.slice(anIndex - 1, anotherIndex);
  10870. } else {
  10871. self._at_(anIndex);
  10872. self._at_(self.length + 1);
  10873. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10874. };
  10875. return self;
  10876. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  10877. },
  10878. args: ["anIndex", "anotherIndex"],
  10879. 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'>",
  10880. referencedClasses: [],
  10881. pragmas: [["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}"]]],
  10882. messageSends: []
  10883. }),
  10884. $globals.Array);
  10885. $core.addMethod(
  10886. $core.method({
  10887. selector: "join:",
  10888. protocol: "enumerating",
  10889. fn: function (aString){
  10890. var self=this,$self=this;
  10891. return $core.withContext(function($ctx1) {
  10892. return self.join(aString);
  10893. return self;
  10894. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  10895. },
  10896. args: ["aString"],
  10897. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10898. referencedClasses: [],
  10899. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  10900. messageSends: []
  10901. }),
  10902. $globals.Array);
  10903. $core.addMethod(
  10904. $core.method({
  10905. selector: "printOn:",
  10906. protocol: "printing",
  10907. fn: function (aStream){
  10908. var self=this,$self=this;
  10909. return $core.withContext(function($ctx1) {
  10910. (
  10911. $ctx1.supercall = true,
  10912. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10913. $ctx1.supercall = false;
  10914. $ctx1.sendIdx["printOn:"]=1;
  10915. $recv(aStream)._nextPutAll_(" (");
  10916. $ctx1.sendIdx["nextPutAll:"]=1;
  10917. $self._do_separatedBy_((function(each){
  10918. return $core.withContext(function($ctx2) {
  10919. return $recv(each)._printOn_(aStream);
  10920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10921. }),(function(){
  10922. return $core.withContext(function($ctx2) {
  10923. return $recv(aStream)._nextPutAll_(" ");
  10924. $ctx2.sendIdx["nextPutAll:"]=2;
  10925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10926. }));
  10927. $recv(aStream)._nextPutAll_(")");
  10928. return self;
  10929. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  10930. },
  10931. args: ["aStream"],
  10932. 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: ')'",
  10933. referencedClasses: [],
  10934. pragmas: [],
  10935. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10936. }),
  10937. $globals.Array);
  10938. $core.addMethod(
  10939. $core.method({
  10940. selector: "remove:ifAbsent:",
  10941. protocol: "adding/removing",
  10942. fn: function (anObject,aBlock){
  10943. var self=this,$self=this;
  10944. var index;
  10945. return $core.withContext(function($ctx1) {
  10946. var $1;
  10947. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10948. return (0);
  10949. }));
  10950. $1=$recv(index).__eq((0));
  10951. if($core.assert($1)){
  10952. return $recv(aBlock)._value();
  10953. } else {
  10954. $self._removeIndex_(index);
  10955. return anObject;
  10956. }
  10957. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  10958. },
  10959. args: ["anObject", "aBlock"],
  10960. 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 ]",
  10961. referencedClasses: [],
  10962. pragmas: [],
  10963. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10964. }),
  10965. $globals.Array);
  10966. $core.addMethod(
  10967. $core.method({
  10968. selector: "removeAll",
  10969. protocol: "adding/removing",
  10970. fn: function (){
  10971. var self=this,$self=this;
  10972. return $core.withContext(function($ctx1) {
  10973. self.length = 0;
  10974. return self;
  10975. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  10976. },
  10977. args: [],
  10978. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10979. referencedClasses: [],
  10980. pragmas: [["inlineJS:", ["self.length = 0"]]],
  10981. messageSends: []
  10982. }),
  10983. $globals.Array);
  10984. $core.addMethod(
  10985. $core.method({
  10986. selector: "removeFrom:to:",
  10987. protocol: "adding/removing",
  10988. fn: function (aNumber,anotherNumber){
  10989. var self=this,$self=this;
  10990. return $core.withContext(function($ctx1) {
  10991. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10992. return self;
  10993. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  10994. },
  10995. args: ["aNumber", "anotherNumber"],
  10996. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10997. referencedClasses: [],
  10998. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  10999. messageSends: []
  11000. }),
  11001. $globals.Array);
  11002. $core.addMethod(
  11003. $core.method({
  11004. selector: "removeIndex:",
  11005. protocol: "adding/removing",
  11006. fn: function (anInteger){
  11007. var self=this,$self=this;
  11008. return $core.withContext(function($ctx1) {
  11009. self.splice(anInteger - 1, 1);
  11010. return self;
  11011. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  11012. },
  11013. args: ["anInteger"],
  11014. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  11015. referencedClasses: [],
  11016. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  11017. messageSends: []
  11018. }),
  11019. $globals.Array);
  11020. $core.addMethod(
  11021. $core.method({
  11022. selector: "removeLast",
  11023. protocol: "adding/removing",
  11024. fn: function (){
  11025. var self=this,$self=this;
  11026. return $core.withContext(function($ctx1) {
  11027. return self.pop();;
  11028. return self;
  11029. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  11030. },
  11031. args: [],
  11032. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  11033. referencedClasses: [],
  11034. pragmas: [["inlineJS:", ["return self.pop();"]]],
  11035. messageSends: []
  11036. }),
  11037. $globals.Array);
  11038. $core.addMethod(
  11039. $core.method({
  11040. selector: "reversed",
  11041. protocol: "converting",
  11042. fn: function (){
  11043. var self=this,$self=this;
  11044. return $core.withContext(function($ctx1) {
  11045. return self.slice().reverse();
  11046. return self;
  11047. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  11048. },
  11049. args: [],
  11050. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  11051. referencedClasses: [],
  11052. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  11053. messageSends: []
  11054. }),
  11055. $globals.Array);
  11056. $core.addMethod(
  11057. $core.method({
  11058. selector: "select:",
  11059. protocol: "enumerating",
  11060. fn: function (aBlock){
  11061. var self=this,$self=this;
  11062. return $core.withContext(function($ctx1) {
  11063. return self.filter(function(each) {return aBlock._value_(each)});
  11064. return self;
  11065. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  11066. },
  11067. args: ["aBlock"],
  11068. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  11069. referencedClasses: [],
  11070. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  11071. messageSends: []
  11072. }),
  11073. $globals.Array);
  11074. $core.addMethod(
  11075. $core.method({
  11076. selector: "shallowCopy",
  11077. protocol: "copying",
  11078. fn: function (){
  11079. var self=this,$self=this;
  11080. return $core.withContext(function($ctx1) {
  11081. return self.slice();
  11082. return self;
  11083. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  11084. },
  11085. args: [],
  11086. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  11087. referencedClasses: [],
  11088. pragmas: [["inlineJS:", ["return self.slice()"]]],
  11089. messageSends: []
  11090. }),
  11091. $globals.Array);
  11092. $core.addMethod(
  11093. $core.method({
  11094. selector: "sort",
  11095. protocol: "enumerating",
  11096. fn: function (){
  11097. var self=this,$self=this;
  11098. return $core.withContext(function($ctx1) {
  11099. return $self._sort_((function(a,b){
  11100. return $core.withContext(function($ctx2) {
  11101. return $recv(a).__lt(b);
  11102. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  11103. }));
  11104. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  11105. },
  11106. args: [],
  11107. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  11108. referencedClasses: [],
  11109. pragmas: [],
  11110. messageSends: ["sort:", "<"]
  11111. }),
  11112. $globals.Array);
  11113. $core.addMethod(
  11114. $core.method({
  11115. selector: "sort:",
  11116. protocol: "enumerating",
  11117. fn: function (aBlock){
  11118. var self=this,$self=this;
  11119. return $core.withContext(function($ctx1) {
  11120. return self.sort(function(a, b) {
  11121. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  11122. })
  11123. ;
  11124. return self;
  11125. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  11126. },
  11127. args: ["aBlock"],
  11128. 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'>",
  11129. referencedClasses: [],
  11130. pragmas: [["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"]]],
  11131. messageSends: []
  11132. }),
  11133. $globals.Array);
  11134. $core.addMethod(
  11135. $core.method({
  11136. selector: "sorted",
  11137. protocol: "enumerating",
  11138. fn: function (){
  11139. var self=this,$self=this;
  11140. return $core.withContext(function($ctx1) {
  11141. return $recv($self._copy())._sort();
  11142. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  11143. },
  11144. args: [],
  11145. source: "sorted\x0a\x09^ self copy sort",
  11146. referencedClasses: [],
  11147. pragmas: [],
  11148. messageSends: ["sort", "copy"]
  11149. }),
  11150. $globals.Array);
  11151. $core.addMethod(
  11152. $core.method({
  11153. selector: "sorted:",
  11154. protocol: "enumerating",
  11155. fn: function (aBlock){
  11156. var self=this,$self=this;
  11157. return $core.withContext(function($ctx1) {
  11158. return $recv($self._copy())._sort_(aBlock);
  11159. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  11160. },
  11161. args: ["aBlock"],
  11162. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11163. referencedClasses: [],
  11164. pragmas: [],
  11165. messageSends: ["sort:", "copy"]
  11166. }),
  11167. $globals.Array);
  11168. $core.addMethod(
  11169. $core.method({
  11170. selector: "new:",
  11171. protocol: "instance creation",
  11172. fn: function (anInteger){
  11173. var self=this,$self=this;
  11174. return $core.withContext(function($ctx1) {
  11175. return new Array(anInteger);
  11176. return self;
  11177. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  11178. },
  11179. args: ["anInteger"],
  11180. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11181. referencedClasses: [],
  11182. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  11183. messageSends: []
  11184. }),
  11185. $globals.Array.a$cls);
  11186. $core.addMethod(
  11187. $core.method({
  11188. selector: "with:",
  11189. protocol: "instance creation",
  11190. fn: function (anObject){
  11191. var self=this,$self=this;
  11192. return $core.withContext(function($ctx1) {
  11193. var $1;
  11194. $1=$self._new_((1));
  11195. $recv($1)._at_put_((1),anObject);
  11196. return $recv($1)._yourself();
  11197. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  11198. },
  11199. args: ["anObject"],
  11200. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11201. referencedClasses: [],
  11202. pragmas: [],
  11203. messageSends: ["at:put:", "new:", "yourself"]
  11204. }),
  11205. $globals.Array.a$cls);
  11206. $core.addMethod(
  11207. $core.method({
  11208. selector: "with:with:",
  11209. protocol: "instance creation",
  11210. fn: function (anObject,anObject2){
  11211. var self=this,$self=this;
  11212. return $core.withContext(function($ctx1) {
  11213. var $1;
  11214. $1=$self._new_((2));
  11215. $recv($1)._at_put_((1),anObject);
  11216. $ctx1.sendIdx["at:put:"]=1;
  11217. $recv($1)._at_put_((2),anObject2);
  11218. return $recv($1)._yourself();
  11219. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  11220. },
  11221. args: ["anObject", "anObject2"],
  11222. 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",
  11223. referencedClasses: [],
  11224. pragmas: [],
  11225. messageSends: ["at:put:", "new:", "yourself"]
  11226. }),
  11227. $globals.Array.a$cls);
  11228. $core.addMethod(
  11229. $core.method({
  11230. selector: "with:with:with:",
  11231. protocol: "instance creation",
  11232. fn: function (anObject,anObject2,anObject3){
  11233. var self=this,$self=this;
  11234. return $core.withContext(function($ctx1) {
  11235. var $1;
  11236. $1=$self._new_((3));
  11237. $recv($1)._at_put_((1),anObject);
  11238. $ctx1.sendIdx["at:put:"]=1;
  11239. $recv($1)._at_put_((2),anObject2);
  11240. $ctx1.sendIdx["at:put:"]=2;
  11241. $recv($1)._at_put_((3),anObject3);
  11242. return $recv($1)._yourself();
  11243. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  11244. },
  11245. args: ["anObject", "anObject2", "anObject3"],
  11246. 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",
  11247. referencedClasses: [],
  11248. pragmas: [],
  11249. messageSends: ["at:put:", "new:", "yourself"]
  11250. }),
  11251. $globals.Array.a$cls);
  11252. $core.addMethod(
  11253. $core.method({
  11254. selector: "withAll:",
  11255. protocol: "instance creation",
  11256. fn: function (aCollection){
  11257. var self=this,$self=this;
  11258. var instance,index;
  11259. return $core.withContext(function($ctx1) {
  11260. index=(1);
  11261. instance=$self._new_($recv(aCollection)._size());
  11262. $recv(aCollection)._do_((function(each){
  11263. return $core.withContext(function($ctx2) {
  11264. $recv(instance)._at_put_(index,each);
  11265. index=$recv(index).__plus((1));
  11266. return index;
  11267. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11268. }));
  11269. return instance;
  11270. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  11271. },
  11272. args: ["aCollection"],
  11273. 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",
  11274. referencedClasses: [],
  11275. pragmas: [],
  11276. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11277. }),
  11278. $globals.Array.a$cls);
  11279. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  11280. $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 >> #,`";
  11281. $core.addMethod(
  11282. $core.method({
  11283. selector: ",",
  11284. protocol: "copying",
  11285. fn: function (aString){
  11286. var self=this,$self=this;
  11287. return $core.withContext(function($ctx1) {
  11288. return String(self) + aString;
  11289. return self;
  11290. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  11291. },
  11292. args: ["aString"],
  11293. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11294. referencedClasses: [],
  11295. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  11296. messageSends: []
  11297. }),
  11298. $globals.String);
  11299. $core.addMethod(
  11300. $core.method({
  11301. selector: "<",
  11302. protocol: "comparing",
  11303. fn: function (aString){
  11304. var self=this,$self=this;
  11305. return $core.withContext(function($ctx1) {
  11306. return String(self) < aString._asString();
  11307. return self;
  11308. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  11309. },
  11310. args: ["aString"],
  11311. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11312. referencedClasses: [],
  11313. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  11314. messageSends: []
  11315. }),
  11316. $globals.String);
  11317. $core.addMethod(
  11318. $core.method({
  11319. selector: "<=",
  11320. protocol: "comparing",
  11321. fn: function (aString){
  11322. var self=this,$self=this;
  11323. return $core.withContext(function($ctx1) {
  11324. return String(self) <= aString._asString();
  11325. return self;
  11326. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  11327. },
  11328. args: ["aString"],
  11329. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11330. referencedClasses: [],
  11331. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  11332. messageSends: []
  11333. }),
  11334. $globals.String);
  11335. $core.addMethod(
  11336. $core.method({
  11337. selector: "=",
  11338. protocol: "comparing",
  11339. fn: function (aString){
  11340. var self=this,$self=this;
  11341. return $core.withContext(function($ctx1) {
  11342. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11343. return self;
  11344. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  11345. },
  11346. args: ["aString"],
  11347. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11348. referencedClasses: [],
  11349. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  11350. messageSends: []
  11351. }),
  11352. $globals.String);
  11353. $core.addMethod(
  11354. $core.method({
  11355. selector: "==",
  11356. protocol: "comparing",
  11357. fn: function (aString){
  11358. var self=this,$self=this;
  11359. return $core.withContext(function($ctx1) {
  11360. if (typeof aString === "string") return String(self) === aString;
  11361. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11362. else return false;;
  11363. return self;
  11364. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  11365. },
  11366. args: ["aString"],
  11367. 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'>",
  11368. referencedClasses: [],
  11369. pragmas: [["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;"]]],
  11370. messageSends: []
  11371. }),
  11372. $globals.String);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: ">",
  11376. protocol: "comparing",
  11377. fn: function (aString){
  11378. var self=this,$self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. return String(self) > aString._asString();
  11381. return self;
  11382. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  11383. },
  11384. args: ["aString"],
  11385. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11386. referencedClasses: [],
  11387. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  11388. messageSends: []
  11389. }),
  11390. $globals.String);
  11391. $core.addMethod(
  11392. $core.method({
  11393. selector: ">=",
  11394. protocol: "comparing",
  11395. fn: function (aString){
  11396. var self=this,$self=this;
  11397. return $core.withContext(function($ctx1) {
  11398. return String(self) >= aString._asString();
  11399. return self;
  11400. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  11401. },
  11402. args: ["aString"],
  11403. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11404. referencedClasses: [],
  11405. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  11406. messageSends: []
  11407. }),
  11408. $globals.String);
  11409. $core.addMethod(
  11410. $core.method({
  11411. selector: "add:",
  11412. protocol: "adding/removing",
  11413. fn: function (anObject){
  11414. var self=this,$self=this;
  11415. return $core.withContext(function($ctx1) {
  11416. $self._errorReadOnly();
  11417. return self;
  11418. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  11419. },
  11420. args: ["anObject"],
  11421. source: "add: anObject\x0a\x09self errorReadOnly",
  11422. referencedClasses: [],
  11423. pragmas: [],
  11424. messageSends: ["errorReadOnly"]
  11425. }),
  11426. $globals.String);
  11427. $core.addMethod(
  11428. $core.method({
  11429. selector: "asJavaScriptMethodName",
  11430. protocol: "converting",
  11431. fn: function (){
  11432. var self=this,$self=this;
  11433. return $core.withContext(function($ctx1) {
  11434. return $core.st2js(self);
  11435. return self;
  11436. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  11437. },
  11438. args: [],
  11439. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11440. referencedClasses: [],
  11441. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  11442. messageSends: []
  11443. }),
  11444. $globals.String);
  11445. $core.addMethod(
  11446. $core.method({
  11447. selector: "asJavaScriptObject",
  11448. protocol: "converting",
  11449. fn: function (){
  11450. var self=this,$self=this;
  11451. return self;
  11452. },
  11453. args: [],
  11454. source: "asJavaScriptObject\x0a\x09^ self",
  11455. referencedClasses: [],
  11456. pragmas: [],
  11457. messageSends: []
  11458. }),
  11459. $globals.String);
  11460. $core.addMethod(
  11461. $core.method({
  11462. selector: "asJavaScriptSource",
  11463. protocol: "converting",
  11464. fn: function (){
  11465. var self=this,$self=this;
  11466. return $core.withContext(function($ctx1) {
  11467. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11468. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11469. else
  11470. return "\"" + self + "\"";
  11471. ;
  11472. return self;
  11473. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  11474. },
  11475. args: [],
  11476. 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'>",
  11477. referencedClasses: [],
  11478. pragmas: [["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"]]],
  11479. messageSends: []
  11480. }),
  11481. $globals.String);
  11482. $core.addMethod(
  11483. $core.method({
  11484. selector: "asLowercase",
  11485. protocol: "converting",
  11486. fn: function (){
  11487. var self=this,$self=this;
  11488. return $core.withContext(function($ctx1) {
  11489. return self.toLowerCase();
  11490. return self;
  11491. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  11492. },
  11493. args: [],
  11494. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11495. referencedClasses: [],
  11496. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  11497. messageSends: []
  11498. }),
  11499. $globals.String);
  11500. $core.addMethod(
  11501. $core.method({
  11502. selector: "asMutator",
  11503. protocol: "converting",
  11504. fn: function (){
  11505. var self=this,$self=this;
  11506. return $core.withContext(function($ctx1) {
  11507. var $1;
  11508. $1=$recv($self._last()).__eq(":");
  11509. if(!$core.assert($1)){
  11510. return $self.__comma(":");
  11511. }
  11512. return self;
  11513. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  11514. },
  11515. args: [],
  11516. 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",
  11517. referencedClasses: [],
  11518. pragmas: [],
  11519. messageSends: ["ifFalse:", "=", "last", ","]
  11520. }),
  11521. $globals.String);
  11522. $core.addMethod(
  11523. $core.method({
  11524. selector: "asNumber",
  11525. protocol: "converting",
  11526. fn: function (){
  11527. var self=this,$self=this;
  11528. return $core.withContext(function($ctx1) {
  11529. return Number(self);
  11530. return self;
  11531. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  11532. },
  11533. args: [],
  11534. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11535. referencedClasses: [],
  11536. pragmas: [["inlineJS:", ["return Number(self)"]]],
  11537. messageSends: []
  11538. }),
  11539. $globals.String);
  11540. $core.addMethod(
  11541. $core.method({
  11542. selector: "asRegexp",
  11543. protocol: "converting",
  11544. fn: function (){
  11545. var self=this,$self=this;
  11546. return $core.withContext(function($ctx1) {
  11547. return $recv($globals.RegularExpression)._fromString_(self);
  11548. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  11549. },
  11550. args: [],
  11551. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11552. referencedClasses: ["RegularExpression"],
  11553. pragmas: [],
  11554. messageSends: ["fromString:"]
  11555. }),
  11556. $globals.String);
  11557. $core.addMethod(
  11558. $core.method({
  11559. selector: "asString",
  11560. protocol: "converting",
  11561. fn: function (){
  11562. var self=this,$self=this;
  11563. return self;
  11564. },
  11565. args: [],
  11566. source: "asString\x0a\x09^ self",
  11567. referencedClasses: [],
  11568. pragmas: [],
  11569. messageSends: []
  11570. }),
  11571. $globals.String);
  11572. $core.addMethod(
  11573. $core.method({
  11574. selector: "asSymbol",
  11575. protocol: "converting",
  11576. fn: function (){
  11577. var self=this,$self=this;
  11578. return self;
  11579. },
  11580. args: [],
  11581. source: "asSymbol\x0a\x09^ self",
  11582. referencedClasses: [],
  11583. pragmas: [],
  11584. messageSends: []
  11585. }),
  11586. $globals.String);
  11587. $core.addMethod(
  11588. $core.method({
  11589. selector: "asSymbolPrintOn:",
  11590. protocol: "printing",
  11591. fn: function (aStream){
  11592. var self=this,$self=this;
  11593. return $core.withContext(function($ctx1) {
  11594. var $1;
  11595. $recv(aStream)._nextPutAll_("#");
  11596. $1=$recv($self._asString())._isSelector();
  11597. if($core.assert($1)){
  11598. $recv(aStream)._nextPut_(self);
  11599. } else {
  11600. $self._printOn_(aStream);
  11601. }
  11602. return self;
  11603. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  11604. },
  11605. args: ["aStream"],
  11606. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11607. referencedClasses: [],
  11608. pragmas: [],
  11609. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11610. }),
  11611. $globals.String);
  11612. $core.addMethod(
  11613. $core.method({
  11614. selector: "asUppercase",
  11615. protocol: "converting",
  11616. fn: function (){
  11617. var self=this,$self=this;
  11618. return $core.withContext(function($ctx1) {
  11619. return self.toUpperCase();
  11620. return self;
  11621. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  11622. },
  11623. args: [],
  11624. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11625. referencedClasses: [],
  11626. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  11627. messageSends: []
  11628. }),
  11629. $globals.String);
  11630. $core.addMethod(
  11631. $core.method({
  11632. selector: "asciiValue",
  11633. protocol: "accessing",
  11634. fn: function (){
  11635. var self=this,$self=this;
  11636. return $core.withContext(function($ctx1) {
  11637. return self.charCodeAt(0);;
  11638. return self;
  11639. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  11640. },
  11641. args: [],
  11642. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11643. referencedClasses: [],
  11644. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  11645. messageSends: []
  11646. }),
  11647. $globals.String);
  11648. $core.addMethod(
  11649. $core.method({
  11650. selector: "at:ifAbsent:",
  11651. protocol: "accessing",
  11652. fn: function (anIndex,aBlock){
  11653. var self=this,$self=this;
  11654. return $core.withContext(function($ctx1) {
  11655. return String(self)[anIndex - 1] || aBlock._value();
  11656. return self;
  11657. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  11658. },
  11659. args: ["anIndex", "aBlock"],
  11660. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11661. referencedClasses: [],
  11662. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  11663. messageSends: []
  11664. }),
  11665. $globals.String);
  11666. $core.addMethod(
  11667. $core.method({
  11668. selector: "at:ifPresent:ifAbsent:",
  11669. protocol: "accessing",
  11670. fn: function (anIndex,aBlock,anotherBlock){
  11671. var self=this,$self=this;
  11672. return $core.withContext(function($ctx1) {
  11673. var result = String(self)[anIndex - 1];
  11674. return result ? aBlock._value_(result) : anotherBlock._value();
  11675. ;
  11676. return self;
  11677. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  11678. },
  11679. args: ["anIndex", "aBlock", "anotherBlock"],
  11680. 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'>",
  11681. referencedClasses: [],
  11682. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  11683. messageSends: []
  11684. }),
  11685. $globals.String);
  11686. $core.addMethod(
  11687. $core.method({
  11688. selector: "at:put:",
  11689. protocol: "accessing",
  11690. fn: function (anIndex,anObject){
  11691. var self=this,$self=this;
  11692. return $core.withContext(function($ctx1) {
  11693. $self._errorReadOnly();
  11694. return self;
  11695. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  11696. },
  11697. args: ["anIndex", "anObject"],
  11698. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11699. referencedClasses: [],
  11700. pragmas: [],
  11701. messageSends: ["errorReadOnly"]
  11702. }),
  11703. $globals.String);
  11704. $core.addMethod(
  11705. $core.method({
  11706. selector: "capitalized",
  11707. protocol: "converting",
  11708. fn: function (){
  11709. var self=this,$self=this;
  11710. return $core.withContext(function($ctx1) {
  11711. return $self._ifNotEmpty_((function(){
  11712. return $core.withContext(function($ctx2) {
  11713. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11715. }));
  11716. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  11717. },
  11718. args: [],
  11719. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11720. referencedClasses: [],
  11721. pragmas: [],
  11722. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11723. }),
  11724. $globals.String);
  11725. $core.addMethod(
  11726. $core.method({
  11727. selector: "charCodeAt:",
  11728. protocol: "accessing",
  11729. fn: function (anInteger){
  11730. var self=this,$self=this;
  11731. return $core.withContext(function($ctx1) {
  11732. return self.charCodeAt(anInteger - 1);
  11733. return self;
  11734. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  11735. },
  11736. args: ["anInteger"],
  11737. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11738. referencedClasses: [],
  11739. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  11740. messageSends: []
  11741. }),
  11742. $globals.String);
  11743. $core.addMethod(
  11744. $core.method({
  11745. selector: "copyFrom:to:",
  11746. protocol: "copying",
  11747. fn: function (anIndex,anotherIndex){
  11748. var self=this,$self=this;
  11749. return $core.withContext(function($ctx1) {
  11750. return self.substring(anIndex - 1, anotherIndex);
  11751. return self;
  11752. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  11753. },
  11754. args: ["anIndex", "anotherIndex"],
  11755. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11756. referencedClasses: [],
  11757. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  11758. messageSends: []
  11759. }),
  11760. $globals.String);
  11761. $core.addMethod(
  11762. $core.method({
  11763. selector: "crlfSanitized",
  11764. protocol: "converting",
  11765. fn: function (){
  11766. var self=this,$self=this;
  11767. return $core.withContext(function($ctx1) {
  11768. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11769. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  11770. },
  11771. args: [],
  11772. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11773. referencedClasses: ["String"],
  11774. pragmas: [],
  11775. messageSends: ["join:", "lines", "lf"]
  11776. }),
  11777. $globals.String);
  11778. $core.addMethod(
  11779. $core.method({
  11780. selector: "deepCopy",
  11781. protocol: "copying",
  11782. fn: function (){
  11783. var self=this,$self=this;
  11784. return $core.withContext(function($ctx1) {
  11785. return $self._shallowCopy();
  11786. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  11787. },
  11788. args: [],
  11789. source: "deepCopy\x0a\x09^ self shallowCopy",
  11790. referencedClasses: [],
  11791. pragmas: [],
  11792. messageSends: ["shallowCopy"]
  11793. }),
  11794. $globals.String);
  11795. $core.addMethod(
  11796. $core.method({
  11797. selector: "errorReadOnly",
  11798. protocol: "error handling",
  11799. fn: function (){
  11800. var self=this,$self=this;
  11801. return $core.withContext(function($ctx1) {
  11802. $self._error_("Object is read-only");
  11803. return self;
  11804. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  11805. },
  11806. args: [],
  11807. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11808. referencedClasses: [],
  11809. pragmas: [],
  11810. messageSends: ["error:"]
  11811. }),
  11812. $globals.String);
  11813. $core.addMethod(
  11814. $core.method({
  11815. selector: "escaped",
  11816. protocol: "converting",
  11817. fn: function (){
  11818. var self=this,$self=this;
  11819. return $core.withContext(function($ctx1) {
  11820. return escape(self);
  11821. return self;
  11822. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  11823. },
  11824. args: [],
  11825. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11826. referencedClasses: [],
  11827. pragmas: [["inlineJS:", ["return escape(self)"]]],
  11828. messageSends: []
  11829. }),
  11830. $globals.String);
  11831. $core.addMethod(
  11832. $core.method({
  11833. selector: "includesSubString:",
  11834. protocol: "testing",
  11835. fn: function (subString){
  11836. var self=this,$self=this;
  11837. return $core.withContext(function($ctx1) {
  11838. return self.indexOf(subString) != -1;
  11839. return self;
  11840. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  11841. },
  11842. args: ["subString"],
  11843. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11844. referencedClasses: [],
  11845. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  11846. messageSends: []
  11847. }),
  11848. $globals.String);
  11849. $core.addMethod(
  11850. $core.method({
  11851. selector: "isCapitalized",
  11852. protocol: "testing",
  11853. fn: function (){
  11854. var self=this,$self=this;
  11855. return $core.withContext(function($ctx1) {
  11856. var $2,$1;
  11857. $2=$self._first();
  11858. $ctx1.sendIdx["first"]=1;
  11859. $1=$recv($2)._asUppercase();
  11860. return $recv($1).__eq_eq($self._first());
  11861. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  11862. },
  11863. args: [],
  11864. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11865. referencedClasses: [],
  11866. pragmas: [],
  11867. messageSends: ["==", "asUppercase", "first"]
  11868. }),
  11869. $globals.String);
  11870. $core.addMethod(
  11871. $core.method({
  11872. selector: "isImmutable",
  11873. protocol: "testing",
  11874. fn: function (){
  11875. var self=this,$self=this;
  11876. return true;
  11877. },
  11878. args: [],
  11879. source: "isImmutable\x0a\x09^ true",
  11880. referencedClasses: [],
  11881. pragmas: [],
  11882. messageSends: []
  11883. }),
  11884. $globals.String);
  11885. $core.addMethod(
  11886. $core.method({
  11887. selector: "isSelector",
  11888. protocol: "testing",
  11889. fn: function (){
  11890. var self=this,$self=this;
  11891. return $core.withContext(function($ctx1) {
  11892. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11893. return self;
  11894. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  11895. },
  11896. args: [],
  11897. 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>",
  11898. referencedClasses: [],
  11899. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  11900. messageSends: []
  11901. }),
  11902. $globals.String);
  11903. $core.addMethod(
  11904. $core.method({
  11905. selector: "isString",
  11906. protocol: "testing",
  11907. fn: function (){
  11908. var self=this,$self=this;
  11909. return true;
  11910. },
  11911. args: [],
  11912. source: "isString\x0a\x09^ true",
  11913. referencedClasses: [],
  11914. pragmas: [],
  11915. messageSends: []
  11916. }),
  11917. $globals.String);
  11918. $core.addMethod(
  11919. $core.method({
  11920. selector: "isVowel",
  11921. protocol: "testing",
  11922. fn: function (){
  11923. var self=this,$self=this;
  11924. return $core.withContext(function($ctx1) {
  11925. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11926. return $core.withContext(function($ctx2) {
  11927. return "aeiou"._includes_($self._asLowercase());
  11928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11929. }));
  11930. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  11931. },
  11932. args: [],
  11933. 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 ]",
  11934. referencedClasses: [],
  11935. pragmas: [],
  11936. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11937. }),
  11938. $globals.String);
  11939. $core.addMethod(
  11940. $core.method({
  11941. selector: "join:",
  11942. protocol: "split join",
  11943. fn: function (aCollection){
  11944. var self=this,$self=this;
  11945. return $core.withContext(function($ctx1) {
  11946. return $recv($globals.String)._streamContents_((function(stream){
  11947. return $core.withContext(function($ctx2) {
  11948. return $recv(aCollection)._do_separatedBy_((function(each){
  11949. return $core.withContext(function($ctx3) {
  11950. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11951. $ctx3.sendIdx["nextPutAll:"]=1;
  11952. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11953. }),(function(){
  11954. return $core.withContext(function($ctx3) {
  11955. return $recv(stream)._nextPutAll_(self);
  11956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11957. }));
  11958. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11959. }));
  11960. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  11961. },
  11962. args: ["aCollection"],
  11963. 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 ]]",
  11964. referencedClasses: ["String"],
  11965. pragmas: [],
  11966. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11967. }),
  11968. $globals.String);
  11969. $core.addMethod(
  11970. $core.method({
  11971. selector: "lineIndicesDo:",
  11972. protocol: "split join",
  11973. fn: function (aBlock){
  11974. var self=this,$self=this;
  11975. var cr,lf,start,sz,nextLF,nextCR;
  11976. return $core.withContext(function($ctx1) {
  11977. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11978. var $early={};
  11979. try {
  11980. start=(1);
  11981. sz=$self._size();
  11982. cr=$recv($globals.String)._cr();
  11983. nextCR=$self._indexOf_startingAt_(cr,(1));
  11984. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11985. lf=$recv($globals.String)._lf();
  11986. nextLF=$self._indexOf_startingAt_(lf,(1));
  11987. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11988. $recv((function(){
  11989. return $core.withContext(function($ctx2) {
  11990. return $recv(start).__lt_eq(sz);
  11991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11992. }))._whileTrue_((function(){
  11993. return $core.withContext(function($ctx2) {
  11994. $2=$recv(nextLF).__eq((0));
  11995. $ctx2.sendIdx["="]=1;
  11996. $1=$recv($2)._and_((function(){
  11997. return $core.withContext(function($ctx3) {
  11998. return $recv(nextCR).__eq((0));
  11999. $ctx3.sendIdx["="]=2;
  12000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12001. }));
  12002. $ctx2.sendIdx["and:"]=1;
  12003. if($core.assert($1)){
  12004. $recv(aBlock)._value_value_value_(start,sz,sz);
  12005. $ctx2.sendIdx["value:value:value:"]=1;
  12006. throw $early=[self];
  12007. }
  12008. $4=$recv(nextCR).__eq((0));
  12009. $ctx2.sendIdx["="]=3;
  12010. $3=$recv($4)._or_((function(){
  12011. return $core.withContext(function($ctx3) {
  12012. $5=(0).__lt(nextLF);
  12013. $ctx3.sendIdx["<"]=1;
  12014. return $recv($5)._and_((function(){
  12015. return $core.withContext(function($ctx4) {
  12016. return $recv(nextLF).__lt(nextCR);
  12017. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12018. }));
  12019. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12020. }));
  12021. if($core.assert($3)){
  12022. $6=start;
  12023. $7=$recv(nextLF).__minus((1));
  12024. $ctx2.sendIdx["-"]=1;
  12025. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12026. $ctx2.sendIdx["value:value:value:"]=2;
  12027. start=(1).__plus(nextLF);
  12028. $ctx2.sendIdx["+"]=1;
  12029. nextLF=$self._indexOf_startingAt_(lf,start);
  12030. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12031. return nextLF;
  12032. } else {
  12033. $9=(1).__plus(nextCR);
  12034. $ctx2.sendIdx["+"]=2;
  12035. $8=$recv($9).__eq(nextLF);
  12036. if($core.assert($8)){
  12037. $10=start;
  12038. $11=$recv(nextCR).__minus((1));
  12039. $ctx2.sendIdx["-"]=2;
  12040. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12041. $ctx2.sendIdx["value:value:value:"]=3;
  12042. start=(1).__plus(nextLF);
  12043. $ctx2.sendIdx["+"]=3;
  12044. nextCR=$self._indexOf_startingAt_(cr,start);
  12045. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12046. nextLF=$self._indexOf_startingAt_(lf,start);
  12047. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12048. return nextLF;
  12049. } else {
  12050. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12051. start=(1).__plus(nextCR);
  12052. nextCR=$self._indexOf_startingAt_(cr,start);
  12053. return nextCR;
  12054. }
  12055. }
  12056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12057. }));
  12058. return self;
  12059. }
  12060. catch(e) {if(e===$early)return e[0]; throw e}
  12061. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  12062. },
  12063. args: ["aBlock"],
  12064. 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 ] ]]",
  12065. referencedClasses: ["String"],
  12066. pragmas: [],
  12067. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12068. }),
  12069. $globals.String);
  12070. $core.addMethod(
  12071. $core.method({
  12072. selector: "lineNumber:",
  12073. protocol: "split join",
  12074. fn: function (anIndex){
  12075. var self=this,$self=this;
  12076. var lineCount;
  12077. return $core.withContext(function($ctx1) {
  12078. var $2,$1;
  12079. var $early={};
  12080. try {
  12081. lineCount=(0);
  12082. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12083. return $core.withContext(function($ctx2) {
  12084. lineCount=$recv(lineCount).__plus((1));
  12085. $2=lineCount;
  12086. $1=$recv($2).__eq(anIndex);
  12087. if($core.assert($1)){
  12088. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12089. }
  12090. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12091. }));
  12092. return nil;
  12093. }
  12094. catch(e) {if(e===$early)return e[0]; throw e}
  12095. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  12096. },
  12097. args: ["anIndex"],
  12098. 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",
  12099. referencedClasses: [],
  12100. pragmas: [],
  12101. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12102. }),
  12103. $globals.String);
  12104. $core.addMethod(
  12105. $core.method({
  12106. selector: "lines",
  12107. protocol: "split join",
  12108. fn: function (){
  12109. var self=this,$self=this;
  12110. return $core.withContext(function($ctx1) {
  12111. var result = self.split(/\r\n|\r|\n/);
  12112. if (!result[result.length-1]) result.pop();
  12113. return result;;
  12114. return self;
  12115. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  12116. },
  12117. args: [],
  12118. 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'>",
  12119. referencedClasses: [],
  12120. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  12121. messageSends: []
  12122. }),
  12123. $globals.String);
  12124. $core.addMethod(
  12125. $core.method({
  12126. selector: "linesDo:",
  12127. protocol: "split join",
  12128. fn: function (aBlock){
  12129. var self=this,$self=this;
  12130. return $core.withContext(function($ctx1) {
  12131. $recv($self._lines())._do_(aBlock);
  12132. return self;
  12133. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  12134. },
  12135. args: ["aBlock"],
  12136. 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",
  12137. referencedClasses: [],
  12138. pragmas: [],
  12139. messageSends: ["do:", "lines"]
  12140. }),
  12141. $globals.String);
  12142. $core.addMethod(
  12143. $core.method({
  12144. selector: "match:",
  12145. protocol: "regular expressions",
  12146. fn: function (aRegexp){
  12147. var self=this,$self=this;
  12148. return $core.withContext(function($ctx1) {
  12149. return self.search(aRegexp) != -1;
  12150. return self;
  12151. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  12152. },
  12153. args: ["aRegexp"],
  12154. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12155. referencedClasses: [],
  12156. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  12157. messageSends: []
  12158. }),
  12159. $globals.String);
  12160. $core.addMethod(
  12161. $core.method({
  12162. selector: "matchesOf:",
  12163. protocol: "regular expressions",
  12164. fn: function (aRegularExpression){
  12165. var self=this,$self=this;
  12166. return $core.withContext(function($ctx1) {
  12167. return self.match(aRegularExpression);
  12168. return self;
  12169. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  12170. },
  12171. args: ["aRegularExpression"],
  12172. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12173. referencedClasses: [],
  12174. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  12175. messageSends: []
  12176. }),
  12177. $globals.String);
  12178. $core.addMethod(
  12179. $core.method({
  12180. selector: "printNl",
  12181. protocol: "printing",
  12182. fn: function (){
  12183. var self=this,$self=this;
  12184. return $core.withContext(function($ctx1) {
  12185. console.log(self);
  12186. return self;
  12187. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  12188. },
  12189. args: [],
  12190. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12191. referencedClasses: [],
  12192. pragmas: [["inlineJS:", ["console.log(self)"]]],
  12193. messageSends: []
  12194. }),
  12195. $globals.String);
  12196. $core.addMethod(
  12197. $core.method({
  12198. selector: "printOn:",
  12199. protocol: "printing",
  12200. fn: function (aStream){
  12201. var self=this,$self=this;
  12202. return $core.withContext(function($ctx1) {
  12203. $recv(aStream)._nextPutAll_("'");
  12204. $ctx1.sendIdx["nextPutAll:"]=1;
  12205. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12206. $ctx1.sendIdx["nextPutAll:"]=2;
  12207. $recv(aStream)._nextPutAll_("'");
  12208. return self;
  12209. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  12210. },
  12211. args: ["aStream"],
  12212. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12213. referencedClasses: [],
  12214. pragmas: [],
  12215. messageSends: ["nextPutAll:", "replace:with:"]
  12216. }),
  12217. $globals.String);
  12218. $core.addMethod(
  12219. $core.method({
  12220. selector: "putOn:",
  12221. protocol: "streaming",
  12222. fn: function (aStream){
  12223. var self=this,$self=this;
  12224. return $core.withContext(function($ctx1) {
  12225. $recv(aStream)._nextPutString_(self);
  12226. return self;
  12227. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  12228. },
  12229. args: ["aStream"],
  12230. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  12231. referencedClasses: [],
  12232. pragmas: [],
  12233. messageSends: ["nextPutString:"]
  12234. }),
  12235. $globals.String);
  12236. $core.addMethod(
  12237. $core.method({
  12238. selector: "remove:",
  12239. protocol: "adding/removing",
  12240. fn: function (anObject){
  12241. var self=this,$self=this;
  12242. return $core.withContext(function($ctx1) {
  12243. $self._errorReadOnly();
  12244. return self;
  12245. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  12246. },
  12247. args: ["anObject"],
  12248. source: "remove: anObject\x0a\x09self errorReadOnly",
  12249. referencedClasses: [],
  12250. pragmas: [],
  12251. messageSends: ["errorReadOnly"]
  12252. }),
  12253. $globals.String);
  12254. $core.addMethod(
  12255. $core.method({
  12256. selector: "remove:ifAbsent:",
  12257. protocol: "adding/removing",
  12258. fn: function (anObject,aBlock){
  12259. var self=this,$self=this;
  12260. return $core.withContext(function($ctx1) {
  12261. $self._errorReadOnly();
  12262. return self;
  12263. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  12264. },
  12265. args: ["anObject", "aBlock"],
  12266. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  12267. referencedClasses: [],
  12268. pragmas: [],
  12269. messageSends: ["errorReadOnly"]
  12270. }),
  12271. $globals.String);
  12272. $core.addMethod(
  12273. $core.method({
  12274. selector: "replace:with:",
  12275. protocol: "regular expressions",
  12276. fn: function (aString,anotherString){
  12277. var self=this,$self=this;
  12278. return $core.withContext(function($ctx1) {
  12279. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12280. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  12281. },
  12282. args: ["aString", "anotherString"],
  12283. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12284. referencedClasses: ["RegularExpression"],
  12285. pragmas: [],
  12286. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12287. }),
  12288. $globals.String);
  12289. $core.addMethod(
  12290. $core.method({
  12291. selector: "replaceRegexp:with:",
  12292. protocol: "regular expressions",
  12293. fn: function (aRegexp,aString){
  12294. var self=this,$self=this;
  12295. return $core.withContext(function($ctx1) {
  12296. return self.replace(aRegexp, aString);
  12297. return self;
  12298. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  12299. },
  12300. args: ["aRegexp", "aString"],
  12301. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12302. referencedClasses: [],
  12303. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  12304. messageSends: []
  12305. }),
  12306. $globals.String);
  12307. $core.addMethod(
  12308. $core.method({
  12309. selector: "reversed",
  12310. protocol: "converting",
  12311. fn: function (){
  12312. var self=this,$self=this;
  12313. return $core.withContext(function($ctx1) {
  12314. return self.split("").reverse().join("");
  12315. return self;
  12316. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  12317. },
  12318. args: [],
  12319. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12320. referencedClasses: [],
  12321. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  12322. messageSends: []
  12323. }),
  12324. $globals.String);
  12325. $core.addMethod(
  12326. $core.method({
  12327. selector: "shallowCopy",
  12328. protocol: "copying",
  12329. fn: function (){
  12330. var self=this,$self=this;
  12331. return self;
  12332. },
  12333. args: [],
  12334. source: "shallowCopy\x0a\x09^ self",
  12335. referencedClasses: [],
  12336. pragmas: [],
  12337. messageSends: []
  12338. }),
  12339. $globals.String);
  12340. $core.addMethod(
  12341. $core.method({
  12342. selector: "subStrings:",
  12343. protocol: "split join",
  12344. fn: function (aString){
  12345. var self=this,$self=this;
  12346. return $core.withContext(function($ctx1) {
  12347. return $self._tokenize_(aString);
  12348. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  12349. },
  12350. args: ["aString"],
  12351. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12352. referencedClasses: [],
  12353. pragmas: [],
  12354. messageSends: ["tokenize:"]
  12355. }),
  12356. $globals.String);
  12357. $core.addMethod(
  12358. $core.method({
  12359. selector: "symbolPrintString",
  12360. protocol: "printing",
  12361. fn: function (){
  12362. var self=this,$self=this;
  12363. return $core.withContext(function($ctx1) {
  12364. return $recv($globals.String)._streamContents_((function(str){
  12365. return $core.withContext(function($ctx2) {
  12366. return $self._asSymbolPrintOn_(str);
  12367. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  12368. }));
  12369. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  12370. },
  12371. args: [],
  12372. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  12373. referencedClasses: ["String"],
  12374. pragmas: [],
  12375. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  12376. }),
  12377. $globals.String);
  12378. $core.addMethod(
  12379. $core.method({
  12380. selector: "tokenize:",
  12381. protocol: "split join",
  12382. fn: function (aString){
  12383. var self=this,$self=this;
  12384. return $core.withContext(function($ctx1) {
  12385. return self.split(aString);
  12386. return self;
  12387. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  12388. },
  12389. args: ["aString"],
  12390. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12391. referencedClasses: [],
  12392. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  12393. messageSends: []
  12394. }),
  12395. $globals.String);
  12396. $core.addMethod(
  12397. $core.method({
  12398. selector: "trimBoth",
  12399. protocol: "regular expressions",
  12400. fn: function (){
  12401. var self=this,$self=this;
  12402. return $core.withContext(function($ctx1) {
  12403. return $self._trimBoth_("\x5cs");
  12404. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  12405. },
  12406. args: [],
  12407. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12408. referencedClasses: [],
  12409. pragmas: [],
  12410. messageSends: ["trimBoth:"]
  12411. }),
  12412. $globals.String);
  12413. $core.addMethod(
  12414. $core.method({
  12415. selector: "trimBoth:",
  12416. protocol: "regular expressions",
  12417. fn: function (separators){
  12418. var self=this,$self=this;
  12419. return $core.withContext(function($ctx1) {
  12420. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12421. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  12422. },
  12423. args: ["separators"],
  12424. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12425. referencedClasses: [],
  12426. pragmas: [],
  12427. messageSends: ["trimRight:", "trimLeft:"]
  12428. }),
  12429. $globals.String);
  12430. $core.addMethod(
  12431. $core.method({
  12432. selector: "trimLeft",
  12433. protocol: "regular expressions",
  12434. fn: function (){
  12435. var self=this,$self=this;
  12436. return $core.withContext(function($ctx1) {
  12437. return $self._trimLeft_("\x5cs");
  12438. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  12439. },
  12440. args: [],
  12441. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12442. referencedClasses: [],
  12443. pragmas: [],
  12444. messageSends: ["trimLeft:"]
  12445. }),
  12446. $globals.String);
  12447. $core.addMethod(
  12448. $core.method({
  12449. selector: "trimLeft:",
  12450. protocol: "regular expressions",
  12451. fn: function (separators){
  12452. var self=this,$self=this;
  12453. return $core.withContext(function($ctx1) {
  12454. var $2,$1;
  12455. $2=$recv("^[".__comma(separators)).__comma("]+");
  12456. $ctx1.sendIdx[","]=1;
  12457. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12458. return $self._replaceRegexp_with_($1,"");
  12459. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  12460. },
  12461. args: ["separators"],
  12462. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12463. referencedClasses: ["RegularExpression"],
  12464. pragmas: [],
  12465. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12466. }),
  12467. $globals.String);
  12468. $core.addMethod(
  12469. $core.method({
  12470. selector: "trimRight",
  12471. protocol: "regular expressions",
  12472. fn: function (){
  12473. var self=this,$self=this;
  12474. return $core.withContext(function($ctx1) {
  12475. return $self._trimRight_("\x5cs");
  12476. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  12477. },
  12478. args: [],
  12479. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12480. referencedClasses: [],
  12481. pragmas: [],
  12482. messageSends: ["trimRight:"]
  12483. }),
  12484. $globals.String);
  12485. $core.addMethod(
  12486. $core.method({
  12487. selector: "trimRight:",
  12488. protocol: "regular expressions",
  12489. fn: function (separators){
  12490. var self=this,$self=this;
  12491. return $core.withContext(function($ctx1) {
  12492. var $2,$1;
  12493. $2=$recv("[".__comma(separators)).__comma("]+$");
  12494. $ctx1.sendIdx[","]=1;
  12495. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12496. return $self._replaceRegexp_with_($1,"");
  12497. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  12498. },
  12499. args: ["separators"],
  12500. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12501. referencedClasses: ["RegularExpression"],
  12502. pragmas: [],
  12503. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12504. }),
  12505. $globals.String);
  12506. $core.addMethod(
  12507. $core.method({
  12508. selector: "unescaped",
  12509. protocol: "converting",
  12510. fn: function (){
  12511. var self=this,$self=this;
  12512. return $core.withContext(function($ctx1) {
  12513. return unescape(self);
  12514. return self;
  12515. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  12516. },
  12517. args: [],
  12518. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12519. referencedClasses: [],
  12520. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  12521. messageSends: []
  12522. }),
  12523. $globals.String);
  12524. $core.addMethod(
  12525. $core.method({
  12526. selector: "uriComponentDecoded",
  12527. protocol: "converting",
  12528. fn: function (){
  12529. var self=this,$self=this;
  12530. return $core.withContext(function($ctx1) {
  12531. return decodeURIComponent(self);
  12532. return self;
  12533. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  12534. },
  12535. args: [],
  12536. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12537. referencedClasses: [],
  12538. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  12539. messageSends: []
  12540. }),
  12541. $globals.String);
  12542. $core.addMethod(
  12543. $core.method({
  12544. selector: "uriComponentEncoded",
  12545. protocol: "converting",
  12546. fn: function (){
  12547. var self=this,$self=this;
  12548. return $core.withContext(function($ctx1) {
  12549. return encodeURIComponent(self);
  12550. return self;
  12551. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  12552. },
  12553. args: [],
  12554. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12555. referencedClasses: [],
  12556. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  12557. messageSends: []
  12558. }),
  12559. $globals.String);
  12560. $core.addMethod(
  12561. $core.method({
  12562. selector: "uriDecoded",
  12563. protocol: "converting",
  12564. fn: function (){
  12565. var self=this,$self=this;
  12566. return $core.withContext(function($ctx1) {
  12567. return decodeURI(self);
  12568. return self;
  12569. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  12570. },
  12571. args: [],
  12572. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12573. referencedClasses: [],
  12574. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  12575. messageSends: []
  12576. }),
  12577. $globals.String);
  12578. $core.addMethod(
  12579. $core.method({
  12580. selector: "uriEncoded",
  12581. protocol: "converting",
  12582. fn: function (){
  12583. var self=this,$self=this;
  12584. return $core.withContext(function($ctx1) {
  12585. return encodeURI(self);
  12586. return self;
  12587. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  12588. },
  12589. args: [],
  12590. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12591. referencedClasses: [],
  12592. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  12593. messageSends: []
  12594. }),
  12595. $globals.String);
  12596. $core.addMethod(
  12597. $core.method({
  12598. selector: "value:",
  12599. protocol: "evaluating",
  12600. fn: function (anObject){
  12601. var self=this,$self=this;
  12602. return $core.withContext(function($ctx1) {
  12603. return $recv(anObject)._perform_(self);
  12604. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  12605. },
  12606. args: ["anObject"],
  12607. source: "value: anObject \x0a\x09^ anObject perform: self",
  12608. referencedClasses: [],
  12609. pragmas: [],
  12610. messageSends: ["perform:"]
  12611. }),
  12612. $globals.String);
  12613. $core.addMethod(
  12614. $core.method({
  12615. selector: "cr",
  12616. protocol: "accessing",
  12617. fn: function (){
  12618. var self=this,$self=this;
  12619. return $core.withContext(function($ctx1) {
  12620. return "\r";
  12621. return self;
  12622. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  12623. },
  12624. args: [],
  12625. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12626. referencedClasses: [],
  12627. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  12628. messageSends: []
  12629. }),
  12630. $globals.String.a$cls);
  12631. $core.addMethod(
  12632. $core.method({
  12633. selector: "crlf",
  12634. protocol: "accessing",
  12635. fn: function (){
  12636. var self=this,$self=this;
  12637. return $core.withContext(function($ctx1) {
  12638. return "\r\n";
  12639. return self;
  12640. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  12641. },
  12642. args: [],
  12643. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12644. referencedClasses: [],
  12645. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  12646. messageSends: []
  12647. }),
  12648. $globals.String.a$cls);
  12649. $core.addMethod(
  12650. $core.method({
  12651. selector: "esc",
  12652. protocol: "accessing",
  12653. fn: function (){
  12654. var self=this,$self=this;
  12655. return $core.withContext(function($ctx1) {
  12656. return $self._fromCharCode_((27));
  12657. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  12658. },
  12659. args: [],
  12660. source: "esc\x0a\x09^ self fromCharCode: 27",
  12661. referencedClasses: [],
  12662. pragmas: [],
  12663. messageSends: ["fromCharCode:"]
  12664. }),
  12665. $globals.String.a$cls);
  12666. $core.addMethod(
  12667. $core.method({
  12668. selector: "fromCharCode:",
  12669. protocol: "instance creation",
  12670. fn: function (anInteger){
  12671. var self=this,$self=this;
  12672. return $core.withContext(function($ctx1) {
  12673. return String.fromCharCode(anInteger);
  12674. return self;
  12675. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  12676. },
  12677. args: ["anInteger"],
  12678. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12679. referencedClasses: [],
  12680. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  12681. messageSends: []
  12682. }),
  12683. $globals.String.a$cls);
  12684. $core.addMethod(
  12685. $core.method({
  12686. selector: "fromString:",
  12687. protocol: "instance creation",
  12688. fn: function (aString){
  12689. var self=this,$self=this;
  12690. return $core.withContext(function($ctx1) {
  12691. return String(aString);
  12692. return self;
  12693. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  12694. },
  12695. args: ["aString"],
  12696. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12697. referencedClasses: [],
  12698. pragmas: [["inlineJS:", ["return String(aString)"]]],
  12699. messageSends: []
  12700. }),
  12701. $globals.String.a$cls);
  12702. $core.addMethod(
  12703. $core.method({
  12704. selector: "lf",
  12705. protocol: "accessing",
  12706. fn: function (){
  12707. var self=this,$self=this;
  12708. return $core.withContext(function($ctx1) {
  12709. return "\n";
  12710. return self;
  12711. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  12712. },
  12713. args: [],
  12714. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12715. referencedClasses: [],
  12716. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  12717. messageSends: []
  12718. }),
  12719. $globals.String.a$cls);
  12720. $core.addMethod(
  12721. $core.method({
  12722. selector: "random",
  12723. protocol: "random",
  12724. fn: function (){
  12725. var self=this,$self=this;
  12726. return $core.withContext(function($ctx1) {
  12727. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12728. return self;
  12729. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  12730. },
  12731. args: [],
  12732. 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);'>",
  12733. referencedClasses: [],
  12734. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  12735. messageSends: []
  12736. }),
  12737. $globals.String.a$cls);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "randomNotIn:",
  12741. protocol: "random",
  12742. fn: function (aString){
  12743. var self=this,$self=this;
  12744. var result;
  12745. return $core.withContext(function($ctx1) {
  12746. $recv((function(){
  12747. return $core.withContext(function($ctx2) {
  12748. result=$self._random();
  12749. return $recv(aString)._includesSubString_(result);
  12750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12751. }))._whileTrue();
  12752. return result;
  12753. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  12754. },
  12755. args: ["aString"],
  12756. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12757. referencedClasses: [],
  12758. pragmas: [],
  12759. messageSends: ["whileTrue", "random", "includesSubString:"]
  12760. }),
  12761. $globals.String.a$cls);
  12762. $core.addMethod(
  12763. $core.method({
  12764. selector: "space",
  12765. protocol: "accessing",
  12766. fn: function (){
  12767. var self=this,$self=this;
  12768. return $core.withContext(function($ctx1) {
  12769. return " ";
  12770. return self;
  12771. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  12772. },
  12773. args: [],
  12774. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12775. referencedClasses: [],
  12776. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  12777. messageSends: []
  12778. }),
  12779. $globals.String.a$cls);
  12780. $core.addMethod(
  12781. $core.method({
  12782. selector: "streamClass",
  12783. protocol: "accessing",
  12784. fn: function (){
  12785. var self=this,$self=this;
  12786. return $globals.StringStream;
  12787. },
  12788. args: [],
  12789. source: "streamClass\x0a\x09\x09^ StringStream",
  12790. referencedClasses: ["StringStream"],
  12791. pragmas: [],
  12792. messageSends: []
  12793. }),
  12794. $globals.String.a$cls);
  12795. $core.addMethod(
  12796. $core.method({
  12797. selector: "tab",
  12798. protocol: "accessing",
  12799. fn: function (){
  12800. var self=this,$self=this;
  12801. return $core.withContext(function($ctx1) {
  12802. return "\t";
  12803. return self;
  12804. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  12805. },
  12806. args: [],
  12807. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12808. referencedClasses: [],
  12809. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  12810. messageSends: []
  12811. }),
  12812. $globals.String.a$cls);
  12813. $core.addMethod(
  12814. $core.method({
  12815. selector: "value:",
  12816. protocol: "instance creation",
  12817. fn: function (aUTFCharCode){
  12818. var self=this,$self=this;
  12819. return $core.withContext(function($ctx1) {
  12820. return String.fromCharCode(aUTFCharCode);;
  12821. return self;
  12822. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  12823. },
  12824. args: ["aUTFCharCode"],
  12825. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12826. referencedClasses: [],
  12827. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  12828. messageSends: []
  12829. }),
  12830. $globals.String.a$cls);
  12831. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12832. $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`.";
  12833. $core.addMethod(
  12834. $core.method({
  12835. selector: "=",
  12836. protocol: "comparing",
  12837. fn: function (aCollection){
  12838. var self=this,$self=this;
  12839. return $core.withContext(function($ctx1) {
  12840. var $2,$1,$4,$3,$5;
  12841. var $early={};
  12842. try {
  12843. $2=$self._class();
  12844. $ctx1.sendIdx["class"]=1;
  12845. $1=$recv($2).__eq($recv(aCollection)._class());
  12846. $ctx1.sendIdx["="]=1;
  12847. if(!$core.assert($1)){
  12848. return false;
  12849. }
  12850. $4=$self._size();
  12851. $ctx1.sendIdx["size"]=1;
  12852. $3=$recv($4).__eq($recv(aCollection)._size());
  12853. if(!$core.assert($3)){
  12854. return false;
  12855. }
  12856. $self._do_((function(each){
  12857. return $core.withContext(function($ctx2) {
  12858. $5=$recv(aCollection)._includes_(each);
  12859. if(!$core.assert($5)){
  12860. throw $early=[false];
  12861. }
  12862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12863. }));
  12864. return true;
  12865. }
  12866. catch(e) {if(e===$early)return e[0]; throw e}
  12867. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  12868. },
  12869. args: ["aCollection"],
  12870. 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",
  12871. referencedClasses: [],
  12872. pragmas: [],
  12873. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12874. }),
  12875. $globals.Set);
  12876. $core.addMethod(
  12877. $core.method({
  12878. selector: "add:",
  12879. protocol: "adding/removing",
  12880. fn: function (anObject){
  12881. var self=this,$self=this;
  12882. var bucket;
  12883. return $core.withContext(function($ctx1) {
  12884. var $1,$receiver;
  12885. bucket=$self._bucketsOfElement_(anObject);
  12886. $1=$recv(bucket)._second();
  12887. if(($receiver = $1) == null || $receiver.a$nil){
  12888. var object,slowBucket;
  12889. object=$recv(bucket)._first();
  12890. $ctx1.sendIdx["first"]=1;
  12891. slowBucket=$recv(bucket)._third();
  12892. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12893. return $core.withContext(function($ctx2) {
  12894. $recv(slowBucket)._add_(object);
  12895. $self.size=$recv($self.size).__plus((1));
  12896. return $self.size;
  12897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12898. }));
  12899. return object;
  12900. } else {
  12901. var primitiveBucket;
  12902. primitiveBucket=$receiver;
  12903. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12904. }
  12905. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  12906. },
  12907. args: ["anObject"],
  12908. 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 ]",
  12909. referencedClasses: [],
  12910. pragmas: [],
  12911. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12912. }),
  12913. $globals.Set);
  12914. $core.addMethod(
  12915. $core.method({
  12916. selector: "add:in:",
  12917. protocol: "private",
  12918. fn: function (anObject,anotherObject){
  12919. var self=this,$self=this;
  12920. return $core.withContext(function($ctx1) {
  12921. if (anObject in anotherObject.store) { return anObject; }
  12922. $self.size++;
  12923. anotherObject.store[anObject] = true;
  12924. return anObject;
  12925. ;
  12926. return self;
  12927. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  12928. },
  12929. args: ["anObject", "anotherObject"],
  12930. 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'>",
  12931. referencedClasses: [],
  12932. pragmas: [["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"]]],
  12933. messageSends: []
  12934. }),
  12935. $globals.Set);
  12936. $core.addMethod(
  12937. $core.method({
  12938. selector: "bucketsOfElement:",
  12939. protocol: "private",
  12940. fn: function (anObject){
  12941. var self=this,$self=this;
  12942. return $core.withContext(function($ctx1) {
  12943. // include nil to well-known objects under "boolean" fastBucket
  12944. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  12945. var prim = anObject.valueOf();
  12946. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  12947. var bucket = null;
  12948. $self.slowBucketStores.some(function (store) {
  12949. return bucket = store._bucketOfElement_(anObject);
  12950. });
  12951. return [ anObject, null, bucket || $self.defaultBucket ];
  12952. }
  12953. return [ prim, $self.fastBuckets[typeof prim] ];
  12954. ;
  12955. return self;
  12956. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  12957. },
  12958. args: ["anObject"],
  12959. 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'>",
  12960. referencedClasses: [],
  12961. pragmas: [["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"]]],
  12962. messageSends: []
  12963. }),
  12964. $globals.Set);
  12965. $core.addMethod(
  12966. $core.method({
  12967. selector: "classNameOf:",
  12968. protocol: "private",
  12969. fn: function (anObject){
  12970. var self=this,$self=this;
  12971. return $core.withContext(function($ctx1) {
  12972. return anObject.a$cls != null && anObject.a$cls.name;
  12973. return self;
  12974. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  12975. },
  12976. args: ["anObject"],
  12977. 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'>",
  12978. referencedClasses: [],
  12979. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  12980. messageSends: []
  12981. }),
  12982. $globals.Set);
  12983. $core.addMethod(
  12984. $core.method({
  12985. selector: "collect:",
  12986. protocol: "enumerating",
  12987. fn: function (aBlock){
  12988. var self=this,$self=this;
  12989. var collection;
  12990. return $core.withContext(function($ctx1) {
  12991. collection=$recv($self._class())._new();
  12992. $self._do_((function(each){
  12993. return $core.withContext(function($ctx2) {
  12994. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12995. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12996. }));
  12997. return collection;
  12998. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  12999. },
  13000. args: ["aBlock"],
  13001. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  13002. referencedClasses: [],
  13003. pragmas: [],
  13004. messageSends: ["new", "class", "do:", "add:", "value:"]
  13005. }),
  13006. $globals.Set);
  13007. $core.addMethod(
  13008. $core.method({
  13009. selector: "do:",
  13010. protocol: "enumerating",
  13011. fn: function (aBlock){
  13012. var self=this,$self=this;
  13013. return $core.withContext(function($ctx1) {
  13014. var el, keys, i;
  13015. el = $self.fastBuckets;
  13016. keys = Object.keys(el);
  13017. for (i = 0; i < keys.length; ++i) {
  13018. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  13019. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  13020. else { store._do_(aBlock); }
  13021. }
  13022. el = $self.slowBucketStores;
  13023. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  13024. $self.defaultBucket._do_(aBlock);
  13025. ;
  13026. return self;
  13027. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  13028. },
  13029. args: ["aBlock"],
  13030. 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'>",
  13031. referencedClasses: [],
  13032. pragmas: [["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"]]],
  13033. messageSends: []
  13034. }),
  13035. $globals.Set);
  13036. $core.addMethod(
  13037. $core.method({
  13038. selector: "includes:",
  13039. protocol: "testing",
  13040. fn: function (anObject){
  13041. var self=this,$self=this;
  13042. var bucket;
  13043. return $core.withContext(function($ctx1) {
  13044. var $1,$2,$3,$receiver;
  13045. bucket=$self._bucketsOfElement_(anObject);
  13046. $1=$recv(bucket)._second();
  13047. if(($receiver = $1) == null || $receiver.a$nil){
  13048. $2=$recv(bucket)._third();
  13049. $3=$recv(bucket)._first();
  13050. $ctx1.sendIdx["first"]=1;
  13051. return $recv($2)._includes_($3);
  13052. } else {
  13053. var primitiveBucket;
  13054. primitiveBucket=$receiver;
  13055. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13056. }
  13057. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  13058. },
  13059. args: ["anObject"],
  13060. 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 ]",
  13061. referencedClasses: [],
  13062. pragmas: [],
  13063. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13064. }),
  13065. $globals.Set);
  13066. $core.addMethod(
  13067. $core.method({
  13068. selector: "includes:in:",
  13069. protocol: "private",
  13070. fn: function (anObject,anotherObject){
  13071. var self=this,$self=this;
  13072. return $core.withContext(function($ctx1) {
  13073. return anObject in anotherObject.store;
  13074. return self;
  13075. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  13076. },
  13077. args: ["anObject", "anotherObject"],
  13078. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13079. referencedClasses: [],
  13080. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  13081. messageSends: []
  13082. }),
  13083. $globals.Set);
  13084. $core.addMethod(
  13085. $core.method({
  13086. selector: "initialize",
  13087. protocol: "initialization",
  13088. fn: function (){
  13089. var self=this,$self=this;
  13090. return $core.withContext(function($ctx1) {
  13091. (
  13092. $ctx1.supercall = true,
  13093. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13094. $ctx1.supercall = false;
  13095. $self.defaultBucket=[];
  13096. $self._initializeSlowBucketStores();
  13097. $self._removeAll();
  13098. return self;
  13099. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  13100. },
  13101. args: [],
  13102. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13103. referencedClasses: [],
  13104. pragmas: [],
  13105. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13106. }),
  13107. $globals.Set);
  13108. $core.addMethod(
  13109. $core.method({
  13110. selector: "initializeSlowBucketStores",
  13111. protocol: "initialization",
  13112. fn: function (){
  13113. var self=this,$self=this;
  13114. return $core.withContext(function($ctx1) {
  13115. var $1;
  13116. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13117. return $core.withContext(function($ctx2) {
  13118. return $self._classNameOf_(x);
  13119. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13120. }));
  13121. $ctx1.sendIdx["hashBlock:"]=1;
  13122. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13123. return $core.withContext(function($ctx2) {
  13124. return $self._jsConstructorNameOf_(x);
  13125. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13126. }))];
  13127. return self;
  13128. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  13129. },
  13130. args: [],
  13131. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13132. referencedClasses: ["ArrayBucketStore"],
  13133. pragmas: [],
  13134. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13135. }),
  13136. $globals.Set);
  13137. $core.addMethod(
  13138. $core.method({
  13139. selector: "jsConstructorNameOf:",
  13140. protocol: "private",
  13141. fn: function (anObject){
  13142. var self=this,$self=this;
  13143. return $core.withContext(function($ctx1) {
  13144. return anObject.constructor && anObject.constructor.name;
  13145. return self;
  13146. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  13147. },
  13148. args: ["anObject"],
  13149. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13150. referencedClasses: [],
  13151. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  13152. messageSends: []
  13153. }),
  13154. $globals.Set);
  13155. $core.addMethod(
  13156. $core.method({
  13157. selector: "printOn:",
  13158. protocol: "printing",
  13159. fn: function (aStream){
  13160. var self=this,$self=this;
  13161. return $core.withContext(function($ctx1) {
  13162. (
  13163. $ctx1.supercall = true,
  13164. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13165. $ctx1.supercall = false;
  13166. $ctx1.sendIdx["printOn:"]=1;
  13167. $recv(aStream)._nextPutAll_(" (");
  13168. $ctx1.sendIdx["nextPutAll:"]=1;
  13169. $self._do_separatedBy_((function(each){
  13170. return $core.withContext(function($ctx2) {
  13171. return $recv(each)._printOn_(aStream);
  13172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13173. }),(function(){
  13174. return $core.withContext(function($ctx2) {
  13175. return $recv(aStream)._nextPutAll_(" ");
  13176. $ctx2.sendIdx["nextPutAll:"]=2;
  13177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13178. }));
  13179. $recv(aStream)._nextPutAll_(")");
  13180. return self;
  13181. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  13182. },
  13183. args: ["aStream"],
  13184. 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: ')'",
  13185. referencedClasses: [],
  13186. pragmas: [],
  13187. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13188. }),
  13189. $globals.Set);
  13190. $core.addMethod(
  13191. $core.method({
  13192. selector: "remove:ifAbsent:",
  13193. protocol: "adding/removing",
  13194. fn: function (anObject,aBlock){
  13195. var self=this,$self=this;
  13196. var bucket;
  13197. return $core.withContext(function($ctx1) {
  13198. var $1,$2,$3,$receiver;
  13199. var $early={};
  13200. try {
  13201. bucket=$self._bucketsOfElement_(anObject);
  13202. $1=$recv(bucket)._second();
  13203. if(($receiver = $1) == null || $receiver.a$nil){
  13204. $2=$recv(bucket)._third();
  13205. $3=$recv(bucket)._first();
  13206. $ctx1.sendIdx["first"]=1;
  13207. $recv($2)._remove_ifAbsent_($3,(function(){
  13208. return $core.withContext(function($ctx2) {
  13209. throw $early=[$recv(aBlock)._value()];
  13210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13211. }));
  13212. $self.size=$recv($self.size).__minus((1));
  13213. return $self.size;
  13214. } else {
  13215. var primitiveBucket;
  13216. primitiveBucket=$receiver;
  13217. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  13218. }
  13219. }
  13220. catch(e) {if(e===$early)return e[0]; throw e}
  13221. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  13222. },
  13223. args: ["anObject", "aBlock"],
  13224. 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 ]",
  13225. referencedClasses: [],
  13226. pragmas: [],
  13227. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  13228. }),
  13229. $globals.Set);
  13230. $core.addMethod(
  13231. $core.method({
  13232. selector: "remove:in:ifAbsent:",
  13233. protocol: "private",
  13234. fn: function (anObject,anotherObject,aBlock){
  13235. var self=this,$self=this;
  13236. return $core.withContext(function($ctx1) {
  13237. if (anObject in anotherObject.store) {
  13238. delete anotherObject.store[anObject];
  13239. $self.size--;
  13240. return anObject;
  13241. } else {
  13242. return aBlock._value();
  13243. };
  13244. return self;
  13245. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  13246. },
  13247. args: ["anObject", "anotherObject", "aBlock"],
  13248. 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}'>",
  13249. referencedClasses: [],
  13250. pragmas: [["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}"]]],
  13251. messageSends: []
  13252. }),
  13253. $globals.Set);
  13254. $core.addMethod(
  13255. $core.method({
  13256. selector: "removeAll",
  13257. protocol: "adding/removing",
  13258. fn: function (){
  13259. var self=this,$self=this;
  13260. return $core.withContext(function($ctx1) {
  13261. $self.fastBuckets = {
  13262. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13263. "number": { store: Object.create(null), fn: Number },
  13264. "string": { store: Object.create(null) }
  13265. };
  13266. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  13267. $self.defaultBucket._removeAll();
  13268. $self.size = 0;
  13269. ;
  13270. return self;
  13271. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  13272. },
  13273. args: [],
  13274. 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'>",
  13275. referencedClasses: [],
  13276. pragmas: [["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"]]],
  13277. messageSends: []
  13278. }),
  13279. $globals.Set);
  13280. $core.addMethod(
  13281. $core.method({
  13282. selector: "select:",
  13283. protocol: "enumerating",
  13284. fn: function (aBlock){
  13285. var self=this,$self=this;
  13286. var collection;
  13287. return $core.withContext(function($ctx1) {
  13288. var $1;
  13289. collection=$recv($self._class())._new();
  13290. $self._do_((function(each){
  13291. return $core.withContext(function($ctx2) {
  13292. $1=$recv(aBlock)._value_(each);
  13293. if($core.assert($1)){
  13294. return $recv(collection)._add_(each);
  13295. }
  13296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13297. }));
  13298. return collection;
  13299. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  13300. },
  13301. args: ["aBlock"],
  13302. 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",
  13303. referencedClasses: [],
  13304. pragmas: [],
  13305. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13306. }),
  13307. $globals.Set);
  13308. $core.addMethod(
  13309. $core.method({
  13310. selector: "select:thenCollect:",
  13311. protocol: "enumerating",
  13312. fn: function (selectBlock,collectBlock){
  13313. var self=this,$self=this;
  13314. var collection;
  13315. return $core.withContext(function($ctx1) {
  13316. var $1;
  13317. collection=$recv($self._class())._new();
  13318. $self._do_((function(each){
  13319. return $core.withContext(function($ctx2) {
  13320. $1=$recv(selectBlock)._value_(each);
  13321. $ctx2.sendIdx["value:"]=1;
  13322. if($core.assert($1)){
  13323. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13324. }
  13325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13326. }));
  13327. return collection;
  13328. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  13329. },
  13330. args: ["selectBlock", "collectBlock"],
  13331. 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",
  13332. referencedClasses: [],
  13333. pragmas: [],
  13334. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13335. }),
  13336. $globals.Set);
  13337. $core.addMethod(
  13338. $core.method({
  13339. selector: "size",
  13340. protocol: "accessing",
  13341. fn: function (){
  13342. var self=this,$self=this;
  13343. return $self.size;
  13344. },
  13345. args: [],
  13346. source: "size\x0a\x09^ size",
  13347. referencedClasses: [],
  13348. pragmas: [],
  13349. messageSends: []
  13350. }),
  13351. $globals.Set);
  13352. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13353. $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.";
  13354. $core.addMethod(
  13355. $core.method({
  13356. selector: "<<",
  13357. protocol: "writing",
  13358. fn: function (anObject){
  13359. var self=this,$self=this;
  13360. return $core.withContext(function($ctx1) {
  13361. $self._write_(anObject);
  13362. return self;
  13363. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  13364. },
  13365. args: ["anObject"],
  13366. source: "<< anObject\x0a\x09self write: anObject",
  13367. referencedClasses: [],
  13368. pragmas: [],
  13369. messageSends: ["write:"]
  13370. }),
  13371. $globals.ProtoStream);
  13372. $core.addMethod(
  13373. $core.method({
  13374. selector: "atEnd",
  13375. protocol: "testing",
  13376. fn: function (){
  13377. var self=this,$self=this;
  13378. return $core.withContext(function($ctx1) {
  13379. $self._subclassResponsibility();
  13380. return self;
  13381. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  13382. },
  13383. args: [],
  13384. source: "atEnd\x0a\x09self subclassResponsibility",
  13385. referencedClasses: [],
  13386. pragmas: [],
  13387. messageSends: ["subclassResponsibility"]
  13388. }),
  13389. $globals.ProtoStream);
  13390. $core.addMethod(
  13391. $core.method({
  13392. selector: "atStart",
  13393. protocol: "testing",
  13394. fn: function (){
  13395. var self=this,$self=this;
  13396. return $core.withContext(function($ctx1) {
  13397. $self._subclassResponsibility();
  13398. return self;
  13399. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  13400. },
  13401. args: [],
  13402. source: "atStart\x0a\x09self subclassResponsibility",
  13403. referencedClasses: [],
  13404. pragmas: [],
  13405. messageSends: ["subclassResponsibility"]
  13406. }),
  13407. $globals.ProtoStream);
  13408. $core.addMethod(
  13409. $core.method({
  13410. selector: "contents",
  13411. protocol: "accessing",
  13412. fn: function (){
  13413. var self=this,$self=this;
  13414. return $core.withContext(function($ctx1) {
  13415. $self._subclassResponsibility();
  13416. return self;
  13417. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  13418. },
  13419. args: [],
  13420. source: "contents\x0a\x09self subclassResponsibility",
  13421. referencedClasses: [],
  13422. pragmas: [],
  13423. messageSends: ["subclassResponsibility"]
  13424. }),
  13425. $globals.ProtoStream);
  13426. $core.addMethod(
  13427. $core.method({
  13428. selector: "do:",
  13429. protocol: "enumerating",
  13430. fn: function (aBlock){
  13431. var self=this,$self=this;
  13432. return $core.withContext(function($ctx1) {
  13433. $recv((function(){
  13434. return $core.withContext(function($ctx2) {
  13435. return $self._atEnd();
  13436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13437. }))._whileFalse_((function(){
  13438. return $core.withContext(function($ctx2) {
  13439. return $recv(aBlock)._value_($self._next());
  13440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13441. }));
  13442. return self;
  13443. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  13444. },
  13445. args: ["aBlock"],
  13446. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13447. referencedClasses: [],
  13448. pragmas: [],
  13449. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13450. }),
  13451. $globals.ProtoStream);
  13452. $core.addMethod(
  13453. $core.method({
  13454. selector: "isEmpty",
  13455. protocol: "testing",
  13456. fn: function (){
  13457. var self=this,$self=this;
  13458. return $core.withContext(function($ctx1) {
  13459. return $recv($self._atStart())._and_((function(){
  13460. return $core.withContext(function($ctx2) {
  13461. return $self._atEnd();
  13462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13463. }));
  13464. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13465. },
  13466. args: [],
  13467. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13468. referencedClasses: [],
  13469. pragmas: [],
  13470. messageSends: ["and:", "atStart", "atEnd"]
  13471. }),
  13472. $globals.ProtoStream);
  13473. $core.addMethod(
  13474. $core.method({
  13475. selector: "next",
  13476. protocol: "reading",
  13477. fn: function (){
  13478. var self=this,$self=this;
  13479. return $core.withContext(function($ctx1) {
  13480. var $1;
  13481. $1=$self._atEnd();
  13482. if($core.assert($1)){
  13483. return nil;
  13484. } else {
  13485. return $self._subclassResponsibility();
  13486. }
  13487. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13488. },
  13489. args: [],
  13490. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13491. referencedClasses: [],
  13492. pragmas: [],
  13493. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13494. }),
  13495. $globals.ProtoStream);
  13496. $core.addMethod(
  13497. $core.method({
  13498. selector: "nextPut:",
  13499. protocol: "writing",
  13500. fn: function (anObject){
  13501. var self=this,$self=this;
  13502. return $core.withContext(function($ctx1) {
  13503. $self._subclassResponsibility();
  13504. return self;
  13505. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13506. },
  13507. args: ["anObject"],
  13508. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13509. referencedClasses: [],
  13510. pragmas: [],
  13511. messageSends: ["subclassResponsibility"]
  13512. }),
  13513. $globals.ProtoStream);
  13514. $core.addMethod(
  13515. $core.method({
  13516. selector: "nextPutAll:",
  13517. protocol: "writing",
  13518. fn: function (aCollection){
  13519. var self=this,$self=this;
  13520. return $core.withContext(function($ctx1) {
  13521. $recv(aCollection)._do_((function(each){
  13522. return $core.withContext(function($ctx2) {
  13523. return $self._nextPut_(each);
  13524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13525. }));
  13526. return self;
  13527. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  13528. },
  13529. args: ["aCollection"],
  13530. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13531. referencedClasses: [],
  13532. pragmas: [],
  13533. messageSends: ["do:", "nextPut:"]
  13534. }),
  13535. $globals.ProtoStream);
  13536. $core.addMethod(
  13537. $core.method({
  13538. selector: "nextPutString:",
  13539. protocol: "writing",
  13540. fn: function (aString){
  13541. var self=this,$self=this;
  13542. return $core.withContext(function($ctx1) {
  13543. $self._nextPut_(aString);
  13544. return self;
  13545. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  13546. },
  13547. args: ["aString"],
  13548. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13549. referencedClasses: [],
  13550. pragmas: [],
  13551. messageSends: ["nextPut:"]
  13552. }),
  13553. $globals.ProtoStream);
  13554. $core.addMethod(
  13555. $core.method({
  13556. selector: "peek",
  13557. protocol: "reading",
  13558. fn: function (){
  13559. var self=this,$self=this;
  13560. return $core.withContext(function($ctx1) {
  13561. var $1;
  13562. $1=$self._atEnd();
  13563. if($core.assert($1)){
  13564. return nil;
  13565. } else {
  13566. return $self._subclassResponsibility();
  13567. }
  13568. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13569. },
  13570. args: [],
  13571. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13572. referencedClasses: [],
  13573. pragmas: [],
  13574. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13575. }),
  13576. $globals.ProtoStream);
  13577. $core.addMethod(
  13578. $core.method({
  13579. selector: "reset",
  13580. protocol: "actions",
  13581. fn: function (){
  13582. var self=this,$self=this;
  13583. return $core.withContext(function($ctx1) {
  13584. $self._subclassResponsibility();
  13585. return self;
  13586. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13587. },
  13588. args: [],
  13589. source: "reset\x0a\x09self subclassResponsibility",
  13590. referencedClasses: [],
  13591. pragmas: [],
  13592. messageSends: ["subclassResponsibility"]
  13593. }),
  13594. $globals.ProtoStream);
  13595. $core.addMethod(
  13596. $core.method({
  13597. selector: "resetContents",
  13598. protocol: "actions",
  13599. fn: function (){
  13600. var self=this,$self=this;
  13601. return $core.withContext(function($ctx1) {
  13602. $self._subclassResponsibility();
  13603. return self;
  13604. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13605. },
  13606. args: [],
  13607. source: "resetContents\x0a\x09self subclassResponsibility",
  13608. referencedClasses: [],
  13609. pragmas: [],
  13610. messageSends: ["subclassResponsibility"]
  13611. }),
  13612. $globals.ProtoStream);
  13613. $core.addMethod(
  13614. $core.method({
  13615. selector: "setToEnd",
  13616. protocol: "positioning",
  13617. fn: function (){
  13618. var self=this,$self=this;
  13619. return $core.withContext(function($ctx1) {
  13620. $self._subclassResponsibility();
  13621. return self;
  13622. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  13623. },
  13624. args: [],
  13625. source: "setToEnd\x0a\x09self subclassResponsibility",
  13626. referencedClasses: [],
  13627. pragmas: [],
  13628. messageSends: ["subclassResponsibility"]
  13629. }),
  13630. $globals.ProtoStream);
  13631. $core.addMethod(
  13632. $core.method({
  13633. selector: "setToStart",
  13634. protocol: "positioning",
  13635. fn: function (){
  13636. var self=this,$self=this;
  13637. return $core.withContext(function($ctx1) {
  13638. $self._reset();
  13639. return self;
  13640. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  13641. },
  13642. args: [],
  13643. source: "setToStart\x0a\x09self reset",
  13644. referencedClasses: [],
  13645. pragmas: [],
  13646. messageSends: ["reset"]
  13647. }),
  13648. $globals.ProtoStream);
  13649. $core.addMethod(
  13650. $core.method({
  13651. selector: "write:",
  13652. protocol: "writing",
  13653. fn: function (anObject){
  13654. var self=this,$self=this;
  13655. return $core.withContext(function($ctx1) {
  13656. $recv(anObject)._putOn_(self);
  13657. return self;
  13658. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  13659. },
  13660. args: ["anObject"],
  13661. source: "write: anObject\x0a\x09anObject putOn: self",
  13662. referencedClasses: [],
  13663. pragmas: [],
  13664. messageSends: ["putOn:"]
  13665. }),
  13666. $globals.ProtoStream);
  13667. $core.addMethod(
  13668. $core.method({
  13669. selector: "on:",
  13670. protocol: "instance creation",
  13671. fn: function (aCollection){
  13672. var self=this,$self=this;
  13673. return $core.withContext(function($ctx1) {
  13674. var $1;
  13675. $1=$self._new();
  13676. $recv($1)._setCollection_(aCollection);
  13677. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13678. return $recv($1)._yourself();
  13679. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  13680. },
  13681. args: ["aCollection"],
  13682. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13683. referencedClasses: [],
  13684. pragmas: [],
  13685. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13686. }),
  13687. $globals.ProtoStream.a$cls);
  13688. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13689. $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.";
  13690. $core.addMethod(
  13691. $core.method({
  13692. selector: "atEnd",
  13693. protocol: "testing",
  13694. fn: function (){
  13695. var self=this,$self=this;
  13696. return $core.withContext(function($ctx1) {
  13697. return $recv($self._position()).__eq($self._size());
  13698. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  13699. },
  13700. args: [],
  13701. source: "atEnd\x0a\x09^ self position = self size",
  13702. referencedClasses: [],
  13703. pragmas: [],
  13704. messageSends: ["=", "position", "size"]
  13705. }),
  13706. $globals.Stream);
  13707. $core.addMethod(
  13708. $core.method({
  13709. selector: "atStart",
  13710. protocol: "testing",
  13711. fn: function (){
  13712. var self=this,$self=this;
  13713. return $core.withContext(function($ctx1) {
  13714. return $recv($self._position()).__eq((0));
  13715. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  13716. },
  13717. args: [],
  13718. source: "atStart\x0a\x09^ self position = 0",
  13719. referencedClasses: [],
  13720. pragmas: [],
  13721. messageSends: ["=", "position"]
  13722. }),
  13723. $globals.Stream);
  13724. $core.addMethod(
  13725. $core.method({
  13726. selector: "close",
  13727. protocol: "actions",
  13728. fn: function (){
  13729. var self=this,$self=this;
  13730. return self;
  13731. },
  13732. args: [],
  13733. source: "close",
  13734. referencedClasses: [],
  13735. pragmas: [],
  13736. messageSends: []
  13737. }),
  13738. $globals.Stream);
  13739. $core.addMethod(
  13740. $core.method({
  13741. selector: "collection",
  13742. protocol: "accessing",
  13743. fn: function (){
  13744. var self=this,$self=this;
  13745. return $self.collection;
  13746. },
  13747. args: [],
  13748. source: "collection\x0a\x09^ collection",
  13749. referencedClasses: [],
  13750. pragmas: [],
  13751. messageSends: []
  13752. }),
  13753. $globals.Stream);
  13754. $core.addMethod(
  13755. $core.method({
  13756. selector: "contents",
  13757. protocol: "accessing",
  13758. fn: function (){
  13759. var self=this,$self=this;
  13760. return $core.withContext(function($ctx1) {
  13761. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13762. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  13763. },
  13764. args: [],
  13765. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13766. referencedClasses: [],
  13767. pragmas: [],
  13768. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13769. }),
  13770. $globals.Stream);
  13771. $core.addMethod(
  13772. $core.method({
  13773. selector: "flush",
  13774. protocol: "actions",
  13775. fn: function (){
  13776. var self=this,$self=this;
  13777. return self;
  13778. },
  13779. args: [],
  13780. source: "flush",
  13781. referencedClasses: [],
  13782. pragmas: [],
  13783. messageSends: []
  13784. }),
  13785. $globals.Stream);
  13786. $core.addMethod(
  13787. $core.method({
  13788. selector: "isEmpty",
  13789. protocol: "testing",
  13790. fn: function (){
  13791. var self=this,$self=this;
  13792. return $core.withContext(function($ctx1) {
  13793. return $recv($self._size()).__eq((0));
  13794. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13795. },
  13796. args: [],
  13797. source: "isEmpty\x0a\x09^ self size = 0",
  13798. referencedClasses: [],
  13799. pragmas: [],
  13800. messageSends: ["=", "size"]
  13801. }),
  13802. $globals.Stream);
  13803. $core.addMethod(
  13804. $core.method({
  13805. selector: "next",
  13806. protocol: "reading",
  13807. fn: function (){
  13808. var self=this,$self=this;
  13809. return $core.withContext(function($ctx1) {
  13810. var $1,$3,$2;
  13811. $1=$self._atEnd();
  13812. if($core.assert($1)){
  13813. return nil;
  13814. } else {
  13815. $3=$self._position();
  13816. $ctx1.sendIdx["position"]=1;
  13817. $2=$recv($3).__plus((1));
  13818. $self._position_($2);
  13819. return $recv($self.collection)._at_($self._position());
  13820. }
  13821. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13822. },
  13823. args: [],
  13824. 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 ]",
  13825. referencedClasses: [],
  13826. pragmas: [],
  13827. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13828. }),
  13829. $globals.Stream);
  13830. $core.addMethod(
  13831. $core.method({
  13832. selector: "next:",
  13833. protocol: "reading",
  13834. fn: function (anInteger){
  13835. var self=this,$self=this;
  13836. var tempCollection;
  13837. return $core.withContext(function($ctx1) {
  13838. var $1;
  13839. tempCollection=$recv($recv($self._collection())._class())._new();
  13840. $recv(anInteger)._timesRepeat_((function(){
  13841. return $core.withContext(function($ctx2) {
  13842. $1=$self._atEnd();
  13843. if(!$core.assert($1)){
  13844. return $recv(tempCollection)._add_($self._next());
  13845. }
  13846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13847. }));
  13848. return tempCollection;
  13849. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  13850. },
  13851. args: ["anInteger"],
  13852. 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",
  13853. referencedClasses: [],
  13854. pragmas: [],
  13855. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13856. }),
  13857. $globals.Stream);
  13858. $core.addMethod(
  13859. $core.method({
  13860. selector: "nextPut:",
  13861. protocol: "writing",
  13862. fn: function (anObject){
  13863. var self=this,$self=this;
  13864. return $core.withContext(function($ctx1) {
  13865. var $2,$1,$3,$4;
  13866. $2=$self._position();
  13867. $ctx1.sendIdx["position"]=1;
  13868. $1=$recv($2).__plus((1));
  13869. $self._position_($1);
  13870. $3=$self._collection();
  13871. $4=$self._position();
  13872. $ctx1.sendIdx["position"]=2;
  13873. $recv($3)._at_put_($4,anObject);
  13874. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13875. return self;
  13876. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13877. },
  13878. args: ["anObject"],
  13879. 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)",
  13880. referencedClasses: [],
  13881. pragmas: [],
  13882. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13883. }),
  13884. $globals.Stream);
  13885. $core.addMethod(
  13886. $core.method({
  13887. selector: "peek",
  13888. protocol: "reading",
  13889. fn: function (){
  13890. var self=this,$self=this;
  13891. return $core.withContext(function($ctx1) {
  13892. var $1;
  13893. $1=$self._atEnd();
  13894. if(!$core.assert($1)){
  13895. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13896. }
  13897. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13898. },
  13899. args: [],
  13900. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13901. referencedClasses: [],
  13902. pragmas: [],
  13903. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13904. }),
  13905. $globals.Stream);
  13906. $core.addMethod(
  13907. $core.method({
  13908. selector: "position",
  13909. protocol: "accessing",
  13910. fn: function (){
  13911. var self=this,$self=this;
  13912. return $core.withContext(function($ctx1) {
  13913. var $1,$receiver;
  13914. $1=$self.position;
  13915. if(($receiver = $1) == null || $receiver.a$nil){
  13916. $self.position=(0);
  13917. return $self.position;
  13918. } else {
  13919. return $1;
  13920. }
  13921. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  13922. },
  13923. args: [],
  13924. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13925. referencedClasses: [],
  13926. pragmas: [],
  13927. messageSends: ["ifNil:"]
  13928. }),
  13929. $globals.Stream);
  13930. $core.addMethod(
  13931. $core.method({
  13932. selector: "position:",
  13933. protocol: "accessing",
  13934. fn: function (anInteger){
  13935. var self=this,$self=this;
  13936. $self.position=anInteger;
  13937. return self;
  13938. },
  13939. args: ["anInteger"],
  13940. source: "position: anInteger\x0a\x09position := anInteger",
  13941. referencedClasses: [],
  13942. pragmas: [],
  13943. messageSends: []
  13944. }),
  13945. $globals.Stream);
  13946. $core.addMethod(
  13947. $core.method({
  13948. selector: "reset",
  13949. protocol: "actions",
  13950. fn: function (){
  13951. var self=this,$self=this;
  13952. return $core.withContext(function($ctx1) {
  13953. $self._position_((0));
  13954. return self;
  13955. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13956. },
  13957. args: [],
  13958. source: "reset\x0a\x09self position: 0",
  13959. referencedClasses: [],
  13960. pragmas: [],
  13961. messageSends: ["position:"]
  13962. }),
  13963. $globals.Stream);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "resetContents",
  13967. protocol: "actions",
  13968. fn: function (){
  13969. var self=this,$self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. $self._reset();
  13972. $self._setStreamSize_((0));
  13973. return self;
  13974. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13975. },
  13976. args: [],
  13977. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13978. referencedClasses: [],
  13979. pragmas: [],
  13980. messageSends: ["reset", "setStreamSize:"]
  13981. }),
  13982. $globals.Stream);
  13983. $core.addMethod(
  13984. $core.method({
  13985. selector: "setCollection:",
  13986. protocol: "accessing",
  13987. fn: function (aCollection){
  13988. var self=this,$self=this;
  13989. $self.collection=aCollection;
  13990. return self;
  13991. },
  13992. args: ["aCollection"],
  13993. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13994. referencedClasses: [],
  13995. pragmas: [],
  13996. messageSends: []
  13997. }),
  13998. $globals.Stream);
  13999. $core.addMethod(
  14000. $core.method({
  14001. selector: "setStreamSize:",
  14002. protocol: "accessing",
  14003. fn: function (anInteger){
  14004. var self=this,$self=this;
  14005. $self.streamSize=anInteger;
  14006. return self;
  14007. },
  14008. args: ["anInteger"],
  14009. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  14010. referencedClasses: [],
  14011. pragmas: [],
  14012. messageSends: []
  14013. }),
  14014. $globals.Stream);
  14015. $core.addMethod(
  14016. $core.method({
  14017. selector: "setToEnd",
  14018. protocol: "positioning",
  14019. fn: function (){
  14020. var self=this,$self=this;
  14021. return $core.withContext(function($ctx1) {
  14022. $self._position_($self._size());
  14023. return self;
  14024. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  14025. },
  14026. args: [],
  14027. source: "setToEnd\x0a\x09self position: self size",
  14028. referencedClasses: [],
  14029. pragmas: [],
  14030. messageSends: ["position:", "size"]
  14031. }),
  14032. $globals.Stream);
  14033. $core.addMethod(
  14034. $core.method({
  14035. selector: "size",
  14036. protocol: "accessing",
  14037. fn: function (){
  14038. var self=this,$self=this;
  14039. return $core.withContext(function($ctx1) {
  14040. return $self._streamSize();
  14041. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  14042. },
  14043. args: [],
  14044. source: "size\x0a\x09^ self streamSize",
  14045. referencedClasses: [],
  14046. pragmas: [],
  14047. messageSends: ["streamSize"]
  14048. }),
  14049. $globals.Stream);
  14050. $core.addMethod(
  14051. $core.method({
  14052. selector: "skip:",
  14053. protocol: "positioning",
  14054. fn: function (anInteger){
  14055. var self=this,$self=this;
  14056. return $core.withContext(function($ctx1) {
  14057. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  14058. return self;
  14059. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  14060. },
  14061. args: ["anInteger"],
  14062. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  14063. referencedClasses: [],
  14064. pragmas: [],
  14065. messageSends: ["position:", "min:max:", "+", "position", "size"]
  14066. }),
  14067. $globals.Stream);
  14068. $core.addMethod(
  14069. $core.method({
  14070. selector: "streamSize",
  14071. protocol: "accessing",
  14072. fn: function (){
  14073. var self=this,$self=this;
  14074. return $self.streamSize;
  14075. },
  14076. args: [],
  14077. source: "streamSize\x0a\x09^ streamSize",
  14078. referencedClasses: [],
  14079. pragmas: [],
  14080. messageSends: []
  14081. }),
  14082. $globals.Stream);
  14083. $core.addMethod(
  14084. $core.method({
  14085. selector: "on:",
  14086. protocol: "instance creation",
  14087. fn: function (aCollection){
  14088. var self=this,$self=this;
  14089. return $core.withContext(function($ctx1) {
  14090. var $1;
  14091. $1=$self._new();
  14092. $recv($1)._setCollection_(aCollection);
  14093. $recv($1)._setStreamSize_($recv(aCollection)._size());
  14094. return $recv($1)._yourself();
  14095. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  14096. },
  14097. args: ["aCollection"],
  14098. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14099. referencedClasses: [],
  14100. pragmas: [],
  14101. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  14102. }),
  14103. $globals.Stream.a$cls);
  14104. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  14105. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14106. $core.addMethod(
  14107. $core.method({
  14108. selector: "cr",
  14109. protocol: "writing",
  14110. fn: function (){
  14111. var self=this,$self=this;
  14112. return $core.withContext(function($ctx1) {
  14113. return $self._nextPutAll_($recv($globals.String)._cr());
  14114. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  14115. },
  14116. args: [],
  14117. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14118. referencedClasses: ["String"],
  14119. pragmas: [],
  14120. messageSends: ["nextPutAll:", "cr"]
  14121. }),
  14122. $globals.StringStream);
  14123. $core.addMethod(
  14124. $core.method({
  14125. selector: "crlf",
  14126. protocol: "writing",
  14127. fn: function (){
  14128. var self=this,$self=this;
  14129. return $core.withContext(function($ctx1) {
  14130. return $self._nextPutAll_($recv($globals.String)._crlf());
  14131. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  14132. },
  14133. args: [],
  14134. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14135. referencedClasses: ["String"],
  14136. pragmas: [],
  14137. messageSends: ["nextPutAll:", "crlf"]
  14138. }),
  14139. $globals.StringStream);
  14140. $core.addMethod(
  14141. $core.method({
  14142. selector: "lf",
  14143. protocol: "writing",
  14144. fn: function (){
  14145. var self=this,$self=this;
  14146. return $core.withContext(function($ctx1) {
  14147. return $self._nextPutAll_($recv($globals.String)._lf());
  14148. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  14149. },
  14150. args: [],
  14151. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14152. referencedClasses: ["String"],
  14153. pragmas: [],
  14154. messageSends: ["nextPutAll:", "lf"]
  14155. }),
  14156. $globals.StringStream);
  14157. $core.addMethod(
  14158. $core.method({
  14159. selector: "next:",
  14160. protocol: "reading",
  14161. fn: function (anInteger){
  14162. var self=this,$self=this;
  14163. var tempCollection;
  14164. return $core.withContext(function($ctx1) {
  14165. var $1;
  14166. tempCollection=$recv($recv($self._collection())._class())._new();
  14167. $recv(anInteger)._timesRepeat_((function(){
  14168. return $core.withContext(function($ctx2) {
  14169. $1=$self._atEnd();
  14170. if(!$core.assert($1)){
  14171. tempCollection=$recv(tempCollection).__comma($self._next());
  14172. return tempCollection;
  14173. }
  14174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14175. }));
  14176. return tempCollection;
  14177. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  14178. },
  14179. args: ["anInteger"],
  14180. 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",
  14181. referencedClasses: [],
  14182. pragmas: [],
  14183. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14184. }),
  14185. $globals.StringStream);
  14186. $core.addMethod(
  14187. $core.method({
  14188. selector: "nextPut:",
  14189. protocol: "writing",
  14190. fn: function (aString){
  14191. var self=this,$self=this;
  14192. return $core.withContext(function($ctx1) {
  14193. $self._nextPutAll_(aString);
  14194. return self;
  14195. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  14196. },
  14197. args: ["aString"],
  14198. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14199. referencedClasses: [],
  14200. pragmas: [],
  14201. messageSends: ["nextPutAll:"]
  14202. }),
  14203. $globals.StringStream);
  14204. $core.addMethod(
  14205. $core.method({
  14206. selector: "nextPutAll:",
  14207. protocol: "writing",
  14208. fn: function (aString){
  14209. var self=this,$self=this;
  14210. var pre,post;
  14211. return $core.withContext(function($ctx1) {
  14212. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  14213. $2=$self._position();
  14214. $ctx1.sendIdx["position"]=1;
  14215. $4=$self._collection();
  14216. $ctx1.sendIdx["collection"]=1;
  14217. $3=$recv($4)._size();
  14218. $ctx1.sendIdx["size"]=1;
  14219. $1=$recv($2).__eq($3);
  14220. if($core.assert($1)){
  14221. $6=$self._collection();
  14222. $ctx1.sendIdx["collection"]=2;
  14223. $5=$recv($6).__comma(aString);
  14224. $ctx1.sendIdx[","]=1;
  14225. $self._setCollection_($5);
  14226. $ctx1.sendIdx["setCollection:"]=1;
  14227. } else {
  14228. $7=$self._collection();
  14229. $ctx1.sendIdx["collection"]=3;
  14230. $8=$self._position();
  14231. $ctx1.sendIdx["position"]=2;
  14232. pre=$recv($7)._copyFrom_to_((1),$8);
  14233. $ctx1.sendIdx["copyFrom:to:"]=1;
  14234. $9=$self._collection();
  14235. $ctx1.sendIdx["collection"]=4;
  14236. $12=$self._position();
  14237. $ctx1.sendIdx["position"]=3;
  14238. $11=$recv($12).__plus((1));
  14239. $ctx1.sendIdx["+"]=2;
  14240. $13=$recv(aString)._size();
  14241. $ctx1.sendIdx["size"]=2;
  14242. $10=$recv($11).__plus($13);
  14243. $ctx1.sendIdx["+"]=1;
  14244. $14=$recv($self._collection())._size();
  14245. $ctx1.sendIdx["size"]=3;
  14246. post=$recv($9)._copyFrom_to_($10,$14);
  14247. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  14248. $ctx1.sendIdx[","]=2;
  14249. $self._setCollection_($15);
  14250. }
  14251. $17=$self._position();
  14252. $ctx1.sendIdx["position"]=4;
  14253. $16=$recv($17).__plus($recv(aString)._size());
  14254. $self._position_($16);
  14255. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14256. return self;
  14257. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  14258. },
  14259. args: ["aString"],
  14260. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size 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)",
  14261. referencedClasses: [],
  14262. pragmas: [],
  14263. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  14264. }),
  14265. $globals.StringStream);
  14266. $core.addMethod(
  14267. $core.method({
  14268. selector: "nextPutString:",
  14269. protocol: "writing",
  14270. fn: function (aString){
  14271. var self=this,$self=this;
  14272. return $core.withContext(function($ctx1) {
  14273. $self._nextPutAll_(aString);
  14274. return self;
  14275. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  14276. },
  14277. args: ["aString"],
  14278. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14279. referencedClasses: [],
  14280. pragmas: [],
  14281. messageSends: ["nextPutAll:"]
  14282. }),
  14283. $globals.StringStream);
  14284. $core.addMethod(
  14285. $core.method({
  14286. selector: "print:",
  14287. protocol: "writing",
  14288. fn: function (anObject){
  14289. var self=this,$self=this;
  14290. return $core.withContext(function($ctx1) {
  14291. $recv(anObject)._printOn_(self);
  14292. return self;
  14293. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  14294. },
  14295. args: ["anObject"],
  14296. source: "print: anObject\x0a\x09anObject printOn: self",
  14297. referencedClasses: [],
  14298. pragmas: [],
  14299. messageSends: ["printOn:"]
  14300. }),
  14301. $globals.StringStream);
  14302. $core.addMethod(
  14303. $core.method({
  14304. selector: "printSymbol:",
  14305. protocol: "writing",
  14306. fn: function (anObject){
  14307. var self=this,$self=this;
  14308. return $core.withContext(function($ctx1) {
  14309. $recv(anObject)._asSymbolPrintOn_(self);
  14310. return self;
  14311. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  14312. },
  14313. args: ["anObject"],
  14314. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14315. referencedClasses: [],
  14316. pragmas: [],
  14317. messageSends: ["asSymbolPrintOn:"]
  14318. }),
  14319. $globals.StringStream);
  14320. $core.addMethod(
  14321. $core.method({
  14322. selector: "space",
  14323. protocol: "writing",
  14324. fn: function (){
  14325. var self=this,$self=this;
  14326. return $core.withContext(function($ctx1) {
  14327. $self._nextPut_(" ");
  14328. return self;
  14329. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  14330. },
  14331. args: [],
  14332. source: "space\x0a\x09self nextPut: ' '",
  14333. referencedClasses: [],
  14334. pragmas: [],
  14335. messageSends: ["nextPut:"]
  14336. }),
  14337. $globals.StringStream);
  14338. $core.addMethod(
  14339. $core.method({
  14340. selector: "tab",
  14341. protocol: "writing",
  14342. fn: function (){
  14343. var self=this,$self=this;
  14344. return $core.withContext(function($ctx1) {
  14345. return $self._nextPutAll_($recv($globals.String)._tab());
  14346. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  14347. },
  14348. args: [],
  14349. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14350. referencedClasses: ["String"],
  14351. pragmas: [],
  14352. messageSends: ["nextPutAll:", "tab"]
  14353. }),
  14354. $globals.StringStream);
  14355. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14356. $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.";
  14357. $core.addMethod(
  14358. $core.method({
  14359. selector: "initialize",
  14360. protocol: "initialization",
  14361. fn: function (){
  14362. var self=this,$self=this;
  14363. return $core.withContext(function($ctx1) {
  14364. (
  14365. $ctx1.supercall = true,
  14366. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14367. $ctx1.supercall = false;
  14368. $self.read=$recv($globals.OrderedCollection)._new();
  14369. $ctx1.sendIdx["new"]=1;
  14370. $self.write=$recv($globals.OrderedCollection)._new();
  14371. $self.readIndex=(1);
  14372. return self;
  14373. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  14374. },
  14375. args: [],
  14376. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14377. referencedClasses: ["OrderedCollection"],
  14378. pragmas: [],
  14379. messageSends: ["initialize", "new"]
  14380. }),
  14381. $globals.Queue);
  14382. $core.addMethod(
  14383. $core.method({
  14384. selector: "next",
  14385. protocol: "accessing",
  14386. fn: function (){
  14387. var self=this,$self=this;
  14388. return $core.withContext(function($ctx1) {
  14389. return $self._nextIfAbsent_((function(){
  14390. return $core.withContext(function($ctx2) {
  14391. return $self._error_("Cannot read from empty Queue.");
  14392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14393. }));
  14394. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  14395. },
  14396. args: [],
  14397. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14398. referencedClasses: [],
  14399. pragmas: [],
  14400. messageSends: ["nextIfAbsent:", "error:"]
  14401. }),
  14402. $globals.Queue);
  14403. $core.addMethod(
  14404. $core.method({
  14405. selector: "nextIfAbsent:",
  14406. protocol: "accessing",
  14407. fn: function (aBlock){
  14408. var self=this,$self=this;
  14409. var result;
  14410. return $core.withContext(function($ctx1) {
  14411. var $1;
  14412. var $early={};
  14413. try {
  14414. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  14415. return $core.withContext(function($ctx2) {
  14416. $recv($self.write)._ifEmpty_((function(){
  14417. return $core.withContext(function($ctx3) {
  14418. $1=$recv($self.readIndex).__gt((1));
  14419. if($core.assert($1)){
  14420. $self.read=[];
  14421. $self.readIndex=(1);
  14422. $self.readIndex;
  14423. }
  14424. throw $early=[$recv(aBlock)._value()];
  14425. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14426. }));
  14427. $self.read=$self.write;
  14428. $self.readIndex=(1);
  14429. $self.write=$recv($globals.OrderedCollection)._new();
  14430. return $recv($self.read)._first();
  14431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14432. }));
  14433. $recv($self.read)._at_put_($self.readIndex,nil);
  14434. $self.readIndex=$recv($self.readIndex).__plus((1));
  14435. return result;
  14436. }
  14437. catch(e) {if(e===$early)return e[0]; throw e}
  14438. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  14439. },
  14440. args: ["aBlock"],
  14441. 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",
  14442. referencedClasses: ["OrderedCollection"],
  14443. pragmas: [],
  14444. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14445. }),
  14446. $globals.Queue);
  14447. $core.addMethod(
  14448. $core.method({
  14449. selector: "nextPut:",
  14450. protocol: "accessing",
  14451. fn: function (anObject){
  14452. var self=this,$self=this;
  14453. return $core.withContext(function($ctx1) {
  14454. $recv($self.write)._add_(anObject);
  14455. return self;
  14456. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  14457. },
  14458. args: ["anObject"],
  14459. source: "nextPut: anObject\x0a\x09write add: anObject",
  14460. referencedClasses: [],
  14461. pragmas: [],
  14462. messageSends: ["add:"]
  14463. }),
  14464. $globals.Queue);
  14465. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14466. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14467. $core.addMethod(
  14468. $core.method({
  14469. selector: "compile:",
  14470. protocol: "evaluating",
  14471. fn: function (aString){
  14472. var self=this,$self=this;
  14473. return $core.withContext(function($ctx1) {
  14474. return self.compile(aString);
  14475. return self;
  14476. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  14477. },
  14478. args: ["aString"],
  14479. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14480. referencedClasses: [],
  14481. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  14482. messageSends: []
  14483. }),
  14484. $globals.RegularExpression);
  14485. $core.addMethod(
  14486. $core.method({
  14487. selector: "exec:",
  14488. protocol: "evaluating",
  14489. fn: function (aString){
  14490. var self=this,$self=this;
  14491. return $core.withContext(function($ctx1) {
  14492. return self.exec(aString) || nil;
  14493. return self;
  14494. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  14495. },
  14496. args: ["aString"],
  14497. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14498. referencedClasses: [],
  14499. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  14500. messageSends: []
  14501. }),
  14502. $globals.RegularExpression);
  14503. $core.addMethod(
  14504. $core.method({
  14505. selector: "test:",
  14506. protocol: "evaluating",
  14507. fn: function (aString){
  14508. var self=this,$self=this;
  14509. return $core.withContext(function($ctx1) {
  14510. return self.test(aString);
  14511. return self;
  14512. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  14513. },
  14514. args: ["aString"],
  14515. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14516. referencedClasses: [],
  14517. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  14518. messageSends: []
  14519. }),
  14520. $globals.RegularExpression);
  14521. $core.addMethod(
  14522. $core.method({
  14523. selector: "fromString:",
  14524. protocol: "instance creation",
  14525. fn: function (aString){
  14526. var self=this,$self=this;
  14527. return $core.withContext(function($ctx1) {
  14528. return $self._fromString_flag_(aString,"");
  14529. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  14530. },
  14531. args: ["aString"],
  14532. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14533. referencedClasses: [],
  14534. pragmas: [],
  14535. messageSends: ["fromString:flag:"]
  14536. }),
  14537. $globals.RegularExpression.a$cls);
  14538. $core.addMethod(
  14539. $core.method({
  14540. selector: "fromString:flag:",
  14541. protocol: "instance creation",
  14542. fn: function (aString,anotherString){
  14543. var self=this,$self=this;
  14544. return $core.withContext(function($ctx1) {
  14545. return new RegExp(aString, anotherString);
  14546. return self;
  14547. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  14548. },
  14549. args: ["aString", "anotherString"],
  14550. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14551. referencedClasses: [],
  14552. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  14553. messageSends: []
  14554. }),
  14555. $globals.RegularExpression.a$cls);
  14556. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  14557. $core.addMethod(
  14558. $core.method({
  14559. selector: "at:",
  14560. protocol: "accessing",
  14561. fn: function (anIndex){
  14562. var self=this,$self=this;
  14563. return $core.withContext(function($ctx1) {
  14564. return $self._at_ifAbsent_(anIndex,(function(){
  14565. return $core.withContext(function($ctx2) {
  14566. return $self._errorNotFound();
  14567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14568. }));
  14569. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  14570. },
  14571. args: ["anIndex"],
  14572. 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 ]",
  14573. referencedClasses: [],
  14574. pragmas: [],
  14575. messageSends: ["at:ifAbsent:", "errorNotFound"]
  14576. }),
  14577. $globals.TKeyValueCollection);
  14578. $core.addMethod(
  14579. $core.method({
  14580. selector: "at:ifAbsent:",
  14581. protocol: "accessing",
  14582. fn: function (anIndex,aBlock){
  14583. var self=this,$self=this;
  14584. return $core.withContext(function($ctx1) {
  14585. $self._subclassResponsibility();
  14586. return self;
  14587. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14588. },
  14589. args: ["anIndex", "aBlock"],
  14590. 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",
  14591. referencedClasses: [],
  14592. pragmas: [],
  14593. messageSends: ["subclassResponsibility"]
  14594. }),
  14595. $globals.TKeyValueCollection);
  14596. $core.addMethod(
  14597. $core.method({
  14598. selector: "at:ifAbsentPut:",
  14599. protocol: "accessing",
  14600. fn: function (aKey,aBlock){
  14601. var self=this,$self=this;
  14602. return $core.withContext(function($ctx1) {
  14603. return $self._at_ifAbsent_(aKey,(function(){
  14604. return $core.withContext(function($ctx2) {
  14605. return $self._at_put_(aKey,$recv(aBlock)._value());
  14606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14607. }));
  14608. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  14609. },
  14610. args: ["aKey", "aBlock"],
  14611. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  14612. referencedClasses: [],
  14613. pragmas: [],
  14614. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  14615. }),
  14616. $globals.TKeyValueCollection);
  14617. $core.addMethod(
  14618. $core.method({
  14619. selector: "at:ifPresent:",
  14620. protocol: "accessing",
  14621. fn: function (anIndex,aBlock){
  14622. var self=this,$self=this;
  14623. return $core.withContext(function($ctx1) {
  14624. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  14625. return nil;
  14626. }));
  14627. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  14628. },
  14629. args: ["anIndex", "aBlock"],
  14630. 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 ]",
  14631. referencedClasses: [],
  14632. pragmas: [],
  14633. messageSends: ["at:ifPresent:ifAbsent:"]
  14634. }),
  14635. $globals.TKeyValueCollection);
  14636. $core.addMethod(
  14637. $core.method({
  14638. selector: "at:ifPresent:ifAbsent:",
  14639. protocol: "accessing",
  14640. fn: function (anIndex,aBlock,anotherBlock){
  14641. var self=this,$self=this;
  14642. return $core.withContext(function($ctx1) {
  14643. $self._subclassResponsibility();
  14644. return self;
  14645. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14646. },
  14647. args: ["anIndex", "aBlock", "anotherBlock"],
  14648. 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",
  14649. referencedClasses: [],
  14650. pragmas: [],
  14651. messageSends: ["subclassResponsibility"]
  14652. }),
  14653. $globals.TKeyValueCollection);
  14654. $core.addMethod(
  14655. $core.method({
  14656. selector: "at:put:",
  14657. protocol: "accessing",
  14658. fn: function (anIndex,anObject){
  14659. var self=this,$self=this;
  14660. return $core.withContext(function($ctx1) {
  14661. $self._subclassResponsibility();
  14662. return self;
  14663. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  14664. },
  14665. args: ["anIndex", "anObject"],
  14666. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  14667. referencedClasses: [],
  14668. pragmas: [],
  14669. messageSends: ["subclassResponsibility"]
  14670. }),
  14671. $globals.TKeyValueCollection);
  14672. $core.addMethod(
  14673. $core.method({
  14674. selector: "indexOf:",
  14675. protocol: "accessing",
  14676. fn: function (anObject){
  14677. var self=this,$self=this;
  14678. return $core.withContext(function($ctx1) {
  14679. return $self._indexOf_ifAbsent_(anObject,(function(){
  14680. return $core.withContext(function($ctx2) {
  14681. return $self._errorNotFound();
  14682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14683. }));
  14684. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  14685. },
  14686. args: ["anObject"],
  14687. 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 ]",
  14688. referencedClasses: [],
  14689. pragmas: [],
  14690. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14691. }),
  14692. $globals.TKeyValueCollection);
  14693. $core.addMethod(
  14694. $core.method({
  14695. selector: "indexOf:ifAbsent:",
  14696. protocol: "accessing",
  14697. fn: function (anObject,aBlock){
  14698. var self=this,$self=this;
  14699. return $core.withContext(function($ctx1) {
  14700. $self._subclassResponsibility();
  14701. return self;
  14702. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14703. },
  14704. args: ["anObject", "aBlock"],
  14705. 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",
  14706. referencedClasses: [],
  14707. pragmas: [],
  14708. messageSends: ["subclassResponsibility"]
  14709. }),
  14710. $globals.TKeyValueCollection);
  14711. $core.addMethod(
  14712. $core.method({
  14713. selector: "with:do:",
  14714. protocol: "enumerating",
  14715. fn: function (anotherCollection,aBlock){
  14716. var self=this,$self=this;
  14717. return $core.withContext(function($ctx1) {
  14718. $self._withIndexDo_((function(each,index){
  14719. return $core.withContext(function($ctx2) {
  14720. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14721. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14722. }));
  14723. return self;
  14724. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14725. },
  14726. args: ["anotherCollection", "aBlock"],
  14727. 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) ]",
  14728. referencedClasses: [],
  14729. pragmas: [],
  14730. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14731. }),
  14732. $globals.TKeyValueCollection);
  14733. $core.addMethod(
  14734. $core.method({
  14735. selector: "withIndexDo:",
  14736. protocol: "enumerating",
  14737. fn: function (aBlock){
  14738. var self=this,$self=this;
  14739. return $core.withContext(function($ctx1) {
  14740. $self._subclassResponsibility();
  14741. return self;
  14742. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14743. },
  14744. args: ["aBlock"],
  14745. 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",
  14746. referencedClasses: [],
  14747. pragmas: [],
  14748. messageSends: ["subclassResponsibility"]
  14749. }),
  14750. $globals.TKeyValueCollection);
  14751. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14752. $core.addMethod(
  14753. $core.method({
  14754. selector: "at:ifAbsent:",
  14755. protocol: "accessing",
  14756. fn: function (anIndex,aBlock){
  14757. var self=this,$self=this;
  14758. return $core.withContext(function($ctx1) {
  14759. return anIndex >= 1 && anIndex <= self.length
  14760. ? self[anIndex - 1]
  14761. : aBlock._value()
  14762. ;
  14763. return self;
  14764. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14765. },
  14766. args: ["anIndex", "aBlock"],
  14767. 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'>",
  14768. referencedClasses: [],
  14769. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  14770. messageSends: []
  14771. }),
  14772. $globals.TNativeZeroBasedCollection);
  14773. $core.addMethod(
  14774. $core.method({
  14775. selector: "at:ifPresent:ifAbsent:",
  14776. protocol: "accessing",
  14777. fn: function (anIndex,aBlock,anotherBlock){
  14778. var self=this,$self=this;
  14779. return $core.withContext(function($ctx1) {
  14780. return anIndex >= 1 && anIndex <= self.length
  14781. ? aBlock._value_(self[anIndex - 1])
  14782. : anotherBlock._value()
  14783. ;
  14784. return self;
  14785. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14786. },
  14787. args: ["anIndex", "aBlock", "anotherBlock"],
  14788. 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'>",
  14789. referencedClasses: [],
  14790. pragmas: [["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"]]],
  14791. messageSends: []
  14792. }),
  14793. $globals.TNativeZeroBasedCollection);
  14794. $core.addMethod(
  14795. $core.method({
  14796. selector: "detect:ifNone:",
  14797. protocol: "enumerating",
  14798. fn: function (aBlock,anotherBlock){
  14799. var self=this,$self=this;
  14800. return $core.withContext(function($ctx1) {
  14801. for(var i = 0; i < self.length; i++)
  14802. if(aBlock._value_(self[i]))
  14803. return self[i];
  14804. return anotherBlock._value();
  14805. ;
  14806. return self;
  14807. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  14808. },
  14809. args: ["aBlock", "anotherBlock"],
  14810. 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'>",
  14811. referencedClasses: [],
  14812. pragmas: [["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"]]],
  14813. messageSends: []
  14814. }),
  14815. $globals.TNativeZeroBasedCollection);
  14816. $core.addMethod(
  14817. $core.method({
  14818. selector: "do:",
  14819. protocol: "enumerating",
  14820. fn: function (aBlock){
  14821. var self=this,$self=this;
  14822. return $core.withContext(function($ctx1) {
  14823. for(var i=0; i < self.length; i++) {
  14824. aBlock._value_(self[i]);
  14825. }
  14826. ;
  14827. return self;
  14828. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  14829. },
  14830. args: ["aBlock"],
  14831. 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'>",
  14832. referencedClasses: [],
  14833. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  14834. messageSends: []
  14835. }),
  14836. $globals.TNativeZeroBasedCollection);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "indexOf:ifAbsent:",
  14840. protocol: "accessing",
  14841. fn: function (anObject,aBlock){
  14842. var self=this,$self=this;
  14843. return $core.withContext(function($ctx1) {
  14844. for(var i=0; i < self.length; i++) {
  14845. if($recv(self[i]).__eq(anObject)) {return i+1}
  14846. };
  14847. return aBlock._value();
  14848. ;
  14849. return self;
  14850. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14851. },
  14852. args: ["anObject", "aBlock"],
  14853. 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'>",
  14854. referencedClasses: [],
  14855. pragmas: [["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"]]],
  14856. messageSends: []
  14857. }),
  14858. $globals.TNativeZeroBasedCollection);
  14859. $core.addMethod(
  14860. $core.method({
  14861. selector: "indexOf:startingAt:ifAbsent:",
  14862. protocol: "accessing",
  14863. fn: function (anObject,start,aBlock){
  14864. var self=this,$self=this;
  14865. return $core.withContext(function($ctx1) {
  14866. for(var i=start - 1; i < self.length; i++){
  14867. if($recv(self[i]).__eq(anObject)) {return i+1}
  14868. }
  14869. return aBlock._value();
  14870. ;
  14871. return self;
  14872. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  14873. },
  14874. args: ["anObject", "start", "aBlock"],
  14875. 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'>",
  14876. referencedClasses: [],
  14877. pragmas: [["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"]]],
  14878. messageSends: []
  14879. }),
  14880. $globals.TNativeZeroBasedCollection);
  14881. $core.addMethod(
  14882. $core.method({
  14883. selector: "single",
  14884. protocol: "accessing",
  14885. fn: function (){
  14886. var self=this,$self=this;
  14887. return $core.withContext(function($ctx1) {
  14888. if (self.length == 0) throw new Error("Collection is empty");
  14889. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14890. return self[0];;
  14891. return self;
  14892. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  14893. },
  14894. args: [],
  14895. 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'>",
  14896. referencedClasses: [],
  14897. pragmas: [["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];"]]],
  14898. messageSends: []
  14899. }),
  14900. $globals.TNativeZeroBasedCollection);
  14901. $core.addMethod(
  14902. $core.method({
  14903. selector: "size",
  14904. protocol: "accessing",
  14905. fn: function (){
  14906. var self=this,$self=this;
  14907. return $core.withContext(function($ctx1) {
  14908. return self.length;
  14909. return self;
  14910. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  14911. },
  14912. args: [],
  14913. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14914. referencedClasses: [],
  14915. pragmas: [["inlineJS:", ["return self.length"]]],
  14916. messageSends: []
  14917. }),
  14918. $globals.TNativeZeroBasedCollection);
  14919. $core.addMethod(
  14920. $core.method({
  14921. selector: "with:do:",
  14922. protocol: "enumerating",
  14923. fn: function (anotherCollection,aBlock){
  14924. var self=this,$self=this;
  14925. return $core.withContext(function($ctx1) {
  14926. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14927. for(var i=0; i<self.length; i++) {
  14928. aBlock._value_value_(self[i], anotherCollection[i]);
  14929. }
  14930. ;
  14931. return self;
  14932. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14933. },
  14934. args: ["anotherCollection", "aBlock"],
  14935. 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'>",
  14936. referencedClasses: [],
  14937. pragmas: [["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"]]],
  14938. messageSends: []
  14939. }),
  14940. $globals.TNativeZeroBasedCollection);
  14941. $core.addMethod(
  14942. $core.method({
  14943. selector: "withIndexDo:",
  14944. protocol: "enumerating",
  14945. fn: function (aBlock){
  14946. var self=this,$self=this;
  14947. return $core.withContext(function($ctx1) {
  14948. for(var i=0; i < self.length; i++) {
  14949. aBlock._value_value_(self[i], i+1);
  14950. }
  14951. ;
  14952. return self;
  14953. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14954. },
  14955. args: ["aBlock"],
  14956. 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'>",
  14957. referencedClasses: [],
  14958. pragmas: [["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"]]],
  14959. messageSends: []
  14960. }),
  14961. $globals.TNativeZeroBasedCollection);
  14962. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14963. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14964. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14965. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14966. });
  14967. define('amber/core/Kernel-Classes',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Helpers", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  14968. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14969. var $pkg = $core.addPackage("Kernel-Classes");
  14970. $pkg.innerEval = function (expr) { return eval(expr); };
  14971. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  14972. $core.addClass("Behavior", $globals.Object, ["organization", "slots", "fn", "superclass"], "Kernel-Classes");
  14973. $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.";
  14974. $core.addMethod(
  14975. $core.method({
  14976. selector: "allInstanceVariableNames",
  14977. protocol: "accessing",
  14978. fn: function (){
  14979. var self=this,$self=this;
  14980. var result;
  14981. return $core.withContext(function($ctx1) {
  14982. var $1,$receiver;
  14983. result=$recv($self._instanceVariableNames())._copy();
  14984. $1=$self._superclass();
  14985. $ctx1.sendIdx["superclass"]=1;
  14986. if(($receiver = $1) == null || $receiver.a$nil){
  14987. $1;
  14988. } else {
  14989. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14990. }
  14991. return result;
  14992. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result})});
  14993. },
  14994. args: [],
  14995. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14996. referencedClasses: [],
  14997. pragmas: [],
  14998. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14999. }),
  15000. $globals.Behavior);
  15001. $core.addMethod(
  15002. $core.method({
  15003. selector: "allSelectors",
  15004. protocol: "accessing",
  15005. fn: function (){
  15006. var self=this,$self=this;
  15007. return $core.withContext(function($ctx1) {
  15008. var $1,$2;
  15009. $1=$self._allSuperclasses();
  15010. $2=$self._selectors();
  15011. $ctx1.sendIdx["selectors"]=1;
  15012. return $recv($1)._inject_into_($2,(function(acc,each){
  15013. return $core.withContext(function($ctx2) {
  15014. $recv(acc)._addAll_($recv(each)._selectors());
  15015. return $recv(acc)._yourself();
  15016. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  15017. }));
  15018. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  15019. },
  15020. args: [],
  15021. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  15022. referencedClasses: [],
  15023. pragmas: [],
  15024. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  15025. }),
  15026. $globals.Behavior);
  15027. $core.addMethod(
  15028. $core.method({
  15029. selector: "allSubclasses",
  15030. protocol: "accessing",
  15031. fn: function (){
  15032. var self=this,$self=this;
  15033. return $core.withContext(function($ctx1) {
  15034. return $recv($globals.Array)._streamContents_((function(str){
  15035. return $core.withContext(function($ctx2) {
  15036. return $self._allSubclassesDo_((function(each){
  15037. return $core.withContext(function($ctx3) {
  15038. return $recv(str)._nextPut_(each);
  15039. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  15040. }));
  15041. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  15042. }));
  15043. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{})});
  15044. },
  15045. args: [],
  15046. 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 ] ]",
  15047. referencedClasses: ["Array"],
  15048. pragmas: [],
  15049. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  15050. }),
  15051. $globals.Behavior);
  15052. $core.addMethod(
  15053. $core.method({
  15054. selector: "allSubclassesDo:",
  15055. protocol: "enumerating",
  15056. fn: function (aBlock){
  15057. var self=this,$self=this;
  15058. return $core.withContext(function($ctx1) {
  15059. $core.traverseClassTree(self, function(subclass) {
  15060. if (subclass !== self) aBlock._value_(subclass);
  15061. });
  15062. return self;
  15063. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock})});
  15064. },
  15065. args: ["aBlock"],
  15066. 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})'>",
  15067. referencedClasses: [],
  15068. pragmas: [["inlineJS:", ["$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})"]]],
  15069. messageSends: []
  15070. }),
  15071. $globals.Behavior);
  15072. $core.addMethod(
  15073. $core.method({
  15074. selector: "allSuperclasses",
  15075. protocol: "accessing",
  15076. fn: function (){
  15077. var self=this,$self=this;
  15078. return $core.withContext(function($ctx1) {
  15079. var $1,$3,$2,$receiver;
  15080. $1=$self._superclass();
  15081. $ctx1.sendIdx["superclass"]=1;
  15082. if(($receiver = $1) == null || $receiver.a$nil){
  15083. return [];
  15084. } else {
  15085. $1;
  15086. }
  15087. $3=$self._superclass();
  15088. $ctx1.sendIdx["superclass"]=2;
  15089. $2=$recv($globals.OrderedCollection)._with_($3);
  15090. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  15091. return $recv($2)._yourself();
  15092. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{})});
  15093. },
  15094. args: [],
  15095. 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",
  15096. referencedClasses: ["OrderedCollection"],
  15097. pragmas: [],
  15098. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  15099. }),
  15100. $globals.Behavior);
  15101. $core.addMethod(
  15102. $core.method({
  15103. selector: "basicNew",
  15104. protocol: "instance creation",
  15105. fn: function (){
  15106. var self=this,$self=this;
  15107. return $core.withContext(function($ctx1) {
  15108. return new self.fn();
  15109. return self;
  15110. }, function($ctx1) {$ctx1.fill(self,"basicNew",{})});
  15111. },
  15112. args: [],
  15113. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  15114. referencedClasses: [],
  15115. pragmas: [["inlineJS:", ["return new self.fn()"]]],
  15116. messageSends: []
  15117. }),
  15118. $globals.Behavior);
  15119. $core.addMethod(
  15120. $core.method({
  15121. selector: "basicOrganization",
  15122. protocol: "accessing",
  15123. fn: function (){
  15124. var self=this,$self=this;
  15125. return $self.organization;
  15126. },
  15127. args: [],
  15128. source: "basicOrganization\x0a\x09^ organization",
  15129. referencedClasses: [],
  15130. pragmas: [],
  15131. messageSends: []
  15132. }),
  15133. $globals.Behavior);
  15134. $core.addMethod(
  15135. $core.method({
  15136. selector: "basicOrganization:",
  15137. protocol: "accessing",
  15138. fn: function (aClassOrganizer){
  15139. var self=this,$self=this;
  15140. $self.organization=aClassOrganizer;
  15141. return self;
  15142. },
  15143. args: ["aClassOrganizer"],
  15144. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  15145. referencedClasses: [],
  15146. pragmas: [],
  15147. messageSends: []
  15148. }),
  15149. $globals.Behavior);
  15150. $core.addMethod(
  15151. $core.method({
  15152. selector: "canUnderstand:",
  15153. protocol: "testing",
  15154. fn: function (aSelector){
  15155. var self=this,$self=this;
  15156. return $core.withContext(function($ctx1) {
  15157. var $2,$1;
  15158. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  15159. return $core.withContext(function($ctx2) {
  15160. $2=$self._superclass();
  15161. $ctx2.sendIdx["superclass"]=1;
  15162. $1=$recv($2)._notNil();
  15163. return $recv($1)._and_((function(){
  15164. return $core.withContext(function($ctx3) {
  15165. return $recv($self._superclass())._canUnderstand_(aSelector);
  15166. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  15167. }));
  15168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15169. }));
  15170. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector})});
  15171. },
  15172. args: ["aSelector"],
  15173. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  15174. referencedClasses: [],
  15175. pragmas: [],
  15176. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  15177. }),
  15178. $globals.Behavior);
  15179. $core.addMethod(
  15180. $core.method({
  15181. selector: "includesBehavior:",
  15182. protocol: "testing",
  15183. fn: function (aClass){
  15184. var self=this,$self=this;
  15185. return $core.withContext(function($ctx1) {
  15186. return $recv($self.__eq_eq(aClass))._or_((function(){
  15187. return $core.withContext(function($ctx2) {
  15188. return $self._inheritsFrom_(aClass);
  15189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15190. }));
  15191. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass})});
  15192. },
  15193. args: ["aClass"],
  15194. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  15195. referencedClasses: [],
  15196. pragmas: [],
  15197. messageSends: ["or:", "==", "inheritsFrom:"]
  15198. }),
  15199. $globals.Behavior);
  15200. $core.addMethod(
  15201. $core.method({
  15202. selector: "inheritsFrom:",
  15203. protocol: "testing",
  15204. fn: function (aClass){
  15205. var self=this,$self=this;
  15206. return $core.withContext(function($ctx1) {
  15207. var $1,$3,$2,$receiver;
  15208. $1=$self._superclass();
  15209. $ctx1.sendIdx["superclass"]=1;
  15210. if(($receiver = $1) == null || $receiver.a$nil){
  15211. return false;
  15212. } else {
  15213. $1;
  15214. }
  15215. $3=$self._superclass();
  15216. $ctx1.sendIdx["superclass"]=2;
  15217. $2=$recv(aClass).__eq_eq($3);
  15218. return $recv($2)._or_((function(){
  15219. return $core.withContext(function($ctx2) {
  15220. return $recv($self._superclass())._inheritsFrom_(aClass);
  15221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15222. }));
  15223. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass})});
  15224. },
  15225. args: ["aClass"],
  15226. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  15227. referencedClasses: [],
  15228. pragmas: [],
  15229. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  15230. }),
  15231. $globals.Behavior);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "instanceVariableNames",
  15235. protocol: "accessing",
  15236. fn: function (){
  15237. var self=this,$self=this;
  15238. return $self.slots;
  15239. },
  15240. args: [],
  15241. source: "instanceVariableNames\x0a\x09^ slots",
  15242. referencedClasses: [],
  15243. pragmas: [],
  15244. messageSends: []
  15245. }),
  15246. $globals.Behavior);
  15247. $core.addMethod(
  15248. $core.method({
  15249. selector: "isBehavior",
  15250. protocol: "testing",
  15251. fn: function (){
  15252. var self=this,$self=this;
  15253. return true;
  15254. },
  15255. args: [],
  15256. source: "isBehavior\x0a\x09^ true",
  15257. referencedClasses: [],
  15258. pragmas: [],
  15259. messageSends: []
  15260. }),
  15261. $globals.Behavior);
  15262. $core.addMethod(
  15263. $core.method({
  15264. selector: "javascriptConstructor",
  15265. protocol: "accessing",
  15266. fn: function (){
  15267. var self=this,$self=this;
  15268. return $self.fn;
  15269. },
  15270. args: [],
  15271. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See kernel-language.js\x22\x0a\x09\x0a\x09^ fn",
  15272. referencedClasses: [],
  15273. pragmas: [],
  15274. messageSends: []
  15275. }),
  15276. $globals.Behavior);
  15277. $core.addMethod(
  15278. $core.method({
  15279. selector: "javascriptConstructor:",
  15280. protocol: "accessing",
  15281. fn: function (aJavaScriptFunction){
  15282. var self=this,$self=this;
  15283. return $core.withContext(function($ctx1) {
  15284. $recv($recv($globals.Smalltalk)._core())._setClassConstructor_to_(self,aJavaScriptFunction);
  15285. return self;
  15286. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  15287. },
  15288. args: ["aJavaScriptFunction"],
  15289. 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\x09Smalltalk core setClassConstructor: self to: aJavaScriptFunction",
  15290. referencedClasses: ["Smalltalk"],
  15291. pragmas: [],
  15292. messageSends: ["setClassConstructor:to:", "core"]
  15293. }),
  15294. $globals.Behavior);
  15295. $core.addMethod(
  15296. $core.method({
  15297. selector: "lookupSelector:",
  15298. protocol: "accessing",
  15299. fn: function (selector){
  15300. var self=this,$self=this;
  15301. var lookupClass;
  15302. return $core.withContext(function($ctx1) {
  15303. var $1;
  15304. var $early={};
  15305. try {
  15306. lookupClass=self;
  15307. $recv((function(){
  15308. return $core.withContext(function($ctx2) {
  15309. return $recv(lookupClass).__eq(nil);
  15310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15311. }))._whileFalse_((function(){
  15312. return $core.withContext(function($ctx2) {
  15313. $1=$recv(lookupClass)._includesSelector_(selector);
  15314. if($core.assert($1)){
  15315. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  15316. }
  15317. lookupClass=$recv(lookupClass)._superclass();
  15318. return lookupClass;
  15319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15320. }));
  15321. return nil;
  15322. }
  15323. catch(e) {if(e===$early)return e[0]; throw e}
  15324. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass})});
  15325. },
  15326. args: ["selector"],
  15327. 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",
  15328. referencedClasses: [],
  15329. pragmas: [],
  15330. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  15331. }),
  15332. $globals.Behavior);
  15333. $core.addMethod(
  15334. $core.method({
  15335. selector: "new",
  15336. protocol: "instance creation",
  15337. fn: function (){
  15338. var self=this,$self=this;
  15339. return $core.withContext(function($ctx1) {
  15340. return $recv($self._basicNew())._initialize();
  15341. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  15342. },
  15343. args: [],
  15344. source: "new\x0a\x09^ self basicNew initialize",
  15345. referencedClasses: [],
  15346. pragmas: [],
  15347. messageSends: ["initialize", "basicNew"]
  15348. }),
  15349. $globals.Behavior);
  15350. $core.addMethod(
  15351. $core.method({
  15352. selector: "prototype",
  15353. protocol: "accessing",
  15354. fn: function (){
  15355. var self=this,$self=this;
  15356. return $core.withContext(function($ctx1) {
  15357. return $recv($self._javascriptConstructor())._prototype();
  15358. }, function($ctx1) {$ctx1.fill(self,"prototype",{})});
  15359. },
  15360. args: [],
  15361. source: "prototype\x0a\x09^ self javascriptConstructor prototype",
  15362. referencedClasses: [],
  15363. pragmas: [],
  15364. messageSends: ["prototype", "javascriptConstructor"]
  15365. }),
  15366. $globals.Behavior);
  15367. $core.addMethod(
  15368. $core.method({
  15369. selector: "subclasses",
  15370. protocol: "accessing",
  15371. fn: function (){
  15372. var self=this,$self=this;
  15373. return $core.withContext(function($ctx1) {
  15374. $self._subclassResponsibility();
  15375. return self;
  15376. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15377. },
  15378. args: [],
  15379. source: "subclasses\x0a\x09self subclassResponsibility",
  15380. referencedClasses: [],
  15381. pragmas: [],
  15382. messageSends: ["subclassResponsibility"]
  15383. }),
  15384. $globals.Behavior);
  15385. $core.addMethod(
  15386. $core.method({
  15387. selector: "superclass",
  15388. protocol: "accessing",
  15389. fn: function (){
  15390. var self=this,$self=this;
  15391. return $self.superclass;
  15392. },
  15393. args: [],
  15394. source: "superclass\x0a\x09^ superclass",
  15395. referencedClasses: [],
  15396. pragmas: [],
  15397. messageSends: []
  15398. }),
  15399. $globals.Behavior);
  15400. $core.addMethod(
  15401. $core.method({
  15402. selector: "theMetaClass",
  15403. protocol: "accessing",
  15404. fn: function (){
  15405. var self=this,$self=this;
  15406. return $core.withContext(function($ctx1) {
  15407. $self._subclassResponsibility();
  15408. return self;
  15409. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  15410. },
  15411. args: [],
  15412. source: "theMetaClass\x0a\x09self subclassResponsibility",
  15413. referencedClasses: [],
  15414. pragmas: [],
  15415. messageSends: ["subclassResponsibility"]
  15416. }),
  15417. $globals.Behavior);
  15418. $core.addMethod(
  15419. $core.method({
  15420. selector: "theNonMetaClass",
  15421. protocol: "accessing",
  15422. fn: function (){
  15423. var self=this,$self=this;
  15424. return $core.withContext(function($ctx1) {
  15425. $self._subclassResponsibility();
  15426. return self;
  15427. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15428. },
  15429. args: [],
  15430. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  15431. referencedClasses: [],
  15432. pragmas: [],
  15433. messageSends: ["subclassResponsibility"]
  15434. }),
  15435. $globals.Behavior);
  15436. $core.addMethod(
  15437. $core.method({
  15438. selector: "withAllSubclasses",
  15439. protocol: "accessing",
  15440. fn: function (){
  15441. var self=this,$self=this;
  15442. return $core.withContext(function($ctx1) {
  15443. var $1;
  15444. $1=$recv($globals.Array)._with_(self);
  15445. $recv($1)._addAll_($self._allSubclasses());
  15446. return $recv($1)._yourself();
  15447. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{})});
  15448. },
  15449. args: [],
  15450. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  15451. referencedClasses: ["Array"],
  15452. pragmas: [],
  15453. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  15454. }),
  15455. $globals.Behavior);
  15456. $core.addClass("Class", $globals.Behavior, ["package", "subclasses"], "Kernel-Classes");
  15457. $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.";
  15458. $core.addMethod(
  15459. $core.method({
  15460. selector: "basicPackage:",
  15461. protocol: "accessing",
  15462. fn: function (aPackage){
  15463. var self=this,$self=this;
  15464. $self.package=aPackage;
  15465. return self;
  15466. },
  15467. args: ["aPackage"],
  15468. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  15469. referencedClasses: [],
  15470. pragmas: [],
  15471. messageSends: []
  15472. }),
  15473. $globals.Class);
  15474. $core.addMethod(
  15475. $core.method({
  15476. selector: "classTag",
  15477. protocol: "accessing",
  15478. fn: function (){
  15479. var self=this,$self=this;
  15480. return "class";
  15481. },
  15482. args: [],
  15483. 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'",
  15484. referencedClasses: [],
  15485. pragmas: [],
  15486. messageSends: []
  15487. }),
  15488. $globals.Class);
  15489. $core.addMethod(
  15490. $core.method({
  15491. selector: "definition",
  15492. protocol: "accessing",
  15493. fn: function (){
  15494. var self=this,$self=this;
  15495. return $core.withContext(function($ctx1) {
  15496. var $1,$2;
  15497. return $recv($globals.String)._streamContents_((function(stream){
  15498. return $core.withContext(function($ctx2) {
  15499. $recv(stream)._print_($self._superclass());
  15500. $ctx2.sendIdx["print:"]=1;
  15501. $recv(stream)._write_(" subclass: ");
  15502. $ctx2.sendIdx["write:"]=1;
  15503. $recv(stream)._printSymbol_($self._name());
  15504. $recv(stream)._lf();
  15505. $ctx2.sendIdx["lf"]=1;
  15506. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15507. return $core.withContext(function($ctx3) {
  15508. $1=$recv($globals.String)._tab();
  15509. $ctx3.sendIdx["tab"]=1;
  15510. $2=$recv($globals.String)._lf();
  15511. $ctx3.sendIdx["lf"]=2;
  15512. return [$1,"uses: ",tcd,$2];
  15513. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15514. })));
  15515. $ctx2.sendIdx["write:"]=2;
  15516. $recv(stream)._tab();
  15517. $ctx2.sendIdx["tab"]=2;
  15518. $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15519. $ctx2.sendIdx["write:"]=3;
  15520. $recv(stream)._lf();
  15521. $recv(stream)._tab();
  15522. $recv(stream)._write_("package: ");
  15523. return $recv(stream)._print_($self._category());
  15524. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15525. }));
  15526. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15527. },
  15528. args: [],
  15529. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'}; lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  15530. referencedClasses: ["String"],
  15531. pragmas: [],
  15532. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "collect:", "instanceVariableNames", "category"]
  15533. }),
  15534. $globals.Class);
  15535. $core.addMethod(
  15536. $core.method({
  15537. selector: "includingPossibleMetaDo:",
  15538. protocol: "enumerating",
  15539. fn: function (aBlock){
  15540. var self=this,$self=this;
  15541. return $core.withContext(function($ctx1) {
  15542. $recv(aBlock)._value_(self);
  15543. $ctx1.sendIdx["value:"]=1;
  15544. $recv(aBlock)._value_($self._theMetaClass());
  15545. return self;
  15546. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  15547. },
  15548. args: ["aBlock"],
  15549. source: "includingPossibleMetaDo: aBlock\x0a\x0a\x09aBlock value: self.\x0a\x09aBlock value: self theMetaClass",
  15550. referencedClasses: [],
  15551. pragmas: [],
  15552. messageSends: ["value:", "theMetaClass"]
  15553. }),
  15554. $globals.Class);
  15555. $core.addMethod(
  15556. $core.method({
  15557. selector: "isClass",
  15558. protocol: "testing",
  15559. fn: function (){
  15560. var self=this,$self=this;
  15561. return true;
  15562. },
  15563. args: [],
  15564. source: "isClass\x0a\x09^ true",
  15565. referencedClasses: [],
  15566. pragmas: [],
  15567. messageSends: []
  15568. }),
  15569. $globals.Class);
  15570. $core.addMethod(
  15571. $core.method({
  15572. selector: "package",
  15573. protocol: "accessing",
  15574. fn: function (){
  15575. var self=this,$self=this;
  15576. return $self.package;
  15577. },
  15578. args: [],
  15579. source: "package\x0a\x09^ package",
  15580. referencedClasses: [],
  15581. pragmas: [],
  15582. messageSends: []
  15583. }),
  15584. $globals.Class);
  15585. $core.addMethod(
  15586. $core.method({
  15587. selector: "provided",
  15588. protocol: "converting",
  15589. fn: function (){
  15590. var self=this,$self=this;
  15591. return $core.withContext(function($ctx1) {
  15592. return $recv($self._javascriptConstructor())._provided();
  15593. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  15594. },
  15595. args: [],
  15596. 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",
  15597. referencedClasses: [],
  15598. pragmas: [],
  15599. messageSends: ["provided", "javascriptConstructor"]
  15600. }),
  15601. $globals.Class);
  15602. $core.addMethod(
  15603. $core.method({
  15604. selector: "rename:",
  15605. protocol: "accessing",
  15606. fn: function (aString){
  15607. var self=this,$self=this;
  15608. return $core.withContext(function($ctx1) {
  15609. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15610. return self;
  15611. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString})});
  15612. },
  15613. args: ["aString"],
  15614. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15615. referencedClasses: ["ClassBuilder"],
  15616. pragmas: [],
  15617. messageSends: ["renameClass:to:", "new"]
  15618. }),
  15619. $globals.Class);
  15620. $core.addMethod(
  15621. $core.method({
  15622. selector: "subclasses",
  15623. protocol: "accessing",
  15624. fn: function (){
  15625. var self=this,$self=this;
  15626. return $core.withContext(function($ctx1) {
  15627. return $recv($self.subclasses)._copy();
  15628. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15629. },
  15630. args: [],
  15631. source: "subclasses\x0a\x09^ subclasses copy",
  15632. referencedClasses: [],
  15633. pragmas: [],
  15634. messageSends: ["copy"]
  15635. }),
  15636. $globals.Class);
  15637. $core.addMethod(
  15638. $core.method({
  15639. selector: "theMetaClass",
  15640. protocol: "accessing",
  15641. fn: function (){
  15642. var self=this,$self=this;
  15643. return $core.withContext(function($ctx1) {
  15644. return $self._class();
  15645. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  15646. },
  15647. args: [],
  15648. source: "theMetaClass\x0a\x09^ self class",
  15649. referencedClasses: [],
  15650. pragmas: [],
  15651. messageSends: ["class"]
  15652. }),
  15653. $globals.Class);
  15654. $core.addClass("Metaclass", $globals.Behavior, ["instanceClass"], "Kernel-Classes");
  15655. $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.";
  15656. $core.addMethod(
  15657. $core.method({
  15658. selector: "asJavaScriptSource",
  15659. protocol: "converting",
  15660. fn: function (){
  15661. var self=this,$self=this;
  15662. return $core.withContext(function($ctx1) {
  15663. var $1;
  15664. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15665. $ctx1.sendIdx[","]=1;
  15666. return $1;
  15667. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  15668. },
  15669. args: [],
  15670. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15671. referencedClasses: [],
  15672. pragmas: [],
  15673. messageSends: [",", "name", "instanceClass"]
  15674. }),
  15675. $globals.Metaclass);
  15676. $core.addMethod(
  15677. $core.method({
  15678. selector: "definition",
  15679. protocol: "accessing",
  15680. fn: function (){
  15681. var self=this,$self=this;
  15682. return $core.withContext(function($ctx1) {
  15683. var $1,$2;
  15684. return $recv($globals.String)._streamContents_((function(stream){
  15685. return $core.withContext(function($ctx2) {
  15686. $recv(stream)._print_(self);
  15687. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15688. return " ";
  15689. }),(function(tcd){
  15690. return $core.withContext(function($ctx3) {
  15691. $1=$recv($globals.String)._lf();
  15692. $ctx3.sendIdx["lf"]=1;
  15693. $2=$recv($globals.String)._tab();
  15694. $ctx3.sendIdx["tab"]=1;
  15695. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15696. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15697. })));
  15698. $ctx2.sendIdx["write:"]=1;
  15699. return $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15700. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15701. }));
  15702. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15703. },
  15704. args: [],
  15705. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'} ]",
  15706. referencedClasses: ["String"],
  15707. pragmas: [],
  15708. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "collect:", "instanceVariableNames"]
  15709. }),
  15710. $globals.Metaclass);
  15711. $core.addMethod(
  15712. $core.method({
  15713. selector: "instanceClass",
  15714. protocol: "accessing",
  15715. fn: function (){
  15716. var self=this,$self=this;
  15717. return $self.instanceClass;
  15718. },
  15719. args: [],
  15720. source: "instanceClass\x0a\x09^ instanceClass",
  15721. referencedClasses: [],
  15722. pragmas: [],
  15723. messageSends: []
  15724. }),
  15725. $globals.Metaclass);
  15726. $core.addMethod(
  15727. $core.method({
  15728. selector: "instanceVariableNames:",
  15729. protocol: "accessing",
  15730. fn: function (aString){
  15731. var self=this,$self=this;
  15732. return $core.withContext(function($ctx1) {
  15733. return $self._slots_($recv(aString)._instanceVariablesStringAsSlotList());
  15734. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aString:aString})});
  15735. },
  15736. args: ["aString"],
  15737. source: "instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self slots: aString instanceVariablesStringAsSlotList",
  15738. referencedClasses: [],
  15739. pragmas: [],
  15740. messageSends: ["slots:", "instanceVariablesStringAsSlotList"]
  15741. }),
  15742. $globals.Metaclass);
  15743. $core.addMethod(
  15744. $core.method({
  15745. selector: "isMetaclass",
  15746. protocol: "testing",
  15747. fn: function (){
  15748. var self=this,$self=this;
  15749. return true;
  15750. },
  15751. args: [],
  15752. source: "isMetaclass\x0a\x09^ true",
  15753. referencedClasses: [],
  15754. pragmas: [],
  15755. messageSends: []
  15756. }),
  15757. $globals.Metaclass);
  15758. $core.addMethod(
  15759. $core.method({
  15760. selector: "name",
  15761. protocol: "accessing",
  15762. fn: function (){
  15763. var self=this,$self=this;
  15764. return $core.withContext(function($ctx1) {
  15765. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15766. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  15767. },
  15768. args: [],
  15769. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15770. referencedClasses: [],
  15771. pragmas: [],
  15772. messageSends: [",", "name", "instanceClass"]
  15773. }),
  15774. $globals.Metaclass);
  15775. $core.addMethod(
  15776. $core.method({
  15777. selector: "package",
  15778. protocol: "accessing",
  15779. fn: function (){
  15780. var self=this,$self=this;
  15781. return $core.withContext(function($ctx1) {
  15782. return $recv($self._instanceClass())._package();
  15783. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  15784. },
  15785. args: [],
  15786. source: "package\x0a\x09^ self instanceClass package",
  15787. referencedClasses: [],
  15788. pragmas: [],
  15789. messageSends: ["package", "instanceClass"]
  15790. }),
  15791. $globals.Metaclass);
  15792. $core.addMethod(
  15793. $core.method({
  15794. selector: "slots:",
  15795. protocol: "accessing",
  15796. fn: function (aCollection){
  15797. var self=this,$self=this;
  15798. return $core.withContext(function($ctx1) {
  15799. $recv($recv($globals.ClassBuilder)._new())._class_slots_(self,aCollection);
  15800. return self;
  15801. }, function($ctx1) {$ctx1.fill(self,"slots:",{aCollection:aCollection})});
  15802. },
  15803. args: ["aCollection"],
  15804. source: "slots: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self slots: aCollection.\x0a\x09^ self",
  15805. referencedClasses: ["ClassBuilder"],
  15806. pragmas: [],
  15807. messageSends: ["class:slots:", "new"]
  15808. }),
  15809. $globals.Metaclass);
  15810. $core.addMethod(
  15811. $core.method({
  15812. selector: "subclasses",
  15813. protocol: "accessing",
  15814. fn: function (){
  15815. var self=this,$self=this;
  15816. return $core.withContext(function($ctx1) {
  15817. return $recv($recv($globals.Smalltalk)._core())._metaSubclasses_(self);
  15818. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15819. },
  15820. args: [],
  15821. source: "subclasses\x0a\x09^ Smalltalk core metaSubclasses: self",
  15822. referencedClasses: ["Smalltalk"],
  15823. pragmas: [],
  15824. messageSends: ["metaSubclasses:", "core"]
  15825. }),
  15826. $globals.Metaclass);
  15827. $core.addMethod(
  15828. $core.method({
  15829. selector: "theMetaClass",
  15830. protocol: "accessing",
  15831. fn: function (){
  15832. var self=this,$self=this;
  15833. return self;
  15834. },
  15835. args: [],
  15836. source: "theMetaClass\x0a\x09^ self",
  15837. referencedClasses: [],
  15838. pragmas: [],
  15839. messageSends: []
  15840. }),
  15841. $globals.Metaclass);
  15842. $core.addMethod(
  15843. $core.method({
  15844. selector: "theNonMetaClass",
  15845. protocol: "accessing",
  15846. fn: function (){
  15847. var self=this,$self=this;
  15848. return $core.withContext(function($ctx1) {
  15849. return $self._instanceClass();
  15850. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15851. },
  15852. args: [],
  15853. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15854. referencedClasses: [],
  15855. pragmas: [],
  15856. messageSends: ["instanceClass"]
  15857. }),
  15858. $globals.Metaclass);
  15859. $core.addMethod(
  15860. $core.method({
  15861. selector: "uses:instanceVariableNames:",
  15862. protocol: "accessing",
  15863. fn: function (aTraitCompositionDescription,aString){
  15864. var self=this,$self=this;
  15865. return $core.withContext(function($ctx1) {
  15866. return $self._uses_slots_(aTraitCompositionDescription,$recv(aString)._instanceVariablesStringAsSlotList());
  15867. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aString:aString})});
  15868. },
  15869. args: ["aTraitCompositionDescription", "aString"],
  15870. source: "uses: aTraitCompositionDescription instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self uses: aTraitCompositionDescription slots: aString instanceVariablesStringAsSlotList",
  15871. referencedClasses: [],
  15872. pragmas: [],
  15873. messageSends: ["uses:slots:", "instanceVariablesStringAsSlotList"]
  15874. }),
  15875. $globals.Metaclass);
  15876. $core.addMethod(
  15877. $core.method({
  15878. selector: "uses:slots:",
  15879. protocol: "accessing",
  15880. fn: function (aTraitCompositionDescription,aCollection){
  15881. var self=this,$self=this;
  15882. return $core.withContext(function($ctx1) {
  15883. $self._slots_(aCollection);
  15884. $self._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15885. return self;
  15886. }, function($ctx1) {$ctx1.fill(self,"uses:slots:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  15887. },
  15888. args: ["aTraitCompositionDescription", "aCollection"],
  15889. source: "uses: aTraitCompositionDescription slots: aCollection\x0a\x09self\x0a\x09\x09slots: aCollection;\x0a\x09\x09setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ self",
  15890. referencedClasses: [],
  15891. pragmas: [],
  15892. messageSends: ["slots:", "setTraitComposition:", "asTraitComposition"]
  15893. }),
  15894. $globals.Metaclass);
  15895. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15896. $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:`.";
  15897. $core.addMethod(
  15898. $core.method({
  15899. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15900. protocol: "class definition",
  15901. fn: function (aClass,className,aCollection,packageName){
  15902. var self=this,$self=this;
  15903. var theClass,thePackage;
  15904. return $core.withContext(function($ctx1) {
  15905. var $1,$2,$3,$receiver;
  15906. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15907. thePackage=$recv($globals.Package)._named_(packageName);
  15908. $1=theClass;
  15909. if(($receiver = $1) == null || $receiver.a$nil){
  15910. $1;
  15911. } else {
  15912. $recv(theClass)._package_(thePackage);
  15913. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15914. if(!$core.assert($2)){
  15915. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15916. }
  15917. }
  15918. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15919. $recv($3)._recompile();
  15920. return $recv($3)._yourself();
  15921. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage})});
  15922. },
  15923. args: ["aClass", "className", "aCollection", "packageName"],
  15924. 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",
  15925. referencedClasses: ["Smalltalk", "Package"],
  15926. pragmas: [],
  15927. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15928. }),
  15929. $globals.ClassBuilder);
  15930. $core.addMethod(
  15931. $core.method({
  15932. selector: "addTraitNamed:package:",
  15933. protocol: "class definition",
  15934. fn: function (traitName,packageName){
  15935. var self=this,$self=this;
  15936. var theTrait,thePackage;
  15937. return $core.withContext(function($ctx1) {
  15938. var $1,$2,$receiver;
  15939. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15940. thePackage=$recv($globals.Package)._named_(packageName);
  15941. $1=theTrait;
  15942. if(($receiver = $1) == null || $receiver.a$nil){
  15943. $1;
  15944. } else {
  15945. $2=theTrait;
  15946. $recv($2)._package_(thePackage);
  15947. $recv($2)._recompile();
  15948. return $recv($2)._yourself();
  15949. }
  15950. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15951. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage})});
  15952. },
  15953. args: ["traitName", "packageName"],
  15954. 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",
  15955. referencedClasses: ["Smalltalk", "Package"],
  15956. pragmas: [],
  15957. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15958. }),
  15959. $globals.ClassBuilder);
  15960. $core.addMethod(
  15961. $core.method({
  15962. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15963. protocol: "private",
  15964. fn: function (aClass,aString,aCollection,packageName){
  15965. var self=this,$self=this;
  15966. return $core.withContext(function($ctx1) {
  15967. return $core.addClass(aString, aClass, aCollection, packageName);
  15968. ;
  15969. return self;
  15970. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName})});
  15971. },
  15972. args: ["aClass", "aString", "aCollection", "packageName"],
  15973. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15974. referencedClasses: [],
  15975. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09"]]],
  15976. messageSends: []
  15977. }),
  15978. $globals.ClassBuilder);
  15979. $core.addMethod(
  15980. $core.method({
  15981. selector: "basicAddTraitNamed:package:",
  15982. protocol: "private",
  15983. fn: function (aString,anotherString){
  15984. var self=this,$self=this;
  15985. return $core.withContext(function($ctx1) {
  15986. return $core.addTrait(aString, anotherString);
  15987. return self;
  15988. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString})});
  15989. },
  15990. args: ["aString", "anotherString"],
  15991. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15992. referencedClasses: [],
  15993. pragmas: [["inlineJS:", ["return $core.addTrait(aString, anotherString)"]]],
  15994. messageSends: []
  15995. }),
  15996. $globals.ClassBuilder);
  15997. $core.addMethod(
  15998. $core.method({
  15999. selector: "basicClass:instanceVariables:",
  16000. protocol: "private",
  16001. fn: function (aClass,aCollection){
  16002. var self=this,$self=this;
  16003. return $core.withContext(function($ctx1) {
  16004. var $1;
  16005. $1=$recv(aClass)._isMetaclass();
  16006. if(!$core.assert($1)){
  16007. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  16008. }
  16009. $recv($recv($globals.Smalltalk)._core())._setSlots_to_(aClass,aCollection);
  16010. return self;
  16011. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection})});
  16012. },
  16013. args: ["aClass", "aCollection"],
  16014. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09Smalltalk core setSlots: aClass to: aCollection",
  16015. referencedClasses: ["Smalltalk"],
  16016. pragmas: [],
  16017. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "setSlots:to:", "core"]
  16018. }),
  16019. $globals.ClassBuilder);
  16020. $core.addMethod(
  16021. $core.method({
  16022. selector: "basicRemoveClass:",
  16023. protocol: "private",
  16024. fn: function (aClass){
  16025. var self=this,$self=this;
  16026. return $core.withContext(function($ctx1) {
  16027. $core.removeClass(aClass);
  16028. return self;
  16029. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass})});
  16030. },
  16031. args: ["aClass"],
  16032. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  16033. referencedClasses: [],
  16034. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  16035. messageSends: []
  16036. }),
  16037. $globals.ClassBuilder);
  16038. $core.addMethod(
  16039. $core.method({
  16040. selector: "basicRenameClass:to:",
  16041. protocol: "private",
  16042. fn: function (aClass,aString){
  16043. var self=this,$self=this;
  16044. return $core.withContext(function($ctx1) {
  16045. $globals[aString] = aClass;
  16046. delete $globals[aClass.name];
  16047. aClass.name = aString;
  16048. ;
  16049. return self;
  16050. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString})});
  16051. },
  16052. args: ["aClass", "aString"],
  16053. 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'>",
  16054. referencedClasses: [],
  16055. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09"]]],
  16056. messageSends: []
  16057. }),
  16058. $globals.ClassBuilder);
  16059. $core.addMethod(
  16060. $core.method({
  16061. selector: "basicSwapClassNames:with:",
  16062. protocol: "private",
  16063. fn: function (aClass,anotherClass){
  16064. var self=this,$self=this;
  16065. return $core.withContext(function($ctx1) {
  16066. var tmp = aClass.name;
  16067. aClass.name = anotherClass.name;
  16068. anotherClass.name = tmp;
  16069. ;
  16070. return self;
  16071. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass})});
  16072. },
  16073. args: ["aClass", "anotherClass"],
  16074. 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'>",
  16075. referencedClasses: [],
  16076. pragmas: [["inlineJS:", ["\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09"]]],
  16077. messageSends: []
  16078. }),
  16079. $globals.ClassBuilder);
  16080. $core.addMethod(
  16081. $core.method({
  16082. selector: "class:slots:",
  16083. protocol: "class definition",
  16084. fn: function (aClass,aCollection){
  16085. var self=this,$self=this;
  16086. return $core.withContext(function($ctx1) {
  16087. var $1,$3,$2;
  16088. $self._basicClass_instanceVariables_(aClass,aCollection);
  16089. $1=$recv($globals.SystemAnnouncer)._current();
  16090. $3=$recv($globals.ClassDefinitionChanged)._new();
  16091. $recv($3)._theClass_(aClass);
  16092. $2=$recv($3)._yourself();
  16093. $recv($1)._announce_($2);
  16094. return self;
  16095. }, function($ctx1) {$ctx1.fill(self,"class:slots:",{aClass:aClass,aCollection:aCollection})});
  16096. },
  16097. args: ["aClass", "aCollection"],
  16098. source: "class: aClass slots: 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)",
  16099. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  16100. pragmas: [],
  16101. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  16102. }),
  16103. $globals.ClassBuilder);
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "copyClass:named:",
  16107. protocol: "copying",
  16108. fn: function (aClass,className){
  16109. var self=this,$self=this;
  16110. var newClass;
  16111. return $core.withContext(function($ctx1) {
  16112. var $1,$3,$2;
  16113. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  16114. $self._copyClass_to_(aClass,newClass);
  16115. $1=$recv($globals.SystemAnnouncer)._current();
  16116. $3=$recv($globals.ClassAdded)._new();
  16117. $recv($3)._theClass_(newClass);
  16118. $2=$recv($3)._yourself();
  16119. $recv($1)._announce_($2);
  16120. return newClass;
  16121. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass})});
  16122. },
  16123. args: ["aClass", "className"],
  16124. 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",
  16125. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  16126. pragmas: [],
  16127. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  16128. }),
  16129. $globals.ClassBuilder);
  16130. $core.addMethod(
  16131. $core.method({
  16132. selector: "copyClass:to:",
  16133. protocol: "copying",
  16134. fn: function (aClass,anotherClass){
  16135. var self=this,$self=this;
  16136. return $core.withContext(function($ctx1) {
  16137. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  16138. $recv(anotherClass)._comment_($recv(aClass)._comment());
  16139. $1=$recv(aClass)._methodDictionary();
  16140. $ctx1.sendIdx["methodDictionary"]=1;
  16141. $recv($1)._valuesDo_((function(each){
  16142. return $core.withContext(function($ctx2) {
  16143. $3=$recv(each)._origin();
  16144. $ctx2.sendIdx["origin"]=1;
  16145. $2=$recv($3).__eq(aClass);
  16146. $ctx2.sendIdx["="]=1;
  16147. if($core.assert($2)){
  16148. $4=$recv($globals.Compiler)._new();
  16149. $ctx2.sendIdx["new"]=1;
  16150. $5=$recv(each)._source();
  16151. $ctx2.sendIdx["source"]=1;
  16152. $6=$recv(each)._protocol();
  16153. $ctx2.sendIdx["protocol"]=1;
  16154. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  16155. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  16156. }
  16157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16158. }));
  16159. $ctx1.sendIdx["valuesDo:"]=1;
  16160. $7=$recv(aClass)._traitComposition();
  16161. $ctx1.sendIdx["traitComposition"]=1;
  16162. $recv(anotherClass)._setTraitComposition_($7);
  16163. $ctx1.sendIdx["setTraitComposition:"]=1;
  16164. $8=$recv(anotherClass)._class();
  16165. $ctx1.sendIdx["class"]=1;
  16166. $10=$recv(aClass)._class();
  16167. $ctx1.sendIdx["class"]=2;
  16168. $9=$recv($10)._instanceVariableNames();
  16169. $self._basicClass_instanceVariables_($8,$9);
  16170. $12=$recv(aClass)._class();
  16171. $ctx1.sendIdx["class"]=3;
  16172. $11=$recv($12)._methodDictionary();
  16173. $recv($11)._valuesDo_((function(each){
  16174. return $core.withContext(function($ctx2) {
  16175. $14=$recv(each)._origin();
  16176. $15=$recv(aClass)._class();
  16177. $ctx2.sendIdx["class"]=4;
  16178. $13=$recv($14).__eq($15);
  16179. if($core.assert($13)){
  16180. $16=$recv($globals.Compiler)._new();
  16181. $17=$recv(each)._source();
  16182. $18=$recv(anotherClass)._class();
  16183. $ctx2.sendIdx["class"]=5;
  16184. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  16185. }
  16186. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16187. }));
  16188. $19=$recv(anotherClass)._class();
  16189. $ctx1.sendIdx["class"]=6;
  16190. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  16191. return self;
  16192. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass})});
  16193. },
  16194. args: ["aClass", "anotherClass"],
  16195. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each origin = 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 origin = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  16196. referencedClasses: ["Compiler"],
  16197. pragmas: [],
  16198. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  16199. }),
  16200. $globals.ClassBuilder);
  16201. $core.addMethod(
  16202. $core.method({
  16203. selector: "migrateClass:superclass:",
  16204. protocol: "class migration",
  16205. fn: function (aClass,anotherClass){
  16206. var self=this,$self=this;
  16207. return $core.withContext(function($ctx1) {
  16208. var $1;
  16209. $1=$recv(aClass)._name();
  16210. $ctx1.sendIdx["name"]=1;
  16211. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  16212. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass})});
  16213. },
  16214. args: ["aClass", "anotherClass"],
  16215. 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",
  16216. referencedClasses: [],
  16217. pragmas: [],
  16218. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  16219. }),
  16220. $globals.ClassBuilder);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  16224. protocol: "class migration",
  16225. fn: function (className,aClass,aCollection,packageName){
  16226. var self=this,$self=this;
  16227. var oldClass,newClass,tmp;
  16228. return $core.withContext(function($ctx1) {
  16229. var $1,$3,$2;
  16230. tmp="new*".__comma(className);
  16231. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  16232. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  16233. $self._basicSwapClassNames_with_(oldClass,newClass);
  16234. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  16235. $recv((function(){
  16236. return $core.withContext(function($ctx2) {
  16237. return $self._copyClass_to_(oldClass,newClass);
  16238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16239. }))._on_do_($globals.Error,(function(exception){
  16240. return $core.withContext(function($ctx2) {
  16241. $self._basicSwapClassNames_with_(oldClass,newClass);
  16242. $self._basicRemoveClass_(newClass);
  16243. $ctx2.sendIdx["basicRemoveClass:"]=1;
  16244. return $recv(exception)._pass();
  16245. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  16246. }));
  16247. $self._rawRenameClass_to_(oldClass,tmp);
  16248. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  16249. $self._rawRenameClass_to_(newClass,className);
  16250. $recv($recv(oldClass)._subclasses())._do_((function(each){
  16251. return $core.withContext(function($ctx2) {
  16252. return $self._migrateClass_superclass_(each,newClass);
  16253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16254. }));
  16255. $self._basicRemoveClass_(oldClass);
  16256. $1=$recv($globals.SystemAnnouncer)._current();
  16257. $3=$recv($globals.ClassMigrated)._new();
  16258. $recv($3)._theClass_(newClass);
  16259. $recv($3)._oldClass_(oldClass);
  16260. $2=$recv($3)._yourself();
  16261. $recv($1)._announce_($2);
  16262. return newClass;
  16263. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp})});
  16264. },
  16265. args: ["className", "aClass", "aCollection", "packageName"],
  16266. 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",
  16267. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  16268. pragmas: [],
  16269. 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"]
  16270. }),
  16271. $globals.ClassBuilder);
  16272. $core.addMethod(
  16273. $core.method({
  16274. selector: "rawRenameClass:to:",
  16275. protocol: "private",
  16276. fn: function (aClass,aString){
  16277. var self=this,$self=this;
  16278. return $core.withContext(function($ctx1) {
  16279. $globals[aString] = aClass;
  16280. ;
  16281. return self;
  16282. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString})});
  16283. },
  16284. args: ["aClass", "aString"],
  16285. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  16286. referencedClasses: [],
  16287. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09"]]],
  16288. messageSends: []
  16289. }),
  16290. $globals.ClassBuilder);
  16291. $core.addMethod(
  16292. $core.method({
  16293. selector: "renameClass:to:",
  16294. protocol: "class migration",
  16295. fn: function (aClass,className){
  16296. var self=this,$self=this;
  16297. return $core.withContext(function($ctx1) {
  16298. var $1,$3,$2;
  16299. $self._basicRenameClass_to_(aClass,className);
  16300. $recv(aClass)._recompile();
  16301. $1=$recv($globals.SystemAnnouncer)._current();
  16302. $3=$recv($globals.ClassRenamed)._new();
  16303. $recv($3)._theClass_(aClass);
  16304. $2=$recv($3)._yourself();
  16305. $recv($1)._announce_($2);
  16306. return self;
  16307. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className})});
  16308. },
  16309. args: ["aClass", "className"],
  16310. 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)",
  16311. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  16312. pragmas: [],
  16313. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  16314. }),
  16315. $globals.ClassBuilder);
  16316. $core.addMethod(
  16317. $core.method({
  16318. selector: "superclass:subclass:",
  16319. protocol: "class definition",
  16320. fn: function (aClass,className){
  16321. var self=this,$self=this;
  16322. return $core.withContext(function($ctx1) {
  16323. return $self._superclass_subclass_slots_package_(aClass,className,[],nil);
  16324. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className})});
  16325. },
  16326. args: ["aClass", "className"],
  16327. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className slots: #() package: nil",
  16328. referencedClasses: [],
  16329. pragmas: [],
  16330. messageSends: ["superclass:subclass:slots:package:"]
  16331. }),
  16332. $globals.ClassBuilder);
  16333. $core.addMethod(
  16334. $core.method({
  16335. selector: "superclass:subclass:slots:package:",
  16336. protocol: "class definition",
  16337. fn: function (aClass,className,aCollection,packageName){
  16338. var self=this,$self=this;
  16339. var newClass;
  16340. return $core.withContext(function($ctx1) {
  16341. var $1,$2,$4,$3,$receiver;
  16342. if(($receiver = packageName) == null || $receiver.a$nil){
  16343. $1="unclassified";
  16344. } else {
  16345. $1=packageName;
  16346. }
  16347. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,$1);
  16348. $2=$recv($globals.SystemAnnouncer)._current();
  16349. $4=$recv($globals.ClassAdded)._new();
  16350. $recv($4)._theClass_(newClass);
  16351. $3=$recv($4)._yourself();
  16352. $recv($2)._announce_($3);
  16353. return newClass;
  16354. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,newClass:newClass})});
  16355. },
  16356. args: ["aClass", "className", "aCollection", "packageName"],
  16357. source: "superclass: aClass subclass: className slots: aCollection package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: aCollection\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",
  16358. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  16359. pragmas: [],
  16360. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  16361. }),
  16362. $globals.ClassBuilder);
  16363. $core.addMethod(
  16364. $core.method({
  16365. selector: "sortClasses:",
  16366. protocol: "as yet unclassified",
  16367. fn: function (aCollection){
  16368. var self=this,$self=this;
  16369. var root,members;
  16370. return $core.withContext(function($ctx1) {
  16371. var $1,$2,$3,$4,$5,$7,$6,$8,$receiver;
  16372. root=[nil,[]];
  16373. members=$recv($globals.HashedCollection)._new();
  16374. $recv(aCollection)._do_((function(each){
  16375. return $core.withContext(function($ctx2) {
  16376. $1=members;
  16377. $2=$recv(each)._name();
  16378. $ctx2.sendIdx["name"]=1;
  16379. return $recv($1)._at_put_($2,[each,[]]);
  16380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16381. }));
  16382. $ctx1.sendIdx["do:"]=1;
  16383. $recv($recv($recv(aCollection)._asArray())._sorted_((function(a,b){
  16384. return $core.withContext(function($ctx2) {
  16385. $3=$recv(a)._name();
  16386. $ctx2.sendIdx["name"]=2;
  16387. $4=$recv(b)._name();
  16388. $ctx2.sendIdx["name"]=3;
  16389. return $recv($3).__lt_eq($4);
  16390. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16391. })))._do_((function(each){
  16392. var target;
  16393. return $core.withContext(function($ctx2) {
  16394. $5=members;
  16395. $7=$recv(each)._superclass();
  16396. if(($receiver = $7) == null || $receiver.a$nil){
  16397. $6=$7;
  16398. } else {
  16399. var superklass;
  16400. superklass=$receiver;
  16401. $6=$recv(superklass)._name();
  16402. $ctx2.sendIdx["name"]=4;
  16403. }
  16404. target=$recv($5)._at_ifAbsent_($6,(function(){
  16405. return root;
  16406. }));
  16407. $8=$recv(target)._second();
  16408. $ctx2.sendIdx["second"]=1;
  16409. return $recv($8)._add_($recv(members)._at_($recv(each)._name()));
  16410. }, function($ctx2) {$ctx2.fillBlock({each:each,target:target},$ctx1,3)});
  16411. }));
  16412. return $recv(root)._second();
  16413. }, function($ctx1) {$ctx1.fill(self,"sortClasses:",{aCollection:aCollection,root:root,members:members})});
  16414. },
  16415. args: ["aCollection"],
  16416. source: "sortClasses: aCollection\x0a\x09| root members |\x0a\x09root := {nil. {}}.\x0a\x09members := HashedCollection new.\x0a\x09aCollection do: [ :each | members at: each name put: {each. {}} ].\x0a\x09(aCollection asArray sorted: [ :a :b | a name <= b name ]) do: [ :each |\x0a\x09\x09| target |\x0a\x09\x09target := members\x0a\x09\x09\x09at: (each superclass ifNotNil: [ :superklass | superklass name ])\x0a\x09\x09\x09ifAbsent: [ root ].\x0a\x09\x09target second add: (members at: each name) ].\x0a\x09^ root second",
  16417. referencedClasses: ["HashedCollection"],
  16418. pragmas: [],
  16419. messageSends: ["new", "do:", "at:put:", "name", "sorted:", "asArray", "<=", "at:ifAbsent:", "ifNotNil:", "superclass", "add:", "second", "at:"]
  16420. }),
  16421. $globals.ClassBuilder.a$cls);
  16422. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  16423. $core.addMethod(
  16424. $core.method({
  16425. selector: "allInstanceVariableNames",
  16426. protocol: "accessing",
  16427. fn: function (){
  16428. var self=this,$self=this;
  16429. return [];
  16430. },
  16431. args: [],
  16432. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  16433. referencedClasses: [],
  16434. pragmas: [],
  16435. messageSends: []
  16436. }),
  16437. $globals.TBehaviorDefaults);
  16438. $core.addMethod(
  16439. $core.method({
  16440. selector: "allSubclassesDo:",
  16441. protocol: "enumerating",
  16442. fn: function (aBlock){
  16443. var self=this,$self=this;
  16444. return self;
  16445. },
  16446. args: ["aBlock"],
  16447. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  16448. referencedClasses: [],
  16449. pragmas: [],
  16450. messageSends: []
  16451. }),
  16452. $globals.TBehaviorDefaults);
  16453. $core.addMethod(
  16454. $core.method({
  16455. selector: "includingPossibleMetaDo:",
  16456. protocol: "enumerating",
  16457. fn: function (aBlock){
  16458. var self=this,$self=this;
  16459. return $core.withContext(function($ctx1) {
  16460. $recv(aBlock)._value_(self);
  16461. return self;
  16462. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  16463. },
  16464. args: ["aBlock"],
  16465. source: "includingPossibleMetaDo: aBlock\x0a\x09\x22Default for non-classes.\x22\x0a\x09aBlock value: self",
  16466. referencedClasses: [],
  16467. pragmas: [],
  16468. messageSends: ["value:"]
  16469. }),
  16470. $globals.TBehaviorDefaults);
  16471. $core.addMethod(
  16472. $core.method({
  16473. selector: "name",
  16474. protocol: "accessing",
  16475. fn: function (){
  16476. var self=this,$self=this;
  16477. return nil;
  16478. },
  16479. args: [],
  16480. source: "name\x0a\x09^ nil",
  16481. referencedClasses: [],
  16482. pragmas: [],
  16483. messageSends: []
  16484. }),
  16485. $globals.TBehaviorDefaults);
  16486. $core.addMethod(
  16487. $core.method({
  16488. selector: "printOn:",
  16489. protocol: "printing",
  16490. fn: function (aStream){
  16491. var self=this,$self=this;
  16492. return $core.withContext(function($ctx1) {
  16493. var $1,$receiver;
  16494. $1=$self._name();
  16495. if(($receiver = $1) == null || $receiver.a$nil){
  16496. (
  16497. $ctx1.supercall = true,
  16498. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  16499. $ctx1.supercall = false;
  16500. } else {
  16501. var name;
  16502. name=$receiver;
  16503. $recv(aStream)._nextPutAll_(name);
  16504. }
  16505. return self;
  16506. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  16507. },
  16508. args: ["aStream"],
  16509. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16510. referencedClasses: [],
  16511. pragmas: [],
  16512. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16513. }),
  16514. $globals.TBehaviorDefaults);
  16515. $core.addMethod(
  16516. $core.method({
  16517. selector: "superclass",
  16518. protocol: "accessing",
  16519. fn: function (){
  16520. var self=this,$self=this;
  16521. return nil;
  16522. },
  16523. args: [],
  16524. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16525. referencedClasses: [],
  16526. pragmas: [],
  16527. messageSends: []
  16528. }),
  16529. $globals.TBehaviorDefaults);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "traitUsers",
  16533. protocol: "accessing",
  16534. fn: function (){
  16535. var self=this,$self=this;
  16536. return [];
  16537. },
  16538. args: [],
  16539. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16540. referencedClasses: [],
  16541. pragmas: [],
  16542. messageSends: []
  16543. }),
  16544. $globals.TBehaviorDefaults);
  16545. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16546. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16547. $core.addMethod(
  16548. $core.method({
  16549. selector: ">>",
  16550. protocol: "accessing",
  16551. fn: function (aString){
  16552. var self=this,$self=this;
  16553. return $core.withContext(function($ctx1) {
  16554. return $self._methodAt_(aString);
  16555. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString})});
  16556. },
  16557. args: ["aString"],
  16558. source: ">> aString\x0a\x09^ self methodAt: aString",
  16559. referencedClasses: [],
  16560. pragmas: [],
  16561. messageSends: ["methodAt:"]
  16562. }),
  16563. $globals.TBehaviorProvider);
  16564. $core.addMethod(
  16565. $core.method({
  16566. selector: "addCompiledMethod:",
  16567. protocol: "compiling",
  16568. fn: function (aMethod){
  16569. var self=this,$self=this;
  16570. var oldMethod,announcement;
  16571. return $core.withContext(function($ctx1) {
  16572. var $1,$2,$3,$receiver;
  16573. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16574. return nil;
  16575. }));
  16576. $self._basicAddCompiledMethod_(aMethod);
  16577. $1=oldMethod;
  16578. if(($receiver = $1) == null || $receiver.a$nil){
  16579. $2=$recv($globals.MethodAdded)._new();
  16580. $ctx1.sendIdx["new"]=1;
  16581. $recv($2)._method_(aMethod);
  16582. $ctx1.sendIdx["method:"]=1;
  16583. announcement=$recv($2)._yourself();
  16584. $ctx1.sendIdx["yourself"]=1;
  16585. } else {
  16586. $3=$recv($globals.MethodModified)._new();
  16587. $recv($3)._oldMethod_(oldMethod);
  16588. $recv($3)._method_(aMethod);
  16589. announcement=$recv($3)._yourself();
  16590. }
  16591. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16592. return self;
  16593. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement})});
  16594. },
  16595. args: ["aMethod"],
  16596. 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",
  16597. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16598. pragmas: [],
  16599. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16600. }),
  16601. $globals.TBehaviorProvider);
  16602. $core.addMethod(
  16603. $core.method({
  16604. selector: "basicAddCompiledMethod:",
  16605. protocol: "private",
  16606. fn: function (aMethod){
  16607. var self=this,$self=this;
  16608. return $core.withContext(function($ctx1) {
  16609. $core.addMethod(aMethod, self);
  16610. return self;
  16611. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod})});
  16612. },
  16613. args: ["aMethod"],
  16614. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16615. referencedClasses: [],
  16616. pragmas: [["inlineJS:", ["$core.addMethod(aMethod, self)"]]],
  16617. messageSends: []
  16618. }),
  16619. $globals.TBehaviorProvider);
  16620. $core.addMethod(
  16621. $core.method({
  16622. selector: "basicRemoveCompiledMethod:",
  16623. protocol: "private",
  16624. fn: function (aMethod){
  16625. var self=this,$self=this;
  16626. return $core.withContext(function($ctx1) {
  16627. $core.removeMethod(aMethod,self);
  16628. return self;
  16629. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod})});
  16630. },
  16631. args: ["aMethod"],
  16632. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16633. referencedClasses: [],
  16634. pragmas: [["inlineJS:", ["$core.removeMethod(aMethod,self)"]]],
  16635. messageSends: []
  16636. }),
  16637. $globals.TBehaviorProvider);
  16638. $core.addMethod(
  16639. $core.method({
  16640. selector: "compile:protocol:",
  16641. protocol: "compiling",
  16642. fn: function (aString,anotherString){
  16643. var self=this,$self=this;
  16644. return $core.withContext(function($ctx1) {
  16645. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16646. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString})});
  16647. },
  16648. args: ["aString", "anotherString"],
  16649. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16650. referencedClasses: ["Compiler"],
  16651. pragmas: [],
  16652. messageSends: ["install:forClass:protocol:", "new"]
  16653. }),
  16654. $globals.TBehaviorProvider);
  16655. $core.addMethod(
  16656. $core.method({
  16657. selector: "includesSelector:",
  16658. protocol: "testing",
  16659. fn: function (aString){
  16660. var self=this,$self=this;
  16661. return $core.withContext(function($ctx1) {
  16662. return $recv($self._methodDictionary())._includesKey_(aString);
  16663. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString})});
  16664. },
  16665. args: ["aString"],
  16666. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16667. referencedClasses: [],
  16668. pragmas: [],
  16669. messageSends: ["includesKey:", "methodDictionary"]
  16670. }),
  16671. $globals.TBehaviorProvider);
  16672. $core.addMethod(
  16673. $core.method({
  16674. selector: "methodAt:",
  16675. protocol: "accessing",
  16676. fn: function (aString){
  16677. var self=this,$self=this;
  16678. return $core.withContext(function($ctx1) {
  16679. return $recv($self._methodDictionary())._at_(aString);
  16680. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString})});
  16681. },
  16682. args: ["aString"],
  16683. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16684. referencedClasses: [],
  16685. pragmas: [],
  16686. messageSends: ["at:", "methodDictionary"]
  16687. }),
  16688. $globals.TBehaviorProvider);
  16689. $core.addMethod(
  16690. $core.method({
  16691. selector: "methodDictionary",
  16692. protocol: "accessing",
  16693. fn: function (){
  16694. var self=this,$self=this;
  16695. return $core.withContext(function($ctx1) {
  16696. var dict = $globals.HashedCollection._new();
  16697. var methods = self.methods;
  16698. Object.keys(methods).forEach(function(i) {
  16699. if(methods[i].selector) {
  16700. dict._at_put_(methods[i].selector, methods[i]);
  16701. }
  16702. });
  16703. return dict;
  16704. return self;
  16705. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{})});
  16706. },
  16707. args: [],
  16708. 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'>",
  16709. referencedClasses: [],
  16710. pragmas: [["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"]]],
  16711. messageSends: []
  16712. }),
  16713. $globals.TBehaviorProvider);
  16714. $core.addMethod(
  16715. $core.method({
  16716. selector: "methodOrganizationEnter:andLeave:",
  16717. protocol: "accessing",
  16718. fn: function (aMethod,oldMethod){
  16719. var self=this,$self=this;
  16720. return $core.withContext(function($ctx1) {
  16721. var $1,$2,$receiver;
  16722. if(($receiver = aMethod) == null || $receiver.a$nil){
  16723. aMethod;
  16724. } else {
  16725. $1=$self._organization();
  16726. $2=$recv(aMethod)._protocol();
  16727. $ctx1.sendIdx["protocol"]=1;
  16728. $recv($1)._addElement_($2);
  16729. }
  16730. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16731. oldMethod;
  16732. } else {
  16733. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16734. }
  16735. return self;
  16736. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod})});
  16737. },
  16738. args: ["aMethod", "oldMethod"],
  16739. 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 ]",
  16740. referencedClasses: [],
  16741. pragmas: [],
  16742. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16743. }),
  16744. $globals.TBehaviorProvider);
  16745. $core.addMethod(
  16746. $core.method({
  16747. selector: "methodTemplate",
  16748. protocol: "accessing",
  16749. fn: function (){
  16750. var self=this,$self=this;
  16751. return $core.withContext(function($ctx1) {
  16752. return $recv($globals.String)._streamContents_((function(stream){
  16753. return $core.withContext(function($ctx2) {
  16754. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16755. $ctx2.sendIdx["write:"]=1;
  16756. $recv(stream)._lf();
  16757. $ctx2.sendIdx["lf"]=1;
  16758. $recv(stream)._tab();
  16759. $ctx2.sendIdx["tab"]=1;
  16760. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16761. $ctx2.sendIdx["write:"]=2;
  16762. $recv(stream)._lf();
  16763. $ctx2.sendIdx["lf"]=2;
  16764. $recv(stream)._lf();
  16765. $ctx2.sendIdx["lf"]=3;
  16766. $recv(stream)._tab();
  16767. $ctx2.sendIdx["tab"]=2;
  16768. $recv(stream)._write_("| temporary variable names |");
  16769. $ctx2.sendIdx["write:"]=3;
  16770. $recv(stream)._lf();
  16771. $recv(stream)._tab();
  16772. return $recv(stream)._write_("statements");
  16773. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16774. }));
  16775. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{})});
  16776. },
  16777. args: [],
  16778. 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' ]",
  16779. referencedClasses: ["String"],
  16780. pragmas: [],
  16781. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16782. }),
  16783. $globals.TBehaviorProvider);
  16784. $core.addMethod(
  16785. $core.method({
  16786. selector: "methods",
  16787. protocol: "accessing",
  16788. fn: function (){
  16789. var self=this,$self=this;
  16790. return $core.withContext(function($ctx1) {
  16791. return $recv($self._methodDictionary())._values();
  16792. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  16793. },
  16794. args: [],
  16795. source: "methods\x0a\x09^ self methodDictionary values",
  16796. referencedClasses: [],
  16797. pragmas: [],
  16798. messageSends: ["values", "methodDictionary"]
  16799. }),
  16800. $globals.TBehaviorProvider);
  16801. $core.addMethod(
  16802. $core.method({
  16803. selector: "methodsInProtocol:",
  16804. protocol: "accessing",
  16805. fn: function (aString){
  16806. var self=this,$self=this;
  16807. return $core.withContext(function($ctx1) {
  16808. return $recv($self._methods())._select_((function(each){
  16809. return $core.withContext(function($ctx2) {
  16810. return $recv($recv(each)._protocol()).__eq(aString);
  16811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16812. }));
  16813. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString})});
  16814. },
  16815. args: ["aString"],
  16816. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16817. referencedClasses: [],
  16818. pragmas: [],
  16819. messageSends: ["select:", "methods", "=", "protocol"]
  16820. }),
  16821. $globals.TBehaviorProvider);
  16822. $core.addMethod(
  16823. $core.method({
  16824. selector: "organization",
  16825. protocol: "accessing",
  16826. fn: function (){
  16827. var self=this,$self=this;
  16828. return $core.withContext(function($ctx1) {
  16829. var $1,$receiver;
  16830. $1=$self._basicOrganization();
  16831. $ctx1.sendIdx["basicOrganization"]=1;
  16832. if(($receiver = $1) == null || $receiver.a$nil){
  16833. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16834. return $self._basicOrganization();
  16835. } else {
  16836. return $1;
  16837. }
  16838. }, function($ctx1) {$ctx1.fill(self,"organization",{})});
  16839. },
  16840. args: [],
  16841. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16842. referencedClasses: ["ClassOrganizer"],
  16843. pragmas: [],
  16844. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16845. }),
  16846. $globals.TBehaviorProvider);
  16847. $core.addMethod(
  16848. $core.method({
  16849. selector: "ownMethods",
  16850. protocol: "accessing",
  16851. fn: function (){
  16852. var self=this,$self=this;
  16853. return $core.withContext(function($ctx1) {
  16854. var $1;
  16855. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16856. return $core.withContext(function($ctx2) {
  16857. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16858. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16859. })))._sorted_((function(a,b){
  16860. return $core.withContext(function($ctx2) {
  16861. $1=$recv(a)._selector();
  16862. $ctx2.sendIdx["selector"]=1;
  16863. return $recv($1).__lt_eq($recv(b)._selector());
  16864. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16865. }));
  16866. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  16867. },
  16868. args: [],
  16869. 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 ]",
  16870. referencedClasses: ["OrderedCollection"],
  16871. pragmas: [],
  16872. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16873. }),
  16874. $globals.TBehaviorProvider);
  16875. $core.addMethod(
  16876. $core.method({
  16877. selector: "ownMethodsInProtocol:",
  16878. protocol: "accessing",
  16879. fn: function (aString){
  16880. var self=this,$self=this;
  16881. return $core.withContext(function($ctx1) {
  16882. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16883. return $core.withContext(function($ctx2) {
  16884. return $recv($recv(each)._origin()).__eq(self);
  16885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16886. }));
  16887. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString})});
  16888. },
  16889. args: ["aString"],
  16890. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each origin = self ]",
  16891. referencedClasses: [],
  16892. pragmas: [],
  16893. messageSends: ["select:", "methodsInProtocol:", "=", "origin"]
  16894. }),
  16895. $globals.TBehaviorProvider);
  16896. $core.addMethod(
  16897. $core.method({
  16898. selector: "ownProtocols",
  16899. protocol: "accessing",
  16900. fn: function (){
  16901. var self=this,$self=this;
  16902. return $core.withContext(function($ctx1) {
  16903. return $recv($self._protocols())._reject_((function(each){
  16904. return $core.withContext(function($ctx2) {
  16905. return $recv(each)._match_("^\x5c*");
  16906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16907. }));
  16908. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{})});
  16909. },
  16910. args: [],
  16911. 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*' ]",
  16912. referencedClasses: [],
  16913. pragmas: [],
  16914. messageSends: ["reject:", "protocols", "match:"]
  16915. }),
  16916. $globals.TBehaviorProvider);
  16917. $core.addMethod(
  16918. $core.method({
  16919. selector: "packageOfProtocol:",
  16920. protocol: "accessing",
  16921. fn: function (aString){
  16922. var self=this,$self=this;
  16923. return $core.withContext(function($ctx1) {
  16924. var $1;
  16925. $1=$recv(aString)._beginsWith_("*");
  16926. if(!$core.assert($1)){
  16927. return $self._package();
  16928. }
  16929. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16930. return nil;
  16931. }));
  16932. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString})});
  16933. },
  16934. args: ["aString"],
  16935. 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 ]",
  16936. referencedClasses: ["Package"],
  16937. pragmas: [],
  16938. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16939. }),
  16940. $globals.TBehaviorProvider);
  16941. $core.addMethod(
  16942. $core.method({
  16943. selector: "protocols",
  16944. protocol: "accessing",
  16945. fn: function (){
  16946. var self=this,$self=this;
  16947. return $core.withContext(function($ctx1) {
  16948. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16949. }, function($ctx1) {$ctx1.fill(self,"protocols",{})});
  16950. },
  16951. args: [],
  16952. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16953. referencedClasses: [],
  16954. pragmas: [],
  16955. messageSends: ["sorted", "asArray", "elements", "organization"]
  16956. }),
  16957. $globals.TBehaviorProvider);
  16958. $core.addMethod(
  16959. $core.method({
  16960. selector: "protocolsDo:",
  16961. protocol: "enumerating",
  16962. fn: function (aBlock){
  16963. var self=this,$self=this;
  16964. var methodsByProtocol;
  16965. return $core.withContext(function($ctx1) {
  16966. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16967. $ctx1.sendIdx["new"]=1;
  16968. $recv($self._methodDictionary())._valuesDo_((function(m){
  16969. return $core.withContext(function($ctx2) {
  16970. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16971. return $core.withContext(function($ctx3) {
  16972. return $recv($globals.Array)._new();
  16973. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16974. })))._add_(m);
  16975. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16976. }));
  16977. $recv($self._protocols())._do_((function(protocol){
  16978. return $core.withContext(function($ctx2) {
  16979. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16980. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16981. }));
  16982. return self;
  16983. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol})});
  16984. },
  16985. args: ["aBlock"],
  16986. 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) ]",
  16987. referencedClasses: ["HashedCollection", "Array"],
  16988. pragmas: [],
  16989. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16990. }),
  16991. $globals.TBehaviorProvider);
  16992. $core.addMethod(
  16993. $core.method({
  16994. selector: "recompile",
  16995. protocol: "compiling",
  16996. fn: function (){
  16997. var self=this,$self=this;
  16998. return $core.withContext(function($ctx1) {
  16999. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  17000. }, function($ctx1) {$ctx1.fill(self,"recompile",{})});
  17001. },
  17002. args: [],
  17003. source: "recompile\x0a\x09^ Compiler new recompile: self",
  17004. referencedClasses: ["Compiler"],
  17005. pragmas: [],
  17006. messageSends: ["recompile:", "new"]
  17007. }),
  17008. $globals.TBehaviorProvider);
  17009. $core.addMethod(
  17010. $core.method({
  17011. selector: "removeCompiledMethod:",
  17012. protocol: "compiling",
  17013. fn: function (aMethod){
  17014. var self=this,$self=this;
  17015. return $core.withContext(function($ctx1) {
  17016. var $1,$3,$2;
  17017. $self._basicRemoveCompiledMethod_(aMethod);
  17018. $1=$recv($globals.SystemAnnouncer)._current();
  17019. $3=$recv($globals.MethodRemoved)._new();
  17020. $recv($3)._method_(aMethod);
  17021. $2=$recv($3)._yourself();
  17022. $recv($1)._announce_($2);
  17023. return self;
  17024. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod})});
  17025. },
  17026. args: ["aMethod"],
  17027. 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)",
  17028. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  17029. pragmas: [],
  17030. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  17031. }),
  17032. $globals.TBehaviorProvider);
  17033. $core.addMethod(
  17034. $core.method({
  17035. selector: "removeProtocolIfEmpty:",
  17036. protocol: "accessing",
  17037. fn: function (aString){
  17038. var self=this,$self=this;
  17039. return $core.withContext(function($ctx1) {
  17040. $recv($self._methods())._detect_ifNone_((function(each){
  17041. return $core.withContext(function($ctx2) {
  17042. return $recv($recv(each)._protocol()).__eq(aString);
  17043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17044. }),(function(){
  17045. return $core.withContext(function($ctx2) {
  17046. return $recv($self._organization())._removeElement_(aString);
  17047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  17048. }));
  17049. return self;
  17050. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString})});
  17051. },
  17052. args: ["aString"],
  17053. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  17054. referencedClasses: [],
  17055. pragmas: [],
  17056. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  17057. }),
  17058. $globals.TBehaviorProvider);
  17059. $core.addMethod(
  17060. $core.method({
  17061. selector: "selectors",
  17062. protocol: "accessing",
  17063. fn: function (){
  17064. var self=this,$self=this;
  17065. return $core.withContext(function($ctx1) {
  17066. return $recv($self._methodDictionary())._keys();
  17067. }, function($ctx1) {$ctx1.fill(self,"selectors",{})});
  17068. },
  17069. args: [],
  17070. source: "selectors\x0a\x09^ self methodDictionary keys",
  17071. referencedClasses: [],
  17072. pragmas: [],
  17073. messageSends: ["keys", "methodDictionary"]
  17074. }),
  17075. $globals.TBehaviorProvider);
  17076. $core.addMethod(
  17077. $core.method({
  17078. selector: "setTraitComposition:",
  17079. protocol: "compiling",
  17080. fn: function (aTraitComposition){
  17081. var self=this,$self=this;
  17082. return $core.withContext(function($ctx1) {
  17083. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  17084. return self;
  17085. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition})});
  17086. },
  17087. args: ["aTraitComposition"],
  17088. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  17089. referencedClasses: [],
  17090. pragmas: [["inlineJS:", ["$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)"]]],
  17091. messageSends: []
  17092. }),
  17093. $globals.TBehaviorProvider);
  17094. $core.addMethod(
  17095. $core.method({
  17096. selector: "traitComposition",
  17097. protocol: "accessing",
  17098. fn: function (){
  17099. var self=this,$self=this;
  17100. return $core.withContext(function($ctx1) {
  17101. var $1,$receiver;
  17102. $1=$self._basicAt_("traitComposition");
  17103. if(($receiver = $1) == null || $receiver.a$nil){
  17104. return [];
  17105. } else {
  17106. var aCollection;
  17107. aCollection=$receiver;
  17108. return $recv(aCollection)._collect_((function(each){
  17109. return $core.withContext(function($ctx2) {
  17110. return $recv($globals.TraitTransformation)._fromJSON_(each);
  17111. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  17112. }));
  17113. }
  17114. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{})});
  17115. },
  17116. args: [],
  17117. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  17118. referencedClasses: ["TraitTransformation"],
  17119. pragmas: [],
  17120. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  17121. }),
  17122. $globals.TBehaviorProvider);
  17123. $core.addMethod(
  17124. $core.method({
  17125. selector: "traitCompositionDefinition",
  17126. protocol: "accessing",
  17127. fn: function (){
  17128. var self=this,$self=this;
  17129. return $core.withContext(function($ctx1) {
  17130. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  17131. return $core.withContext(function($ctx2) {
  17132. return $recv($globals.String)._streamContents_((function(str){
  17133. return $core.withContext(function($ctx3) {
  17134. $recv(str)._write_("{");
  17135. $ctx3.sendIdx["write:"]=1;
  17136. $recv(traitComposition)._do_separatedBy_((function(each){
  17137. return $core.withContext(function($ctx4) {
  17138. return $recv(str)._write_($recv(each)._definition());
  17139. $ctx4.sendIdx["write:"]=2;
  17140. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17141. }),(function(){
  17142. return $core.withContext(function($ctx4) {
  17143. return $recv(str)._write_(". ");
  17144. $ctx4.sendIdx["write:"]=3;
  17145. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17146. }));
  17147. return $recv(str)._write_("}");
  17148. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  17149. }));
  17150. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  17151. }));
  17152. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{})});
  17153. },
  17154. args: [],
  17155. 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: '}' ] ]",
  17156. referencedClasses: ["String"],
  17157. pragmas: [],
  17158. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  17159. }),
  17160. $globals.TBehaviorProvider);
  17161. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  17162. $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.";
  17163. $core.addMethod(
  17164. $core.method({
  17165. selector: "asJavaScriptSource",
  17166. protocol: "converting",
  17167. fn: function (){
  17168. var self=this,$self=this;
  17169. return $core.withContext(function($ctx1) {
  17170. return "$globals.".__comma($self._name());
  17171. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17172. },
  17173. args: [],
  17174. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  17175. referencedClasses: [],
  17176. pragmas: [],
  17177. messageSends: [",", "name"]
  17178. }),
  17179. $globals.TMasterBehavior);
  17180. $core.addMethod(
  17181. $core.method({
  17182. selector: "browse",
  17183. protocol: "browsing",
  17184. fn: function (){
  17185. var self=this,$self=this;
  17186. return $core.withContext(function($ctx1) {
  17187. $recv($globals.Finder)._findClass_(self);
  17188. return self;
  17189. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  17190. },
  17191. args: [],
  17192. source: "browse\x0a\x09Finder findClass: self",
  17193. referencedClasses: ["Finder"],
  17194. pragmas: [],
  17195. messageSends: ["findClass:"]
  17196. }),
  17197. $globals.TMasterBehavior);
  17198. $core.addMethod(
  17199. $core.method({
  17200. selector: "category",
  17201. protocol: "accessing",
  17202. fn: function (){
  17203. var self=this,$self=this;
  17204. return $core.withContext(function($ctx1) {
  17205. var $1,$receiver;
  17206. $1=$self._package();
  17207. $ctx1.sendIdx["package"]=1;
  17208. if(($receiver = $1) == null || $receiver.a$nil){
  17209. return "Unclassified";
  17210. } else {
  17211. return $recv($self._package())._name();
  17212. }
  17213. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  17214. },
  17215. args: [],
  17216. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  17217. referencedClasses: [],
  17218. pragmas: [],
  17219. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  17220. }),
  17221. $globals.TMasterBehavior);
  17222. $core.addMethod(
  17223. $core.method({
  17224. selector: "classTag",
  17225. protocol: "accessing",
  17226. fn: function (){
  17227. var self=this,$self=this;
  17228. return $core.withContext(function($ctx1) {
  17229. return $self._subclassResponsibility();
  17230. }, function($ctx1) {$ctx1.fill(self,"classTag",{})});
  17231. },
  17232. args: [],
  17233. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  17234. referencedClasses: [],
  17235. pragmas: [],
  17236. messageSends: ["subclassResponsibility"]
  17237. }),
  17238. $globals.TMasterBehavior);
  17239. $core.addMethod(
  17240. $core.method({
  17241. selector: "comment",
  17242. protocol: "accessing",
  17243. fn: function (){
  17244. var self=this,$self=this;
  17245. return $core.withContext(function($ctx1) {
  17246. var $1,$receiver;
  17247. $1=$self._basicAt_("comment");
  17248. if(($receiver = $1) == null || $receiver.a$nil){
  17249. return "";
  17250. } else {
  17251. return $1;
  17252. }
  17253. }, function($ctx1) {$ctx1.fill(self,"comment",{})});
  17254. },
  17255. args: [],
  17256. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  17257. referencedClasses: [],
  17258. pragmas: [],
  17259. messageSends: ["ifNil:", "basicAt:"]
  17260. }),
  17261. $globals.TMasterBehavior);
  17262. $core.addMethod(
  17263. $core.method({
  17264. selector: "comment:",
  17265. protocol: "accessing",
  17266. fn: function (aString){
  17267. var self=this,$self=this;
  17268. return $core.withContext(function($ctx1) {
  17269. var $1,$3,$2;
  17270. $self._basicAt_put_("comment",aString);
  17271. $1=$recv($globals.SystemAnnouncer)._current();
  17272. $3=$recv($globals.ClassCommentChanged)._new();
  17273. $recv($3)._theClass_(self);
  17274. $2=$recv($3)._yourself();
  17275. $recv($1)._announce_($2);
  17276. return self;
  17277. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString})});
  17278. },
  17279. args: ["aString"],
  17280. 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)",
  17281. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  17282. pragmas: [],
  17283. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  17284. }),
  17285. $globals.TMasterBehavior);
  17286. $core.addMethod(
  17287. $core.method({
  17288. selector: "definedMethods",
  17289. protocol: "accessing",
  17290. fn: function (){
  17291. var self=this,$self=this;
  17292. var methods;
  17293. return $core.withContext(function($ctx1) {
  17294. var $1,$receiver;
  17295. methods=$self._methods();
  17296. $ctx1.sendIdx["methods"]=1;
  17297. $1=$self._theMetaClass();
  17298. if(($receiver = $1) == null || $receiver.a$nil){
  17299. return methods;
  17300. } else {
  17301. var meta;
  17302. meta=$receiver;
  17303. return $recv(methods).__comma($recv(meta)._methods());
  17304. }
  17305. return self;
  17306. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods})});
  17307. },
  17308. args: [],
  17309. 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 ]",
  17310. referencedClasses: [],
  17311. pragmas: [],
  17312. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  17313. }),
  17314. $globals.TMasterBehavior);
  17315. $core.addMethod(
  17316. $core.method({
  17317. selector: "enterOrganization",
  17318. protocol: "accessing",
  17319. fn: function (){
  17320. var self=this,$self=this;
  17321. return $core.withContext(function($ctx1) {
  17322. var $1,$receiver;
  17323. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  17324. $globals.Smalltalk;
  17325. } else {
  17326. $1=$self._basicAt_("category");
  17327. if(($receiver = $1) == null || $receiver.a$nil){
  17328. $self._basicPackage_(nil);
  17329. $ctx1.sendIdx["basicPackage:"]=1;
  17330. } else {
  17331. var category;
  17332. category=$receiver;
  17333. $self._basicPackage_($recv($globals.Package)._named_(category));
  17334. $recv($recv($self._package())._organization())._addElement_(self);
  17335. }
  17336. }
  17337. return self;
  17338. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{})});
  17339. },
  17340. args: [],
  17341. 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 ] ]",
  17342. referencedClasses: ["Smalltalk", "Package"],
  17343. pragmas: [],
  17344. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  17345. }),
  17346. $globals.TMasterBehavior);
  17347. $core.addMethod(
  17348. $core.method({
  17349. selector: "leaveOrganization",
  17350. protocol: "accessing",
  17351. fn: function (){
  17352. var self=this,$self=this;
  17353. return $core.withContext(function($ctx1) {
  17354. var $receiver;
  17355. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  17356. $globals.Smalltalk;
  17357. } else {
  17358. $recv($recv($self._package())._organization())._removeElement_(self);
  17359. }
  17360. return self;
  17361. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{})});
  17362. },
  17363. args: [],
  17364. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  17365. referencedClasses: ["Smalltalk"],
  17366. pragmas: [],
  17367. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  17368. }),
  17369. $globals.TMasterBehavior);
  17370. $core.addMethod(
  17371. $core.method({
  17372. selector: "name",
  17373. protocol: "accessing",
  17374. fn: function (){
  17375. var self=this,$self=this;
  17376. return $core.withContext(function($ctx1) {
  17377. return self.name;
  17378. return self;
  17379. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  17380. },
  17381. args: [],
  17382. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  17383. referencedClasses: [],
  17384. pragmas: [["inlineJS:", ["return self.name"]]],
  17385. messageSends: []
  17386. }),
  17387. $globals.TMasterBehavior);
  17388. $core.addMethod(
  17389. $core.method({
  17390. selector: "package:",
  17391. protocol: "accessing",
  17392. fn: function (aPackage){
  17393. var self=this,$self=this;
  17394. var oldPackage;
  17395. return $core.withContext(function($ctx1) {
  17396. var $2,$1,$3,$5,$4;
  17397. $2=$self._package();
  17398. $ctx1.sendIdx["package"]=1;
  17399. $1=$recv($2).__eq(aPackage);
  17400. if($core.assert($1)){
  17401. return self;
  17402. }
  17403. oldPackage=$self._package();
  17404. $self._leaveOrganization();
  17405. $self._basicAt_put_("category",$recv(aPackage)._name());
  17406. $self._enterOrganization();
  17407. $3=$recv($globals.SystemAnnouncer)._current();
  17408. $5=$recv($globals.ClassMoved)._new();
  17409. $recv($5)._theClass_(self);
  17410. $recv($5)._oldPackage_(oldPackage);
  17411. $4=$recv($5)._yourself();
  17412. $recv($3)._announce_($4);
  17413. return self;
  17414. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage})});
  17415. },
  17416. args: ["aPackage"],
  17417. 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)",
  17418. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  17419. pragmas: [],
  17420. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  17421. }),
  17422. $globals.TMasterBehavior);
  17423. $core.addMethod(
  17424. $core.method({
  17425. selector: "theNonMetaClass",
  17426. protocol: "accessing",
  17427. fn: function (){
  17428. var self=this,$self=this;
  17429. return self;
  17430. },
  17431. args: [],
  17432. source: "theNonMetaClass\x0a\x09^ self",
  17433. referencedClasses: [],
  17434. pragmas: [],
  17435. messageSends: []
  17436. }),
  17437. $globals.TMasterBehavior);
  17438. $core.addClass("Trait", $globals.Object, ["organization", "package", "traitUsers"], "Kernel-Classes");
  17439. $core.addMethod(
  17440. $core.method({
  17441. selector: "-",
  17442. protocol: "composition",
  17443. fn: function (anArray){
  17444. var self=this,$self=this;
  17445. return $core.withContext(function($ctx1) {
  17446. return $recv($self._asTraitTransformation()).__minus(anArray);
  17447. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  17448. },
  17449. args: ["anArray"],
  17450. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  17451. referencedClasses: [],
  17452. pragmas: [],
  17453. messageSends: ["-", "asTraitTransformation"]
  17454. }),
  17455. $globals.Trait);
  17456. $core.addMethod(
  17457. $core.method({
  17458. selector: "@",
  17459. protocol: "composition",
  17460. fn: function (anArrayOfAssociations){
  17461. var self=this,$self=this;
  17462. return $core.withContext(function($ctx1) {
  17463. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  17464. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  17465. },
  17466. args: ["anArrayOfAssociations"],
  17467. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  17468. referencedClasses: [],
  17469. pragmas: [],
  17470. messageSends: ["@", "asTraitTransformation"]
  17471. }),
  17472. $globals.Trait);
  17473. $core.addMethod(
  17474. $core.method({
  17475. selector: "asTraitComposition",
  17476. protocol: "converting",
  17477. fn: function (){
  17478. var self=this,$self=this;
  17479. return $core.withContext(function($ctx1) {
  17480. return $recv($self._asTraitTransformation())._asTraitComposition();
  17481. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  17482. },
  17483. args: [],
  17484. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  17485. referencedClasses: [],
  17486. pragmas: [],
  17487. messageSends: ["asTraitComposition", "asTraitTransformation"]
  17488. }),
  17489. $globals.Trait);
  17490. $core.addMethod(
  17491. $core.method({
  17492. selector: "asTraitTransformation",
  17493. protocol: "converting",
  17494. fn: function (){
  17495. var self=this,$self=this;
  17496. return $core.withContext(function($ctx1) {
  17497. return $recv($globals.TraitTransformation)._on_(self);
  17498. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{})});
  17499. },
  17500. args: [],
  17501. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  17502. referencedClasses: ["TraitTransformation"],
  17503. pragmas: [],
  17504. messageSends: ["on:"]
  17505. }),
  17506. $globals.Trait);
  17507. $core.addMethod(
  17508. $core.method({
  17509. selector: "basicOrganization",
  17510. protocol: "accessing",
  17511. fn: function (){
  17512. var self=this,$self=this;
  17513. return $self.organization;
  17514. },
  17515. args: [],
  17516. source: "basicOrganization\x0a\x09^ organization",
  17517. referencedClasses: [],
  17518. pragmas: [],
  17519. messageSends: []
  17520. }),
  17521. $globals.Trait);
  17522. $core.addMethod(
  17523. $core.method({
  17524. selector: "basicOrganization:",
  17525. protocol: "accessing",
  17526. fn: function (aClassOrganizer){
  17527. var self=this,$self=this;
  17528. $self.organization=aClassOrganizer;
  17529. return self;
  17530. },
  17531. args: ["aClassOrganizer"],
  17532. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17533. referencedClasses: [],
  17534. pragmas: [],
  17535. messageSends: []
  17536. }),
  17537. $globals.Trait);
  17538. $core.addMethod(
  17539. $core.method({
  17540. selector: "basicPackage:",
  17541. protocol: "accessing",
  17542. fn: function (aPackage){
  17543. var self=this,$self=this;
  17544. $self.package=aPackage;
  17545. return self;
  17546. },
  17547. args: ["aPackage"],
  17548. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17549. referencedClasses: [],
  17550. pragmas: [],
  17551. messageSends: []
  17552. }),
  17553. $globals.Trait);
  17554. $core.addMethod(
  17555. $core.method({
  17556. selector: "classTag",
  17557. protocol: "accessing",
  17558. fn: function (){
  17559. var self=this,$self=this;
  17560. return "trait";
  17561. },
  17562. args: [],
  17563. source: "classTag\x0a\x09^ 'trait'",
  17564. referencedClasses: [],
  17565. pragmas: [],
  17566. messageSends: []
  17567. }),
  17568. $globals.Trait);
  17569. $core.addMethod(
  17570. $core.method({
  17571. selector: "definition",
  17572. protocol: "accessing",
  17573. fn: function (){
  17574. var self=this,$self=this;
  17575. return $core.withContext(function($ctx1) {
  17576. var $1;
  17577. return $recv($globals.String)._streamContents_((function(stream){
  17578. return $core.withContext(function($ctx2) {
  17579. $recv(stream)._write_("Trait named: ");
  17580. $ctx2.sendIdx["write:"]=1;
  17581. $recv(stream)._printSymbol_($self._name());
  17582. $recv(stream)._lf();
  17583. $ctx2.sendIdx["lf"]=1;
  17584. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17585. return $core.withContext(function($ctx3) {
  17586. $1=$recv($globals.String)._tab();
  17587. $ctx3.sendIdx["tab"]=1;
  17588. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17589. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17590. })));
  17591. $ctx2.sendIdx["write:"]=2;
  17592. $recv(stream)._tab();
  17593. $recv(stream)._write_("package: ");
  17594. return $recv(stream)._print_($self._category());
  17595. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17596. }));
  17597. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17598. },
  17599. args: [],
  17600. 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 ]",
  17601. referencedClasses: ["String"],
  17602. pragmas: [],
  17603. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17604. }),
  17605. $globals.Trait);
  17606. $core.addMethod(
  17607. $core.method({
  17608. selector: "package",
  17609. protocol: "accessing",
  17610. fn: function (){
  17611. var self=this,$self=this;
  17612. return $self.package;
  17613. },
  17614. args: [],
  17615. source: "package\x0a\x09^ package",
  17616. referencedClasses: [],
  17617. pragmas: [],
  17618. messageSends: []
  17619. }),
  17620. $globals.Trait);
  17621. $core.addMethod(
  17622. $core.method({
  17623. selector: "theMetaClass",
  17624. protocol: "accessing",
  17625. fn: function (){
  17626. var self=this,$self=this;
  17627. return nil;
  17628. },
  17629. args: [],
  17630. source: "theMetaClass\x0a\x09^ nil",
  17631. referencedClasses: [],
  17632. pragmas: [],
  17633. messageSends: []
  17634. }),
  17635. $globals.Trait);
  17636. $core.addMethod(
  17637. $core.method({
  17638. selector: "traitUsers",
  17639. protocol: "accessing",
  17640. fn: function (){
  17641. var self=this,$self=this;
  17642. return $core.withContext(function($ctx1) {
  17643. return $recv($self.traitUsers)._copy();
  17644. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{})});
  17645. },
  17646. args: [],
  17647. source: "traitUsers\x0a\x09^ traitUsers copy",
  17648. referencedClasses: [],
  17649. pragmas: [],
  17650. messageSends: ["copy"]
  17651. }),
  17652. $globals.Trait);
  17653. $core.addMethod(
  17654. $core.method({
  17655. selector: "named:package:",
  17656. protocol: "instance creation",
  17657. fn: function (aString,anotherString){
  17658. var self=this,$self=this;
  17659. return $core.withContext(function($ctx1) {
  17660. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17661. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString})});
  17662. },
  17663. args: ["aString", "anotherString"],
  17664. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17665. referencedClasses: ["ClassBuilder"],
  17666. pragmas: [],
  17667. messageSends: ["addTraitNamed:package:", "new"]
  17668. }),
  17669. $globals.Trait.a$cls);
  17670. $core.addMethod(
  17671. $core.method({
  17672. selector: "named:uses:package:",
  17673. protocol: "instance creation",
  17674. fn: function (aString,aTraitCompositionDescription,anotherString){
  17675. var self=this,$self=this;
  17676. var trait;
  17677. return $core.withContext(function($ctx1) {
  17678. trait=$self._named_package_(aString,anotherString);
  17679. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17680. return trait;
  17681. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait})});
  17682. },
  17683. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17684. 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",
  17685. referencedClasses: [],
  17686. pragmas: [],
  17687. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17688. }),
  17689. $globals.Trait.a$cls);
  17690. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17691. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17692. $core.addMethod(
  17693. $core.method({
  17694. selector: "-",
  17695. protocol: "composition",
  17696. fn: function (anArray){
  17697. var self=this,$self=this;
  17698. return $core.withContext(function($ctx1) {
  17699. var $1;
  17700. $1=$self._copy();
  17701. $recv($1)._addExclusions_(anArray);
  17702. return $recv($1)._yourself();
  17703. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  17704. },
  17705. args: ["anArray"],
  17706. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17707. referencedClasses: [],
  17708. pragmas: [],
  17709. messageSends: ["addExclusions:", "copy", "yourself"]
  17710. }),
  17711. $globals.TraitTransformation);
  17712. $core.addMethod(
  17713. $core.method({
  17714. selector: "@",
  17715. protocol: "composition",
  17716. fn: function (anArrayOfAssociations){
  17717. var self=this,$self=this;
  17718. return $core.withContext(function($ctx1) {
  17719. var $1;
  17720. $1=$self._copy();
  17721. $recv($1)._addAliases_(anArrayOfAssociations);
  17722. return $recv($1)._yourself();
  17723. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  17724. },
  17725. args: ["anArrayOfAssociations"],
  17726. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17727. referencedClasses: [],
  17728. pragmas: [],
  17729. messageSends: ["addAliases:", "copy", "yourself"]
  17730. }),
  17731. $globals.TraitTransformation);
  17732. $core.addMethod(
  17733. $core.method({
  17734. selector: "addAliases:",
  17735. protocol: "accessing",
  17736. fn: function (anArrayOfAssociations){
  17737. var self=this,$self=this;
  17738. return $core.withContext(function($ctx1) {
  17739. $recv(anArrayOfAssociations)._do_((function(each){
  17740. var key;
  17741. return $core.withContext(function($ctx2) {
  17742. key=$recv(each)._key();
  17743. return $recv($self.aliases)._at_ifPresent_ifAbsent_(key,(function(){
  17744. return $core.withContext(function($ctx3) {
  17745. return $self._error_("Cannot use same alias name twice.");
  17746. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17747. }),(function(){
  17748. return $core.withContext(function($ctx3) {
  17749. return $recv($self.aliases)._at_put_(key,$recv(each)._value());
  17750. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17751. }));
  17752. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17753. }));
  17754. return anArrayOfAssociations;
  17755. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations})});
  17756. },
  17757. args: ["anArrayOfAssociations"],
  17758. 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",
  17759. referencedClasses: [],
  17760. pragmas: [],
  17761. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17762. }),
  17763. $globals.TraitTransformation);
  17764. $core.addMethod(
  17765. $core.method({
  17766. selector: "addExclusions:",
  17767. protocol: "accessing",
  17768. fn: function (anArray){
  17769. var self=this,$self=this;
  17770. return $core.withContext(function($ctx1) {
  17771. $recv($self.exclusions)._addAll_(anArray);
  17772. return anArray;
  17773. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray})});
  17774. },
  17775. args: ["anArray"],
  17776. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17777. referencedClasses: [],
  17778. pragmas: [],
  17779. messageSends: ["addAll:"]
  17780. }),
  17781. $globals.TraitTransformation);
  17782. $core.addMethod(
  17783. $core.method({
  17784. selector: "aliases",
  17785. protocol: "accessing",
  17786. fn: function (){
  17787. var self=this,$self=this;
  17788. return $self.aliases;
  17789. },
  17790. args: [],
  17791. source: "aliases\x0a\x09^ aliases",
  17792. referencedClasses: [],
  17793. pragmas: [],
  17794. messageSends: []
  17795. }),
  17796. $globals.TraitTransformation);
  17797. $core.addMethod(
  17798. $core.method({
  17799. selector: "asJavaScriptObject",
  17800. protocol: "converting",
  17801. fn: function (){
  17802. var self=this,$self=this;
  17803. return $core.withContext(function($ctx1) {
  17804. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17805. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  17806. },
  17807. args: [],
  17808. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17809. referencedClasses: [],
  17810. pragmas: [],
  17811. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17812. }),
  17813. $globals.TraitTransformation);
  17814. $core.addMethod(
  17815. $core.method({
  17816. selector: "asJavaScriptSource",
  17817. protocol: "converting",
  17818. fn: function (){
  17819. var self=this,$self=this;
  17820. return $core.withContext(function($ctx1) {
  17821. var $2,$3,$1;
  17822. return $recv($globals.String)._streamContents_((function(str){
  17823. return $core.withContext(function($ctx2) {
  17824. $2=$recv($self._trait())._asJavaScriptSource();
  17825. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17826. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17827. return $core.withContext(function($ctx3) {
  17828. return [", aliases: ",$recv(al)._asJSONString()];
  17829. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17830. }));
  17831. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17832. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17833. return $core.withContext(function($ctx3) {
  17834. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17835. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17836. })),"}"];
  17837. return $recv(str)._write_($1);
  17838. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17839. }));
  17840. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17841. },
  17842. args: [],
  17843. 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'}' } ]",
  17844. referencedClasses: ["String"],
  17845. pragmas: [],
  17846. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17847. }),
  17848. $globals.TraitTransformation);
  17849. $core.addMethod(
  17850. $core.method({
  17851. selector: "asTraitComposition",
  17852. protocol: "converting",
  17853. fn: function (){
  17854. var self=this,$self=this;
  17855. return [self];
  17856. },
  17857. args: [],
  17858. source: "asTraitComposition\x0a\x09^ { self }",
  17859. referencedClasses: [],
  17860. pragmas: [],
  17861. messageSends: []
  17862. }),
  17863. $globals.TraitTransformation);
  17864. $core.addMethod(
  17865. $core.method({
  17866. selector: "asTraitTransformation",
  17867. protocol: "converting",
  17868. fn: function (){
  17869. var self=this,$self=this;
  17870. return self;
  17871. },
  17872. args: [],
  17873. source: "asTraitTransformation\x0a\x09^ self",
  17874. referencedClasses: [],
  17875. pragmas: [],
  17876. messageSends: []
  17877. }),
  17878. $globals.TraitTransformation);
  17879. $core.addMethod(
  17880. $core.method({
  17881. selector: "definition",
  17882. protocol: "accessing",
  17883. fn: function (){
  17884. var self=this,$self=this;
  17885. return $core.withContext(function($ctx1) {
  17886. return $recv($globals.String)._streamContents_((function(str){
  17887. return $core.withContext(function($ctx2) {
  17888. $recv(str)._print_($self._trait());
  17889. $recv($self._aliases())._ifNotEmpty_((function(al){
  17890. return $core.withContext(function($ctx3) {
  17891. $recv(str)._write_(" @ {");
  17892. $ctx3.sendIdx["write:"]=1;
  17893. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17894. return $core.withContext(function($ctx4) {
  17895. $recv(str)._printSymbol_($recv(each)._key());
  17896. $ctx4.sendIdx["printSymbol:"]=1;
  17897. $recv(str)._write_(" -> ");
  17898. $ctx4.sendIdx["write:"]=2;
  17899. return $recv(str)._printSymbol_($recv(each)._value());
  17900. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17901. }),(function(){
  17902. return $core.withContext(function($ctx4) {
  17903. return $recv(str)._write_(". ");
  17904. $ctx4.sendIdx["write:"]=3;
  17905. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17906. }));
  17907. $ctx3.sendIdx["do:separatedBy:"]=1;
  17908. return $recv(str)._write_("}");
  17909. $ctx3.sendIdx["write:"]=4;
  17910. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17911. }));
  17912. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17913. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17914. return $core.withContext(function($ctx3) {
  17915. $recv(str)._write_(" - #(");
  17916. $ctx3.sendIdx["write:"]=5;
  17917. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17918. return $core.withContext(function($ctx4) {
  17919. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17920. $ctx4.sendIdx["write:"]=6;
  17921. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17922. }),(function(){
  17923. return $core.withContext(function($ctx4) {
  17924. return $recv(str)._space();
  17925. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17926. }));
  17927. return $recv(str)._write_(")");
  17928. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17929. }));
  17930. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17931. }));
  17932. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17933. },
  17934. args: [],
  17935. 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: ')' ] ]",
  17936. referencedClasses: ["String"],
  17937. pragmas: [],
  17938. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17939. }),
  17940. $globals.TraitTransformation);
  17941. $core.addMethod(
  17942. $core.method({
  17943. selector: "exclusions",
  17944. protocol: "accessing",
  17945. fn: function (){
  17946. var self=this,$self=this;
  17947. return $self.exclusions;
  17948. },
  17949. args: [],
  17950. source: "exclusions\x0a\x09^ exclusions",
  17951. referencedClasses: [],
  17952. pragmas: [],
  17953. messageSends: []
  17954. }),
  17955. $globals.TraitTransformation);
  17956. $core.addMethod(
  17957. $core.method({
  17958. selector: "initialize",
  17959. protocol: "initialization",
  17960. fn: function (){
  17961. var self=this,$self=this;
  17962. return $core.withContext(function($ctx1) {
  17963. (
  17964. $ctx1.supercall = true,
  17965. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17966. $ctx1.supercall = false;
  17967. $self.aliases=$globals.HashedCollection._newFromPairs_([]);
  17968. $self.exclusions=$recv($globals.Set)._new();
  17969. $self.trait=nil;
  17970. return self;
  17971. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  17972. },
  17973. args: [],
  17974. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17975. referencedClasses: ["Set"],
  17976. pragmas: [],
  17977. messageSends: ["initialize", "new"]
  17978. }),
  17979. $globals.TraitTransformation);
  17980. $core.addMethod(
  17981. $core.method({
  17982. selector: "postCopy",
  17983. protocol: "copying",
  17984. fn: function (){
  17985. var self=this,$self=this;
  17986. return $core.withContext(function($ctx1) {
  17987. $self.aliases=$recv($self.aliases)._copy();
  17988. $ctx1.sendIdx["copy"]=1;
  17989. $self.exclusions=$recv($self.exclusions)._copy();
  17990. return self;
  17991. }, function($ctx1) {$ctx1.fill(self,"postCopy",{})});
  17992. },
  17993. args: [],
  17994. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17995. referencedClasses: [],
  17996. pragmas: [],
  17997. messageSends: ["copy"]
  17998. }),
  17999. $globals.TraitTransformation);
  18000. $core.addMethod(
  18001. $core.method({
  18002. selector: "trait",
  18003. protocol: "accessing",
  18004. fn: function (){
  18005. var self=this,$self=this;
  18006. return $self.trait;
  18007. },
  18008. args: [],
  18009. source: "trait\x0a\x09^ trait",
  18010. referencedClasses: [],
  18011. pragmas: [],
  18012. messageSends: []
  18013. }),
  18014. $globals.TraitTransformation);
  18015. $core.addMethod(
  18016. $core.method({
  18017. selector: "trait:",
  18018. protocol: "accessing",
  18019. fn: function (anObject){
  18020. var self=this,$self=this;
  18021. $self.trait=anObject;
  18022. return self;
  18023. },
  18024. args: ["anObject"],
  18025. source: "trait: anObject\x0a\x09trait := anObject",
  18026. referencedClasses: [],
  18027. pragmas: [],
  18028. messageSends: []
  18029. }),
  18030. $globals.TraitTransformation);
  18031. $core.addMethod(
  18032. $core.method({
  18033. selector: "fromJSON:",
  18034. protocol: "instance creation",
  18035. fn: function (aJSObject){
  18036. var self=this,$self=this;
  18037. return $core.withContext(function($ctx1) {
  18038. var $1,$4,$3,$2;
  18039. $1=(
  18040. $ctx1.supercall = true,
  18041. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  18042. $ctx1.supercall = false;
  18043. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  18044. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  18045. return $globals.HashedCollection._newFromPairs_([]);
  18046. }));
  18047. $ctx1.sendIdx["at:ifAbsent:"]=1;
  18048. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  18049. $2=$recv($3)._associations();
  18050. $recv($1)._addAliases_($2);
  18051. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  18052. return [];
  18053. })));
  18054. return $recv($1)._yourself();
  18055. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject})});
  18056. },
  18057. args: ["aJSObject"],
  18058. 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",
  18059. referencedClasses: ["Smalltalk"],
  18060. pragmas: [],
  18061. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  18062. }),
  18063. $globals.TraitTransformation.a$cls);
  18064. $core.addMethod(
  18065. $core.method({
  18066. selector: "on:",
  18067. protocol: "instance creation",
  18068. fn: function (aTrait){
  18069. var self=this,$self=this;
  18070. return $core.withContext(function($ctx1) {
  18071. var $1;
  18072. $1=(
  18073. $ctx1.supercall = true,
  18074. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  18075. $ctx1.supercall = false;
  18076. $recv($1)._trait_(aTrait);
  18077. return $recv($1)._yourself();
  18078. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait})});
  18079. },
  18080. args: ["aTrait"],
  18081. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  18082. referencedClasses: [],
  18083. pragmas: [],
  18084. messageSends: ["trait:", "new", "yourself"]
  18085. }),
  18086. $globals.TraitTransformation.a$cls);
  18087. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  18088. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  18089. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  18090. $core.addMethod(
  18091. $core.method({
  18092. selector: "asTraitComposition",
  18093. protocol: "*Kernel-Classes",
  18094. fn: function (){
  18095. var self=this,$self=this;
  18096. return $core.withContext(function($ctx1) {
  18097. return $self._collect_((function(each){
  18098. return $core.withContext(function($ctx2) {
  18099. return $recv(each)._asTraitTransformation();
  18100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18101. }));
  18102. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  18103. },
  18104. args: [],
  18105. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  18106. referencedClasses: [],
  18107. pragmas: [],
  18108. messageSends: ["collect:", "asTraitTransformation"]
  18109. }),
  18110. $globals.Array);
  18111. $core.addMethod(
  18112. $core.method({
  18113. selector: "instanceVariablesStringAsSlotList",
  18114. protocol: "*Kernel-Classes",
  18115. fn: function (){
  18116. var self=this,$self=this;
  18117. return $core.withContext(function($ctx1) {
  18118. return $recv($self._tokenize_(" "))._reject_((function(each){
  18119. return $core.withContext(function($ctx2) {
  18120. return $recv(each)._isEmpty();
  18121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18122. }));
  18123. }, function($ctx1) {$ctx1.fill(self,"instanceVariablesStringAsSlotList",{})});
  18124. },
  18125. args: [],
  18126. source: "instanceVariablesStringAsSlotList\x0a\x09^ (self tokenize: ' ') reject: [ :each | each isEmpty ]",
  18127. referencedClasses: [],
  18128. pragmas: [],
  18129. messageSends: ["reject:", "tokenize:", "isEmpty"]
  18130. }),
  18131. $globals.String);
  18132. });
  18133. define('amber/core/Kernel-Methods',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  18134. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  18135. var $pkg = $core.addPackage("Kernel-Methods");
  18136. $pkg.innerEval = function (expr) { return eval(expr); };
  18137. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  18138. $core.addClass("BlockClosure", $globals.Object, ["prototype", "length"], "Kernel-Methods");
  18139. $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 | ... ] `";
  18140. $core.addMethod(
  18141. $core.method({
  18142. selector: "applyTo:arguments:",
  18143. protocol: "evaluating",
  18144. fn: function (anObject,aCollection){
  18145. var self=this,$self=this;
  18146. return $core.withContext(function($ctx1) {
  18147. return self.apply(anObject, aCollection);
  18148. return self;
  18149. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  18150. },
  18151. args: ["anObject", "aCollection"],
  18152. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  18153. referencedClasses: [],
  18154. pragmas: [["inlineJS:", ["return self.apply(anObject, aCollection)"]]],
  18155. messageSends: []
  18156. }),
  18157. $globals.BlockClosure);
  18158. $core.addMethod(
  18159. $core.method({
  18160. selector: "asCompiledMethod:",
  18161. protocol: "converting",
  18162. fn: function (aString){
  18163. var self=this,$self=this;
  18164. return $core.withContext(function($ctx1) {
  18165. return $core.method({selector:aString, fn:self});;
  18166. return self;
  18167. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString})});
  18168. },
  18169. args: ["aString"],
  18170. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  18171. referencedClasses: [],
  18172. pragmas: [["inlineJS:", ["return $core.method({selector:aString, fn:self});"]]],
  18173. messageSends: []
  18174. }),
  18175. $globals.BlockClosure);
  18176. $core.addMethod(
  18177. $core.method({
  18178. selector: "compiledSource",
  18179. protocol: "accessing",
  18180. fn: function (){
  18181. var self=this,$self=this;
  18182. return $core.withContext(function($ctx1) {
  18183. return self.toString();
  18184. return self;
  18185. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{})});
  18186. },
  18187. args: [],
  18188. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  18189. referencedClasses: [],
  18190. pragmas: [["inlineJS:", ["return self.toString()"]]],
  18191. messageSends: []
  18192. }),
  18193. $globals.BlockClosure);
  18194. $core.addMethod(
  18195. $core.method({
  18196. selector: "currySelf",
  18197. protocol: "converting",
  18198. fn: function (){
  18199. var self=this,$self=this;
  18200. return $core.withContext(function($ctx1) {
  18201. return function () {
  18202. var args = [ this ];
  18203. args.push.apply(args, arguments);
  18204. return self.apply(null, args);
  18205. }
  18206. ;
  18207. return self;
  18208. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  18209. },
  18210. args: [],
  18211. 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'>",
  18212. referencedClasses: [],
  18213. pragmas: [["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"]]],
  18214. messageSends: []
  18215. }),
  18216. $globals.BlockClosure);
  18217. $core.addMethod(
  18218. $core.method({
  18219. selector: "ensure:",
  18220. protocol: "evaluating",
  18221. fn: function (aBlock){
  18222. var self=this,$self=this;
  18223. return $core.withContext(function($ctx1) {
  18224. try{return $self._value()}finally{aBlock._value()};
  18225. return self;
  18226. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock})});
  18227. },
  18228. args: ["aBlock"],
  18229. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  18230. referencedClasses: [],
  18231. pragmas: [["inlineJS:", ["try{return $self._value()}finally{aBlock._value()}"]]],
  18232. messageSends: []
  18233. }),
  18234. $globals.BlockClosure);
  18235. $core.addMethod(
  18236. $core.method({
  18237. selector: "fork",
  18238. protocol: "timeout/interval",
  18239. fn: function (){
  18240. var self=this,$self=this;
  18241. return $core.withContext(function($ctx1) {
  18242. $recv($recv($globals.ForkPool)._default())._fork_(self);
  18243. return self;
  18244. }, function($ctx1) {$ctx1.fill(self,"fork",{})});
  18245. },
  18246. args: [],
  18247. source: "fork\x0a\x09ForkPool default fork: self",
  18248. referencedClasses: ["ForkPool"],
  18249. pragmas: [],
  18250. messageSends: ["fork:", "default"]
  18251. }),
  18252. $globals.BlockClosure);
  18253. $core.addMethod(
  18254. $core.method({
  18255. selector: "new",
  18256. protocol: "evaluating",
  18257. fn: function (){
  18258. var self=this,$self=this;
  18259. return $core.withContext(function($ctx1) {
  18260. return new self();
  18261. return self;
  18262. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  18263. },
  18264. args: [],
  18265. 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()'>",
  18266. referencedClasses: [],
  18267. pragmas: [["inlineJS:", ["return new self()"]]],
  18268. messageSends: []
  18269. }),
  18270. $globals.BlockClosure);
  18271. $core.addMethod(
  18272. $core.method({
  18273. selector: "newValue:",
  18274. protocol: "evaluating",
  18275. fn: function (anObject){
  18276. var self=this,$self=this;
  18277. return $core.withContext(function($ctx1) {
  18278. return $self._newWithValues_([anObject]);
  18279. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject})});
  18280. },
  18281. args: ["anObject"],
  18282. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  18283. referencedClasses: [],
  18284. pragmas: [],
  18285. messageSends: ["newWithValues:"]
  18286. }),
  18287. $globals.BlockClosure);
  18288. $core.addMethod(
  18289. $core.method({
  18290. selector: "newValue:value:",
  18291. protocol: "evaluating",
  18292. fn: function (anObject,anObject2){
  18293. var self=this,$self=this;
  18294. return $core.withContext(function($ctx1) {
  18295. return $self._newWithValues_([anObject,anObject2]);
  18296. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2})});
  18297. },
  18298. args: ["anObject", "anObject2"],
  18299. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  18300. referencedClasses: [],
  18301. pragmas: [],
  18302. messageSends: ["newWithValues:"]
  18303. }),
  18304. $globals.BlockClosure);
  18305. $core.addMethod(
  18306. $core.method({
  18307. selector: "newValue:value:value:",
  18308. protocol: "evaluating",
  18309. fn: function (anObject,anObject2,anObject3){
  18310. var self=this,$self=this;
  18311. return $core.withContext(function($ctx1) {
  18312. return $self._newWithValues_([anObject,anObject2,anObject3]);
  18313. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  18314. },
  18315. args: ["anObject", "anObject2", "anObject3"],
  18316. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  18317. referencedClasses: [],
  18318. pragmas: [],
  18319. messageSends: ["newWithValues:"]
  18320. }),
  18321. $globals.BlockClosure);
  18322. $core.addMethod(
  18323. $core.method({
  18324. selector: "newWithValues:",
  18325. protocol: "evaluating",
  18326. fn: function (aCollection){
  18327. var self=this,$self=this;
  18328. return $core.withContext(function($ctx1) {
  18329. var object = Object.create(self.prototype);
  18330. var result = self.apply(object, aCollection);
  18331. return typeof result === "object" ? result : object;
  18332. ;
  18333. return self;
  18334. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection})});
  18335. },
  18336. args: ["aCollection"],
  18337. 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'>",
  18338. referencedClasses: [],
  18339. pragmas: [["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"]]],
  18340. messageSends: []
  18341. }),
  18342. $globals.BlockClosure);
  18343. $core.addMethod(
  18344. $core.method({
  18345. selector: "numArgs",
  18346. protocol: "accessing",
  18347. fn: function (){
  18348. var self=this,$self=this;
  18349. return $self.length;
  18350. },
  18351. args: [],
  18352. source: "numArgs\x0a\x09^ length",
  18353. referencedClasses: [],
  18354. pragmas: [],
  18355. messageSends: []
  18356. }),
  18357. $globals.BlockClosure);
  18358. $core.addMethod(
  18359. $core.method({
  18360. selector: "on:do:",
  18361. protocol: "error handling",
  18362. fn: function (anErrorClass,aBlock){
  18363. var self=this,$self=this;
  18364. return $core.withContext(function($ctx1) {
  18365. var $1;
  18366. return $self._tryCatch_((function(error){
  18367. var smalltalkError;
  18368. return $core.withContext(function($ctx2) {
  18369. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  18370. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  18371. if($core.assert($1)){
  18372. return $recv(aBlock)._value_(smalltalkError);
  18373. } else {
  18374. return $recv(smalltalkError)._pass();
  18375. }
  18376. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  18377. }));
  18378. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock})});
  18379. },
  18380. args: ["anErrorClass", "aBlock"],
  18381. 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 ] ]",
  18382. referencedClasses: ["Smalltalk"],
  18383. pragmas: [],
  18384. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  18385. }),
  18386. $globals.BlockClosure);
  18387. $core.addMethod(
  18388. $core.method({
  18389. selector: "prototype",
  18390. protocol: "accessing",
  18391. fn: function (){
  18392. var self=this,$self=this;
  18393. return $self.prototype;
  18394. },
  18395. args: [],
  18396. source: "prototype\x0a\x09^ prototype",
  18397. referencedClasses: [],
  18398. pragmas: [],
  18399. messageSends: []
  18400. }),
  18401. $globals.BlockClosure);
  18402. $core.addMethod(
  18403. $core.method({
  18404. selector: "provided",
  18405. protocol: "converting",
  18406. fn: function (){
  18407. var self=this,$self=this;
  18408. return $core.withContext(function($ctx1) {
  18409. return $recv($globals.JSObjectProxy)._on_(self);
  18410. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  18411. },
  18412. args: [],
  18413. 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",
  18414. referencedClasses: ["JSObjectProxy"],
  18415. pragmas: [],
  18416. messageSends: ["on:"]
  18417. }),
  18418. $globals.BlockClosure);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "receiver",
  18422. protocol: "accessing",
  18423. fn: function (){
  18424. var self=this,$self=this;
  18425. return nil;
  18426. },
  18427. args: [],
  18428. source: "receiver\x0a\x09^ nil",
  18429. referencedClasses: [],
  18430. pragmas: [],
  18431. messageSends: []
  18432. }),
  18433. $globals.BlockClosure);
  18434. $core.addMethod(
  18435. $core.method({
  18436. selector: "timeToRun",
  18437. protocol: "evaluating",
  18438. fn: function (){
  18439. var self=this,$self=this;
  18440. return $core.withContext(function($ctx1) {
  18441. return $recv($globals.Date)._millisecondsToRun_(self);
  18442. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{})});
  18443. },
  18444. args: [],
  18445. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  18446. referencedClasses: ["Date"],
  18447. pragmas: [],
  18448. messageSends: ["millisecondsToRun:"]
  18449. }),
  18450. $globals.BlockClosure);
  18451. $core.addMethod(
  18452. $core.method({
  18453. selector: "tryCatch:",
  18454. protocol: "error handling",
  18455. fn: function (aBlock){
  18456. var self=this,$self=this;
  18457. return $core.withContext(function($ctx1) {
  18458. try {
  18459. return $self._value();
  18460. } catch(error) {
  18461. // pass non-local returns undetected
  18462. if (Array.isArray(error) && error.length === 1) throw error;
  18463. return aBlock._value_(error);
  18464. }
  18465. ;
  18466. return self;
  18467. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock})});
  18468. },
  18469. args: ["aBlock"],
  18470. 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'>",
  18471. referencedClasses: [],
  18472. pragmas: [["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"]]],
  18473. messageSends: []
  18474. }),
  18475. $globals.BlockClosure);
  18476. $core.addMethod(
  18477. $core.method({
  18478. selector: "value",
  18479. protocol: "evaluating",
  18480. fn: function (){
  18481. var self=this,$self=this;
  18482. return $core.withContext(function($ctx1) {
  18483. return self();;
  18484. return self;
  18485. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  18486. },
  18487. args: [],
  18488. source: "value\x0a\x09<inlineJS: 'return self();'>",
  18489. referencedClasses: [],
  18490. pragmas: [["inlineJS:", ["return self();"]]],
  18491. messageSends: []
  18492. }),
  18493. $globals.BlockClosure);
  18494. $core.addMethod(
  18495. $core.method({
  18496. selector: "value:",
  18497. protocol: "evaluating",
  18498. fn: function (anArg){
  18499. var self=this,$self=this;
  18500. return $core.withContext(function($ctx1) {
  18501. return self(anArg);;
  18502. return self;
  18503. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg})});
  18504. },
  18505. args: ["anArg"],
  18506. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  18507. referencedClasses: [],
  18508. pragmas: [["inlineJS:", ["return self(anArg);"]]],
  18509. messageSends: []
  18510. }),
  18511. $globals.BlockClosure);
  18512. $core.addMethod(
  18513. $core.method({
  18514. selector: "value:value:",
  18515. protocol: "evaluating",
  18516. fn: function (firstArg,secondArg){
  18517. var self=this,$self=this;
  18518. return $core.withContext(function($ctx1) {
  18519. return self(firstArg, secondArg);;
  18520. return self;
  18521. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg})});
  18522. },
  18523. args: ["firstArg", "secondArg"],
  18524. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  18525. referencedClasses: [],
  18526. pragmas: [["inlineJS:", ["return self(firstArg, secondArg);"]]],
  18527. messageSends: []
  18528. }),
  18529. $globals.BlockClosure);
  18530. $core.addMethod(
  18531. $core.method({
  18532. selector: "value:value:value:",
  18533. protocol: "evaluating",
  18534. fn: function (firstArg,secondArg,thirdArg){
  18535. var self=this,$self=this;
  18536. return $core.withContext(function($ctx1) {
  18537. return self(firstArg, secondArg, thirdArg);;
  18538. return self;
  18539. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg})});
  18540. },
  18541. args: ["firstArg", "secondArg", "thirdArg"],
  18542. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  18543. referencedClasses: [],
  18544. pragmas: [["inlineJS:", ["return self(firstArg, secondArg, thirdArg);"]]],
  18545. messageSends: []
  18546. }),
  18547. $globals.BlockClosure);
  18548. $core.addMethod(
  18549. $core.method({
  18550. selector: "valueWithInterval:",
  18551. protocol: "timeout/interval",
  18552. fn: function (aNumber){
  18553. var self=this,$self=this;
  18554. return $core.withContext(function($ctx1) {
  18555. var interval = setInterval(self, aNumber);
  18556. return $globals.Timeout._on_(interval);
  18557. ;
  18558. return self;
  18559. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber})});
  18560. },
  18561. args: ["aNumber"],
  18562. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  18563. referencedClasses: [],
  18564. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09"]]],
  18565. messageSends: []
  18566. }),
  18567. $globals.BlockClosure);
  18568. $core.addMethod(
  18569. $core.method({
  18570. selector: "valueWithPossibleArguments:",
  18571. protocol: "evaluating",
  18572. fn: function (aCollection){
  18573. var self=this,$self=this;
  18574. return $core.withContext(function($ctx1) {
  18575. return self.apply(null, aCollection);;
  18576. return self;
  18577. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  18578. },
  18579. args: ["aCollection"],
  18580. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  18581. referencedClasses: [],
  18582. pragmas: [["inlineJS:", ["return self.apply(null, aCollection);"]]],
  18583. messageSends: []
  18584. }),
  18585. $globals.BlockClosure);
  18586. $core.addMethod(
  18587. $core.method({
  18588. selector: "valueWithTimeout:",
  18589. protocol: "timeout/interval",
  18590. fn: function (aNumber){
  18591. var self=this,$self=this;
  18592. return $core.withContext(function($ctx1) {
  18593. var timeout = setTimeout(self, aNumber);
  18594. return $globals.Timeout._on_(timeout);
  18595. ;
  18596. return self;
  18597. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber})});
  18598. },
  18599. args: ["aNumber"],
  18600. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18601. referencedClasses: [],
  18602. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09"]]],
  18603. messageSends: []
  18604. }),
  18605. $globals.BlockClosure);
  18606. $core.addMethod(
  18607. $core.method({
  18608. selector: "whileFalse",
  18609. protocol: "controlling",
  18610. fn: function (){
  18611. var self=this,$self=this;
  18612. return $core.withContext(function($ctx1) {
  18613. $self._whileFalse_((function(){
  18614. }));
  18615. return self;
  18616. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{})});
  18617. },
  18618. args: [],
  18619. source: "whileFalse\x0a\x09self whileFalse: []",
  18620. referencedClasses: [],
  18621. pragmas: [],
  18622. messageSends: ["whileFalse:"]
  18623. }),
  18624. $globals.BlockClosure);
  18625. $core.addMethod(
  18626. $core.method({
  18627. selector: "whileFalse:",
  18628. protocol: "controlling",
  18629. fn: function (aBlock){
  18630. var self=this,$self=this;
  18631. return $core.withContext(function($ctx1) {
  18632. while(!$core.assert($self._value())) {aBlock._value()};
  18633. return self;
  18634. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock})});
  18635. },
  18636. args: ["aBlock"],
  18637. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18638. referencedClasses: [],
  18639. pragmas: [["inlineJS:", ["while(!$core.assert($self._value())) {aBlock._value()}"]]],
  18640. messageSends: []
  18641. }),
  18642. $globals.BlockClosure);
  18643. $core.addMethod(
  18644. $core.method({
  18645. selector: "whileTrue",
  18646. protocol: "controlling",
  18647. fn: function (){
  18648. var self=this,$self=this;
  18649. return $core.withContext(function($ctx1) {
  18650. $self._whileTrue_((function(){
  18651. }));
  18652. return self;
  18653. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{})});
  18654. },
  18655. args: [],
  18656. source: "whileTrue\x0a\x09self whileTrue: []",
  18657. referencedClasses: [],
  18658. pragmas: [],
  18659. messageSends: ["whileTrue:"]
  18660. }),
  18661. $globals.BlockClosure);
  18662. $core.addMethod(
  18663. $core.method({
  18664. selector: "whileTrue:",
  18665. protocol: "controlling",
  18666. fn: function (aBlock){
  18667. var self=this,$self=this;
  18668. return $core.withContext(function($ctx1) {
  18669. while($core.assert($self._value())) {aBlock._value()};
  18670. return self;
  18671. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock})});
  18672. },
  18673. args: ["aBlock"],
  18674. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18675. referencedClasses: [],
  18676. pragmas: [["inlineJS:", ["while($core.assert($self._value())) {aBlock._value()}"]]],
  18677. messageSends: []
  18678. }),
  18679. $globals.BlockClosure);
  18680. $core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
  18681. $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";
  18682. $core.addMethod(
  18683. $core.method({
  18684. selector: "arguments",
  18685. protocol: "accessing",
  18686. fn: function (){
  18687. var self=this,$self=this;
  18688. return $core.withContext(function($ctx1) {
  18689. var $1,$receiver;
  18690. $1=$self.args;
  18691. if(($receiver = $1) == null || $receiver.a$nil){
  18692. return [];
  18693. } else {
  18694. return $1;
  18695. }
  18696. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  18697. },
  18698. args: [],
  18699. source: "arguments\x0a\x09^ args ifNil: [ #() ]",
  18700. referencedClasses: [],
  18701. pragmas: [],
  18702. messageSends: ["ifNil:"]
  18703. }),
  18704. $globals.CompiledMethod);
  18705. $core.addMethod(
  18706. $core.method({
  18707. selector: "asString",
  18708. protocol: "converting",
  18709. fn: function (){
  18710. var self=this,$self=this;
  18711. return $core.withContext(function($ctx1) {
  18712. return $self._asStringForClass_($self._methodClass());
  18713. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  18714. },
  18715. args: [],
  18716. source: "asString\x0a\x09^ self asStringForClass: self methodClass",
  18717. referencedClasses: [],
  18718. pragmas: [],
  18719. messageSends: ["asStringForClass:", "methodClass"]
  18720. }),
  18721. $globals.CompiledMethod);
  18722. $core.addMethod(
  18723. $core.method({
  18724. selector: "asStringForClass:",
  18725. protocol: "converting",
  18726. fn: function (aClass){
  18727. var self=this,$self=this;
  18728. var result;
  18729. return $core.withContext(function($ctx1) {
  18730. var $2,$1,$4,$6,$7,$5,$3,$10,$9,$12,$11,$8,$14,$16,$15,$13,$17,$receiver;
  18731. result=$recv(aClass)._name();
  18732. $ctx1.sendIdx["name"]=1;
  18733. $2=$self._methodClass();
  18734. $ctx1.sendIdx["methodClass"]=1;
  18735. $1=$recv($2).__eq(aClass);
  18736. $ctx1.sendIdx["="]=1;
  18737. if(!$core.assert($1)){
  18738. $4=$recv(result).__comma(" (");
  18739. $ctx1.sendIdx[","]=3;
  18740. $6=$self._methodClass();
  18741. $ctx1.sendIdx["methodClass"]=2;
  18742. if(($receiver = $6) == null || $receiver.a$nil){
  18743. $5="nil";
  18744. } else {
  18745. $7=$self._methodClass();
  18746. $ctx1.sendIdx["methodClass"]=3;
  18747. $5=$recv($7)._name();
  18748. $ctx1.sendIdx["name"]=2;
  18749. }
  18750. $3=$recv($4).__comma($5);
  18751. $ctx1.sendIdx[","]=2;
  18752. result=$recv($3).__comma(")");
  18753. $ctx1.sendIdx[","]=1;
  18754. result;
  18755. }
  18756. $10=$self._origin();
  18757. $ctx1.sendIdx["origin"]=1;
  18758. $9=$recv($10).__eq(aClass);
  18759. $ctx1.sendIdx["="]=2;
  18760. $12=$self._origin();
  18761. $ctx1.sendIdx["origin"]=2;
  18762. $11=$recv($12).__eq($self._methodClass());
  18763. $8=$recv($9).__or($11);
  18764. if(!$core.assert($8)){
  18765. $14=$recv(result).__comma(" /");
  18766. $ctx1.sendIdx[","]=6;
  18767. $16=$self._origin();
  18768. $ctx1.sendIdx["origin"]=3;
  18769. if(($receiver = $16) == null || $receiver.a$nil){
  18770. $15="nil";
  18771. } else {
  18772. $15=$recv($self._origin())._name();
  18773. }
  18774. $13=$recv($14).__comma($15);
  18775. $ctx1.sendIdx[","]=5;
  18776. result=$recv($13).__comma("/");
  18777. $ctx1.sendIdx[","]=4;
  18778. result;
  18779. }
  18780. $17=$recv($recv(result).__comma(" >> ")).__comma($recv($self._selector())._symbolPrintString());
  18781. $ctx1.sendIdx[","]=7;
  18782. return $17;
  18783. }, function($ctx1) {$ctx1.fill(self,"asStringForClass:",{aClass:aClass,result:result})});
  18784. },
  18785. args: ["aClass"],
  18786. source: "asStringForClass: aClass\x0a\x09| result |\x0a\x09result := aClass name.\x0a\x09self methodClass = aClass \x0a\x09\x09ifFalse: [ result := result, ' (', (self methodClass ifNil: [ 'nil' ] ifNotNil: [ self methodClass name ]), ')'].\x0a\x09(self origin = aClass | (self origin = self methodClass)) \x0a\x09\x09ifFalse: [ result := result, ' /', (self origin ifNil: [ 'nil' ] ifNotNil: [ self origin name ]), '/'].\x0a\x09^ result, ' >> ', self selector symbolPrintString",
  18787. referencedClasses: [],
  18788. pragmas: [],
  18789. messageSends: ["name", "ifFalse:", "=", "methodClass", ",", "ifNil:ifNotNil:", "|", "origin", "symbolPrintString", "selector"]
  18790. }),
  18791. $globals.CompiledMethod);
  18792. $core.addMethod(
  18793. $core.method({
  18794. selector: "basicPragmas",
  18795. protocol: "accessing",
  18796. fn: function (){
  18797. var self=this,$self=this;
  18798. return $core.withContext(function($ctx1) {
  18799. var $1,$receiver;
  18800. $1=$self.pragmas;
  18801. if(($receiver = $1) == null || $receiver.a$nil){
  18802. return [];
  18803. } else {
  18804. return $1;
  18805. }
  18806. }, function($ctx1) {$ctx1.fill(self,"basicPragmas",{})});
  18807. },
  18808. args: [],
  18809. source: "basicPragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  18810. referencedClasses: [],
  18811. pragmas: [],
  18812. messageSends: ["ifNil:"]
  18813. }),
  18814. $globals.CompiledMethod);
  18815. $core.addMethod(
  18816. $core.method({
  18817. selector: "browse",
  18818. protocol: "browsing",
  18819. fn: function (){
  18820. var self=this,$self=this;
  18821. return $core.withContext(function($ctx1) {
  18822. $recv($globals.Finder)._findMethod_(self);
  18823. return self;
  18824. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  18825. },
  18826. args: [],
  18827. source: "browse\x0a\x09Finder findMethod: self",
  18828. referencedClasses: ["Finder"],
  18829. pragmas: [],
  18830. messageSends: ["findMethod:"]
  18831. }),
  18832. $globals.CompiledMethod);
  18833. $core.addMethod(
  18834. $core.method({
  18835. selector: "category",
  18836. protocol: "accessing",
  18837. fn: function (){
  18838. var self=this,$self=this;
  18839. return $core.withContext(function($ctx1) {
  18840. return $self._protocol();
  18841. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  18842. },
  18843. args: [],
  18844. source: "category\x0a\x09^ self protocol",
  18845. referencedClasses: [],
  18846. pragmas: [],
  18847. messageSends: ["protocol"]
  18848. }),
  18849. $globals.CompiledMethod);
  18850. $core.addMethod(
  18851. $core.method({
  18852. selector: "defaultProtocol",
  18853. protocol: "defaults",
  18854. fn: function (){
  18855. var self=this,$self=this;
  18856. return "as yet unclassified";
  18857. },
  18858. args: [],
  18859. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18860. referencedClasses: [],
  18861. pragmas: [],
  18862. messageSends: []
  18863. }),
  18864. $globals.CompiledMethod);
  18865. $core.addMethod(
  18866. $core.method({
  18867. selector: "fn",
  18868. protocol: "accessing",
  18869. fn: function (){
  18870. var self=this,$self=this;
  18871. return $self.fn;
  18872. },
  18873. args: [],
  18874. source: "fn\x0a\x09^ fn",
  18875. referencedClasses: [],
  18876. pragmas: [],
  18877. messageSends: []
  18878. }),
  18879. $globals.CompiledMethod);
  18880. $core.addMethod(
  18881. $core.method({
  18882. selector: "fn:",
  18883. protocol: "accessing",
  18884. fn: function (aBlock){
  18885. var self=this,$self=this;
  18886. $self.fn=aBlock;
  18887. return self;
  18888. },
  18889. args: ["aBlock"],
  18890. source: "fn: aBlock\x0a\x09fn := aBlock",
  18891. referencedClasses: [],
  18892. pragmas: [],
  18893. messageSends: []
  18894. }),
  18895. $globals.CompiledMethod);
  18896. $core.addMethod(
  18897. $core.method({
  18898. selector: "isCompiledMethod",
  18899. protocol: "testing",
  18900. fn: function (){
  18901. var self=this,$self=this;
  18902. return true;
  18903. },
  18904. args: [],
  18905. source: "isCompiledMethod\x0a\x09^ true",
  18906. referencedClasses: [],
  18907. pragmas: [],
  18908. messageSends: []
  18909. }),
  18910. $globals.CompiledMethod);
  18911. $core.addMethod(
  18912. $core.method({
  18913. selector: "isOverridden",
  18914. protocol: "testing",
  18915. fn: function (){
  18916. var self=this,$self=this;
  18917. return $core.withContext(function($ctx1) {
  18918. var $1;
  18919. var $early={};
  18920. try {
  18921. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18922. return $core.withContext(function($ctx2) {
  18923. $1=$recv(each)._includesSelector_($self.selector);
  18924. if($core.assert($1)){
  18925. throw $early=[true];
  18926. }
  18927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18928. }));
  18929. return false;
  18930. }
  18931. catch(e) {if(e===$early)return e[0]; throw e}
  18932. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{})});
  18933. },
  18934. args: [],
  18935. source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18936. referencedClasses: [],
  18937. pragmas: [],
  18938. messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18939. }),
  18940. $globals.CompiledMethod);
  18941. $core.addMethod(
  18942. $core.method({
  18943. selector: "isOverride",
  18944. protocol: "testing",
  18945. fn: function (){
  18946. var self=this,$self=this;
  18947. var superclass;
  18948. return $core.withContext(function($ctx1) {
  18949. var $1,$2,$receiver;
  18950. $1=$self._methodClass();
  18951. $ctx1.sendIdx["methodClass"]=1;
  18952. superclass=$recv($1)._superclass();
  18953. $ctx1.sendIdx["superclass"]=1;
  18954. $2=superclass;
  18955. if(($receiver = $2) == null || $receiver.a$nil){
  18956. return false;
  18957. } else {
  18958. $2;
  18959. }
  18960. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18961. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass})});
  18962. },
  18963. args: [],
  18964. 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",
  18965. referencedClasses: [],
  18966. pragmas: [],
  18967. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18968. }),
  18969. $globals.CompiledMethod);
  18970. $core.addMethod(
  18971. $core.method({
  18972. selector: "messageSends",
  18973. protocol: "accessing",
  18974. fn: function (){
  18975. var self=this,$self=this;
  18976. return $self.messageSends;
  18977. },
  18978. args: [],
  18979. source: "messageSends\x0a\x09^ messageSends",
  18980. referencedClasses: [],
  18981. pragmas: [],
  18982. messageSends: []
  18983. }),
  18984. $globals.CompiledMethod);
  18985. $core.addMethod(
  18986. $core.method({
  18987. selector: "methodClass",
  18988. protocol: "accessing",
  18989. fn: function (){
  18990. var self=this,$self=this;
  18991. return $self.methodClass;
  18992. },
  18993. args: [],
  18994. source: "methodClass\x0a\x09^ methodClass",
  18995. referencedClasses: [],
  18996. pragmas: [],
  18997. messageSends: []
  18998. }),
  18999. $globals.CompiledMethod);
  19000. $core.addMethod(
  19001. $core.method({
  19002. selector: "origin",
  19003. protocol: "accessing",
  19004. fn: function (){
  19005. var self=this,$self=this;
  19006. return $self.owner;
  19007. },
  19008. args: [],
  19009. source: "origin\x0a\x09^ owner",
  19010. referencedClasses: [],
  19011. pragmas: [],
  19012. messageSends: []
  19013. }),
  19014. $globals.CompiledMethod);
  19015. $core.addMethod(
  19016. $core.method({
  19017. selector: "package",
  19018. protocol: "accessing",
  19019. fn: function (){
  19020. var self=this,$self=this;
  19021. return $core.withContext(function($ctx1) {
  19022. var $1,$receiver;
  19023. $1=$self._origin();
  19024. if(($receiver = $1) == null || $receiver.a$nil){
  19025. return $1;
  19026. } else {
  19027. var class_;
  19028. class_=$receiver;
  19029. return $recv(class_)._packageOfProtocol_($self._protocol());
  19030. }
  19031. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  19032. },
  19033. args: [],
  19034. 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 origin ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  19035. referencedClasses: [],
  19036. pragmas: [],
  19037. messageSends: ["ifNotNil:", "origin", "packageOfProtocol:", "protocol"]
  19038. }),
  19039. $globals.CompiledMethod);
  19040. $core.addMethod(
  19041. $core.method({
  19042. selector: "pragmas",
  19043. protocol: "accessing",
  19044. fn: function (){
  19045. var self=this,$self=this;
  19046. return $core.withContext(function($ctx1) {
  19047. return $recv($self._basicPragmas())._collect_((function(each){
  19048. return $core.withContext(function($ctx2) {
  19049. return $recv($globals.Message)._selector_arguments_($recv(each)._first(),$recv(each)._second());
  19050. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19051. }));
  19052. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  19053. },
  19054. args: [],
  19055. source: "pragmas\x0a\x09^ self basicPragmas collect: [ :each | Message selector: each first arguments: each second ]",
  19056. referencedClasses: ["Message"],
  19057. pragmas: [],
  19058. messageSends: ["collect:", "basicPragmas", "selector:arguments:", "first", "second"]
  19059. }),
  19060. $globals.CompiledMethod);
  19061. $core.addMethod(
  19062. $core.method({
  19063. selector: "pragmas:",
  19064. protocol: "accessing",
  19065. fn: function (anArrayOfMessages){
  19066. var self=this,$self=this;
  19067. return $core.withContext(function($ctx1) {
  19068. $self.pragmas=$recv(anArrayOfMessages)._collect_((function(each){
  19069. return $core.withContext(function($ctx2) {
  19070. return [$recv(each)._selector(),$recv(each)._arguments()];
  19071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19072. }));
  19073. return self;
  19074. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{anArrayOfMessages:anArrayOfMessages})});
  19075. },
  19076. args: ["anArrayOfMessages"],
  19077. source: "pragmas: anArrayOfMessages\x0a\x09pragmas := anArrayOfMessages collect: [ :each | { each selector. each arguments } ]",
  19078. referencedClasses: [],
  19079. pragmas: [],
  19080. messageSends: ["collect:", "selector", "arguments"]
  19081. }),
  19082. $globals.CompiledMethod);
  19083. $core.addMethod(
  19084. $core.method({
  19085. selector: "protocol",
  19086. protocol: "accessing",
  19087. fn: function (){
  19088. var self=this,$self=this;
  19089. return $core.withContext(function($ctx1) {
  19090. var $1,$receiver;
  19091. $1=$self.protocol;
  19092. if(($receiver = $1) == null || $receiver.a$nil){
  19093. return $self._defaultProtocol();
  19094. } else {
  19095. return $1;
  19096. }
  19097. }, function($ctx1) {$ctx1.fill(self,"protocol",{})});
  19098. },
  19099. args: [],
  19100. source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
  19101. referencedClasses: [],
  19102. pragmas: [],
  19103. messageSends: ["ifNil:", "defaultProtocol"]
  19104. }),
  19105. $globals.CompiledMethod);
  19106. $core.addMethod(
  19107. $core.method({
  19108. selector: "protocol:",
  19109. protocol: "accessing",
  19110. fn: function (aString){
  19111. var self=this,$self=this;
  19112. var oldProtocol;
  19113. return $core.withContext(function($ctx1) {
  19114. var $1,$2,$4,$3,$5,$receiver;
  19115. oldProtocol=$self._protocol();
  19116. $self.protocol=aString;
  19117. $1=oldProtocol;
  19118. if(($receiver = $1) == null || $receiver.a$nil){
  19119. $1;
  19120. } else {
  19121. $2=$recv($globals.SystemAnnouncer)._current();
  19122. $4=$recv($globals.MethodMoved)._new();
  19123. $recv($4)._method_(self);
  19124. $recv($4)._oldProtocol_(oldProtocol);
  19125. $3=$recv($4)._yourself();
  19126. $recv($2)._announce_($3);
  19127. }
  19128. $5=$self._origin();
  19129. if(($receiver = $5) == null || $receiver.a$nil){
  19130. $5;
  19131. } else {
  19132. var origin;
  19133. origin=$receiver;
  19134. $recv($recv(origin)._organization())._addElement_(aString);
  19135. $recv(origin)._removeProtocolIfEmpty_(oldProtocol);
  19136. }
  19137. return self;
  19138. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol})});
  19139. },
  19140. args: ["aString"],
  19141. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09protocol := aString.\x0a\x0a\x09oldProtocol ifNotNil: [\x0a\x09\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09\x09method: self;\x0a\x09\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09self origin ifNotNil: [ :origin |\x0a\x09\x09origin organization addElement: aString.\x0a\x09\x09origin removeProtocolIfEmpty: oldProtocol ]",
  19142. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  19143. pragmas: [],
  19144. messageSends: ["protocol", "ifNotNil:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "origin", "addElement:", "organization", "removeProtocolIfEmpty:"]
  19145. }),
  19146. $globals.CompiledMethod);
  19147. $core.addMethod(
  19148. $core.method({
  19149. selector: "referencedClasses",
  19150. protocol: "accessing",
  19151. fn: function (){
  19152. var self=this,$self=this;
  19153. return $self.referencedClasses;
  19154. },
  19155. args: [],
  19156. source: "referencedClasses\x0a\x09^ referencedClasses",
  19157. referencedClasses: [],
  19158. pragmas: [],
  19159. messageSends: []
  19160. }),
  19161. $globals.CompiledMethod);
  19162. $core.addMethod(
  19163. $core.method({
  19164. selector: "selector",
  19165. protocol: "accessing",
  19166. fn: function (){
  19167. var self=this,$self=this;
  19168. return $self.selector;
  19169. },
  19170. args: [],
  19171. source: "selector\x0a\x09^ selector",
  19172. referencedClasses: [],
  19173. pragmas: [],
  19174. messageSends: []
  19175. }),
  19176. $globals.CompiledMethod);
  19177. $core.addMethod(
  19178. $core.method({
  19179. selector: "selector:",
  19180. protocol: "accessing",
  19181. fn: function (aString){
  19182. var self=this,$self=this;
  19183. $self.selector=aString;
  19184. return self;
  19185. },
  19186. args: ["aString"],
  19187. source: "selector: aString\x0a\x09selector := aString",
  19188. referencedClasses: [],
  19189. pragmas: [],
  19190. messageSends: []
  19191. }),
  19192. $globals.CompiledMethod);
  19193. $core.addMethod(
  19194. $core.method({
  19195. selector: "sendTo:arguments:",
  19196. protocol: "evaluating",
  19197. fn: function (anObject,aCollection){
  19198. var self=this,$self=this;
  19199. return $core.withContext(function($ctx1) {
  19200. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  19201. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  19202. },
  19203. args: ["anObject", "aCollection"],
  19204. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  19205. referencedClasses: [],
  19206. pragmas: [],
  19207. messageSends: ["applyTo:arguments:", "fn"]
  19208. }),
  19209. $globals.CompiledMethod);
  19210. $core.addMethod(
  19211. $core.method({
  19212. selector: "source",
  19213. protocol: "accessing",
  19214. fn: function (){
  19215. var self=this,$self=this;
  19216. return $core.withContext(function($ctx1) {
  19217. var $1,$receiver;
  19218. $1=$self.source;
  19219. if(($receiver = $1) == null || $receiver.a$nil){
  19220. return "";
  19221. } else {
  19222. return $1;
  19223. }
  19224. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  19225. },
  19226. args: [],
  19227. source: "source\x0a\x09^ source ifNil: [ '' ]",
  19228. referencedClasses: [],
  19229. pragmas: [],
  19230. messageSends: ["ifNil:"]
  19231. }),
  19232. $globals.CompiledMethod);
  19233. $core.addMethod(
  19234. $core.method({
  19235. selector: "source:",
  19236. protocol: "accessing",
  19237. fn: function (aString){
  19238. var self=this,$self=this;
  19239. $self.source=aString;
  19240. return self;
  19241. },
  19242. args: ["aString"],
  19243. source: "source: aString\x0a\x09source := aString",
  19244. referencedClasses: [],
  19245. pragmas: [],
  19246. messageSends: []
  19247. }),
  19248. $globals.CompiledMethod);
  19249. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  19250. $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`";
  19251. $core.addMethod(
  19252. $core.method({
  19253. selector: "addWorker",
  19254. protocol: "private",
  19255. fn: function (){
  19256. var self=this,$self=this;
  19257. return $core.withContext(function($ctx1) {
  19258. $recv($self.worker)._valueWithTimeout_((0));
  19259. $self.poolSize=$recv($self.poolSize).__plus((1));
  19260. return self;
  19261. }, function($ctx1) {$ctx1.fill(self,"addWorker",{})});
  19262. },
  19263. args: [],
  19264. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  19265. referencedClasses: [],
  19266. pragmas: [],
  19267. messageSends: ["valueWithTimeout:", "+"]
  19268. }),
  19269. $globals.ForkPool);
  19270. $core.addMethod(
  19271. $core.method({
  19272. selector: "defaultMaxPoolSize",
  19273. protocol: "defaults",
  19274. fn: function (){
  19275. var self=this,$self=this;
  19276. return $core.withContext(function($ctx1) {
  19277. return $recv($self._class())._defaultMaxPoolSize();
  19278. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{})});
  19279. },
  19280. args: [],
  19281. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  19282. referencedClasses: [],
  19283. pragmas: [],
  19284. messageSends: ["defaultMaxPoolSize", "class"]
  19285. }),
  19286. $globals.ForkPool);
  19287. $core.addMethod(
  19288. $core.method({
  19289. selector: "fork:",
  19290. protocol: "actions",
  19291. fn: function (aBlock){
  19292. var self=this,$self=this;
  19293. return $core.withContext(function($ctx1) {
  19294. var $1;
  19295. $1=$recv($self.poolSize).__lt($self._maxPoolSize());
  19296. if($core.assert($1)){
  19297. $self._addWorker();
  19298. }
  19299. $recv($self.queue)._nextPut_(aBlock);
  19300. return self;
  19301. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock})});
  19302. },
  19303. args: ["aBlock"],
  19304. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  19305. referencedClasses: [],
  19306. pragmas: [],
  19307. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  19308. }),
  19309. $globals.ForkPool);
  19310. $core.addMethod(
  19311. $core.method({
  19312. selector: "initialize",
  19313. protocol: "initialization",
  19314. fn: function (){
  19315. var self=this,$self=this;
  19316. return $core.withContext(function($ctx1) {
  19317. (
  19318. $ctx1.supercall = true,
  19319. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  19320. $ctx1.supercall = false;
  19321. $self.poolSize=(0);
  19322. $self.queue=$recv($globals.Queue)._new();
  19323. $self.worker=$self._makeWorker();
  19324. return self;
  19325. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  19326. },
  19327. args: [],
  19328. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  19329. referencedClasses: ["Queue"],
  19330. pragmas: [],
  19331. messageSends: ["initialize", "new", "makeWorker"]
  19332. }),
  19333. $globals.ForkPool);
  19334. $core.addMethod(
  19335. $core.method({
  19336. selector: "makeWorker",
  19337. protocol: "initialization",
  19338. fn: function (){
  19339. var self=this,$self=this;
  19340. var sentinel;
  19341. return $core.withContext(function($ctx1) {
  19342. var $1;
  19343. sentinel=$recv($globals.Object)._new();
  19344. return (function(){
  19345. var block;
  19346. return $core.withContext(function($ctx2) {
  19347. $self.poolSize=$recv($self.poolSize).__minus((1));
  19348. block=$recv($self.queue)._nextIfAbsent_((function(){
  19349. return sentinel;
  19350. }));
  19351. $1=$recv(block).__eq_eq(sentinel);
  19352. if(!$core.assert($1)){
  19353. return $recv((function(){
  19354. return $core.withContext(function($ctx3) {
  19355. return $recv(block)._value();
  19356. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  19357. }))._ensure_((function(){
  19358. return $core.withContext(function($ctx3) {
  19359. return $self._addWorker();
  19360. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  19361. }));
  19362. }
  19363. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  19364. });
  19365. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel})});
  19366. },
  19367. args: [],
  19368. 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 ] ]]",
  19369. referencedClasses: ["Object"],
  19370. pragmas: [],
  19371. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  19372. }),
  19373. $globals.ForkPool);
  19374. $core.addMethod(
  19375. $core.method({
  19376. selector: "maxPoolSize",
  19377. protocol: "accessing",
  19378. fn: function (){
  19379. var self=this,$self=this;
  19380. return $core.withContext(function($ctx1) {
  19381. var $1,$receiver;
  19382. $1=$self.maxPoolSize;
  19383. if(($receiver = $1) == null || $receiver.a$nil){
  19384. return $self._defaultMaxPoolSize();
  19385. } else {
  19386. return $1;
  19387. }
  19388. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{})});
  19389. },
  19390. args: [],
  19391. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  19392. referencedClasses: [],
  19393. pragmas: [],
  19394. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  19395. }),
  19396. $globals.ForkPool);
  19397. $core.addMethod(
  19398. $core.method({
  19399. selector: "maxPoolSize:",
  19400. protocol: "accessing",
  19401. fn: function (anInteger){
  19402. var self=this,$self=this;
  19403. $self.maxPoolSize=anInteger;
  19404. return self;
  19405. },
  19406. args: ["anInteger"],
  19407. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  19408. referencedClasses: [],
  19409. pragmas: [],
  19410. messageSends: []
  19411. }),
  19412. $globals.ForkPool);
  19413. $core.setSlots($globals.ForkPool.a$cls, ["default"]);
  19414. $core.addMethod(
  19415. $core.method({
  19416. selector: "default",
  19417. protocol: "accessing",
  19418. fn: function (){
  19419. var self=this,$self=this;
  19420. return $core.withContext(function($ctx1) {
  19421. var $1,$receiver;
  19422. $1=$self.default;
  19423. if(($receiver = $1) == null || $receiver.a$nil){
  19424. $self.default=$self._new();
  19425. return $self.default;
  19426. } else {
  19427. return $1;
  19428. }
  19429. }, function($ctx1) {$ctx1.fill(self,"default",{})});
  19430. },
  19431. args: [],
  19432. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  19433. referencedClasses: [],
  19434. pragmas: [],
  19435. messageSends: ["ifNil:", "new"]
  19436. }),
  19437. $globals.ForkPool.a$cls);
  19438. $core.addMethod(
  19439. $core.method({
  19440. selector: "defaultMaxPoolSize",
  19441. protocol: "accessing",
  19442. fn: function (){
  19443. var self=this,$self=this;
  19444. return (100);
  19445. },
  19446. args: [],
  19447. source: "defaultMaxPoolSize\x0a\x09^ 100",
  19448. referencedClasses: [],
  19449. pragmas: [],
  19450. messageSends: []
  19451. }),
  19452. $globals.ForkPool.a$cls);
  19453. $core.addMethod(
  19454. $core.method({
  19455. selector: "resetDefault",
  19456. protocol: "accessing",
  19457. fn: function (){
  19458. var self=this,$self=this;
  19459. $self.default=nil;
  19460. return self;
  19461. },
  19462. args: [],
  19463. source: "resetDefault\x0a\x09default := nil",
  19464. referencedClasses: [],
  19465. pragmas: [],
  19466. messageSends: []
  19467. }),
  19468. $globals.ForkPool.a$cls);
  19469. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  19470. $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.";
  19471. $core.addMethod(
  19472. $core.method({
  19473. selector: "arguments",
  19474. protocol: "accessing",
  19475. fn: function (){
  19476. var self=this,$self=this;
  19477. return $self.arguments;
  19478. },
  19479. args: [],
  19480. source: "arguments\x0a\x09^ arguments",
  19481. referencedClasses: [],
  19482. pragmas: [],
  19483. messageSends: []
  19484. }),
  19485. $globals.Message);
  19486. $core.addMethod(
  19487. $core.method({
  19488. selector: "arguments:",
  19489. protocol: "accessing",
  19490. fn: function (anArray){
  19491. var self=this,$self=this;
  19492. $self.arguments=anArray;
  19493. return self;
  19494. },
  19495. args: ["anArray"],
  19496. source: "arguments: anArray\x0a\x09arguments := anArray",
  19497. referencedClasses: [],
  19498. pragmas: [],
  19499. messageSends: []
  19500. }),
  19501. $globals.Message);
  19502. $core.addMethod(
  19503. $core.method({
  19504. selector: "printOn:",
  19505. protocol: "printing",
  19506. fn: function (aStream){
  19507. var self=this,$self=this;
  19508. return $core.withContext(function($ctx1) {
  19509. (
  19510. $ctx1.supercall = true,
  19511. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19512. $ctx1.supercall = false;
  19513. $recv(aStream)._nextPutAll_("(");
  19514. $ctx1.sendIdx["nextPutAll:"]=1;
  19515. $recv(aStream)._nextPutAll_($self._selector());
  19516. $ctx1.sendIdx["nextPutAll:"]=2;
  19517. $recv(aStream)._nextPutAll_(")");
  19518. return self;
  19519. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19520. },
  19521. args: ["aStream"],
  19522. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  19523. referencedClasses: [],
  19524. pragmas: [],
  19525. messageSends: ["printOn:", "nextPutAll:", "selector"]
  19526. }),
  19527. $globals.Message);
  19528. $core.addMethod(
  19529. $core.method({
  19530. selector: "selector",
  19531. protocol: "accessing",
  19532. fn: function (){
  19533. var self=this,$self=this;
  19534. return $self.selector;
  19535. },
  19536. args: [],
  19537. source: "selector\x0a\x09^ selector",
  19538. referencedClasses: [],
  19539. pragmas: [],
  19540. messageSends: []
  19541. }),
  19542. $globals.Message);
  19543. $core.addMethod(
  19544. $core.method({
  19545. selector: "selector:",
  19546. protocol: "accessing",
  19547. fn: function (aString){
  19548. var self=this,$self=this;
  19549. $self.selector=aString;
  19550. return self;
  19551. },
  19552. args: ["aString"],
  19553. source: "selector: aString\x0a\x09selector := aString",
  19554. referencedClasses: [],
  19555. pragmas: [],
  19556. messageSends: []
  19557. }),
  19558. $globals.Message);
  19559. $core.addMethod(
  19560. $core.method({
  19561. selector: "sendTo:",
  19562. protocol: "actions",
  19563. fn: function (anObject){
  19564. var self=this,$self=this;
  19565. return $core.withContext(function($ctx1) {
  19566. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  19567. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject})});
  19568. },
  19569. args: ["anObject"],
  19570. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  19571. referencedClasses: [],
  19572. pragmas: [],
  19573. messageSends: ["perform:withArguments:", "selector", "arguments"]
  19574. }),
  19575. $globals.Message);
  19576. $core.addMethod(
  19577. $core.method({
  19578. selector: "selector:arguments:",
  19579. protocol: "instance creation",
  19580. fn: function (aString,anArray){
  19581. var self=this,$self=this;
  19582. return $core.withContext(function($ctx1) {
  19583. var $1;
  19584. $1=$self._new();
  19585. $recv($1)._selector_(aString);
  19586. $recv($1)._arguments_(anArray);
  19587. return $recv($1)._yourself();
  19588. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray})});
  19589. },
  19590. args: ["aString", "anArray"],
  19591. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  19592. referencedClasses: [],
  19593. pragmas: [],
  19594. messageSends: ["selector:", "new", "arguments:", "yourself"]
  19595. }),
  19596. $globals.Message.a$cls);
  19597. $core.addMethod(
  19598. $core.method({
  19599. selector: "selector:arguments:notUnderstoodBy:",
  19600. protocol: "dnu handling",
  19601. fn: function (aString,anArray,anObject){
  19602. var self=this,$self=this;
  19603. return $core.withContext(function($ctx1) {
  19604. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  19605. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject})});
  19606. },
  19607. args: ["aString", "anArray", "anObject"],
  19608. 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)",
  19609. referencedClasses: [],
  19610. pragmas: [],
  19611. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  19612. }),
  19613. $globals.Message.a$cls);
  19614. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  19615. $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.";
  19616. $core.addMethod(
  19617. $core.method({
  19618. selector: "arguments",
  19619. protocol: "accessing",
  19620. fn: function (){
  19621. var self=this,$self=this;
  19622. return $core.withContext(function($ctx1) {
  19623. return $recv($self.message)._arguments();
  19624. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  19625. },
  19626. args: [],
  19627. source: "arguments\x0a\x09^ message arguments",
  19628. referencedClasses: [],
  19629. pragmas: [],
  19630. messageSends: ["arguments"]
  19631. }),
  19632. $globals.MessageSend);
  19633. $core.addMethod(
  19634. $core.method({
  19635. selector: "arguments:",
  19636. protocol: "accessing",
  19637. fn: function (aCollection){
  19638. var self=this,$self=this;
  19639. return $core.withContext(function($ctx1) {
  19640. $recv($self.message)._arguments_(aCollection);
  19641. return self;
  19642. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection})});
  19643. },
  19644. args: ["aCollection"],
  19645. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  19646. referencedClasses: [],
  19647. pragmas: [],
  19648. messageSends: ["arguments:"]
  19649. }),
  19650. $globals.MessageSend);
  19651. $core.addMethod(
  19652. $core.method({
  19653. selector: "initialize",
  19654. protocol: "initialization",
  19655. fn: function (){
  19656. var self=this,$self=this;
  19657. return $core.withContext(function($ctx1) {
  19658. (
  19659. $ctx1.supercall = true,
  19660. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  19661. $ctx1.supercall = false;
  19662. $self.message=$recv($globals.Message)._new();
  19663. return self;
  19664. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  19665. },
  19666. args: [],
  19667. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  19668. referencedClasses: ["Message"],
  19669. pragmas: [],
  19670. messageSends: ["initialize", "new"]
  19671. }),
  19672. $globals.MessageSend);
  19673. $core.addMethod(
  19674. $core.method({
  19675. selector: "printOn:",
  19676. protocol: "printing",
  19677. fn: function (aStream){
  19678. var self=this,$self=this;
  19679. return $core.withContext(function($ctx1) {
  19680. (
  19681. $ctx1.supercall = true,
  19682. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19683. $ctx1.supercall = false;
  19684. $recv(aStream)._nextPutAll_("(");
  19685. $ctx1.sendIdx["nextPutAll:"]=1;
  19686. $recv(aStream)._nextPutAll_($self._receiver());
  19687. $ctx1.sendIdx["nextPutAll:"]=2;
  19688. $recv(aStream)._nextPutAll_(" >> ");
  19689. $ctx1.sendIdx["nextPutAll:"]=3;
  19690. $recv(aStream)._nextPutAll_($self._selector());
  19691. $ctx1.sendIdx["nextPutAll:"]=4;
  19692. $recv(aStream)._nextPutAll_(")");
  19693. return self;
  19694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19695. },
  19696. args: ["aStream"],
  19697. 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: ')'",
  19698. referencedClasses: [],
  19699. pragmas: [],
  19700. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  19701. }),
  19702. $globals.MessageSend);
  19703. $core.addMethod(
  19704. $core.method({
  19705. selector: "receiver",
  19706. protocol: "accessing",
  19707. fn: function (){
  19708. var self=this,$self=this;
  19709. return $self.receiver;
  19710. },
  19711. args: [],
  19712. source: "receiver\x0a\x09^ receiver",
  19713. referencedClasses: [],
  19714. pragmas: [],
  19715. messageSends: []
  19716. }),
  19717. $globals.MessageSend);
  19718. $core.addMethod(
  19719. $core.method({
  19720. selector: "receiver:",
  19721. protocol: "accessing",
  19722. fn: function (anObject){
  19723. var self=this,$self=this;
  19724. $self.receiver=anObject;
  19725. return self;
  19726. },
  19727. args: ["anObject"],
  19728. source: "receiver: anObject\x0a\x09receiver := anObject",
  19729. referencedClasses: [],
  19730. pragmas: [],
  19731. messageSends: []
  19732. }),
  19733. $globals.MessageSend);
  19734. $core.addMethod(
  19735. $core.method({
  19736. selector: "selector",
  19737. protocol: "accessing",
  19738. fn: function (){
  19739. var self=this,$self=this;
  19740. return $core.withContext(function($ctx1) {
  19741. return $recv($self.message)._selector();
  19742. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19743. },
  19744. args: [],
  19745. source: "selector\x0a\x09^ message selector",
  19746. referencedClasses: [],
  19747. pragmas: [],
  19748. messageSends: ["selector"]
  19749. }),
  19750. $globals.MessageSend);
  19751. $core.addMethod(
  19752. $core.method({
  19753. selector: "selector:",
  19754. protocol: "accessing",
  19755. fn: function (aString){
  19756. var self=this,$self=this;
  19757. return $core.withContext(function($ctx1) {
  19758. $recv($self.message)._selector_(aString);
  19759. return self;
  19760. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString})});
  19761. },
  19762. args: ["aString"],
  19763. source: "selector: aString\x0a\x09message selector: aString",
  19764. referencedClasses: [],
  19765. pragmas: [],
  19766. messageSends: ["selector:"]
  19767. }),
  19768. $globals.MessageSend);
  19769. $core.addMethod(
  19770. $core.method({
  19771. selector: "value",
  19772. protocol: "evaluating",
  19773. fn: function (){
  19774. var self=this,$self=this;
  19775. return $core.withContext(function($ctx1) {
  19776. return $recv($self.message)._sendTo_($self._receiver());
  19777. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  19778. },
  19779. args: [],
  19780. source: "value\x0a\x09^ message sendTo: self receiver",
  19781. referencedClasses: [],
  19782. pragmas: [],
  19783. messageSends: ["sendTo:", "receiver"]
  19784. }),
  19785. $globals.MessageSend);
  19786. $core.addMethod(
  19787. $core.method({
  19788. selector: "value:",
  19789. protocol: "evaluating",
  19790. fn: function (anObject){
  19791. var self=this,$self=this;
  19792. return $core.withContext(function($ctx1) {
  19793. var $1;
  19794. $1=$self.message;
  19795. $recv($1)._arguments_([anObject]);
  19796. return $recv($1)._sendTo_($self._receiver());
  19797. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  19798. },
  19799. args: ["anObject"],
  19800. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  19801. referencedClasses: [],
  19802. pragmas: [],
  19803. messageSends: ["arguments:", "sendTo:", "receiver"]
  19804. }),
  19805. $globals.MessageSend);
  19806. $core.addMethod(
  19807. $core.method({
  19808. selector: "value:value:",
  19809. protocol: "evaluating",
  19810. fn: function (firstArgument,secondArgument){
  19811. var self=this,$self=this;
  19812. return $core.withContext(function($ctx1) {
  19813. var $1;
  19814. $1=$self.message;
  19815. $recv($1)._arguments_([firstArgument,secondArgument]);
  19816. return $recv($1)._sendTo_($self._receiver());
  19817. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  19818. },
  19819. args: ["firstArgument", "secondArgument"],
  19820. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19821. referencedClasses: [],
  19822. pragmas: [],
  19823. messageSends: ["arguments:", "sendTo:", "receiver"]
  19824. }),
  19825. $globals.MessageSend);
  19826. $core.addMethod(
  19827. $core.method({
  19828. selector: "value:value:value:",
  19829. protocol: "evaluating",
  19830. fn: function (firstArgument,secondArgument,thirdArgument){
  19831. var self=this,$self=this;
  19832. return $core.withContext(function($ctx1) {
  19833. var $1;
  19834. $1=$self.message;
  19835. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19836. return $recv($1)._sendTo_($self._receiver());
  19837. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  19838. },
  19839. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19840. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19841. referencedClasses: [],
  19842. pragmas: [],
  19843. messageSends: ["arguments:", "sendTo:", "receiver"]
  19844. }),
  19845. $globals.MessageSend);
  19846. $core.addMethod(
  19847. $core.method({
  19848. selector: "valueWithPossibleArguments:",
  19849. protocol: "evaluating",
  19850. fn: function (aCollection){
  19851. var self=this,$self=this;
  19852. return $core.withContext(function($ctx1) {
  19853. $self._arguments_(aCollection);
  19854. return $self._value();
  19855. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  19856. },
  19857. args: ["aCollection"],
  19858. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19859. referencedClasses: [],
  19860. pragmas: [],
  19861. messageSends: ["arguments:", "value"]
  19862. }),
  19863. $globals.MessageSend);
  19864. $core.addClass("MethodContext", $globals.Object, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"], "Kernel-Methods");
  19865. $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`.";
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "basicReceiver",
  19869. protocol: "accessing",
  19870. fn: function (){
  19871. var self=this,$self=this;
  19872. return $self.receiver;
  19873. },
  19874. args: [],
  19875. source: "basicReceiver\x0a\x09^ receiver",
  19876. referencedClasses: [],
  19877. pragmas: [],
  19878. messageSends: []
  19879. }),
  19880. $globals.MethodContext);
  19881. $core.addMethod(
  19882. $core.method({
  19883. selector: "evaluatedSelector",
  19884. protocol: "accessing",
  19885. fn: function (){
  19886. var self=this,$self=this;
  19887. return $self.evaluatedSelector;
  19888. },
  19889. args: [],
  19890. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  19891. referencedClasses: [],
  19892. pragmas: [],
  19893. messageSends: []
  19894. }),
  19895. $globals.MethodContext);
  19896. $core.addMethod(
  19897. $core.method({
  19898. selector: "home",
  19899. protocol: "accessing",
  19900. fn: function (){
  19901. var self=this,$self=this;
  19902. return $self.homeContext;
  19903. },
  19904. args: [],
  19905. source: "home\x0a\x09^ homeContext",
  19906. referencedClasses: [],
  19907. pragmas: [],
  19908. messageSends: []
  19909. }),
  19910. $globals.MethodContext);
  19911. $core.addMethod(
  19912. $core.method({
  19913. selector: "index",
  19914. protocol: "accessing",
  19915. fn: function (){
  19916. var self=this,$self=this;
  19917. return $core.withContext(function($ctx1) {
  19918. var $1,$receiver;
  19919. $1=$self.index;
  19920. if(($receiver = $1) == null || $receiver.a$nil){
  19921. return (0);
  19922. } else {
  19923. return $1;
  19924. }
  19925. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  19926. },
  19927. args: [],
  19928. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  19929. referencedClasses: [],
  19930. pragmas: [],
  19931. messageSends: ["ifNil:"]
  19932. }),
  19933. $globals.MethodContext);
  19934. $core.addMethod(
  19935. $core.method({
  19936. selector: "locals",
  19937. protocol: "accessing",
  19938. fn: function (){
  19939. var self=this,$self=this;
  19940. return $self.locals;
  19941. },
  19942. args: [],
  19943. source: "locals\x0a\x09^ locals",
  19944. referencedClasses: [],
  19945. pragmas: [],
  19946. messageSends: []
  19947. }),
  19948. $globals.MethodContext);
  19949. $core.addMethod(
  19950. $core.method({
  19951. selector: "outerContext",
  19952. protocol: "accessing",
  19953. fn: function (){
  19954. var self=this,$self=this;
  19955. return $core.withContext(function($ctx1) {
  19956. var $1,$receiver;
  19957. $1=$self.outerContext;
  19958. if(($receiver = $1) == null || $receiver.a$nil){
  19959. return $self._home();
  19960. } else {
  19961. return $1;
  19962. }
  19963. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  19964. },
  19965. args: [],
  19966. source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ]",
  19967. referencedClasses: [],
  19968. pragmas: [],
  19969. messageSends: ["ifNil:", "home"]
  19970. }),
  19971. $globals.MethodContext);
  19972. $core.addMethod(
  19973. $core.method({
  19974. selector: "selector",
  19975. protocol: "accessing",
  19976. fn: function (){
  19977. var self=this,$self=this;
  19978. return $core.withContext(function($ctx1) {
  19979. var $1,$receiver;
  19980. $1=$self.selector;
  19981. if(($receiver = $1) == null || $receiver.a$nil){
  19982. return $1;
  19983. } else {
  19984. return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
  19985. }
  19986. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19987. },
  19988. args: [],
  19989. source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
  19990. referencedClasses: ["Smalltalk"],
  19991. pragmas: [],
  19992. messageSends: ["ifNotNil:", "js2st:", "core"]
  19993. }),
  19994. $globals.MethodContext);
  19995. $core.addMethod(
  19996. $core.method({
  19997. selector: "sendIndexes",
  19998. protocol: "accessing",
  19999. fn: function (){
  20000. var self=this,$self=this;
  20001. return $self.sendIdx;
  20002. },
  20003. args: [],
  20004. source: "sendIndexes\x0a\x09^ sendIdx",
  20005. referencedClasses: [],
  20006. pragmas: [],
  20007. messageSends: []
  20008. }),
  20009. $globals.MethodContext);
  20010. $core.addMethod(
  20011. $core.method({
  20012. selector: "stubHere",
  20013. protocol: "accessing",
  20014. fn: function (){
  20015. var self=this,$self=this;
  20016. return $core.withContext(function($ctx1) {
  20017. $self.homeContext=$recv($globals.JSObjectProxy)._undefined();
  20018. return self;
  20019. }, function($ctx1) {$ctx1.fill(self,"stubHere",{})});
  20020. },
  20021. args: [],
  20022. source: "stubHere\x0a\x09homeContext := JSObjectProxy undefined",
  20023. referencedClasses: ["JSObjectProxy"],
  20024. pragmas: [],
  20025. messageSends: ["undefined"]
  20026. }),
  20027. $globals.MethodContext);
  20028. $core.addMethod(
  20029. $core.method({
  20030. selector: "stubToAtMost:",
  20031. protocol: "error handling",
  20032. fn: function (anInteger){
  20033. var self=this,$self=this;
  20034. var context;
  20035. return $core.withContext(function($ctx1) {
  20036. var $1,$2,$receiver;
  20037. context=self;
  20038. $recv(anInteger)._timesRepeat_((function(){
  20039. return $core.withContext(function($ctx2) {
  20040. $1=context;
  20041. if(($receiver = $1) == null || $receiver.a$nil){
  20042. context=$1;
  20043. } else {
  20044. context=$recv(context)._home();
  20045. }
  20046. return context;
  20047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20048. }));
  20049. $2=context;
  20050. if(($receiver = $2) == null || $receiver.a$nil){
  20051. $2;
  20052. } else {
  20053. $recv(context)._stubHere();
  20054. }
  20055. return self;
  20056. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context})});
  20057. },
  20058. args: ["anInteger"],
  20059. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  20060. referencedClasses: [],
  20061. pragmas: [],
  20062. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  20063. }),
  20064. $globals.MethodContext);
  20065. $core.addMethod(
  20066. $core.method({
  20067. selector: "supercall",
  20068. protocol: "accessing",
  20069. fn: function (){
  20070. var self=this,$self=this;
  20071. return $core.withContext(function($ctx1) {
  20072. return $recv($self.supercall).__eq(true);
  20073. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  20074. },
  20075. args: [],
  20076. source: "supercall\x0a\x09^ supercall = true",
  20077. referencedClasses: [],
  20078. pragmas: [],
  20079. messageSends: ["="]
  20080. }),
  20081. $globals.MethodContext);
  20082. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  20083. $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' ]";
  20084. $core.addMethod(
  20085. $core.method({
  20086. selector: "constructorNamed:",
  20087. protocol: "instance creation",
  20088. fn: function (aString){
  20089. var self=this,$self=this;
  20090. return $core.withContext(function($ctx1) {
  20091. var nativeFunc=$globals.Platform._globals()[aString];
  20092. return new nativeFunc();
  20093. ;
  20094. return self;
  20095. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString})});
  20096. },
  20097. args: ["aString"],
  20098. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  20099. referencedClasses: [],
  20100. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  20101. messageSends: []
  20102. }),
  20103. $globals.NativeFunction.a$cls);
  20104. $core.addMethod(
  20105. $core.method({
  20106. selector: "constructorNamed:value:",
  20107. protocol: "instance creation",
  20108. fn: function (aString,anObject){
  20109. var self=this,$self=this;
  20110. return $core.withContext(function($ctx1) {
  20111. var nativeFunc=$globals.Platform._globals()[aString];
  20112. return new nativeFunc(anObject);
  20113. ;
  20114. return self;
  20115. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject})});
  20116. },
  20117. args: ["aString", "anObject"],
  20118. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  20119. referencedClasses: [],
  20120. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  20121. messageSends: []
  20122. }),
  20123. $globals.NativeFunction.a$cls);
  20124. $core.addMethod(
  20125. $core.method({
  20126. selector: "constructorNamed:value:value:",
  20127. protocol: "instance creation",
  20128. fn: function (aString,anObject,anObject2){
  20129. var self=this,$self=this;
  20130. return $core.withContext(function($ctx1) {
  20131. var nativeFunc=$globals.Platform._globals[aString];
  20132. return new nativeFunc(anObject,anObject2);
  20133. ;
  20134. return self;
  20135. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  20136. },
  20137. args: ["aString", "anObject", "anObject2"],
  20138. 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'>",
  20139. referencedClasses: [],
  20140. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20141. messageSends: []
  20142. }),
  20143. $globals.NativeFunction.a$cls);
  20144. $core.addMethod(
  20145. $core.method({
  20146. selector: "constructorNamed:value:value:value:",
  20147. protocol: "instance creation",
  20148. fn: function (aString,anObject,anObject2,anObject3){
  20149. var self=this,$self=this;
  20150. return $core.withContext(function($ctx1) {
  20151. var nativeFunc=$globals.Platform._globals[aString];
  20152. return new nativeFunc(anObject,anObject2, anObject3);
  20153. ;
  20154. return self;
  20155. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20156. },
  20157. args: ["aString", "anObject", "anObject2", "anObject3"],
  20158. 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'>",
  20159. referencedClasses: [],
  20160. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20161. messageSends: []
  20162. }),
  20163. $globals.NativeFunction.a$cls);
  20164. $core.addMethod(
  20165. $core.method({
  20166. selector: "constructorOf:",
  20167. protocol: "instance creation",
  20168. fn: function (nativeFunc){
  20169. var self=this,$self=this;
  20170. return $core.withContext(function($ctx1) {
  20171. return new nativeFunc();
  20172. ;
  20173. return self;
  20174. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc})});
  20175. },
  20176. args: ["nativeFunc"],
  20177. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  20178. referencedClasses: [],
  20179. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  20180. messageSends: []
  20181. }),
  20182. $globals.NativeFunction.a$cls);
  20183. $core.addMethod(
  20184. $core.method({
  20185. selector: "constructorOf:value:",
  20186. protocol: "instance creation",
  20187. fn: function (nativeFunc,anObject){
  20188. var self=this,$self=this;
  20189. return $core.withContext(function($ctx1) {
  20190. return new nativeFunc(anObject);
  20191. ;
  20192. return self;
  20193. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  20194. },
  20195. args: ["nativeFunc", "anObject"],
  20196. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  20197. referencedClasses: [],
  20198. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  20199. messageSends: []
  20200. }),
  20201. $globals.NativeFunction.a$cls);
  20202. $core.addMethod(
  20203. $core.method({
  20204. selector: "constructorOf:value:value:",
  20205. protocol: "instance creation",
  20206. fn: function (nativeFunc,anObject,anObject2){
  20207. var self=this,$self=this;
  20208. return $core.withContext(function($ctx1) {
  20209. return new nativeFunc(anObject,anObject2);
  20210. ;
  20211. return self;
  20212. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  20213. },
  20214. args: ["nativeFunc", "anObject", "anObject2"],
  20215. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  20216. referencedClasses: [],
  20217. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20218. messageSends: []
  20219. }),
  20220. $globals.NativeFunction.a$cls);
  20221. $core.addMethod(
  20222. $core.method({
  20223. selector: "constructorOf:value:value:value:",
  20224. protocol: "instance creation",
  20225. fn: function (nativeFunc,anObject,anObject2,anObject3){
  20226. var self=this,$self=this;
  20227. return $core.withContext(function($ctx1) {
  20228. return new nativeFunc(anObject,anObject2, anObject3);
  20229. ;
  20230. return self;
  20231. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20232. },
  20233. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  20234. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  20235. referencedClasses: [],
  20236. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20237. messageSends: []
  20238. }),
  20239. $globals.NativeFunction.a$cls);
  20240. $core.addMethod(
  20241. $core.method({
  20242. selector: "exists:",
  20243. protocol: "testing",
  20244. fn: function (aString){
  20245. var self=this,$self=this;
  20246. return $core.withContext(function($ctx1) {
  20247. return $recv($globals.Platform)._includesGlobal_(aString);
  20248. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString})});
  20249. },
  20250. args: ["aString"],
  20251. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  20252. referencedClasses: ["Platform"],
  20253. pragmas: [],
  20254. messageSends: ["includesGlobal:"]
  20255. }),
  20256. $globals.NativeFunction.a$cls);
  20257. $core.addMethod(
  20258. $core.method({
  20259. selector: "functionNamed:",
  20260. protocol: "function calling",
  20261. fn: function (aString){
  20262. var self=this,$self=this;
  20263. return $core.withContext(function($ctx1) {
  20264. var nativeFunc=$globals.Platform._globals[aString];
  20265. return nativeFunc();
  20266. ;
  20267. return self;
  20268. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString})});
  20269. },
  20270. args: ["aString"],
  20271. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  20272. referencedClasses: [],
  20273. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  20274. messageSends: []
  20275. }),
  20276. $globals.NativeFunction.a$cls);
  20277. $core.addMethod(
  20278. $core.method({
  20279. selector: "functionNamed:value:",
  20280. protocol: "function calling",
  20281. fn: function (aString,anObject){
  20282. var self=this,$self=this;
  20283. return $core.withContext(function($ctx1) {
  20284. var nativeFunc=$globals.Platform._globals()[aString];
  20285. return nativeFunc(anObject);
  20286. ;
  20287. return self;
  20288. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject})});
  20289. },
  20290. args: ["aString", "anObject"],
  20291. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  20292. referencedClasses: [],
  20293. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  20294. messageSends: []
  20295. }),
  20296. $globals.NativeFunction.a$cls);
  20297. $core.addMethod(
  20298. $core.method({
  20299. selector: "functionNamed:value:value:",
  20300. protocol: "function calling",
  20301. fn: function (aString,anObject,anObject2){
  20302. var self=this,$self=this;
  20303. return $core.withContext(function($ctx1) {
  20304. var nativeFunc=$globals.Platform._globals()[aString];
  20305. return nativeFunc(anObject,anObject2);
  20306. ;
  20307. return self;
  20308. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  20309. },
  20310. args: ["aString", "anObject", "anObject2"],
  20311. 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'>",
  20312. referencedClasses: [],
  20313. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20314. messageSends: []
  20315. }),
  20316. $globals.NativeFunction.a$cls);
  20317. $core.addMethod(
  20318. $core.method({
  20319. selector: "functionNamed:value:value:value:",
  20320. protocol: "function calling",
  20321. fn: function (aString,anObject,anObject2,anObject3){
  20322. var self=this,$self=this;
  20323. return $core.withContext(function($ctx1) {
  20324. var nativeFunc=$globals.Platform._globals()[aString];
  20325. return nativeFunc(anObject,anObject2, anObject3);
  20326. ;
  20327. return self;
  20328. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20329. },
  20330. args: ["aString", "anObject", "anObject2", "anObject3"],
  20331. 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'>",
  20332. referencedClasses: [],
  20333. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20334. messageSends: []
  20335. }),
  20336. $globals.NativeFunction.a$cls);
  20337. $core.addMethod(
  20338. $core.method({
  20339. selector: "functionNamed:valueWithArgs:",
  20340. protocol: "function calling",
  20341. fn: function (aString,args){
  20342. var self=this,$self=this;
  20343. return $core.withContext(function($ctx1) {
  20344. var nativeFunc=$globals.Platform._globals()[aString];
  20345. return Function.prototype.apply.call(nativeFunc, null, args);
  20346. ;
  20347. return self;
  20348. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args})});
  20349. },
  20350. args: ["aString", "args"],
  20351. 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'>",
  20352. referencedClasses: [],
  20353. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  20354. messageSends: []
  20355. }),
  20356. $globals.NativeFunction.a$cls);
  20357. $core.addMethod(
  20358. $core.method({
  20359. selector: "functionOf:",
  20360. protocol: "function calling",
  20361. fn: function (nativeFunc){
  20362. var self=this,$self=this;
  20363. return $core.withContext(function($ctx1) {
  20364. return nativeFunc();
  20365. ;
  20366. return self;
  20367. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc})});
  20368. },
  20369. args: ["nativeFunc"],
  20370. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  20371. referencedClasses: [],
  20372. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  20373. messageSends: []
  20374. }),
  20375. $globals.NativeFunction.a$cls);
  20376. $core.addMethod(
  20377. $core.method({
  20378. selector: "functionOf:value:",
  20379. protocol: "function calling",
  20380. fn: function (nativeFunc,anObject){
  20381. var self=this,$self=this;
  20382. return $core.withContext(function($ctx1) {
  20383. return nativeFunc(anObject);
  20384. ;
  20385. return self;
  20386. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  20387. },
  20388. args: ["nativeFunc", "anObject"],
  20389. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  20390. referencedClasses: [],
  20391. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  20392. messageSends: []
  20393. }),
  20394. $globals.NativeFunction.a$cls);
  20395. $core.addMethod(
  20396. $core.method({
  20397. selector: "functionOf:value:value:",
  20398. protocol: "function calling",
  20399. fn: function (nativeFunc,anObject,anObject2){
  20400. var self=this,$self=this;
  20401. return $core.withContext(function($ctx1) {
  20402. return nativeFunc(anObject,anObject2);
  20403. ;
  20404. return self;
  20405. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  20406. },
  20407. args: ["nativeFunc", "anObject", "anObject2"],
  20408. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  20409. referencedClasses: [],
  20410. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  20411. messageSends: []
  20412. }),
  20413. $globals.NativeFunction.a$cls);
  20414. $core.addMethod(
  20415. $core.method({
  20416. selector: "functionOf:value:value:value:",
  20417. protocol: "function calling",
  20418. fn: function (nativeFunc,anObject,anObject2,anObject3){
  20419. var self=this,$self=this;
  20420. return $core.withContext(function($ctx1) {
  20421. return nativeFunc(anObject,anObject2, anObject3);
  20422. ;
  20423. return self;
  20424. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20425. },
  20426. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  20427. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  20428. referencedClasses: [],
  20429. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  20430. messageSends: []
  20431. }),
  20432. $globals.NativeFunction.a$cls);
  20433. $core.addMethod(
  20434. $core.method({
  20435. selector: "functionOf:valueWithArgs:",
  20436. protocol: "function calling",
  20437. fn: function (nativeFunc,args){
  20438. var self=this,$self=this;
  20439. return $core.withContext(function($ctx1) {
  20440. return Function.prototype.apply.call(nativeFunc, null, args);
  20441. ;
  20442. return self;
  20443. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args})});
  20444. },
  20445. args: ["nativeFunc", "args"],
  20446. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  20447. referencedClasses: [],
  20448. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  20449. messageSends: []
  20450. }),
  20451. $globals.NativeFunction.a$cls);
  20452. $core.addMethod(
  20453. $core.method({
  20454. selector: "isNativeFunction:",
  20455. protocol: "testing",
  20456. fn: function (anObject){
  20457. var self=this,$self=this;
  20458. return $core.withContext(function($ctx1) {
  20459. return typeof anObject === "function";
  20460. return self;
  20461. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject})});
  20462. },
  20463. args: ["anObject"],
  20464. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  20465. referencedClasses: [],
  20466. pragmas: [["inlineJS:", ["return typeof anObject === \x22function\x22"]]],
  20467. messageSends: []
  20468. }),
  20469. $globals.NativeFunction.a$cls);
  20470. $core.addMethod(
  20471. $core.method({
  20472. selector: "methodOf:this:",
  20473. protocol: "method calling",
  20474. fn: function (nativeFunc,thisObject){
  20475. var self=this,$self=this;
  20476. return $core.withContext(function($ctx1) {
  20477. return Function.prototype.call.call(nativeFunc, thisObject);
  20478. ;
  20479. return self;
  20480. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject})});
  20481. },
  20482. args: ["nativeFunc", "thisObject"],
  20483. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  20484. referencedClasses: [],
  20485. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09"]]],
  20486. messageSends: []
  20487. }),
  20488. $globals.NativeFunction.a$cls);
  20489. $core.addMethod(
  20490. $core.method({
  20491. selector: "methodOf:this:value:",
  20492. protocol: "method calling",
  20493. fn: function (nativeFunc,thisObject,anObject){
  20494. var self=this,$self=this;
  20495. return $core.withContext(function($ctx1) {
  20496. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  20497. ;
  20498. return self;
  20499. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject})});
  20500. },
  20501. args: ["nativeFunc", "thisObject", "anObject"],
  20502. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  20503. referencedClasses: [],
  20504. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09"]]],
  20505. messageSends: []
  20506. }),
  20507. $globals.NativeFunction.a$cls);
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "methodOf:this:value:value:",
  20511. protocol: "method calling",
  20512. fn: function (nativeFunc,thisObject,anObject,anObject2){
  20513. var self=this,$self=this;
  20514. return $core.withContext(function($ctx1) {
  20515. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  20516. ;
  20517. return self;
  20518. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2})});
  20519. },
  20520. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  20521. 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'>",
  20522. referencedClasses: [],
  20523. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09"]]],
  20524. messageSends: []
  20525. }),
  20526. $globals.NativeFunction.a$cls);
  20527. $core.addMethod(
  20528. $core.method({
  20529. selector: "methodOf:this:value:value:value:",
  20530. protocol: "method calling",
  20531. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  20532. var self=this,$self=this;
  20533. return $core.withContext(function($ctx1) {
  20534. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  20535. ;
  20536. return self;
  20537. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  20538. },
  20539. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  20540. 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'>",
  20541. referencedClasses: [],
  20542. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09"]]],
  20543. messageSends: []
  20544. }),
  20545. $globals.NativeFunction.a$cls);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "methodOf:this:valueWithArgs:",
  20549. protocol: "method calling",
  20550. fn: function (nativeFunc,thisObject,args){
  20551. var self=this,$self=this;
  20552. return $core.withContext(function($ctx1) {
  20553. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  20554. ;
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args})});
  20557. },
  20558. args: ["nativeFunc", "thisObject", "args"],
  20559. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  20560. referencedClasses: [],
  20561. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09"]]],
  20562. messageSends: []
  20563. }),
  20564. $globals.NativeFunction.a$cls);
  20565. $core.addTrait("TMethodContext", "Kernel-Methods");
  20566. $core.addMethod(
  20567. $core.method({
  20568. selector: "asString",
  20569. protocol: "converting",
  20570. fn: function (){
  20571. var self=this,$self=this;
  20572. return $core.withContext(function($ctx1) {
  20573. var $1,$2,$receiver;
  20574. $1=$self._isBlockContext();
  20575. if($core.assert($1)){
  20576. return $recv("a block (in ".__comma($recv($self._methodContext())._asString())).__comma(")");
  20577. $ctx1.sendIdx[","]=1;
  20578. } else {
  20579. $2=$self._method();
  20580. if(($receiver = $2) == null || $receiver.a$nil){
  20581. return $2;
  20582. } else {
  20583. var method;
  20584. method=$receiver;
  20585. return $recv(method)._asStringForClass_($recv($self._receiver())._class());
  20586. }
  20587. }
  20588. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  20589. },
  20590. args: [],
  20591. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self method ifNotNil: [ :method | method asStringForClass: self receiver class ] ]",
  20592. referencedClasses: [],
  20593. pragmas: [],
  20594. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "ifNotNil:", "method", "asStringForClass:", "class", "receiver"]
  20595. }),
  20596. $globals.TMethodContext);
  20597. $core.addMethod(
  20598. $core.method({
  20599. selector: "basicReceiver",
  20600. protocol: "accessing",
  20601. fn: function (){
  20602. var self=this,$self=this;
  20603. return $core.withContext(function($ctx1) {
  20604. $self._subclassResponsibility();
  20605. return self;
  20606. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  20607. },
  20608. args: [],
  20609. source: "basicReceiver\x0a\x09self subclassResponsibility",
  20610. referencedClasses: [],
  20611. pragmas: [],
  20612. messageSends: ["subclassResponsibility"]
  20613. }),
  20614. $globals.TMethodContext);
  20615. $core.addMethod(
  20616. $core.method({
  20617. selector: "findContextSuchThat:",
  20618. protocol: "accessing",
  20619. fn: function (testBlock){
  20620. var self=this,$self=this;
  20621. var context;
  20622. return $core.withContext(function($ctx1) {
  20623. var $1;
  20624. var $early={};
  20625. try {
  20626. context=self;
  20627. $recv((function(){
  20628. return $core.withContext(function($ctx2) {
  20629. return $recv(context)._isNil();
  20630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20631. }))._whileFalse_((function(){
  20632. return $core.withContext(function($ctx2) {
  20633. $1=$recv(testBlock)._value_(context);
  20634. if($core.assert($1)){
  20635. throw $early=[context];
  20636. }
  20637. context=$recv(context)._outerContext();
  20638. return context;
  20639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20640. }));
  20641. return nil;
  20642. }
  20643. catch(e) {if(e===$early)return e[0]; throw e}
  20644. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context})});
  20645. },
  20646. args: ["testBlock"],
  20647. 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",
  20648. referencedClasses: [],
  20649. pragmas: [],
  20650. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  20651. }),
  20652. $globals.TMethodContext);
  20653. $core.addMethod(
  20654. $core.method({
  20655. selector: "home",
  20656. protocol: "accessing",
  20657. fn: function (){
  20658. var self=this,$self=this;
  20659. return $core.withContext(function($ctx1) {
  20660. $self._subclassResponsibility();
  20661. return self;
  20662. }, function($ctx1) {$ctx1.fill(self,"home",{})});
  20663. },
  20664. args: [],
  20665. source: "home\x0a\x09self subclassResponsibility",
  20666. referencedClasses: [],
  20667. pragmas: [],
  20668. messageSends: ["subclassResponsibility"]
  20669. }),
  20670. $globals.TMethodContext);
  20671. $core.addMethod(
  20672. $core.method({
  20673. selector: "index",
  20674. protocol: "accessing",
  20675. fn: function (){
  20676. var self=this,$self=this;
  20677. return $core.withContext(function($ctx1) {
  20678. $self._subclassResponsibility();
  20679. return self;
  20680. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  20681. },
  20682. args: [],
  20683. source: "index\x0a\x09self subclassResponsibility",
  20684. referencedClasses: [],
  20685. pragmas: [],
  20686. messageSends: ["subclassResponsibility"]
  20687. }),
  20688. $globals.TMethodContext);
  20689. $core.addMethod(
  20690. $core.method({
  20691. selector: "isBlockContext",
  20692. protocol: "testing",
  20693. fn: function (){
  20694. var self=this,$self=this;
  20695. return $core.withContext(function($ctx1) {
  20696. return $recv($self._selector())._isNil();
  20697. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{})});
  20698. },
  20699. args: [],
  20700. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  20701. referencedClasses: [],
  20702. pragmas: [],
  20703. messageSends: ["isNil", "selector"]
  20704. }),
  20705. $globals.TMethodContext);
  20706. $core.addMethod(
  20707. $core.method({
  20708. selector: "locals",
  20709. protocol: "accessing",
  20710. fn: function (){
  20711. var self=this,$self=this;
  20712. return $core.withContext(function($ctx1) {
  20713. $self._subclassResponsibility();
  20714. return self;
  20715. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  20716. },
  20717. args: [],
  20718. source: "locals\x0a\x09self subclassResponsibility",
  20719. referencedClasses: [],
  20720. pragmas: [],
  20721. messageSends: ["subclassResponsibility"]
  20722. }),
  20723. $globals.TMethodContext);
  20724. $core.addMethod(
  20725. $core.method({
  20726. selector: "method",
  20727. protocol: "accessing",
  20728. fn: function (){
  20729. var self=this,$self=this;
  20730. var method,lookupClass,receiverClass,supercall;
  20731. return $core.withContext(function($ctx1) {
  20732. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  20733. $1=$self._methodContext();
  20734. $ctx1.sendIdx["methodContext"]=1;
  20735. if(($receiver = $1) == null || $receiver.a$nil){
  20736. return nil;
  20737. } else {
  20738. $1;
  20739. }
  20740. $3=$self._methodContext();
  20741. $ctx1.sendIdx["methodContext"]=2;
  20742. $2=$recv($3)._receiver();
  20743. receiverClass=$recv($2)._class();
  20744. $4=receiverClass;
  20745. $6=$self._methodContext();
  20746. $ctx1.sendIdx["methodContext"]=3;
  20747. $5=$recv($6)._selector();
  20748. $ctx1.sendIdx["selector"]=1;
  20749. method=$recv($4)._lookupSelector_($5);
  20750. $ctx1.sendIdx["lookupSelector:"]=1;
  20751. $7=$self._outerContext();
  20752. if(($receiver = $7) == null || $receiver.a$nil){
  20753. supercall=false;
  20754. } else {
  20755. var outer;
  20756. outer=$receiver;
  20757. supercall=$recv(outer)._supercall();
  20758. }
  20759. $8=supercall;
  20760. if($core.assert($8)){
  20761. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  20762. } else {
  20763. return method;
  20764. }
  20765. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall})});
  20766. },
  20767. args: [],
  20768. 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 ]",
  20769. referencedClasses: [],
  20770. pragmas: [],
  20771. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  20772. }),
  20773. $globals.TMethodContext);
  20774. $core.addMethod(
  20775. $core.method({
  20776. selector: "methodContext",
  20777. protocol: "accessing",
  20778. fn: function (){
  20779. var self=this,$self=this;
  20780. return $core.withContext(function($ctx1) {
  20781. var $1,$2,$receiver;
  20782. $1=$self._isBlockContext();
  20783. if(!$core.assert($1)){
  20784. return self;
  20785. }
  20786. $2=$self._outerContext();
  20787. if(($receiver = $2) == null || $receiver.a$nil){
  20788. return $2;
  20789. } else {
  20790. var outer;
  20791. outer=$receiver;
  20792. return $recv(outer)._methodContext();
  20793. }
  20794. }, function($ctx1) {$ctx1.fill(self,"methodContext",{})});
  20795. },
  20796. args: [],
  20797. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  20798. referencedClasses: [],
  20799. pragmas: [],
  20800. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  20801. }),
  20802. $globals.TMethodContext);
  20803. $core.addMethod(
  20804. $core.method({
  20805. selector: "outerContext",
  20806. protocol: "accessing",
  20807. fn: function (){
  20808. var self=this,$self=this;
  20809. return $core.withContext(function($ctx1) {
  20810. $self._subclassResponsibility();
  20811. return self;
  20812. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  20813. },
  20814. args: [],
  20815. source: "outerContext\x0a\x09self subclassResponsibility",
  20816. referencedClasses: [],
  20817. pragmas: [],
  20818. messageSends: ["subclassResponsibility"]
  20819. }),
  20820. $globals.TMethodContext);
  20821. $core.addMethod(
  20822. $core.method({
  20823. selector: "printOn:",
  20824. protocol: "printing",
  20825. fn: function (aStream){
  20826. var self=this,$self=this;
  20827. return $core.withContext(function($ctx1) {
  20828. (
  20829. $ctx1.supercall = true,
  20830. ($globals.TMethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  20831. $ctx1.supercall = false;
  20832. $recv(aStream)._nextPutAll_("(");
  20833. $ctx1.sendIdx["nextPutAll:"]=1;
  20834. $recv(aStream)._nextPutAll_($self._asString());
  20835. $ctx1.sendIdx["nextPutAll:"]=2;
  20836. $recv(aStream)._nextPutAll_(")");
  20837. return self;
  20838. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  20839. },
  20840. args: ["aStream"],
  20841. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  20842. referencedClasses: [],
  20843. pragmas: [],
  20844. messageSends: ["printOn:", "nextPutAll:", "asString"]
  20845. }),
  20846. $globals.TMethodContext);
  20847. $core.addMethod(
  20848. $core.method({
  20849. selector: "receiver",
  20850. protocol: "accessing",
  20851. fn: function (){
  20852. var self=this,$self=this;
  20853. return $core.withContext(function($ctx1) {
  20854. var $2,$1;
  20855. $1=$recv($self._isBlockContext())._and_((function(){
  20856. return $core.withContext(function($ctx2) {
  20857. $2=$self._outerContext();
  20858. $ctx2.sendIdx["outerContext"]=1;
  20859. return $recv($2)._notNil();
  20860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20861. }));
  20862. if($core.assert($1)){
  20863. return $recv($self._outerContext())._receiver();
  20864. } else {
  20865. return $self._basicReceiver();
  20866. }
  20867. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  20868. },
  20869. args: [],
  20870. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  20871. referencedClasses: [],
  20872. pragmas: [],
  20873. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  20874. }),
  20875. $globals.TMethodContext);
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "selector",
  20879. protocol: "accessing",
  20880. fn: function (){
  20881. var self=this,$self=this;
  20882. return $core.withContext(function($ctx1) {
  20883. $self._subclassResponsibility();
  20884. return self;
  20885. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  20886. },
  20887. args: [],
  20888. source: "selector\x0a\x09self subclassResponsibility",
  20889. referencedClasses: [],
  20890. pragmas: [],
  20891. messageSends: ["subclassResponsibility"]
  20892. }),
  20893. $globals.TMethodContext);
  20894. $core.addMethod(
  20895. $core.method({
  20896. selector: "sendIndexes",
  20897. protocol: "accessing",
  20898. fn: function (){
  20899. var self=this,$self=this;
  20900. return $core.withContext(function($ctx1) {
  20901. $self._subclassResponsibility();
  20902. return self;
  20903. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  20904. },
  20905. args: [],
  20906. source: "sendIndexes\x0a\x09self subclassResponsibility",
  20907. referencedClasses: [],
  20908. pragmas: [],
  20909. messageSends: ["subclassResponsibility"]
  20910. }),
  20911. $globals.TMethodContext);
  20912. $core.addMethod(
  20913. $core.method({
  20914. selector: "supercall",
  20915. protocol: "accessing",
  20916. fn: function (){
  20917. var self=this,$self=this;
  20918. return $core.withContext(function($ctx1) {
  20919. $self._subclassResponsibility();
  20920. return self;
  20921. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  20922. },
  20923. args: [],
  20924. source: "supercall\x0a\x09self subclassResponsibility",
  20925. referencedClasses: [],
  20926. pragmas: [],
  20927. messageSends: ["subclassResponsibility"]
  20928. }),
  20929. $globals.TMethodContext);
  20930. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  20931. $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.";
  20932. $core.addMethod(
  20933. $core.method({
  20934. selector: "clearInterval",
  20935. protocol: "timeout/interval",
  20936. fn: function (){
  20937. var self=this,$self=this;
  20938. return $core.withContext(function($ctx1) {
  20939. var interval = $self.rawTimeout;
  20940. clearInterval(interval);
  20941. ;
  20942. return self;
  20943. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{})});
  20944. },
  20945. args: [],
  20946. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20947. referencedClasses: [],
  20948. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09"]]],
  20949. messageSends: []
  20950. }),
  20951. $globals.Timeout);
  20952. $core.addMethod(
  20953. $core.method({
  20954. selector: "clearTimeout",
  20955. protocol: "timeout/interval",
  20956. fn: function (){
  20957. var self=this,$self=this;
  20958. return $core.withContext(function($ctx1) {
  20959. var timeout = $self.rawTimeout;
  20960. clearTimeout(timeout);
  20961. ;
  20962. return self;
  20963. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{})});
  20964. },
  20965. args: [],
  20966. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20967. referencedClasses: [],
  20968. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09"]]],
  20969. messageSends: []
  20970. }),
  20971. $globals.Timeout);
  20972. $core.addMethod(
  20973. $core.method({
  20974. selector: "rawTimeout:",
  20975. protocol: "accessing",
  20976. fn: function (anObject){
  20977. var self=this,$self=this;
  20978. $self.rawTimeout=anObject;
  20979. return self;
  20980. },
  20981. args: ["anObject"],
  20982. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20983. referencedClasses: [],
  20984. pragmas: [],
  20985. messageSends: []
  20986. }),
  20987. $globals.Timeout);
  20988. $core.addMethod(
  20989. $core.method({
  20990. selector: "on:",
  20991. protocol: "instance creation",
  20992. fn: function (anObject){
  20993. var self=this,$self=this;
  20994. return $core.withContext(function($ctx1) {
  20995. var $1;
  20996. $1=$self._new();
  20997. $recv($1)._rawTimeout_(anObject);
  20998. return $recv($1)._yourself();
  20999. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject})});
  21000. },
  21001. args: ["anObject"],
  21002. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  21003. referencedClasses: [],
  21004. pragmas: [],
  21005. messageSends: ["rawTimeout:", "new", "yourself"]
  21006. }),
  21007. $globals.Timeout.a$cls);
  21008. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
  21009. });
  21010. define('amber/core/Kernel-Dag',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  21011. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21012. var $pkg = $core.addPackage("Kernel-Dag");
  21013. $pkg.innerEval = function (expr) { return eval(expr); };
  21014. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21015. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  21016. $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:`.";
  21017. $core.addMethod(
  21018. $core.method({
  21019. selector: "value:",
  21020. protocol: "evaluating",
  21021. fn: function (anObject){
  21022. var self=this,$self=this;
  21023. return $core.withContext(function($ctx1) {
  21024. return $self._visit_(anObject);
  21025. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  21026. },
  21027. args: ["anObject"],
  21028. source: "value: anObject\x0a\x09^ self visit: anObject",
  21029. referencedClasses: [],
  21030. pragmas: [],
  21031. messageSends: ["visit:"]
  21032. }),
  21033. $globals.AbstractDagVisitor);
  21034. $core.addMethod(
  21035. $core.method({
  21036. selector: "visit:",
  21037. protocol: "visiting",
  21038. fn: function (aNode){
  21039. var self=this,$self=this;
  21040. return $core.withContext(function($ctx1) {
  21041. return $recv(aNode)._acceptDagVisitor_(self);
  21042. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  21043. },
  21044. args: ["aNode"],
  21045. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  21046. referencedClasses: [],
  21047. pragmas: [],
  21048. messageSends: ["acceptDagVisitor:"]
  21049. }),
  21050. $globals.AbstractDagVisitor);
  21051. $core.addMethod(
  21052. $core.method({
  21053. selector: "visitAll:",
  21054. protocol: "visiting",
  21055. fn: function (aCollection){
  21056. var self=this,$self=this;
  21057. return $core.withContext(function($ctx1) {
  21058. return $recv(aCollection)._collect_((function(each){
  21059. return $core.withContext(function($ctx2) {
  21060. return $self._visit_(each);
  21061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21062. }));
  21063. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection})});
  21064. },
  21065. args: ["aCollection"],
  21066. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  21067. referencedClasses: [],
  21068. pragmas: [],
  21069. messageSends: ["collect:", "visit:"]
  21070. }),
  21071. $globals.AbstractDagVisitor);
  21072. $core.addMethod(
  21073. $core.method({
  21074. selector: "visitAllChildren:",
  21075. protocol: "visiting",
  21076. fn: function (aDagNode){
  21077. var self=this,$self=this;
  21078. return $core.withContext(function($ctx1) {
  21079. return $self._visitAll_($recv(aDagNode)._dagChildren());
  21080. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode})});
  21081. },
  21082. args: ["aDagNode"],
  21083. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  21084. referencedClasses: [],
  21085. pragmas: [],
  21086. messageSends: ["visitAll:", "dagChildren"]
  21087. }),
  21088. $globals.AbstractDagVisitor);
  21089. $core.addMethod(
  21090. $core.method({
  21091. selector: "visitDagNode:",
  21092. protocol: "visiting",
  21093. fn: function (aNode){
  21094. var self=this,$self=this;
  21095. return $core.withContext(function($ctx1) {
  21096. $self._subclassResponsibility();
  21097. return self;
  21098. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  21099. },
  21100. args: ["aNode"],
  21101. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  21102. referencedClasses: [],
  21103. pragmas: [],
  21104. messageSends: ["subclassResponsibility"]
  21105. }),
  21106. $globals.AbstractDagVisitor);
  21107. $core.addMethod(
  21108. $core.method({
  21109. selector: "visitDagNodeVariantRedux:",
  21110. protocol: "visiting",
  21111. fn: function (aNode){
  21112. var self=this,$self=this;
  21113. var newChildren,oldChildren;
  21114. return $core.withContext(function($ctx1) {
  21115. var $2,$3,$1,$4,$5;
  21116. var $early={};
  21117. try {
  21118. oldChildren=$recv(aNode)._dagChildren();
  21119. newChildren=$self._visitAllChildren_(aNode);
  21120. $2=$recv(oldChildren)._size();
  21121. $ctx1.sendIdx["size"]=1;
  21122. $3=$recv(newChildren)._size();
  21123. $ctx1.sendIdx["size"]=2;
  21124. $1=$recv($2).__eq($3);
  21125. if($core.assert($1)){
  21126. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  21127. return $core.withContext(function($ctx2) {
  21128. $4=$recv(oldChildren)._at_(i);
  21129. $ctx2.sendIdx["at:"]=1;
  21130. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  21131. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  21132. }),(function(){
  21133. throw $early=[aNode];
  21134. }));
  21135. }
  21136. $5=$recv(aNode)._copy();
  21137. $recv($5)._dagChildren_(newChildren);
  21138. return $recv($5)._yourself();
  21139. }
  21140. catch(e) {if(e===$early)return e[0]; throw e}
  21141. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren})});
  21142. },
  21143. args: ["aNode"],
  21144. 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",
  21145. referencedClasses: [],
  21146. pragmas: [],
  21147. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  21148. }),
  21149. $globals.AbstractDagVisitor);
  21150. $core.addMethod(
  21151. $core.method({
  21152. selector: "visitDagNodeVariantSimple:",
  21153. protocol: "visiting",
  21154. fn: function (aNode){
  21155. var self=this,$self=this;
  21156. return $core.withContext(function($ctx1) {
  21157. $self._visitAllChildren_(aNode);
  21158. return aNode;
  21159. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode})});
  21160. },
  21161. args: ["aNode"],
  21162. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  21163. referencedClasses: [],
  21164. pragmas: [],
  21165. messageSends: ["visitAllChildren:"]
  21166. }),
  21167. $globals.AbstractDagVisitor);
  21168. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  21169. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  21170. $core.addMethod(
  21171. $core.method({
  21172. selector: "initialize",
  21173. protocol: "initialization",
  21174. fn: function (){
  21175. var self=this,$self=this;
  21176. return $core.withContext(function($ctx1) {
  21177. (
  21178. $ctx1.supercall = true,
  21179. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21180. $ctx1.supercall = false;
  21181. $self.path=[];
  21182. return self;
  21183. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  21184. },
  21185. args: [],
  21186. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  21187. referencedClasses: [],
  21188. pragmas: [],
  21189. messageSends: ["initialize"]
  21190. }),
  21191. $globals.PathDagVisitor);
  21192. $core.addMethod(
  21193. $core.method({
  21194. selector: "path",
  21195. protocol: "accessing",
  21196. fn: function (){
  21197. var self=this,$self=this;
  21198. return $self.path;
  21199. },
  21200. args: [],
  21201. source: "path\x0a\x09^ path",
  21202. referencedClasses: [],
  21203. pragmas: [],
  21204. messageSends: []
  21205. }),
  21206. $globals.PathDagVisitor);
  21207. $core.addMethod(
  21208. $core.method({
  21209. selector: "visit:",
  21210. protocol: "visiting",
  21211. fn: function (aNode){
  21212. var self=this,$self=this;
  21213. var oldPath,result;
  21214. return $core.withContext(function($ctx1) {
  21215. result=aNode;
  21216. oldPath=$self.path;
  21217. $recv((function(){
  21218. return $core.withContext(function($ctx2) {
  21219. $self.path=$recv($self.path).__comma([aNode]);
  21220. result=(
  21221. $ctx2.supercall = true,
  21222. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  21223. $ctx2.supercall = false;
  21224. return result;
  21225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21226. }))._ensure_((function(){
  21227. $self.path=oldPath;
  21228. return $self.path;
  21229. }));
  21230. return result;
  21231. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result})});
  21232. },
  21233. args: ["aNode"],
  21234. 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",
  21235. referencedClasses: [],
  21236. pragmas: [],
  21237. messageSends: ["ensure:", ",", "visit:"]
  21238. }),
  21239. $globals.PathDagVisitor);
  21240. $core.addMethod(
  21241. $core.method({
  21242. selector: "visitDagNodeVariantRedux:",
  21243. protocol: "visiting",
  21244. fn: function (aNode){
  21245. var self=this,$self=this;
  21246. var newNode;
  21247. return $core.withContext(function($ctx1) {
  21248. var $1;
  21249. newNode=(
  21250. $ctx1.supercall = true,
  21251. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  21252. $ctx1.supercall = false;
  21253. $1=$recv(aNode).__eq_eq(newNode);
  21254. if(!$core.assert($1)){
  21255. $recv($self.path)._at_put_($recv($self.path)._size(),newNode);
  21256. }
  21257. return newNode;
  21258. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode})});
  21259. },
  21260. args: ["aNode"],
  21261. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  21262. referencedClasses: [],
  21263. pragmas: [],
  21264. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  21265. }),
  21266. $globals.PathDagVisitor);
  21267. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  21268. $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).";
  21269. $core.addMethod(
  21270. $core.method({
  21271. selector: "acceptDagVisitor:",
  21272. protocol: "visiting",
  21273. fn: function (aVisitor){
  21274. var self=this,$self=this;
  21275. return $core.withContext(function($ctx1) {
  21276. return $recv(aVisitor)._visitDagNode_(self);
  21277. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  21278. },
  21279. args: ["aVisitor"],
  21280. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  21281. referencedClasses: [],
  21282. pragmas: [],
  21283. messageSends: ["visitDagNode:"]
  21284. }),
  21285. $globals.DagNode);
  21286. $core.addMethod(
  21287. $core.method({
  21288. selector: "allDagChildren",
  21289. protocol: "accessing",
  21290. fn: function (){
  21291. var self=this,$self=this;
  21292. var allNodes;
  21293. return $core.withContext(function($ctx1) {
  21294. var $1;
  21295. $1=$self._dagChildren();
  21296. $ctx1.sendIdx["dagChildren"]=1;
  21297. allNodes=$recv($1)._asSet();
  21298. $recv($self._dagChildren())._do_((function(each){
  21299. return $core.withContext(function($ctx2) {
  21300. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  21301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21302. }));
  21303. return allNodes;
  21304. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes})});
  21305. },
  21306. args: [],
  21307. 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",
  21308. referencedClasses: [],
  21309. pragmas: [],
  21310. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  21311. }),
  21312. $globals.DagNode);
  21313. $core.addMethod(
  21314. $core.method({
  21315. selector: "dagChildren",
  21316. protocol: "accessing",
  21317. fn: function (){
  21318. var self=this,$self=this;
  21319. return $core.withContext(function($ctx1) {
  21320. $self._subclassResponsibility();
  21321. return self;
  21322. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  21323. },
  21324. args: [],
  21325. source: "dagChildren\x0a\x09self subclassResponsibility",
  21326. referencedClasses: [],
  21327. pragmas: [],
  21328. messageSends: ["subclassResponsibility"]
  21329. }),
  21330. $globals.DagNode);
  21331. $core.addMethod(
  21332. $core.method({
  21333. selector: "dagChildren:",
  21334. protocol: "accessing",
  21335. fn: function (aCollection){
  21336. var self=this,$self=this;
  21337. return $core.withContext(function($ctx1) {
  21338. $self._subclassResponsibility();
  21339. return self;
  21340. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  21341. },
  21342. args: ["aCollection"],
  21343. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  21344. referencedClasses: [],
  21345. pragmas: [],
  21346. messageSends: ["subclassResponsibility"]
  21347. }),
  21348. $globals.DagNode);
  21349. $core.addMethod(
  21350. $core.method({
  21351. selector: "isDagNode",
  21352. protocol: "testing",
  21353. fn: function (){
  21354. var self=this,$self=this;
  21355. return true;
  21356. },
  21357. args: [],
  21358. source: "isDagNode\x0a\x09^ true",
  21359. referencedClasses: [],
  21360. pragmas: [],
  21361. messageSends: []
  21362. }),
  21363. $globals.DagNode);
  21364. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  21365. $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.";
  21366. $core.addMethod(
  21367. $core.method({
  21368. selector: "addDagChild:",
  21369. protocol: "accessing",
  21370. fn: function (aDagNode){
  21371. var self=this,$self=this;
  21372. return $core.withContext(function($ctx1) {
  21373. $recv($self._dagChildren())._add_(aDagNode);
  21374. return self;
  21375. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode})});
  21376. },
  21377. args: ["aDagNode"],
  21378. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  21379. referencedClasses: [],
  21380. pragmas: [],
  21381. messageSends: ["add:", "dagChildren"]
  21382. }),
  21383. $globals.DagParentNode);
  21384. $core.addMethod(
  21385. $core.method({
  21386. selector: "dagChildren",
  21387. protocol: "accessing",
  21388. fn: function (){
  21389. var self=this,$self=this;
  21390. return $core.withContext(function($ctx1) {
  21391. var $1,$receiver;
  21392. $1=$self.nodes;
  21393. if(($receiver = $1) == null || $receiver.a$nil){
  21394. $self.nodes=$recv($globals.Array)._new();
  21395. return $self.nodes;
  21396. } else {
  21397. return $1;
  21398. }
  21399. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  21400. },
  21401. args: [],
  21402. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  21403. referencedClasses: ["Array"],
  21404. pragmas: [],
  21405. messageSends: ["ifNil:", "new"]
  21406. }),
  21407. $globals.DagParentNode);
  21408. $core.addMethod(
  21409. $core.method({
  21410. selector: "dagChildren:",
  21411. protocol: "accessing",
  21412. fn: function (aCollection){
  21413. var self=this,$self=this;
  21414. $self.nodes=aCollection;
  21415. return self;
  21416. },
  21417. args: ["aCollection"],
  21418. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  21419. referencedClasses: [],
  21420. pragmas: [],
  21421. messageSends: []
  21422. }),
  21423. $globals.DagParentNode);
  21424. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  21425. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  21426. $core.addMethod(
  21427. $core.method({
  21428. selector: "dagChildren",
  21429. protocol: "accessing",
  21430. fn: function (){
  21431. var self=this,$self=this;
  21432. return [];
  21433. },
  21434. args: [],
  21435. source: "dagChildren\x0a\x09^ #()",
  21436. referencedClasses: [],
  21437. pragmas: [],
  21438. messageSends: []
  21439. }),
  21440. $globals.DagSink);
  21441. $core.addMethod(
  21442. $core.method({
  21443. selector: "dagChildren:",
  21444. protocol: "accessing",
  21445. fn: function (aCollection){
  21446. var self=this,$self=this;
  21447. return $core.withContext(function($ctx1) {
  21448. $recv(aCollection)._ifNotEmpty_((function(){
  21449. return $core.withContext(function($ctx2) {
  21450. return $self._error_("A DagSink cannot have children.");
  21451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21452. }));
  21453. return self;
  21454. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  21455. },
  21456. args: ["aCollection"],
  21457. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  21458. referencedClasses: [],
  21459. pragmas: [],
  21460. messageSends: ["ifNotEmpty:", "error:"]
  21461. }),
  21462. $globals.DagSink);
  21463. $core.addMethod(
  21464. $core.method({
  21465. selector: "isDagNode",
  21466. protocol: "*Kernel-Dag",
  21467. fn: function (){
  21468. var self=this,$self=this;
  21469. return false;
  21470. },
  21471. args: [],
  21472. source: "isDagNode\x0a\x09^ false",
  21473. referencedClasses: [],
  21474. pragmas: [],
  21475. messageSends: []
  21476. }),
  21477. $globals.Object);
  21478. });
  21479. define('amber/core/Kernel-Exceptions',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  21480. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21481. var $pkg = $core.addPackage("Kernel-Exceptions");
  21482. $pkg.innerEval = function (expr) { return eval(expr); };
  21483. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21484. $core.addClass("Error", $globals.Object, ["message", "stack", "amberHandled", "context", "smalltalkError"], "Kernel-Exceptions");
  21485. $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.";
  21486. $core.addMethod(
  21487. $core.method({
  21488. selector: "basicSignal",
  21489. protocol: "private",
  21490. fn: function (){
  21491. var self=this,$self=this;
  21492. return $core.withContext(function($ctx1) {
  21493. throw self;;
  21494. return self;
  21495. }, function($ctx1) {$ctx1.fill(self,"basicSignal",{})});
  21496. },
  21497. args: [],
  21498. source: "basicSignal\x0a\x09<inlineJS: 'throw self;'>",
  21499. referencedClasses: [],
  21500. pragmas: [["inlineJS:", ["throw self;"]]],
  21501. messageSends: []
  21502. }),
  21503. $globals.Error);
  21504. $core.addMethod(
  21505. $core.method({
  21506. selector: "beHandled",
  21507. protocol: "accessing",
  21508. fn: function (){
  21509. var self=this,$self=this;
  21510. $self.amberHandled=true;
  21511. return self;
  21512. },
  21513. args: [],
  21514. source: "beHandled\x0a\x09amberHandled := true",
  21515. referencedClasses: [],
  21516. pragmas: [],
  21517. messageSends: []
  21518. }),
  21519. $globals.Error);
  21520. $core.addMethod(
  21521. $core.method({
  21522. selector: "beSmalltalkError",
  21523. protocol: "accessing",
  21524. fn: function (){
  21525. var self=this,$self=this;
  21526. $self.smalltalkError=true;
  21527. return self;
  21528. },
  21529. args: [],
  21530. source: "beSmalltalkError\x0a\x09smalltalkError := true",
  21531. referencedClasses: [],
  21532. pragmas: [],
  21533. messageSends: []
  21534. }),
  21535. $globals.Error);
  21536. $core.addMethod(
  21537. $core.method({
  21538. selector: "beUnhandled",
  21539. protocol: "accessing",
  21540. fn: function (){
  21541. var self=this,$self=this;
  21542. $self.amberHandled=false;
  21543. return self;
  21544. },
  21545. args: [],
  21546. source: "beUnhandled\x0a\x09amberHandled := false",
  21547. referencedClasses: [],
  21548. pragmas: [],
  21549. messageSends: []
  21550. }),
  21551. $globals.Error);
  21552. $core.addMethod(
  21553. $core.method({
  21554. selector: "context",
  21555. protocol: "accessing",
  21556. fn: function (){
  21557. var self=this,$self=this;
  21558. return $self.context;
  21559. },
  21560. args: [],
  21561. source: "context\x0a\x09^ context",
  21562. referencedClasses: [],
  21563. pragmas: [],
  21564. messageSends: []
  21565. }),
  21566. $globals.Error);
  21567. $core.addMethod(
  21568. $core.method({
  21569. selector: "context:",
  21570. protocol: "accessing",
  21571. fn: function (aMethodContext){
  21572. var self=this,$self=this;
  21573. $self.context=aMethodContext;
  21574. return self;
  21575. },
  21576. args: ["aMethodContext"],
  21577. source: "context: aMethodContext\x0a\x09context := aMethodContext",
  21578. referencedClasses: [],
  21579. pragmas: [],
  21580. messageSends: []
  21581. }),
  21582. $globals.Error);
  21583. $core.addMethod(
  21584. $core.method({
  21585. selector: "initialize",
  21586. protocol: "initialization",
  21587. fn: function (){
  21588. var self=this,$self=this;
  21589. return $core.withContext(function($ctx1) {
  21590. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  21591. return self;
  21592. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  21593. },
  21594. args: [],
  21595. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  21596. referencedClasses: [],
  21597. pragmas: [],
  21598. messageSends: ["messageText:", ",", "name", "class"]
  21599. }),
  21600. $globals.Error);
  21601. $core.addMethod(
  21602. $core.method({
  21603. selector: "isSmalltalkError",
  21604. protocol: "testing",
  21605. fn: function (){
  21606. var self=this,$self=this;
  21607. return $core.withContext(function($ctx1) {
  21608. return $recv($self.smalltalkError).__eq_eq(true);
  21609. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{})});
  21610. },
  21611. args: [],
  21612. source: "isSmalltalkError\x0a\x09^ smalltalkError == true",
  21613. referencedClasses: [],
  21614. pragmas: [],
  21615. messageSends: ["=="]
  21616. }),
  21617. $globals.Error);
  21618. $core.addMethod(
  21619. $core.method({
  21620. selector: "jsStack",
  21621. protocol: "accessing",
  21622. fn: function (){
  21623. var self=this,$self=this;
  21624. return $self.stack;
  21625. },
  21626. args: [],
  21627. source: "jsStack\x0a\x09^ stack",
  21628. referencedClasses: [],
  21629. pragmas: [],
  21630. messageSends: []
  21631. }),
  21632. $globals.Error);
  21633. $core.addMethod(
  21634. $core.method({
  21635. selector: "messageText",
  21636. protocol: "accessing",
  21637. fn: function (){
  21638. var self=this,$self=this;
  21639. return $self.message;
  21640. },
  21641. args: [],
  21642. source: "messageText\x0a\x09^ message",
  21643. referencedClasses: [],
  21644. pragmas: [],
  21645. messageSends: []
  21646. }),
  21647. $globals.Error);
  21648. $core.addMethod(
  21649. $core.method({
  21650. selector: "messageText:",
  21651. protocol: "accessing",
  21652. fn: function (aString){
  21653. var self=this,$self=this;
  21654. $self.message=aString;
  21655. return self;
  21656. },
  21657. args: ["aString"],
  21658. source: "messageText: aString\x0a\x09message := aString",
  21659. referencedClasses: [],
  21660. pragmas: [],
  21661. messageSends: []
  21662. }),
  21663. $globals.Error);
  21664. $core.addMethod(
  21665. $core.method({
  21666. selector: "outer",
  21667. protocol: "signaling",
  21668. fn: function (){
  21669. var self=this,$self=this;
  21670. return $core.withContext(function($ctx1) {
  21671. return $self._pass();
  21672. }, function($ctx1) {$ctx1.fill(self,"outer",{})});
  21673. },
  21674. args: [],
  21675. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  21676. referencedClasses: [],
  21677. pragmas: [],
  21678. messageSends: ["pass"]
  21679. }),
  21680. $globals.Error);
  21681. $core.addMethod(
  21682. $core.method({
  21683. selector: "pass",
  21684. protocol: "signaling",
  21685. fn: function (){
  21686. var self=this,$self=this;
  21687. return $core.withContext(function($ctx1) {
  21688. $self._beUnhandled();
  21689. $self._basicSignal();
  21690. return self;
  21691. }, function($ctx1) {$ctx1.fill(self,"pass",{})});
  21692. },
  21693. args: [],
  21694. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x0a\x09self beUnhandled; basicSignal",
  21695. referencedClasses: [],
  21696. pragmas: [],
  21697. messageSends: ["beUnhandled", "basicSignal"]
  21698. }),
  21699. $globals.Error);
  21700. $core.addMethod(
  21701. $core.method({
  21702. selector: "resignal",
  21703. protocol: "signaling",
  21704. fn: function (){
  21705. var self=this,$self=this;
  21706. return $core.withContext(function($ctx1) {
  21707. $self._deprecatedAPI_("Use #pass.");
  21708. return $self._pass();
  21709. }, function($ctx1) {$ctx1.fill(self,"resignal",{})});
  21710. },
  21711. args: [],
  21712. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  21713. referencedClasses: [],
  21714. pragmas: [],
  21715. messageSends: ["deprecatedAPI:", "pass"]
  21716. }),
  21717. $globals.Error);
  21718. $core.addMethod(
  21719. $core.method({
  21720. selector: "signal",
  21721. protocol: "signaling",
  21722. fn: function (){
  21723. var self=this,$self=this;
  21724. return $core.withContext(function($ctx1) {
  21725. $self._beUnhandled();
  21726. $self._context_($core.getThisContext());
  21727. $self._beSmalltalkError();
  21728. $self._basicSignal();
  21729. return self;
  21730. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  21731. },
  21732. args: [],
  21733. source: "signal\x0a\x09self beUnhandled; context: thisContext; beSmalltalkError; basicSignal",
  21734. referencedClasses: [],
  21735. pragmas: [],
  21736. messageSends: ["beUnhandled", "context:", "beSmalltalkError", "basicSignal"]
  21737. }),
  21738. $globals.Error);
  21739. $core.addMethod(
  21740. $core.method({
  21741. selector: "signal:",
  21742. protocol: "signaling",
  21743. fn: function (aString){
  21744. var self=this,$self=this;
  21745. return $core.withContext(function($ctx1) {
  21746. $self._messageText_(aString);
  21747. $self._signal();
  21748. return self;
  21749. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  21750. },
  21751. args: ["aString"],
  21752. source: "signal: aString\x0a\x09self messageText: aString; signal",
  21753. referencedClasses: [],
  21754. pragmas: [],
  21755. messageSends: ["messageText:", "signal"]
  21756. }),
  21757. $globals.Error);
  21758. $core.addMethod(
  21759. $core.method({
  21760. selector: "signalerContext",
  21761. protocol: "accessing",
  21762. fn: function (){
  21763. var self=this,$self=this;
  21764. return $core.withContext(function($ctx1) {
  21765. return $self._signalerContextFrom_($self._context());
  21766. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{})});
  21767. },
  21768. args: [],
  21769. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  21770. referencedClasses: [],
  21771. pragmas: [],
  21772. messageSends: ["signalerContextFrom:", "context"]
  21773. }),
  21774. $globals.Error);
  21775. $core.addMethod(
  21776. $core.method({
  21777. selector: "signalerContextFrom:",
  21778. protocol: "accessing",
  21779. fn: function (aContext){
  21780. var self=this,$self=this;
  21781. return $core.withContext(function($ctx1) {
  21782. var $3,$2,$1;
  21783. return $recv(aContext)._findContextSuchThat_((function(one){
  21784. return $core.withContext(function($ctx2) {
  21785. $3=$recv(one)._receiver();
  21786. $ctx2.sendIdx["receiver"]=1;
  21787. $2=$recv($3).__eq_eq(self);
  21788. $ctx2.sendIdx["=="]=1;
  21789. $1=$recv($2)._or_((function(){
  21790. return $core.withContext(function($ctx3) {
  21791. return $recv($recv(one)._receiver()).__eq_eq($self._class());
  21792. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21793. }));
  21794. return $recv($1)._not();
  21795. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  21796. }));
  21797. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  21798. },
  21799. args: ["aContext"],
  21800. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ one receiver == self class ]) not ]",
  21801. referencedClasses: [],
  21802. pragmas: [],
  21803. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  21804. }),
  21805. $globals.Error);
  21806. $core.addMethod(
  21807. $core.method({
  21808. selector: "wasHandled",
  21809. protocol: "testing",
  21810. fn: function (){
  21811. var self=this,$self=this;
  21812. return $core.withContext(function($ctx1) {
  21813. return $recv($self.amberHandled).__eq_eq(true);
  21814. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{})});
  21815. },
  21816. args: [],
  21817. source: "wasHandled\x0a\x09^ amberHandled == true",
  21818. referencedClasses: [],
  21819. pragmas: [],
  21820. messageSends: ["=="]
  21821. }),
  21822. $globals.Error);
  21823. $core.addMethod(
  21824. $core.method({
  21825. selector: "classTag",
  21826. protocol: "accessing",
  21827. fn: function (){
  21828. var self=this,$self=this;
  21829. return "exception";
  21830. },
  21831. args: [],
  21832. 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'",
  21833. referencedClasses: [],
  21834. pragmas: [],
  21835. messageSends: []
  21836. }),
  21837. $globals.Error.a$cls);
  21838. $core.addMethod(
  21839. $core.method({
  21840. selector: "signal",
  21841. protocol: "instance creation",
  21842. fn: function (){
  21843. var self=this,$self=this;
  21844. return $core.withContext(function($ctx1) {
  21845. return $recv($self._new())._signal();
  21846. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  21847. },
  21848. args: [],
  21849. source: "signal\x0a\x09^ self new signal",
  21850. referencedClasses: [],
  21851. pragmas: [],
  21852. messageSends: ["signal", "new"]
  21853. }),
  21854. $globals.Error.a$cls);
  21855. $core.addMethod(
  21856. $core.method({
  21857. selector: "signal:",
  21858. protocol: "instance creation",
  21859. fn: function (aString){
  21860. var self=this,$self=this;
  21861. return $core.withContext(function($ctx1) {
  21862. return $recv($self._new())._signal_(aString);
  21863. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  21864. },
  21865. args: ["aString"],
  21866. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  21867. referencedClasses: [],
  21868. pragmas: [],
  21869. messageSends: ["signal:", "new"]
  21870. }),
  21871. $globals.Error.a$cls);
  21872. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  21873. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  21874. $core.addMethod(
  21875. $core.method({
  21876. selector: "messageText",
  21877. protocol: "accessing",
  21878. fn: function (){
  21879. var self=this,$self=this;
  21880. return "Halt encountered";
  21881. },
  21882. args: [],
  21883. source: "messageText\x0a\x09^ 'Halt encountered'",
  21884. referencedClasses: [],
  21885. pragmas: [],
  21886. messageSends: []
  21887. }),
  21888. $globals.Halt);
  21889. $core.addMethod(
  21890. $core.method({
  21891. selector: "signalerContextFrom:",
  21892. protocol: "accessing",
  21893. fn: function (aContext){
  21894. var self=this,$self=this;
  21895. return $core.withContext(function($ctx1) {
  21896. var $3,$2,$1;
  21897. return $recv(aContext)._findContextSuchThat_((function(one){
  21898. return $core.withContext(function($ctx2) {
  21899. $3=$recv(one)._receiver();
  21900. $ctx2.sendIdx["receiver"]=1;
  21901. $2=$recv($3).__eq_eq(self);
  21902. $ctx2.sendIdx["=="]=1;
  21903. $1=$recv($2)._or_((function(){
  21904. return $core.withContext(function($ctx3) {
  21905. return $recv($recv($recv(one)._receiver()).__eq_eq($self._class()))._or_((function(){
  21906. return $core.withContext(function($ctx4) {
  21907. return $recv($recv($recv(one)._method())._selector()).__eq("halt");
  21908. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  21909. }));
  21910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21911. }));
  21912. $ctx2.sendIdx["or:"]=1;
  21913. return $recv($1)._not();
  21914. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  21915. }));
  21916. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  21917. },
  21918. args: ["aContext"],
  21919. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ (one receiver == self class) \x0a\x09\x09or: [ one method selector = #halt ]]) not ]",
  21920. referencedClasses: [],
  21921. pragmas: [],
  21922. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  21923. }),
  21924. $globals.Halt);
  21925. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  21926. $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:`";
  21927. $core.addMethod(
  21928. $core.method({
  21929. selector: "exception",
  21930. protocol: "accessing",
  21931. fn: function (){
  21932. var self=this,$self=this;
  21933. return $self.exception;
  21934. },
  21935. args: [],
  21936. source: "exception\x0a\x09^ exception",
  21937. referencedClasses: [],
  21938. pragmas: [],
  21939. messageSends: []
  21940. }),
  21941. $globals.JavaScriptException);
  21942. $core.addMethod(
  21943. $core.method({
  21944. selector: "exception:",
  21945. protocol: "accessing",
  21946. fn: function (anException){
  21947. var self=this,$self=this;
  21948. $self.exception=anException;
  21949. return self;
  21950. },
  21951. args: ["anException"],
  21952. source: "exception: anException\x0a\x09exception := anException",
  21953. referencedClasses: [],
  21954. pragmas: [],
  21955. messageSends: []
  21956. }),
  21957. $globals.JavaScriptException);
  21958. $core.addMethod(
  21959. $core.method({
  21960. selector: "messageText",
  21961. protocol: "accessing",
  21962. fn: function (){
  21963. var self=this,$self=this;
  21964. return $core.withContext(function($ctx1) {
  21965. return "JavaScript exception: " + $self.exception.toString();
  21966. return self;
  21967. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  21968. },
  21969. args: [],
  21970. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self.exception.toString()'>",
  21971. referencedClasses: [],
  21972. pragmas: [["inlineJS:", ["return \x22JavaScript exception: \x22 + $self.exception.toString()"]]],
  21973. messageSends: []
  21974. }),
  21975. $globals.JavaScriptException);
  21976. $core.addMethod(
  21977. $core.method({
  21978. selector: "shouldBeStubbed",
  21979. protocol: "testing",
  21980. fn: function (){
  21981. var self=this,$self=this;
  21982. return $core.withContext(function($ctx1) {
  21983. return $self.exception instanceof RangeError;
  21984. return self;
  21985. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{})});
  21986. },
  21987. args: [],
  21988. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self.exception instanceof RangeError'>",
  21989. referencedClasses: [],
  21990. pragmas: [["inlineJS:", ["return $self.exception instanceof RangeError"]]],
  21991. messageSends: []
  21992. }),
  21993. $globals.JavaScriptException);
  21994. $core.addMethod(
  21995. $core.method({
  21996. selector: "wrap",
  21997. protocol: "error handling",
  21998. fn: function (){
  21999. var self=this,$self=this;
  22000. return $core.withContext(function($ctx1) {
  22001. var $1;
  22002. $recv((function(){
  22003. return $core.withContext(function($ctx2) {
  22004. return $self._signal();
  22005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22006. }))._tryCatch_((function(){
  22007. return $core.withContext(function($ctx2) {
  22008. $1=$self._shouldBeStubbed();
  22009. if($core.assert($1)){
  22010. return $recv($self._context())._stubToAtMost_((100));
  22011. }
  22012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  22013. }));
  22014. return self;
  22015. }, function($ctx1) {$ctx1.fill(self,"wrap",{})});
  22016. },
  22017. args: [],
  22018. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  22019. referencedClasses: [],
  22020. pragmas: [],
  22021. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  22022. }),
  22023. $globals.JavaScriptException);
  22024. $core.addMethod(
  22025. $core.method({
  22026. selector: "on:",
  22027. protocol: "instance creation",
  22028. fn: function (anException){
  22029. var self=this,$self=this;
  22030. return $core.withContext(function($ctx1) {
  22031. var $1;
  22032. $1=$self._new();
  22033. $recv($1)._exception_(anException);
  22034. return $recv($1)._yourself();
  22035. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException})});
  22036. },
  22037. args: ["anException"],
  22038. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  22039. referencedClasses: [],
  22040. pragmas: [],
  22041. messageSends: ["exception:", "new", "yourself"]
  22042. }),
  22043. $globals.JavaScriptException.a$cls);
  22044. $core.addMethod(
  22045. $core.method({
  22046. selector: "on:context:",
  22047. protocol: "instance creation",
  22048. fn: function (anException,aMethodContext){
  22049. var self=this,$self=this;
  22050. return $core.withContext(function($ctx1) {
  22051. var $1;
  22052. $1=$self._new();
  22053. $recv($1)._exception_(anException);
  22054. $recv($1)._context_(aMethodContext);
  22055. return $recv($1)._yourself();
  22056. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext})});
  22057. },
  22058. args: ["anException", "aMethodContext"],
  22059. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  22060. referencedClasses: [],
  22061. pragmas: [],
  22062. messageSends: ["exception:", "new", "context:", "yourself"]
  22063. }),
  22064. $globals.JavaScriptException.a$cls);
  22065. $core.addClass("MessageNotUnderstood", $globals.Error, ["smalltalkMessage", "receiver"], "Kernel-Exceptions");
  22066. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  22067. $core.addMethod(
  22068. $core.method({
  22069. selector: "message",
  22070. protocol: "accessing",
  22071. fn: function (){
  22072. var self=this,$self=this;
  22073. return $self.smalltalkMessage;
  22074. },
  22075. args: [],
  22076. source: "message\x0a\x09^ smalltalkMessage",
  22077. referencedClasses: [],
  22078. pragmas: [],
  22079. messageSends: []
  22080. }),
  22081. $globals.MessageNotUnderstood);
  22082. $core.addMethod(
  22083. $core.method({
  22084. selector: "message:",
  22085. protocol: "accessing",
  22086. fn: function (aMessage){
  22087. var self=this,$self=this;
  22088. $self.smalltalkMessage=aMessage;
  22089. return self;
  22090. },
  22091. args: ["aMessage"],
  22092. source: "message: aMessage\x0a\x09smalltalkMessage := aMessage",
  22093. referencedClasses: [],
  22094. pragmas: [],
  22095. messageSends: []
  22096. }),
  22097. $globals.MessageNotUnderstood);
  22098. $core.addMethod(
  22099. $core.method({
  22100. selector: "messageText",
  22101. protocol: "accessing",
  22102. fn: function (){
  22103. var self=this,$self=this;
  22104. return $core.withContext(function($ctx1) {
  22105. var $1;
  22106. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  22107. $ctx1.sendIdx[","]=1;
  22108. return $1;
  22109. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  22110. },
  22111. args: [],
  22112. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  22113. referencedClasses: [],
  22114. pragmas: [],
  22115. messageSends: [",", "asString", "receiver", "selector", "message"]
  22116. }),
  22117. $globals.MessageNotUnderstood);
  22118. $core.addMethod(
  22119. $core.method({
  22120. selector: "receiver",
  22121. protocol: "accessing",
  22122. fn: function (){
  22123. var self=this,$self=this;
  22124. return $self.receiver;
  22125. },
  22126. args: [],
  22127. source: "receiver\x0a\x09^ receiver",
  22128. referencedClasses: [],
  22129. pragmas: [],
  22130. messageSends: []
  22131. }),
  22132. $globals.MessageNotUnderstood);
  22133. $core.addMethod(
  22134. $core.method({
  22135. selector: "receiver:",
  22136. protocol: "accessing",
  22137. fn: function (anObject){
  22138. var self=this,$self=this;
  22139. $self.receiver=anObject;
  22140. return self;
  22141. },
  22142. args: ["anObject"],
  22143. source: "receiver: anObject\x0a\x09receiver := anObject",
  22144. referencedClasses: [],
  22145. pragmas: [],
  22146. messageSends: []
  22147. }),
  22148. $globals.MessageNotUnderstood);
  22149. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  22150. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  22151. $core.addMethod(
  22152. $core.method({
  22153. selector: "object",
  22154. protocol: "accessing",
  22155. fn: function (){
  22156. var self=this,$self=this;
  22157. return $self.object;
  22158. },
  22159. args: [],
  22160. source: "object\x0a\x09^ object",
  22161. referencedClasses: [],
  22162. pragmas: [],
  22163. messageSends: []
  22164. }),
  22165. $globals.NonBooleanReceiver);
  22166. $core.addMethod(
  22167. $core.method({
  22168. selector: "object:",
  22169. protocol: "accessing",
  22170. fn: function (anObject){
  22171. var self=this,$self=this;
  22172. $self.object=anObject;
  22173. return self;
  22174. },
  22175. args: ["anObject"],
  22176. source: "object: anObject\x0a\x09object := anObject",
  22177. referencedClasses: [],
  22178. pragmas: [],
  22179. messageSends: []
  22180. }),
  22181. $globals.NonBooleanReceiver);
  22182. $core.addMethod(
  22183. $core.method({
  22184. selector: "signalOn:",
  22185. protocol: "instance creation",
  22186. fn: function (anObject){
  22187. var self=this,$self=this;
  22188. return $core.withContext(function($ctx1) {
  22189. var $1;
  22190. $1=$self._new();
  22191. $recv($1)._object_(anObject);
  22192. return $recv($1)._signal();
  22193. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject})});
  22194. },
  22195. args: ["anObject"],
  22196. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  22197. referencedClasses: [],
  22198. pragmas: [],
  22199. messageSends: ["object:", "new", "signal"]
  22200. }),
  22201. $globals.NonBooleanReceiver.a$cls);
  22202. });
  22203. define('amber/core/Kernel-Promises',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  22204. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22205. var $pkg = $core.addPackage("Kernel-Promises");
  22206. $pkg.innerEval = function (expr) { return eval(expr); };
  22207. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  22208. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  22209. $core.addMethod(
  22210. $core.method({
  22211. selector: "all:",
  22212. protocol: "composites",
  22213. fn: function (aCollection){
  22214. var self=this,$self=this;
  22215. return $core.withContext(function($ctx1) {
  22216. return Promise.all($recv(aCollection)._asArray());
  22217. return self;
  22218. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection})});
  22219. },
  22220. args: ["aCollection"],
  22221. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  22222. referencedClasses: [],
  22223. pragmas: [["inlineJS:", ["return Promise.all($recv(aCollection)._asArray())"]]],
  22224. messageSends: []
  22225. }),
  22226. $globals.Promise.a$cls);
  22227. $core.addMethod(
  22228. $core.method({
  22229. selector: "any:",
  22230. protocol: "composites",
  22231. fn: function (aCollection){
  22232. var self=this,$self=this;
  22233. return $core.withContext(function($ctx1) {
  22234. return Promise.race($recv(aCollection)._asArray());
  22235. return self;
  22236. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection})});
  22237. },
  22238. args: ["aCollection"],
  22239. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  22240. referencedClasses: [],
  22241. pragmas: [["inlineJS:", ["return Promise.race($recv(aCollection)._asArray())"]]],
  22242. messageSends: []
  22243. }),
  22244. $globals.Promise.a$cls);
  22245. $core.addMethod(
  22246. $core.method({
  22247. selector: "forBlock:",
  22248. protocol: "instance creation",
  22249. fn: function (aBlock){
  22250. var self=this,$self=this;
  22251. return $core.withContext(function($ctx1) {
  22252. return $recv($self._new())._then_(aBlock);
  22253. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock})});
  22254. },
  22255. args: ["aBlock"],
  22256. 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",
  22257. referencedClasses: [],
  22258. pragmas: [],
  22259. messageSends: ["then:", "new"]
  22260. }),
  22261. $globals.Promise.a$cls);
  22262. $core.addMethod(
  22263. $core.method({
  22264. selector: "new",
  22265. protocol: "instance creation",
  22266. fn: function (){
  22267. var self=this,$self=this;
  22268. return $core.withContext(function($ctx1) {
  22269. return Promise.resolve();
  22270. return self;
  22271. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  22272. },
  22273. args: [],
  22274. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  22275. referencedClasses: [],
  22276. pragmas: [["inlineJS:", ["return Promise.resolve()"]]],
  22277. messageSends: []
  22278. }),
  22279. $globals.Promise.a$cls);
  22280. $core.addMethod(
  22281. $core.method({
  22282. selector: "new:",
  22283. protocol: "instance creation",
  22284. fn: function (aBlock){
  22285. var self=this,$self=this;
  22286. return $core.withContext(function($ctx1) {
  22287. return new Promise(function (resolve, reject) {
  22288. var model = {value: resolve, signal: reject};
  22289. aBlock._value_(model);
  22290. });
  22291. return self;
  22292. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock})});
  22293. },
  22294. args: ["aBlock"],
  22295. 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})'>",
  22296. referencedClasses: [],
  22297. pragmas: [["inlineJS:", ["return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})"]]],
  22298. messageSends: []
  22299. }),
  22300. $globals.Promise.a$cls);
  22301. $core.addMethod(
  22302. $core.method({
  22303. selector: "signal:",
  22304. protocol: "instance creation",
  22305. fn: function (anObject){
  22306. var self=this,$self=this;
  22307. return $core.withContext(function($ctx1) {
  22308. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  22309. return self;
  22310. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject})});
  22311. },
  22312. args: ["anObject"],
  22313. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  22314. referencedClasses: [],
  22315. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.reject(x)})"]]],
  22316. messageSends: []
  22317. }),
  22318. $globals.Promise.a$cls);
  22319. $core.addMethod(
  22320. $core.method({
  22321. selector: "value:",
  22322. protocol: "instance creation",
  22323. fn: function (anObject){
  22324. var self=this,$self=this;
  22325. return $core.withContext(function($ctx1) {
  22326. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  22327. return self;
  22328. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  22329. },
  22330. args: ["anObject"],
  22331. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  22332. referencedClasses: [],
  22333. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})"]]],
  22334. messageSends: []
  22335. }),
  22336. $globals.Promise.a$cls);
  22337. $core.addTrait("TThenable", "Kernel-Promises");
  22338. $core.addMethod(
  22339. $core.method({
  22340. selector: "catch:",
  22341. protocol: "promises",
  22342. fn: function (aBlock){
  22343. var self=this,$self=this;
  22344. return $core.withContext(function($ctx1) {
  22345. return self.then(null, function (err) {return $core.seamless(function () {
  22346. return aBlock._value_(err);
  22347. })});
  22348. return self;
  22349. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  22350. },
  22351. args: ["aBlock"],
  22352. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  22353. referencedClasses: [],
  22354. pragmas: [["inlineJS:", ["return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})"]]],
  22355. messageSends: []
  22356. }),
  22357. $globals.TThenable);
  22358. $core.addMethod(
  22359. $core.method({
  22360. selector: "on:do:",
  22361. protocol: "promises",
  22362. fn: function (aClass,aBlock){
  22363. var self=this,$self=this;
  22364. return $core.withContext(function($ctx1) {
  22365. return self.then(null, function (err) {return $core.seamless(function () {
  22366. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  22367. else throw err;
  22368. })});
  22369. return self;
  22370. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  22371. },
  22372. args: ["aClass", "aBlock"],
  22373. 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})})'>",
  22374. referencedClasses: [],
  22375. pragmas: [["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})})"]]],
  22376. messageSends: []
  22377. }),
  22378. $globals.TThenable);
  22379. $core.addMethod(
  22380. $core.method({
  22381. selector: "on:do:catch:",
  22382. protocol: "promises",
  22383. fn: function (aClass,aBlock,anotherBlock){
  22384. var self=this,$self=this;
  22385. return $core.withContext(function($ctx1) {
  22386. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22387. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  22388. },
  22389. args: ["aClass", "aBlock", "anotherBlock"],
  22390. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  22391. referencedClasses: [],
  22392. pragmas: [],
  22393. messageSends: ["catch:", "on:do:"]
  22394. }),
  22395. $globals.TThenable);
  22396. $core.addMethod(
  22397. $core.method({
  22398. selector: "then:",
  22399. protocol: "promises",
  22400. fn: function (aBlockOrArray){
  22401. var self=this,$self=this;
  22402. return $core.withContext(function($ctx1) {
  22403. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  22404. return array.reduce(function (soFar, aBlock) {
  22405. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  22406. function (result) {return $core.seamless(function () {
  22407. if (Array.isArray(result)) {
  22408. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  22409. } else {
  22410. return aBlock._value_(result);
  22411. }
  22412. })} :
  22413. function (result) {return $core.seamless(function () {
  22414. return aBlock._value_(result);
  22415. })}
  22416. );
  22417. }, self);
  22418. return self;
  22419. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  22420. },
  22421. args: ["aBlockOrArray"],
  22422. 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)'>",
  22423. referencedClasses: [],
  22424. pragmas: [["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)"]]],
  22425. messageSends: []
  22426. }),
  22427. $globals.TThenable);
  22428. $core.addMethod(
  22429. $core.method({
  22430. selector: "then:catch:",
  22431. protocol: "promises",
  22432. fn: function (aBlockOrArray,anotherBlock){
  22433. var self=this,$self=this;
  22434. return $core.withContext(function($ctx1) {
  22435. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  22436. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock})});
  22437. },
  22438. args: ["aBlockOrArray", "anotherBlock"],
  22439. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  22440. referencedClasses: [],
  22441. pragmas: [],
  22442. messageSends: ["catch:", "then:"]
  22443. }),
  22444. $globals.TThenable);
  22445. $core.addMethod(
  22446. $core.method({
  22447. selector: "then:on:do:",
  22448. protocol: "promises",
  22449. fn: function (aBlockOrArray,aClass,aBlock){
  22450. var self=this,$self=this;
  22451. return $core.withContext(function($ctx1) {
  22452. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  22453. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock})});
  22454. },
  22455. args: ["aBlockOrArray", "aClass", "aBlock"],
  22456. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  22457. referencedClasses: [],
  22458. pragmas: [],
  22459. messageSends: ["on:do:", "then:"]
  22460. }),
  22461. $globals.TThenable);
  22462. $core.addMethod(
  22463. $core.method({
  22464. selector: "then:on:do:catch:",
  22465. protocol: "promises",
  22466. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  22467. var self=this,$self=this;
  22468. return $core.withContext(function($ctx1) {
  22469. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22470. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  22471. },
  22472. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  22473. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  22474. referencedClasses: [],
  22475. pragmas: [],
  22476. messageSends: ["catch:", "on:do:", "then:"]
  22477. }),
  22478. $globals.TThenable);
  22479. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  22480. });
  22481. /*
  22482. * Generated by PEG.js 0.10.0.
  22483. *
  22484. * http://pegjs.org/
  22485. */
  22486. define('amber/parser',["./boot"], function(__boot) {
  22487. "use strict";
  22488. function peg$subclass(child, parent) {
  22489. function ctor() { this.constructor = child; }
  22490. ctor.prototype = parent.prototype;
  22491. child.prototype = new ctor();
  22492. }
  22493. function peg$SyntaxError(message, expected, found, location) {
  22494. this.message = message;
  22495. this.expected = expected;
  22496. this.found = found;
  22497. this.location = location;
  22498. this.name = "SyntaxError";
  22499. if (typeof Error.captureStackTrace === "function") {
  22500. Error.captureStackTrace(this, peg$SyntaxError);
  22501. }
  22502. }
  22503. peg$subclass(peg$SyntaxError, Error);
  22504. peg$SyntaxError.buildMessage = function(expected, found) {
  22505. var DESCRIBE_EXPECTATION_FNS = {
  22506. literal: function(expectation) {
  22507. return "\"" + literalEscape(expectation.text) + "\"";
  22508. },
  22509. "class": function(expectation) {
  22510. var escapedParts = "",
  22511. i;
  22512. for (i = 0; i < expectation.parts.length; i++) {
  22513. escapedParts += expectation.parts[i] instanceof Array
  22514. ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
  22515. : classEscape(expectation.parts[i]);
  22516. }
  22517. return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
  22518. },
  22519. any: function(expectation) {
  22520. return "any character";
  22521. },
  22522. end: function(expectation) {
  22523. return "end of input";
  22524. },
  22525. other: function(expectation) {
  22526. return expectation.description;
  22527. }
  22528. };
  22529. function hex(ch) {
  22530. return ch.charCodeAt(0).toString(16).toUpperCase();
  22531. }
  22532. function literalEscape(s) {
  22533. return s
  22534. .replace(/\\/g, '\\\\')
  22535. .replace(/"/g, '\\"')
  22536. .replace(/\0/g, '\\0')
  22537. .replace(/\t/g, '\\t')
  22538. .replace(/\n/g, '\\n')
  22539. .replace(/\r/g, '\\r')
  22540. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  22541. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  22542. }
  22543. function classEscape(s) {
  22544. return s
  22545. .replace(/\\/g, '\\\\')
  22546. .replace(/\]/g, '\\]')
  22547. .replace(/\^/g, '\\^')
  22548. .replace(/-/g, '\\-')
  22549. .replace(/\0/g, '\\0')
  22550. .replace(/\t/g, '\\t')
  22551. .replace(/\n/g, '\\n')
  22552. .replace(/\r/g, '\\r')
  22553. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  22554. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  22555. }
  22556. function describeExpectation(expectation) {
  22557. return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
  22558. }
  22559. function describeExpected(expected) {
  22560. var descriptions = new Array(expected.length),
  22561. i, j;
  22562. for (i = 0; i < expected.length; i++) {
  22563. descriptions[i] = describeExpectation(expected[i]);
  22564. }
  22565. descriptions.sort();
  22566. if (descriptions.length > 0) {
  22567. for (i = 1, j = 1; i < descriptions.length; i++) {
  22568. if (descriptions[i - 1] !== descriptions[i]) {
  22569. descriptions[j] = descriptions[i];
  22570. j++;
  22571. }
  22572. }
  22573. descriptions.length = j;
  22574. }
  22575. switch (descriptions.length) {
  22576. case 1:
  22577. return descriptions[0];
  22578. case 2:
  22579. return descriptions[0] + " or " + descriptions[1];
  22580. default:
  22581. return descriptions.slice(0, -1).join(", ")
  22582. + ", or "
  22583. + descriptions[descriptions.length - 1];
  22584. }
  22585. }
  22586. function describeFound(found) {
  22587. return found ? "\"" + literalEscape(found) + "\"" : "end of input";
  22588. }
  22589. return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
  22590. };
  22591. function peg$parse(input, options) {
  22592. options = options !== void 0 ? options : {};
  22593. var peg$FAILED = {},
  22594. peg$startRuleFunctions = { start: peg$parsestart },
  22595. peg$startRuleFunction = peg$parsestart,
  22596. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  22597. peg$c1 = peg$classExpectation([" ", "\t", "\x0B", "\f", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u202F", "\u205F", "\u3000", "\uFEFF", "\n", "\r", "\u2028", "\u2029"], false, false),
  22598. peg$c2 = "\"",
  22599. peg$c3 = peg$literalExpectation("\"", false),
  22600. peg$c4 = /^[^"]/,
  22601. peg$c5 = peg$classExpectation(["\""], true, false),
  22602. peg$c6 = ".",
  22603. peg$c7 = peg$literalExpectation(".", false),
  22604. peg$c8 = /^[a-zA-Z]/,
  22605. peg$c9 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false),
  22606. peg$c10 = /^[a-zA-Z0-9]/,
  22607. peg$c11 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false),
  22608. peg$c12 = ":",
  22609. peg$c13 = peg$literalExpectation(":", false),
  22610. peg$c14 = /^[A-Z]/,
  22611. peg$c15 = peg$classExpectation([["A", "Z"]], false, false),
  22612. peg$c16 = function(val) {
  22613. return newNode($globals.ValueNode)._value_(val);
  22614. },
  22615. peg$c17 = "'",
  22616. peg$c18 = peg$literalExpectation("'", false),
  22617. peg$c19 = "''",
  22618. peg$c20 = peg$literalExpectation("''", false),
  22619. peg$c21 = function() {return '\'';},
  22620. peg$c22 = /^[^']/,
  22621. peg$c23 = peg$classExpectation(["'"], true, false),
  22622. peg$c24 = function(val) {return val.join('');},
  22623. peg$c25 = "$",
  22624. peg$c26 = peg$literalExpectation("$", false),
  22625. peg$c27 = peg$anyExpectation(),
  22626. peg$c28 = function(char) {
  22627. return newNode($globals.ValueNode)._value_(char);
  22628. },
  22629. peg$c29 = "#",
  22630. peg$c30 = peg$literalExpectation("#", false),
  22631. peg$c31 = function(rest) {return rest;},
  22632. peg$c32 = "e",
  22633. peg$c33 = peg$literalExpectation("e", false),
  22634. peg$c34 = function(n) {return parseFloat(n);},
  22635. peg$c35 = "-",
  22636. peg$c36 = peg$literalExpectation("-", false),
  22637. peg$c37 = "16r",
  22638. peg$c38 = peg$literalExpectation("16r", false),
  22639. peg$c39 = /^[0-9a-fA-F]/,
  22640. peg$c40 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false),
  22641. peg$c41 = function(neg, num) {
  22642. return parseInt(((neg || '') + num), 16);
  22643. },
  22644. peg$c42 = /^[0-9]/,
  22645. peg$c43 = peg$classExpectation([["0", "9"]], false, false),
  22646. peg$c44 = function(n) {return parseFloat(n, 10);},
  22647. peg$c45 = function(n) {return parseInt(n, 10);},
  22648. peg$c46 = "#(",
  22649. peg$c47 = peg$literalExpectation("#(", false),
  22650. peg$c48 = ")",
  22651. peg$c49 = peg$literalExpectation(")", false),
  22652. peg$c50 = function(rest) {
  22653. return newNode($globals.ValueNode)._value_(rest);
  22654. },
  22655. peg$c51 = "(",
  22656. peg$c52 = peg$literalExpectation("(", false),
  22657. peg$c53 = function(lit) {return lit._value();},
  22658. peg$c54 = "{",
  22659. peg$c55 = peg$literalExpectation("{", false),
  22660. peg$c56 = "}",
  22661. peg$c57 = peg$literalExpectation("}", false),
  22662. peg$c58 = function(expressions) {
  22663. return newNode($globals.DynamicArrayNode)._dagChildren_(expressions || []);
  22664. },
  22665. peg$c59 = "#{",
  22666. peg$c60 = peg$literalExpectation("#{", false),
  22667. peg$c61 = function(expressions) {
  22668. return newNode($globals.DynamicDictionaryNode)._dagChildren_(expressions || []);
  22669. },
  22670. peg$c62 = "true",
  22671. peg$c63 = peg$literalExpectation("true", false),
  22672. peg$c64 = function() {return true;},
  22673. peg$c65 = "false",
  22674. peg$c66 = peg$literalExpectation("false", false),
  22675. peg$c67 = function() {return false;},
  22676. peg$c68 = "nil",
  22677. peg$c69 = peg$literalExpectation("nil", false),
  22678. peg$c70 = function() {return null;},
  22679. peg$c71 = function(identifier) {
  22680. return newNode($globals.VariableNode)._value_(identifier);
  22681. },
  22682. peg$c72 = /^[\\+*\/=><,@%~|&\-]/,
  22683. peg$c73 = peg$classExpectation(["\\", "+", "*", "/", "=", ">", "<", ",", "@", "%", "~", "|", "&", "-"], false, false),
  22684. peg$c74 = function(key, arg) {return {key:key, arg:arg};},
  22685. peg$c75 = function(pairs) {
  22686. var selector = '';
  22687. var params = [];
  22688. for(var i = 0; i < pairs.length; i++) {
  22689. selector += pairs[i].key;
  22690. params.push(pairs[i].arg);
  22691. }
  22692. return [selector, params];
  22693. },
  22694. peg$c76 = function(selector, arg) {
  22695. return [selector, [arg]];
  22696. },
  22697. peg$c77 = function(selector) {return [selector, []];},
  22698. peg$c78 = function(expression) {
  22699. return expression;
  22700. },
  22701. peg$c79 = function(first, others) {
  22702. return [first].concat(others);
  22703. },
  22704. peg$c80 = function(selector) {
  22705. return $globals.Message._selector_arguments_(selector, []);
  22706. },
  22707. peg$c81 = function(pairs) {
  22708. var selector = '';
  22709. var args = [];
  22710. for(var i = 0; i < pairs.length; i++) {
  22711. selector += pairs[i].key;
  22712. args.push(pairs[i].arg._value());
  22713. }
  22714. return $globals.Message._selector_arguments_(selector, args)
  22715. },
  22716. peg$c82 = "<",
  22717. peg$c83 = peg$literalExpectation("<", false),
  22718. peg$c84 = ">",
  22719. peg$c85 = peg$literalExpectation(">", false),
  22720. peg$c86 = function(message) {return message;},
  22721. peg$c87 = ":=",
  22722. peg$c88 = peg$literalExpectation(":=", false),
  22723. peg$c89 = function(variable, expression) {
  22724. return newNode($globals.AssignmentNode)._left_(variable)._right_(expression);
  22725. },
  22726. peg$c90 = "^",
  22727. peg$c91 = peg$literalExpectation("^", false),
  22728. peg$c92 = function(expression) {
  22729. return newNode($globals.ReturnNode)._dagChildren_([expression]);
  22730. },
  22731. peg$c93 = "|",
  22732. peg$c94 = peg$literalExpectation("|", false),
  22733. peg$c95 = function(variable) {return variable;},
  22734. peg$c96 = function(vars) {
  22735. return vars;
  22736. },
  22737. peg$c97 = function(param) {return param;},
  22738. peg$c98 = function(params) {
  22739. return params;
  22740. },
  22741. peg$c99 = function(ret) {return [ret];},
  22742. peg$c100 = function(exps, ret) {
  22743. var expressions = exps;
  22744. expressions.push(ret);
  22745. return expressions;
  22746. },
  22747. peg$c101 = function(expressions) {return expressions || [];},
  22748. peg$c102 = function(aPragmas, temps, zPragmas, statements) {
  22749. return [newNode($globals.SequenceNode)
  22750. ._temps_(temps || [])
  22751. ._dagChildren_(statements || []), (aPragmas || []).concat(zPragmas || [])];
  22752. },
  22753. peg$c103 = function(temps, statements) {
  22754. return newNode($globals.BlockSequenceNode)
  22755. ._temps_(temps || [])
  22756. ._dagChildren_(statements || []);
  22757. },
  22758. peg$c104 = "[",
  22759. peg$c105 = peg$literalExpectation("[", false),
  22760. peg$c106 = "]",
  22761. peg$c107 = peg$literalExpectation("]", false),
  22762. peg$c108 = function(params, sequence) {
  22763. return newNode($globals.BlockNode)._parameters_(params || [])._dagChildren_([sequence]);
  22764. },
  22765. peg$c109 = function(selector) {
  22766. return newNode($globals.SendNode)._selector_(selector);
  22767. },
  22768. peg$c110 = function(receiver, tail) {
  22769. return receiver._withTail_(tail);
  22770. },
  22771. peg$c111 = function(selector, arg) {
  22772. return newNode($globals.SendNode)._selector_(selector)._arguments_([arg]);
  22773. },
  22774. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  22775. peg$c113 = function(pairs) {
  22776. var selector = '';
  22777. var args = [];
  22778. for(var i = 0; i < pairs.length; i++) {
  22779. selector += pairs[i].key;
  22780. args.push(pairs[i].arg);
  22781. }
  22782. return newNode($globals.SendNode)._selector_(selector)._arguments_(args);
  22783. },
  22784. peg$c114 = function(binarys, final) {
  22785. if (final) binarys.push(final);
  22786. return binarys;
  22787. },
  22788. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  22789. peg$c116 = ";",
  22790. peg$c117 = peg$literalExpectation(";", false),
  22791. peg$c118 = function(receiver, tail, mess) {return mess;},
  22792. peg$c119 = function(receiver, tail, messages) {
  22793. messages.unshift(receiver._withTail_(tail));
  22794. return newNode($globals.CascadeNode)._dagChildren_(messages);
  22795. },
  22796. peg$c120 = function(pattern, sequence) {
  22797. return newNode($globals.MethodNode)
  22798. ._selector_(pattern[0])
  22799. ._arguments_(pattern[1])
  22800. ._pragmas_(sequence[1])
  22801. ._dagChildren_([sequence[0]]);
  22802. },
  22803. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  22804. peg$c122 = function(receiver, tail) {
  22805. var last = tail.pop();
  22806. return [receiver._withTail_(tail), last._arguments()[0]];
  22807. },
  22808. peg$c123 = function(first, others) {
  22809. return first.concat.apply(first, others);
  22810. },
  22811. peg$currPos = 0,
  22812. peg$savedPos = 0,
  22813. peg$posDetailsCache = [{ line: 1, column: 1 }],
  22814. peg$maxFailPos = 0,
  22815. peg$maxFailExpected = [],
  22816. peg$silentFails = 0,
  22817. peg$resultsCache = {},
  22818. peg$result;
  22819. if ("startRule" in options) {
  22820. if (!(options.startRule in peg$startRuleFunctions)) {
  22821. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  22822. }
  22823. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  22824. }
  22825. function text() {
  22826. return input.substring(peg$savedPos, peg$currPos);
  22827. }
  22828. function location() {
  22829. return peg$computeLocation(peg$savedPos, peg$currPos);
  22830. }
  22831. function expected(description, location) {
  22832. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  22833. throw peg$buildStructuredError(
  22834. [peg$otherExpectation(description)],
  22835. input.substring(peg$savedPos, peg$currPos),
  22836. location
  22837. );
  22838. }
  22839. function error(message, location) {
  22840. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  22841. throw peg$buildSimpleError(message, location);
  22842. }
  22843. function peg$literalExpectation(text, ignoreCase) {
  22844. return { type: "literal", text: text, ignoreCase: ignoreCase };
  22845. }
  22846. function peg$classExpectation(parts, inverted, ignoreCase) {
  22847. return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
  22848. }
  22849. function peg$anyExpectation() {
  22850. return { type: "any" };
  22851. }
  22852. function peg$endExpectation() {
  22853. return { type: "end" };
  22854. }
  22855. function peg$otherExpectation(description) {
  22856. return { type: "other", description: description };
  22857. }
  22858. function peg$computePosDetails(pos) {
  22859. var details = peg$posDetailsCache[pos], p;
  22860. if (details) {
  22861. return details;
  22862. } else {
  22863. p = pos - 1;
  22864. while (!peg$posDetailsCache[p]) {
  22865. p--;
  22866. }
  22867. details = peg$posDetailsCache[p];
  22868. details = {
  22869. line: details.line,
  22870. column: details.column
  22871. };
  22872. while (p < pos) {
  22873. if (input.charCodeAt(p) === 10) {
  22874. details.line++;
  22875. details.column = 1;
  22876. } else {
  22877. details.column++;
  22878. }
  22879. p++;
  22880. }
  22881. peg$posDetailsCache[pos] = details;
  22882. return details;
  22883. }
  22884. }
  22885. function peg$computeLocation(startPos, endPos) {
  22886. var startPosDetails = peg$computePosDetails(startPos),
  22887. endPosDetails = peg$computePosDetails(endPos);
  22888. return {
  22889. start: {
  22890. offset: startPos,
  22891. line: startPosDetails.line,
  22892. column: startPosDetails.column
  22893. },
  22894. end: {
  22895. offset: endPos,
  22896. line: endPosDetails.line,
  22897. column: endPosDetails.column
  22898. }
  22899. };
  22900. }
  22901. function peg$fail(expected) {
  22902. if (peg$currPos < peg$maxFailPos) { return; }
  22903. if (peg$currPos > peg$maxFailPos) {
  22904. peg$maxFailPos = peg$currPos;
  22905. peg$maxFailExpected = [];
  22906. }
  22907. peg$maxFailExpected.push(expected);
  22908. }
  22909. function peg$buildSimpleError(message, location) {
  22910. return new peg$SyntaxError(message, null, null, location);
  22911. }
  22912. function peg$buildStructuredError(expected, found, location) {
  22913. return new peg$SyntaxError(
  22914. peg$SyntaxError.buildMessage(expected, found),
  22915. expected,
  22916. found,
  22917. location
  22918. );
  22919. }
  22920. function peg$parsestart() {
  22921. var s0;
  22922. var key = peg$currPos * 67 + 0,
  22923. cached = peg$resultsCache[key];
  22924. if (cached) {
  22925. peg$currPos = cached.nextPos;
  22926. return cached.result;
  22927. }
  22928. s0 = peg$parsemethod();
  22929. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  22930. return s0;
  22931. }
  22932. function peg$parseseparator() {
  22933. var s0, s1;
  22934. var key = peg$currPos * 67 + 1,
  22935. cached = peg$resultsCache[key];
  22936. if (cached) {
  22937. peg$currPos = cached.nextPos;
  22938. return cached.result;
  22939. }
  22940. s0 = [];
  22941. if (peg$c0.test(input.charAt(peg$currPos))) {
  22942. s1 = input.charAt(peg$currPos);
  22943. peg$currPos++;
  22944. } else {
  22945. s1 = peg$FAILED;
  22946. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  22947. }
  22948. if (s1 !== peg$FAILED) {
  22949. while (s1 !== peg$FAILED) {
  22950. s0.push(s1);
  22951. if (peg$c0.test(input.charAt(peg$currPos))) {
  22952. s1 = input.charAt(peg$currPos);
  22953. peg$currPos++;
  22954. } else {
  22955. s1 = peg$FAILED;
  22956. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  22957. }
  22958. }
  22959. } else {
  22960. s0 = peg$FAILED;
  22961. }
  22962. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  22963. return s0;
  22964. }
  22965. function peg$parsecomments() {
  22966. var s0, s1, s2, s3, s4;
  22967. var key = peg$currPos * 67 + 2,
  22968. cached = peg$resultsCache[key];
  22969. if (cached) {
  22970. peg$currPos = cached.nextPos;
  22971. return cached.result;
  22972. }
  22973. s0 = [];
  22974. s1 = peg$currPos;
  22975. if (input.charCodeAt(peg$currPos) === 34) {
  22976. s2 = peg$c2;
  22977. peg$currPos++;
  22978. } else {
  22979. s2 = peg$FAILED;
  22980. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  22981. }
  22982. if (s2 !== peg$FAILED) {
  22983. s3 = [];
  22984. if (peg$c4.test(input.charAt(peg$currPos))) {
  22985. s4 = input.charAt(peg$currPos);
  22986. peg$currPos++;
  22987. } else {
  22988. s4 = peg$FAILED;
  22989. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  22990. }
  22991. while (s4 !== peg$FAILED) {
  22992. s3.push(s4);
  22993. if (peg$c4.test(input.charAt(peg$currPos))) {
  22994. s4 = input.charAt(peg$currPos);
  22995. peg$currPos++;
  22996. } else {
  22997. s4 = peg$FAILED;
  22998. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  22999. }
  23000. }
  23001. if (s3 !== peg$FAILED) {
  23002. if (input.charCodeAt(peg$currPos) === 34) {
  23003. s4 = peg$c2;
  23004. peg$currPos++;
  23005. } else {
  23006. s4 = peg$FAILED;
  23007. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23008. }
  23009. if (s4 !== peg$FAILED) {
  23010. s2 = [s2, s3, s4];
  23011. s1 = s2;
  23012. } else {
  23013. peg$currPos = s1;
  23014. s1 = peg$FAILED;
  23015. }
  23016. } else {
  23017. peg$currPos = s1;
  23018. s1 = peg$FAILED;
  23019. }
  23020. } else {
  23021. peg$currPos = s1;
  23022. s1 = peg$FAILED;
  23023. }
  23024. if (s1 !== peg$FAILED) {
  23025. while (s1 !== peg$FAILED) {
  23026. s0.push(s1);
  23027. s1 = peg$currPos;
  23028. if (input.charCodeAt(peg$currPos) === 34) {
  23029. s2 = peg$c2;
  23030. peg$currPos++;
  23031. } else {
  23032. s2 = peg$FAILED;
  23033. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23034. }
  23035. if (s2 !== peg$FAILED) {
  23036. s3 = [];
  23037. if (peg$c4.test(input.charAt(peg$currPos))) {
  23038. s4 = input.charAt(peg$currPos);
  23039. peg$currPos++;
  23040. } else {
  23041. s4 = peg$FAILED;
  23042. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23043. }
  23044. while (s4 !== peg$FAILED) {
  23045. s3.push(s4);
  23046. if (peg$c4.test(input.charAt(peg$currPos))) {
  23047. s4 = input.charAt(peg$currPos);
  23048. peg$currPos++;
  23049. } else {
  23050. s4 = peg$FAILED;
  23051. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23052. }
  23053. }
  23054. if (s3 !== peg$FAILED) {
  23055. if (input.charCodeAt(peg$currPos) === 34) {
  23056. s4 = peg$c2;
  23057. peg$currPos++;
  23058. } else {
  23059. s4 = peg$FAILED;
  23060. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23061. }
  23062. if (s4 !== peg$FAILED) {
  23063. s2 = [s2, s3, s4];
  23064. s1 = s2;
  23065. } else {
  23066. peg$currPos = s1;
  23067. s1 = peg$FAILED;
  23068. }
  23069. } else {
  23070. peg$currPos = s1;
  23071. s1 = peg$FAILED;
  23072. }
  23073. } else {
  23074. peg$currPos = s1;
  23075. s1 = peg$FAILED;
  23076. }
  23077. }
  23078. } else {
  23079. s0 = peg$FAILED;
  23080. }
  23081. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23082. return s0;
  23083. }
  23084. function peg$parsews() {
  23085. var s0, s1;
  23086. var key = peg$currPos * 67 + 3,
  23087. cached = peg$resultsCache[key];
  23088. if (cached) {
  23089. peg$currPos = cached.nextPos;
  23090. return cached.result;
  23091. }
  23092. s0 = [];
  23093. s1 = peg$parseseparator();
  23094. if (s1 === peg$FAILED) {
  23095. s1 = peg$parsecomments();
  23096. }
  23097. while (s1 !== peg$FAILED) {
  23098. s0.push(s1);
  23099. s1 = peg$parseseparator();
  23100. if (s1 === peg$FAILED) {
  23101. s1 = peg$parsecomments();
  23102. }
  23103. }
  23104. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23105. return s0;
  23106. }
  23107. function peg$parsemaybeDotsWs() {
  23108. var s0, s1;
  23109. var key = peg$currPos * 67 + 4,
  23110. cached = peg$resultsCache[key];
  23111. if (cached) {
  23112. peg$currPos = cached.nextPos;
  23113. return cached.result;
  23114. }
  23115. s0 = [];
  23116. if (input.charCodeAt(peg$currPos) === 46) {
  23117. s1 = peg$c6;
  23118. peg$currPos++;
  23119. } else {
  23120. s1 = peg$FAILED;
  23121. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23122. }
  23123. if (s1 === peg$FAILED) {
  23124. s1 = peg$parseseparator();
  23125. if (s1 === peg$FAILED) {
  23126. s1 = peg$parsecomments();
  23127. }
  23128. }
  23129. while (s1 !== peg$FAILED) {
  23130. s0.push(s1);
  23131. if (input.charCodeAt(peg$currPos) === 46) {
  23132. s1 = peg$c6;
  23133. peg$currPos++;
  23134. } else {
  23135. s1 = peg$FAILED;
  23136. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23137. }
  23138. if (s1 === peg$FAILED) {
  23139. s1 = peg$parseseparator();
  23140. if (s1 === peg$FAILED) {
  23141. s1 = peg$parsecomments();
  23142. }
  23143. }
  23144. }
  23145. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23146. return s0;
  23147. }
  23148. function peg$parsesomeDotsWs() {
  23149. var s0, s1, s2, s3;
  23150. var key = peg$currPos * 67 + 5,
  23151. cached = peg$resultsCache[key];
  23152. if (cached) {
  23153. peg$currPos = cached.nextPos;
  23154. return cached.result;
  23155. }
  23156. s0 = peg$currPos;
  23157. s1 = peg$parsews();
  23158. if (s1 !== peg$FAILED) {
  23159. if (input.charCodeAt(peg$currPos) === 46) {
  23160. s2 = peg$c6;
  23161. peg$currPos++;
  23162. } else {
  23163. s2 = peg$FAILED;
  23164. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23165. }
  23166. if (s2 !== peg$FAILED) {
  23167. s3 = peg$parsemaybeDotsWs();
  23168. if (s3 !== peg$FAILED) {
  23169. s1 = [s1, s2, s3];
  23170. s0 = s1;
  23171. } else {
  23172. peg$currPos = s0;
  23173. s0 = peg$FAILED;
  23174. }
  23175. } else {
  23176. peg$currPos = s0;
  23177. s0 = peg$FAILED;
  23178. }
  23179. } else {
  23180. peg$currPos = s0;
  23181. s0 = peg$FAILED;
  23182. }
  23183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23184. return s0;
  23185. }
  23186. function peg$parseidentifier() {
  23187. var s0, s1, s2, s3, s4;
  23188. var key = peg$currPos * 67 + 6,
  23189. cached = peg$resultsCache[key];
  23190. if (cached) {
  23191. peg$currPos = cached.nextPos;
  23192. return cached.result;
  23193. }
  23194. s0 = peg$currPos;
  23195. s1 = peg$currPos;
  23196. if (peg$c8.test(input.charAt(peg$currPos))) {
  23197. s2 = input.charAt(peg$currPos);
  23198. peg$currPos++;
  23199. } else {
  23200. s2 = peg$FAILED;
  23201. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  23202. }
  23203. if (s2 !== peg$FAILED) {
  23204. s3 = [];
  23205. if (peg$c10.test(input.charAt(peg$currPos))) {
  23206. s4 = input.charAt(peg$currPos);
  23207. peg$currPos++;
  23208. } else {
  23209. s4 = peg$FAILED;
  23210. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23211. }
  23212. while (s4 !== peg$FAILED) {
  23213. s3.push(s4);
  23214. if (peg$c10.test(input.charAt(peg$currPos))) {
  23215. s4 = input.charAt(peg$currPos);
  23216. peg$currPos++;
  23217. } else {
  23218. s4 = peg$FAILED;
  23219. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23220. }
  23221. }
  23222. if (s3 !== peg$FAILED) {
  23223. s2 = [s2, s3];
  23224. s1 = s2;
  23225. } else {
  23226. peg$currPos = s1;
  23227. s1 = peg$FAILED;
  23228. }
  23229. } else {
  23230. peg$currPos = s1;
  23231. s1 = peg$FAILED;
  23232. }
  23233. if (s1 !== peg$FAILED) {
  23234. s0 = input.substring(s0, peg$currPos);
  23235. } else {
  23236. s0 = s1;
  23237. }
  23238. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23239. return s0;
  23240. }
  23241. function peg$parsekeyword() {
  23242. var s0, s1, s2, s3;
  23243. var key = peg$currPos * 67 + 7,
  23244. cached = peg$resultsCache[key];
  23245. if (cached) {
  23246. peg$currPos = cached.nextPos;
  23247. return cached.result;
  23248. }
  23249. s0 = peg$currPos;
  23250. s1 = peg$currPos;
  23251. s2 = peg$parseidentifier();
  23252. if (s2 !== peg$FAILED) {
  23253. if (input.charCodeAt(peg$currPos) === 58) {
  23254. s3 = peg$c12;
  23255. peg$currPos++;
  23256. } else {
  23257. s3 = peg$FAILED;
  23258. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  23259. }
  23260. if (s3 !== peg$FAILED) {
  23261. s2 = [s2, s3];
  23262. s1 = s2;
  23263. } else {
  23264. peg$currPos = s1;
  23265. s1 = peg$FAILED;
  23266. }
  23267. } else {
  23268. peg$currPos = s1;
  23269. s1 = peg$FAILED;
  23270. }
  23271. if (s1 !== peg$FAILED) {
  23272. s0 = input.substring(s0, peg$currPos);
  23273. } else {
  23274. s0 = s1;
  23275. }
  23276. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23277. return s0;
  23278. }
  23279. function peg$parseclassName() {
  23280. var s0, s1, s2, s3, s4;
  23281. var key = peg$currPos * 67 + 8,
  23282. cached = peg$resultsCache[key];
  23283. if (cached) {
  23284. peg$currPos = cached.nextPos;
  23285. return cached.result;
  23286. }
  23287. s0 = peg$currPos;
  23288. s1 = peg$currPos;
  23289. if (peg$c14.test(input.charAt(peg$currPos))) {
  23290. s2 = input.charAt(peg$currPos);
  23291. peg$currPos++;
  23292. } else {
  23293. s2 = peg$FAILED;
  23294. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  23295. }
  23296. if (s2 !== peg$FAILED) {
  23297. s3 = [];
  23298. if (peg$c10.test(input.charAt(peg$currPos))) {
  23299. s4 = input.charAt(peg$currPos);
  23300. peg$currPos++;
  23301. } else {
  23302. s4 = peg$FAILED;
  23303. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23304. }
  23305. while (s4 !== peg$FAILED) {
  23306. s3.push(s4);
  23307. if (peg$c10.test(input.charAt(peg$currPos))) {
  23308. s4 = input.charAt(peg$currPos);
  23309. peg$currPos++;
  23310. } else {
  23311. s4 = peg$FAILED;
  23312. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  23313. }
  23314. }
  23315. if (s3 !== peg$FAILED) {
  23316. s2 = [s2, s3];
  23317. s1 = s2;
  23318. } else {
  23319. peg$currPos = s1;
  23320. s1 = peg$FAILED;
  23321. }
  23322. } else {
  23323. peg$currPos = s1;
  23324. s1 = peg$FAILED;
  23325. }
  23326. if (s1 !== peg$FAILED) {
  23327. s0 = input.substring(s0, peg$currPos);
  23328. } else {
  23329. s0 = s1;
  23330. }
  23331. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23332. return s0;
  23333. }
  23334. function peg$parsestring() {
  23335. var s0, s1;
  23336. var key = peg$currPos * 67 + 9,
  23337. cached = peg$resultsCache[key];
  23338. if (cached) {
  23339. peg$currPos = cached.nextPos;
  23340. return cached.result;
  23341. }
  23342. s0 = peg$currPos;
  23343. s1 = peg$parserawString();
  23344. if (s1 !== peg$FAILED) {
  23345. peg$savedPos = s0;
  23346. s1 = peg$c16(s1);
  23347. }
  23348. s0 = s1;
  23349. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23350. return s0;
  23351. }
  23352. function peg$parserawString() {
  23353. var s0, s1, s2, s3, s4;
  23354. var key = peg$currPos * 67 + 10,
  23355. cached = peg$resultsCache[key];
  23356. if (cached) {
  23357. peg$currPos = cached.nextPos;
  23358. return cached.result;
  23359. }
  23360. s0 = peg$currPos;
  23361. if (input.charCodeAt(peg$currPos) === 39) {
  23362. s1 = peg$c17;
  23363. peg$currPos++;
  23364. } else {
  23365. s1 = peg$FAILED;
  23366. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  23367. }
  23368. if (s1 !== peg$FAILED) {
  23369. s2 = [];
  23370. s3 = peg$currPos;
  23371. if (input.substr(peg$currPos, 2) === peg$c19) {
  23372. s4 = peg$c19;
  23373. peg$currPos += 2;
  23374. } else {
  23375. s4 = peg$FAILED;
  23376. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  23377. }
  23378. if (s4 !== peg$FAILED) {
  23379. peg$savedPos = s3;
  23380. s4 = peg$c21();
  23381. }
  23382. s3 = s4;
  23383. if (s3 === peg$FAILED) {
  23384. if (peg$c22.test(input.charAt(peg$currPos))) {
  23385. s3 = input.charAt(peg$currPos);
  23386. peg$currPos++;
  23387. } else {
  23388. s3 = peg$FAILED;
  23389. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23390. }
  23391. }
  23392. while (s3 !== peg$FAILED) {
  23393. s2.push(s3);
  23394. s3 = peg$currPos;
  23395. if (input.substr(peg$currPos, 2) === peg$c19) {
  23396. s4 = peg$c19;
  23397. peg$currPos += 2;
  23398. } else {
  23399. s4 = peg$FAILED;
  23400. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  23401. }
  23402. if (s4 !== peg$FAILED) {
  23403. peg$savedPos = s3;
  23404. s4 = peg$c21();
  23405. }
  23406. s3 = s4;
  23407. if (s3 === peg$FAILED) {
  23408. if (peg$c22.test(input.charAt(peg$currPos))) {
  23409. s3 = input.charAt(peg$currPos);
  23410. peg$currPos++;
  23411. } else {
  23412. s3 = peg$FAILED;
  23413. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  23414. }
  23415. }
  23416. }
  23417. if (s2 !== peg$FAILED) {
  23418. if (input.charCodeAt(peg$currPos) === 39) {
  23419. s3 = peg$c17;
  23420. peg$currPos++;
  23421. } else {
  23422. s3 = peg$FAILED;
  23423. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  23424. }
  23425. if (s3 !== peg$FAILED) {
  23426. peg$savedPos = s0;
  23427. s1 = peg$c24(s2);
  23428. s0 = s1;
  23429. } else {
  23430. peg$currPos = s0;
  23431. s0 = peg$FAILED;
  23432. }
  23433. } else {
  23434. peg$currPos = s0;
  23435. s0 = peg$FAILED;
  23436. }
  23437. } else {
  23438. peg$currPos = s0;
  23439. s0 = peg$FAILED;
  23440. }
  23441. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23442. return s0;
  23443. }
  23444. function peg$parsecharacter() {
  23445. var s0, s1, s2;
  23446. var key = peg$currPos * 67 + 11,
  23447. cached = peg$resultsCache[key];
  23448. if (cached) {
  23449. peg$currPos = cached.nextPos;
  23450. return cached.result;
  23451. }
  23452. s0 = peg$currPos;
  23453. if (input.charCodeAt(peg$currPos) === 36) {
  23454. s1 = peg$c25;
  23455. peg$currPos++;
  23456. } else {
  23457. s1 = peg$FAILED;
  23458. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  23459. }
  23460. if (s1 !== peg$FAILED) {
  23461. if (input.length > peg$currPos) {
  23462. s2 = input.charAt(peg$currPos);
  23463. peg$currPos++;
  23464. } else {
  23465. s2 = peg$FAILED;
  23466. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  23467. }
  23468. if (s2 !== peg$FAILED) {
  23469. peg$savedPos = s0;
  23470. s1 = peg$c28(s2);
  23471. s0 = s1;
  23472. } else {
  23473. peg$currPos = s0;
  23474. s0 = peg$FAILED;
  23475. }
  23476. } else {
  23477. peg$currPos = s0;
  23478. s0 = peg$FAILED;
  23479. }
  23480. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23481. return s0;
  23482. }
  23483. function peg$parsesymbol() {
  23484. var s0, s1, s2;
  23485. var key = peg$currPos * 67 + 12,
  23486. cached = peg$resultsCache[key];
  23487. if (cached) {
  23488. peg$currPos = cached.nextPos;
  23489. return cached.result;
  23490. }
  23491. s0 = peg$currPos;
  23492. if (input.charCodeAt(peg$currPos) === 35) {
  23493. s1 = peg$c29;
  23494. peg$currPos++;
  23495. } else {
  23496. s1 = peg$FAILED;
  23497. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  23498. }
  23499. if (s1 !== peg$FAILED) {
  23500. s2 = peg$parsebareSymbol();
  23501. if (s2 !== peg$FAILED) {
  23502. peg$savedPos = s0;
  23503. s1 = peg$c31(s2);
  23504. s0 = s1;
  23505. } else {
  23506. peg$currPos = s0;
  23507. s0 = peg$FAILED;
  23508. }
  23509. } else {
  23510. peg$currPos = s0;
  23511. s0 = peg$FAILED;
  23512. }
  23513. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23514. return s0;
  23515. }
  23516. function peg$parsebareSymbol() {
  23517. var s0, s1, s2, s3;
  23518. var key = peg$currPos * 67 + 13,
  23519. cached = peg$resultsCache[key];
  23520. if (cached) {
  23521. peg$currPos = cached.nextPos;
  23522. return cached.result;
  23523. }
  23524. s0 = peg$currPos;
  23525. s1 = peg$currPos;
  23526. s2 = [];
  23527. s3 = peg$parsekeyword();
  23528. if (s3 !== peg$FAILED) {
  23529. while (s3 !== peg$FAILED) {
  23530. s2.push(s3);
  23531. s3 = peg$parsekeyword();
  23532. }
  23533. } else {
  23534. s2 = peg$FAILED;
  23535. }
  23536. if (s2 !== peg$FAILED) {
  23537. s1 = input.substring(s1, peg$currPos);
  23538. } else {
  23539. s1 = s2;
  23540. }
  23541. if (s1 === peg$FAILED) {
  23542. s1 = peg$parsebinarySelector();
  23543. if (s1 === peg$FAILED) {
  23544. s1 = peg$parseidentifier();
  23545. if (s1 === peg$FAILED) {
  23546. s1 = peg$parserawString();
  23547. }
  23548. }
  23549. }
  23550. if (s1 !== peg$FAILED) {
  23551. peg$savedPos = s0;
  23552. s1 = peg$c16(s1);
  23553. }
  23554. s0 = s1;
  23555. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23556. return s0;
  23557. }
  23558. function peg$parsenumber() {
  23559. var s0, s1;
  23560. var key = peg$currPos * 67 + 14,
  23561. cached = peg$resultsCache[key];
  23562. if (cached) {
  23563. peg$currPos = cached.nextPos;
  23564. return cached.result;
  23565. }
  23566. s0 = peg$currPos;
  23567. s1 = peg$parserawNumber();
  23568. if (s1 !== peg$FAILED) {
  23569. peg$savedPos = s0;
  23570. s1 = peg$c16(s1);
  23571. }
  23572. s0 = s1;
  23573. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23574. return s0;
  23575. }
  23576. function peg$parserawNumber() {
  23577. var s0;
  23578. var key = peg$currPos * 67 + 15,
  23579. cached = peg$resultsCache[key];
  23580. if (cached) {
  23581. peg$currPos = cached.nextPos;
  23582. return cached.result;
  23583. }
  23584. s0 = peg$parsenumberExp();
  23585. if (s0 === peg$FAILED) {
  23586. s0 = peg$parsehex();
  23587. if (s0 === peg$FAILED) {
  23588. s0 = peg$parsefloat();
  23589. if (s0 === peg$FAILED) {
  23590. s0 = peg$parseinteger();
  23591. }
  23592. }
  23593. }
  23594. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23595. return s0;
  23596. }
  23597. function peg$parsenumberExp() {
  23598. var s0, s1, s2, s3, s4, s5;
  23599. var key = peg$currPos * 67 + 16,
  23600. cached = peg$resultsCache[key];
  23601. if (cached) {
  23602. peg$currPos = cached.nextPos;
  23603. return cached.result;
  23604. }
  23605. s0 = peg$currPos;
  23606. s1 = peg$currPos;
  23607. s2 = peg$currPos;
  23608. s3 = peg$parsefloat();
  23609. if (s3 === peg$FAILED) {
  23610. s3 = peg$parseinteger();
  23611. }
  23612. if (s3 !== peg$FAILED) {
  23613. if (input.charCodeAt(peg$currPos) === 101) {
  23614. s4 = peg$c32;
  23615. peg$currPos++;
  23616. } else {
  23617. s4 = peg$FAILED;
  23618. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  23619. }
  23620. if (s4 !== peg$FAILED) {
  23621. s5 = peg$parseinteger();
  23622. if (s5 !== peg$FAILED) {
  23623. s3 = [s3, s4, s5];
  23624. s2 = s3;
  23625. } else {
  23626. peg$currPos = s2;
  23627. s2 = peg$FAILED;
  23628. }
  23629. } else {
  23630. peg$currPos = s2;
  23631. s2 = peg$FAILED;
  23632. }
  23633. } else {
  23634. peg$currPos = s2;
  23635. s2 = peg$FAILED;
  23636. }
  23637. if (s2 !== peg$FAILED) {
  23638. s1 = input.substring(s1, peg$currPos);
  23639. } else {
  23640. s1 = s2;
  23641. }
  23642. if (s1 !== peg$FAILED) {
  23643. peg$savedPos = s0;
  23644. s1 = peg$c34(s1);
  23645. }
  23646. s0 = s1;
  23647. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23648. return s0;
  23649. }
  23650. function peg$parsehex() {
  23651. var s0, s1, s2, s3, s4, s5;
  23652. var key = peg$currPos * 67 + 17,
  23653. cached = peg$resultsCache[key];
  23654. if (cached) {
  23655. peg$currPos = cached.nextPos;
  23656. return cached.result;
  23657. }
  23658. s0 = peg$currPos;
  23659. if (input.charCodeAt(peg$currPos) === 45) {
  23660. s1 = peg$c35;
  23661. peg$currPos++;
  23662. } else {
  23663. s1 = peg$FAILED;
  23664. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23665. }
  23666. if (s1 === peg$FAILED) {
  23667. s1 = null;
  23668. }
  23669. if (s1 !== peg$FAILED) {
  23670. if (input.substr(peg$currPos, 3) === peg$c37) {
  23671. s2 = peg$c37;
  23672. peg$currPos += 3;
  23673. } else {
  23674. s2 = peg$FAILED;
  23675. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  23676. }
  23677. if (s2 !== peg$FAILED) {
  23678. s3 = peg$currPos;
  23679. s4 = [];
  23680. if (peg$c39.test(input.charAt(peg$currPos))) {
  23681. s5 = input.charAt(peg$currPos);
  23682. peg$currPos++;
  23683. } else {
  23684. s5 = peg$FAILED;
  23685. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  23686. }
  23687. if (s5 !== peg$FAILED) {
  23688. while (s5 !== peg$FAILED) {
  23689. s4.push(s5);
  23690. if (peg$c39.test(input.charAt(peg$currPos))) {
  23691. s5 = input.charAt(peg$currPos);
  23692. peg$currPos++;
  23693. } else {
  23694. s5 = peg$FAILED;
  23695. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  23696. }
  23697. }
  23698. } else {
  23699. s4 = peg$FAILED;
  23700. }
  23701. if (s4 !== peg$FAILED) {
  23702. s3 = input.substring(s3, peg$currPos);
  23703. } else {
  23704. s3 = s4;
  23705. }
  23706. if (s3 !== peg$FAILED) {
  23707. peg$savedPos = s0;
  23708. s1 = peg$c41(s1, s3);
  23709. s0 = s1;
  23710. } else {
  23711. peg$currPos = s0;
  23712. s0 = peg$FAILED;
  23713. }
  23714. } else {
  23715. peg$currPos = s0;
  23716. s0 = peg$FAILED;
  23717. }
  23718. } else {
  23719. peg$currPos = s0;
  23720. s0 = peg$FAILED;
  23721. }
  23722. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23723. return s0;
  23724. }
  23725. function peg$parsefloat() {
  23726. var s0, s1, s2, s3, s4, s5, s6, s7;
  23727. var key = peg$currPos * 67 + 18,
  23728. cached = peg$resultsCache[key];
  23729. if (cached) {
  23730. peg$currPos = cached.nextPos;
  23731. return cached.result;
  23732. }
  23733. s0 = peg$currPos;
  23734. s1 = peg$currPos;
  23735. s2 = peg$currPos;
  23736. if (input.charCodeAt(peg$currPos) === 45) {
  23737. s3 = peg$c35;
  23738. peg$currPos++;
  23739. } else {
  23740. s3 = peg$FAILED;
  23741. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23742. }
  23743. if (s3 === peg$FAILED) {
  23744. s3 = null;
  23745. }
  23746. if (s3 !== peg$FAILED) {
  23747. s4 = [];
  23748. if (peg$c42.test(input.charAt(peg$currPos))) {
  23749. s5 = input.charAt(peg$currPos);
  23750. peg$currPos++;
  23751. } else {
  23752. s5 = peg$FAILED;
  23753. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23754. }
  23755. if (s5 !== peg$FAILED) {
  23756. while (s5 !== peg$FAILED) {
  23757. s4.push(s5);
  23758. if (peg$c42.test(input.charAt(peg$currPos))) {
  23759. s5 = input.charAt(peg$currPos);
  23760. peg$currPos++;
  23761. } else {
  23762. s5 = peg$FAILED;
  23763. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23764. }
  23765. }
  23766. } else {
  23767. s4 = peg$FAILED;
  23768. }
  23769. if (s4 !== peg$FAILED) {
  23770. if (input.charCodeAt(peg$currPos) === 46) {
  23771. s5 = peg$c6;
  23772. peg$currPos++;
  23773. } else {
  23774. s5 = peg$FAILED;
  23775. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23776. }
  23777. if (s5 !== peg$FAILED) {
  23778. s6 = [];
  23779. if (peg$c42.test(input.charAt(peg$currPos))) {
  23780. s7 = input.charAt(peg$currPos);
  23781. peg$currPos++;
  23782. } else {
  23783. s7 = peg$FAILED;
  23784. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23785. }
  23786. if (s7 !== peg$FAILED) {
  23787. while (s7 !== peg$FAILED) {
  23788. s6.push(s7);
  23789. if (peg$c42.test(input.charAt(peg$currPos))) {
  23790. s7 = input.charAt(peg$currPos);
  23791. peg$currPos++;
  23792. } else {
  23793. s7 = peg$FAILED;
  23794. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23795. }
  23796. }
  23797. } else {
  23798. s6 = peg$FAILED;
  23799. }
  23800. if (s6 !== peg$FAILED) {
  23801. s3 = [s3, s4, s5, s6];
  23802. s2 = s3;
  23803. } else {
  23804. peg$currPos = s2;
  23805. s2 = peg$FAILED;
  23806. }
  23807. } else {
  23808. peg$currPos = s2;
  23809. s2 = peg$FAILED;
  23810. }
  23811. } else {
  23812. peg$currPos = s2;
  23813. s2 = peg$FAILED;
  23814. }
  23815. } else {
  23816. peg$currPos = s2;
  23817. s2 = peg$FAILED;
  23818. }
  23819. if (s2 !== peg$FAILED) {
  23820. s1 = input.substring(s1, peg$currPos);
  23821. } else {
  23822. s1 = s2;
  23823. }
  23824. if (s1 !== peg$FAILED) {
  23825. peg$savedPos = s0;
  23826. s1 = peg$c44(s1);
  23827. }
  23828. s0 = s1;
  23829. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23830. return s0;
  23831. }
  23832. function peg$parseinteger() {
  23833. var s0, s1, s2, s3, s4, s5;
  23834. var key = peg$currPos * 67 + 19,
  23835. cached = peg$resultsCache[key];
  23836. if (cached) {
  23837. peg$currPos = cached.nextPos;
  23838. return cached.result;
  23839. }
  23840. s0 = peg$currPos;
  23841. s1 = peg$currPos;
  23842. s2 = peg$currPos;
  23843. if (input.charCodeAt(peg$currPos) === 45) {
  23844. s3 = peg$c35;
  23845. peg$currPos++;
  23846. } else {
  23847. s3 = peg$FAILED;
  23848. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  23849. }
  23850. if (s3 === peg$FAILED) {
  23851. s3 = null;
  23852. }
  23853. if (s3 !== peg$FAILED) {
  23854. s4 = [];
  23855. if (peg$c42.test(input.charAt(peg$currPos))) {
  23856. s5 = input.charAt(peg$currPos);
  23857. peg$currPos++;
  23858. } else {
  23859. s5 = peg$FAILED;
  23860. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23861. }
  23862. if (s5 !== peg$FAILED) {
  23863. while (s5 !== peg$FAILED) {
  23864. s4.push(s5);
  23865. if (peg$c42.test(input.charAt(peg$currPos))) {
  23866. s5 = input.charAt(peg$currPos);
  23867. peg$currPos++;
  23868. } else {
  23869. s5 = peg$FAILED;
  23870. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  23871. }
  23872. }
  23873. } else {
  23874. s4 = peg$FAILED;
  23875. }
  23876. if (s4 !== peg$FAILED) {
  23877. s3 = [s3, s4];
  23878. s2 = s3;
  23879. } else {
  23880. peg$currPos = s2;
  23881. s2 = peg$FAILED;
  23882. }
  23883. } else {
  23884. peg$currPos = s2;
  23885. s2 = peg$FAILED;
  23886. }
  23887. if (s2 !== peg$FAILED) {
  23888. s1 = input.substring(s1, peg$currPos);
  23889. } else {
  23890. s1 = s2;
  23891. }
  23892. if (s1 !== peg$FAILED) {
  23893. peg$savedPos = s0;
  23894. s1 = peg$c45(s1);
  23895. }
  23896. s0 = s1;
  23897. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23898. return s0;
  23899. }
  23900. function peg$parseliteralArray() {
  23901. var s0, s1, s2, s3, s4;
  23902. var key = peg$currPos * 67 + 20,
  23903. cached = peg$resultsCache[key];
  23904. if (cached) {
  23905. peg$currPos = cached.nextPos;
  23906. return cached.result;
  23907. }
  23908. s0 = peg$currPos;
  23909. if (input.substr(peg$currPos, 2) === peg$c46) {
  23910. s1 = peg$c46;
  23911. peg$currPos += 2;
  23912. } else {
  23913. s1 = peg$FAILED;
  23914. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  23915. }
  23916. if (s1 !== peg$FAILED) {
  23917. s2 = peg$parsewsLiteralArrayContents();
  23918. if (s2 !== peg$FAILED) {
  23919. s3 = peg$parsews();
  23920. if (s3 !== peg$FAILED) {
  23921. if (input.charCodeAt(peg$currPos) === 41) {
  23922. s4 = peg$c48;
  23923. peg$currPos++;
  23924. } else {
  23925. s4 = peg$FAILED;
  23926. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  23927. }
  23928. if (s4 !== peg$FAILED) {
  23929. peg$savedPos = s0;
  23930. s1 = peg$c50(s2);
  23931. s0 = s1;
  23932. } else {
  23933. peg$currPos = s0;
  23934. s0 = peg$FAILED;
  23935. }
  23936. } else {
  23937. peg$currPos = s0;
  23938. s0 = peg$FAILED;
  23939. }
  23940. } else {
  23941. peg$currPos = s0;
  23942. s0 = peg$FAILED;
  23943. }
  23944. } else {
  23945. peg$currPos = s0;
  23946. s0 = peg$FAILED;
  23947. }
  23948. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23949. return s0;
  23950. }
  23951. function peg$parsebareLiteralArray() {
  23952. var s0, s1, s2, s3, s4;
  23953. var key = peg$currPos * 67 + 21,
  23954. cached = peg$resultsCache[key];
  23955. if (cached) {
  23956. peg$currPos = cached.nextPos;
  23957. return cached.result;
  23958. }
  23959. s0 = peg$currPos;
  23960. if (input.charCodeAt(peg$currPos) === 40) {
  23961. s1 = peg$c51;
  23962. peg$currPos++;
  23963. } else {
  23964. s1 = peg$FAILED;
  23965. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  23966. }
  23967. if (s1 !== peg$FAILED) {
  23968. s2 = peg$parsewsLiteralArrayContents();
  23969. if (s2 !== peg$FAILED) {
  23970. s3 = peg$parsews();
  23971. if (s3 !== peg$FAILED) {
  23972. if (input.charCodeAt(peg$currPos) === 41) {
  23973. s4 = peg$c48;
  23974. peg$currPos++;
  23975. } else {
  23976. s4 = peg$FAILED;
  23977. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  23978. }
  23979. if (s4 !== peg$FAILED) {
  23980. peg$savedPos = s0;
  23981. s1 = peg$c50(s2);
  23982. s0 = s1;
  23983. } else {
  23984. peg$currPos = s0;
  23985. s0 = peg$FAILED;
  23986. }
  23987. } else {
  23988. peg$currPos = s0;
  23989. s0 = peg$FAILED;
  23990. }
  23991. } else {
  23992. peg$currPos = s0;
  23993. s0 = peg$FAILED;
  23994. }
  23995. } else {
  23996. peg$currPos = s0;
  23997. s0 = peg$FAILED;
  23998. }
  23999. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24000. return s0;
  24001. }
  24002. function peg$parseliteralArrayElement() {
  24003. var s0;
  24004. var key = peg$currPos * 67 + 22,
  24005. cached = peg$resultsCache[key];
  24006. if (cached) {
  24007. peg$currPos = cached.nextPos;
  24008. return cached.result;
  24009. }
  24010. s0 = peg$parseparseTimeLiteral();
  24011. if (s0 === peg$FAILED) {
  24012. s0 = peg$parsebareLiteralArray();
  24013. if (s0 === peg$FAILED) {
  24014. s0 = peg$parsebareSymbol();
  24015. }
  24016. }
  24017. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24018. return s0;
  24019. }
  24020. function peg$parsewsLiteralArrayContents() {
  24021. var s0, s1, s2, s3;
  24022. var key = peg$currPos * 67 + 23,
  24023. cached = peg$resultsCache[key];
  24024. if (cached) {
  24025. peg$currPos = cached.nextPos;
  24026. return cached.result;
  24027. }
  24028. s0 = [];
  24029. s1 = peg$currPos;
  24030. s2 = peg$parsews();
  24031. if (s2 !== peg$FAILED) {
  24032. s3 = peg$parseliteralArrayElement();
  24033. if (s3 !== peg$FAILED) {
  24034. peg$savedPos = s1;
  24035. s2 = peg$c53(s3);
  24036. s1 = s2;
  24037. } else {
  24038. peg$currPos = s1;
  24039. s1 = peg$FAILED;
  24040. }
  24041. } else {
  24042. peg$currPos = s1;
  24043. s1 = peg$FAILED;
  24044. }
  24045. while (s1 !== peg$FAILED) {
  24046. s0.push(s1);
  24047. s1 = peg$currPos;
  24048. s2 = peg$parsews();
  24049. if (s2 !== peg$FAILED) {
  24050. s3 = peg$parseliteralArrayElement();
  24051. if (s3 !== peg$FAILED) {
  24052. peg$savedPos = s1;
  24053. s2 = peg$c53(s3);
  24054. s1 = s2;
  24055. } else {
  24056. peg$currPos = s1;
  24057. s1 = peg$FAILED;
  24058. }
  24059. } else {
  24060. peg$currPos = s1;
  24061. s1 = peg$FAILED;
  24062. }
  24063. }
  24064. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24065. return s0;
  24066. }
  24067. function peg$parsedynamicArray() {
  24068. var s0, s1, s2, s3, s4;
  24069. var key = peg$currPos * 67 + 24,
  24070. cached = peg$resultsCache[key];
  24071. if (cached) {
  24072. peg$currPos = cached.nextPos;
  24073. return cached.result;
  24074. }
  24075. s0 = peg$currPos;
  24076. if (input.charCodeAt(peg$currPos) === 123) {
  24077. s1 = peg$c54;
  24078. peg$currPos++;
  24079. } else {
  24080. s1 = peg$FAILED;
  24081. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24082. }
  24083. if (s1 !== peg$FAILED) {
  24084. s2 = peg$parsewsExpressions();
  24085. if (s2 === peg$FAILED) {
  24086. s2 = null;
  24087. }
  24088. if (s2 !== peg$FAILED) {
  24089. s3 = peg$parsemaybeDotsWs();
  24090. if (s3 !== peg$FAILED) {
  24091. if (input.charCodeAt(peg$currPos) === 125) {
  24092. s4 = peg$c56;
  24093. peg$currPos++;
  24094. } else {
  24095. s4 = peg$FAILED;
  24096. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  24097. }
  24098. if (s4 !== peg$FAILED) {
  24099. peg$savedPos = s0;
  24100. s1 = peg$c58(s2);
  24101. s0 = s1;
  24102. } else {
  24103. peg$currPos = s0;
  24104. s0 = peg$FAILED;
  24105. }
  24106. } else {
  24107. peg$currPos = s0;
  24108. s0 = peg$FAILED;
  24109. }
  24110. } else {
  24111. peg$currPos = s0;
  24112. s0 = peg$FAILED;
  24113. }
  24114. } else {
  24115. peg$currPos = s0;
  24116. s0 = peg$FAILED;
  24117. }
  24118. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24119. return s0;
  24120. }
  24121. function peg$parsedynamicDictionary() {
  24122. var s0, s1, s2, s3, s4;
  24123. var key = peg$currPos * 67 + 25,
  24124. cached = peg$resultsCache[key];
  24125. if (cached) {
  24126. peg$currPos = cached.nextPos;
  24127. return cached.result;
  24128. }
  24129. s0 = peg$currPos;
  24130. if (input.substr(peg$currPos, 2) === peg$c59) {
  24131. s1 = peg$c59;
  24132. peg$currPos += 2;
  24133. } else {
  24134. s1 = peg$FAILED;
  24135. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  24136. }
  24137. if (s1 !== peg$FAILED) {
  24138. s2 = peg$parsewsAssociations();
  24139. if (s2 === peg$FAILED) {
  24140. s2 = null;
  24141. }
  24142. if (s2 !== peg$FAILED) {
  24143. s3 = peg$parsemaybeDotsWs();
  24144. if (s3 !== peg$FAILED) {
  24145. if (input.charCodeAt(peg$currPos) === 125) {
  24146. s4 = peg$c56;
  24147. peg$currPos++;
  24148. } else {
  24149. s4 = peg$FAILED;
  24150. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  24151. }
  24152. if (s4 !== peg$FAILED) {
  24153. peg$savedPos = s0;
  24154. s1 = peg$c61(s2);
  24155. s0 = s1;
  24156. } else {
  24157. peg$currPos = s0;
  24158. s0 = peg$FAILED;
  24159. }
  24160. } else {
  24161. peg$currPos = s0;
  24162. s0 = peg$FAILED;
  24163. }
  24164. } else {
  24165. peg$currPos = s0;
  24166. s0 = peg$FAILED;
  24167. }
  24168. } else {
  24169. peg$currPos = s0;
  24170. s0 = peg$FAILED;
  24171. }
  24172. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24173. return s0;
  24174. }
  24175. function peg$parsepseudoVariable() {
  24176. var s0, s1, s2;
  24177. var key = peg$currPos * 67 + 26,
  24178. cached = peg$resultsCache[key];
  24179. if (cached) {
  24180. peg$currPos = cached.nextPos;
  24181. return cached.result;
  24182. }
  24183. s0 = peg$currPos;
  24184. s1 = peg$currPos;
  24185. if (input.substr(peg$currPos, 4) === peg$c62) {
  24186. s2 = peg$c62;
  24187. peg$currPos += 4;
  24188. } else {
  24189. s2 = peg$FAILED;
  24190. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  24191. }
  24192. if (s2 !== peg$FAILED) {
  24193. peg$savedPos = s1;
  24194. s2 = peg$c64();
  24195. }
  24196. s1 = s2;
  24197. if (s1 === peg$FAILED) {
  24198. s1 = peg$currPos;
  24199. if (input.substr(peg$currPos, 5) === peg$c65) {
  24200. s2 = peg$c65;
  24201. peg$currPos += 5;
  24202. } else {
  24203. s2 = peg$FAILED;
  24204. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  24205. }
  24206. if (s2 !== peg$FAILED) {
  24207. peg$savedPos = s1;
  24208. s2 = peg$c67();
  24209. }
  24210. s1 = s2;
  24211. if (s1 === peg$FAILED) {
  24212. s1 = peg$currPos;
  24213. if (input.substr(peg$currPos, 3) === peg$c68) {
  24214. s2 = peg$c68;
  24215. peg$currPos += 3;
  24216. } else {
  24217. s2 = peg$FAILED;
  24218. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  24219. }
  24220. if (s2 !== peg$FAILED) {
  24221. peg$savedPos = s1;
  24222. s2 = peg$c70();
  24223. }
  24224. s1 = s2;
  24225. }
  24226. }
  24227. if (s1 !== peg$FAILED) {
  24228. peg$savedPos = s0;
  24229. s1 = peg$c16(s1);
  24230. }
  24231. s0 = s1;
  24232. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24233. return s0;
  24234. }
  24235. function peg$parseparseTimeLiteral() {
  24236. var s0;
  24237. var key = peg$currPos * 67 + 27,
  24238. cached = peg$resultsCache[key];
  24239. if (cached) {
  24240. peg$currPos = cached.nextPos;
  24241. return cached.result;
  24242. }
  24243. s0 = peg$parsepseudoVariable();
  24244. if (s0 === peg$FAILED) {
  24245. s0 = peg$parsenumber();
  24246. if (s0 === peg$FAILED) {
  24247. s0 = peg$parseliteralArray();
  24248. if (s0 === peg$FAILED) {
  24249. s0 = peg$parsestring();
  24250. if (s0 === peg$FAILED) {
  24251. s0 = peg$parsesymbol();
  24252. if (s0 === peg$FAILED) {
  24253. s0 = peg$parsecharacter();
  24254. }
  24255. }
  24256. }
  24257. }
  24258. }
  24259. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24260. return s0;
  24261. }
  24262. function peg$parseruntimeLiteral() {
  24263. var s0;
  24264. var key = peg$currPos * 67 + 28,
  24265. cached = peg$resultsCache[key];
  24266. if (cached) {
  24267. peg$currPos = cached.nextPos;
  24268. return cached.result;
  24269. }
  24270. s0 = peg$parsedynamicDictionary();
  24271. if (s0 === peg$FAILED) {
  24272. s0 = peg$parsedynamicArray();
  24273. if (s0 === peg$FAILED) {
  24274. s0 = peg$parseblock();
  24275. }
  24276. }
  24277. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24278. return s0;
  24279. }
  24280. function peg$parseliteral() {
  24281. var s0;
  24282. var key = peg$currPos * 67 + 29,
  24283. cached = peg$resultsCache[key];
  24284. if (cached) {
  24285. peg$currPos = cached.nextPos;
  24286. return cached.result;
  24287. }
  24288. s0 = peg$parseruntimeLiteral();
  24289. if (s0 === peg$FAILED) {
  24290. s0 = peg$parseparseTimeLiteral();
  24291. }
  24292. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24293. return s0;
  24294. }
  24295. function peg$parsevariable() {
  24296. var s0, s1;
  24297. var key = peg$currPos * 67 + 30,
  24298. cached = peg$resultsCache[key];
  24299. if (cached) {
  24300. peg$currPos = cached.nextPos;
  24301. return cached.result;
  24302. }
  24303. s0 = peg$currPos;
  24304. s1 = peg$parseidentifier();
  24305. if (s1 !== peg$FAILED) {
  24306. peg$savedPos = s0;
  24307. s1 = peg$c71(s1);
  24308. }
  24309. s0 = s1;
  24310. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24311. return s0;
  24312. }
  24313. function peg$parsebinarySelector() {
  24314. var s0, s1, s2;
  24315. var key = peg$currPos * 67 + 31,
  24316. cached = peg$resultsCache[key];
  24317. if (cached) {
  24318. peg$currPos = cached.nextPos;
  24319. return cached.result;
  24320. }
  24321. s0 = peg$currPos;
  24322. s1 = [];
  24323. if (peg$c72.test(input.charAt(peg$currPos))) {
  24324. s2 = input.charAt(peg$currPos);
  24325. peg$currPos++;
  24326. } else {
  24327. s2 = peg$FAILED;
  24328. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  24329. }
  24330. if (s2 !== peg$FAILED) {
  24331. while (s2 !== peg$FAILED) {
  24332. s1.push(s2);
  24333. if (peg$c72.test(input.charAt(peg$currPos))) {
  24334. s2 = input.charAt(peg$currPos);
  24335. peg$currPos++;
  24336. } else {
  24337. s2 = peg$FAILED;
  24338. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  24339. }
  24340. }
  24341. } else {
  24342. s1 = peg$FAILED;
  24343. }
  24344. if (s1 !== peg$FAILED) {
  24345. s0 = input.substring(s0, peg$currPos);
  24346. } else {
  24347. s0 = s1;
  24348. }
  24349. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24350. return s0;
  24351. }
  24352. function peg$parsewsKeywordPattern() {
  24353. var s0, s1, s2, s3, s4, s5, s6;
  24354. var key = peg$currPos * 67 + 32,
  24355. cached = peg$resultsCache[key];
  24356. if (cached) {
  24357. peg$currPos = cached.nextPos;
  24358. return cached.result;
  24359. }
  24360. s0 = peg$currPos;
  24361. s1 = [];
  24362. s2 = peg$currPos;
  24363. s3 = peg$parsews();
  24364. if (s3 !== peg$FAILED) {
  24365. s4 = peg$parsekeyword();
  24366. if (s4 !== peg$FAILED) {
  24367. s5 = peg$parsews();
  24368. if (s5 !== peg$FAILED) {
  24369. s6 = peg$parseidentifier();
  24370. if (s6 !== peg$FAILED) {
  24371. peg$savedPos = s2;
  24372. s3 = peg$c74(s4, s6);
  24373. s2 = s3;
  24374. } else {
  24375. peg$currPos = s2;
  24376. s2 = peg$FAILED;
  24377. }
  24378. } else {
  24379. peg$currPos = s2;
  24380. s2 = peg$FAILED;
  24381. }
  24382. } else {
  24383. peg$currPos = s2;
  24384. s2 = peg$FAILED;
  24385. }
  24386. } else {
  24387. peg$currPos = s2;
  24388. s2 = peg$FAILED;
  24389. }
  24390. if (s2 !== peg$FAILED) {
  24391. while (s2 !== peg$FAILED) {
  24392. s1.push(s2);
  24393. s2 = peg$currPos;
  24394. s3 = peg$parsews();
  24395. if (s3 !== peg$FAILED) {
  24396. s4 = peg$parsekeyword();
  24397. if (s4 !== peg$FAILED) {
  24398. s5 = peg$parsews();
  24399. if (s5 !== peg$FAILED) {
  24400. s6 = peg$parseidentifier();
  24401. if (s6 !== peg$FAILED) {
  24402. peg$savedPos = s2;
  24403. s3 = peg$c74(s4, s6);
  24404. s2 = s3;
  24405. } else {
  24406. peg$currPos = s2;
  24407. s2 = peg$FAILED;
  24408. }
  24409. } else {
  24410. peg$currPos = s2;
  24411. s2 = peg$FAILED;
  24412. }
  24413. } else {
  24414. peg$currPos = s2;
  24415. s2 = peg$FAILED;
  24416. }
  24417. } else {
  24418. peg$currPos = s2;
  24419. s2 = peg$FAILED;
  24420. }
  24421. }
  24422. } else {
  24423. s1 = peg$FAILED;
  24424. }
  24425. if (s1 !== peg$FAILED) {
  24426. peg$savedPos = s0;
  24427. s1 = peg$c75(s1);
  24428. }
  24429. s0 = s1;
  24430. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24431. return s0;
  24432. }
  24433. function peg$parsewsBinaryPattern() {
  24434. var s0, s1, s2, s3, s4;
  24435. var key = peg$currPos * 67 + 33,
  24436. cached = peg$resultsCache[key];
  24437. if (cached) {
  24438. peg$currPos = cached.nextPos;
  24439. return cached.result;
  24440. }
  24441. s0 = peg$currPos;
  24442. s1 = peg$parsews();
  24443. if (s1 !== peg$FAILED) {
  24444. s2 = peg$parsebinarySelector();
  24445. if (s2 !== peg$FAILED) {
  24446. s3 = peg$parsews();
  24447. if (s3 !== peg$FAILED) {
  24448. s4 = peg$parseidentifier();
  24449. if (s4 !== peg$FAILED) {
  24450. peg$savedPos = s0;
  24451. s1 = peg$c76(s2, s4);
  24452. s0 = s1;
  24453. } else {
  24454. peg$currPos = s0;
  24455. s0 = peg$FAILED;
  24456. }
  24457. } else {
  24458. peg$currPos = s0;
  24459. s0 = peg$FAILED;
  24460. }
  24461. } else {
  24462. peg$currPos = s0;
  24463. s0 = peg$FAILED;
  24464. }
  24465. } else {
  24466. peg$currPos = s0;
  24467. s0 = peg$FAILED;
  24468. }
  24469. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24470. return s0;
  24471. }
  24472. function peg$parsewsUnaryPattern() {
  24473. var s0, s1, s2;
  24474. var key = peg$currPos * 67 + 34,
  24475. cached = peg$resultsCache[key];
  24476. if (cached) {
  24477. peg$currPos = cached.nextPos;
  24478. return cached.result;
  24479. }
  24480. s0 = peg$currPos;
  24481. s1 = peg$parsews();
  24482. if (s1 !== peg$FAILED) {
  24483. s2 = peg$parseidentifier();
  24484. if (s2 !== peg$FAILED) {
  24485. peg$savedPos = s0;
  24486. s1 = peg$c77(s2);
  24487. s0 = s1;
  24488. } else {
  24489. peg$currPos = s0;
  24490. s0 = peg$FAILED;
  24491. }
  24492. } else {
  24493. peg$currPos = s0;
  24494. s0 = peg$FAILED;
  24495. }
  24496. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24497. return s0;
  24498. }
  24499. function peg$parseexpression() {
  24500. var s0;
  24501. var key = peg$currPos * 67 + 35,
  24502. cached = peg$resultsCache[key];
  24503. if (cached) {
  24504. peg$currPos = cached.nextPos;
  24505. return cached.result;
  24506. }
  24507. s0 = peg$parseassignment();
  24508. if (s0 === peg$FAILED) {
  24509. s0 = peg$parsecascade();
  24510. if (s0 === peg$FAILED) {
  24511. s0 = peg$parsekeywordSend();
  24512. }
  24513. }
  24514. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24515. return s0;
  24516. }
  24517. function peg$parsewsExpressionsRest() {
  24518. var s0, s1, s2;
  24519. var key = peg$currPos * 67 + 36,
  24520. cached = peg$resultsCache[key];
  24521. if (cached) {
  24522. peg$currPos = cached.nextPos;
  24523. return cached.result;
  24524. }
  24525. s0 = peg$currPos;
  24526. s1 = peg$parsesomeDotsWs();
  24527. if (s1 !== peg$FAILED) {
  24528. s2 = peg$parseexpression();
  24529. if (s2 !== peg$FAILED) {
  24530. peg$savedPos = s0;
  24531. s1 = peg$c78(s2);
  24532. s0 = s1;
  24533. } else {
  24534. peg$currPos = s0;
  24535. s0 = peg$FAILED;
  24536. }
  24537. } else {
  24538. peg$currPos = s0;
  24539. s0 = peg$FAILED;
  24540. }
  24541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24542. return s0;
  24543. }
  24544. function peg$parsewsExpressions() {
  24545. var s0, s1, s2, s3, s4;
  24546. var key = peg$currPos * 67 + 37,
  24547. cached = peg$resultsCache[key];
  24548. if (cached) {
  24549. peg$currPos = cached.nextPos;
  24550. return cached.result;
  24551. }
  24552. s0 = peg$currPos;
  24553. s1 = peg$parsemaybeDotsWs();
  24554. if (s1 !== peg$FAILED) {
  24555. s2 = peg$parseexpression();
  24556. if (s2 !== peg$FAILED) {
  24557. s3 = [];
  24558. s4 = peg$parsewsExpressionsRest();
  24559. while (s4 !== peg$FAILED) {
  24560. s3.push(s4);
  24561. s4 = peg$parsewsExpressionsRest();
  24562. }
  24563. if (s3 !== peg$FAILED) {
  24564. peg$savedPos = s0;
  24565. s1 = peg$c79(s2, s3);
  24566. s0 = s1;
  24567. } else {
  24568. peg$currPos = s0;
  24569. s0 = peg$FAILED;
  24570. }
  24571. } else {
  24572. peg$currPos = s0;
  24573. s0 = peg$FAILED;
  24574. }
  24575. } else {
  24576. peg$currPos = s0;
  24577. s0 = peg$FAILED;
  24578. }
  24579. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24580. return s0;
  24581. }
  24582. function peg$parsewsUnaryPragmaMessage() {
  24583. var s0, s1, s2, s3, s4;
  24584. var key = peg$currPos * 67 + 38,
  24585. cached = peg$resultsCache[key];
  24586. if (cached) {
  24587. peg$currPos = cached.nextPos;
  24588. return cached.result;
  24589. }
  24590. s0 = peg$currPos;
  24591. s1 = peg$parsews();
  24592. if (s1 !== peg$FAILED) {
  24593. s2 = peg$parseidentifier();
  24594. if (s2 !== peg$FAILED) {
  24595. s3 = peg$currPos;
  24596. peg$silentFails++;
  24597. if (input.charCodeAt(peg$currPos) === 58) {
  24598. s4 = peg$c12;
  24599. peg$currPos++;
  24600. } else {
  24601. s4 = peg$FAILED;
  24602. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  24603. }
  24604. peg$silentFails--;
  24605. if (s4 === peg$FAILED) {
  24606. s3 = void 0;
  24607. } else {
  24608. peg$currPos = s3;
  24609. s3 = peg$FAILED;
  24610. }
  24611. if (s3 !== peg$FAILED) {
  24612. peg$savedPos = s0;
  24613. s1 = peg$c80(s2);
  24614. s0 = s1;
  24615. } else {
  24616. peg$currPos = s0;
  24617. s0 = peg$FAILED;
  24618. }
  24619. } else {
  24620. peg$currPos = s0;
  24621. s0 = peg$FAILED;
  24622. }
  24623. } else {
  24624. peg$currPos = s0;
  24625. s0 = peg$FAILED;
  24626. }
  24627. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24628. return s0;
  24629. }
  24630. function peg$parsewsKeywordPragmaMessage() {
  24631. var s0, s1, s2, s3, s4, s5, s6;
  24632. var key = peg$currPos * 67 + 39,
  24633. cached = peg$resultsCache[key];
  24634. if (cached) {
  24635. peg$currPos = cached.nextPos;
  24636. return cached.result;
  24637. }
  24638. s0 = peg$currPos;
  24639. s1 = [];
  24640. s2 = peg$currPos;
  24641. s3 = peg$parsews();
  24642. if (s3 !== peg$FAILED) {
  24643. s4 = peg$parsekeyword();
  24644. if (s4 !== peg$FAILED) {
  24645. s5 = peg$parsews();
  24646. if (s5 !== peg$FAILED) {
  24647. s6 = peg$parseparseTimeLiteral();
  24648. if (s6 !== peg$FAILED) {
  24649. peg$savedPos = s2;
  24650. s3 = peg$c74(s4, s6);
  24651. s2 = s3;
  24652. } else {
  24653. peg$currPos = s2;
  24654. s2 = peg$FAILED;
  24655. }
  24656. } else {
  24657. peg$currPos = s2;
  24658. s2 = peg$FAILED;
  24659. }
  24660. } else {
  24661. peg$currPos = s2;
  24662. s2 = peg$FAILED;
  24663. }
  24664. } else {
  24665. peg$currPos = s2;
  24666. s2 = peg$FAILED;
  24667. }
  24668. if (s2 !== peg$FAILED) {
  24669. while (s2 !== peg$FAILED) {
  24670. s1.push(s2);
  24671. s2 = peg$currPos;
  24672. s3 = peg$parsews();
  24673. if (s3 !== peg$FAILED) {
  24674. s4 = peg$parsekeyword();
  24675. if (s4 !== peg$FAILED) {
  24676. s5 = peg$parsews();
  24677. if (s5 !== peg$FAILED) {
  24678. s6 = peg$parseparseTimeLiteral();
  24679. if (s6 !== peg$FAILED) {
  24680. peg$savedPos = s2;
  24681. s3 = peg$c74(s4, s6);
  24682. s2 = s3;
  24683. } else {
  24684. peg$currPos = s2;
  24685. s2 = peg$FAILED;
  24686. }
  24687. } else {
  24688. peg$currPos = s2;
  24689. s2 = peg$FAILED;
  24690. }
  24691. } else {
  24692. peg$currPos = s2;
  24693. s2 = peg$FAILED;
  24694. }
  24695. } else {
  24696. peg$currPos = s2;
  24697. s2 = peg$FAILED;
  24698. }
  24699. }
  24700. } else {
  24701. s1 = peg$FAILED;
  24702. }
  24703. if (s1 !== peg$FAILED) {
  24704. peg$savedPos = s0;
  24705. s1 = peg$c81(s1);
  24706. }
  24707. s0 = s1;
  24708. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24709. return s0;
  24710. }
  24711. function peg$parsewsPragmaMessage() {
  24712. var s0;
  24713. var key = peg$currPos * 67 + 40,
  24714. cached = peg$resultsCache[key];
  24715. if (cached) {
  24716. peg$currPos = cached.nextPos;
  24717. return cached.result;
  24718. }
  24719. s0 = peg$parsewsUnaryPragmaMessage();
  24720. if (s0 === peg$FAILED) {
  24721. s0 = peg$parsewsKeywordPragmaMessage();
  24722. }
  24723. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24724. return s0;
  24725. }
  24726. function peg$parsewsPragmas() {
  24727. var s0, s1, s2, s3, s4, s5, s6;
  24728. var key = peg$currPos * 67 + 41,
  24729. cached = peg$resultsCache[key];
  24730. if (cached) {
  24731. peg$currPos = cached.nextPos;
  24732. return cached.result;
  24733. }
  24734. s0 = [];
  24735. s1 = peg$currPos;
  24736. s2 = peg$parsews();
  24737. if (s2 !== peg$FAILED) {
  24738. if (input.charCodeAt(peg$currPos) === 60) {
  24739. s3 = peg$c82;
  24740. peg$currPos++;
  24741. } else {
  24742. s3 = peg$FAILED;
  24743. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  24744. }
  24745. if (s3 !== peg$FAILED) {
  24746. s4 = peg$parsewsPragmaMessage();
  24747. if (s4 !== peg$FAILED) {
  24748. s5 = peg$parsews();
  24749. if (s5 !== peg$FAILED) {
  24750. if (input.charCodeAt(peg$currPos) === 62) {
  24751. s6 = peg$c84;
  24752. peg$currPos++;
  24753. } else {
  24754. s6 = peg$FAILED;
  24755. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  24756. }
  24757. if (s6 !== peg$FAILED) {
  24758. peg$savedPos = s1;
  24759. s2 = peg$c86(s4);
  24760. s1 = s2;
  24761. } else {
  24762. peg$currPos = s1;
  24763. s1 = peg$FAILED;
  24764. }
  24765. } else {
  24766. peg$currPos = s1;
  24767. s1 = peg$FAILED;
  24768. }
  24769. } else {
  24770. peg$currPos = s1;
  24771. s1 = peg$FAILED;
  24772. }
  24773. } else {
  24774. peg$currPos = s1;
  24775. s1 = peg$FAILED;
  24776. }
  24777. } else {
  24778. peg$currPos = s1;
  24779. s1 = peg$FAILED;
  24780. }
  24781. while (s1 !== peg$FAILED) {
  24782. s0.push(s1);
  24783. s1 = peg$currPos;
  24784. s2 = peg$parsews();
  24785. if (s2 !== peg$FAILED) {
  24786. if (input.charCodeAt(peg$currPos) === 60) {
  24787. s3 = peg$c82;
  24788. peg$currPos++;
  24789. } else {
  24790. s3 = peg$FAILED;
  24791. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  24792. }
  24793. if (s3 !== peg$FAILED) {
  24794. s4 = peg$parsewsPragmaMessage();
  24795. if (s4 !== peg$FAILED) {
  24796. s5 = peg$parsews();
  24797. if (s5 !== peg$FAILED) {
  24798. if (input.charCodeAt(peg$currPos) === 62) {
  24799. s6 = peg$c84;
  24800. peg$currPos++;
  24801. } else {
  24802. s6 = peg$FAILED;
  24803. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  24804. }
  24805. if (s6 !== peg$FAILED) {
  24806. peg$savedPos = s1;
  24807. s2 = peg$c86(s4);
  24808. s1 = s2;
  24809. } else {
  24810. peg$currPos = s1;
  24811. s1 = peg$FAILED;
  24812. }
  24813. } else {
  24814. peg$currPos = s1;
  24815. s1 = peg$FAILED;
  24816. }
  24817. } else {
  24818. peg$currPos = s1;
  24819. s1 = peg$FAILED;
  24820. }
  24821. } else {
  24822. peg$currPos = s1;
  24823. s1 = peg$FAILED;
  24824. }
  24825. } else {
  24826. peg$currPos = s1;
  24827. s1 = peg$FAILED;
  24828. }
  24829. }
  24830. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24831. return s0;
  24832. }
  24833. function peg$parseassignment() {
  24834. var s0, s1, s2, s3, s4, s5;
  24835. var key = peg$currPos * 67 + 42,
  24836. cached = peg$resultsCache[key];
  24837. if (cached) {
  24838. peg$currPos = cached.nextPos;
  24839. return cached.result;
  24840. }
  24841. s0 = peg$currPos;
  24842. s1 = peg$parsevariable();
  24843. if (s1 !== peg$FAILED) {
  24844. s2 = peg$parsews();
  24845. if (s2 !== peg$FAILED) {
  24846. if (input.substr(peg$currPos, 2) === peg$c87) {
  24847. s3 = peg$c87;
  24848. peg$currPos += 2;
  24849. } else {
  24850. s3 = peg$FAILED;
  24851. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  24852. }
  24853. if (s3 !== peg$FAILED) {
  24854. s4 = peg$parsews();
  24855. if (s4 !== peg$FAILED) {
  24856. s5 = peg$parseexpression();
  24857. if (s5 !== peg$FAILED) {
  24858. peg$savedPos = s0;
  24859. s1 = peg$c89(s1, s5);
  24860. s0 = s1;
  24861. } else {
  24862. peg$currPos = s0;
  24863. s0 = peg$FAILED;
  24864. }
  24865. } else {
  24866. peg$currPos = s0;
  24867. s0 = peg$FAILED;
  24868. }
  24869. } else {
  24870. peg$currPos = s0;
  24871. s0 = peg$FAILED;
  24872. }
  24873. } else {
  24874. peg$currPos = s0;
  24875. s0 = peg$FAILED;
  24876. }
  24877. } else {
  24878. peg$currPos = s0;
  24879. s0 = peg$FAILED;
  24880. }
  24881. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24882. return s0;
  24883. }
  24884. function peg$parseret() {
  24885. var s0, s1, s2, s3;
  24886. var key = peg$currPos * 67 + 43,
  24887. cached = peg$resultsCache[key];
  24888. if (cached) {
  24889. peg$currPos = cached.nextPos;
  24890. return cached.result;
  24891. }
  24892. s0 = peg$currPos;
  24893. if (input.charCodeAt(peg$currPos) === 94) {
  24894. s1 = peg$c90;
  24895. peg$currPos++;
  24896. } else {
  24897. s1 = peg$FAILED;
  24898. if (peg$silentFails === 0) { peg$fail(peg$c91); }
  24899. }
  24900. if (s1 !== peg$FAILED) {
  24901. s2 = peg$parsews();
  24902. if (s2 !== peg$FAILED) {
  24903. s3 = peg$parseexpression();
  24904. if (s3 !== peg$FAILED) {
  24905. peg$savedPos = s0;
  24906. s1 = peg$c92(s3);
  24907. s0 = s1;
  24908. } else {
  24909. peg$currPos = s0;
  24910. s0 = peg$FAILED;
  24911. }
  24912. } else {
  24913. peg$currPos = s0;
  24914. s0 = peg$FAILED;
  24915. }
  24916. } else {
  24917. peg$currPos = s0;
  24918. s0 = peg$FAILED;
  24919. }
  24920. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24921. return s0;
  24922. }
  24923. function peg$parsetemps() {
  24924. var s0, s1, s2, s3, s4, s5;
  24925. var key = peg$currPos * 67 + 44,
  24926. cached = peg$resultsCache[key];
  24927. if (cached) {
  24928. peg$currPos = cached.nextPos;
  24929. return cached.result;
  24930. }
  24931. s0 = peg$currPos;
  24932. if (input.charCodeAt(peg$currPos) === 124) {
  24933. s1 = peg$c93;
  24934. peg$currPos++;
  24935. } else {
  24936. s1 = peg$FAILED;
  24937. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  24938. }
  24939. if (s1 !== peg$FAILED) {
  24940. s2 = [];
  24941. s3 = peg$currPos;
  24942. s4 = peg$parsews();
  24943. if (s4 !== peg$FAILED) {
  24944. s5 = peg$parseidentifier();
  24945. if (s5 !== peg$FAILED) {
  24946. peg$savedPos = s3;
  24947. s4 = peg$c95(s5);
  24948. s3 = s4;
  24949. } else {
  24950. peg$currPos = s3;
  24951. s3 = peg$FAILED;
  24952. }
  24953. } else {
  24954. peg$currPos = s3;
  24955. s3 = peg$FAILED;
  24956. }
  24957. while (s3 !== peg$FAILED) {
  24958. s2.push(s3);
  24959. s3 = peg$currPos;
  24960. s4 = peg$parsews();
  24961. if (s4 !== peg$FAILED) {
  24962. s5 = peg$parseidentifier();
  24963. if (s5 !== peg$FAILED) {
  24964. peg$savedPos = s3;
  24965. s4 = peg$c95(s5);
  24966. s3 = s4;
  24967. } else {
  24968. peg$currPos = s3;
  24969. s3 = peg$FAILED;
  24970. }
  24971. } else {
  24972. peg$currPos = s3;
  24973. s3 = peg$FAILED;
  24974. }
  24975. }
  24976. if (s2 !== peg$FAILED) {
  24977. s3 = peg$parsews();
  24978. if (s3 !== peg$FAILED) {
  24979. if (input.charCodeAt(peg$currPos) === 124) {
  24980. s4 = peg$c93;
  24981. peg$currPos++;
  24982. } else {
  24983. s4 = peg$FAILED;
  24984. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  24985. }
  24986. if (s4 !== peg$FAILED) {
  24987. peg$savedPos = s0;
  24988. s1 = peg$c96(s2);
  24989. s0 = s1;
  24990. } else {
  24991. peg$currPos = s0;
  24992. s0 = peg$FAILED;
  24993. }
  24994. } else {
  24995. peg$currPos = s0;
  24996. s0 = peg$FAILED;
  24997. }
  24998. } else {
  24999. peg$currPos = s0;
  25000. s0 = peg$FAILED;
  25001. }
  25002. } else {
  25003. peg$currPos = s0;
  25004. s0 = peg$FAILED;
  25005. }
  25006. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25007. return s0;
  25008. }
  25009. function peg$parsewsBlockParamList() {
  25010. var s0, s1, s2, s3, s4, s5, s6;
  25011. var key = peg$currPos * 67 + 45,
  25012. cached = peg$resultsCache[key];
  25013. if (cached) {
  25014. peg$currPos = cached.nextPos;
  25015. return cached.result;
  25016. }
  25017. s0 = peg$currPos;
  25018. s1 = [];
  25019. s2 = peg$currPos;
  25020. s3 = peg$parsews();
  25021. if (s3 !== peg$FAILED) {
  25022. if (input.charCodeAt(peg$currPos) === 58) {
  25023. s4 = peg$c12;
  25024. peg$currPos++;
  25025. } else {
  25026. s4 = peg$FAILED;
  25027. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25028. }
  25029. if (s4 !== peg$FAILED) {
  25030. s5 = peg$parsews();
  25031. if (s5 !== peg$FAILED) {
  25032. s6 = peg$parseidentifier();
  25033. if (s6 !== peg$FAILED) {
  25034. peg$savedPos = s2;
  25035. s3 = peg$c97(s6);
  25036. s2 = s3;
  25037. } else {
  25038. peg$currPos = s2;
  25039. s2 = peg$FAILED;
  25040. }
  25041. } else {
  25042. peg$currPos = s2;
  25043. s2 = peg$FAILED;
  25044. }
  25045. } else {
  25046. peg$currPos = s2;
  25047. s2 = peg$FAILED;
  25048. }
  25049. } else {
  25050. peg$currPos = s2;
  25051. s2 = peg$FAILED;
  25052. }
  25053. if (s2 !== peg$FAILED) {
  25054. while (s2 !== peg$FAILED) {
  25055. s1.push(s2);
  25056. s2 = peg$currPos;
  25057. s3 = peg$parsews();
  25058. if (s3 !== peg$FAILED) {
  25059. if (input.charCodeAt(peg$currPos) === 58) {
  25060. s4 = peg$c12;
  25061. peg$currPos++;
  25062. } else {
  25063. s4 = peg$FAILED;
  25064. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25065. }
  25066. if (s4 !== peg$FAILED) {
  25067. s5 = peg$parsews();
  25068. if (s5 !== peg$FAILED) {
  25069. s6 = peg$parseidentifier();
  25070. if (s6 !== peg$FAILED) {
  25071. peg$savedPos = s2;
  25072. s3 = peg$c97(s6);
  25073. s2 = s3;
  25074. } else {
  25075. peg$currPos = s2;
  25076. s2 = peg$FAILED;
  25077. }
  25078. } else {
  25079. peg$currPos = s2;
  25080. s2 = peg$FAILED;
  25081. }
  25082. } else {
  25083. peg$currPos = s2;
  25084. s2 = peg$FAILED;
  25085. }
  25086. } else {
  25087. peg$currPos = s2;
  25088. s2 = peg$FAILED;
  25089. }
  25090. }
  25091. } else {
  25092. s1 = peg$FAILED;
  25093. }
  25094. if (s1 !== peg$FAILED) {
  25095. s2 = peg$parsews();
  25096. if (s2 !== peg$FAILED) {
  25097. if (input.charCodeAt(peg$currPos) === 124) {
  25098. s3 = peg$c93;
  25099. peg$currPos++;
  25100. } else {
  25101. s3 = peg$FAILED;
  25102. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  25103. }
  25104. if (s3 !== peg$FAILED) {
  25105. peg$savedPos = s0;
  25106. s1 = peg$c98(s1);
  25107. s0 = s1;
  25108. } else {
  25109. peg$currPos = s0;
  25110. s0 = peg$FAILED;
  25111. }
  25112. } else {
  25113. peg$currPos = s0;
  25114. s0 = peg$FAILED;
  25115. }
  25116. } else {
  25117. peg$currPos = s0;
  25118. s0 = peg$FAILED;
  25119. }
  25120. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25121. return s0;
  25122. }
  25123. function peg$parsesubexpression() {
  25124. var s0, s1, s2, s3, s4, s5;
  25125. var key = peg$currPos * 67 + 46,
  25126. cached = peg$resultsCache[key];
  25127. if (cached) {
  25128. peg$currPos = cached.nextPos;
  25129. return cached.result;
  25130. }
  25131. s0 = peg$currPos;
  25132. if (input.charCodeAt(peg$currPos) === 40) {
  25133. s1 = peg$c51;
  25134. peg$currPos++;
  25135. } else {
  25136. s1 = peg$FAILED;
  25137. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25138. }
  25139. if (s1 !== peg$FAILED) {
  25140. s2 = peg$parsews();
  25141. if (s2 !== peg$FAILED) {
  25142. s3 = peg$parseexpression();
  25143. if (s3 !== peg$FAILED) {
  25144. s4 = peg$parsews();
  25145. if (s4 !== peg$FAILED) {
  25146. if (input.charCodeAt(peg$currPos) === 41) {
  25147. s5 = peg$c48;
  25148. peg$currPos++;
  25149. } else {
  25150. s5 = peg$FAILED;
  25151. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25152. }
  25153. if (s5 !== peg$FAILED) {
  25154. peg$savedPos = s0;
  25155. s1 = peg$c78(s3);
  25156. s0 = s1;
  25157. } else {
  25158. peg$currPos = s0;
  25159. s0 = peg$FAILED;
  25160. }
  25161. } else {
  25162. peg$currPos = s0;
  25163. s0 = peg$FAILED;
  25164. }
  25165. } else {
  25166. peg$currPos = s0;
  25167. s0 = peg$FAILED;
  25168. }
  25169. } else {
  25170. peg$currPos = s0;
  25171. s0 = peg$FAILED;
  25172. }
  25173. } else {
  25174. peg$currPos = s0;
  25175. s0 = peg$FAILED;
  25176. }
  25177. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25178. return s0;
  25179. }
  25180. function peg$parsewsStatements() {
  25181. var s0, s1, s2, s3;
  25182. var key = peg$currPos * 67 + 47,
  25183. cached = peg$resultsCache[key];
  25184. if (cached) {
  25185. peg$currPos = cached.nextPos;
  25186. return cached.result;
  25187. }
  25188. s0 = peg$currPos;
  25189. s1 = peg$parsemaybeDotsWs();
  25190. if (s1 !== peg$FAILED) {
  25191. s2 = peg$parseret();
  25192. if (s2 !== peg$FAILED) {
  25193. peg$savedPos = s0;
  25194. s1 = peg$c99(s2);
  25195. s0 = s1;
  25196. } else {
  25197. peg$currPos = s0;
  25198. s0 = peg$FAILED;
  25199. }
  25200. } else {
  25201. peg$currPos = s0;
  25202. s0 = peg$FAILED;
  25203. }
  25204. if (s0 === peg$FAILED) {
  25205. s0 = peg$currPos;
  25206. s1 = peg$parsewsExpressions();
  25207. if (s1 !== peg$FAILED) {
  25208. s2 = peg$parsesomeDotsWs();
  25209. if (s2 !== peg$FAILED) {
  25210. s3 = peg$parseret();
  25211. if (s3 !== peg$FAILED) {
  25212. peg$savedPos = s0;
  25213. s1 = peg$c100(s1, s3);
  25214. s0 = s1;
  25215. } else {
  25216. peg$currPos = s0;
  25217. s0 = peg$FAILED;
  25218. }
  25219. } else {
  25220. peg$currPos = s0;
  25221. s0 = peg$FAILED;
  25222. }
  25223. } else {
  25224. peg$currPos = s0;
  25225. s0 = peg$FAILED;
  25226. }
  25227. if (s0 === peg$FAILED) {
  25228. s0 = peg$currPos;
  25229. s1 = peg$parsewsExpressions();
  25230. if (s1 === peg$FAILED) {
  25231. s1 = null;
  25232. }
  25233. if (s1 !== peg$FAILED) {
  25234. peg$savedPos = s0;
  25235. s1 = peg$c101(s1);
  25236. }
  25237. s0 = s1;
  25238. }
  25239. }
  25240. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25241. return s0;
  25242. }
  25243. function peg$parsewsSequenceWs() {
  25244. var s0, s1, s2, s3, s4, s5, s6;
  25245. var key = peg$currPos * 67 + 48,
  25246. cached = peg$resultsCache[key];
  25247. if (cached) {
  25248. peg$currPos = cached.nextPos;
  25249. return cached.result;
  25250. }
  25251. s0 = peg$currPos;
  25252. s1 = peg$parsewsPragmas();
  25253. if (s1 === peg$FAILED) {
  25254. s1 = null;
  25255. }
  25256. if (s1 !== peg$FAILED) {
  25257. s2 = peg$parsews();
  25258. if (s2 !== peg$FAILED) {
  25259. s3 = peg$parsetemps();
  25260. if (s3 === peg$FAILED) {
  25261. s3 = null;
  25262. }
  25263. if (s3 !== peg$FAILED) {
  25264. s4 = peg$parsewsPragmas();
  25265. if (s4 === peg$FAILED) {
  25266. s4 = null;
  25267. }
  25268. if (s4 !== peg$FAILED) {
  25269. s5 = peg$parsewsStatements();
  25270. if (s5 === peg$FAILED) {
  25271. s5 = null;
  25272. }
  25273. if (s5 !== peg$FAILED) {
  25274. s6 = peg$parsemaybeDotsWs();
  25275. if (s6 !== peg$FAILED) {
  25276. peg$savedPos = s0;
  25277. s1 = peg$c102(s1, s3, s4, s5);
  25278. s0 = s1;
  25279. } else {
  25280. peg$currPos = s0;
  25281. s0 = peg$FAILED;
  25282. }
  25283. } else {
  25284. peg$currPos = s0;
  25285. s0 = peg$FAILED;
  25286. }
  25287. } else {
  25288. peg$currPos = s0;
  25289. s0 = peg$FAILED;
  25290. }
  25291. } else {
  25292. peg$currPos = s0;
  25293. s0 = peg$FAILED;
  25294. }
  25295. } else {
  25296. peg$currPos = s0;
  25297. s0 = peg$FAILED;
  25298. }
  25299. } else {
  25300. peg$currPos = s0;
  25301. s0 = peg$FAILED;
  25302. }
  25303. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25304. return s0;
  25305. }
  25306. function peg$parsewsBlockSequenceWs() {
  25307. var s0, s1, s2, s3, s4;
  25308. var key = peg$currPos * 67 + 49,
  25309. cached = peg$resultsCache[key];
  25310. if (cached) {
  25311. peg$currPos = cached.nextPos;
  25312. return cached.result;
  25313. }
  25314. s0 = peg$currPos;
  25315. s1 = peg$parsews();
  25316. if (s1 !== peg$FAILED) {
  25317. s2 = peg$parsetemps();
  25318. if (s2 === peg$FAILED) {
  25319. s2 = null;
  25320. }
  25321. if (s2 !== peg$FAILED) {
  25322. s3 = peg$parsewsStatements();
  25323. if (s3 === peg$FAILED) {
  25324. s3 = null;
  25325. }
  25326. if (s3 !== peg$FAILED) {
  25327. s4 = peg$parsemaybeDotsWs();
  25328. if (s4 !== peg$FAILED) {
  25329. peg$savedPos = s0;
  25330. s1 = peg$c103(s2, s3);
  25331. s0 = s1;
  25332. } else {
  25333. peg$currPos = s0;
  25334. s0 = peg$FAILED;
  25335. }
  25336. } else {
  25337. peg$currPos = s0;
  25338. s0 = peg$FAILED;
  25339. }
  25340. } else {
  25341. peg$currPos = s0;
  25342. s0 = peg$FAILED;
  25343. }
  25344. } else {
  25345. peg$currPos = s0;
  25346. s0 = peg$FAILED;
  25347. }
  25348. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25349. return s0;
  25350. }
  25351. function peg$parseblock() {
  25352. var s0, s1, s2, s3, s4;
  25353. var key = peg$currPos * 67 + 50,
  25354. cached = peg$resultsCache[key];
  25355. if (cached) {
  25356. peg$currPos = cached.nextPos;
  25357. return cached.result;
  25358. }
  25359. s0 = peg$currPos;
  25360. if (input.charCodeAt(peg$currPos) === 91) {
  25361. s1 = peg$c104;
  25362. peg$currPos++;
  25363. } else {
  25364. s1 = peg$FAILED;
  25365. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  25366. }
  25367. if (s1 !== peg$FAILED) {
  25368. s2 = peg$parsewsBlockParamList();
  25369. if (s2 === peg$FAILED) {
  25370. s2 = null;
  25371. }
  25372. if (s2 !== peg$FAILED) {
  25373. s3 = peg$parsewsBlockSequenceWs();
  25374. if (s3 !== peg$FAILED) {
  25375. if (input.charCodeAt(peg$currPos) === 93) {
  25376. s4 = peg$c106;
  25377. peg$currPos++;
  25378. } else {
  25379. s4 = peg$FAILED;
  25380. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  25381. }
  25382. if (s4 !== peg$FAILED) {
  25383. peg$savedPos = s0;
  25384. s1 = peg$c108(s2, s3);
  25385. s0 = s1;
  25386. } else {
  25387. peg$currPos = s0;
  25388. s0 = peg$FAILED;
  25389. }
  25390. } else {
  25391. peg$currPos = s0;
  25392. s0 = peg$FAILED;
  25393. }
  25394. } else {
  25395. peg$currPos = s0;
  25396. s0 = peg$FAILED;
  25397. }
  25398. } else {
  25399. peg$currPos = s0;
  25400. s0 = peg$FAILED;
  25401. }
  25402. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25403. return s0;
  25404. }
  25405. function peg$parseoperand() {
  25406. var s0;
  25407. var key = peg$currPos * 67 + 51,
  25408. cached = peg$resultsCache[key];
  25409. if (cached) {
  25410. peg$currPos = cached.nextPos;
  25411. return cached.result;
  25412. }
  25413. s0 = peg$parseliteral();
  25414. if (s0 === peg$FAILED) {
  25415. s0 = peg$parsevariable();
  25416. if (s0 === peg$FAILED) {
  25417. s0 = peg$parsesubexpression();
  25418. }
  25419. }
  25420. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25421. return s0;
  25422. }
  25423. function peg$parsewsUnaryMessage() {
  25424. var s0, s1, s2, s3, s4;
  25425. var key = peg$currPos * 67 + 52,
  25426. cached = peg$resultsCache[key];
  25427. if (cached) {
  25428. peg$currPos = cached.nextPos;
  25429. return cached.result;
  25430. }
  25431. s0 = peg$currPos;
  25432. s1 = peg$parsews();
  25433. if (s1 !== peg$FAILED) {
  25434. s2 = peg$parseidentifier();
  25435. if (s2 !== peg$FAILED) {
  25436. s3 = peg$currPos;
  25437. peg$silentFails++;
  25438. if (input.charCodeAt(peg$currPos) === 58) {
  25439. s4 = peg$c12;
  25440. peg$currPos++;
  25441. } else {
  25442. s4 = peg$FAILED;
  25443. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  25444. }
  25445. peg$silentFails--;
  25446. if (s4 === peg$FAILED) {
  25447. s3 = void 0;
  25448. } else {
  25449. peg$currPos = s3;
  25450. s3 = peg$FAILED;
  25451. }
  25452. if (s3 !== peg$FAILED) {
  25453. peg$savedPos = s0;
  25454. s1 = peg$c109(s2);
  25455. s0 = s1;
  25456. } else {
  25457. peg$currPos = s0;
  25458. s0 = peg$FAILED;
  25459. }
  25460. } else {
  25461. peg$currPos = s0;
  25462. s0 = peg$FAILED;
  25463. }
  25464. } else {
  25465. peg$currPos = s0;
  25466. s0 = peg$FAILED;
  25467. }
  25468. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25469. return s0;
  25470. }
  25471. function peg$parsewsUnaryTail() {
  25472. var s0, s1;
  25473. var key = peg$currPos * 67 + 53,
  25474. cached = peg$resultsCache[key];
  25475. if (cached) {
  25476. peg$currPos = cached.nextPos;
  25477. return cached.result;
  25478. }
  25479. s0 = [];
  25480. s1 = peg$parsewsUnaryMessage();
  25481. while (s1 !== peg$FAILED) {
  25482. s0.push(s1);
  25483. s1 = peg$parsewsUnaryMessage();
  25484. }
  25485. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25486. return s0;
  25487. }
  25488. function peg$parseunarySend() {
  25489. var s0, s1, s2;
  25490. var key = peg$currPos * 67 + 54,
  25491. cached = peg$resultsCache[key];
  25492. if (cached) {
  25493. peg$currPos = cached.nextPos;
  25494. return cached.result;
  25495. }
  25496. s0 = peg$currPos;
  25497. s1 = peg$parseoperand();
  25498. if (s1 !== peg$FAILED) {
  25499. s2 = peg$parsewsUnaryTail();
  25500. if (s2 !== peg$FAILED) {
  25501. peg$savedPos = s0;
  25502. s1 = peg$c110(s1, s2);
  25503. s0 = s1;
  25504. } else {
  25505. peg$currPos = s0;
  25506. s0 = peg$FAILED;
  25507. }
  25508. } else {
  25509. peg$currPos = s0;
  25510. s0 = peg$FAILED;
  25511. }
  25512. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25513. return s0;
  25514. }
  25515. function peg$parsewsBinaryMessage() {
  25516. var s0, s1, s2, s3, s4;
  25517. var key = peg$currPos * 67 + 55,
  25518. cached = peg$resultsCache[key];
  25519. if (cached) {
  25520. peg$currPos = cached.nextPos;
  25521. return cached.result;
  25522. }
  25523. s0 = peg$currPos;
  25524. s1 = peg$parsews();
  25525. if (s1 !== peg$FAILED) {
  25526. s2 = peg$parsebinarySelector();
  25527. if (s2 !== peg$FAILED) {
  25528. s3 = peg$parsews();
  25529. if (s3 !== peg$FAILED) {
  25530. s4 = peg$parseunarySend();
  25531. if (s4 !== peg$FAILED) {
  25532. peg$savedPos = s0;
  25533. s1 = peg$c111(s2, s4);
  25534. s0 = s1;
  25535. } else {
  25536. peg$currPos = s0;
  25537. s0 = peg$FAILED;
  25538. }
  25539. } else {
  25540. peg$currPos = s0;
  25541. s0 = peg$FAILED;
  25542. }
  25543. } else {
  25544. peg$currPos = s0;
  25545. s0 = peg$FAILED;
  25546. }
  25547. } else {
  25548. peg$currPos = s0;
  25549. s0 = peg$FAILED;
  25550. }
  25551. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25552. return s0;
  25553. }
  25554. function peg$parsewsBinaryTail() {
  25555. var s0, s1, s2, s3;
  25556. var key = peg$currPos * 67 + 56,
  25557. cached = peg$resultsCache[key];
  25558. if (cached) {
  25559. peg$currPos = cached.nextPos;
  25560. return cached.result;
  25561. }
  25562. s0 = peg$currPos;
  25563. s1 = peg$parsewsUnaryTail();
  25564. if (s1 !== peg$FAILED) {
  25565. s2 = [];
  25566. s3 = peg$parsewsBinaryMessage();
  25567. while (s3 !== peg$FAILED) {
  25568. s2.push(s3);
  25569. s3 = peg$parsewsBinaryMessage();
  25570. }
  25571. if (s2 !== peg$FAILED) {
  25572. peg$savedPos = s0;
  25573. s1 = peg$c112(s1, s2);
  25574. s0 = s1;
  25575. } else {
  25576. peg$currPos = s0;
  25577. s0 = peg$FAILED;
  25578. }
  25579. } else {
  25580. peg$currPos = s0;
  25581. s0 = peg$FAILED;
  25582. }
  25583. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25584. return s0;
  25585. }
  25586. function peg$parsebinarySend() {
  25587. var s0, s1, s2;
  25588. var key = peg$currPos * 67 + 57,
  25589. cached = peg$resultsCache[key];
  25590. if (cached) {
  25591. peg$currPos = cached.nextPos;
  25592. return cached.result;
  25593. }
  25594. s0 = peg$currPos;
  25595. s1 = peg$parseoperand();
  25596. if (s1 !== peg$FAILED) {
  25597. s2 = peg$parsewsBinaryTail();
  25598. if (s2 !== peg$FAILED) {
  25599. peg$savedPos = s0;
  25600. s1 = peg$c110(s1, s2);
  25601. s0 = s1;
  25602. } else {
  25603. peg$currPos = s0;
  25604. s0 = peg$FAILED;
  25605. }
  25606. } else {
  25607. peg$currPos = s0;
  25608. s0 = peg$FAILED;
  25609. }
  25610. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25611. return s0;
  25612. }
  25613. function peg$parsewsKeywordMessage() {
  25614. var s0, s1, s2, s3, s4, s5, s6;
  25615. var key = peg$currPos * 67 + 58,
  25616. cached = peg$resultsCache[key];
  25617. if (cached) {
  25618. peg$currPos = cached.nextPos;
  25619. return cached.result;
  25620. }
  25621. s0 = peg$currPos;
  25622. s1 = [];
  25623. s2 = peg$currPos;
  25624. s3 = peg$parsews();
  25625. if (s3 !== peg$FAILED) {
  25626. s4 = peg$parsekeyword();
  25627. if (s4 !== peg$FAILED) {
  25628. s5 = peg$parsews();
  25629. if (s5 !== peg$FAILED) {
  25630. s6 = peg$parsebinarySend();
  25631. if (s6 !== peg$FAILED) {
  25632. peg$savedPos = s2;
  25633. s3 = peg$c74(s4, s6);
  25634. s2 = s3;
  25635. } else {
  25636. peg$currPos = s2;
  25637. s2 = peg$FAILED;
  25638. }
  25639. } else {
  25640. peg$currPos = s2;
  25641. s2 = peg$FAILED;
  25642. }
  25643. } else {
  25644. peg$currPos = s2;
  25645. s2 = peg$FAILED;
  25646. }
  25647. } else {
  25648. peg$currPos = s2;
  25649. s2 = peg$FAILED;
  25650. }
  25651. if (s2 !== peg$FAILED) {
  25652. while (s2 !== peg$FAILED) {
  25653. s1.push(s2);
  25654. s2 = peg$currPos;
  25655. s3 = peg$parsews();
  25656. if (s3 !== peg$FAILED) {
  25657. s4 = peg$parsekeyword();
  25658. if (s4 !== peg$FAILED) {
  25659. s5 = peg$parsews();
  25660. if (s5 !== peg$FAILED) {
  25661. s6 = peg$parsebinarySend();
  25662. if (s6 !== peg$FAILED) {
  25663. peg$savedPos = s2;
  25664. s3 = peg$c74(s4, s6);
  25665. s2 = s3;
  25666. } else {
  25667. peg$currPos = s2;
  25668. s2 = peg$FAILED;
  25669. }
  25670. } else {
  25671. peg$currPos = s2;
  25672. s2 = peg$FAILED;
  25673. }
  25674. } else {
  25675. peg$currPos = s2;
  25676. s2 = peg$FAILED;
  25677. }
  25678. } else {
  25679. peg$currPos = s2;
  25680. s2 = peg$FAILED;
  25681. }
  25682. }
  25683. } else {
  25684. s1 = peg$FAILED;
  25685. }
  25686. if (s1 !== peg$FAILED) {
  25687. peg$savedPos = s0;
  25688. s1 = peg$c113(s1);
  25689. }
  25690. s0 = s1;
  25691. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25692. return s0;
  25693. }
  25694. function peg$parsewsKeywordTail() {
  25695. var s0, s1, s2;
  25696. var key = peg$currPos * 67 + 59,
  25697. cached = peg$resultsCache[key];
  25698. if (cached) {
  25699. peg$currPos = cached.nextPos;
  25700. return cached.result;
  25701. }
  25702. s0 = peg$currPos;
  25703. s1 = peg$parsewsBinaryTail();
  25704. if (s1 !== peg$FAILED) {
  25705. s2 = peg$parsewsKeywordMessage();
  25706. if (s2 === peg$FAILED) {
  25707. s2 = null;
  25708. }
  25709. if (s2 !== peg$FAILED) {
  25710. peg$savedPos = s0;
  25711. s1 = peg$c114(s1, s2);
  25712. s0 = s1;
  25713. } else {
  25714. peg$currPos = s0;
  25715. s0 = peg$FAILED;
  25716. }
  25717. } else {
  25718. peg$currPos = s0;
  25719. s0 = peg$FAILED;
  25720. }
  25721. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25722. return s0;
  25723. }
  25724. function peg$parsekeywordSend() {
  25725. var s0, s1, s2;
  25726. var key = peg$currPos * 67 + 60,
  25727. cached = peg$resultsCache[key];
  25728. if (cached) {
  25729. peg$currPos = cached.nextPos;
  25730. return cached.result;
  25731. }
  25732. s0 = peg$currPos;
  25733. s1 = peg$parseoperand();
  25734. if (s1 !== peg$FAILED) {
  25735. s2 = peg$parsewsKeywordTail();
  25736. if (s2 !== peg$FAILED) {
  25737. peg$savedPos = s0;
  25738. s1 = peg$c110(s1, s2);
  25739. s0 = s1;
  25740. } else {
  25741. peg$currPos = s0;
  25742. s0 = peg$FAILED;
  25743. }
  25744. } else {
  25745. peg$currPos = s0;
  25746. s0 = peg$FAILED;
  25747. }
  25748. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25749. return s0;
  25750. }
  25751. function peg$parsewsMessage() {
  25752. var s0;
  25753. var key = peg$currPos * 67 + 61,
  25754. cached = peg$resultsCache[key];
  25755. if (cached) {
  25756. peg$currPos = cached.nextPos;
  25757. return cached.result;
  25758. }
  25759. s0 = peg$parsewsBinaryMessage();
  25760. if (s0 === peg$FAILED) {
  25761. s0 = peg$parsewsUnaryMessage();
  25762. if (s0 === peg$FAILED) {
  25763. s0 = peg$parsewsKeywordMessage();
  25764. }
  25765. }
  25766. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25767. return s0;
  25768. }
  25769. function peg$parsecascade() {
  25770. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  25771. var key = peg$currPos * 67 + 62,
  25772. cached = peg$resultsCache[key];
  25773. if (cached) {
  25774. peg$currPos = cached.nextPos;
  25775. return cached.result;
  25776. }
  25777. s0 = peg$currPos;
  25778. s1 = peg$parseoperand();
  25779. if (s1 !== peg$FAILED) {
  25780. s2 = peg$parsewsKeywordTail();
  25781. if (s2 !== peg$FAILED) {
  25782. peg$savedPos = peg$currPos;
  25783. s3 = peg$c115(s1, s2);
  25784. if (s3) {
  25785. s3 = void 0;
  25786. } else {
  25787. s3 = peg$FAILED;
  25788. }
  25789. if (s3 !== peg$FAILED) {
  25790. s4 = [];
  25791. s5 = peg$currPos;
  25792. s6 = peg$parsews();
  25793. if (s6 !== peg$FAILED) {
  25794. if (input.charCodeAt(peg$currPos) === 59) {
  25795. s7 = peg$c116;
  25796. peg$currPos++;
  25797. } else {
  25798. s7 = peg$FAILED;
  25799. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  25800. }
  25801. if (s7 !== peg$FAILED) {
  25802. s8 = peg$parsewsMessage();
  25803. if (s8 !== peg$FAILED) {
  25804. peg$savedPos = s5;
  25805. s6 = peg$c118(s1, s2, s8);
  25806. s5 = s6;
  25807. } else {
  25808. peg$currPos = s5;
  25809. s5 = peg$FAILED;
  25810. }
  25811. } else {
  25812. peg$currPos = s5;
  25813. s5 = peg$FAILED;
  25814. }
  25815. } else {
  25816. peg$currPos = s5;
  25817. s5 = peg$FAILED;
  25818. }
  25819. if (s5 !== peg$FAILED) {
  25820. while (s5 !== peg$FAILED) {
  25821. s4.push(s5);
  25822. s5 = peg$currPos;
  25823. s6 = peg$parsews();
  25824. if (s6 !== peg$FAILED) {
  25825. if (input.charCodeAt(peg$currPos) === 59) {
  25826. s7 = peg$c116;
  25827. peg$currPos++;
  25828. } else {
  25829. s7 = peg$FAILED;
  25830. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  25831. }
  25832. if (s7 !== peg$FAILED) {
  25833. s8 = peg$parsewsMessage();
  25834. if (s8 !== peg$FAILED) {
  25835. peg$savedPos = s5;
  25836. s6 = peg$c118(s1, s2, s8);
  25837. s5 = s6;
  25838. } else {
  25839. peg$currPos = s5;
  25840. s5 = peg$FAILED;
  25841. }
  25842. } else {
  25843. peg$currPos = s5;
  25844. s5 = peg$FAILED;
  25845. }
  25846. } else {
  25847. peg$currPos = s5;
  25848. s5 = peg$FAILED;
  25849. }
  25850. }
  25851. } else {
  25852. s4 = peg$FAILED;
  25853. }
  25854. if (s4 !== peg$FAILED) {
  25855. peg$savedPos = s0;
  25856. s1 = peg$c119(s1, s2, s4);
  25857. s0 = s1;
  25858. } else {
  25859. peg$currPos = s0;
  25860. s0 = peg$FAILED;
  25861. }
  25862. } else {
  25863. peg$currPos = s0;
  25864. s0 = peg$FAILED;
  25865. }
  25866. } else {
  25867. peg$currPos = s0;
  25868. s0 = peg$FAILED;
  25869. }
  25870. } else {
  25871. peg$currPos = s0;
  25872. s0 = peg$FAILED;
  25873. }
  25874. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25875. return s0;
  25876. }
  25877. function peg$parsemethod() {
  25878. var s0, s1, s2;
  25879. var key = peg$currPos * 67 + 63,
  25880. cached = peg$resultsCache[key];
  25881. if (cached) {
  25882. peg$currPos = cached.nextPos;
  25883. return cached.result;
  25884. }
  25885. s0 = peg$currPos;
  25886. s1 = peg$parsewsKeywordPattern();
  25887. if (s1 === peg$FAILED) {
  25888. s1 = peg$parsewsBinaryPattern();
  25889. if (s1 === peg$FAILED) {
  25890. s1 = peg$parsewsUnaryPattern();
  25891. }
  25892. }
  25893. if (s1 !== peg$FAILED) {
  25894. s2 = peg$parsewsSequenceWs();
  25895. if (s2 !== peg$FAILED) {
  25896. peg$savedPos = s0;
  25897. s1 = peg$c120(s1, s2);
  25898. s0 = s1;
  25899. } else {
  25900. peg$currPos = s0;
  25901. s0 = peg$FAILED;
  25902. }
  25903. } else {
  25904. peg$currPos = s0;
  25905. s0 = peg$FAILED;
  25906. }
  25907. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25908. return s0;
  25909. }
  25910. function peg$parseassociationSend() {
  25911. var s0, s1, s2, s3;
  25912. var key = peg$currPos * 67 + 64,
  25913. cached = peg$resultsCache[key];
  25914. if (cached) {
  25915. peg$currPos = cached.nextPos;
  25916. return cached.result;
  25917. }
  25918. s0 = peg$currPos;
  25919. s1 = peg$parseoperand();
  25920. if (s1 !== peg$FAILED) {
  25921. s2 = peg$parsewsBinaryTail();
  25922. if (s2 !== peg$FAILED) {
  25923. peg$savedPos = peg$currPos;
  25924. s3 = peg$c121(s1, s2);
  25925. if (s3) {
  25926. s3 = void 0;
  25927. } else {
  25928. s3 = peg$FAILED;
  25929. }
  25930. if (s3 !== peg$FAILED) {
  25931. peg$savedPos = s0;
  25932. s1 = peg$c122(s1, s2);
  25933. s0 = s1;
  25934. } else {
  25935. peg$currPos = s0;
  25936. s0 = peg$FAILED;
  25937. }
  25938. } else {
  25939. peg$currPos = s0;
  25940. s0 = peg$FAILED;
  25941. }
  25942. } else {
  25943. peg$currPos = s0;
  25944. s0 = peg$FAILED;
  25945. }
  25946. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25947. return s0;
  25948. }
  25949. function peg$parsewsAssociationsRest() {
  25950. var s0, s1, s2;
  25951. var key = peg$currPos * 67 + 65,
  25952. cached = peg$resultsCache[key];
  25953. if (cached) {
  25954. peg$currPos = cached.nextPos;
  25955. return cached.result;
  25956. }
  25957. s0 = peg$currPos;
  25958. s1 = peg$parsesomeDotsWs();
  25959. if (s1 !== peg$FAILED) {
  25960. s2 = peg$parseassociationSend();
  25961. if (s2 !== peg$FAILED) {
  25962. peg$savedPos = s0;
  25963. s1 = peg$c78(s2);
  25964. s0 = s1;
  25965. } else {
  25966. peg$currPos = s0;
  25967. s0 = peg$FAILED;
  25968. }
  25969. } else {
  25970. peg$currPos = s0;
  25971. s0 = peg$FAILED;
  25972. }
  25973. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25974. return s0;
  25975. }
  25976. function peg$parsewsAssociations() {
  25977. var s0, s1, s2, s3, s4;
  25978. var key = peg$currPos * 67 + 66,
  25979. cached = peg$resultsCache[key];
  25980. if (cached) {
  25981. peg$currPos = cached.nextPos;
  25982. return cached.result;
  25983. }
  25984. s0 = peg$currPos;
  25985. s1 = peg$parsemaybeDotsWs();
  25986. if (s1 !== peg$FAILED) {
  25987. s2 = peg$parseassociationSend();
  25988. if (s2 !== peg$FAILED) {
  25989. s3 = [];
  25990. s4 = peg$parsewsAssociationsRest();
  25991. while (s4 !== peg$FAILED) {
  25992. s3.push(s4);
  25993. s4 = peg$parsewsAssociationsRest();
  25994. }
  25995. if (s3 !== peg$FAILED) {
  25996. peg$savedPos = s0;
  25997. s1 = peg$c123(s2, s3);
  25998. s0 = s1;
  25999. } else {
  26000. peg$currPos = s0;
  26001. s0 = peg$FAILED;
  26002. }
  26003. } else {
  26004. peg$currPos = s0;
  26005. s0 = peg$FAILED;
  26006. }
  26007. } else {
  26008. peg$currPos = s0;
  26009. s0 = peg$FAILED;
  26010. }
  26011. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26012. return s0;
  26013. }
  26014. var $globals = __boot.globals;
  26015. function newNode(nodeClass) {
  26016. return nodeClass._new()._location_(location())._source_(text());
  26017. }
  26018. peg$result = peg$startRuleFunction();
  26019. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26020. return peg$result;
  26021. } else {
  26022. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26023. peg$fail(peg$endExpectation());
  26024. }
  26025. throw peg$buildStructuredError(
  26026. peg$maxFailExpected,
  26027. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  26028. peg$maxFailPos < input.length
  26029. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  26030. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  26031. );
  26032. }
  26033. }
  26034. return {
  26035. SyntaxError: peg$SyntaxError,
  26036. parse: peg$parse
  26037. };
  26038. });
  26039. define('amber/core/Kernel-Infrastructure',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Objects", "amber/core/Kernel-Promises"], function($boot,requirejs){"use strict";
  26040. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  26041. var $pkg = $core.addPackage("Kernel-Infrastructure");
  26042. $pkg.innerEval = function (expr) { return eval(expr); };
  26043. $pkg.imports = ["smalltalkParser=amber/parser"];
  26044. var smalltalkParser;
  26045. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/parser"], function ($1) {smalltalkParser=$1; resolve();}, reject); });
  26046. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  26047. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  26048. $core.addMethod(
  26049. $core.method({
  26050. selector: "organizeClasses",
  26051. protocol: "organization",
  26052. fn: function (){
  26053. var self=this,$self=this;
  26054. return $core.withContext(function($ctx1) {
  26055. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  26056. return $core.withContext(function($ctx2) {
  26057. return $recv(each)._enterOrganization();
  26058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26059. }));
  26060. return self;
  26061. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{})});
  26062. },
  26063. args: [],
  26064. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  26065. referencedClasses: ["Smalltalk"],
  26066. pragmas: [],
  26067. messageSends: ["do:", "classes", "enterOrganization"]
  26068. }),
  26069. $globals.AmberBootstrapInitialization.a$cls);
  26070. $core.addMethod(
  26071. $core.method({
  26072. selector: "organizeMethods",
  26073. protocol: "organization",
  26074. fn: function (){
  26075. var self=this,$self=this;
  26076. return $core.withContext(function($ctx1) {
  26077. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  26078. return $core.withContext(function($ctx2) {
  26079. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  26080. return $core.withContext(function($ctx3) {
  26081. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  26082. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  26083. }));
  26084. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  26085. }));
  26086. $ctx1.sendIdx["do:"]=1;
  26087. return self;
  26088. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{})});
  26089. },
  26090. args: [],
  26091. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  26092. referencedClasses: ["Smalltalk"],
  26093. pragmas: [],
  26094. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  26095. }),
  26096. $globals.AmberBootstrapInitialization.a$cls);
  26097. $core.addMethod(
  26098. $core.method({
  26099. selector: "run",
  26100. protocol: "public api",
  26101. fn: function (){
  26102. var self=this,$self=this;
  26103. return $core.withContext(function($ctx1) {
  26104. $recv($globals.SmalltalkImage)._initialize();
  26105. $self._organizeClasses();
  26106. $self._organizeMethods();
  26107. return $recv($recv($globals.Smalltalk)._postLoad())._then_((function(){
  26108. return $core.withContext(function($ctx2) {
  26109. return $recv($recv($globals.Smalltalk)._globals())._at_put_("SmalltalkParser",smalltalkParser);
  26110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26111. }));
  26112. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  26113. },
  26114. args: [],
  26115. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad\x0a\x09\x09\x22TODO remove, backward compat\x22\x0a\x09\x09then: [ Smalltalk globals at: #SmalltalkParser put: smalltalkParser ]",
  26116. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  26117. pragmas: [],
  26118. messageSends: ["initialize", "organizeClasses", "organizeMethods", "then:", "postLoad", "at:put:", "globals"]
  26119. }),
  26120. $globals.AmberBootstrapInitialization.a$cls);
  26121. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  26122. $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`.";
  26123. $core.addMethod(
  26124. $core.method({
  26125. selector: "=",
  26126. protocol: "comparing",
  26127. fn: function (anObject){
  26128. var self=this,$self=this;
  26129. return $core.withContext(function($ctx1) {
  26130. var $2,$1;
  26131. $2=$recv(anObject)._class();
  26132. $ctx1.sendIdx["class"]=1;
  26133. $1=$recv($2).__eq_eq($self._class());
  26134. if(!$core.assert($1)){
  26135. return false;
  26136. }
  26137. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  26138. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  26139. },
  26140. args: ["anObject"],
  26141. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  26142. referencedClasses: ["JSObjectProxy"],
  26143. pragmas: [],
  26144. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  26145. }),
  26146. $globals.JSObjectProxy);
  26147. $core.addMethod(
  26148. $core.method({
  26149. selector: "asJavaScriptObject",
  26150. protocol: "converting",
  26151. fn: function (){
  26152. var self=this,$self=this;
  26153. return $self.jsObject;
  26154. },
  26155. args: [],
  26156. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  26157. referencedClasses: [],
  26158. pragmas: [],
  26159. messageSends: []
  26160. }),
  26161. $globals.JSObjectProxy);
  26162. $core.addMethod(
  26163. $core.method({
  26164. selector: "at:",
  26165. protocol: "accessing",
  26166. fn: function (aString){
  26167. var self=this,$self=this;
  26168. return $core.withContext(function($ctx1) {
  26169. return $self.jsObject[aString];
  26170. return self;
  26171. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString})});
  26172. },
  26173. args: ["aString"],
  26174. source: "at: aString\x0a\x09<inlineJS: 'return $self.jsObject[aString]'>",
  26175. referencedClasses: [],
  26176. pragmas: [["inlineJS:", ["return $self.jsObject[aString]"]]],
  26177. messageSends: []
  26178. }),
  26179. $globals.JSObjectProxy);
  26180. $core.addMethod(
  26181. $core.method({
  26182. selector: "at:ifAbsent:",
  26183. protocol: "accessing",
  26184. fn: function (aString,aBlock){
  26185. var self=this,$self=this;
  26186. return $core.withContext(function($ctx1) {
  26187. var obj = $self.jsObject;
  26188. return aString in obj ? obj[aString] : aBlock._value();
  26189. ;
  26190. return self;
  26191. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock})});
  26192. },
  26193. args: ["aString", "aBlock"],
  26194. 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'>",
  26195. referencedClasses: [],
  26196. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09"]]],
  26197. messageSends: []
  26198. }),
  26199. $globals.JSObjectProxy);
  26200. $core.addMethod(
  26201. $core.method({
  26202. selector: "at:ifPresent:",
  26203. protocol: "accessing",
  26204. fn: function (aString,aBlock){
  26205. var self=this,$self=this;
  26206. return $core.withContext(function($ctx1) {
  26207. var obj = $self.jsObject;
  26208. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  26209. ;
  26210. return self;
  26211. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock})});
  26212. },
  26213. args: ["aString", "aBlock"],
  26214. 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'>",
  26215. referencedClasses: [],
  26216. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09"]]],
  26217. messageSends: []
  26218. }),
  26219. $globals.JSObjectProxy);
  26220. $core.addMethod(
  26221. $core.method({
  26222. selector: "at:ifPresent:ifAbsent:",
  26223. protocol: "accessing",
  26224. fn: function (aString,aBlock,anotherBlock){
  26225. var self=this,$self=this;
  26226. return $core.withContext(function($ctx1) {
  26227. var obj = $self.jsObject;
  26228. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  26229. ;
  26230. return self;
  26231. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock})});
  26232. },
  26233. args: ["aString", "aBlock", "anotherBlock"],
  26234. 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'>",
  26235. referencedClasses: [],
  26236. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09"]]],
  26237. messageSends: []
  26238. }),
  26239. $globals.JSObjectProxy);
  26240. $core.addMethod(
  26241. $core.method({
  26242. selector: "at:put:",
  26243. protocol: "accessing",
  26244. fn: function (aString,anObject){
  26245. var self=this,$self=this;
  26246. return $core.withContext(function($ctx1) {
  26247. return $self.jsObject[aString] = anObject;
  26248. return self;
  26249. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject})});
  26250. },
  26251. args: ["aString", "anObject"],
  26252. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self.jsObject[aString] = anObject'>",
  26253. referencedClasses: [],
  26254. pragmas: [["inlineJS:", ["return $self.jsObject[aString] = anObject"]]],
  26255. messageSends: []
  26256. }),
  26257. $globals.JSObjectProxy);
  26258. $core.addMethod(
  26259. $core.method({
  26260. selector: "catch:",
  26261. protocol: "promises",
  26262. fn: function (aBlock){
  26263. var self=this,$self=this;
  26264. return $core.withContext(function($ctx1) {
  26265. var $1,$2;
  26266. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26267. if($core.assert($1)){
  26268. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self.jsObject,[aBlock]);
  26269. } else {
  26270. $2=(
  26271. $ctx1.supercall = true,
  26272. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  26273. $ctx1.supercall = false;
  26274. return $2;
  26275. }
  26276. return self;
  26277. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  26278. },
  26279. args: ["aBlock"],
  26280. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  26281. referencedClasses: ["NativeFunction", "TThenable"],
  26282. pragmas: [],
  26283. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  26284. }),
  26285. $globals.JSObjectProxy);
  26286. $core.addMethod(
  26287. $core.method({
  26288. selector: "doesNotUnderstand:",
  26289. protocol: "proxy",
  26290. fn: function (aMessage){
  26291. var self=this,$self=this;
  26292. return $core.withContext(function($ctx1) {
  26293. var $1,$receiver;
  26294. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  26295. if(($receiver = $1) == null || $receiver.a$nil){
  26296. return (
  26297. $ctx1.supercall = true,
  26298. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  26299. $ctx1.supercall = false;
  26300. } else {
  26301. var jsSelector;
  26302. jsSelector=$receiver;
  26303. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  26304. }
  26305. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  26306. },
  26307. args: ["aMessage"],
  26308. 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 ]",
  26309. referencedClasses: ["JSObjectProxy"],
  26310. pragmas: [],
  26311. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  26312. }),
  26313. $globals.JSObjectProxy);
  26314. $core.addMethod(
  26315. $core.method({
  26316. selector: "in:",
  26317. protocol: "accessing",
  26318. fn: function (aValuable){
  26319. var self=this,$self=this;
  26320. return $core.withContext(function($ctx1) {
  26321. return $recv(aValuable)._value_($self.jsObject);
  26322. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  26323. },
  26324. args: ["aValuable"],
  26325. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  26326. referencedClasses: [],
  26327. pragmas: [],
  26328. messageSends: ["value:"]
  26329. }),
  26330. $globals.JSObjectProxy);
  26331. $core.addMethod(
  26332. $core.method({
  26333. selector: "jsObject",
  26334. protocol: "accessing",
  26335. fn: function (){
  26336. var self=this,$self=this;
  26337. return $self.jsObject;
  26338. },
  26339. args: [],
  26340. source: "jsObject\x0a\x09^ jsObject",
  26341. referencedClasses: [],
  26342. pragmas: [],
  26343. messageSends: []
  26344. }),
  26345. $globals.JSObjectProxy);
  26346. $core.addMethod(
  26347. $core.method({
  26348. selector: "keysAndValuesDo:",
  26349. protocol: "enumerating",
  26350. fn: function (aBlock){
  26351. var self=this,$self=this;
  26352. return $core.withContext(function($ctx1) {
  26353. var o = $self.jsObject;
  26354. for(var i in o) {
  26355. aBlock._value_value_(i, o[i]);
  26356. }
  26357. ;
  26358. return self;
  26359. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  26360. },
  26361. args: ["aBlock"],
  26362. 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'>",
  26363. referencedClasses: [],
  26364. pragmas: [["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"]]],
  26365. messageSends: []
  26366. }),
  26367. $globals.JSObjectProxy);
  26368. $core.addMethod(
  26369. $core.method({
  26370. selector: "on:do:",
  26371. protocol: "promises",
  26372. fn: function (aClass,aBlock){
  26373. var self=this,$self=this;
  26374. return $core.withContext(function($ctx1) {
  26375. var $1,$2;
  26376. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26377. if($core.assert($1)){
  26378. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self.jsObject,[aClass,aBlock]);
  26379. } else {
  26380. $2=(
  26381. $ctx1.supercall = true,
  26382. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  26383. $ctx1.supercall = false;
  26384. return $2;
  26385. }
  26386. return self;
  26387. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  26388. },
  26389. args: ["aClass", "aBlock"],
  26390. 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 ]",
  26391. referencedClasses: ["NativeFunction", "TThenable"],
  26392. pragmas: [],
  26393. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  26394. }),
  26395. $globals.JSObjectProxy);
  26396. $core.addMethod(
  26397. $core.method({
  26398. selector: "printOn:",
  26399. protocol: "printing",
  26400. fn: function (aStream){
  26401. var self=this,$self=this;
  26402. return $core.withContext(function($ctx1) {
  26403. $recv(aStream)._nextPutAll_($self._printString());
  26404. return self;
  26405. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  26406. },
  26407. args: ["aStream"],
  26408. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  26409. referencedClasses: [],
  26410. pragmas: [],
  26411. messageSends: ["nextPutAll:", "printString"]
  26412. }),
  26413. $globals.JSObjectProxy);
  26414. $core.addMethod(
  26415. $core.method({
  26416. selector: "printString",
  26417. protocol: "printing",
  26418. fn: function (){
  26419. var self=this,$self=this;
  26420. return $core.withContext(function($ctx1) {
  26421. var js = $self.jsObject;
  26422. return !js ? "<<malformed JS object proxy>>" : js.toString
  26423. ? js.toString()
  26424. : Object.prototype.toString.call(js)
  26425. ;
  26426. return self;
  26427. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  26428. },
  26429. args: [],
  26430. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return !js ? \x22<<malformed JS object proxy>>\x22 : js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  26431. referencedClasses: [],
  26432. pragmas: [["inlineJS:", ["\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return !js ? \x22<<malformed JS object proxy>>\x22 : js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09"]]],
  26433. messageSends: []
  26434. }),
  26435. $globals.JSObjectProxy);
  26436. $core.addMethod(
  26437. $core.method({
  26438. selector: "putOn:",
  26439. protocol: "streaming",
  26440. fn: function (aStream){
  26441. var self=this,$self=this;
  26442. return $core.withContext(function($ctx1) {
  26443. $recv(aStream)._nextPutJSObject_($self.jsObject);
  26444. return self;
  26445. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  26446. },
  26447. args: ["aStream"],
  26448. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  26449. referencedClasses: [],
  26450. pragmas: [],
  26451. messageSends: ["nextPutJSObject:"]
  26452. }),
  26453. $globals.JSObjectProxy);
  26454. $core.addMethod(
  26455. $core.method({
  26456. selector: "removeKey:",
  26457. protocol: "accessing",
  26458. fn: function (aString){
  26459. var self=this,$self=this;
  26460. return $core.withContext(function($ctx1) {
  26461. delete $self.jsObject[aString]; return aString;
  26462. return self;
  26463. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString})});
  26464. },
  26465. args: ["aString"],
  26466. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self.jsObject[aString]; return aString'>",
  26467. referencedClasses: [],
  26468. pragmas: [["inlineJS:", ["delete $self.jsObject[aString]; return aString"]]],
  26469. messageSends: []
  26470. }),
  26471. $globals.JSObjectProxy);
  26472. $core.addMethod(
  26473. $core.method({
  26474. selector: "then:",
  26475. protocol: "promises",
  26476. fn: function (aBlockOrArray){
  26477. var self=this,$self=this;
  26478. return $core.withContext(function($ctx1) {
  26479. var $1,$2;
  26480. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  26481. if($core.assert($1)){
  26482. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self.jsObject,[aBlockOrArray]);
  26483. } else {
  26484. $2=(
  26485. $ctx1.supercall = true,
  26486. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  26487. $ctx1.supercall = false;
  26488. return $2;
  26489. }
  26490. return self;
  26491. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  26492. },
  26493. args: ["aBlockOrArray"],
  26494. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  26495. referencedClasses: ["NativeFunction", "TThenable"],
  26496. pragmas: [],
  26497. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  26498. }),
  26499. $globals.JSObjectProxy);
  26500. $core.addMethod(
  26501. $core.method({
  26502. selector: "addObjectVariablesTo:ofProxy:",
  26503. protocol: "proxy",
  26504. fn: function (aDictionary,aProxy){
  26505. var self=this,$self=this;
  26506. return $core.withContext(function($ctx1) {
  26507. var jsObject = aProxy.jsObject;
  26508. for(var i in jsObject) {
  26509. aDictionary._at_put_(i, jsObject[i]);
  26510. }
  26511. ;
  26512. return self;
  26513. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy})});
  26514. },
  26515. args: ["aDictionary", "aProxy"],
  26516. 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'>",
  26517. referencedClasses: [],
  26518. pragmas: [["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"]]],
  26519. messageSends: []
  26520. }),
  26521. $globals.JSObjectProxy.a$cls);
  26522. $core.addMethod(
  26523. $core.method({
  26524. selector: "compareJSObjectOfProxy:withProxy:",
  26525. protocol: "proxy",
  26526. fn: function (aProxy,anotherProxy){
  26527. var self=this,$self=this;
  26528. return $core.withContext(function($ctx1) {
  26529. var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;
  26530. return aProxy.jsObject === anotherJSObject;
  26531. return self;
  26532. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy})});
  26533. },
  26534. args: ["aProxy", "anotherProxy"],
  26535. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject\x0a'>",
  26536. referencedClasses: [],
  26537. pragmas: [["inlineJS:", ["\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject"]]],
  26538. messageSends: []
  26539. }),
  26540. $globals.JSObjectProxy.a$cls);
  26541. $core.addMethod(
  26542. $core.method({
  26543. selector: "forwardMessage:withArguments:ofProxy:",
  26544. protocol: "proxy",
  26545. fn: function (aString,anArray,aProxy){
  26546. var self=this,$self=this;
  26547. return $core.withContext(function($ctx1) {
  26548. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  26549. ;
  26550. return self;
  26551. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy})});
  26552. },
  26553. args: ["aString", "anArray", "aProxy"],
  26554. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  26555. referencedClasses: [],
  26556. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09"]]],
  26557. messageSends: []
  26558. }),
  26559. $globals.JSObjectProxy.a$cls);
  26560. $core.addMethod(
  26561. $core.method({
  26562. selector: "jsObject:ofProxy:",
  26563. protocol: "proxy",
  26564. fn: function (aJSObject,aProxy){
  26565. var self=this,$self=this;
  26566. return $core.withContext(function($ctx1) {
  26567. aProxy.jsObject = aJSObject;
  26568. return self;
  26569. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy})});
  26570. },
  26571. args: ["aJSObject", "aProxy"],
  26572. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy.jsObject = aJSObject'>",
  26573. referencedClasses: [],
  26574. pragmas: [["inlineJS:", ["aProxy.jsObject = aJSObject"]]],
  26575. messageSends: []
  26576. }),
  26577. $globals.JSObjectProxy.a$cls);
  26578. $core.addMethod(
  26579. $core.method({
  26580. selector: "lookupProperty:ofProxy:",
  26581. protocol: "proxy",
  26582. fn: function (aString,aProxy){
  26583. var self=this,$self=this;
  26584. return $core.withContext(function($ctx1) {
  26585. return aString in aProxy._jsObject() ? aString : nil;
  26586. return self;
  26587. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy})});
  26588. },
  26589. args: ["aString", "aProxy"],
  26590. 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'>",
  26591. referencedClasses: [],
  26592. pragmas: [["inlineJS:", ["return aString in aProxy._jsObject() ? aString : nil"]]],
  26593. messageSends: []
  26594. }),
  26595. $globals.JSObjectProxy.a$cls);
  26596. $core.addMethod(
  26597. $core.method({
  26598. selector: "null",
  26599. protocol: "accessing",
  26600. fn: function (){
  26601. var self=this,$self=this;
  26602. return $core.withContext(function($ctx1) {
  26603. return null;
  26604. return self;
  26605. }, function($ctx1) {$ctx1.fill(self,"null",{})});
  26606. },
  26607. args: [],
  26608. source: "null\x0a\x09<inlineJS: 'return null'>",
  26609. referencedClasses: [],
  26610. pragmas: [["inlineJS:", ["return null"]]],
  26611. messageSends: []
  26612. }),
  26613. $globals.JSObjectProxy.a$cls);
  26614. $core.addMethod(
  26615. $core.method({
  26616. selector: "on:",
  26617. protocol: "instance creation",
  26618. fn: function (aJSObject){
  26619. var self=this,$self=this;
  26620. var instance;
  26621. return $core.withContext(function($ctx1) {
  26622. instance=$self._new();
  26623. $self._jsObject_ofProxy_(aJSObject,instance);
  26624. return instance;
  26625. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance})});
  26626. },
  26627. args: ["aJSObject"],
  26628. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  26629. referencedClasses: [],
  26630. pragmas: [],
  26631. messageSends: ["new", "jsObject:ofProxy:"]
  26632. }),
  26633. $globals.JSObjectProxy.a$cls);
  26634. $core.addMethod(
  26635. $core.method({
  26636. selector: "undefined",
  26637. protocol: "accessing",
  26638. fn: function (){
  26639. var self=this,$self=this;
  26640. return $core.withContext(function($ctx1) {
  26641. return undefined;
  26642. return self;
  26643. }, function($ctx1) {$ctx1.fill(self,"undefined",{})});
  26644. },
  26645. args: [],
  26646. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  26647. referencedClasses: [],
  26648. pragmas: [["inlineJS:", ["return undefined"]]],
  26649. messageSends: []
  26650. }),
  26651. $globals.JSObjectProxy.a$cls);
  26652. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  26653. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  26654. $core.addMethod(
  26655. $core.method({
  26656. selector: "addElement:",
  26657. protocol: "accessing",
  26658. fn: function (anObject){
  26659. var self=this,$self=this;
  26660. return $core.withContext(function($ctx1) {
  26661. $recv($self._elements())._add_(anObject);
  26662. return self;
  26663. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject})});
  26664. },
  26665. args: ["anObject"],
  26666. source: "addElement: anObject\x0a\x09self elements add: anObject",
  26667. referencedClasses: [],
  26668. pragmas: [],
  26669. messageSends: ["add:", "elements"]
  26670. }),
  26671. $globals.Organizer);
  26672. $core.addMethod(
  26673. $core.method({
  26674. selector: "elements",
  26675. protocol: "accessing",
  26676. fn: function (){
  26677. var self=this,$self=this;
  26678. return $self.elements;
  26679. },
  26680. args: [],
  26681. source: "elements\x0a\x09^ elements",
  26682. referencedClasses: [],
  26683. pragmas: [],
  26684. messageSends: []
  26685. }),
  26686. $globals.Organizer);
  26687. $core.addMethod(
  26688. $core.method({
  26689. selector: "initialize",
  26690. protocol: "initialization",
  26691. fn: function (){
  26692. var self=this,$self=this;
  26693. return $core.withContext(function($ctx1) {
  26694. (
  26695. $ctx1.supercall = true,
  26696. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  26697. $ctx1.supercall = false;
  26698. $self.elements=$recv($globals.Set)._new();
  26699. return self;
  26700. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  26701. },
  26702. args: [],
  26703. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  26704. referencedClasses: ["Set"],
  26705. pragmas: [],
  26706. messageSends: ["initialize", "new"]
  26707. }),
  26708. $globals.Organizer);
  26709. $core.addMethod(
  26710. $core.method({
  26711. selector: "removeElement:",
  26712. protocol: "accessing",
  26713. fn: function (anObject){
  26714. var self=this,$self=this;
  26715. return $core.withContext(function($ctx1) {
  26716. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  26717. }));
  26718. return self;
  26719. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject})});
  26720. },
  26721. args: ["anObject"],
  26722. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  26723. referencedClasses: [],
  26724. pragmas: [],
  26725. messageSends: ["remove:ifAbsent:", "elements"]
  26726. }),
  26727. $globals.Organizer);
  26728. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  26729. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  26730. $core.addMethod(
  26731. $core.method({
  26732. selector: "addElement:",
  26733. protocol: "accessing",
  26734. fn: function (aString){
  26735. var self=this,$self=this;
  26736. return $core.withContext(function($ctx1) {
  26737. var $1,$3,$2;
  26738. (
  26739. $ctx1.supercall = true,
  26740. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  26741. $ctx1.supercall = false;
  26742. $1=$recv($globals.SystemAnnouncer)._current();
  26743. $3=$recv($globals.ProtocolAdded)._new();
  26744. $recv($3)._protocol_(aString);
  26745. $recv($3)._theClass_($self._theClass());
  26746. $2=$recv($3)._yourself();
  26747. $recv($1)._announce_($2);
  26748. return self;
  26749. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString})});
  26750. },
  26751. args: ["aString"],
  26752. 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)",
  26753. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  26754. pragmas: [],
  26755. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  26756. }),
  26757. $globals.ClassOrganizer);
  26758. $core.addMethod(
  26759. $core.method({
  26760. selector: "removeElement:",
  26761. protocol: "accessing",
  26762. fn: function (aString){
  26763. var self=this,$self=this;
  26764. return $core.withContext(function($ctx1) {
  26765. var $1,$3,$2;
  26766. (
  26767. $ctx1.supercall = true,
  26768. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  26769. $ctx1.supercall = false;
  26770. $1=$recv($globals.SystemAnnouncer)._current();
  26771. $3=$recv($globals.ProtocolRemoved)._new();
  26772. $recv($3)._protocol_(aString);
  26773. $recv($3)._theClass_($self._theClass());
  26774. $2=$recv($3)._yourself();
  26775. $recv($1)._announce_($2);
  26776. return self;
  26777. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString})});
  26778. },
  26779. args: ["aString"],
  26780. 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)",
  26781. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  26782. pragmas: [],
  26783. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  26784. }),
  26785. $globals.ClassOrganizer);
  26786. $core.addMethod(
  26787. $core.method({
  26788. selector: "theClass",
  26789. protocol: "accessing",
  26790. fn: function (){
  26791. var self=this,$self=this;
  26792. return $self.traitOrBehavior;
  26793. },
  26794. args: [],
  26795. source: "theClass\x0a\x09^ traitOrBehavior",
  26796. referencedClasses: [],
  26797. pragmas: [],
  26798. messageSends: []
  26799. }),
  26800. $globals.ClassOrganizer);
  26801. $core.addMethod(
  26802. $core.method({
  26803. selector: "theClass:",
  26804. protocol: "accessing",
  26805. fn: function (aClass){
  26806. var self=this,$self=this;
  26807. $self.traitOrBehavior=aClass;
  26808. return self;
  26809. },
  26810. args: ["aClass"],
  26811. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  26812. referencedClasses: [],
  26813. pragmas: [],
  26814. messageSends: []
  26815. }),
  26816. $globals.ClassOrganizer);
  26817. $core.addMethod(
  26818. $core.method({
  26819. selector: "on:",
  26820. protocol: "instance creation",
  26821. fn: function (aClass){
  26822. var self=this,$self=this;
  26823. return $core.withContext(function($ctx1) {
  26824. var $1;
  26825. $1=$self._new();
  26826. $recv($1)._theClass_(aClass);
  26827. return $recv($1)._yourself();
  26828. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  26829. },
  26830. args: ["aClass"],
  26831. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  26832. referencedClasses: [],
  26833. pragmas: [],
  26834. messageSends: ["theClass:", "new", "yourself"]
  26835. }),
  26836. $globals.ClassOrganizer.a$cls);
  26837. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  26838. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  26839. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  26840. $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'";
  26841. $core.addMethod(
  26842. $core.method({
  26843. selector: "basicTransport",
  26844. protocol: "private",
  26845. fn: function (){
  26846. var self=this,$self=this;
  26847. return $self.basicTransport;
  26848. },
  26849. args: [],
  26850. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  26851. referencedClasses: [],
  26852. pragmas: [],
  26853. messageSends: []
  26854. }),
  26855. $globals.Package);
  26856. $core.addMethod(
  26857. $core.method({
  26858. selector: "beClean",
  26859. protocol: "accessing",
  26860. fn: function (){
  26861. var self=this,$self=this;
  26862. return $core.withContext(function($ctx1) {
  26863. var $1,$3,$2;
  26864. $self.dirty=false;
  26865. $1=$recv($globals.SystemAnnouncer)._current();
  26866. $3=$recv($globals.PackageClean)._new();
  26867. $recv($3)._package_(self);
  26868. $2=$recv($3)._yourself();
  26869. $recv($1)._announce_($2);
  26870. return self;
  26871. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  26872. },
  26873. args: [],
  26874. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  26875. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  26876. pragmas: [],
  26877. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  26878. }),
  26879. $globals.Package);
  26880. $core.addMethod(
  26881. $core.method({
  26882. selector: "beDirty",
  26883. protocol: "accessing",
  26884. fn: function (){
  26885. var self=this,$self=this;
  26886. return $core.withContext(function($ctx1) {
  26887. var $1,$3,$2;
  26888. $self.dirty=true;
  26889. $1=$recv($globals.SystemAnnouncer)._current();
  26890. $3=$recv($globals.PackageDirty)._new();
  26891. $recv($3)._package_(self);
  26892. $2=$recv($3)._yourself();
  26893. $recv($1)._announce_($2);
  26894. return self;
  26895. }, function($ctx1) {$ctx1.fill(self,"beDirty",{})});
  26896. },
  26897. args: [],
  26898. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  26899. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  26900. pragmas: [],
  26901. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  26902. }),
  26903. $globals.Package);
  26904. $core.addMethod(
  26905. $core.method({
  26906. selector: "classTemplate",
  26907. protocol: "accessing",
  26908. fn: function (){
  26909. var self=this,$self=this;
  26910. return $core.withContext(function($ctx1) {
  26911. return $recv($globals.String)._streamContents_((function(stream){
  26912. return $core.withContext(function($ctx2) {
  26913. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  26914. $ctx2.sendIdx["write:"]=1;
  26915. $recv(stream)._lf();
  26916. $ctx2.sendIdx["lf"]=1;
  26917. $recv(stream)._tab();
  26918. $ctx2.sendIdx["tab"]=1;
  26919. $recv(stream)._write_("instanceVariableNames: ''");
  26920. $ctx2.sendIdx["write:"]=2;
  26921. $recv(stream)._lf();
  26922. $recv(stream)._tab();
  26923. $recv(stream)._write_("package: ");
  26924. return $recv(stream)._print_($self._name());
  26925. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  26926. }));
  26927. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{})});
  26928. },
  26929. args: [],
  26930. 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 ]",
  26931. referencedClasses: ["String"],
  26932. pragmas: [],
  26933. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  26934. }),
  26935. $globals.Package);
  26936. $core.addMethod(
  26937. $core.method({
  26938. selector: "classes",
  26939. protocol: "classes",
  26940. fn: function (){
  26941. var self=this,$self=this;
  26942. return $core.withContext(function($ctx1) {
  26943. return $recv($recv($self._organization())._elements())._copy();
  26944. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  26945. },
  26946. args: [],
  26947. source: "classes\x0a\x09^ self organization elements copy",
  26948. referencedClasses: [],
  26949. pragmas: [],
  26950. messageSends: ["copy", "elements", "organization"]
  26951. }),
  26952. $globals.Package);
  26953. $core.addMethod(
  26954. $core.method({
  26955. selector: "definition",
  26956. protocol: "accessing",
  26957. fn: function (){
  26958. var self=this,$self=this;
  26959. return $core.withContext(function($ctx1) {
  26960. var $1;
  26961. return $recv($globals.String)._streamContents_((function(stream){
  26962. return $core.withContext(function($ctx2) {
  26963. $1=$recv($self._class())._name();
  26964. $ctx2.sendIdx["name"]=1;
  26965. $recv(stream)._write_($1);
  26966. $ctx2.sendIdx["write:"]=1;
  26967. $recv(stream)._lf();
  26968. $ctx2.sendIdx["lf"]=1;
  26969. $recv(stream)._tab();
  26970. $ctx2.sendIdx["tab"]=1;
  26971. $recv(stream)._write_("named: ");
  26972. $ctx2.sendIdx["write:"]=2;
  26973. $recv(stream)._print_($self._name());
  26974. $recv(stream)._lf();
  26975. $ctx2.sendIdx["lf"]=2;
  26976. $recv(stream)._tab();
  26977. $ctx2.sendIdx["tab"]=2;
  26978. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  26979. $ctx2.sendIdx["write:"]=3;
  26980. $recv(stream)._lf();
  26981. $recv(stream)._tab();
  26982. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  26983. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  26984. }));
  26985. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  26986. },
  26987. args: [],
  26988. 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. ')' } ]",
  26989. referencedClasses: ["String"],
  26990. pragmas: [],
  26991. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  26992. }),
  26993. $globals.Package);
  26994. $core.addMethod(
  26995. $core.method({
  26996. selector: "eval:",
  26997. protocol: "evaluating",
  26998. fn: function (aString){
  26999. var self=this,$self=this;
  27000. return $core.withContext(function($ctx1) {
  27001. var $1,$receiver;
  27002. $1=$self.evalBlock;
  27003. if(($receiver = $1) == null || $receiver.a$nil){
  27004. return $recv($globals.Compiler)._eval_(aString);
  27005. } else {
  27006. return $recv($self.evalBlock)._value_(aString);
  27007. }
  27008. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  27009. },
  27010. args: ["aString"],
  27011. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  27012. referencedClasses: ["Compiler"],
  27013. pragmas: [],
  27014. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  27015. }),
  27016. $globals.Package);
  27017. $core.addMethod(
  27018. $core.method({
  27019. selector: "evalBlock",
  27020. protocol: "accessing",
  27021. fn: function (){
  27022. var self=this,$self=this;
  27023. return $self.evalBlock;
  27024. },
  27025. args: [],
  27026. source: "evalBlock\x0a\x09^ evalBlock",
  27027. referencedClasses: [],
  27028. pragmas: [],
  27029. messageSends: []
  27030. }),
  27031. $globals.Package);
  27032. $core.addMethod(
  27033. $core.method({
  27034. selector: "evalBlock:",
  27035. protocol: "accessing",
  27036. fn: function (aBlock){
  27037. var self=this,$self=this;
  27038. $self.evalBlock=aBlock;
  27039. return self;
  27040. },
  27041. args: ["aBlock"],
  27042. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  27043. referencedClasses: [],
  27044. pragmas: [],
  27045. messageSends: []
  27046. }),
  27047. $globals.Package);
  27048. $core.addMethod(
  27049. $core.method({
  27050. selector: "imports",
  27051. protocol: "accessing",
  27052. fn: function (){
  27053. var self=this,$self=this;
  27054. return $core.withContext(function($ctx1) {
  27055. var $1,$receiver;
  27056. $1=$self.imports;
  27057. if(($receiver = $1) == null || $receiver.a$nil){
  27058. $self._imports_([]);
  27059. return $self.imports;
  27060. } else {
  27061. return $1;
  27062. }
  27063. }, function($ctx1) {$ctx1.fill(self,"imports",{})});
  27064. },
  27065. args: [],
  27066. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  27067. referencedClasses: [],
  27068. pragmas: [],
  27069. messageSends: ["ifNil:", "imports:"]
  27070. }),
  27071. $globals.Package);
  27072. $core.addMethod(
  27073. $core.method({
  27074. selector: "imports:",
  27075. protocol: "accessing",
  27076. fn: function (anArray){
  27077. var self=this,$self=this;
  27078. return $core.withContext(function($ctx1) {
  27079. $self._validateImports_(anArray);
  27080. $self.imports=$recv(anArray)._asSet();
  27081. return self;
  27082. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray})});
  27083. },
  27084. args: ["anArray"],
  27085. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  27086. referencedClasses: [],
  27087. pragmas: [],
  27088. messageSends: ["validateImports:", "asSet"]
  27089. }),
  27090. $globals.Package);
  27091. $core.addMethod(
  27092. $core.method({
  27093. selector: "importsAsJson",
  27094. protocol: "converting",
  27095. fn: function (){
  27096. var self=this,$self=this;
  27097. return $core.withContext(function($ctx1) {
  27098. var $1;
  27099. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  27100. return $core.withContext(function($ctx2) {
  27101. $1=$recv(each)._isString();
  27102. if($core.assert($1)){
  27103. return each;
  27104. } else {
  27105. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  27106. $ctx2.sendIdx[","]=1;
  27107. }
  27108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27109. }));
  27110. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{})});
  27111. },
  27112. args: [],
  27113. 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 ]]",
  27114. referencedClasses: [],
  27115. pragmas: [],
  27116. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  27117. }),
  27118. $globals.Package);
  27119. $core.addMethod(
  27120. $core.method({
  27121. selector: "importsDefinition",
  27122. protocol: "accessing",
  27123. fn: function (){
  27124. var self=this,$self=this;
  27125. return $core.withContext(function($ctx1) {
  27126. return $recv($globals.String)._streamContents_((function(stream){
  27127. return $core.withContext(function($ctx2) {
  27128. $recv(stream)._write_("{");
  27129. $ctx2.sendIdx["write:"]=1;
  27130. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  27131. return $core.withContext(function($ctx3) {
  27132. return $recv(stream)._print_(each);
  27133. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27134. }),(function(){
  27135. return $core.withContext(function($ctx3) {
  27136. return $recv(stream)._write_(". ");
  27137. $ctx3.sendIdx["write:"]=2;
  27138. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27139. }));
  27140. return $recv(stream)._write_("}");
  27141. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  27142. }));
  27143. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{})});
  27144. },
  27145. args: [],
  27146. 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: '}' ]",
  27147. referencedClasses: ["String"],
  27148. pragmas: [],
  27149. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  27150. }),
  27151. $globals.Package);
  27152. $core.addMethod(
  27153. $core.method({
  27154. selector: "importsFromJson:",
  27155. protocol: "converting",
  27156. fn: function (anArray){
  27157. var self=this,$self=this;
  27158. return $core.withContext(function($ctx1) {
  27159. var $1;
  27160. return $recv(anArray)._collect_((function(each){
  27161. var split;
  27162. return $core.withContext(function($ctx2) {
  27163. split=$recv(each)._tokenize_("=");
  27164. $1=$recv($recv(split)._size()).__eq((1));
  27165. if($core.assert($1)){
  27166. return $recv(split)._first();
  27167. $ctx2.sendIdx["first"]=1;
  27168. } else {
  27169. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  27170. }
  27171. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  27172. }));
  27173. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray})});
  27174. },
  27175. args: ["anArray"],
  27176. 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 ]]",
  27177. referencedClasses: [],
  27178. pragmas: [],
  27179. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  27180. }),
  27181. $globals.Package);
  27182. $core.addMethod(
  27183. $core.method({
  27184. selector: "initialize",
  27185. protocol: "initialization",
  27186. fn: function (){
  27187. var self=this,$self=this;
  27188. return $core.withContext(function($ctx1) {
  27189. (
  27190. $ctx1.supercall = true,
  27191. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  27192. $ctx1.supercall = false;
  27193. $self.organization=$recv($globals.PackageOrganizer)._new();
  27194. $ctx1.sendIdx["new"]=1;
  27195. $self.evalBlock=nil;
  27196. $self.dirty=nil;
  27197. $self.imports=nil;
  27198. $self.isReady=$recv($globals.Promise)._new();
  27199. $self.transport=nil;
  27200. return self;
  27201. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  27202. },
  27203. args: [],
  27204. 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",
  27205. referencedClasses: ["PackageOrganizer", "Promise"],
  27206. pragmas: [],
  27207. messageSends: ["initialize", "new"]
  27208. }),
  27209. $globals.Package);
  27210. $core.addMethod(
  27211. $core.method({
  27212. selector: "isDirty",
  27213. protocol: "testing",
  27214. fn: function (){
  27215. var self=this,$self=this;
  27216. return $core.withContext(function($ctx1) {
  27217. var $1,$receiver;
  27218. $1=$self.dirty;
  27219. if(($receiver = $1) == null || $receiver.a$nil){
  27220. return false;
  27221. } else {
  27222. return $1;
  27223. }
  27224. }, function($ctx1) {$ctx1.fill(self,"isDirty",{})});
  27225. },
  27226. args: [],
  27227. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  27228. referencedClasses: [],
  27229. pragmas: [],
  27230. messageSends: ["ifNil:"]
  27231. }),
  27232. $globals.Package);
  27233. $core.addMethod(
  27234. $core.method({
  27235. selector: "isPackage",
  27236. protocol: "testing",
  27237. fn: function (){
  27238. var self=this,$self=this;
  27239. return true;
  27240. },
  27241. args: [],
  27242. source: "isPackage\x0a\x09^ true",
  27243. referencedClasses: [],
  27244. pragmas: [],
  27245. messageSends: []
  27246. }),
  27247. $globals.Package);
  27248. $core.addMethod(
  27249. $core.method({
  27250. selector: "isReady",
  27251. protocol: "accessing",
  27252. fn: function (){
  27253. var self=this,$self=this;
  27254. return $self.isReady;
  27255. },
  27256. args: [],
  27257. source: "isReady\x0a\x09^ isReady",
  27258. referencedClasses: [],
  27259. pragmas: [],
  27260. messageSends: []
  27261. }),
  27262. $globals.Package);
  27263. $core.addMethod(
  27264. $core.method({
  27265. selector: "isReady:",
  27266. protocol: "accessing",
  27267. fn: function (aPromise){
  27268. var self=this,$self=this;
  27269. $self.isReady=aPromise;
  27270. return self;
  27271. },
  27272. args: ["aPromise"],
  27273. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  27274. referencedClasses: [],
  27275. pragmas: [],
  27276. messageSends: []
  27277. }),
  27278. $globals.Package);
  27279. $core.addMethod(
  27280. $core.method({
  27281. selector: "javaScriptDescriptor:",
  27282. protocol: "accessing",
  27283. fn: function (anObject){
  27284. var self=this,$self=this;
  27285. var basicEval,basicImports;
  27286. return $core.withContext(function($ctx1) {
  27287. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  27288. return $core.withContext(function($ctx2) {
  27289. return nil._asJavaScriptObject();
  27290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27291. }));
  27292. $ctx1.sendIdx["at:ifAbsent:"]=1;
  27293. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  27294. return [];
  27295. }));
  27296. $ctx1.sendIdx["at:ifAbsent:"]=2;
  27297. $self.basicTransport=$recv(anObject)._at_ifAbsent_("transport",(function(){
  27298. }));
  27299. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  27300. return $core.withContext(function($ctx2) {
  27301. return $self._isReady_(aPromise);
  27302. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  27303. }));
  27304. $self._evalBlock_(basicEval);
  27305. $self._imports_($self._importsFromJson_(basicImports));
  27306. return self;
  27307. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports})});
  27308. },
  27309. args: ["anObject"],
  27310. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ].\x0a\x09basicImports := anObject at: 'imports' ifAbsent: [ #() ].\x0a\x09basicTransport := anObject at: 'transport' ifAbsent: [].\x0a\x09anObject at: 'isReady' ifPresent: [ :aPromise | self isReady: aPromise ].\x0a\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  27311. referencedClasses: [],
  27312. pragmas: [],
  27313. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  27314. }),
  27315. $globals.Package);
  27316. $core.addMethod(
  27317. $core.method({
  27318. selector: "loadDependencies",
  27319. protocol: "dependencies",
  27320. fn: function (){
  27321. var self=this,$self=this;
  27322. var classes,packages;
  27323. return $core.withContext(function($ctx1) {
  27324. var $1;
  27325. classes=$self._loadDependencyClasses();
  27326. $1=$recv($recv(classes)._collect_((function(each){
  27327. return $core.withContext(function($ctx2) {
  27328. return $recv(each)._package();
  27329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27330. })))._asSet();
  27331. $recv($1)._remove_ifAbsent_(self,(function(){
  27332. }));
  27333. return $recv($1)._yourself();
  27334. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages})});
  27335. },
  27336. args: [],
  27337. 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",
  27338. referencedClasses: [],
  27339. pragmas: [],
  27340. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  27341. }),
  27342. $globals.Package);
  27343. $core.addMethod(
  27344. $core.method({
  27345. selector: "loadDependencyClasses",
  27346. protocol: "dependencies",
  27347. fn: function (){
  27348. var self=this,$self=this;
  27349. var starCategoryName;
  27350. return $core.withContext(function($ctx1) {
  27351. var $3,$2,$1;
  27352. starCategoryName="*".__comma($self._name());
  27353. $3=$self._classes();
  27354. $ctx1.sendIdx["classes"]=1;
  27355. $2=$recv($3)._collect_((function(each){
  27356. return $core.withContext(function($ctx2) {
  27357. return $recv(each)._superclass();
  27358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27359. }));
  27360. $ctx1.sendIdx["collect:"]=1;
  27361. $1=$recv($2)._asSet();
  27362. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  27363. return $core.withContext(function($ctx2) {
  27364. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._anySatisfy_((function(any){
  27365. return $core.withContext(function($ctx3) {
  27366. return $recv($recv($recv(any)._protocols())._includes_(starCategoryName))._and_((function(){
  27367. return $core.withContext(function($ctx4) {
  27368. return $recv($recv(any)._ownMethodsInProtocol_(starCategoryName))._notEmpty();
  27369. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  27370. }));
  27371. }, function($ctx3) {$ctx3.fillBlock({any:any},$ctx2,3)});
  27372. }));
  27373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27374. })));
  27375. $ctx1.sendIdx["addAll:"]=1;
  27376. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  27377. return $core.withContext(function($ctx2) {
  27378. return $recv($self._traitCompositions())._valuesDo_((function(each){
  27379. return $core.withContext(function($ctx3) {
  27380. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  27381. return $core.withContext(function($ctx4) {
  27382. return $recv(eachTT)._trait();
  27383. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  27384. })));
  27385. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  27386. }));
  27387. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  27388. })));
  27389. $recv($1)._remove_ifAbsent_(nil,(function(){
  27390. }));
  27391. return $recv($1)._yourself();
  27392. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName})});
  27393. },
  27394. args: [],
  27395. 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\x09({each. each theMetaClass} copyWithout: nil) anySatisfy: [ :any |\x0a\x09\x09\x09\x09(any protocols includes: starCategoryName) and: [\x0a\x09\x09\x09\x09\x09(any ownMethodsInProtocol: starCategoryName) notEmpty ]]]);\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",
  27396. referencedClasses: ["Smalltalk", "Array"],
  27397. pragmas: [],
  27398. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "anySatisfy:", "copyWithout:", "theMetaClass", "and:", "includes:", "protocols", "notEmpty", "ownMethodsInProtocol:", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  27399. }),
  27400. $globals.Package);
  27401. $core.addMethod(
  27402. $core.method({
  27403. selector: "name",
  27404. protocol: "accessing",
  27405. fn: function (){
  27406. var self=this,$self=this;
  27407. return $self.name;
  27408. },
  27409. args: [],
  27410. source: "name\x0a\x09^ name",
  27411. referencedClasses: [],
  27412. pragmas: [],
  27413. messageSends: []
  27414. }),
  27415. $globals.Package);
  27416. $core.addMethod(
  27417. $core.method({
  27418. selector: "name:",
  27419. protocol: "accessing",
  27420. fn: function (aString){
  27421. var self=this,$self=this;
  27422. $self.name=aString;
  27423. return self;
  27424. },
  27425. args: ["aString"],
  27426. source: "name: aString\x0a\x09name := aString",
  27427. referencedClasses: [],
  27428. pragmas: [],
  27429. messageSends: []
  27430. }),
  27431. $globals.Package);
  27432. $core.addMethod(
  27433. $core.method({
  27434. selector: "organization",
  27435. protocol: "accessing",
  27436. fn: function (){
  27437. var self=this,$self=this;
  27438. return $self.organization;
  27439. },
  27440. args: [],
  27441. source: "organization\x0a\x09^ organization",
  27442. referencedClasses: [],
  27443. pragmas: [],
  27444. messageSends: []
  27445. }),
  27446. $globals.Package);
  27447. $core.addMethod(
  27448. $core.method({
  27449. selector: "printOn:",
  27450. protocol: "printing",
  27451. fn: function (aStream){
  27452. var self=this,$self=this;
  27453. return $core.withContext(function($ctx1) {
  27454. (
  27455. $ctx1.supercall = true,
  27456. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  27457. $ctx1.supercall = false;
  27458. $recv(aStream)._nextPutAll_(" (");
  27459. $ctx1.sendIdx["nextPutAll:"]=1;
  27460. $recv(aStream)._nextPutAll_($self._name());
  27461. $ctx1.sendIdx["nextPutAll:"]=2;
  27462. $recv(aStream)._nextPutAll_(")");
  27463. return self;
  27464. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  27465. },
  27466. args: ["aStream"],
  27467. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  27468. referencedClasses: [],
  27469. pragmas: [],
  27470. messageSends: ["printOn:", "nextPutAll:", "name"]
  27471. }),
  27472. $globals.Package);
  27473. $core.addMethod(
  27474. $core.method({
  27475. selector: "setupClasses",
  27476. protocol: "classes",
  27477. fn: function (){
  27478. var self=this,$self=this;
  27479. return $core.withContext(function($ctx1) {
  27480. $recv($self._classes())._do_((function(each){
  27481. return $core.withContext(function($ctx2) {
  27482. return $recv(each)._initialize();
  27483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27484. }));
  27485. return self;
  27486. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{})});
  27487. },
  27488. args: [],
  27489. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  27490. referencedClasses: [],
  27491. pragmas: [],
  27492. messageSends: ["do:", "classes", "initialize"]
  27493. }),
  27494. $globals.Package);
  27495. $core.addMethod(
  27496. $core.method({
  27497. selector: "sortedClasses",
  27498. protocol: "classes",
  27499. fn: function (){
  27500. var self=this,$self=this;
  27501. return $core.withContext(function($ctx1) {
  27502. return $recv($self._class())._sortedClasses_($self._classes());
  27503. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{})});
  27504. },
  27505. args: [],
  27506. 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",
  27507. referencedClasses: [],
  27508. pragmas: [],
  27509. messageSends: ["sortedClasses:", "class", "classes"]
  27510. }),
  27511. $globals.Package);
  27512. $core.addMethod(
  27513. $core.method({
  27514. selector: "sortedImportsAsArray",
  27515. protocol: "private",
  27516. fn: function (){
  27517. var self=this,$self=this;
  27518. return $core.withContext(function($ctx1) {
  27519. var $3,$2,$4,$1,$6,$5,$7;
  27520. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  27521. return $core.withContext(function($ctx2) {
  27522. $3=$recv(a)._isString();
  27523. $ctx2.sendIdx["isString"]=1;
  27524. $2=$recv($3)._not();
  27525. $4=$recv(b)._isString();
  27526. $ctx2.sendIdx["isString"]=2;
  27527. $1=$recv($2).__and($4);
  27528. return $recv($1)._or_((function(){
  27529. return $core.withContext(function($ctx3) {
  27530. $6=$recv(a)._isString();
  27531. $ctx3.sendIdx["isString"]=3;
  27532. $5=$recv($6).__eq($recv(b)._isString());
  27533. return $recv($5)._and_((function(){
  27534. return $core.withContext(function($ctx4) {
  27535. $7=$recv(a)._value();
  27536. $ctx4.sendIdx["value"]=1;
  27537. return $recv($7).__lt_eq($recv(b)._value());
  27538. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  27539. }));
  27540. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  27541. }));
  27542. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27543. }));
  27544. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{})});
  27545. },
  27546. args: [],
  27547. 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 ]]]",
  27548. referencedClasses: [],
  27549. pragmas: [],
  27550. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  27551. }),
  27552. $globals.Package);
  27553. $core.addMethod(
  27554. $core.method({
  27555. selector: "traitCompositions",
  27556. protocol: "dependencies",
  27557. fn: function (){
  27558. var self=this,$self=this;
  27559. var traitCompositions;
  27560. return $core.withContext(function($ctx1) {
  27561. traitCompositions=$recv($globals.Dictionary)._new();
  27562. $recv($self._classes())._do_((function(eachClass){
  27563. return $core.withContext(function($ctx2) {
  27564. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  27565. return $core.withContext(function($ctx3) {
  27566. return $recv(traitCompositions)._at_put_(each,$recv(each)._traitComposition());
  27567. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27568. }));
  27569. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  27570. }));
  27571. return $recv(traitCompositions)._reject_((function(each){
  27572. return $core.withContext(function($ctx2) {
  27573. return $recv(each)._isEmpty();
  27574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  27575. }));
  27576. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions})});
  27577. },
  27578. args: [],
  27579. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  27580. referencedClasses: ["Dictionary"],
  27581. pragmas: [],
  27582. messageSends: ["new", "do:", "classes", "includingPossibleMetaDo:", "at:put:", "traitComposition", "reject:", "isEmpty"]
  27583. }),
  27584. $globals.Package);
  27585. $core.addMethod(
  27586. $core.method({
  27587. selector: "transport",
  27588. protocol: "accessing",
  27589. fn: function (){
  27590. var self=this,$self=this;
  27591. return $core.withContext(function($ctx1) {
  27592. var $1,$receiver;
  27593. $1=$self.transport;
  27594. if(($receiver = $1) == null || $receiver.a$nil){
  27595. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  27596. return $self.transport;
  27597. } else {
  27598. return $1;
  27599. }
  27600. }, function($ctx1) {$ctx1.fill(self,"transport",{})});
  27601. },
  27602. args: [],
  27603. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  27604. referencedClasses: ["PackageTransport"],
  27605. pragmas: [],
  27606. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  27607. }),
  27608. $globals.Package);
  27609. $core.addMethod(
  27610. $core.method({
  27611. selector: "transport:",
  27612. protocol: "accessing",
  27613. fn: function (aPackageTransport){
  27614. var self=this,$self=this;
  27615. return $core.withContext(function($ctx1) {
  27616. $self.transport=aPackageTransport;
  27617. $recv(aPackageTransport)._package_(self);
  27618. return self;
  27619. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport})});
  27620. },
  27621. args: ["aPackageTransport"],
  27622. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  27623. referencedClasses: [],
  27624. pragmas: [],
  27625. messageSends: ["package:"]
  27626. }),
  27627. $globals.Package);
  27628. $core.addMethod(
  27629. $core.method({
  27630. selector: "validateImports:",
  27631. protocol: "validation",
  27632. fn: function (aCollection){
  27633. var self=this,$self=this;
  27634. return $core.withContext(function($ctx1) {
  27635. var $1,$2,$5,$4,$3,$6;
  27636. $recv(aCollection)._do_((function(import_){
  27637. return $core.withContext(function($ctx2) {
  27638. $1=$recv(import_)._isString();
  27639. $ctx2.sendIdx["isString"]=1;
  27640. if(!$core.assert($1)){
  27641. $2=$recv(import_)._respondsTo_("key");
  27642. if(!$core.assert($2)){
  27643. $self._error_("Imports must be Strings or Associations");
  27644. $ctx2.sendIdx["error:"]=1;
  27645. }
  27646. $5=$recv(import_)._key();
  27647. $ctx2.sendIdx["key"]=1;
  27648. $4=$recv($5)._isString();
  27649. $ctx2.sendIdx["isString"]=2;
  27650. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  27651. if(!$core.assert($3)){
  27652. $self._error_("Key and value must be Strings");
  27653. $ctx2.sendIdx["error:"]=2;
  27654. }
  27655. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  27656. if(!$core.assert($6)){
  27657. return $self._error_("Keys must be identifiers");
  27658. }
  27659. }
  27660. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  27661. }));
  27662. return self;
  27663. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection})});
  27664. },
  27665. args: ["aCollection"],
  27666. 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' ]]]",
  27667. referencedClasses: [],
  27668. pragmas: [],
  27669. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  27670. }),
  27671. $globals.Package);
  27672. $core.setSlots($globals.Package.a$cls, ["defaultCommitPathJs", "defaultCommitPathSt"]);
  27673. $core.addMethod(
  27674. $core.method({
  27675. selector: "named:",
  27676. protocol: "accessing",
  27677. fn: function (aPackageName){
  27678. var self=this,$self=this;
  27679. return $core.withContext(function($ctx1) {
  27680. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  27681. return $core.withContext(function($ctx2) {
  27682. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  27683. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27684. }));
  27685. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName})});
  27686. },
  27687. args: ["aPackageName"],
  27688. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  27689. referencedClasses: ["Smalltalk"],
  27690. pragmas: [],
  27691. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  27692. }),
  27693. $globals.Package.a$cls);
  27694. $core.addMethod(
  27695. $core.method({
  27696. selector: "named:ifAbsent:",
  27697. protocol: "accessing",
  27698. fn: function (aPackageName,aBlock){
  27699. var self=this,$self=this;
  27700. return $core.withContext(function($ctx1) {
  27701. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  27702. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock})});
  27703. },
  27704. args: ["aPackageName", "aBlock"],
  27705. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  27706. referencedClasses: ["Smalltalk"],
  27707. pragmas: [],
  27708. messageSends: ["packageAt:ifAbsent:"]
  27709. }),
  27710. $globals.Package.a$cls);
  27711. $core.addMethod(
  27712. $core.method({
  27713. selector: "named:imports:transport:",
  27714. protocol: "accessing",
  27715. fn: function (aPackageName,anArray,aTransport){
  27716. var self=this,$self=this;
  27717. var pkg;
  27718. return $core.withContext(function($ctx1) {
  27719. pkg=$self._named_(aPackageName);
  27720. $recv(pkg)._imports_(anArray);
  27721. $recv(pkg)._transport_(aTransport);
  27722. return pkg;
  27723. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg})});
  27724. },
  27725. args: ["aPackageName", "anArray", "aTransport"],
  27726. 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",
  27727. referencedClasses: [],
  27728. pragmas: [],
  27729. messageSends: ["named:", "imports:", "transport:"]
  27730. }),
  27731. $globals.Package.a$cls);
  27732. $core.addMethod(
  27733. $core.method({
  27734. selector: "named:javaScriptDescriptor:",
  27735. protocol: "instance creation",
  27736. fn: function (aString,anObject){
  27737. var self=this,$self=this;
  27738. var pkg;
  27739. return $core.withContext(function($ctx1) {
  27740. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  27741. $recv(pkg)._javaScriptDescriptor_(anObject);
  27742. return pkg;
  27743. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg})});
  27744. },
  27745. args: ["aString", "anObject"],
  27746. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  27747. referencedClasses: ["Smalltalk"],
  27748. pragmas: [],
  27749. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  27750. }),
  27751. $globals.Package.a$cls);
  27752. $core.addMethod(
  27753. $core.method({
  27754. selector: "named:transport:",
  27755. protocol: "accessing",
  27756. fn: function (aPackageName,aTransport){
  27757. var self=this,$self=this;
  27758. var pkg;
  27759. return $core.withContext(function($ctx1) {
  27760. pkg=$self._named_(aPackageName);
  27761. $recv(pkg)._transport_(aTransport);
  27762. return pkg;
  27763. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg})});
  27764. },
  27765. args: ["aPackageName", "aTransport"],
  27766. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  27767. referencedClasses: [],
  27768. pragmas: [],
  27769. messageSends: ["named:", "transport:"]
  27770. }),
  27771. $globals.Package.a$cls);
  27772. $core.addMethod(
  27773. $core.method({
  27774. selector: "new:",
  27775. protocol: "instance creation",
  27776. fn: function (aString){
  27777. var self=this,$self=this;
  27778. return $core.withContext(function($ctx1) {
  27779. var $1;
  27780. $1=$recv($globals.Package)._new();
  27781. $recv($1)._name_(aString);
  27782. return $recv($1)._yourself();
  27783. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString})});
  27784. },
  27785. args: ["aString"],
  27786. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  27787. referencedClasses: ["Package"],
  27788. pragmas: [],
  27789. messageSends: ["name:", "new", "yourself"]
  27790. }),
  27791. $globals.Package.a$cls);
  27792. $core.addMethod(
  27793. $core.method({
  27794. selector: "sortedClasses:",
  27795. protocol: "sorting",
  27796. fn: function (classes){
  27797. var self=this,$self=this;
  27798. return $core.withContext(function($ctx1) {
  27799. return $recv($globals.Array)._streamContents_((function(stream){
  27800. return $core.withContext(function($ctx2) {
  27801. return $recv(stream).__lt_lt($recv($globals.ClassBuilder)._sortClasses_(classes));
  27802. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  27803. }));
  27804. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes})});
  27805. },
  27806. args: ["classes"],
  27807. source: "sortedClasses: classes\x0a\x09^ Array streamContents: [ :stream | stream << (ClassBuilder sortClasses: classes) ]",
  27808. referencedClasses: ["Array", "ClassBuilder"],
  27809. pragmas: [],
  27810. messageSends: ["streamContents:", "<<", "sortClasses:"]
  27811. }),
  27812. $globals.Package.a$cls);
  27813. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  27814. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  27815. $core.addMethod(
  27816. $core.method({
  27817. selector: "announcer",
  27818. protocol: "accessing",
  27819. fn: function (){
  27820. var self=this,$self=this;
  27821. return $core.withContext(function($ctx1) {
  27822. return $recv($globals.SystemAnnouncer)._current();
  27823. }, function($ctx1) {$ctx1.fill(self,"announcer",{})});
  27824. },
  27825. args: [],
  27826. source: "announcer\x0a\x09^ SystemAnnouncer current",
  27827. referencedClasses: ["SystemAnnouncer"],
  27828. pragmas: [],
  27829. messageSends: ["current"]
  27830. }),
  27831. $globals.PackageStateObserver);
  27832. $core.addMethod(
  27833. $core.method({
  27834. selector: "observeSystem",
  27835. protocol: "actions",
  27836. fn: function (){
  27837. var self=this,$self=this;
  27838. return $core.withContext(function($ctx1) {
  27839. var $1;
  27840. $1=$self._announcer();
  27841. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  27842. $ctx1.sendIdx["on:send:to:"]=1;
  27843. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  27844. $ctx1.sendIdx["on:send:to:"]=2;
  27845. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  27846. $ctx1.sendIdx["on:send:to:"]=3;
  27847. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  27848. return self;
  27849. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{})});
  27850. },
  27851. args: [],
  27852. 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",
  27853. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  27854. pragmas: [],
  27855. messageSends: ["on:send:to:", "announcer"]
  27856. }),
  27857. $globals.PackageStateObserver);
  27858. $core.addMethod(
  27859. $core.method({
  27860. selector: "onClassModification:",
  27861. protocol: "reactions",
  27862. fn: function (anAnnouncement){
  27863. var self=this,$self=this;
  27864. return $core.withContext(function($ctx1) {
  27865. var $1,$receiver;
  27866. $1=$recv(anAnnouncement)._theClass();
  27867. if(($receiver = $1) == null || $receiver.a$nil){
  27868. $1;
  27869. } else {
  27870. var theClass;
  27871. theClass=$receiver;
  27872. $recv($recv(theClass)._package())._beDirty();
  27873. }
  27874. return self;
  27875. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement})});
  27876. },
  27877. args: ["anAnnouncement"],
  27878. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  27879. referencedClasses: [],
  27880. pragmas: [],
  27881. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  27882. }),
  27883. $globals.PackageStateObserver);
  27884. $core.addMethod(
  27885. $core.method({
  27886. selector: "onMethodModification:",
  27887. protocol: "reactions",
  27888. fn: function (anAnnouncement){
  27889. var self=this,$self=this;
  27890. return $core.withContext(function($ctx1) {
  27891. var $1,$receiver;
  27892. $1=$recv($recv(anAnnouncement)._method())._package();
  27893. if(($receiver = $1) == null || $receiver.a$nil){
  27894. $1;
  27895. } else {
  27896. var package_;
  27897. package_=$receiver;
  27898. $recv(package_)._beDirty();
  27899. }
  27900. return self;
  27901. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement})});
  27902. },
  27903. args: ["anAnnouncement"],
  27904. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  27905. referencedClasses: [],
  27906. pragmas: [],
  27907. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  27908. }),
  27909. $globals.PackageStateObserver);
  27910. $core.addMethod(
  27911. $core.method({
  27912. selector: "onPackageAdded:",
  27913. protocol: "reactions",
  27914. fn: function (anAnnouncement){
  27915. var self=this,$self=this;
  27916. return $core.withContext(function($ctx1) {
  27917. $recv($recv(anAnnouncement)._package())._beDirty();
  27918. return self;
  27919. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement})});
  27920. },
  27921. args: ["anAnnouncement"],
  27922. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  27923. referencedClasses: [],
  27924. pragmas: [],
  27925. messageSends: ["beDirty", "package"]
  27926. }),
  27927. $globals.PackageStateObserver);
  27928. $core.addMethod(
  27929. $core.method({
  27930. selector: "onProtocolModification:",
  27931. protocol: "reactions",
  27932. fn: function (anAnnouncement){
  27933. var self=this,$self=this;
  27934. return $core.withContext(function($ctx1) {
  27935. var $1,$receiver;
  27936. $1=$recv(anAnnouncement)._package();
  27937. if(($receiver = $1) == null || $receiver.a$nil){
  27938. $1;
  27939. } else {
  27940. var package_;
  27941. package_=$receiver;
  27942. $recv(package_)._beDirty();
  27943. }
  27944. return self;
  27945. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement})});
  27946. },
  27947. args: ["anAnnouncement"],
  27948. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  27949. referencedClasses: [],
  27950. pragmas: [],
  27951. messageSends: ["ifNotNil:", "package", "beDirty"]
  27952. }),
  27953. $globals.PackageStateObserver);
  27954. $core.setSlots($globals.PackageStateObserver.a$cls, ["current"]);
  27955. $core.addMethod(
  27956. $core.method({
  27957. selector: "current",
  27958. protocol: "accessing",
  27959. fn: function (){
  27960. var self=this,$self=this;
  27961. return $core.withContext(function($ctx1) {
  27962. var $1,$receiver;
  27963. $1=$self.current;
  27964. if(($receiver = $1) == null || $receiver.a$nil){
  27965. $self.current=$self._new();
  27966. return $self.current;
  27967. } else {
  27968. return $1;
  27969. }
  27970. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  27971. },
  27972. args: [],
  27973. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  27974. referencedClasses: [],
  27975. pragmas: [],
  27976. messageSends: ["ifNil:", "new"]
  27977. }),
  27978. $globals.PackageStateObserver.a$cls);
  27979. $core.addMethod(
  27980. $core.method({
  27981. selector: "initialize",
  27982. protocol: "initialization",
  27983. fn: function (){
  27984. var self=this,$self=this;
  27985. return $core.withContext(function($ctx1) {
  27986. $recv($self._current())._observeSystem();
  27987. return self;
  27988. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  27989. },
  27990. args: [],
  27991. source: "initialize\x0a\x09self current observeSystem",
  27992. referencedClasses: [],
  27993. pragmas: [],
  27994. messageSends: ["observeSystem", "current"]
  27995. }),
  27996. $globals.PackageStateObserver.a$cls);
  27997. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  27998. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  27999. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  28000. $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`";
  28001. $core.addMethod(
  28002. $core.method({
  28003. selector: "defaultValue",
  28004. protocol: "accessing",
  28005. fn: function (){
  28006. var self=this,$self=this;
  28007. return $self.defaultValue;
  28008. },
  28009. args: [],
  28010. source: "defaultValue\x0a\x09^ defaultValue",
  28011. referencedClasses: [],
  28012. pragmas: [],
  28013. messageSends: []
  28014. }),
  28015. $globals.Setting);
  28016. $core.addMethod(
  28017. $core.method({
  28018. selector: "defaultValue:",
  28019. protocol: "accessing",
  28020. fn: function (aStringifiableObject){
  28021. var self=this,$self=this;
  28022. $self.defaultValue=aStringifiableObject;
  28023. return self;
  28024. },
  28025. args: ["aStringifiableObject"],
  28026. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  28027. referencedClasses: [],
  28028. pragmas: [],
  28029. messageSends: []
  28030. }),
  28031. $globals.Setting);
  28032. $core.addMethod(
  28033. $core.method({
  28034. selector: "key",
  28035. protocol: "accessing",
  28036. fn: function (){
  28037. var self=this,$self=this;
  28038. return $self.key;
  28039. },
  28040. args: [],
  28041. source: "key\x0a\x09^ key",
  28042. referencedClasses: [],
  28043. pragmas: [],
  28044. messageSends: []
  28045. }),
  28046. $globals.Setting);
  28047. $core.addMethod(
  28048. $core.method({
  28049. selector: "key:",
  28050. protocol: "accessing",
  28051. fn: function (aString){
  28052. var self=this,$self=this;
  28053. $self.key=aString;
  28054. return self;
  28055. },
  28056. args: ["aString"],
  28057. source: "key: aString\x0a\x09key := aString",
  28058. referencedClasses: [],
  28059. pragmas: [],
  28060. messageSends: []
  28061. }),
  28062. $globals.Setting);
  28063. $core.addMethod(
  28064. $core.method({
  28065. selector: "value",
  28066. protocol: "accessing",
  28067. fn: function (){
  28068. var self=this,$self=this;
  28069. return $core.withContext(function($ctx1) {
  28070. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  28071. return $core.withContext(function($ctx2) {
  28072. return $self._defaultValue();
  28073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28074. }));
  28075. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  28076. },
  28077. args: [],
  28078. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  28079. referencedClasses: ["Smalltalk"],
  28080. pragmas: [],
  28081. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  28082. }),
  28083. $globals.Setting);
  28084. $core.addMethod(
  28085. $core.method({
  28086. selector: "value:",
  28087. protocol: "accessing",
  28088. fn: function (aStringifiableObject){
  28089. var self=this,$self=this;
  28090. return $core.withContext(function($ctx1) {
  28091. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  28092. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject})});
  28093. },
  28094. args: ["aStringifiableObject"],
  28095. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  28096. referencedClasses: ["Smalltalk"],
  28097. pragmas: [],
  28098. messageSends: ["at:put:", "settings", "key"]
  28099. }),
  28100. $globals.Setting);
  28101. $core.addMethod(
  28102. $core.method({
  28103. selector: "at:ifAbsent:",
  28104. protocol: "instance creation",
  28105. fn: function (aString,aDefaultValue){
  28106. var self=this,$self=this;
  28107. return $core.withContext(function($ctx1) {
  28108. var $1;
  28109. $1=(
  28110. $ctx1.supercall = true,
  28111. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  28112. $ctx1.supercall = false;
  28113. $recv($1)._key_(aString);
  28114. $recv($1)._defaultValue_(aDefaultValue);
  28115. return $recv($1)._yourself();
  28116. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue})});
  28117. },
  28118. args: ["aString", "aDefaultValue"],
  28119. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  28120. referencedClasses: [],
  28121. pragmas: [],
  28122. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  28123. }),
  28124. $globals.Setting.a$cls);
  28125. $core.addMethod(
  28126. $core.method({
  28127. selector: "new",
  28128. protocol: "instance creation",
  28129. fn: function (){
  28130. var self=this,$self=this;
  28131. return $core.withContext(function($ctx1) {
  28132. $self._shouldNotImplement();
  28133. return self;
  28134. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  28135. },
  28136. args: [],
  28137. source: "new\x0a\x09self shouldNotImplement",
  28138. referencedClasses: [],
  28139. pragmas: [],
  28140. messageSends: ["shouldNotImplement"]
  28141. }),
  28142. $globals.Setting.a$cls);
  28143. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  28144. $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.";
  28145. $core.addMethod(
  28146. $core.method({
  28147. selector: "addGlobalJsVariable:",
  28148. protocol: "globals",
  28149. fn: function (aString){
  28150. var self=this,$self=this;
  28151. return $core.withContext(function($ctx1) {
  28152. $recv($self._globalJsVariables())._add_(aString);
  28153. return self;
  28154. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString})});
  28155. },
  28156. args: ["aString"],
  28157. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  28158. referencedClasses: [],
  28159. pragmas: [],
  28160. messageSends: ["add:", "globalJsVariables"]
  28161. }),
  28162. $globals.SmalltalkImage);
  28163. $core.addMethod(
  28164. $core.method({
  28165. selector: "adoptPackageDescriptors",
  28166. protocol: "private",
  28167. fn: function (){
  28168. var self=this,$self=this;
  28169. return $core.withContext(function($ctx1) {
  28170. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  28171. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{})});
  28172. },
  28173. args: [],
  28174. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  28175. referencedClasses: ["Set"],
  28176. pragmas: [],
  28177. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  28178. }),
  28179. $globals.SmalltalkImage);
  28180. $core.addMethod(
  28181. $core.method({
  28182. selector: "amdRequire",
  28183. protocol: "accessing amd",
  28184. fn: function (){
  28185. var self=this,$self=this;
  28186. return $core.withContext(function($ctx1) {
  28187. return $recv($self._core())._at_("amdRequire");
  28188. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{})});
  28189. },
  28190. args: [],
  28191. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  28192. referencedClasses: [],
  28193. pragmas: [],
  28194. messageSends: ["at:", "core"]
  28195. }),
  28196. $globals.SmalltalkImage);
  28197. $core.addMethod(
  28198. $core.method({
  28199. selector: "asSmalltalkException:",
  28200. protocol: "error handling",
  28201. fn: function (anObject){
  28202. var self=this,$self=this;
  28203. return $core.withContext(function($ctx1) {
  28204. var $1;
  28205. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  28206. return $core.withContext(function($ctx2) {
  28207. return $recv(anObject)._isKindOf_($globals.Error);
  28208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28209. }));
  28210. if($core.assert($1)){
  28211. return anObject;
  28212. } else {
  28213. return $recv($globals.JavaScriptException)._on_(anObject);
  28214. }
  28215. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject})});
  28216. },
  28217. args: ["anObject"],
  28218. 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 ]",
  28219. referencedClasses: ["Error", "JavaScriptException"],
  28220. pragmas: [],
  28221. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  28222. }),
  28223. $globals.SmalltalkImage);
  28224. $core.addMethod(
  28225. $core.method({
  28226. selector: "basicCreatePackage:",
  28227. protocol: "private",
  28228. fn: function (packageName){
  28229. var self=this,$self=this;
  28230. return $core.withContext(function($ctx1) {
  28231. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  28232. return $core.withContext(function($ctx2) {
  28233. return $recv($globals.Package)._new_(packageName);
  28234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28235. }));
  28236. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName})});
  28237. },
  28238. args: ["packageName"],
  28239. 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 ]",
  28240. referencedClasses: ["Package"],
  28241. pragmas: [],
  28242. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  28243. }),
  28244. $globals.SmalltalkImage);
  28245. $core.addMethod(
  28246. $core.method({
  28247. selector: "basicParse:",
  28248. protocol: "private",
  28249. fn: function (aString){
  28250. var self=this,$self=this;
  28251. return $core.withContext(function($ctx1) {
  28252. return $recv(smalltalkParser)._parse_(aString);
  28253. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString})});
  28254. },
  28255. args: ["aString"],
  28256. source: "basicParse: aString\x0a\x09^ smalltalkParser parse: aString",
  28257. referencedClasses: [],
  28258. pragmas: [],
  28259. messageSends: ["parse:"]
  28260. }),
  28261. $globals.SmalltalkImage);
  28262. $core.addMethod(
  28263. $core.method({
  28264. selector: "beClean",
  28265. protocol: "packages",
  28266. fn: function (){
  28267. var self=this,$self=this;
  28268. return $core.withContext(function($ctx1) {
  28269. $recv($self._packages())._do_("beClean");
  28270. return self;
  28271. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  28272. },
  28273. args: [],
  28274. source: "beClean\x0a\x09\x22Marks all packages clean.\x22\x0a\x0a\x09self packages do: #beClean",
  28275. referencedClasses: [],
  28276. pragmas: [],
  28277. messageSends: ["do:", "packages"]
  28278. }),
  28279. $globals.SmalltalkImage);
  28280. $core.addMethod(
  28281. $core.method({
  28282. selector: "cancelOptOut:",
  28283. protocol: "accessing",
  28284. fn: function (anObject){
  28285. var self=this,$self=this;
  28286. return $core.withContext(function($ctx1) {
  28287. delete anObject.a$cls;;
  28288. return self;
  28289. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject})});
  28290. },
  28291. args: ["anObject"],
  28292. 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.a$cls;'>",
  28293. referencedClasses: [],
  28294. pragmas: [["inlineJS:", ["delete anObject.a$cls;"]]],
  28295. messageSends: []
  28296. }),
  28297. $globals.SmalltalkImage);
  28298. $core.addMethod(
  28299. $core.method({
  28300. selector: "classes",
  28301. protocol: "classes",
  28302. fn: function (){
  28303. var self=this,$self=this;
  28304. return $core.withContext(function($ctx1) {
  28305. return $recv($recv($self._core())._traitsOrClasses())._copy();
  28306. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  28307. },
  28308. args: [],
  28309. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  28310. referencedClasses: [],
  28311. pragmas: [],
  28312. messageSends: ["copy", "traitsOrClasses", "core"]
  28313. }),
  28314. $globals.SmalltalkImage);
  28315. $core.addMethod(
  28316. $core.method({
  28317. selector: "core",
  28318. protocol: "accessing",
  28319. fn: function (){
  28320. var self=this,$self=this;
  28321. return $core.withContext(function($ctx1) {
  28322. return $core;
  28323. return self;
  28324. }, function($ctx1) {$ctx1.fill(self,"core",{})});
  28325. },
  28326. args: [],
  28327. source: "core\x0a\x09<inlineJS: 'return $core'>",
  28328. referencedClasses: [],
  28329. pragmas: [["inlineJS:", ["return $core"]]],
  28330. messageSends: []
  28331. }),
  28332. $globals.SmalltalkImage);
  28333. $core.addMethod(
  28334. $core.method({
  28335. selector: "createPackage:",
  28336. protocol: "packages",
  28337. fn: function (packageName){
  28338. var self=this,$self=this;
  28339. var package_,announcement;
  28340. return $core.withContext(function($ctx1) {
  28341. var $1;
  28342. package_=$self._basicCreatePackage_(packageName);
  28343. $1=$recv($globals.PackageAdded)._new();
  28344. $recv($1)._package_(package_);
  28345. announcement=$recv($1)._yourself();
  28346. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  28347. return package_;
  28348. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement})});
  28349. },
  28350. args: ["packageName"],
  28351. 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",
  28352. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  28353. pragmas: [],
  28354. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  28355. }),
  28356. $globals.SmalltalkImage);
  28357. $core.addMethod(
  28358. $core.method({
  28359. selector: "defaultAmdNamespace",
  28360. protocol: "accessing amd",
  28361. fn: function (){
  28362. var self=this,$self=this;
  28363. return $core.withContext(function($ctx1) {
  28364. return "transport.defaultAmdNamespace"._settingValue();
  28365. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{})});
  28366. },
  28367. args: [],
  28368. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  28369. referencedClasses: [],
  28370. pragmas: [],
  28371. messageSends: ["settingValue"]
  28372. }),
  28373. $globals.SmalltalkImage);
  28374. $core.addMethod(
  28375. $core.method({
  28376. selector: "defaultAmdNamespace:",
  28377. protocol: "accessing amd",
  28378. fn: function (aString){
  28379. var self=this,$self=this;
  28380. return $core.withContext(function($ctx1) {
  28381. "transport.defaultAmdNamespace"._settingValue_(aString);
  28382. return self;
  28383. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString})});
  28384. },
  28385. args: ["aString"],
  28386. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  28387. referencedClasses: [],
  28388. pragmas: [],
  28389. messageSends: ["settingValue:"]
  28390. }),
  28391. $globals.SmalltalkImage);
  28392. $core.addMethod(
  28393. $core.method({
  28394. selector: "deleteClass:",
  28395. protocol: "private",
  28396. fn: function (aClass){
  28397. var self=this,$self=this;
  28398. return $core.withContext(function($ctx1) {
  28399. $core.removeClass(aClass);
  28400. return self;
  28401. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass})});
  28402. },
  28403. args: ["aClass"],
  28404. 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)'>",
  28405. referencedClasses: [],
  28406. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  28407. messageSends: []
  28408. }),
  28409. $globals.SmalltalkImage);
  28410. $core.addMethod(
  28411. $core.method({
  28412. selector: "deleteGlobalJsVariable:",
  28413. protocol: "globals",
  28414. fn: function (aString){
  28415. var self=this,$self=this;
  28416. return $core.withContext(function($ctx1) {
  28417. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  28418. }));
  28419. return self;
  28420. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString})});
  28421. },
  28422. args: ["aString"],
  28423. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  28424. referencedClasses: [],
  28425. pragmas: [],
  28426. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  28427. }),
  28428. $globals.SmalltalkImage);
  28429. $core.addMethod(
  28430. $core.method({
  28431. selector: "existsJsGlobal:",
  28432. protocol: "testing",
  28433. fn: function (aString){
  28434. var self=this,$self=this;
  28435. return $core.withContext(function($ctx1) {
  28436. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  28437. return $recv($globals.Platform)._includesGlobal_(aString);
  28438. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString})});
  28439. },
  28440. args: ["aString"],
  28441. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  28442. referencedClasses: ["Platform"],
  28443. pragmas: [],
  28444. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  28445. }),
  28446. $globals.SmalltalkImage);
  28447. $core.addMethod(
  28448. $core.method({
  28449. selector: "globalJsVariables",
  28450. protocol: "globals",
  28451. fn: function (){
  28452. var self=this,$self=this;
  28453. return $core.withContext(function($ctx1) {
  28454. var $1,$receiver;
  28455. $1=$self.globalJsVariables;
  28456. if(($receiver = $1) == null || $receiver.a$nil){
  28457. $self.globalJsVariables=["window", "document", "process", "global"];
  28458. return $self.globalJsVariables;
  28459. } else {
  28460. return $1;
  28461. }
  28462. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{})});
  28463. },
  28464. args: [],
  28465. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  28466. referencedClasses: [],
  28467. pragmas: [],
  28468. messageSends: ["ifNil:"]
  28469. }),
  28470. $globals.SmalltalkImage);
  28471. $core.addMethod(
  28472. $core.method({
  28473. selector: "globals",
  28474. protocol: "accessing",
  28475. fn: function (){
  28476. var self=this,$self=this;
  28477. return $core.withContext(function($ctx1) {
  28478. return $globals;
  28479. return self;
  28480. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  28481. },
  28482. args: [],
  28483. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  28484. referencedClasses: [],
  28485. pragmas: [["inlineJS:", ["return $globals"]]],
  28486. messageSends: []
  28487. }),
  28488. $globals.SmalltalkImage);
  28489. $core.addMethod(
  28490. $core.method({
  28491. selector: "isSmalltalkObject:",
  28492. protocol: "testing",
  28493. fn: function (anObject){
  28494. var self=this,$self=this;
  28495. return $core.withContext(function($ctx1) {
  28496. return anObject.a$cls != null;
  28497. return self;
  28498. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject})});
  28499. },
  28500. args: ["anObject"],
  28501. 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'>",
  28502. referencedClasses: [],
  28503. pragmas: [["inlineJS:", ["return anObject.a$cls != null"]]],
  28504. messageSends: []
  28505. }),
  28506. $globals.SmalltalkImage);
  28507. $core.addMethod(
  28508. $core.method({
  28509. selector: "optOut:",
  28510. protocol: "accessing",
  28511. fn: function (anObject){
  28512. var self=this,$self=this;
  28513. return $core.withContext(function($ctx1) {
  28514. anObject.a$cls = null;
  28515. return self;
  28516. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject})});
  28517. },
  28518. args: ["anObject"],
  28519. 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.a$cls = null'>",
  28520. referencedClasses: [],
  28521. pragmas: [["inlineJS:", ["anObject.a$cls = null"]]],
  28522. messageSends: []
  28523. }),
  28524. $globals.SmalltalkImage);
  28525. $core.addMethod(
  28526. $core.method({
  28527. selector: "packageAt:ifAbsent:",
  28528. protocol: "packages",
  28529. fn: function (packageName,aBlock){
  28530. var self=this,$self=this;
  28531. return $core.withContext(function($ctx1) {
  28532. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  28533. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock})});
  28534. },
  28535. args: ["packageName", "aBlock"],
  28536. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  28537. referencedClasses: [],
  28538. pragmas: [],
  28539. messageSends: ["at:ifAbsent:", "packageDictionary"]
  28540. }),
  28541. $globals.SmalltalkImage);
  28542. $core.addMethod(
  28543. $core.method({
  28544. selector: "packageAt:ifPresent:",
  28545. protocol: "packages",
  28546. fn: function (packageName,aBlock){
  28547. var self=this,$self=this;
  28548. return $core.withContext(function($ctx1) {
  28549. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  28550. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock})});
  28551. },
  28552. args: ["packageName", "aBlock"],
  28553. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  28554. referencedClasses: [],
  28555. pragmas: [],
  28556. messageSends: ["at:ifPresent:", "packageDictionary"]
  28557. }),
  28558. $globals.SmalltalkImage);
  28559. $core.addMethod(
  28560. $core.method({
  28561. selector: "packageDictionary",
  28562. protocol: "packages",
  28563. fn: function (){
  28564. var self=this,$self=this;
  28565. return $core.withContext(function($ctx1) {
  28566. var $1,$receiver;
  28567. $1=$self.packageDictionary;
  28568. if(($receiver = $1) == null || $receiver.a$nil){
  28569. $self.packageDictionary=$recv($globals.Dictionary)._new();
  28570. return $self.packageDictionary;
  28571. } else {
  28572. return $1;
  28573. }
  28574. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{})});
  28575. },
  28576. args: [],
  28577. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  28578. referencedClasses: ["Dictionary"],
  28579. pragmas: [],
  28580. messageSends: ["ifNil:", "new"]
  28581. }),
  28582. $globals.SmalltalkImage);
  28583. $core.addMethod(
  28584. $core.method({
  28585. selector: "packages",
  28586. protocol: "packages",
  28587. fn: function (){
  28588. var self=this,$self=this;
  28589. return $core.withContext(function($ctx1) {
  28590. return $recv($recv($self._packageDictionary())._values())._copy();
  28591. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  28592. },
  28593. args: [],
  28594. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  28595. referencedClasses: [],
  28596. pragmas: [],
  28597. messageSends: ["copy", "values", "packageDictionary"]
  28598. }),
  28599. $globals.SmalltalkImage);
  28600. $core.addMethod(
  28601. $core.method({
  28602. selector: "parse:",
  28603. protocol: "accessing",
  28604. fn: function (aString){
  28605. var self=this,$self=this;
  28606. var result;
  28607. return $core.withContext(function($ctx1) {
  28608. var $1;
  28609. $recv((function(){
  28610. return $core.withContext(function($ctx2) {
  28611. result=$self._basicParse_(aString);
  28612. return result;
  28613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28614. }))._tryCatch_((function(ex){
  28615. return $core.withContext(function($ctx2) {
  28616. return $recv($self._parseError_parsing_(ex,aString))._signal();
  28617. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  28618. }));
  28619. $1=result;
  28620. $recv($1)._source_(aString);
  28621. return $recv($1)._yourself();
  28622. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result})});
  28623. },
  28624. args: ["aString"],
  28625. 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",
  28626. referencedClasses: [],
  28627. pragmas: [],
  28628. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  28629. }),
  28630. $globals.SmalltalkImage);
  28631. $core.addMethod(
  28632. $core.method({
  28633. selector: "parseError:parsing:",
  28634. protocol: "error handling",
  28635. fn: function (anException,aString){
  28636. var self=this,$self=this;
  28637. return $core.withContext(function($ctx1) {
  28638. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  28639. $1=$recv(anException)._basicAt_("location");
  28640. $ctx1.sendIdx["basicAt:"]=1;
  28641. if(($receiver = $1) == null || $receiver.a$nil){
  28642. return $recv(anException)._pass();
  28643. } else {
  28644. var loc;
  28645. loc=$receiver;
  28646. $2=$recv($globals.ParseError)._new();
  28647. $9=$recv(loc)._start();
  28648. $ctx1.sendIdx["start"]=1;
  28649. $8=$recv($9)._line();
  28650. $7="Parse error on line ".__comma($8);
  28651. $6=$recv($7).__comma(" column ");
  28652. $ctx1.sendIdx[","]=4;
  28653. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  28654. $ctx1.sendIdx[","]=3;
  28655. $4=$recv($5).__comma(" : Unexpected character ");
  28656. $ctx1.sendIdx[","]=2;
  28657. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  28658. $ctx1.sendIdx[","]=1;
  28659. $recv($2)._messageText_($3);
  28660. return $recv($2)._yourself();
  28661. }
  28662. return self;
  28663. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString})});
  28664. },
  28665. args: ["anException", "aString"],
  28666. 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 ]",
  28667. referencedClasses: ["ParseError"],
  28668. pragmas: [],
  28669. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  28670. }),
  28671. $globals.SmalltalkImage);
  28672. $core.addMethod(
  28673. $core.method({
  28674. selector: "postLoad",
  28675. protocol: "image",
  28676. fn: function (){
  28677. var self=this,$self=this;
  28678. return $core.withContext(function($ctx1) {
  28679. var $1;
  28680. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  28681. var classes;
  28682. return $core.withContext(function($ctx2) {
  28683. $recv(pkgs)._do_("beClean");
  28684. $ctx2.sendIdx["do:"]=1;
  28685. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  28686. return $core.withContext(function($ctx3) {
  28687. return $recv(pkgs)._includes_($recv(each)._package());
  28688. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  28689. }));
  28690. $recv(classes)._do_((function(each){
  28691. return $core.withContext(function($ctx3) {
  28692. $1=$recv(each).__eq($self._class());
  28693. if(!$core.assert($1)){
  28694. return $recv(each)._initialize();
  28695. }
  28696. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  28697. }));
  28698. return $self._sweepPackageDescriptors_(pkgs);
  28699. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  28700. }));
  28701. }, function($ctx1) {$ctx1.fill(self,"postLoad",{})});
  28702. },
  28703. args: [],
  28704. source: "postLoad\x0a\x09^ self adoptPackageDescriptors then: [ :pkgs |\x0a\x09\x09| classes |\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 ]",
  28705. referencedClasses: ["Smalltalk"],
  28706. pragmas: [],
  28707. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  28708. }),
  28709. $globals.SmalltalkImage);
  28710. $core.addMethod(
  28711. $core.method({
  28712. selector: "pseudoVariableNames",
  28713. protocol: "accessing",
  28714. fn: function (){
  28715. var self=this,$self=this;
  28716. return ["self", "super", "nil", "true", "false", "thisContext"];
  28717. },
  28718. args: [],
  28719. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  28720. referencedClasses: [],
  28721. pragmas: [],
  28722. messageSends: []
  28723. }),
  28724. $globals.SmalltalkImage);
  28725. $core.addMethod(
  28726. $core.method({
  28727. selector: "readJSObject:",
  28728. protocol: "accessing",
  28729. fn: function (anObject){
  28730. var self=this,$self=this;
  28731. return $core.withContext(function($ctx1) {
  28732. return $core.readJSObject(anObject);
  28733. return self;
  28734. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject})});
  28735. },
  28736. args: ["anObject"],
  28737. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  28738. referencedClasses: [],
  28739. pragmas: [["inlineJS:", ["return $core.readJSObject(anObject)"]]],
  28740. messageSends: []
  28741. }),
  28742. $globals.SmalltalkImage);
  28743. $core.addMethod(
  28744. $core.method({
  28745. selector: "removeClass:",
  28746. protocol: "classes",
  28747. fn: function (aClass){
  28748. var self=this,$self=this;
  28749. return $core.withContext(function($ctx1) {
  28750. var $1,$2,$5,$4,$6,$3,$7,$9,$8;
  28751. $1=$recv(aClass)._isMetaclass();
  28752. if($core.assert($1)){
  28753. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  28754. $ctx1.sendIdx[","]=1;
  28755. $self._error_($2);
  28756. $ctx1.sendIdx["error:"]=1;
  28757. }
  28758. $recv(aClass)._allSubclassesDo_((function(subclass){
  28759. return $core.withContext(function($ctx2) {
  28760. $5=$recv(aClass)._name();
  28761. $ctx2.sendIdx["name"]=1;
  28762. $4=$recv($5).__comma(" has a subclass: ");
  28763. $ctx2.sendIdx[","]=3;
  28764. $6=$recv(subclass)._name();
  28765. $ctx2.sendIdx["name"]=2;
  28766. $3=$recv($4).__comma($6);
  28767. $ctx2.sendIdx[","]=2;
  28768. return $self._error_($3);
  28769. $ctx2.sendIdx["error:"]=2;
  28770. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  28771. }));
  28772. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  28773. return $core.withContext(function($ctx2) {
  28774. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  28775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  28776. }));
  28777. $self._deleteClass_(aClass);
  28778. $recv(aClass)._includingPossibleMetaDo_((function(each){
  28779. return $core.withContext(function($ctx2) {
  28780. return $recv(each)._setTraitComposition_([]);
  28781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  28782. }));
  28783. $7=$recv($globals.SystemAnnouncer)._current();
  28784. $9=$recv($globals.ClassRemoved)._new();
  28785. $recv($9)._theClass_(aClass);
  28786. $8=$recv($9)._yourself();
  28787. $recv($7)._announce_($8);
  28788. return self;
  28789. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  28790. },
  28791. args: ["aClass"],
  28792. 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 includingPossibleMetaDo: [ :each | each setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  28793. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  28794. pragmas: [],
  28795. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "includingPossibleMetaDo:", "setTraitComposition:", "announce:", "current", "theClass:", "new", "yourself"]
  28796. }),
  28797. $globals.SmalltalkImage);
  28798. $core.addMethod(
  28799. $core.method({
  28800. selector: "removePackage:",
  28801. protocol: "packages",
  28802. fn: function (packageName){
  28803. var self=this,$self=this;
  28804. var pkg;
  28805. return $core.withContext(function($ctx1) {
  28806. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  28807. return $core.withContext(function($ctx2) {
  28808. return $self._error_("Missing package: ".__comma(packageName));
  28809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28810. }));
  28811. $recv($recv(pkg)._classes())._do_((function(each){
  28812. return $core.withContext(function($ctx2) {
  28813. return $self._removeClass_(each);
  28814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28815. }));
  28816. $recv($self._packageDictionary())._removeKey_(packageName);
  28817. return self;
  28818. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg})});
  28819. },
  28820. args: ["packageName"],
  28821. 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",
  28822. referencedClasses: [],
  28823. pragmas: [],
  28824. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  28825. }),
  28826. $globals.SmalltalkImage);
  28827. $core.addMethod(
  28828. $core.method({
  28829. selector: "renamePackage:to:",
  28830. protocol: "packages",
  28831. fn: function (packageName,newName){
  28832. var self=this,$self=this;
  28833. var pkg;
  28834. return $core.withContext(function($ctx1) {
  28835. var $1,$2,$3;
  28836. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  28837. return $core.withContext(function($ctx2) {
  28838. $1="Missing package: ".__comma(packageName);
  28839. $ctx2.sendIdx[","]=1;
  28840. return $self._error_($1);
  28841. $ctx2.sendIdx["error:"]=1;
  28842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28843. }));
  28844. $self._packageAt_ifPresent_(newName,(function(){
  28845. return $core.withContext(function($ctx2) {
  28846. return $self._error_("Already exists a package called: ".__comma(newName));
  28847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28848. }));
  28849. $2=pkg;
  28850. $recv($2)._name_(newName);
  28851. $recv($2)._beDirty();
  28852. $3=$self._packageDictionary();
  28853. $recv($3)._at_put_(newName,pkg);
  28854. $recv($3)._removeKey_(packageName);
  28855. return self;
  28856. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg})});
  28857. },
  28858. args: ["packageName", "newName"],
  28859. 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",
  28860. referencedClasses: [],
  28861. pragmas: [],
  28862. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  28863. }),
  28864. $globals.SmalltalkImage);
  28865. $core.addMethod(
  28866. $core.method({
  28867. selector: "reservedWords",
  28868. protocol: "accessing",
  28869. fn: function (){
  28870. var self=this,$self=this;
  28871. 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"];
  28872. },
  28873. args: [],
  28874. 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)",
  28875. referencedClasses: [],
  28876. pragmas: [],
  28877. messageSends: []
  28878. }),
  28879. $globals.SmalltalkImage);
  28880. $core.addMethod(
  28881. $core.method({
  28882. selector: "settings",
  28883. protocol: "accessing",
  28884. fn: function (){
  28885. var self=this,$self=this;
  28886. return $globals.SmalltalkSettings;
  28887. },
  28888. args: [],
  28889. source: "settings\x0a\x09^ SmalltalkSettings",
  28890. referencedClasses: ["SmalltalkSettings"],
  28891. pragmas: [],
  28892. messageSends: []
  28893. }),
  28894. $globals.SmalltalkImage);
  28895. $core.addMethod(
  28896. $core.method({
  28897. selector: "sweepPackageDescriptors:",
  28898. protocol: "private",
  28899. fn: function (pkgs){
  28900. var self=this,$self=this;
  28901. var pd;
  28902. return $core.withContext(function($ctx1) {
  28903. pd=$recv($self._core())._packageDescriptors();
  28904. $recv(pkgs)._do_((function(each){
  28905. return $core.withContext(function($ctx2) {
  28906. return $recv(pd)._removeKey_($recv(each)._name());
  28907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28908. }));
  28909. return self;
  28910. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd})});
  28911. },
  28912. args: ["pkgs"],
  28913. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  28914. referencedClasses: [],
  28915. pragmas: [],
  28916. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  28917. }),
  28918. $globals.SmalltalkImage);
  28919. $core.addMethod(
  28920. $core.method({
  28921. selector: "tryAdoptPackageDescriptorsBeyond:",
  28922. protocol: "private",
  28923. fn: function (aSet){
  28924. var self=this,$self=this;
  28925. var original;
  28926. return $core.withContext(function($ctx1) {
  28927. var $1;
  28928. original=$recv(aSet)._copy();
  28929. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  28930. return $core.withContext(function($ctx2) {
  28931. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  28932. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  28933. }));
  28934. $1=$recv(aSet)._allSatisfy_((function(each){
  28935. return $core.withContext(function($ctx2) {
  28936. return $recv(original)._includes_(each);
  28937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28938. }));
  28939. if($core.assert($1)){
  28940. return $recv($globals.Promise)._value_(aSet);
  28941. } else {
  28942. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  28943. return $core.withContext(function($ctx2) {
  28944. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  28945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  28946. }));
  28947. }
  28948. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original})});
  28949. },
  28950. args: ["aSet"],
  28951. source: "tryAdoptPackageDescriptorsBeyond: aSet\x0a\x09| original |\x0a\x09original := aSet copy.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09aSet add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ (aSet allSatisfy: [ :each | original includes: each ])\x0a\x09\x09ifFalse: [ (Promise all: (aSet collect: #isReady)) then: [ self tryAdoptPackageDescriptorsBeyond: aSet ] ]\x0a\x09\x09ifTrue: [ Promise value: aSet ]",
  28952. referencedClasses: ["Package", "Promise"],
  28953. pragmas: [],
  28954. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  28955. }),
  28956. $globals.SmalltalkImage);
  28957. $core.addMethod(
  28958. $core.method({
  28959. selector: "version",
  28960. protocol: "accessing",
  28961. fn: function (){
  28962. var self=this,$self=this;
  28963. return "0.23.2";
  28964. },
  28965. args: [],
  28966. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.2'",
  28967. referencedClasses: [],
  28968. pragmas: [],
  28969. messageSends: []
  28970. }),
  28971. $globals.SmalltalkImage);
  28972. $core.setSlots($globals.SmalltalkImage.a$cls, ["current"]);
  28973. $core.addMethod(
  28974. $core.method({
  28975. selector: "current",
  28976. protocol: "instance creation",
  28977. fn: function (){
  28978. var self=this,$self=this;
  28979. return $core.withContext(function($ctx1) {
  28980. var $1,$receiver;
  28981. $1=$self.current;
  28982. if(($receiver = $1) == null || $receiver.a$nil){
  28983. $self.current=(
  28984. $ctx1.supercall = true,
  28985. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  28986. $ctx1.supercall = false;
  28987. return $self.current;
  28988. } else {
  28989. $self._deprecatedAPI();
  28990. return $self.current;
  28991. }
  28992. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  28993. },
  28994. args: [],
  28995. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  28996. referencedClasses: [],
  28997. pragmas: [],
  28998. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  28999. }),
  29000. $globals.SmalltalkImage.a$cls);
  29001. $core.addMethod(
  29002. $core.method({
  29003. selector: "initialize",
  29004. protocol: "initialization",
  29005. fn: function (){
  29006. var self=this,$self=this;
  29007. var st;
  29008. return $core.withContext(function($ctx1) {
  29009. st=$self._current();
  29010. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  29011. return self;
  29012. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st})});
  29013. },
  29014. args: [],
  29015. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  29016. referencedClasses: [],
  29017. pragmas: [],
  29018. messageSends: ["current", "at:put:", "globals"]
  29019. }),
  29020. $globals.SmalltalkImage.a$cls);
  29021. $core.addMethod(
  29022. $core.method({
  29023. selector: "new",
  29024. protocol: "instance creation",
  29025. fn: function (){
  29026. var self=this,$self=this;
  29027. return $core.withContext(function($ctx1) {
  29028. $self._shouldNotImplement();
  29029. return self;
  29030. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  29031. },
  29032. args: [],
  29033. source: "new\x0a\x09self shouldNotImplement",
  29034. referencedClasses: [],
  29035. pragmas: [],
  29036. messageSends: ["shouldNotImplement"]
  29037. }),
  29038. $globals.SmalltalkImage.a$cls);
  29039. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  29040. $core.addMethod(
  29041. $core.method({
  29042. selector: "nextPutJSObject:",
  29043. protocol: "*Kernel-Infrastructure",
  29044. fn: function (aJSObject){
  29045. var self=this,$self=this;
  29046. return $core.withContext(function($ctx1) {
  29047. $self._nextPut_(aJSObject);
  29048. return self;
  29049. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject})});
  29050. },
  29051. args: ["aJSObject"],
  29052. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  29053. referencedClasses: [],
  29054. pragmas: [],
  29055. messageSends: ["nextPut:"]
  29056. }),
  29057. $globals.ProtoStream);
  29058. $core.addMethod(
  29059. $core.method({
  29060. selector: "asJavaScriptPropertyName",
  29061. protocol: "*Kernel-Infrastructure",
  29062. fn: function (){
  29063. var self=this,$self=this;
  29064. return $core.withContext(function($ctx1) {
  29065. return $core.st2prop(self);
  29066. return self;
  29067. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{})});
  29068. },
  29069. args: [],
  29070. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  29071. referencedClasses: [],
  29072. pragmas: [["inlineJS:", ["return $core.st2prop(self)"]]],
  29073. messageSends: []
  29074. }),
  29075. $globals.String);
  29076. $core.addMethod(
  29077. $core.method({
  29078. selector: "asSetting",
  29079. protocol: "*Kernel-Infrastructure",
  29080. fn: function (){
  29081. var self=this,$self=this;
  29082. return $core.withContext(function($ctx1) {
  29083. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  29084. }, function($ctx1) {$ctx1.fill(self,"asSetting",{})});
  29085. },
  29086. args: [],
  29087. 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",
  29088. referencedClasses: ["Setting"],
  29089. pragmas: [],
  29090. messageSends: ["at:ifAbsent:"]
  29091. }),
  29092. $globals.String);
  29093. $core.addMethod(
  29094. $core.method({
  29095. selector: "asSettingIfAbsent:",
  29096. protocol: "*Kernel-Infrastructure",
  29097. fn: function (aDefaultValue){
  29098. var self=this,$self=this;
  29099. return $core.withContext(function($ctx1) {
  29100. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  29101. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue})});
  29102. },
  29103. args: ["aDefaultValue"],
  29104. 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",
  29105. referencedClasses: ["Setting"],
  29106. pragmas: [],
  29107. messageSends: ["at:ifAbsent:"]
  29108. }),
  29109. $globals.String);
  29110. $core.addMethod(
  29111. $core.method({
  29112. selector: "settingValue",
  29113. protocol: "*Kernel-Infrastructure",
  29114. fn: function (){
  29115. var self=this,$self=this;
  29116. return $core.withContext(function($ctx1) {
  29117. return $recv($self._asSetting())._value();
  29118. }, function($ctx1) {$ctx1.fill(self,"settingValue",{})});
  29119. },
  29120. args: [],
  29121. source: "settingValue\x0a\x09^ self asSetting value",
  29122. referencedClasses: [],
  29123. pragmas: [],
  29124. messageSends: ["value", "asSetting"]
  29125. }),
  29126. $globals.String);
  29127. $core.addMethod(
  29128. $core.method({
  29129. selector: "settingValue:",
  29130. protocol: "*Kernel-Infrastructure",
  29131. fn: function (aValue){
  29132. var self=this,$self=this;
  29133. return $core.withContext(function($ctx1) {
  29134. return $recv($self._asSetting())._value_(aValue);
  29135. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue})});
  29136. },
  29137. args: ["aValue"],
  29138. 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",
  29139. referencedClasses: [],
  29140. pragmas: [],
  29141. messageSends: ["value:", "asSetting"]
  29142. }),
  29143. $globals.String);
  29144. $core.addMethod(
  29145. $core.method({
  29146. selector: "settingValueIfAbsent:",
  29147. protocol: "*Kernel-Infrastructure",
  29148. fn: function (aDefaultValue){
  29149. var self=this,$self=this;
  29150. return $core.withContext(function($ctx1) {
  29151. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  29152. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue})});
  29153. },
  29154. args: ["aDefaultValue"],
  29155. 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",
  29156. referencedClasses: [],
  29157. pragmas: [],
  29158. messageSends: ["value", "asSettingIfAbsent:"]
  29159. }),
  29160. $globals.String);
  29161. });
  29162. define('amber/core/Kernel-Announcements',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  29163. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  29164. var $pkg = $core.addPackage("Kernel-Announcements");
  29165. $pkg.innerEval = function (expr) { return eval(expr); };
  29166. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  29167. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  29168. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  29169. $core.addMethod(
  29170. $core.method({
  29171. selector: "announcementClass",
  29172. protocol: "accessing",
  29173. fn: function (){
  29174. var self=this,$self=this;
  29175. return $self.announcementClass;
  29176. },
  29177. args: [],
  29178. source: "announcementClass\x0a\x09^ announcementClass",
  29179. referencedClasses: [],
  29180. pragmas: [],
  29181. messageSends: []
  29182. }),
  29183. $globals.AnnouncementSubscription);
  29184. $core.addMethod(
  29185. $core.method({
  29186. selector: "announcementClass:",
  29187. protocol: "accessing",
  29188. fn: function (aClass){
  29189. var self=this,$self=this;
  29190. return $core.withContext(function($ctx1) {
  29191. $self.announcementClass=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  29192. return self;
  29193. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass})});
  29194. },
  29195. args: ["aClass"],
  29196. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  29197. referencedClasses: ["Smalltalk"],
  29198. pragmas: [],
  29199. messageSends: ["at:", "globals", "name"]
  29200. }),
  29201. $globals.AnnouncementSubscription);
  29202. $core.addMethod(
  29203. $core.method({
  29204. selector: "deliver:",
  29205. protocol: "announcing",
  29206. fn: function (anAnnouncement){
  29207. var self=this,$self=this;
  29208. return $core.withContext(function($ctx1) {
  29209. var $1;
  29210. $1=$self._handlesAnnouncement_(anAnnouncement);
  29211. if($core.assert($1)){
  29212. $recv($self._valuable())._value_(anAnnouncement);
  29213. }
  29214. return self;
  29215. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement})});
  29216. },
  29217. args: ["anAnnouncement"],
  29218. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  29219. referencedClasses: [],
  29220. pragmas: [],
  29221. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  29222. }),
  29223. $globals.AnnouncementSubscription);
  29224. $core.addMethod(
  29225. $core.method({
  29226. selector: "handlesAnnouncement:",
  29227. protocol: "announcing",
  29228. fn: function (anAnnouncement){
  29229. var self=this,$self=this;
  29230. return $core.withContext(function($ctx1) {
  29231. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  29232. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement})});
  29233. },
  29234. args: ["anAnnouncement"],
  29235. 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",
  29236. referencedClasses: ["Smalltalk"],
  29237. pragmas: [],
  29238. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  29239. }),
  29240. $globals.AnnouncementSubscription);
  29241. $core.addMethod(
  29242. $core.method({
  29243. selector: "receiver",
  29244. protocol: "accessing",
  29245. fn: function (){
  29246. var self=this,$self=this;
  29247. return $core.withContext(function($ctx1) {
  29248. return $recv($self._valuable())._receiver();
  29249. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  29250. },
  29251. args: [],
  29252. source: "receiver\x0a\x09^ self valuable receiver",
  29253. referencedClasses: [],
  29254. pragmas: [],
  29255. messageSends: ["receiver", "valuable"]
  29256. }),
  29257. $globals.AnnouncementSubscription);
  29258. $core.addMethod(
  29259. $core.method({
  29260. selector: "valuable",
  29261. protocol: "accessing",
  29262. fn: function (){
  29263. var self=this,$self=this;
  29264. return $self.valuable;
  29265. },
  29266. args: [],
  29267. source: "valuable\x0a\x09^ valuable",
  29268. referencedClasses: [],
  29269. pragmas: [],
  29270. messageSends: []
  29271. }),
  29272. $globals.AnnouncementSubscription);
  29273. $core.addMethod(
  29274. $core.method({
  29275. selector: "valuable:",
  29276. protocol: "accessing",
  29277. fn: function (aValuable){
  29278. var self=this,$self=this;
  29279. $self.valuable=aValuable;
  29280. return self;
  29281. },
  29282. args: ["aValuable"],
  29283. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  29284. referencedClasses: [],
  29285. pragmas: [],
  29286. messageSends: []
  29287. }),
  29288. $globals.AnnouncementSubscription);
  29289. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  29290. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  29291. $core.addMethod(
  29292. $core.method({
  29293. selector: "receiver",
  29294. protocol: "accessing",
  29295. fn: function (){
  29296. var self=this,$self=this;
  29297. return $self.receiver;
  29298. },
  29299. args: [],
  29300. source: "receiver\x0a\x09^ receiver",
  29301. referencedClasses: [],
  29302. pragmas: [],
  29303. messageSends: []
  29304. }),
  29305. $globals.AnnouncementValuable);
  29306. $core.addMethod(
  29307. $core.method({
  29308. selector: "receiver:",
  29309. protocol: "accessing",
  29310. fn: function (anObject){
  29311. var self=this,$self=this;
  29312. $self.receiver=anObject;
  29313. return self;
  29314. },
  29315. args: ["anObject"],
  29316. source: "receiver: anObject\x0a\x09receiver := anObject",
  29317. referencedClasses: [],
  29318. pragmas: [],
  29319. messageSends: []
  29320. }),
  29321. $globals.AnnouncementValuable);
  29322. $core.addMethod(
  29323. $core.method({
  29324. selector: "valuable",
  29325. protocol: "accessing",
  29326. fn: function (){
  29327. var self=this,$self=this;
  29328. return $self.valuable;
  29329. },
  29330. args: [],
  29331. source: "valuable\x0a\x09^ valuable",
  29332. referencedClasses: [],
  29333. pragmas: [],
  29334. messageSends: []
  29335. }),
  29336. $globals.AnnouncementValuable);
  29337. $core.addMethod(
  29338. $core.method({
  29339. selector: "valuable:",
  29340. protocol: "accessing",
  29341. fn: function (anObject){
  29342. var self=this,$self=this;
  29343. $self.valuable=anObject;
  29344. return self;
  29345. },
  29346. args: ["anObject"],
  29347. source: "valuable: anObject\x0a\x09valuable := anObject",
  29348. referencedClasses: [],
  29349. pragmas: [],
  29350. messageSends: []
  29351. }),
  29352. $globals.AnnouncementValuable);
  29353. $core.addMethod(
  29354. $core.method({
  29355. selector: "value",
  29356. protocol: "evaluating",
  29357. fn: function (){
  29358. var self=this,$self=this;
  29359. return $core.withContext(function($ctx1) {
  29360. return $recv($self._valuable())._value();
  29361. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  29362. },
  29363. args: [],
  29364. source: "value\x0a\x09^ self valuable value",
  29365. referencedClasses: [],
  29366. pragmas: [],
  29367. messageSends: ["value", "valuable"]
  29368. }),
  29369. $globals.AnnouncementValuable);
  29370. $core.addMethod(
  29371. $core.method({
  29372. selector: "value:",
  29373. protocol: "evaluating",
  29374. fn: function (anObject){
  29375. var self=this,$self=this;
  29376. return $core.withContext(function($ctx1) {
  29377. return $recv($self._valuable())._value_(anObject);
  29378. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  29379. },
  29380. args: ["anObject"],
  29381. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  29382. referencedClasses: [],
  29383. pragmas: [],
  29384. messageSends: ["value:", "valuable"]
  29385. }),
  29386. $globals.AnnouncementValuable);
  29387. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  29388. $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' ].";
  29389. $core.addMethod(
  29390. $core.method({
  29391. selector: "announce:",
  29392. protocol: "announcing",
  29393. fn: function (anAnnouncement){
  29394. var self=this,$self=this;
  29395. return $core.withContext(function($ctx1) {
  29396. $recv($self.subscriptions)._do_((function(each){
  29397. return $core.withContext(function($ctx2) {
  29398. return $recv(each)._deliver_(anAnnouncement);
  29399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29400. }));
  29401. return self;
  29402. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement})});
  29403. },
  29404. args: ["anAnnouncement"],
  29405. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  29406. referencedClasses: [],
  29407. pragmas: [],
  29408. messageSends: ["do:", "deliver:"]
  29409. }),
  29410. $globals.Announcer);
  29411. $core.addMethod(
  29412. $core.method({
  29413. selector: "initialize",
  29414. protocol: "initialization",
  29415. fn: function (){
  29416. var self=this,$self=this;
  29417. return $core.withContext(function($ctx1) {
  29418. (
  29419. $ctx1.supercall = true,
  29420. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  29421. $ctx1.supercall = false;
  29422. $self.subscriptions=$recv($globals.OrderedCollection)._new();
  29423. return self;
  29424. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  29425. },
  29426. args: [],
  29427. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  29428. referencedClasses: ["OrderedCollection"],
  29429. pragmas: [],
  29430. messageSends: ["initialize", "new"]
  29431. }),
  29432. $globals.Announcer);
  29433. $core.addMethod(
  29434. $core.method({
  29435. selector: "on:do:",
  29436. protocol: "subscribing",
  29437. fn: function (aClass,aBlock){
  29438. var self=this,$self=this;
  29439. return $core.withContext(function($ctx1) {
  29440. $self._on_do_for_(aClass,aBlock,nil);
  29441. return self;
  29442. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  29443. },
  29444. args: ["aClass", "aBlock"],
  29445. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  29446. referencedClasses: [],
  29447. pragmas: [],
  29448. messageSends: ["on:do:for:"]
  29449. }),
  29450. $globals.Announcer);
  29451. $core.addMethod(
  29452. $core.method({
  29453. selector: "on:do:for:",
  29454. protocol: "subscribing",
  29455. fn: function (aClass,aBlock,aReceiver){
  29456. var self=this,$self=this;
  29457. return $core.withContext(function($ctx1) {
  29458. var $1,$3,$5,$6,$4,$2;
  29459. $1=$self.subscriptions;
  29460. $3=$recv($globals.AnnouncementSubscription)._new();
  29461. $ctx1.sendIdx["new"]=1;
  29462. $5=$recv($globals.AnnouncementValuable)._new();
  29463. $recv($5)._valuable_(aBlock);
  29464. $recv($5)._receiver_(aReceiver);
  29465. $6=$recv($5)._yourself();
  29466. $ctx1.sendIdx["yourself"]=1;
  29467. $4=$6;
  29468. $recv($3)._valuable_($4);
  29469. $ctx1.sendIdx["valuable:"]=1;
  29470. $recv($3)._announcementClass_(aClass);
  29471. $2=$recv($3)._yourself();
  29472. $recv($1)._add_($2);
  29473. return self;
  29474. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver})});
  29475. },
  29476. args: ["aClass", "aBlock", "aReceiver"],
  29477. 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)",
  29478. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  29479. pragmas: [],
  29480. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  29481. }),
  29482. $globals.Announcer);
  29483. $core.addMethod(
  29484. $core.method({
  29485. selector: "on:doOnce:",
  29486. protocol: "subscribing",
  29487. fn: function (aClass,aBlock){
  29488. var self=this,$self=this;
  29489. var subscription;
  29490. return $core.withContext(function($ctx1) {
  29491. var $1;
  29492. $1=$recv($globals.AnnouncementSubscription)._new();
  29493. $recv($1)._announcementClass_(aClass);
  29494. subscription=$recv($1)._yourself();
  29495. $recv(subscription)._valuable_((function(ann){
  29496. return $core.withContext(function($ctx2) {
  29497. $recv($self.subscriptions)._remove_(subscription);
  29498. return $recv(aBlock)._value_(ann);
  29499. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  29500. }));
  29501. $recv($self.subscriptions)._add_(subscription);
  29502. return self;
  29503. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription})});
  29504. },
  29505. args: ["aClass", "aBlock"],
  29506. 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",
  29507. referencedClasses: ["AnnouncementSubscription"],
  29508. pragmas: [],
  29509. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  29510. }),
  29511. $globals.Announcer);
  29512. $core.addMethod(
  29513. $core.method({
  29514. selector: "on:send:to:",
  29515. protocol: "subscribing",
  29516. fn: function (aClass,aSelector,anObject){
  29517. var self=this,$self=this;
  29518. return $core.withContext(function($ctx1) {
  29519. var $1,$3,$5,$6,$4,$2;
  29520. $1=$self.subscriptions;
  29521. $3=$recv($globals.AnnouncementSubscription)._new();
  29522. $ctx1.sendIdx["new"]=1;
  29523. $5=$recv($globals.MessageSend)._new();
  29524. $recv($5)._receiver_(anObject);
  29525. $recv($5)._selector_(aSelector);
  29526. $6=$recv($5)._yourself();
  29527. $ctx1.sendIdx["yourself"]=1;
  29528. $4=$6;
  29529. $recv($3)._valuable_($4);
  29530. $recv($3)._announcementClass_(aClass);
  29531. $2=$recv($3)._yourself();
  29532. $recv($1)._add_($2);
  29533. return self;
  29534. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject})});
  29535. },
  29536. args: ["aClass", "aSelector", "anObject"],
  29537. 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)",
  29538. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  29539. pragmas: [],
  29540. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  29541. }),
  29542. $globals.Announcer);
  29543. $core.addMethod(
  29544. $core.method({
  29545. selector: "unsubscribe:",
  29546. protocol: "subscribing",
  29547. fn: function (anObject){
  29548. var self=this,$self=this;
  29549. return $core.withContext(function($ctx1) {
  29550. $self.subscriptions=$recv($self.subscriptions)._reject_((function(each){
  29551. return $core.withContext(function($ctx2) {
  29552. return $recv($recv(each)._receiver()).__eq(anObject);
  29553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29554. }));
  29555. return self;
  29556. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject})});
  29557. },
  29558. args: ["anObject"],
  29559. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  29560. referencedClasses: [],
  29561. pragmas: [],
  29562. messageSends: ["reject:", "=", "receiver"]
  29563. }),
  29564. $globals.Announcer);
  29565. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  29566. $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`";
  29567. $core.setSlots($globals.SystemAnnouncer.a$cls, ["current"]);
  29568. $core.addMethod(
  29569. $core.method({
  29570. selector: "current",
  29571. protocol: "accessing",
  29572. fn: function (){
  29573. var self=this,$self=this;
  29574. return $core.withContext(function($ctx1) {
  29575. var $1,$receiver;
  29576. $1=$self.current;
  29577. if(($receiver = $1) == null || $receiver.a$nil){
  29578. $self.current=(
  29579. $ctx1.supercall = true,
  29580. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  29581. $ctx1.supercall = false;
  29582. return $self.current;
  29583. } else {
  29584. return $1;
  29585. }
  29586. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  29587. },
  29588. args: [],
  29589. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  29590. referencedClasses: [],
  29591. pragmas: [],
  29592. messageSends: ["ifNil:", "new"]
  29593. }),
  29594. $globals.SystemAnnouncer.a$cls);
  29595. $core.addMethod(
  29596. $core.method({
  29597. selector: "new",
  29598. protocol: "instance creation",
  29599. fn: function (){
  29600. var self=this,$self=this;
  29601. return $core.withContext(function($ctx1) {
  29602. $self._shouldNotImplement();
  29603. return self;
  29604. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  29605. },
  29606. args: [],
  29607. source: "new\x0a\x09self shouldNotImplement",
  29608. referencedClasses: [],
  29609. pragmas: [],
  29610. messageSends: ["shouldNotImplement"]
  29611. }),
  29612. $globals.SystemAnnouncer.a$cls);
  29613. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  29614. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  29615. $core.addMethod(
  29616. $core.method({
  29617. selector: "classTag",
  29618. protocol: "accessing",
  29619. fn: function (){
  29620. var self=this,$self=this;
  29621. return "announcement";
  29622. },
  29623. args: [],
  29624. 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'",
  29625. referencedClasses: [],
  29626. pragmas: [],
  29627. messageSends: []
  29628. }),
  29629. $globals.SystemAnnouncement.a$cls);
  29630. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  29631. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  29632. $core.addMethod(
  29633. $core.method({
  29634. selector: "theClass",
  29635. protocol: "accessing",
  29636. fn: function (){
  29637. var self=this,$self=this;
  29638. return $self.theClass;
  29639. },
  29640. args: [],
  29641. source: "theClass\x0a\x09^ theClass",
  29642. referencedClasses: [],
  29643. pragmas: [],
  29644. messageSends: []
  29645. }),
  29646. $globals.ClassAnnouncement);
  29647. $core.addMethod(
  29648. $core.method({
  29649. selector: "theClass:",
  29650. protocol: "accessing",
  29651. fn: function (aClass){
  29652. var self=this,$self=this;
  29653. $self.theClass=aClass;
  29654. return self;
  29655. },
  29656. args: ["aClass"],
  29657. source: "theClass: aClass\x0a\x09theClass := aClass",
  29658. referencedClasses: [],
  29659. pragmas: [],
  29660. messageSends: []
  29661. }),
  29662. $globals.ClassAnnouncement);
  29663. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29664. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  29665. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29666. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  29667. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29668. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  29669. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  29670. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  29671. $core.addMethod(
  29672. $core.method({
  29673. selector: "oldClass",
  29674. protocol: "accessing",
  29675. fn: function (){
  29676. var self=this,$self=this;
  29677. return $self.oldClass;
  29678. },
  29679. args: [],
  29680. source: "oldClass\x0a\x09^ oldClass",
  29681. referencedClasses: [],
  29682. pragmas: [],
  29683. messageSends: []
  29684. }),
  29685. $globals.ClassMigrated);
  29686. $core.addMethod(
  29687. $core.method({
  29688. selector: "oldClass:",
  29689. protocol: "accessing",
  29690. fn: function (aClass){
  29691. var self=this,$self=this;
  29692. $self.oldClass=aClass;
  29693. return self;
  29694. },
  29695. args: ["aClass"],
  29696. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  29697. referencedClasses: [],
  29698. pragmas: [],
  29699. messageSends: []
  29700. }),
  29701. $globals.ClassMigrated);
  29702. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  29703. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  29704. $core.addMethod(
  29705. $core.method({
  29706. selector: "oldPackage",
  29707. protocol: "accessing",
  29708. fn: function (){
  29709. var self=this,$self=this;
  29710. return $self.oldPackage;
  29711. },
  29712. args: [],
  29713. source: "oldPackage\x0a\x09^ oldPackage",
  29714. referencedClasses: [],
  29715. pragmas: [],
  29716. messageSends: []
  29717. }),
  29718. $globals.ClassMoved);
  29719. $core.addMethod(
  29720. $core.method({
  29721. selector: "oldPackage:",
  29722. protocol: "accessing",
  29723. fn: function (aPackage){
  29724. var self=this,$self=this;
  29725. $self.oldPackage=aPackage;
  29726. return self;
  29727. },
  29728. args: ["aPackage"],
  29729. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  29730. referencedClasses: [],
  29731. pragmas: [],
  29732. messageSends: []
  29733. }),
  29734. $globals.ClassMoved);
  29735. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29736. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  29737. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  29738. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  29739. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  29740. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  29741. $core.addMethod(
  29742. $core.method({
  29743. selector: "method",
  29744. protocol: "accessing",
  29745. fn: function (){
  29746. var self=this,$self=this;
  29747. return $self.method;
  29748. },
  29749. args: [],
  29750. source: "method\x0a\x09^ method",
  29751. referencedClasses: [],
  29752. pragmas: [],
  29753. messageSends: []
  29754. }),
  29755. $globals.MethodAnnouncement);
  29756. $core.addMethod(
  29757. $core.method({
  29758. selector: "method:",
  29759. protocol: "accessing",
  29760. fn: function (aCompiledMethod){
  29761. var self=this,$self=this;
  29762. $self.method=aCompiledMethod;
  29763. return self;
  29764. },
  29765. args: ["aCompiledMethod"],
  29766. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  29767. referencedClasses: [],
  29768. pragmas: [],
  29769. messageSends: []
  29770. }),
  29771. $globals.MethodAnnouncement);
  29772. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  29773. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  29774. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  29775. $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.";
  29776. $core.addMethod(
  29777. $core.method({
  29778. selector: "oldMethod",
  29779. protocol: "accessing",
  29780. fn: function (){
  29781. var self=this,$self=this;
  29782. return $self.oldMethod;
  29783. },
  29784. args: [],
  29785. source: "oldMethod\x0a\x09^ oldMethod",
  29786. referencedClasses: [],
  29787. pragmas: [],
  29788. messageSends: []
  29789. }),
  29790. $globals.MethodModified);
  29791. $core.addMethod(
  29792. $core.method({
  29793. selector: "oldMethod:",
  29794. protocol: "accessing",
  29795. fn: function (aMethod){
  29796. var self=this,$self=this;
  29797. $self.oldMethod=aMethod;
  29798. return self;
  29799. },
  29800. args: ["aMethod"],
  29801. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  29802. referencedClasses: [],
  29803. pragmas: [],
  29804. messageSends: []
  29805. }),
  29806. $globals.MethodModified);
  29807. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  29808. $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.";
  29809. $core.addMethod(
  29810. $core.method({
  29811. selector: "oldProtocol",
  29812. protocol: "accessing",
  29813. fn: function (){
  29814. var self=this,$self=this;
  29815. return $self.oldProtocol;
  29816. },
  29817. args: [],
  29818. source: "oldProtocol\x0a\x09^ oldProtocol",
  29819. referencedClasses: [],
  29820. pragmas: [],
  29821. messageSends: []
  29822. }),
  29823. $globals.MethodMoved);
  29824. $core.addMethod(
  29825. $core.method({
  29826. selector: "oldProtocol:",
  29827. protocol: "accessing",
  29828. fn: function (aString){
  29829. var self=this,$self=this;
  29830. $self.oldProtocol=aString;
  29831. return self;
  29832. },
  29833. args: ["aString"],
  29834. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  29835. referencedClasses: [],
  29836. pragmas: [],
  29837. messageSends: []
  29838. }),
  29839. $globals.MethodMoved);
  29840. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  29841. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  29842. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  29843. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  29844. $core.addMethod(
  29845. $core.method({
  29846. selector: "package",
  29847. protocol: "accessing",
  29848. fn: function (){
  29849. var self=this,$self=this;
  29850. return $self.package;
  29851. },
  29852. args: [],
  29853. source: "package\x0a\x09^ package",
  29854. referencedClasses: [],
  29855. pragmas: [],
  29856. messageSends: []
  29857. }),
  29858. $globals.PackageAnnouncement);
  29859. $core.addMethod(
  29860. $core.method({
  29861. selector: "package:",
  29862. protocol: "accessing",
  29863. fn: function (aPackage){
  29864. var self=this,$self=this;
  29865. $self.package=aPackage;
  29866. return self;
  29867. },
  29868. args: ["aPackage"],
  29869. source: "package: aPackage\x0a\x09package := aPackage",
  29870. referencedClasses: [],
  29871. pragmas: [],
  29872. messageSends: []
  29873. }),
  29874. $globals.PackageAnnouncement);
  29875. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29876. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  29877. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29878. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  29879. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29880. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  29881. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  29882. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  29883. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  29884. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  29885. $core.addMethod(
  29886. $core.method({
  29887. selector: "package",
  29888. protocol: "accessing",
  29889. fn: function (){
  29890. var self=this,$self=this;
  29891. return $core.withContext(function($ctx1) {
  29892. var $1,$receiver;
  29893. $1=$self._theClass();
  29894. if(($receiver = $1) == null || $receiver.a$nil){
  29895. return $1;
  29896. } else {
  29897. var class_;
  29898. class_=$receiver;
  29899. return $recv(class_)._packageOfProtocol_($self._protocol());
  29900. }
  29901. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  29902. },
  29903. args: [],
  29904. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  29905. referencedClasses: [],
  29906. pragmas: [],
  29907. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  29908. }),
  29909. $globals.ProtocolAnnouncement);
  29910. $core.addMethod(
  29911. $core.method({
  29912. selector: "protocol",
  29913. protocol: "accessing",
  29914. fn: function (){
  29915. var self=this,$self=this;
  29916. return $self.protocol;
  29917. },
  29918. args: [],
  29919. source: "protocol\x0a\x09^ protocol",
  29920. referencedClasses: [],
  29921. pragmas: [],
  29922. messageSends: []
  29923. }),
  29924. $globals.ProtocolAnnouncement);
  29925. $core.addMethod(
  29926. $core.method({
  29927. selector: "protocol:",
  29928. protocol: "accessing",
  29929. fn: function (aString){
  29930. var self=this,$self=this;
  29931. $self.protocol=aString;
  29932. return self;
  29933. },
  29934. args: ["aString"],
  29935. source: "protocol: aString\x0a\x09protocol := aString",
  29936. referencedClasses: [],
  29937. pragmas: [],
  29938. messageSends: []
  29939. }),
  29940. $globals.ProtocolAnnouncement);
  29941. $core.addMethod(
  29942. $core.method({
  29943. selector: "theClass",
  29944. protocol: "accessing",
  29945. fn: function (){
  29946. var self=this,$self=this;
  29947. return $self.theClass;
  29948. },
  29949. args: [],
  29950. source: "theClass\x0a\x09^ theClass",
  29951. referencedClasses: [],
  29952. pragmas: [],
  29953. messageSends: []
  29954. }),
  29955. $globals.ProtocolAnnouncement);
  29956. $core.addMethod(
  29957. $core.method({
  29958. selector: "theClass:",
  29959. protocol: "accessing",
  29960. fn: function (aClass){
  29961. var self=this,$self=this;
  29962. $self.theClass=aClass;
  29963. return self;
  29964. },
  29965. args: ["aClass"],
  29966. source: "theClass: aClass\x0a\x09theClass := aClass",
  29967. referencedClasses: [],
  29968. pragmas: [],
  29969. messageSends: []
  29970. }),
  29971. $globals.ProtocolAnnouncement);
  29972. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  29973. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  29974. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  29975. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  29976. });
  29977. define('amber/core/Platform-Services',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  29978. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  29979. var $pkg = $core.addPackage("Platform-Services");
  29980. $pkg.innerEval = function (expr) { return eval(expr); };
  29981. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  29982. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  29983. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  29984. $core.addMethod(
  29985. $core.method({
  29986. selector: "handleError:",
  29987. protocol: "error handling",
  29988. fn: function (anError){
  29989. var self=this,$self=this;
  29990. return $core.withContext(function($ctx1) {
  29991. var $1,$receiver;
  29992. $1=$recv(anError)._context();
  29993. $ctx1.sendIdx["context"]=1;
  29994. if(($receiver = $1) == null || $receiver.a$nil){
  29995. $1;
  29996. } else {
  29997. $self._logErrorContext_($recv(anError)._context());
  29998. }
  29999. $self._logError_(anError);
  30000. return self;
  30001. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError})});
  30002. },
  30003. args: ["anError"],
  30004. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  30005. referencedClasses: [],
  30006. pragmas: [],
  30007. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  30008. }),
  30009. $globals.ConsoleErrorHandler);
  30010. $core.addMethod(
  30011. $core.method({
  30012. selector: "log:",
  30013. protocol: "private",
  30014. fn: function (aString){
  30015. var self=this,$self=this;
  30016. return $core.withContext(function($ctx1) {
  30017. $recv(console)._log_(aString);
  30018. return self;
  30019. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString})});
  30020. },
  30021. args: ["aString"],
  30022. source: "log: aString\x0a\x09console log: aString",
  30023. referencedClasses: [],
  30024. pragmas: [],
  30025. messageSends: ["log:"]
  30026. }),
  30027. $globals.ConsoleErrorHandler);
  30028. $core.addMethod(
  30029. $core.method({
  30030. selector: "logContext:",
  30031. protocol: "private",
  30032. fn: function (aContext){
  30033. var self=this,$self=this;
  30034. return $core.withContext(function($ctx1) {
  30035. var $1,$receiver;
  30036. $1=$recv(aContext)._home();
  30037. $ctx1.sendIdx["home"]=1;
  30038. if(($receiver = $1) == null || $receiver.a$nil){
  30039. $1;
  30040. } else {
  30041. $self._logContext_($recv(aContext)._home());
  30042. }
  30043. $self._log_($recv(aContext)._asString());
  30044. return self;
  30045. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext})});
  30046. },
  30047. args: ["aContext"],
  30048. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  30049. referencedClasses: [],
  30050. pragmas: [],
  30051. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  30052. }),
  30053. $globals.ConsoleErrorHandler);
  30054. $core.addMethod(
  30055. $core.method({
  30056. selector: "logError:",
  30057. protocol: "private",
  30058. fn: function (anError){
  30059. var self=this,$self=this;
  30060. return $core.withContext(function($ctx1) {
  30061. $self._log_($recv(anError)._messageText());
  30062. return self;
  30063. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError})});
  30064. },
  30065. args: ["anError"],
  30066. source: "logError: anError\x0a\x09self log: anError messageText",
  30067. referencedClasses: [],
  30068. pragmas: [],
  30069. messageSends: ["log:", "messageText"]
  30070. }),
  30071. $globals.ConsoleErrorHandler);
  30072. $core.addMethod(
  30073. $core.method({
  30074. selector: "logErrorContext:",
  30075. protocol: "private",
  30076. fn: function (aContext){
  30077. var self=this,$self=this;
  30078. return $core.withContext(function($ctx1) {
  30079. var $1,$receiver;
  30080. if(($receiver = aContext) == null || $receiver.a$nil){
  30081. aContext;
  30082. } else {
  30083. $1=$recv(aContext)._home();
  30084. $ctx1.sendIdx["home"]=1;
  30085. if(($receiver = $1) == null || $receiver.a$nil){
  30086. $1;
  30087. } else {
  30088. $self._logContext_($recv(aContext)._home());
  30089. }
  30090. }
  30091. return self;
  30092. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext})});
  30093. },
  30094. args: ["aContext"],
  30095. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  30096. referencedClasses: [],
  30097. pragmas: [],
  30098. messageSends: ["ifNotNil:", "home", "logContext:"]
  30099. }),
  30100. $globals.ConsoleErrorHandler);
  30101. $core.setSlots($globals.ConsoleErrorHandler.a$cls, ["current"]);
  30102. $core.addMethod(
  30103. $core.method({
  30104. selector: "initialize",
  30105. protocol: "initialization",
  30106. fn: function (){
  30107. var self=this,$self=this;
  30108. return $core.withContext(function($ctx1) {
  30109. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  30110. return self;
  30111. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30112. },
  30113. args: [],
  30114. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  30115. referencedClasses: ["ErrorHandler"],
  30116. pragmas: [],
  30117. messageSends: ["registerIfNone:", "new"]
  30118. }),
  30119. $globals.ConsoleErrorHandler.a$cls);
  30120. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  30121. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  30122. $core.addMethod(
  30123. $core.method({
  30124. selector: "clear",
  30125. protocol: "printing",
  30126. fn: function (){
  30127. var self=this,$self=this;
  30128. return self;
  30129. },
  30130. args: [],
  30131. source: "clear\x0a\x09\x22no op\x22",
  30132. referencedClasses: [],
  30133. pragmas: [],
  30134. messageSends: []
  30135. }),
  30136. $globals.ConsoleTranscript);
  30137. $core.addMethod(
  30138. $core.method({
  30139. selector: "cr",
  30140. protocol: "printing",
  30141. fn: function (){
  30142. var self=this,$self=this;
  30143. return self;
  30144. },
  30145. args: [],
  30146. source: "cr\x0a\x09\x22no op\x22",
  30147. referencedClasses: [],
  30148. pragmas: [],
  30149. messageSends: []
  30150. }),
  30151. $globals.ConsoleTranscript);
  30152. $core.addMethod(
  30153. $core.method({
  30154. selector: "open",
  30155. protocol: "actions",
  30156. fn: function (){
  30157. var self=this,$self=this;
  30158. return self;
  30159. },
  30160. args: [],
  30161. source: "open",
  30162. referencedClasses: [],
  30163. pragmas: [],
  30164. messageSends: []
  30165. }),
  30166. $globals.ConsoleTranscript);
  30167. $core.addMethod(
  30168. $core.method({
  30169. selector: "show:",
  30170. protocol: "printing",
  30171. fn: function (anObject){
  30172. var self=this,$self=this;
  30173. return $core.withContext(function($ctx1) {
  30174. console.log(String($recv(anObject)._asString()));
  30175. return self;
  30176. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  30177. },
  30178. args: ["anObject"],
  30179. 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()))'>",
  30180. referencedClasses: [],
  30181. pragmas: [["inlineJS:", ["console.log(String($recv(anObject)._asString()))"]]],
  30182. messageSends: []
  30183. }),
  30184. $globals.ConsoleTranscript);
  30185. $core.addMethod(
  30186. $core.method({
  30187. selector: "initialize",
  30188. protocol: "initialization",
  30189. fn: function (){
  30190. var self=this,$self=this;
  30191. return $core.withContext(function($ctx1) {
  30192. $recv($globals.Transcript)._registerIfNone_($self._new());
  30193. return self;
  30194. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30195. },
  30196. args: [],
  30197. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  30198. referencedClasses: ["Transcript"],
  30199. pragmas: [],
  30200. messageSends: ["registerIfNone:", "new"]
  30201. }),
  30202. $globals.ConsoleTranscript.a$cls);
  30203. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  30204. $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.";
  30205. $core.addMethod(
  30206. $core.method({
  30207. selector: "addInstVarNamed:to:",
  30208. protocol: "compiling",
  30209. fn: function (aString,aClass){
  30210. var self=this,$self=this;
  30211. var newInstVars;
  30212. return $core.withContext(function($ctx1) {
  30213. var $1,$2,$3,$4,$5;
  30214. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  30215. $1=$recv(aClass)._isMetaclass();
  30216. if($core.assert($1)){
  30217. $2=$self._classBuilder();
  30218. $ctx1.sendIdx["classBuilder"]=1;
  30219. $recv($2)._class_slots_(aClass,newInstVars);
  30220. } else {
  30221. $3=$self._classBuilder();
  30222. $4=$recv(aClass)._superclass();
  30223. $5=$recv(aClass)._name();
  30224. $ctx1.sendIdx["name"]=1;
  30225. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  30226. }
  30227. return self;
  30228. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars})});
  30229. },
  30230. args: ["aString", "aClass"],
  30231. 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 slots: 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 ]",
  30232. referencedClasses: [],
  30233. pragmas: [],
  30234. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:slots:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  30235. }),
  30236. $globals.Environment);
  30237. $core.addMethod(
  30238. $core.method({
  30239. selector: "allSelectors",
  30240. protocol: "accessing",
  30241. fn: function (){
  30242. var self=this,$self=this;
  30243. return $core.withContext(function($ctx1) {
  30244. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  30245. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  30246. },
  30247. args: [],
  30248. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  30249. referencedClasses: ["Smalltalk"],
  30250. pragmas: [],
  30251. messageSends: ["allSelectors", "core"]
  30252. }),
  30253. $globals.Environment);
  30254. $core.addMethod(
  30255. $core.method({
  30256. selector: "availableClassNames",
  30257. protocol: "accessing",
  30258. fn: function (){
  30259. var self=this,$self=this;
  30260. return $core.withContext(function($ctx1) {
  30261. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  30262. return $core.withContext(function($ctx2) {
  30263. return $recv(each)._name();
  30264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30265. }));
  30266. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{})});
  30267. },
  30268. args: [],
  30269. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  30270. referencedClasses: ["Smalltalk"],
  30271. pragmas: [],
  30272. messageSends: ["collect:", "classes", "name"]
  30273. }),
  30274. $globals.Environment);
  30275. $core.addMethod(
  30276. $core.method({
  30277. selector: "availablePackageNames",
  30278. protocol: "accessing",
  30279. fn: function (){
  30280. var self=this,$self=this;
  30281. return $core.withContext(function($ctx1) {
  30282. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  30283. return $core.withContext(function($ctx2) {
  30284. return $recv(each)._name();
  30285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30286. }));
  30287. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{})});
  30288. },
  30289. args: [],
  30290. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  30291. referencedClasses: ["Smalltalk"],
  30292. pragmas: [],
  30293. messageSends: ["collect:", "packages", "name"]
  30294. }),
  30295. $globals.Environment);
  30296. $core.addMethod(
  30297. $core.method({
  30298. selector: "availableProtocolsFor:",
  30299. protocol: "accessing",
  30300. fn: function (aClass){
  30301. var self=this,$self=this;
  30302. var protocols;
  30303. return $core.withContext(function($ctx1) {
  30304. var $1,$receiver;
  30305. protocols=$recv(aClass)._protocols();
  30306. $1=$recv(aClass)._superclass();
  30307. $ctx1.sendIdx["superclass"]=1;
  30308. if(($receiver = $1) == null || $receiver.a$nil){
  30309. $1;
  30310. } else {
  30311. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  30312. }
  30313. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  30314. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols})});
  30315. },
  30316. args: ["aClass"],
  30317. 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",
  30318. referencedClasses: [],
  30319. pragmas: [],
  30320. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  30321. }),
  30322. $globals.Environment);
  30323. $core.addMethod(
  30324. $core.method({
  30325. selector: "classBuilder",
  30326. protocol: "accessing",
  30327. fn: function (){
  30328. var self=this,$self=this;
  30329. return $core.withContext(function($ctx1) {
  30330. return $recv($globals.ClassBuilder)._new();
  30331. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{})});
  30332. },
  30333. args: [],
  30334. source: "classBuilder\x0a\x09^ ClassBuilder new",
  30335. referencedClasses: ["ClassBuilder"],
  30336. pragmas: [],
  30337. messageSends: ["new"]
  30338. }),
  30339. $globals.Environment);
  30340. $core.addMethod(
  30341. $core.method({
  30342. selector: "classNamed:",
  30343. protocol: "accessing",
  30344. fn: function (aString){
  30345. var self=this,$self=this;
  30346. return $core.withContext(function($ctx1) {
  30347. var $1,$receiver;
  30348. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  30349. if(($receiver = $1) == null || $receiver.a$nil){
  30350. return $self._error_("Invalid class name");
  30351. } else {
  30352. return $1;
  30353. }
  30354. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString})});
  30355. },
  30356. args: ["aString"],
  30357. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  30358. referencedClasses: ["Smalltalk"],
  30359. pragmas: [],
  30360. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  30361. }),
  30362. $globals.Environment);
  30363. $core.addMethod(
  30364. $core.method({
  30365. selector: "classes",
  30366. protocol: "accessing",
  30367. fn: function (){
  30368. var self=this,$self=this;
  30369. return $core.withContext(function($ctx1) {
  30370. return $recv($globals.Smalltalk)._classes();
  30371. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  30372. },
  30373. args: [],
  30374. source: "classes\x0a\x09^ Smalltalk classes",
  30375. referencedClasses: ["Smalltalk"],
  30376. pragmas: [],
  30377. messageSends: ["classes"]
  30378. }),
  30379. $globals.Environment);
  30380. $core.addMethod(
  30381. $core.method({
  30382. selector: "commitPackage:onSuccess:onError:",
  30383. protocol: "actions",
  30384. fn: function (aPackage,aBlock,anotherBlock){
  30385. var self=this,$self=this;
  30386. return $core.withContext(function($ctx1) {
  30387. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  30388. return self;
  30389. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  30390. },
  30391. args: ["aPackage", "aBlock", "anotherBlock"],
  30392. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  30393. referencedClasses: [],
  30394. pragmas: [],
  30395. messageSends: ["commitOnSuccess:onError:", "transport"]
  30396. }),
  30397. $globals.Environment);
  30398. $core.addMethod(
  30399. $core.method({
  30400. selector: "compileClassComment:for:",
  30401. protocol: "compiling",
  30402. fn: function (aString,aClass){
  30403. var self=this,$self=this;
  30404. return $core.withContext(function($ctx1) {
  30405. $recv(aClass)._comment_(aString);
  30406. return self;
  30407. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass})});
  30408. },
  30409. args: ["aString", "aClass"],
  30410. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  30411. referencedClasses: [],
  30412. pragmas: [],
  30413. messageSends: ["comment:"]
  30414. }),
  30415. $globals.Environment);
  30416. $core.addMethod(
  30417. $core.method({
  30418. selector: "compileClassDefinition:",
  30419. protocol: "compiling",
  30420. fn: function (aString){
  30421. var self=this,$self=this;
  30422. return $core.withContext(function($ctx1) {
  30423. $recv((function(){
  30424. return $core.withContext(function($ctx2) {
  30425. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  30426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30427. }))._on_do_($globals.Error,(function(error){
  30428. return $core.withContext(function($ctx2) {
  30429. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  30430. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  30431. }));
  30432. return self;
  30433. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString})});
  30434. },
  30435. args: ["aString"],
  30436. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  30437. referencedClasses: ["DoIt", "Error", "Terminal"],
  30438. pragmas: [],
  30439. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  30440. }),
  30441. $globals.Environment);
  30442. $core.addMethod(
  30443. $core.method({
  30444. selector: "compileMethod:for:protocol:",
  30445. protocol: "compiling",
  30446. fn: function (sourceCode,class_,protocol){
  30447. var self=this,$self=this;
  30448. return $core.withContext(function($ctx1) {
  30449. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  30450. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol})});
  30451. },
  30452. args: ["sourceCode", "class", "protocol"],
  30453. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  30454. referencedClasses: [],
  30455. pragmas: [],
  30456. messageSends: ["compile:protocol:"]
  30457. }),
  30458. $globals.Environment);
  30459. $core.addMethod(
  30460. $core.method({
  30461. selector: "copyClass:to:",
  30462. protocol: "actions",
  30463. fn: function (aClass,aClassName){
  30464. var self=this,$self=this;
  30465. return $core.withContext(function($ctx1) {
  30466. var $1,$2,$receiver;
  30467. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  30468. if(($receiver = $1) == null || $receiver.a$nil){
  30469. $1;
  30470. } else {
  30471. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  30472. $ctx1.sendIdx[","]=1;
  30473. $self._error_($2);
  30474. }
  30475. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  30476. return self;
  30477. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName})});
  30478. },
  30479. args: ["aClass", "aClassName"],
  30480. 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",
  30481. referencedClasses: ["Smalltalk", "ClassBuilder"],
  30482. pragmas: [],
  30483. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  30484. }),
  30485. $globals.Environment);
  30486. $core.addMethod(
  30487. $core.method({
  30488. selector: "doItReceiver",
  30489. protocol: "accessing",
  30490. fn: function (){
  30491. var self=this,$self=this;
  30492. return $core.withContext(function($ctx1) {
  30493. return $recv($globals.DoIt)._new();
  30494. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{})});
  30495. },
  30496. args: [],
  30497. source: "doItReceiver\x0a\x09^ DoIt new",
  30498. referencedClasses: ["DoIt"],
  30499. pragmas: [],
  30500. messageSends: ["new"]
  30501. }),
  30502. $globals.Environment);
  30503. $core.addMethod(
  30504. $core.method({
  30505. selector: "evaluate:for:",
  30506. protocol: "evaluating",
  30507. fn: function (aString,anObject){
  30508. var self=this,$self=this;
  30509. return $core.withContext(function($ctx1) {
  30510. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  30511. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  30512. },
  30513. args: ["aString", "anObject"],
  30514. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  30515. referencedClasses: ["Evaluator"],
  30516. pragmas: [],
  30517. messageSends: ["evaluate:for:"]
  30518. }),
  30519. $globals.Environment);
  30520. $core.addMethod(
  30521. $core.method({
  30522. selector: "evaluate:on:do:",
  30523. protocol: "error handling",
  30524. fn: function (aBlock,anErrorClass,exceptionBlock){
  30525. var self=this,$self=this;
  30526. return $core.withContext(function($ctx1) {
  30527. var $1;
  30528. $recv(aBlock)._tryCatch_((function(exception){
  30529. return $core.withContext(function($ctx2) {
  30530. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  30531. if($core.assert($1)){
  30532. return $recv(exceptionBlock)._value_(exception);
  30533. } else {
  30534. return $recv(exception)._pass();
  30535. }
  30536. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  30537. }));
  30538. return self;
  30539. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock})});
  30540. },
  30541. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  30542. 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 ] ]",
  30543. referencedClasses: [],
  30544. pragmas: [],
  30545. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  30546. }),
  30547. $globals.Environment);
  30548. $core.addMethod(
  30549. $core.method({
  30550. selector: "inspect:",
  30551. protocol: "actions",
  30552. fn: function (anObject){
  30553. var self=this,$self=this;
  30554. return $core.withContext(function($ctx1) {
  30555. $recv($globals.Inspector)._inspect_(anObject);
  30556. return self;
  30557. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  30558. },
  30559. args: ["anObject"],
  30560. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  30561. referencedClasses: ["Inspector"],
  30562. pragmas: [],
  30563. messageSends: ["inspect:"]
  30564. }),
  30565. $globals.Environment);
  30566. $core.addMethod(
  30567. $core.method({
  30568. selector: "moveClass:toPackage:",
  30569. protocol: "actions",
  30570. fn: function (aClass,aPackageName){
  30571. var self=this,$self=this;
  30572. var package_;
  30573. return $core.withContext(function($ctx1) {
  30574. var $1,$2,$receiver;
  30575. package_=$recv($globals.Package)._named_(aPackageName);
  30576. $1=package_;
  30577. if(($receiver = $1) == null || $receiver.a$nil){
  30578. $self._error_("Invalid package name");
  30579. } else {
  30580. $1;
  30581. }
  30582. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  30583. if($core.assert($2)){
  30584. return self;
  30585. }
  30586. $recv(aClass)._package_(package_);
  30587. $recv(aClass)._recompile();
  30588. return self;
  30589. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_})});
  30590. },
  30591. args: ["aClass", "aPackageName"],
  30592. 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",
  30593. referencedClasses: ["Package"],
  30594. pragmas: [],
  30595. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  30596. }),
  30597. $globals.Environment);
  30598. $core.addMethod(
  30599. $core.method({
  30600. selector: "moveMethod:toClass:",
  30601. protocol: "actions",
  30602. fn: function (aMethod,aClassName){
  30603. var self=this,$self=this;
  30604. var destinationClass;
  30605. return $core.withContext(function($ctx1) {
  30606. var $2,$3,$1,$5,$4;
  30607. destinationClass=$self._classNamed_(aClassName);
  30608. $2=destinationClass;
  30609. $3=$recv(aMethod)._origin();
  30610. $ctx1.sendIdx["origin"]=1;
  30611. $1=$recv($2).__eq_eq($3);
  30612. if($core.assert($1)){
  30613. return self;
  30614. }
  30615. $5=$recv(aMethod)._origin();
  30616. $ctx1.sendIdx["origin"]=2;
  30617. $4=$recv($5)._isMetaclass();
  30618. if($core.assert($4)){
  30619. destinationClass=$recv(destinationClass)._theMetaClass();
  30620. destinationClass;
  30621. }
  30622. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  30623. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  30624. return self;
  30625. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass})});
  30626. },
  30627. args: ["aMethod", "aClassName"],
  30628. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod origin ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod origin isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod origin \x0a\x09\x09removeCompiledMethod: aMethod",
  30629. referencedClasses: [],
  30630. pragmas: [],
  30631. messageSends: ["classNamed:", "ifTrue:", "==", "origin", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  30632. }),
  30633. $globals.Environment);
  30634. $core.addMethod(
  30635. $core.method({
  30636. selector: "moveMethod:toProtocol:",
  30637. protocol: "actions",
  30638. fn: function (aMethod,aProtocol){
  30639. var self=this,$self=this;
  30640. return $core.withContext(function($ctx1) {
  30641. $recv(aMethod)._protocol_(aProtocol);
  30642. $recv($recv(aMethod)._origin())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  30643. return self;
  30644. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol})});
  30645. },
  30646. args: ["aMethod", "aProtocol"],
  30647. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod origin\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  30648. referencedClasses: [],
  30649. pragmas: [],
  30650. messageSends: ["protocol:", "compile:protocol:", "origin", "source", "protocol"]
  30651. }),
  30652. $globals.Environment);
  30653. $core.addMethod(
  30654. $core.method({
  30655. selector: "packages",
  30656. protocol: "accessing",
  30657. fn: function (){
  30658. var self=this,$self=this;
  30659. return $core.withContext(function($ctx1) {
  30660. return $recv($globals.Smalltalk)._packages();
  30661. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  30662. },
  30663. args: [],
  30664. source: "packages\x0a\x09^ Smalltalk packages",
  30665. referencedClasses: ["Smalltalk"],
  30666. pragmas: [],
  30667. messageSends: ["packages"]
  30668. }),
  30669. $globals.Environment);
  30670. $core.addMethod(
  30671. $core.method({
  30672. selector: "registerErrorHandler:",
  30673. protocol: "services",
  30674. fn: function (anErrorHandler){
  30675. var self=this,$self=this;
  30676. return $core.withContext(function($ctx1) {
  30677. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  30678. return self;
  30679. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler})});
  30680. },
  30681. args: ["anErrorHandler"],
  30682. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  30683. referencedClasses: ["ErrorHandler"],
  30684. pragmas: [],
  30685. messageSends: ["register:"]
  30686. }),
  30687. $globals.Environment);
  30688. $core.addMethod(
  30689. $core.method({
  30690. selector: "registerFinder:",
  30691. protocol: "services",
  30692. fn: function (aFinder){
  30693. var self=this,$self=this;
  30694. return $core.withContext(function($ctx1) {
  30695. $recv($globals.Finder)._register_(aFinder);
  30696. return self;
  30697. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder})});
  30698. },
  30699. args: ["aFinder"],
  30700. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  30701. referencedClasses: ["Finder"],
  30702. pragmas: [],
  30703. messageSends: ["register:"]
  30704. }),
  30705. $globals.Environment);
  30706. $core.addMethod(
  30707. $core.method({
  30708. selector: "registerInspector:",
  30709. protocol: "services",
  30710. fn: function (anInspector){
  30711. var self=this,$self=this;
  30712. return $core.withContext(function($ctx1) {
  30713. $recv($globals.Inspector)._register_(anInspector);
  30714. return self;
  30715. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector})});
  30716. },
  30717. args: ["anInspector"],
  30718. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  30719. referencedClasses: ["Inspector"],
  30720. pragmas: [],
  30721. messageSends: ["register:"]
  30722. }),
  30723. $globals.Environment);
  30724. $core.addMethod(
  30725. $core.method({
  30726. selector: "registerProgressHandler:",
  30727. protocol: "services",
  30728. fn: function (aProgressHandler){
  30729. var self=this,$self=this;
  30730. return $core.withContext(function($ctx1) {
  30731. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  30732. return self;
  30733. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler})});
  30734. },
  30735. args: ["aProgressHandler"],
  30736. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  30737. referencedClasses: ["ProgressHandler"],
  30738. pragmas: [],
  30739. messageSends: ["register:"]
  30740. }),
  30741. $globals.Environment);
  30742. $core.addMethod(
  30743. $core.method({
  30744. selector: "registerTranscript:",
  30745. protocol: "services",
  30746. fn: function (aTranscript){
  30747. var self=this,$self=this;
  30748. return $core.withContext(function($ctx1) {
  30749. $recv($globals.Transcript)._register_(aTranscript);
  30750. return self;
  30751. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript})});
  30752. },
  30753. args: ["aTranscript"],
  30754. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  30755. referencedClasses: ["Transcript"],
  30756. pragmas: [],
  30757. messageSends: ["register:"]
  30758. }),
  30759. $globals.Environment);
  30760. $core.addMethod(
  30761. $core.method({
  30762. selector: "removeClass:",
  30763. protocol: "actions",
  30764. fn: function (aClass){
  30765. var self=this,$self=this;
  30766. return $core.withContext(function($ctx1) {
  30767. $recv($globals.Smalltalk)._removeClass_(aClass);
  30768. return self;
  30769. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  30770. },
  30771. args: ["aClass"],
  30772. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  30773. referencedClasses: ["Smalltalk"],
  30774. pragmas: [],
  30775. messageSends: ["removeClass:"]
  30776. }),
  30777. $globals.Environment);
  30778. $core.addMethod(
  30779. $core.method({
  30780. selector: "removeMethod:",
  30781. protocol: "actions",
  30782. fn: function (aMethod){
  30783. var self=this,$self=this;
  30784. return $core.withContext(function($ctx1) {
  30785. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  30786. return self;
  30787. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod})});
  30788. },
  30789. args: ["aMethod"],
  30790. source: "removeMethod: aMethod\x0a\x09aMethod origin removeCompiledMethod: aMethod",
  30791. referencedClasses: [],
  30792. pragmas: [],
  30793. messageSends: ["removeCompiledMethod:", "origin"]
  30794. }),
  30795. $globals.Environment);
  30796. $core.addMethod(
  30797. $core.method({
  30798. selector: "removeProtocol:from:",
  30799. protocol: "actions",
  30800. fn: function (aString,aClass){
  30801. var self=this,$self=this;
  30802. return $core.withContext(function($ctx1) {
  30803. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  30804. return $core.withContext(function($ctx2) {
  30805. return $recv(aClass)._removeCompiledMethod_(each);
  30806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30807. }));
  30808. return self;
  30809. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass})});
  30810. },
  30811. args: ["aString", "aClass"],
  30812. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  30813. referencedClasses: [],
  30814. pragmas: [],
  30815. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  30816. }),
  30817. $globals.Environment);
  30818. $core.addMethod(
  30819. $core.method({
  30820. selector: "renameClass:to:",
  30821. protocol: "actions",
  30822. fn: function (aClass,aClassName){
  30823. var self=this,$self=this;
  30824. return $core.withContext(function($ctx1) {
  30825. var $1,$2,$receiver;
  30826. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  30827. if(($receiver = $1) == null || $receiver.a$nil){
  30828. $1;
  30829. } else {
  30830. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  30831. $ctx1.sendIdx[","]=1;
  30832. $self._error_($2);
  30833. }
  30834. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  30835. return self;
  30836. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName})});
  30837. },
  30838. args: ["aClass", "aClassName"],
  30839. 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",
  30840. referencedClasses: ["Smalltalk", "ClassBuilder"],
  30841. pragmas: [],
  30842. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  30843. }),
  30844. $globals.Environment);
  30845. $core.addMethod(
  30846. $core.method({
  30847. selector: "renamePackage:to:",
  30848. protocol: "actions",
  30849. fn: function (aPackageName,aNewPackageName){
  30850. var self=this,$self=this;
  30851. return $core.withContext(function($ctx1) {
  30852. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  30853. return self;
  30854. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName})});
  30855. },
  30856. args: ["aPackageName", "aNewPackageName"],
  30857. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  30858. referencedClasses: ["Smalltalk"],
  30859. pragmas: [],
  30860. messageSends: ["renamePackage:to:"]
  30861. }),
  30862. $globals.Environment);
  30863. $core.addMethod(
  30864. $core.method({
  30865. selector: "renameProtocol:to:in:",
  30866. protocol: "actions",
  30867. fn: function (aString,anotherString,aClass){
  30868. var self=this,$self=this;
  30869. return $core.withContext(function($ctx1) {
  30870. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  30871. return $core.withContext(function($ctx2) {
  30872. return $recv(each)._protocol_(anotherString);
  30873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30874. }));
  30875. return self;
  30876. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass})});
  30877. },
  30878. args: ["aString", "anotherString", "aClass"],
  30879. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  30880. referencedClasses: [],
  30881. pragmas: [],
  30882. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  30883. }),
  30884. $globals.Environment);
  30885. $core.addMethod(
  30886. $core.method({
  30887. selector: "setClassCommentOf:to:",
  30888. protocol: "actions",
  30889. fn: function (aClass,aString){
  30890. var self=this,$self=this;
  30891. return $core.withContext(function($ctx1) {
  30892. $recv(aClass)._comment_(aString);
  30893. return self;
  30894. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString})});
  30895. },
  30896. args: ["aClass", "aString"],
  30897. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  30898. referencedClasses: [],
  30899. pragmas: [],
  30900. messageSends: ["comment:"]
  30901. }),
  30902. $globals.Environment);
  30903. $core.addMethod(
  30904. $core.method({
  30905. selector: "systemAnnouncer",
  30906. protocol: "accessing",
  30907. fn: function (){
  30908. var self=this,$self=this;
  30909. return $core.withContext(function($ctx1) {
  30910. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  30911. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{})});
  30912. },
  30913. args: [],
  30914. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  30915. referencedClasses: ["Smalltalk"],
  30916. pragmas: [],
  30917. messageSends: ["current", "at:", "globals"]
  30918. }),
  30919. $globals.Environment);
  30920. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  30921. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  30922. $core.addMethod(
  30923. $core.method({
  30924. selector: "do:on:displaying:",
  30925. protocol: "progress handling",
  30926. fn: function (aBlock,aCollection,aString){
  30927. var self=this,$self=this;
  30928. return $core.withContext(function($ctx1) {
  30929. $recv(aCollection)._do_(aBlock);
  30930. return self;
  30931. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  30932. },
  30933. args: ["aBlock", "aCollection", "aString"],
  30934. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  30935. referencedClasses: [],
  30936. pragmas: [],
  30937. messageSends: ["do:"]
  30938. }),
  30939. $globals.NullProgressHandler);
  30940. $core.setSlots($globals.NullProgressHandler.a$cls, ["current"]);
  30941. $core.addMethod(
  30942. $core.method({
  30943. selector: "initialize",
  30944. protocol: "initialization",
  30945. fn: function (){
  30946. var self=this,$self=this;
  30947. return $core.withContext(function($ctx1) {
  30948. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  30949. return self;
  30950. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  30951. },
  30952. args: [],
  30953. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  30954. referencedClasses: ["ProgressHandler"],
  30955. pragmas: [],
  30956. messageSends: ["registerIfNone:", "new"]
  30957. }),
  30958. $globals.NullProgressHandler.a$cls);
  30959. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  30960. $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.";
  30961. $core.setSlots($globals.Service.a$cls, ["current"]);
  30962. $core.addMethod(
  30963. $core.method({
  30964. selector: "current",
  30965. protocol: "accessing",
  30966. fn: function (){
  30967. var self=this,$self=this;
  30968. return $self.current;
  30969. },
  30970. args: [],
  30971. source: "current\x0a\x09^ current",
  30972. referencedClasses: [],
  30973. pragmas: [],
  30974. messageSends: []
  30975. }),
  30976. $globals.Service.a$cls);
  30977. $core.addMethod(
  30978. $core.method({
  30979. selector: "new",
  30980. protocol: "instance creation",
  30981. fn: function (){
  30982. var self=this,$self=this;
  30983. return $core.withContext(function($ctx1) {
  30984. $self._shouldNotImplement();
  30985. return self;
  30986. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  30987. },
  30988. args: [],
  30989. source: "new\x0a\x09self shouldNotImplement",
  30990. referencedClasses: [],
  30991. pragmas: [],
  30992. messageSends: ["shouldNotImplement"]
  30993. }),
  30994. $globals.Service.a$cls);
  30995. $core.addMethod(
  30996. $core.method({
  30997. selector: "register:",
  30998. protocol: "registration",
  30999. fn: function (anObject){
  31000. var self=this,$self=this;
  31001. $self.current=anObject;
  31002. return self;
  31003. },
  31004. args: ["anObject"],
  31005. source: "register: anObject\x0a\x09current := anObject",
  31006. referencedClasses: [],
  31007. pragmas: [],
  31008. messageSends: []
  31009. }),
  31010. $globals.Service.a$cls);
  31011. $core.addMethod(
  31012. $core.method({
  31013. selector: "registerIfNone:",
  31014. protocol: "registration",
  31015. fn: function (anObject){
  31016. var self=this,$self=this;
  31017. return $core.withContext(function($ctx1) {
  31018. var $1,$receiver;
  31019. $1=$self._current();
  31020. if(($receiver = $1) == null || $receiver.a$nil){
  31021. $self._register_(anObject);
  31022. } else {
  31023. $1;
  31024. }
  31025. return self;
  31026. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject})});
  31027. },
  31028. args: ["anObject"],
  31029. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  31030. referencedClasses: [],
  31031. pragmas: [],
  31032. messageSends: ["ifNil:", "current", "register:"]
  31033. }),
  31034. $globals.Service.a$cls);
  31035. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  31036. $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.";
  31037. $core.addMethod(
  31038. $core.method({
  31039. selector: "handleError:",
  31040. protocol: "error handling",
  31041. fn: function (anError){
  31042. var self=this,$self=this;
  31043. return $core.withContext(function($ctx1) {
  31044. var $1;
  31045. $1=$recv((function(){
  31046. return $core.withContext(function($ctx2) {
  31047. return $recv(anError)._isSmalltalkError();
  31048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31049. }))._tryCatch_((function(){
  31050. return false;
  31051. }));
  31052. if($core.assert($1)){
  31053. $self._handleUnhandledError_(anError);
  31054. $ctx1.sendIdx["handleUnhandledError:"]=1;
  31055. } else {
  31056. var smalltalkError;
  31057. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  31058. $recv(smalltalkError)._wrap();
  31059. $self._handleUnhandledError_(smalltalkError);
  31060. }
  31061. return self;
  31062. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError})});
  31063. },
  31064. args: ["anError"],
  31065. 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 ]",
  31066. referencedClasses: ["JavaScriptException"],
  31067. pragmas: [],
  31068. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  31069. }),
  31070. $globals.ErrorHandler.a$cls);
  31071. $core.addMethod(
  31072. $core.method({
  31073. selector: "handleUnhandledError:",
  31074. protocol: "error handling",
  31075. fn: function (anError){
  31076. var self=this,$self=this;
  31077. return $core.withContext(function($ctx1) {
  31078. var $1;
  31079. $1=$recv(anError)._wasHandled();
  31080. if(!$core.assert($1)){
  31081. $recv($self._current())._handleError_(anError);
  31082. $recv(anError)._beHandled();
  31083. }
  31084. return self;
  31085. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError})});
  31086. },
  31087. args: ["anError"],
  31088. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  31089. referencedClasses: [],
  31090. pragmas: [],
  31091. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  31092. }),
  31093. $globals.ErrorHandler.a$cls);
  31094. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  31095. $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.";
  31096. $core.addMethod(
  31097. $core.method({
  31098. selector: "findClass:",
  31099. protocol: "finding",
  31100. fn: function (aClass){
  31101. var self=this,$self=this;
  31102. return $core.withContext(function($ctx1) {
  31103. return $recv($self._current())._findClass_(aClass);
  31104. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass})});
  31105. },
  31106. args: ["aClass"],
  31107. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  31108. referencedClasses: [],
  31109. pragmas: [],
  31110. messageSends: ["findClass:", "current"]
  31111. }),
  31112. $globals.Finder.a$cls);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "findMethod:",
  31116. protocol: "finding",
  31117. fn: function (aCompiledMethod){
  31118. var self=this,$self=this;
  31119. return $core.withContext(function($ctx1) {
  31120. return $recv($self._current())._findMethod_(aCompiledMethod);
  31121. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod})});
  31122. },
  31123. args: ["aCompiledMethod"],
  31124. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  31125. referencedClasses: [],
  31126. pragmas: [],
  31127. messageSends: ["findMethod:", "current"]
  31128. }),
  31129. $globals.Finder.a$cls);
  31130. $core.addMethod(
  31131. $core.method({
  31132. selector: "findString:",
  31133. protocol: "finding",
  31134. fn: function (aString){
  31135. var self=this,$self=this;
  31136. return $core.withContext(function($ctx1) {
  31137. return $recv($self._current())._findString_(aString);
  31138. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString})});
  31139. },
  31140. args: ["aString"],
  31141. source: "findString: aString\x0a\x09^ self current findString: aString",
  31142. referencedClasses: [],
  31143. pragmas: [],
  31144. messageSends: ["findString:", "current"]
  31145. }),
  31146. $globals.Finder.a$cls);
  31147. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  31148. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  31149. $core.addMethod(
  31150. $core.method({
  31151. selector: "inspect:",
  31152. protocol: "inspecting",
  31153. fn: function (anObject){
  31154. var self=this,$self=this;
  31155. return $core.withContext(function($ctx1) {
  31156. return $recv($self._current())._inspect_(anObject);
  31157. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  31158. },
  31159. args: ["anObject"],
  31160. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  31161. referencedClasses: [],
  31162. pragmas: [],
  31163. messageSends: ["inspect:", "current"]
  31164. }),
  31165. $globals.Inspector.a$cls);
  31166. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  31167. $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";
  31168. $core.addMethod(
  31169. $core.method({
  31170. selector: "fetch:",
  31171. protocol: "accessing",
  31172. fn: function (aStringOrObject){
  31173. var self=this,$self=this;
  31174. return $core.withContext(function($ctx1) {
  31175. return $recv($self._current())._fetch_(aStringOrObject);
  31176. }, function($ctx1) {$ctx1.fill(self,"fetch:",{aStringOrObject:aStringOrObject})});
  31177. },
  31178. args: ["aStringOrObject"],
  31179. source: "fetch: aStringOrObject\x0a\x09^ self current fetch: aStringOrObject",
  31180. referencedClasses: [],
  31181. pragmas: [],
  31182. messageSends: ["fetch:", "current"]
  31183. }),
  31184. $globals.Platform.a$cls);
  31185. $core.addMethod(
  31186. $core.method({
  31187. selector: "fetchUrl:options:",
  31188. protocol: "accessing",
  31189. fn: function (aString,anObject){
  31190. var self=this,$self=this;
  31191. return $core.withContext(function($ctx1) {
  31192. return $recv($self._current())._fetchUrl_options_(aString,anObject);
  31193. }, function($ctx1) {$ctx1.fill(self,"fetchUrl:options:",{aString:aString,anObject:anObject})});
  31194. },
  31195. args: ["aString", "anObject"],
  31196. source: "fetchUrl: aString options: anObject\x0a\x09^ self current fetchUrl: aString options: anObject",
  31197. referencedClasses: [],
  31198. pragmas: [],
  31199. messageSends: ["fetchUrl:options:", "current"]
  31200. }),
  31201. $globals.Platform.a$cls);
  31202. $core.addMethod(
  31203. $core.method({
  31204. selector: "globals",
  31205. protocol: "accessing",
  31206. fn: function (){
  31207. var self=this,$self=this;
  31208. return $core.withContext(function($ctx1) {
  31209. return $recv($self._current())._globals();
  31210. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  31211. },
  31212. args: [],
  31213. source: "globals\x0a\x09^ self current globals",
  31214. referencedClasses: [],
  31215. pragmas: [],
  31216. messageSends: ["globals", "current"]
  31217. }),
  31218. $globals.Platform.a$cls);
  31219. $core.addMethod(
  31220. $core.method({
  31221. selector: "includesGlobal:",
  31222. protocol: "testing",
  31223. fn: function (aString){
  31224. var self=this,$self=this;
  31225. return $core.withContext(function($ctx1) {
  31226. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  31227. return true;
  31228. }),(function(){
  31229. return false;
  31230. }));
  31231. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString})});
  31232. },
  31233. args: ["aString"],
  31234. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  31235. referencedClasses: [],
  31236. pragmas: [],
  31237. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  31238. }),
  31239. $globals.Platform.a$cls);
  31240. $core.addMethod(
  31241. $core.method({
  31242. selector: "newXhr",
  31243. protocol: "accessing",
  31244. fn: function (){
  31245. var self=this,$self=this;
  31246. return $core.withContext(function($ctx1) {
  31247. return $recv($self._current())._newXhr();
  31248. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  31249. },
  31250. args: [],
  31251. source: "newXhr\x0a\x09^ self current newXhr",
  31252. referencedClasses: [],
  31253. pragmas: [],
  31254. messageSends: ["newXhr", "current"]
  31255. }),
  31256. $globals.Platform.a$cls);
  31257. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  31258. $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`.";
  31259. $core.addMethod(
  31260. $core.method({
  31261. selector: "do:on:displaying:",
  31262. protocol: "progress handling",
  31263. fn: function (aBlock,aCollection,aString){
  31264. var self=this,$self=this;
  31265. return $core.withContext(function($ctx1) {
  31266. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  31267. return self;
  31268. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  31269. },
  31270. args: ["aBlock", "aCollection", "aString"],
  31271. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  31272. referencedClasses: [],
  31273. pragmas: [],
  31274. messageSends: ["do:on:displaying:", "current"]
  31275. }),
  31276. $globals.ProgressHandler.a$cls);
  31277. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  31278. $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:'.";
  31279. $core.addMethod(
  31280. $core.method({
  31281. selector: "alert:",
  31282. protocol: "dialogs",
  31283. fn: function (aString){
  31284. var self=this,$self=this;
  31285. return $core.withContext(function($ctx1) {
  31286. return $recv($self._current())._alert_(aString);
  31287. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString})});
  31288. },
  31289. args: ["aString"],
  31290. source: "alert: aString\x0a\x09^ self current alert: aString",
  31291. referencedClasses: [],
  31292. pragmas: [],
  31293. messageSends: ["alert:", "current"]
  31294. }),
  31295. $globals.Terminal.a$cls);
  31296. $core.addMethod(
  31297. $core.method({
  31298. selector: "confirm:",
  31299. protocol: "dialogs",
  31300. fn: function (aString){
  31301. var self=this,$self=this;
  31302. return $core.withContext(function($ctx1) {
  31303. return $recv($self._current())._confirm_(aString);
  31304. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString})});
  31305. },
  31306. args: ["aString"],
  31307. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  31308. referencedClasses: [],
  31309. pragmas: [],
  31310. messageSends: ["confirm:", "current"]
  31311. }),
  31312. $globals.Terminal.a$cls);
  31313. $core.addMethod(
  31314. $core.method({
  31315. selector: "prompt:",
  31316. protocol: "dialogs",
  31317. fn: function (aString){
  31318. var self=this,$self=this;
  31319. return $core.withContext(function($ctx1) {
  31320. return $recv($self._current())._prompt_(aString);
  31321. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString})});
  31322. },
  31323. args: ["aString"],
  31324. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  31325. referencedClasses: [],
  31326. pragmas: [],
  31327. messageSends: ["prompt:", "current"]
  31328. }),
  31329. $globals.Terminal.a$cls);
  31330. $core.addMethod(
  31331. $core.method({
  31332. selector: "prompt:default:",
  31333. protocol: "dialogs",
  31334. fn: function (aString,defaultString){
  31335. var self=this,$self=this;
  31336. return $core.withContext(function($ctx1) {
  31337. return $recv($self._current())._prompt_default_(aString,defaultString);
  31338. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString})});
  31339. },
  31340. args: ["aString", "defaultString"],
  31341. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  31342. referencedClasses: [],
  31343. pragmas: [],
  31344. messageSends: ["prompt:default:", "current"]
  31345. }),
  31346. $globals.Terminal.a$cls);
  31347. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  31348. $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.";
  31349. $core.addMethod(
  31350. $core.method({
  31351. selector: "clear",
  31352. protocol: "printing",
  31353. fn: function (){
  31354. var self=this,$self=this;
  31355. return $core.withContext(function($ctx1) {
  31356. $recv($self._current())._clear();
  31357. return self;
  31358. }, function($ctx1) {$ctx1.fill(self,"clear",{})});
  31359. },
  31360. args: [],
  31361. source: "clear\x0a\x09self current clear",
  31362. referencedClasses: [],
  31363. pragmas: [],
  31364. messageSends: ["clear", "current"]
  31365. }),
  31366. $globals.Transcript.a$cls);
  31367. $core.addMethod(
  31368. $core.method({
  31369. selector: "cr",
  31370. protocol: "printing",
  31371. fn: function (){
  31372. var self=this,$self=this;
  31373. return $core.withContext(function($ctx1) {
  31374. $recv($self._current())._show_($recv($globals.String)._cr());
  31375. return self;
  31376. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  31377. },
  31378. args: [],
  31379. source: "cr\x0a\x09self current show: String cr",
  31380. referencedClasses: ["String"],
  31381. pragmas: [],
  31382. messageSends: ["show:", "current", "cr"]
  31383. }),
  31384. $globals.Transcript.a$cls);
  31385. $core.addMethod(
  31386. $core.method({
  31387. selector: "inspect:",
  31388. protocol: "printing",
  31389. fn: function (anObject){
  31390. var self=this,$self=this;
  31391. return $core.withContext(function($ctx1) {
  31392. $self._show_(anObject);
  31393. return self;
  31394. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  31395. },
  31396. args: ["anObject"],
  31397. source: "inspect: anObject\x0a\x09self show: anObject",
  31398. referencedClasses: [],
  31399. pragmas: [],
  31400. messageSends: ["show:"]
  31401. }),
  31402. $globals.Transcript.a$cls);
  31403. $core.addMethod(
  31404. $core.method({
  31405. selector: "open",
  31406. protocol: "instance creation",
  31407. fn: function (){
  31408. var self=this,$self=this;
  31409. return $core.withContext(function($ctx1) {
  31410. $recv($self._current())._open();
  31411. return self;
  31412. }, function($ctx1) {$ctx1.fill(self,"open",{})});
  31413. },
  31414. args: [],
  31415. source: "open\x0a\x09self current open",
  31416. referencedClasses: [],
  31417. pragmas: [],
  31418. messageSends: ["open", "current"]
  31419. }),
  31420. $globals.Transcript.a$cls);
  31421. $core.addMethod(
  31422. $core.method({
  31423. selector: "show:",
  31424. protocol: "printing",
  31425. fn: function (anObject){
  31426. var self=this,$self=this;
  31427. return $core.withContext(function($ctx1) {
  31428. $recv($self._current())._show_(anObject);
  31429. return self;
  31430. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  31431. },
  31432. args: ["anObject"],
  31433. source: "show: anObject\x0a\x09self current show: anObject",
  31434. referencedClasses: [],
  31435. pragmas: [],
  31436. messageSends: ["show:", "current"]
  31437. }),
  31438. $globals.Transcript.a$cls);
  31439. $core.addMethod(
  31440. $core.method({
  31441. selector: "inspectOn:",
  31442. protocol: "*Platform-Services",
  31443. fn: function (anInspector){
  31444. var self=this,$self=this;
  31445. var variables;
  31446. return $core.withContext(function($ctx1) {
  31447. variables=$recv($globals.Dictionary)._new();
  31448. $recv(variables)._at_put_("#self",self);
  31449. $ctx1.sendIdx["at:put:"]=1;
  31450. $recv(variables)._at_put_("#keys",$self._keys());
  31451. $ctx1.sendIdx["at:put:"]=2;
  31452. $self._keysAndValuesDo_((function(key,value){
  31453. return $core.withContext(function($ctx2) {
  31454. return $recv(variables)._at_put_(key,value);
  31455. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  31456. }));
  31457. $recv(anInspector)._setLabel_($self._printString());
  31458. $recv(anInspector)._setVariables_(variables);
  31459. return self;
  31460. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31461. },
  31462. args: ["anInspector"],
  31463. 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",
  31464. referencedClasses: ["Dictionary"],
  31465. pragmas: [],
  31466. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  31467. }),
  31468. $globals.AssociativeCollection);
  31469. $core.addMethod(
  31470. $core.method({
  31471. selector: "inspectOn:",
  31472. protocol: "*Platform-Services",
  31473. fn: function (anInspector){
  31474. var self=this,$self=this;
  31475. var variables;
  31476. return $core.withContext(function($ctx1) {
  31477. variables=$recv($globals.Dictionary)._new();
  31478. $recv(variables)._at_put_("#self",self);
  31479. $ctx1.sendIdx["at:put:"]=1;
  31480. $self._withIndexDo_((function(each,i){
  31481. return $core.withContext(function($ctx2) {
  31482. return $recv(variables)._at_put_(i,each);
  31483. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  31484. }));
  31485. $recv(anInspector)._setLabel_($self._printString());
  31486. $recv(anInspector)._setVariables_(variables);
  31487. return self;
  31488. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31489. },
  31490. args: ["anInspector"],
  31491. 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",
  31492. referencedClasses: ["Dictionary"],
  31493. pragmas: [],
  31494. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  31495. }),
  31496. $globals.Collection);
  31497. $core.addMethod(
  31498. $core.method({
  31499. selector: "inspectOn:",
  31500. protocol: "*Platform-Services",
  31501. fn: function (anInspector){
  31502. var self=this,$self=this;
  31503. var variables;
  31504. return $core.withContext(function($ctx1) {
  31505. variables=$recv($globals.Dictionary)._new();
  31506. $recv(variables)._at_put_("#self",self);
  31507. $ctx1.sendIdx["at:put:"]=1;
  31508. $recv(variables)._at_put_("#year",$self._year());
  31509. $ctx1.sendIdx["at:put:"]=2;
  31510. $recv(variables)._at_put_("#month",$self._month());
  31511. $ctx1.sendIdx["at:put:"]=3;
  31512. $recv(variables)._at_put_("#day",$self._day());
  31513. $ctx1.sendIdx["at:put:"]=4;
  31514. $recv(variables)._at_put_("#hours",$self._hours());
  31515. $ctx1.sendIdx["at:put:"]=5;
  31516. $recv(variables)._at_put_("#minutes",$self._minutes());
  31517. $ctx1.sendIdx["at:put:"]=6;
  31518. $recv(variables)._at_put_("#seconds",$self._seconds());
  31519. $ctx1.sendIdx["at:put:"]=7;
  31520. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  31521. $recv(anInspector)._setLabel_($self._printString());
  31522. $recv(anInspector)._setVariables_(variables);
  31523. return self;
  31524. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31525. },
  31526. args: ["anInspector"],
  31527. 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",
  31528. referencedClasses: ["Dictionary"],
  31529. pragmas: [],
  31530. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  31531. }),
  31532. $globals.Date);
  31533. $core.addMethod(
  31534. $core.method({
  31535. selector: "inspectOn:",
  31536. protocol: "*Platform-Services",
  31537. fn: function (anInspector){
  31538. var self=this,$self=this;
  31539. var variables;
  31540. return $core.withContext(function($ctx1) {
  31541. variables=$recv($globals.Dictionary)._new();
  31542. $recv(variables)._at_put_("#self",$self._jsObject());
  31543. $recv(anInspector)._setLabel_($self._printString());
  31544. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  31545. $recv(anInspector)._setVariables_(variables);
  31546. return self;
  31547. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31548. },
  31549. args: ["anInspector"],
  31550. 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",
  31551. referencedClasses: ["Dictionary", "JSObjectProxy"],
  31552. pragmas: [],
  31553. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  31554. }),
  31555. $globals.JSObjectProxy);
  31556. $core.addMethod(
  31557. $core.method({
  31558. selector: "inspectOn:",
  31559. protocol: "*Platform-Services",
  31560. fn: function (anInspector){
  31561. var self=this,$self=this;
  31562. var variables;
  31563. return $core.withContext(function($ctx1) {
  31564. variables=$recv($globals.Dictionary)._new();
  31565. $recv(variables)._at_put_("#self",self);
  31566. $ctx1.sendIdx["at:put:"]=1;
  31567. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  31568. return $core.withContext(function($ctx2) {
  31569. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  31570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31571. }));
  31572. $recv(anInspector)._setLabel_($self._printString());
  31573. $recv(anInspector)._setVariables_(variables);
  31574. return self;
  31575. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31576. },
  31577. args: ["anInspector"],
  31578. 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",
  31579. referencedClasses: ["Dictionary"],
  31580. pragmas: [],
  31581. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  31582. }),
  31583. $globals.Object);
  31584. $core.addMethod(
  31585. $core.method({
  31586. selector: "do:displayingProgress:",
  31587. protocol: "*Platform-Services",
  31588. fn: function (aBlock,aString){
  31589. var self=this,$self=this;
  31590. return $core.withContext(function($ctx1) {
  31591. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  31592. return self;
  31593. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString})});
  31594. },
  31595. args: ["aBlock", "aString"],
  31596. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  31597. referencedClasses: ["ProgressHandler"],
  31598. pragmas: [],
  31599. messageSends: ["do:on:displaying:"]
  31600. }),
  31601. $globals.SequenceableCollection);
  31602. $core.addMethod(
  31603. $core.method({
  31604. selector: "inspectOn:",
  31605. protocol: "*Platform-Services",
  31606. fn: function (anInspector){
  31607. var self=this,$self=this;
  31608. var variables,i;
  31609. return $core.withContext(function($ctx1) {
  31610. variables=$recv($globals.Dictionary)._new();
  31611. $recv(variables)._at_put_("#self",self);
  31612. $ctx1.sendIdx["at:put:"]=1;
  31613. i=(1);
  31614. $self._do_((function(each){
  31615. return $core.withContext(function($ctx2) {
  31616. $recv(variables)._at_put_(i,each);
  31617. i=$recv(i).__plus((1));
  31618. return i;
  31619. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31620. }));
  31621. $recv(anInspector)._setLabel_($self._printString());
  31622. $recv(anInspector)._setVariables_(variables);
  31623. return self;
  31624. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i})});
  31625. },
  31626. args: ["anInspector"],
  31627. 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",
  31628. referencedClasses: ["Dictionary"],
  31629. pragmas: [],
  31630. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  31631. }),
  31632. $globals.Set);
  31633. $core.addMethod(
  31634. $core.method({
  31635. selector: "inspectOn:",
  31636. protocol: "*Platform-Services",
  31637. fn: function (anInspector){
  31638. var self=this,$self=this;
  31639. var label;
  31640. return $core.withContext(function($ctx1) {
  31641. var $3,$2,$1,$5,$4;
  31642. (
  31643. $ctx1.supercall = true,
  31644. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  31645. $ctx1.supercall = false;
  31646. $3=$self._printString();
  31647. $ctx1.sendIdx["printString"]=1;
  31648. $2=$recv($3)._size();
  31649. $1=$recv($2).__gt((30));
  31650. if($core.assert($1)){
  31651. $5=$self._printString();
  31652. $ctx1.sendIdx["printString"]=2;
  31653. $4=$recv($5)._copyFrom_to_((1),(30));
  31654. label=$recv($4).__comma("...'");
  31655. label;
  31656. } else {
  31657. label=$self._printString();
  31658. label;
  31659. }
  31660. $recv(anInspector)._setLabel_(label);
  31661. return self;
  31662. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label})});
  31663. },
  31664. args: ["anInspector"],
  31665. 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",
  31666. referencedClasses: [],
  31667. pragmas: [],
  31668. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  31669. }),
  31670. $globals.String);
  31671. $core.addMethod(
  31672. $core.method({
  31673. selector: "inspectOn:",
  31674. protocol: "*Platform-Services",
  31675. fn: function (anInspector){
  31676. var self=this,$self=this;
  31677. var variables;
  31678. return $core.withContext(function($ctx1) {
  31679. variables=$recv($globals.Dictionary)._new();
  31680. $recv(variables)._at_put_("#self",self);
  31681. $ctx1.sendIdx["at:put:"]=1;
  31682. $recv(variables)._at_put_("#home",$self._home());
  31683. $ctx1.sendIdx["at:put:"]=2;
  31684. $recv(variables)._at_put_("#receiver",$self._receiver());
  31685. $ctx1.sendIdx["at:put:"]=3;
  31686. $recv(variables)._at_put_("#selector",$self._selector());
  31687. $ctx1.sendIdx["at:put:"]=4;
  31688. $recv(variables)._at_put_("#locals",$self._locals());
  31689. $ctx1.sendIdx["at:put:"]=5;
  31690. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  31691. return $core.withContext(function($ctx2) {
  31692. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  31693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31694. }));
  31695. $recv(anInspector)._setLabel_($self._printString());
  31696. $recv(anInspector)._setVariables_(variables);
  31697. return self;
  31698. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  31699. },
  31700. args: ["anInspector"],
  31701. 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",
  31702. referencedClasses: ["Dictionary"],
  31703. pragmas: [],
  31704. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  31705. }),
  31706. $globals.TMethodContext);
  31707. });
  31708. define('amber/deploy',[
  31709. './helpers',
  31710. './boot', // pre-fetch, dep of ./helpers
  31711. // --- packages of the core Amber begin here ---
  31712. 'amber/core/Kernel-Helpers',
  31713. 'amber/core/Kernel-Objects',
  31714. 'amber/core/Kernel-Classes',
  31715. 'amber/core/Kernel-Methods',
  31716. 'amber/core/Kernel-Collections',
  31717. 'amber/core/Kernel-Dag',
  31718. 'amber/core/Kernel-Infrastructure',
  31719. 'amber/core/Kernel-Promises',
  31720. 'amber/core/Kernel-Exceptions',
  31721. 'amber/core/Kernel-Announcements',
  31722. 'amber/core/Platform-Services',
  31723. // --- packages of the core Amber end here ---
  31724. ], function (amber) {
  31725. return amber;
  31726. });
  31727. define('amber/core/Platform-ImportExport',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  31728. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31729. var $pkg = $core.addPackage("Platform-ImportExport");
  31730. $pkg.innerEval = function (expr) { return eval(expr); };
  31731. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  31732. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  31733. $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.";
  31734. $core.addMethod(
  31735. $core.method({
  31736. selector: "exportPackage:on:",
  31737. protocol: "output",
  31738. fn: function (aPackage,aStream){
  31739. var self=this,$self=this;
  31740. return $core.withContext(function($ctx1) {
  31741. $self._subclassResponsibility();
  31742. return self;
  31743. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  31744. },
  31745. args: ["aPackage", "aStream"],
  31746. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31747. referencedClasses: [],
  31748. pragmas: [],
  31749. messageSends: ["subclassResponsibility"]
  31750. }),
  31751. $globals.AbstractExporter);
  31752. $core.addMethod(
  31753. $core.method({
  31754. selector: "extensionMethodsOfPackage:",
  31755. protocol: "accessing",
  31756. fn: function (aPackage){
  31757. var self=this,$self=this;
  31758. var result;
  31759. return $core.withContext(function($ctx1) {
  31760. result=$recv($globals.OrderedCollection)._new();
  31761. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  31762. return $core.withContext(function($ctx2) {
  31763. return $recv(result)._addAll_($recv(each)._ownMethods());
  31764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31765. }));
  31766. return result;
  31767. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result})});
  31768. },
  31769. args: ["aPackage"],
  31770. 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",
  31771. referencedClasses: ["OrderedCollection"],
  31772. pragmas: [],
  31773. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  31774. }),
  31775. $globals.AbstractExporter);
  31776. $core.addMethod(
  31777. $core.method({
  31778. selector: "extensionProtocolsOfPackage:",
  31779. protocol: "accessing",
  31780. fn: function (aPackage){
  31781. var self=this,$self=this;
  31782. var extensionName,result;
  31783. return $core.withContext(function($ctx1) {
  31784. var $1,$2,$3;
  31785. $1=$recv(aPackage)._name();
  31786. $ctx1.sendIdx["name"]=1;
  31787. extensionName="*".__comma($1);
  31788. result=$recv($globals.OrderedCollection)._new();
  31789. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  31790. return $core.withContext(function($ctx2) {
  31791. $2=$recv(a)._name();
  31792. $ctx2.sendIdx["name"]=2;
  31793. return $recv($2).__lt($recv(b)._name());
  31794. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31795. })))._do_((function(each){
  31796. return $core.withContext(function($ctx2) {
  31797. return $recv(each)._includingPossibleMetaDo_((function(behavior){
  31798. return $core.withContext(function($ctx3) {
  31799. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  31800. if($core.assert($3)){
  31801. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  31802. }
  31803. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  31804. }));
  31805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31806. }));
  31807. return result;
  31808. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result})});
  31809. },
  31810. args: ["aPackage"],
  31811. 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\x09each includingPossibleMetaDo: [ :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",
  31812. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  31813. pragmas: [],
  31814. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "includingPossibleMetaDo:", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  31815. }),
  31816. $globals.AbstractExporter);
  31817. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31818. $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.";
  31819. $core.addMethod(
  31820. $core.method({
  31821. selector: "chunkEscape:",
  31822. protocol: "convenience",
  31823. fn: function (aString){
  31824. var self=this,$self=this;
  31825. return $core.withContext(function($ctx1) {
  31826. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  31827. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString})});
  31828. },
  31829. args: ["aString"],
  31830. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  31831. referencedClasses: [],
  31832. pragmas: [],
  31833. messageSends: ["trimBoth", "replace:with:"]
  31834. }),
  31835. $globals.ChunkExporter);
  31836. $core.addMethod(
  31837. $core.method({
  31838. selector: "exportBehavior:on:",
  31839. protocol: "output",
  31840. fn: function (aBehavior,aStream){
  31841. var self=this,$self=this;
  31842. return $core.withContext(function($ctx1) {
  31843. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31844. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  31845. return self;
  31846. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  31847. },
  31848. args: ["aBehavior", "aStream"],
  31849. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  31850. referencedClasses: [],
  31851. pragmas: [],
  31852. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  31853. }),
  31854. $globals.ChunkExporter);
  31855. $core.addMethod(
  31856. $core.method({
  31857. selector: "exportCategoryEpilogueOf:on:",
  31858. protocol: "output",
  31859. fn: function (aCategory,aStream){
  31860. var self=this,$self=this;
  31861. return $core.withContext(function($ctx1) {
  31862. $recv(aStream)._write_(" !");
  31863. $recv(aStream)._lf();
  31864. $ctx1.sendIdx["lf"]=1;
  31865. $recv(aStream)._lf();
  31866. return self;
  31867. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream})});
  31868. },
  31869. args: ["aCategory", "aStream"],
  31870. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  31871. referencedClasses: [],
  31872. pragmas: [],
  31873. messageSends: ["write:", "lf"]
  31874. }),
  31875. $globals.ChunkExporter);
  31876. $core.addMethod(
  31877. $core.method({
  31878. selector: "exportCategoryPrologueOf:on:",
  31879. protocol: "output",
  31880. fn: function (aCategory,aStream){
  31881. var self=this,$self=this;
  31882. return $core.withContext(function($ctx1) {
  31883. $recv(aStream)._write_("!");
  31884. $ctx1.sendIdx["write:"]=1;
  31885. $recv(aStream)._print_($recv(aCategory)._theClass());
  31886. $ctx1.sendIdx["print:"]=1;
  31887. $recv(aStream)._write_(" methodsFor: ");
  31888. $ctx1.sendIdx["write:"]=2;
  31889. $recv(aStream)._print_(aCategory);
  31890. $recv(aStream)._write_("!");
  31891. return self;
  31892. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream})});
  31893. },
  31894. args: ["aCategory", "aStream"],
  31895. 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: '!'",
  31896. referencedClasses: [],
  31897. pragmas: [],
  31898. messageSends: ["write:", "print:", "theClass"]
  31899. }),
  31900. $globals.ChunkExporter);
  31901. $core.addMethod(
  31902. $core.method({
  31903. selector: "exportDefinitionOf:on:",
  31904. protocol: "output",
  31905. fn: function (aClass,aStream){
  31906. var self=this,$self=this;
  31907. return $core.withContext(function($ctx1) {
  31908. var $1;
  31909. $recv(aStream)._print_($recv(aClass)._superclass());
  31910. $ctx1.sendIdx["print:"]=1;
  31911. $recv(aStream)._write_(" subclass: ");
  31912. $ctx1.sendIdx["write:"]=1;
  31913. $recv(aStream)._printSymbol_($recv(aClass)._name());
  31914. $recv(aStream)._lf();
  31915. $ctx1.sendIdx["lf"]=1;
  31916. $recv(aStream)._tab();
  31917. $ctx1.sendIdx["tab"]=1;
  31918. $recv(aStream)._write_(["slots: {",". "._join_($recv($recv(aClass)._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  31919. $ctx1.sendIdx["write:"]=2;
  31920. $recv(aStream)._lf();
  31921. $ctx1.sendIdx["lf"]=2;
  31922. $recv(aStream)._tab();
  31923. $recv(aStream)._write_("package: ");
  31924. $ctx1.sendIdx["write:"]=3;
  31925. $recv(aStream)._print_($recv(aClass)._category());
  31926. $ctx1.sendIdx["print:"]=2;
  31927. $recv(aStream)._write_("!");
  31928. $ctx1.sendIdx["write:"]=4;
  31929. $recv(aStream)._lf();
  31930. $ctx1.sendIdx["lf"]=3;
  31931. $1=$recv(aClass)._comment();
  31932. $ctx1.sendIdx["comment"]=1;
  31933. $recv($1)._ifNotEmpty_((function(){
  31934. return $core.withContext(function($ctx2) {
  31935. $recv(aStream)._write_("!");
  31936. $ctx2.sendIdx["write:"]=5;
  31937. $recv(aStream)._print_(aClass);
  31938. $recv(aStream)._write_(" commentStamp!");
  31939. $ctx2.sendIdx["write:"]=6;
  31940. $recv(aStream)._lf();
  31941. $ctx2.sendIdx["lf"]=4;
  31942. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  31943. return $recv(aStream)._lf();
  31944. $ctx2.sendIdx["lf"]=5;
  31945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31946. }));
  31947. $recv(aStream)._lf();
  31948. return self;
  31949. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31950. },
  31951. args: ["aClass", "aStream"],
  31952. 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: {'slots: {'. ('. ' join: (aClass instanceVariableNames collect: #symbolPrintString)). '}'};\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",
  31953. referencedClasses: [],
  31954. pragmas: [],
  31955. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "collect:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  31956. }),
  31957. $globals.ChunkExporter);
  31958. $core.addMethod(
  31959. $core.method({
  31960. selector: "exportMetaDefinitionOf:on:",
  31961. protocol: "output",
  31962. fn: function (aClass,aStream){
  31963. var self=this,$self=this;
  31964. var classIvars,classTraitComposition;
  31965. return $core.withContext(function($ctx1) {
  31966. var $1,$2;
  31967. $1=$recv(aClass)._class();
  31968. $ctx1.sendIdx["class"]=1;
  31969. classIvars=$recv($1)._instanceVariableNames();
  31970. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  31971. $2=$recv(classIvars)._notEmpty();
  31972. if($core.assert($2)){
  31973. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  31974. $recv(aStream)._space();
  31975. $recv(aStream)._write_(["slots: {",". "._join_($recv(classIvars)._collect_("symbolPrintString")),"}!"]);
  31976. $recv(aStream)._lf();
  31977. $ctx1.sendIdx["lf"]=1;
  31978. $recv(aStream)._lf();
  31979. }
  31980. return self;
  31981. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition})});
  31982. },
  31983. args: ["aClass", "aStream"],
  31984. 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: {'slots: {'. ('. ' join: (classIvars collect: #symbolPrintString)). '}!'}; lf; lf ]",
  31985. referencedClasses: [],
  31986. pragmas: [],
  31987. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "collect:", "lf"]
  31988. }),
  31989. $globals.ChunkExporter);
  31990. $core.addMethod(
  31991. $core.method({
  31992. selector: "exportMethod:on:",
  31993. protocol: "output",
  31994. fn: function (aMethod,aStream){
  31995. var self=this,$self=this;
  31996. return $core.withContext(function($ctx1) {
  31997. $recv(aStream)._lf();
  31998. $ctx1.sendIdx["lf"]=1;
  31999. $recv(aStream)._lf();
  32000. $ctx1.sendIdx["lf"]=2;
  32001. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  32002. $ctx1.sendIdx["write:"]=1;
  32003. $recv(aStream)._lf();
  32004. $recv(aStream)._write_("!");
  32005. return self;
  32006. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  32007. },
  32008. args: ["aMethod", "aStream"],
  32009. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  32010. referencedClasses: [],
  32011. pragmas: [],
  32012. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  32013. }),
  32014. $globals.ChunkExporter);
  32015. $core.addMethod(
  32016. $core.method({
  32017. selector: "exportPackage:on:",
  32018. protocol: "output",
  32019. fn: function (aPackage,aStream){
  32020. var self=this,$self=this;
  32021. return $core.withContext(function($ctx1) {
  32022. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  32023. $self._exportPackageImportsOf_on_(aPackage,aStream);
  32024. $recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  32025. return $core.withContext(function($ctx2) {
  32026. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  32027. return $core.withContext(function($ctx3) {
  32028. return $self._exportBehavior_on_(each,aStream);
  32029. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  32030. }));
  32031. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  32032. }));
  32033. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  32034. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  32035. return self;
  32036. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  32037. },
  32038. args: ["aPackage", "aStream"],
  32039. 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: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  32040. referencedClasses: [],
  32041. pragmas: [],
  32042. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  32043. }),
  32044. $globals.ChunkExporter);
  32045. $core.addMethod(
  32046. $core.method({
  32047. selector: "exportPackageDefinitionOf:on:",
  32048. protocol: "output",
  32049. fn: function (aPackage,aStream){
  32050. var self=this,$self=this;
  32051. return $core.withContext(function($ctx1) {
  32052. $recv(aStream)._write_("Smalltalk createPackage: ");
  32053. $ctx1.sendIdx["write:"]=1;
  32054. $recv(aStream)._print_($recv(aPackage)._name());
  32055. $recv(aStream)._write_("!");
  32056. $recv(aStream)._lf();
  32057. return self;
  32058. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  32059. },
  32060. args: ["aPackage", "aStream"],
  32061. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  32062. referencedClasses: [],
  32063. pragmas: [],
  32064. messageSends: ["write:", "print:", "name", "lf"]
  32065. }),
  32066. $globals.ChunkExporter);
  32067. $core.addMethod(
  32068. $core.method({
  32069. selector: "exportPackageImportsOf:on:",
  32070. protocol: "output",
  32071. fn: function (aPackage,aStream){
  32072. var self=this,$self=this;
  32073. return $core.withContext(function($ctx1) {
  32074. var $1;
  32075. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  32076. return $core.withContext(function($ctx2) {
  32077. $recv(aStream)._write_("(Smalltalk packageAt: ");
  32078. $ctx2.sendIdx["write:"]=1;
  32079. $1=$recv(aPackage)._name();
  32080. $ctx2.sendIdx["name"]=1;
  32081. $recv(aStream)._print_($1);
  32082. $ctx2.sendIdx["print:"]=1;
  32083. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  32084. $ctx2.sendIdx["write:"]=2;
  32085. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  32086. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  32087. return $recv(aStream)._lf();
  32088. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  32089. }));
  32090. return self;
  32091. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32092. },
  32093. args: ["aPackage", "aStream"],
  32094. 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 ]",
  32095. referencedClasses: [],
  32096. pragmas: [],
  32097. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  32098. }),
  32099. $globals.ChunkExporter);
  32100. $core.addMethod(
  32101. $core.method({
  32102. selector: "exportPackageTraitCompositionsOf:on:",
  32103. protocol: "output",
  32104. fn: function (aPackage,aStream){
  32105. var self=this,$self=this;
  32106. return $core.withContext(function($ctx1) {
  32107. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  32108. return $core.withContext(function($ctx2) {
  32109. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  32110. return $core.withContext(function($ctx3) {
  32111. return $self._exportTraitComposition_of_on_(value,key,aStream);
  32112. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  32113. }));
  32114. $recv(aStream)._write_("! !");
  32115. $recv(aStream)._lf();
  32116. $ctx2.sendIdx["lf"]=1;
  32117. return $recv(aStream)._lf();
  32118. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  32119. }));
  32120. return self;
  32121. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32122. },
  32123. args: ["aPackage", "aStream"],
  32124. 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 ]",
  32125. referencedClasses: [],
  32126. pragmas: [],
  32127. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  32128. }),
  32129. $globals.ChunkExporter);
  32130. $core.addMethod(
  32131. $core.method({
  32132. selector: "exportProtocol:on:",
  32133. protocol: "output",
  32134. fn: function (aProtocol,aStream){
  32135. var self=this,$self=this;
  32136. return $core.withContext(function($ctx1) {
  32137. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  32138. return $core.withContext(function($ctx2) {
  32139. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  32140. $recv(methods)._do_((function(method){
  32141. return $core.withContext(function($ctx3) {
  32142. return $self._exportMethod_on_(method,aStream);
  32143. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  32144. }));
  32145. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  32146. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  32147. }));
  32148. return self;
  32149. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream})});
  32150. },
  32151. args: ["aProtocol", "aStream"],
  32152. 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 ]",
  32153. referencedClasses: [],
  32154. pragmas: [],
  32155. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  32156. }),
  32157. $globals.ChunkExporter);
  32158. $core.addMethod(
  32159. $core.method({
  32160. selector: "exportProtocolEpilogueOf:on:",
  32161. protocol: "output",
  32162. fn: function (aProtocol,aStream){
  32163. var self=this,$self=this;
  32164. return $core.withContext(function($ctx1) {
  32165. $recv(aStream)._write_(" !");
  32166. $recv(aStream)._lf();
  32167. $ctx1.sendIdx["lf"]=1;
  32168. $recv(aStream)._lf();
  32169. return self;
  32170. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  32171. },
  32172. args: ["aProtocol", "aStream"],
  32173. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  32174. referencedClasses: [],
  32175. pragmas: [],
  32176. messageSends: ["write:", "lf"]
  32177. }),
  32178. $globals.ChunkExporter);
  32179. $core.addMethod(
  32180. $core.method({
  32181. selector: "exportProtocolPrologueOf:on:",
  32182. protocol: "output",
  32183. fn: function (aProtocol,aStream){
  32184. var self=this,$self=this;
  32185. return $core.withContext(function($ctx1) {
  32186. $recv(aStream)._write_("!");
  32187. $ctx1.sendIdx["write:"]=1;
  32188. $recv(aStream)._print_($recv(aProtocol)._theClass());
  32189. $ctx1.sendIdx["print:"]=1;
  32190. $recv(aStream)._write_(" methodsFor: ");
  32191. $ctx1.sendIdx["write:"]=2;
  32192. $recv(aStream)._print_($recv(aProtocol)._name());
  32193. $recv(aStream)._write_("!");
  32194. return self;
  32195. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  32196. },
  32197. args: ["aProtocol", "aStream"],
  32198. 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: '!'",
  32199. referencedClasses: [],
  32200. pragmas: [],
  32201. messageSends: ["write:", "print:", "theClass", "name"]
  32202. }),
  32203. $globals.ChunkExporter);
  32204. $core.addMethod(
  32205. $core.method({
  32206. selector: "exportProtocols:on:",
  32207. protocol: "output",
  32208. fn: function (aCollection,aStream){
  32209. var self=this,$self=this;
  32210. return $core.withContext(function($ctx1) {
  32211. $recv(aCollection)._do_((function(each){
  32212. return $core.withContext(function($ctx2) {
  32213. return $self._exportProtocol_on_(each,aStream);
  32214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32215. }));
  32216. return self;
  32217. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream})});
  32218. },
  32219. args: ["aCollection", "aStream"],
  32220. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  32221. referencedClasses: [],
  32222. pragmas: [],
  32223. messageSends: ["do:", "exportProtocol:on:"]
  32224. }),
  32225. $globals.ChunkExporter);
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "exportTraitComposition:of:on:",
  32229. protocol: "output",
  32230. fn: function (aTraitComposition,aBehavior,aStream){
  32231. var self=this,$self=this;
  32232. return $core.withContext(function($ctx1) {
  32233. $recv(aStream)._print_(aBehavior);
  32234. $recv(aStream)._write_(" setTraitComposition: ");
  32235. $ctx1.sendIdx["write:"]=1;
  32236. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  32237. $ctx1.sendIdx["write:"]=2;
  32238. $recv(aStream)._write_(" asTraitComposition!");
  32239. $recv(aStream)._lf();
  32240. return self;
  32241. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  32242. },
  32243. args: ["aTraitComposition", "aBehavior", "aStream"],
  32244. 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",
  32245. referencedClasses: [],
  32246. pragmas: [],
  32247. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  32248. }),
  32249. $globals.ChunkExporter);
  32250. $core.addMethod(
  32251. $core.method({
  32252. selector: "exportTraitDefinitionOf:on:",
  32253. protocol: "output",
  32254. fn: function (aClass,aStream){
  32255. var self=this,$self=this;
  32256. return $core.withContext(function($ctx1) {
  32257. var $1;
  32258. $recv(aStream)._write_("Trait named: ");
  32259. $ctx1.sendIdx["write:"]=1;
  32260. $recv(aStream)._printSymbol_($recv(aClass)._name());
  32261. $recv(aStream)._lf();
  32262. $ctx1.sendIdx["lf"]=1;
  32263. $recv(aStream)._tab();
  32264. $recv(aStream)._write_("package: ");
  32265. $ctx1.sendIdx["write:"]=2;
  32266. $recv(aStream)._print_($recv(aClass)._category());
  32267. $ctx1.sendIdx["print:"]=1;
  32268. $recv(aStream)._write_("!");
  32269. $ctx1.sendIdx["write:"]=3;
  32270. $recv(aStream)._lf();
  32271. $ctx1.sendIdx["lf"]=2;
  32272. $1=$recv(aClass)._comment();
  32273. $ctx1.sendIdx["comment"]=1;
  32274. $recv($1)._ifNotEmpty_((function(){
  32275. return $core.withContext(function($ctx2) {
  32276. $recv(aStream)._write_("!");
  32277. $ctx2.sendIdx["write:"]=4;
  32278. $recv(aStream)._print_(aClass);
  32279. $recv(aStream)._write_(" commentStamp!");
  32280. $ctx2.sendIdx["write:"]=5;
  32281. $recv(aStream)._lf();
  32282. $ctx2.sendIdx["lf"]=3;
  32283. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  32284. return $recv(aStream)._lf();
  32285. $ctx2.sendIdx["lf"]=4;
  32286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32287. }));
  32288. $recv(aStream)._lf();
  32289. return self;
  32290. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32291. },
  32292. args: ["aClass", "aStream"],
  32293. 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",
  32294. referencedClasses: [],
  32295. pragmas: [],
  32296. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  32297. }),
  32298. $globals.ChunkExporter);
  32299. $core.addMethod(
  32300. $core.method({
  32301. selector: "extensionCategoriesOfPackage:",
  32302. protocol: "accessing",
  32303. fn: function (aPackage){
  32304. var self=this,$self=this;
  32305. var name,map,result;
  32306. return $core.withContext(function($ctx1) {
  32307. var $1;
  32308. name=$recv(aPackage)._name();
  32309. result=$recv($globals.OrderedCollection)._new();
  32310. $ctx1.sendIdx["new"]=1;
  32311. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  32312. return $core.withContext(function($ctx2) {
  32313. return $recv(each)._includingPossibleMetaDo_((function(aClass){
  32314. return $core.withContext(function($ctx3) {
  32315. map=$recv($globals.Dictionary)._new();
  32316. $recv(aClass)._protocolsDo_((function(category,methods){
  32317. return $core.withContext(function($ctx4) {
  32318. $1=$recv(category).__eq("*".__comma(name));
  32319. if($core.assert($1)){
  32320. return $recv(map)._at_put_(category,methods);
  32321. }
  32322. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  32323. }));
  32324. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  32325. return $core.withContext(function($ctx4) {
  32326. return $recv(a).__lt_eq(b);
  32327. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  32328. })))._collect_((function(category){
  32329. return $core.withContext(function($ctx4) {
  32330. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  32331. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  32332. })));
  32333. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  32334. }));
  32335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32336. }));
  32337. return result;
  32338. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result})});
  32339. },
  32340. args: ["aPackage"],
  32341. 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\x09each includingPossibleMetaDo: [ :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",
  32342. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  32343. pragmas: [],
  32344. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "includingPossibleMetaDo:", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  32345. }),
  32346. $globals.ChunkExporter);
  32347. $core.addMethod(
  32348. $core.method({
  32349. selector: "ownCategoriesOfClass:",
  32350. protocol: "accessing",
  32351. fn: function (aClass){
  32352. var self=this,$self=this;
  32353. var map;
  32354. return $core.withContext(function($ctx1) {
  32355. var $1;
  32356. map=$recv($globals.Dictionary)._new();
  32357. $recv(aClass)._protocolsDo_((function(each,methods){
  32358. return $core.withContext(function($ctx2) {
  32359. $1=$recv(each)._match_("^\x5c*");
  32360. if(!$core.assert($1)){
  32361. return $recv(map)._at_put_(each,methods);
  32362. }
  32363. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  32364. }));
  32365. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  32366. return $core.withContext(function($ctx2) {
  32367. return $recv(a).__lt_eq(b);
  32368. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  32369. })))._collect_((function(each){
  32370. return $core.withContext(function($ctx2) {
  32371. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  32372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  32373. }));
  32374. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map})});
  32375. },
  32376. args: ["aClass"],
  32377. 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) ]",
  32378. referencedClasses: ["Dictionary", "MethodCategory"],
  32379. pragmas: [],
  32380. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  32381. }),
  32382. $globals.ChunkExporter);
  32383. $core.addMethod(
  32384. $core.method({
  32385. selector: "ownCategoriesOfMetaClass:",
  32386. protocol: "accessing",
  32387. fn: function (aClass){
  32388. var self=this,$self=this;
  32389. return $core.withContext(function($ctx1) {
  32390. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  32391. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass})});
  32392. },
  32393. args: ["aClass"],
  32394. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  32395. referencedClasses: [],
  32396. pragmas: [],
  32397. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  32398. }),
  32399. $globals.ChunkExporter);
  32400. $core.addMethod(
  32401. $core.method({
  32402. selector: "ownMethodProtocolsOfClass:",
  32403. protocol: "accessing",
  32404. fn: function (aClass){
  32405. var self=this,$self=this;
  32406. return $core.withContext(function($ctx1) {
  32407. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  32408. return $core.withContext(function($ctx2) {
  32409. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  32410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32411. }));
  32412. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass})});
  32413. },
  32414. args: ["aClass"],
  32415. 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 ]",
  32416. referencedClasses: ["ExportMethodProtocol"],
  32417. pragmas: [],
  32418. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  32419. }),
  32420. $globals.ChunkExporter);
  32421. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  32422. $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.).";
  32423. $core.addMethod(
  32424. $core.method({
  32425. selector: "exportBehavior:on:",
  32426. protocol: "output",
  32427. fn: function (aBehavior,aStream){
  32428. var self=this,$self=this;
  32429. return $core.withContext(function($ctx1) {
  32430. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  32431. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  32432. return $core.withContext(function($ctx2) {
  32433. return $self._exportMethod_on_(method,aStream);
  32434. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  32435. }));
  32436. return self;
  32437. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  32438. },
  32439. args: ["aBehavior", "aStream"],
  32440. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  32441. referencedClasses: [],
  32442. pragmas: [],
  32443. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  32444. }),
  32445. $globals.Exporter);
  32446. $core.addMethod(
  32447. $core.method({
  32448. selector: "exportDefinitionOf:on:",
  32449. protocol: "output",
  32450. fn: function (aClass,aStream){
  32451. var self=this,$self=this;
  32452. return $core.withContext(function($ctx1) {
  32453. var $2,$4,$3,$5,$6,$1,$7,$9,$8,$receiver;
  32454. $recv(aStream)._lf();
  32455. $ctx1.sendIdx["lf"]=1;
  32456. $2=$recv($recv(aClass)._name())._asJavaScriptSource();
  32457. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32458. $4=$recv(aClass)._superclass();
  32459. if(($receiver = $4) == null || $receiver.a$nil){
  32460. $3="null";
  32461. } else {
  32462. var superclass;
  32463. superclass=$receiver;
  32464. $3=$recv(superclass)._asJavaScriptSource();
  32465. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32466. }
  32467. $5=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  32468. $ctx1.sendIdx["asJavaScriptSource"]=3;
  32469. $6=$recv($recv(aClass)._category())._asJavaScriptSource();
  32470. $ctx1.sendIdx["asJavaScriptSource"]=4;
  32471. $1=["$core.addClass(",$2,", ",$3,", ",$5,", ",$6,");"];
  32472. $recv(aStream)._write_($1);
  32473. $ctx1.sendIdx["write:"]=1;
  32474. $7=$recv(aClass)._comment();
  32475. $ctx1.sendIdx["comment"]=1;
  32476. $recv($7)._ifNotEmpty_((function(){
  32477. return $core.withContext(function($ctx2) {
  32478. $recv(aStream)._lf();
  32479. $ctx2.sendIdx["lf"]=2;
  32480. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32481. $ctx2.sendIdx["write:"]=2;
  32482. $recv(aStream)._lf();
  32483. $ctx2.sendIdx["lf"]=3;
  32484. $9=$recv(aClass)._asJavaScriptSource();
  32485. $ctx2.sendIdx["asJavaScriptSource"]=5;
  32486. $8=[$9,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  32487. $recv(aStream)._write_($8);
  32488. $ctx2.sendIdx["write:"]=3;
  32489. $recv(aStream)._lf();
  32490. $ctx2.sendIdx["lf"]=4;
  32491. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  32493. }));
  32494. $recv(aStream)._lf();
  32495. return self;
  32496. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32497. },
  32498. args: ["aClass", "aStream"],
  32499. 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",
  32500. referencedClasses: [],
  32501. pragmas: [],
  32502. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  32503. }),
  32504. $globals.Exporter);
  32505. $core.addMethod(
  32506. $core.method({
  32507. selector: "exportMetaDefinitionOf:on:",
  32508. protocol: "output",
  32509. fn: function (aClass,aStream){
  32510. var self=this,$self=this;
  32511. return $core.withContext(function($ctx1) {
  32512. var $2,$1,$4,$3;
  32513. $recv(aStream)._lf();
  32514. $ctx1.sendIdx["lf"]=1;
  32515. $2=$recv(aClass)._theMetaClass();
  32516. $ctx1.sendIdx["theMetaClass"]=1;
  32517. $1=$recv($2)._instanceVariableNames();
  32518. $recv($1)._ifNotEmpty_((function(classIvars){
  32519. return $core.withContext(function($ctx2) {
  32520. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  32521. $ctx2.sendIdx["asJavaScriptSource"]=1;
  32522. $3=["$core.setSlots(",$4,", ",$recv(classIvars)._asJavaScriptSource(),");"];
  32523. $recv(aStream)._write_($3);
  32524. return $recv(aStream)._lf();
  32525. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  32526. }));
  32527. return self;
  32528. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32529. },
  32530. args: ["aClass", "aStream"],
  32531. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { '$core.setSlots('. aClass theMetaClass asJavaScriptSource. ', '. classIvars asJavaScriptSource. ');' };\x0a\x09\x09lf ]",
  32532. referencedClasses: [],
  32533. pragmas: [],
  32534. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  32535. }),
  32536. $globals.Exporter);
  32537. $core.addMethod(
  32538. $core.method({
  32539. selector: "exportMethod:on:",
  32540. protocol: "output",
  32541. fn: function (aMethod,aStream){
  32542. var self=this,$self=this;
  32543. return $core.withContext(function($ctx1) {
  32544. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13;
  32545. $recv(aStream)._write_("$core.addMethod(");
  32546. $ctx1.sendIdx["write:"]=1;
  32547. $recv(aStream)._lf();
  32548. $ctx1.sendIdx["lf"]=1;
  32549. $recv(aStream)._write_("$core.method({");
  32550. $ctx1.sendIdx["write:"]=2;
  32551. $recv(aStream)._lf();
  32552. $ctx1.sendIdx["lf"]=2;
  32553. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  32554. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32555. $1=["selector: ",$2,","];
  32556. $recv(aStream)._write_($1);
  32557. $ctx1.sendIdx["write:"]=3;
  32558. $recv(aStream)._lf();
  32559. $ctx1.sendIdx["lf"]=3;
  32560. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  32561. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32562. $3=["protocol: ",$4,","];
  32563. $recv(aStream)._write_($3);
  32564. $ctx1.sendIdx["write:"]=4;
  32565. $recv(aStream)._lf();
  32566. $ctx1.sendIdx["lf"]=4;
  32567. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  32568. $ctx1.sendIdx["write:"]=5;
  32569. $recv(aStream)._lf();
  32570. $ctx1.sendIdx["lf"]=5;
  32571. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32572. $ctx1.sendIdx["write:"]=6;
  32573. $recv(aStream)._lf();
  32574. $ctx1.sendIdx["lf"]=6;
  32575. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  32576. $ctx1.sendIdx["asJavaScriptSource"]=3;
  32577. $5=["args: ",$6,","];
  32578. $recv(aStream)._write_($5);
  32579. $ctx1.sendIdx["write:"]=7;
  32580. $recv(aStream)._lf();
  32581. $ctx1.sendIdx["lf"]=7;
  32582. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  32583. $ctx1.sendIdx["asJavaScriptSource"]=4;
  32584. $7=["source: ",$8,","];
  32585. $recv(aStream)._write_($7);
  32586. $ctx1.sendIdx["write:"]=8;
  32587. $recv(aStream)._lf();
  32588. $ctx1.sendIdx["lf"]=8;
  32589. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  32590. $ctx1.sendIdx["asJavaScriptSource"]=5;
  32591. $9=["referencedClasses: ",$10,","];
  32592. $recv(aStream)._write_($9);
  32593. $ctx1.sendIdx["write:"]=9;
  32594. $recv(aStream)._lf();
  32595. $ctx1.sendIdx["lf"]=9;
  32596. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32597. $ctx1.sendIdx["write:"]=10;
  32598. $recv(aStream)._lf();
  32599. $ctx1.sendIdx["lf"]=10;
  32600. $12=$recv($recv(aMethod)._basicPragmas())._asJavaScriptSource();
  32601. $ctx1.sendIdx["asJavaScriptSource"]=6;
  32602. $11=["pragmas: ",$12,","];
  32603. $recv(aStream)._write_($11);
  32604. $ctx1.sendIdx["write:"]=11;
  32605. $recv(aStream)._lf();
  32606. $ctx1.sendIdx["lf"]=11;
  32607. $14=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  32608. $ctx1.sendIdx["asJavaScriptSource"]=7;
  32609. $13=["messageSends: ",$14];
  32610. $recv(aStream)._write_($13);
  32611. $ctx1.sendIdx["write:"]=12;
  32612. $recv(aStream)._lf();
  32613. $ctx1.sendIdx["lf"]=12;
  32614. $recv(aStream)._write_("}),");
  32615. $ctx1.sendIdx["write:"]=13;
  32616. $recv(aStream)._lf();
  32617. $ctx1.sendIdx["lf"]=13;
  32618. $recv(aStream)._write_([$recv($recv(aMethod)._origin())._asJavaScriptSource(),");"]);
  32619. $recv(aStream)._lf();
  32620. $ctx1.sendIdx["lf"]=14;
  32621. $recv(aStream)._lf();
  32622. return self;
  32623. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  32624. },
  32625. args: ["aMethod", "aStream"],
  32626. 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: { 'pragmas: '. aMethod basicPragmas asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod origin asJavaScriptSource. ');' }; lf; lf",
  32627. referencedClasses: [],
  32628. pragmas: [],
  32629. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "basicPragmas", "messageSends", "origin"]
  32630. }),
  32631. $globals.Exporter);
  32632. $core.addMethod(
  32633. $core.method({
  32634. selector: "exportPackage:on:",
  32635. protocol: "output",
  32636. fn: function (aPackage,aStream){
  32637. var self=this,$self=this;
  32638. return $core.withContext(function($ctx1) {
  32639. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  32640. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  32641. $self._exportPackageContextOf_on_(aPackage,aStream);
  32642. $self._exportPackageImportsOf_on_(aPackage,aStream);
  32643. $self._exportPackageTransportOf_on_(aPackage,aStream);
  32644. $recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  32645. return $core.withContext(function($ctx2) {
  32646. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  32647. return $core.withContext(function($ctx3) {
  32648. return $self._exportBehavior_on_(each,aStream);
  32649. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  32650. }));
  32651. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  32652. }));
  32653. $ctx1.sendIdx["do:"]=1;
  32654. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  32655. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  32656. return $core.withContext(function($ctx2) {
  32657. return $self._exportMethod_on_(each,aStream);
  32658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  32659. }));
  32660. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  32661. return self;
  32662. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  32663. },
  32664. args: ["aPackage", "aStream"],
  32665. 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: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09self exportBehavior: each 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",
  32666. referencedClasses: [],
  32667. pragmas: [],
  32668. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  32669. }),
  32670. $globals.Exporter);
  32671. $core.addMethod(
  32672. $core.method({
  32673. selector: "exportPackageBodyBlockPrologueOf:on:",
  32674. protocol: "output",
  32675. fn: function (aPackage,aStream){
  32676. var self=this,$self=this;
  32677. return $core.withContext(function($ctx1) {
  32678. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  32679. $recv(aStream)._lf();
  32680. return self;
  32681. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32682. },
  32683. args: ["aPackage", "aStream"],
  32684. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  32685. referencedClasses: [],
  32686. pragmas: [],
  32687. messageSends: ["write:", "lf"]
  32688. }),
  32689. $globals.Exporter);
  32690. $core.addMethod(
  32691. $core.method({
  32692. selector: "exportPackageContextOf:on:",
  32693. protocol: "output",
  32694. fn: function (aPackage,aStream){
  32695. var self=this,$self=this;
  32696. return $core.withContext(function($ctx1) {
  32697. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  32698. $recv(aStream)._lf();
  32699. return self;
  32700. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream})});
  32701. },
  32702. args: ["aPackage", "aStream"],
  32703. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  32704. referencedClasses: [],
  32705. pragmas: [],
  32706. messageSends: ["write:", "lf"]
  32707. }),
  32708. $globals.Exporter);
  32709. $core.addMethod(
  32710. $core.method({
  32711. selector: "exportPackageDefinitionOf:on:",
  32712. protocol: "output",
  32713. fn: function (aPackage,aStream){
  32714. var self=this,$self=this;
  32715. return $core.withContext(function($ctx1) {
  32716. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  32717. $recv(aStream)._lf();
  32718. return self;
  32719. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  32720. },
  32721. args: ["aPackage", "aStream"],
  32722. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  32723. referencedClasses: [],
  32724. pragmas: [],
  32725. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  32726. }),
  32727. $globals.Exporter);
  32728. $core.addMethod(
  32729. $core.method({
  32730. selector: "exportPackageEpilogueOf:on:",
  32731. protocol: "output",
  32732. fn: function (aPackage,aStream){
  32733. var self=this,$self=this;
  32734. return $core.withContext(function($ctx1) {
  32735. $self._subclassResponsibility();
  32736. return self;
  32737. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32738. },
  32739. args: ["aPackage", "aStream"],
  32740. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  32741. referencedClasses: [],
  32742. pragmas: [],
  32743. messageSends: ["subclassResponsibility"]
  32744. }),
  32745. $globals.Exporter);
  32746. $core.addMethod(
  32747. $core.method({
  32748. selector: "exportPackageImportsOf:on:",
  32749. protocol: "output",
  32750. fn: function (aPackage,aStream){
  32751. var self=this,$self=this;
  32752. return $core.withContext(function($ctx1) {
  32753. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  32754. return $core.withContext(function($ctx2) {
  32755. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  32756. return $recv(aStream)._lf();
  32757. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  32758. }));
  32759. return self;
  32760. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32761. },
  32762. args: ["aPackage", "aStream"],
  32763. 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 ]",
  32764. referencedClasses: [],
  32765. pragmas: [],
  32766. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  32767. }),
  32768. $globals.Exporter);
  32769. $core.addMethod(
  32770. $core.method({
  32771. selector: "exportPackagePrologueOf:on:",
  32772. protocol: "output",
  32773. fn: function (aPackage,aStream){
  32774. var self=this,$self=this;
  32775. return $core.withContext(function($ctx1) {
  32776. $self._subclassResponsibility();
  32777. return self;
  32778. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  32779. },
  32780. args: ["aPackage", "aStream"],
  32781. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  32782. referencedClasses: [],
  32783. pragmas: [],
  32784. messageSends: ["subclassResponsibility"]
  32785. }),
  32786. $globals.Exporter);
  32787. $core.addMethod(
  32788. $core.method({
  32789. selector: "exportPackageTraitCompositionsOf:on:",
  32790. protocol: "output",
  32791. fn: function (aPackage,aStream){
  32792. var self=this,$self=this;
  32793. return $core.withContext(function($ctx1) {
  32794. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  32795. return $core.withContext(function($ctx2) {
  32796. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  32797. return $core.withContext(function($ctx3) {
  32798. return $self._exportTraitComposition_of_on_(value,key,aStream);
  32799. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  32800. }));
  32801. return $recv(aStream)._lf();
  32802. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  32803. }));
  32804. return self;
  32805. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  32806. },
  32807. args: ["aPackage", "aStream"],
  32808. 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 ]",
  32809. referencedClasses: [],
  32810. pragmas: [],
  32811. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  32812. }),
  32813. $globals.Exporter);
  32814. $core.addMethod(
  32815. $core.method({
  32816. selector: "exportPackageTransportOf:on:",
  32817. protocol: "output",
  32818. fn: function (aPackage,aStream){
  32819. var self=this,$self=this;
  32820. return $core.withContext(function($ctx1) {
  32821. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  32822. $recv(aStream)._lf();
  32823. return self;
  32824. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream})});
  32825. },
  32826. args: ["aPackage", "aStream"],
  32827. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  32828. referencedClasses: [],
  32829. pragmas: [],
  32830. messageSends: ["write:", "asJSONString", "transport", "lf"]
  32831. }),
  32832. $globals.Exporter);
  32833. $core.addMethod(
  32834. $core.method({
  32835. selector: "exportTraitComposition:of:on:",
  32836. protocol: "output",
  32837. fn: function (aTraitComposition,aBehavior,aStream){
  32838. var self=this,$self=this;
  32839. return $core.withContext(function($ctx1) {
  32840. var $2,$1;
  32841. $2=$recv(aTraitComposition)._asJavaScriptSource();
  32842. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32843. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  32844. $recv(aStream)._write_($1);
  32845. $recv(aStream)._lf();
  32846. return self;
  32847. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  32848. },
  32849. args: ["aTraitComposition", "aBehavior", "aStream"],
  32850. 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",
  32851. referencedClasses: [],
  32852. pragmas: [],
  32853. messageSends: ["write:", "asJavaScriptSource", "lf"]
  32854. }),
  32855. $globals.Exporter);
  32856. $core.addMethod(
  32857. $core.method({
  32858. selector: "exportTraitDefinitionOf:on:",
  32859. protocol: "output",
  32860. fn: function (aClass,aStream){
  32861. var self=this,$self=this;
  32862. return $core.withContext(function($ctx1) {
  32863. var $2,$3,$1,$4,$6,$5;
  32864. $recv(aStream)._lf();
  32865. $ctx1.sendIdx["lf"]=1;
  32866. $2=$recv($recv(aClass)._name())._asJavaScriptSource();
  32867. $ctx1.sendIdx["asJavaScriptSource"]=1;
  32868. $3=$recv($recv(aClass)._category())._asJavaScriptSource();
  32869. $ctx1.sendIdx["asJavaScriptSource"]=2;
  32870. $1=["$core.addTrait(",$2,", ",$3,");"];
  32871. $recv(aStream)._write_($1);
  32872. $ctx1.sendIdx["write:"]=1;
  32873. $4=$recv(aClass)._comment();
  32874. $ctx1.sendIdx["comment"]=1;
  32875. $recv($4)._ifNotEmpty_((function(){
  32876. return $core.withContext(function($ctx2) {
  32877. $recv(aStream)._lf();
  32878. $ctx2.sendIdx["lf"]=2;
  32879. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  32880. $ctx2.sendIdx["write:"]=2;
  32881. $recv(aStream)._lf();
  32882. $ctx2.sendIdx["lf"]=3;
  32883. $6=$recv(aClass)._asJavaScriptSource();
  32884. $ctx2.sendIdx["asJavaScriptSource"]=3;
  32885. $5=[$6,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  32886. $recv(aStream)._write_($5);
  32887. $ctx2.sendIdx["write:"]=3;
  32888. $recv(aStream)._lf();
  32889. $ctx2.sendIdx["lf"]=4;
  32890. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  32891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32892. }));
  32893. $recv(aStream)._lf();
  32894. return self;
  32895. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  32896. },
  32897. args: ["aClass", "aStream"],
  32898. 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",
  32899. referencedClasses: [],
  32900. pragmas: [],
  32901. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  32902. }),
  32903. $globals.Exporter);
  32904. $core.addMethod(
  32905. $core.method({
  32906. selector: "ownMethodsOfClass:",
  32907. protocol: "accessing",
  32908. fn: function (aClass){
  32909. var self=this,$self=this;
  32910. return $core.withContext(function($ctx1) {
  32911. var $1;
  32912. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  32913. return $core.withContext(function($ctx2) {
  32914. $1=$recv(a)._selector();
  32915. $ctx2.sendIdx["selector"]=1;
  32916. return $recv($1).__lt_eq($recv(b)._selector());
  32917. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32918. })))._reject_((function(each){
  32919. return $core.withContext(function($ctx2) {
  32920. return $recv($recv(each)._protocol())._match_("^\x5c*");
  32921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  32922. }));
  32923. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass})});
  32924. },
  32925. args: ["aClass"],
  32926. 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*') ]",
  32927. referencedClasses: [],
  32928. pragmas: [],
  32929. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  32930. }),
  32931. $globals.Exporter);
  32932. $core.addMethod(
  32933. $core.method({
  32934. selector: "ownMethodsOfMetaClass:",
  32935. protocol: "accessing",
  32936. fn: function (aClass){
  32937. var self=this,$self=this;
  32938. return $core.withContext(function($ctx1) {
  32939. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  32940. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass})});
  32941. },
  32942. args: ["aClass"],
  32943. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  32944. referencedClasses: [],
  32945. pragmas: [],
  32946. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  32947. }),
  32948. $globals.Exporter);
  32949. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  32950. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  32951. $core.addMethod(
  32952. $core.method({
  32953. selector: "amdNamesOfPackages:",
  32954. protocol: "private",
  32955. fn: function (anArray){
  32956. var self=this,$self=this;
  32957. return $core.withContext(function($ctx1) {
  32958. var $1;
  32959. return $recv($recv(anArray)._select_((function(each){
  32960. return $core.withContext(function($ctx2) {
  32961. $1=$self._amdNamespaceOfPackage_(each);
  32962. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  32963. return $recv($1)._notNil();
  32964. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32965. })))._collect_((function(each){
  32966. return $core.withContext(function($ctx2) {
  32967. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  32968. $ctx2.sendIdx[","]=1;
  32969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  32970. }));
  32971. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray})});
  32972. },
  32973. args: ["anArray"],
  32974. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  32975. referencedClasses: [],
  32976. pragmas: [],
  32977. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  32978. }),
  32979. $globals.AmdExporter);
  32980. $core.addMethod(
  32981. $core.method({
  32982. selector: "amdNamespaceOfPackage:",
  32983. protocol: "private",
  32984. fn: function (aPackage){
  32985. var self=this,$self=this;
  32986. return $core.withContext(function($ctx1) {
  32987. var $3,$2,$1;
  32988. $3=$recv(aPackage)._transport();
  32989. $ctx1.sendIdx["transport"]=1;
  32990. $2=$recv($3)._type();
  32991. $1=$recv($2).__eq("amd");
  32992. if($core.assert($1)){
  32993. return $recv($recv(aPackage)._transport())._namespace();
  32994. } else {
  32995. return nil;
  32996. }
  32997. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage})});
  32998. },
  32999. args: ["aPackage"],
  33000. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  33001. referencedClasses: [],
  33002. pragmas: [],
  33003. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  33004. }),
  33005. $globals.AmdExporter);
  33006. $core.addMethod(
  33007. $core.method({
  33008. selector: "exportPackageEpilogueOf:on:",
  33009. protocol: "output",
  33010. fn: function (aPackage,aStream){
  33011. var self=this,$self=this;
  33012. return $core.withContext(function($ctx1) {
  33013. $recv(aStream)._write_("});");
  33014. $recv(aStream)._lf();
  33015. return self;
  33016. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  33017. },
  33018. args: ["aPackage", "aStream"],
  33019. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  33020. referencedClasses: [],
  33021. pragmas: [],
  33022. messageSends: ["write:", "lf"]
  33023. }),
  33024. $globals.AmdExporter);
  33025. $core.addMethod(
  33026. $core.method({
  33027. selector: "exportPackageImportsOf:on:",
  33028. protocol: "output",
  33029. fn: function (aPackage,aStream){
  33030. var self=this,$self=this;
  33031. var importsForOutput,pragmaStart,pragmaEnd;
  33032. return $core.withContext(function($ctx1) {
  33033. var $1,$2,$4,$3,$6,$10,$9,$11,$8,$7,$12,$5;
  33034. $1=$recv($globals.String)._lf();
  33035. $ctx1.sendIdx["lf"]=1;
  33036. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  33037. $ctx1.sendIdx[","]=1;
  33038. $2=$recv($globals.String)._lf();
  33039. $ctx1.sendIdx["lf"]=2;
  33040. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  33041. $ctx1.sendIdx[","]=2;
  33042. (
  33043. $ctx1.supercall = true,
  33044. ($globals.AmdExporter.superclass||$boot.nilAsClass).fn.prototype._exportPackageImportsOf_on_.apply($self, [aPackage,aStream]));
  33045. $ctx1.supercall = false;
  33046. importsForOutput=$self._importsForOutput_(aPackage);
  33047. $recv($recv(importsForOutput)._value())._ifNotEmpty_((function(imports){
  33048. var vars;
  33049. return $core.withContext(function($ctx2) {
  33050. $recv(aStream)._write_(pragmaStart);
  33051. $ctx2.sendIdx["write:"]=1;
  33052. vars=$recv(importsForOutput)._key();
  33053. $recv(vars)._ifNotEmpty_((function(){
  33054. return $core.withContext(function($ctx3) {
  33055. $4=","._join_(vars);
  33056. $ctx3.sendIdx["join:"]=1;
  33057. $3=["var ",$4,";"];
  33058. $recv(aStream)._write_($3);
  33059. $ctx3.sendIdx["write:"]=2;
  33060. return $recv(aStream)._lf();
  33061. $ctx3.sendIdx["lf"]=3;
  33062. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33063. }));
  33064. $6=$recv(imports)._asJavaScriptSource();
  33065. $10=$recv(vars)._size();
  33066. $ctx2.sendIdx["size"]=1;
  33067. $9=(1)._to_($10);
  33068. $ctx2.sendIdx["to:"]=1;
  33069. $8=$recv($9)._collect_((function(each){
  33070. return $core.withContext(function($ctx3) {
  33071. $11=$recv(each)._asString();
  33072. $ctx3.sendIdx["asString"]=1;
  33073. return "$".__comma($11);
  33074. $ctx3.sendIdx[","]=3;
  33075. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  33076. }));
  33077. $ctx2.sendIdx["collect:"]=1;
  33078. $7=","._join_($8);
  33079. $5=["$pkg.isReady = new Promise(function (resolve, reject) { requirejs(",$6,", function (",$7,") {",$recv((1)._to_($recv(vars)._size()))._collect_((function(each){
  33080. return $core.withContext(function($ctx3) {
  33081. $12=$recv($recv($recv(vars)._at_(each)).__comma("=$")).__comma($recv(each)._asString());
  33082. $ctx3.sendIdx[","]=5;
  33083. return $recv($12).__comma("; ");
  33084. $ctx3.sendIdx[","]=4;
  33085. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  33086. })),"resolve();}, reject); });"];
  33087. $recv(aStream)._write_($5);
  33088. $ctx2.sendIdx["write:"]=3;
  33089. $recv(aStream)._lf();
  33090. return $recv(aStream)._write_(pragmaEnd);
  33091. }, function($ctx2) {$ctx2.fillBlock({imports:imports,vars:vars},$ctx1,1)});
  33092. }));
  33093. $ctx1.sendIdx["ifNotEmpty:"]=1;
  33094. return self;
  33095. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  33096. },
  33097. args: ["aPackage", "aStream"],
  33098. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09| importsForOutput pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09super exportPackageImportsOf: aPackage on: aStream.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09importsForOutput value ifNotEmpty: [ :imports |\x0a\x09\x09| vars |\x0a\x09\x09aStream write: pragmaStart.\x0a\x09\x09vars := importsForOutput key.\x0a\x09\x09vars ifNotEmpty: [ aStream write: { 'var '. ',' join: vars. ';' }; lf ]. \x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$pkg.isReady = new Promise(function (resolve, reject) { requirejs('.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09', function ('.\x0a\x09\x09\x09\x09',' join: ((1 to: vars size) collect: [ :each | '$', each asString ]).\x0a\x09\x09\x09\x09') {'.\x0a\x09\x09\x09\x09(1 to: vars size) collect: [ :each | (vars at: each), '=$', each asString, '; ' ].\x0a\x09\x09\x09\x09'resolve();}, reject); });' };\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: pragmaEnd ]",
  33099. referencedClasses: ["String"],
  33100. pragmas: [],
  33101. messageSends: [",", "lf", "exportPackageImportsOf:on:", "importsForOutput:", "ifNotEmpty:", "value", "write:", "key", "join:", "asJavaScriptSource", "collect:", "to:", "size", "asString", "at:"]
  33102. }),
  33103. $globals.AmdExporter);
  33104. $core.addMethod(
  33105. $core.method({
  33106. selector: "exportPackagePrologueOf:on:",
  33107. protocol: "output",
  33108. fn: function (aPackage,aStream){
  33109. var self=this,$self=this;
  33110. var loadDependencies,pragmaStart,pragmaEnd;
  33111. return $core.withContext(function($ctx1) {
  33112. var $1,$2;
  33113. $1=$recv($globals.String)._lf();
  33114. $ctx1.sendIdx["lf"]=1;
  33115. pragmaStart="//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma($1);
  33116. $ctx1.sendIdx[","]=1;
  33117. $2=$recv($globals.String)._lf();
  33118. $ctx1.sendIdx["lf"]=2;
  33119. pragmaEnd="//>>excludeEnd(\x22imports\x22);".__comma($2);
  33120. $ctx1.sendIdx[","]=2;
  33121. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  33122. $recv(aStream)._write_(["define(",$recv(["amber/boot", "require"].__comma($recv($recv(loadDependencies)._asArray())._sorted()))._asJavaScriptSource(),", function($boot,requirejs){\x22use strict\x22;"]);
  33123. $recv(aStream)._lf();
  33124. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  33125. return self;
  33126. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  33127. },
  33128. args: ["aPackage", "aStream"],
  33129. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09(#('amber/boot' 'require'), loadDependencies asArray sorted) asJavaScriptSource.\x0a\x09\x09\x09', function($boot,requirejs){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  33130. referencedClasses: ["String"],
  33131. pragmas: [],
  33132. messageSends: [",", "lf", "amdNamesOfPackages:", "loadDependencies", "write:", "asJavaScriptSource", "sorted", "asArray", "exportPackageBodyBlockPrologueOf:on:"]
  33133. }),
  33134. $globals.AmdExporter);
  33135. $core.addMethod(
  33136. $core.method({
  33137. selector: "importsForOutput:",
  33138. protocol: "private",
  33139. fn: function (aPackage){
  33140. var self=this,$self=this;
  33141. var namedImports,anonImports,importVarNames;
  33142. return $core.withContext(function($ctx1) {
  33143. var $1;
  33144. namedImports=[];
  33145. anonImports=[];
  33146. importVarNames=[];
  33147. $recv($recv(aPackage)._imports())._do_((function(each){
  33148. return $core.withContext(function($ctx2) {
  33149. $1=$recv(each)._isString();
  33150. if($core.assert($1)){
  33151. return $recv(anonImports)._add_(each);
  33152. $ctx2.sendIdx["add:"]=1;
  33153. } else {
  33154. $recv(namedImports)._add_($recv(each)._value());
  33155. $ctx2.sendIdx["add:"]=2;
  33156. return $recv(importVarNames)._add_($recv(each)._key());
  33157. }
  33158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33159. }));
  33160. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  33161. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames})});
  33162. },
  33163. args: ["aPackage"],
  33164. 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)",
  33165. referencedClasses: [],
  33166. pragmas: [],
  33167. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  33168. }),
  33169. $globals.AmdExporter);
  33170. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  33171. $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";
  33172. $core.addMethod(
  33173. $core.method({
  33174. selector: "last",
  33175. protocol: "accessing",
  33176. fn: function (){
  33177. var self=this,$self=this;
  33178. return $self.last;
  33179. },
  33180. args: [],
  33181. source: "last\x0a\x09^ last",
  33182. referencedClasses: [],
  33183. pragmas: [],
  33184. messageSends: []
  33185. }),
  33186. $globals.ChunkParser);
  33187. $core.addMethod(
  33188. $core.method({
  33189. selector: "nextChunk",
  33190. protocol: "reading",
  33191. fn: function (){
  33192. var self=this,$self=this;
  33193. var char,result,chunk;
  33194. return $core.withContext(function($ctx1) {
  33195. var $1,$2,$3,$4;
  33196. var $early={};
  33197. try {
  33198. result=""._writeStream();
  33199. $recv((function(){
  33200. return $core.withContext(function($ctx2) {
  33201. char=$recv($self.stream)._next();
  33202. $ctx2.sendIdx["next"]=1;
  33203. return $recv(char)._notNil();
  33204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33205. }))._whileTrue_((function(){
  33206. return $core.withContext(function($ctx2) {
  33207. $1=$recv(char).__eq("!");
  33208. $ctx2.sendIdx["="]=1;
  33209. if($core.assert($1)){
  33210. $2=$recv($recv($self.stream)._peek()).__eq("!");
  33211. if($core.assert($2)){
  33212. $recv($self.stream)._next();
  33213. } else {
  33214. $self.last=$recv($recv(result)._contents())._trimBoth();
  33215. $3=$self.last;
  33216. throw $early=[$3];
  33217. }
  33218. }
  33219. return $recv(result)._nextPut_(char);
  33220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  33221. }));
  33222. $self.last=nil;
  33223. $4=$self.last;
  33224. return $4;
  33225. }
  33226. catch(e) {if(e===$early)return e[0]; throw e}
  33227. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk})});
  33228. },
  33229. args: [],
  33230. 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",
  33231. referencedClasses: [],
  33232. pragmas: [],
  33233. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  33234. }),
  33235. $globals.ChunkParser);
  33236. $core.addMethod(
  33237. $core.method({
  33238. selector: "stream:",
  33239. protocol: "accessing",
  33240. fn: function (aStream){
  33241. var self=this,$self=this;
  33242. $self.stream=aStream;
  33243. return self;
  33244. },
  33245. args: ["aStream"],
  33246. source: "stream: aStream\x0a\x09stream := aStream",
  33247. referencedClasses: [],
  33248. pragmas: [],
  33249. messageSends: []
  33250. }),
  33251. $globals.ChunkParser);
  33252. $core.addMethod(
  33253. $core.method({
  33254. selector: "on:",
  33255. protocol: "instance creation",
  33256. fn: function (aStream){
  33257. var self=this,$self=this;
  33258. return $core.withContext(function($ctx1) {
  33259. return $recv($self._new())._stream_(aStream);
  33260. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream})});
  33261. },
  33262. args: ["aStream"],
  33263. source: "on: aStream\x0a\x09^ self new stream: aStream",
  33264. referencedClasses: [],
  33265. pragmas: [],
  33266. messageSends: ["stream:", "new"]
  33267. }),
  33268. $globals.ChunkParser.a$cls);
  33269. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  33270. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  33271. $core.addMethod(
  33272. $core.method({
  33273. selector: "class:",
  33274. protocol: "accessing",
  33275. fn: function (aClass){
  33276. var self=this,$self=this;
  33277. $self.class=aClass;
  33278. return self;
  33279. },
  33280. args: ["aClass"],
  33281. source: "class: aClass\x0a\x09class := aClass",
  33282. referencedClasses: [],
  33283. pragmas: [],
  33284. messageSends: []
  33285. }),
  33286. $globals.ClassCommentReader);
  33287. $core.addMethod(
  33288. $core.method({
  33289. selector: "initialize",
  33290. protocol: "initialization",
  33291. fn: function (){
  33292. var self=this,$self=this;
  33293. return $core.withContext(function($ctx1) {
  33294. (
  33295. $ctx1.supercall = true,
  33296. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  33297. $ctx1.supercall = false;
  33298. return self;
  33299. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  33300. },
  33301. args: [],
  33302. source: "initialize\x0a\x09super initialize.",
  33303. referencedClasses: [],
  33304. pragmas: [],
  33305. messageSends: ["initialize"]
  33306. }),
  33307. $globals.ClassCommentReader);
  33308. $core.addMethod(
  33309. $core.method({
  33310. selector: "scanFrom:",
  33311. protocol: "fileIn",
  33312. fn: function (aChunkParser){
  33313. var self=this,$self=this;
  33314. var chunk;
  33315. return $core.withContext(function($ctx1) {
  33316. chunk=$recv(aChunkParser)._nextChunk();
  33317. $recv(chunk)._ifNotEmpty_((function(){
  33318. return $core.withContext(function($ctx2) {
  33319. return $self._setComment_(chunk);
  33320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33321. }));
  33322. return self;
  33323. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  33324. },
  33325. args: ["aChunkParser"],
  33326. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  33327. referencedClasses: [],
  33328. pragmas: [],
  33329. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  33330. }),
  33331. $globals.ClassCommentReader);
  33332. $core.addMethod(
  33333. $core.method({
  33334. selector: "setComment:",
  33335. protocol: "private",
  33336. fn: function (aString){
  33337. var self=this,$self=this;
  33338. return $core.withContext(function($ctx1) {
  33339. $recv($self.class)._comment_(aString);
  33340. return self;
  33341. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString})});
  33342. },
  33343. args: ["aString"],
  33344. source: "setComment: aString\x0a\x09class comment: aString",
  33345. referencedClasses: [],
  33346. pragmas: [],
  33347. messageSends: ["comment:"]
  33348. }),
  33349. $globals.ClassCommentReader);
  33350. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  33351. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  33352. $core.addMethod(
  33353. $core.method({
  33354. selector: "class:category:",
  33355. protocol: "accessing",
  33356. fn: function (aClass,aString){
  33357. var self=this,$self=this;
  33358. $self.class=aClass;
  33359. $self.category=aString;
  33360. return self;
  33361. },
  33362. args: ["aClass", "aString"],
  33363. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  33364. referencedClasses: [],
  33365. pragmas: [],
  33366. messageSends: []
  33367. }),
  33368. $globals.ClassProtocolReader);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "compileMethod:",
  33372. protocol: "private",
  33373. fn: function (aString){
  33374. var self=this,$self=this;
  33375. return $core.withContext(function($ctx1) {
  33376. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self.class,$self.category);
  33377. return self;
  33378. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString})});
  33379. },
  33380. args: ["aString"],
  33381. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  33382. referencedClasses: ["Compiler"],
  33383. pragmas: [],
  33384. messageSends: ["install:forClass:protocol:", "new"]
  33385. }),
  33386. $globals.ClassProtocolReader);
  33387. $core.addMethod(
  33388. $core.method({
  33389. selector: "initialize",
  33390. protocol: "initialization",
  33391. fn: function (){
  33392. var self=this,$self=this;
  33393. return $core.withContext(function($ctx1) {
  33394. (
  33395. $ctx1.supercall = true,
  33396. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  33397. $ctx1.supercall = false;
  33398. return self;
  33399. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  33400. },
  33401. args: [],
  33402. source: "initialize\x0a\x09super initialize.",
  33403. referencedClasses: [],
  33404. pragmas: [],
  33405. messageSends: ["initialize"]
  33406. }),
  33407. $globals.ClassProtocolReader);
  33408. $core.addMethod(
  33409. $core.method({
  33410. selector: "scanFrom:",
  33411. protocol: "fileIn",
  33412. fn: function (aChunkParser){
  33413. var self=this,$self=this;
  33414. var chunk;
  33415. return $core.withContext(function($ctx1) {
  33416. $recv((function(){
  33417. return $core.withContext(function($ctx2) {
  33418. chunk=$recv(aChunkParser)._nextChunk();
  33419. return $recv(chunk)._isEmpty();
  33420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33421. }))._whileFalse_((function(){
  33422. return $core.withContext(function($ctx2) {
  33423. return $self._compileMethod_(chunk);
  33424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  33425. }));
  33426. return self;
  33427. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  33428. },
  33429. args: ["aChunkParser"],
  33430. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  33431. referencedClasses: [],
  33432. pragmas: [],
  33433. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  33434. }),
  33435. $globals.ClassProtocolReader);
  33436. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  33437. $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.";
  33438. $core.addMethod(
  33439. $core.method({
  33440. selector: "methods",
  33441. protocol: "accessing",
  33442. fn: function (){
  33443. var self=this,$self=this;
  33444. return $core.withContext(function($ctx1) {
  33445. var $1;
  33446. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  33447. return $core.withContext(function($ctx2) {
  33448. $1=$recv(a)._selector();
  33449. $ctx2.sendIdx["selector"]=1;
  33450. return $recv($1).__lt_eq($recv(b)._selector());
  33451. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  33452. }));
  33453. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  33454. },
  33455. args: [],
  33456. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  33457. referencedClasses: [],
  33458. pragmas: [],
  33459. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  33460. }),
  33461. $globals.ExportMethodProtocol);
  33462. $core.addMethod(
  33463. $core.method({
  33464. selector: "name",
  33465. protocol: "accessing",
  33466. fn: function (){
  33467. var self=this,$self=this;
  33468. return $self.name;
  33469. },
  33470. args: [],
  33471. source: "name\x0a\x09^ name",
  33472. referencedClasses: [],
  33473. pragmas: [],
  33474. messageSends: []
  33475. }),
  33476. $globals.ExportMethodProtocol);
  33477. $core.addMethod(
  33478. $core.method({
  33479. selector: "name:",
  33480. protocol: "accessing",
  33481. fn: function (aString){
  33482. var self=this,$self=this;
  33483. $self.name=aString;
  33484. return self;
  33485. },
  33486. args: ["aString"],
  33487. source: "name: aString\x0a\x09name := aString",
  33488. referencedClasses: [],
  33489. pragmas: [],
  33490. messageSends: []
  33491. }),
  33492. $globals.ExportMethodProtocol);
  33493. $core.addMethod(
  33494. $core.method({
  33495. selector: "ownMethods",
  33496. protocol: "accessing",
  33497. fn: function (){
  33498. var self=this,$self=this;
  33499. return $core.withContext(function($ctx1) {
  33500. var $1;
  33501. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  33502. return $core.withContext(function($ctx2) {
  33503. $1=$recv(a)._selector();
  33504. $ctx2.sendIdx["selector"]=1;
  33505. return $recv($1).__lt_eq($recv(b)._selector());
  33506. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  33507. }));
  33508. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  33509. },
  33510. args: [],
  33511. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  33512. referencedClasses: [],
  33513. pragmas: [],
  33514. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  33515. }),
  33516. $globals.ExportMethodProtocol);
  33517. $core.addMethod(
  33518. $core.method({
  33519. selector: "theClass",
  33520. protocol: "accessing",
  33521. fn: function (){
  33522. var self=this,$self=this;
  33523. return $self.theClass;
  33524. },
  33525. args: [],
  33526. source: "theClass\x0a\x09^ theClass",
  33527. referencedClasses: [],
  33528. pragmas: [],
  33529. messageSends: []
  33530. }),
  33531. $globals.ExportMethodProtocol);
  33532. $core.addMethod(
  33533. $core.method({
  33534. selector: "theClass:",
  33535. protocol: "accessing",
  33536. fn: function (aClass){
  33537. var self=this,$self=this;
  33538. $self.theClass=aClass;
  33539. return self;
  33540. },
  33541. args: ["aClass"],
  33542. source: "theClass: aClass\x0a\x09theClass := aClass",
  33543. referencedClasses: [],
  33544. pragmas: [],
  33545. messageSends: []
  33546. }),
  33547. $globals.ExportMethodProtocol);
  33548. $core.addMethod(
  33549. $core.method({
  33550. selector: "name:theClass:",
  33551. protocol: "instance creation",
  33552. fn: function (aString,aClass){
  33553. var self=this,$self=this;
  33554. return $core.withContext(function($ctx1) {
  33555. var $1;
  33556. $1=$self._new();
  33557. $recv($1)._name_(aString);
  33558. $recv($1)._theClass_(aClass);
  33559. return $recv($1)._yourself();
  33560. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass})});
  33561. },
  33562. args: ["aString", "aClass"],
  33563. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  33564. referencedClasses: [],
  33565. pragmas: [],
  33566. messageSends: ["name:", "new", "theClass:", "yourself"]
  33567. }),
  33568. $globals.ExportMethodProtocol.a$cls);
  33569. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  33570. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  33571. $core.addMethod(
  33572. $core.method({
  33573. selector: "import:",
  33574. protocol: "fileIn",
  33575. fn: function (aStream){
  33576. var self=this,$self=this;
  33577. var chunk,result,parser,lastEmpty;
  33578. return $core.withContext(function($ctx1) {
  33579. var $1;
  33580. parser=$recv($globals.ChunkParser)._on_(aStream);
  33581. lastEmpty=false;
  33582. $self.lastSection="n/a, not started";
  33583. $self.lastChunk=nil;
  33584. $recv((function(){
  33585. return $core.withContext(function($ctx2) {
  33586. $recv((function(){
  33587. return $core.withContext(function($ctx3) {
  33588. chunk=$recv(parser)._nextChunk();
  33589. return $recv(chunk)._isNil();
  33590. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33591. }))._whileFalse_((function(){
  33592. return $core.withContext(function($ctx3) {
  33593. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  33594. lastEmpty=true;
  33595. return lastEmpty;
  33596. }),(function(){
  33597. return $core.withContext(function($ctx4) {
  33598. $self.lastSection=chunk;
  33599. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  33600. $1=lastEmpty;
  33601. if($core.assert($1)){
  33602. lastEmpty=false;
  33603. return $recv(result)._scanFrom_(parser);
  33604. }
  33605. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  33606. }));
  33607. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  33608. }));
  33609. $self.lastSection="n/a, finished";
  33610. return $self.lastSection;
  33611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33612. }))._on_do_($globals.Error,(function(e){
  33613. return $core.withContext(function($ctx2) {
  33614. $self.lastChunk=$recv(parser)._last();
  33615. return $recv(e)._pass();
  33616. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  33617. }));
  33618. return self;
  33619. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty})});
  33620. },
  33621. args: ["aStream"],
  33622. 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 ].",
  33623. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  33624. pragmas: [],
  33625. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  33626. }),
  33627. $globals.Importer);
  33628. $core.addMethod(
  33629. $core.method({
  33630. selector: "lastChunk",
  33631. protocol: "accessing",
  33632. fn: function (){
  33633. var self=this,$self=this;
  33634. return $self.lastChunk;
  33635. },
  33636. args: [],
  33637. source: "lastChunk\x0a\x09^ lastChunk",
  33638. referencedClasses: [],
  33639. pragmas: [],
  33640. messageSends: []
  33641. }),
  33642. $globals.Importer);
  33643. $core.addMethod(
  33644. $core.method({
  33645. selector: "lastSection",
  33646. protocol: "accessing",
  33647. fn: function (){
  33648. var self=this,$self=this;
  33649. return $self.lastSection;
  33650. },
  33651. args: [],
  33652. source: "lastSection\x0a\x09^ lastSection",
  33653. referencedClasses: [],
  33654. pragmas: [],
  33655. messageSends: []
  33656. }),
  33657. $globals.Importer);
  33658. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  33659. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  33660. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  33661. $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.";
  33662. $core.addMethod(
  33663. $core.method({
  33664. selector: "ajaxPutAt:data:onSuccess:onError:",
  33665. protocol: "private",
  33666. fn: function (aURL,aString,aBlock,anotherBlock){
  33667. var self=this,$self=this;
  33668. var xhr;
  33669. return $core.withContext(function($ctx1) {
  33670. var $1,$4,$3,$2;
  33671. xhr=$recv($globals.Platform)._newXhr();
  33672. $recv(xhr)._open_url_async_("PUT",aURL,true);
  33673. $recv(xhr)._onreadystatechange_((function(){
  33674. return $core.withContext(function($ctx2) {
  33675. $1=$recv($recv(xhr)._readyState()).__eq((4));
  33676. if($core.assert($1)){
  33677. $4=$recv(xhr)._status();
  33678. $ctx2.sendIdx["status"]=1;
  33679. $3=$recv($4).__gt_eq((200));
  33680. $2=$recv($3)._and_((function(){
  33681. return $core.withContext(function($ctx3) {
  33682. return $recv($recv(xhr)._status()).__lt((300));
  33683. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  33684. }));
  33685. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  33686. }
  33687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33688. }));
  33689. $recv(xhr)._send_(aString);
  33690. return self;
  33691. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr})});
  33692. },
  33693. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  33694. 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",
  33695. referencedClasses: ["Platform"],
  33696. pragmas: [],
  33697. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  33698. }),
  33699. $globals.PackageHandler);
  33700. $core.addMethod(
  33701. $core.method({
  33702. selector: "chunkContentsFor:",
  33703. protocol: "accessing",
  33704. fn: function (aPackage){
  33705. var self=this,$self=this;
  33706. return $core.withContext(function($ctx1) {
  33707. return $recv($globals.String)._streamContents_((function(str){
  33708. return $core.withContext(function($ctx2) {
  33709. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  33710. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  33711. }));
  33712. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage})});
  33713. },
  33714. args: ["aPackage"],
  33715. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  33716. referencedClasses: ["String"],
  33717. pragmas: [],
  33718. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  33719. }),
  33720. $globals.PackageHandler);
  33721. $core.addMethod(
  33722. $core.method({
  33723. selector: "chunkExporter",
  33724. protocol: "factory",
  33725. fn: function (){
  33726. var self=this,$self=this;
  33727. return $core.withContext(function($ctx1) {
  33728. return $recv($self._chunkExporterClass())._new();
  33729. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{})});
  33730. },
  33731. args: [],
  33732. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  33733. referencedClasses: [],
  33734. pragmas: [],
  33735. messageSends: ["new", "chunkExporterClass"]
  33736. }),
  33737. $globals.PackageHandler);
  33738. $core.addMethod(
  33739. $core.method({
  33740. selector: "chunkExporterClass",
  33741. protocol: "accessing",
  33742. fn: function (){
  33743. var self=this,$self=this;
  33744. return $globals.ChunkExporter;
  33745. },
  33746. args: [],
  33747. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  33748. referencedClasses: ["ChunkExporter"],
  33749. pragmas: [],
  33750. messageSends: []
  33751. }),
  33752. $globals.PackageHandler);
  33753. $core.addMethod(
  33754. $core.method({
  33755. selector: "commit:",
  33756. protocol: "committing",
  33757. fn: function (aPackage){
  33758. var self=this,$self=this;
  33759. return $core.withContext(function($ctx1) {
  33760. var $1,$2;
  33761. $self._commit_onSuccess_onError_(aPackage,(function(){
  33762. }),(function(error){
  33763. return $core.withContext(function($ctx2) {
  33764. $1=$recv($globals.PackageCommitError)._new();
  33765. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  33766. $ctx2.sendIdx[","]=1;
  33767. $recv($1)._messageText_($2);
  33768. return $recv($1)._signal();
  33769. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  33770. }));
  33771. return self;
  33772. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage})});
  33773. },
  33774. args: ["aPackage"],
  33775. 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 ]",
  33776. referencedClasses: ["PackageCommitError"],
  33777. pragmas: [],
  33778. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  33779. }),
  33780. $globals.PackageHandler);
  33781. $core.addMethod(
  33782. $core.method({
  33783. selector: "commit:onSuccess:onError:",
  33784. protocol: "committing",
  33785. fn: function (aPackage,aBlock,anotherBlock){
  33786. var self=this,$self=this;
  33787. return $core.withContext(function($ctx1) {
  33788. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  33789. return $core.withContext(function($ctx2) {
  33790. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  33791. return $core.withContext(function($ctx3) {
  33792. $recv(aPackage)._beClean();
  33793. return $recv(aBlock)._value();
  33794. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33795. }),anotherBlock);
  33796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33797. }),anotherBlock);
  33798. return self;
  33799. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33800. },
  33801. args: ["aPackage", "aBlock", "anotherBlock"],
  33802. 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",
  33803. referencedClasses: [],
  33804. pragmas: [],
  33805. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  33806. }),
  33807. $globals.PackageHandler);
  33808. $core.addMethod(
  33809. $core.method({
  33810. selector: "commitJsFileFor:onSuccess:onError:",
  33811. protocol: "committing",
  33812. fn: function (aPackage,aBlock,anotherBlock){
  33813. var self=this,$self=this;
  33814. return $core.withContext(function($ctx1) {
  33815. var $2,$1;
  33816. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  33817. $ctx1.sendIdx[","]=2;
  33818. $1=$recv($2).__comma(".js");
  33819. $ctx1.sendIdx[","]=1;
  33820. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  33821. return self;
  33822. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33823. },
  33824. args: ["aPackage", "aBlock", "anotherBlock"],
  33825. 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",
  33826. referencedClasses: [],
  33827. pragmas: [],
  33828. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  33829. }),
  33830. $globals.PackageHandler);
  33831. $core.addMethod(
  33832. $core.method({
  33833. selector: "commitPathJsFor:",
  33834. protocol: "accessing",
  33835. fn: function (aPackage){
  33836. var self=this,$self=this;
  33837. return $core.withContext(function($ctx1) {
  33838. $self._subclassResponsibility();
  33839. return self;
  33840. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  33841. },
  33842. args: ["aPackage"],
  33843. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  33844. referencedClasses: [],
  33845. pragmas: [],
  33846. messageSends: ["subclassResponsibility"]
  33847. }),
  33848. $globals.PackageHandler);
  33849. $core.addMethod(
  33850. $core.method({
  33851. selector: "commitPathStFor:",
  33852. protocol: "accessing",
  33853. fn: function (aPackage){
  33854. var self=this,$self=this;
  33855. return $core.withContext(function($ctx1) {
  33856. $self._subclassResponsibility();
  33857. return self;
  33858. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage})});
  33859. },
  33860. args: ["aPackage"],
  33861. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  33862. referencedClasses: [],
  33863. pragmas: [],
  33864. messageSends: ["subclassResponsibility"]
  33865. }),
  33866. $globals.PackageHandler);
  33867. $core.addMethod(
  33868. $core.method({
  33869. selector: "commitStFileFor:onSuccess:onError:",
  33870. protocol: "committing",
  33871. fn: function (aPackage,aBlock,anotherBlock){
  33872. var self=this,$self=this;
  33873. return $core.withContext(function($ctx1) {
  33874. var $2,$1;
  33875. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  33876. $ctx1.sendIdx[","]=2;
  33877. $1=$recv($2).__comma(".st");
  33878. $ctx1.sendIdx[","]=1;
  33879. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  33880. return self;
  33881. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  33882. },
  33883. args: ["aPackage", "aBlock", "anotherBlock"],
  33884. 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",
  33885. referencedClasses: [],
  33886. pragmas: [],
  33887. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  33888. }),
  33889. $globals.PackageHandler);
  33890. $core.addMethod(
  33891. $core.method({
  33892. selector: "contentsFor:",
  33893. protocol: "accessing",
  33894. fn: function (aPackage){
  33895. var self=this,$self=this;
  33896. return $core.withContext(function($ctx1) {
  33897. return $recv($globals.String)._streamContents_((function(str){
  33898. return $core.withContext(function($ctx2) {
  33899. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  33900. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  33901. }));
  33902. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage})});
  33903. },
  33904. args: ["aPackage"],
  33905. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  33906. referencedClasses: ["String"],
  33907. pragmas: [],
  33908. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  33909. }),
  33910. $globals.PackageHandler);
  33911. $core.addMethod(
  33912. $core.method({
  33913. selector: "exporter",
  33914. protocol: "factory",
  33915. fn: function (){
  33916. var self=this,$self=this;
  33917. return $core.withContext(function($ctx1) {
  33918. return $recv($self._exporterClass())._new();
  33919. }, function($ctx1) {$ctx1.fill(self,"exporter",{})});
  33920. },
  33921. args: [],
  33922. source: "exporter\x0a\x09^ self exporterClass new",
  33923. referencedClasses: [],
  33924. pragmas: [],
  33925. messageSends: ["new", "exporterClass"]
  33926. }),
  33927. $globals.PackageHandler);
  33928. $core.addMethod(
  33929. $core.method({
  33930. selector: "exporterClass",
  33931. protocol: "accessing",
  33932. fn: function (){
  33933. var self=this,$self=this;
  33934. return $core.withContext(function($ctx1) {
  33935. $self._subclassResponsibility();
  33936. return self;
  33937. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{})});
  33938. },
  33939. args: [],
  33940. source: "exporterClass\x0a\x09self subclassResponsibility",
  33941. referencedClasses: [],
  33942. pragmas: [],
  33943. messageSends: ["subclassResponsibility"]
  33944. }),
  33945. $globals.PackageHandler);
  33946. $core.addMethod(
  33947. $core.method({
  33948. selector: "load:",
  33949. protocol: "loading",
  33950. fn: function (aPackage){
  33951. var self=this,$self=this;
  33952. return $core.withContext(function($ctx1) {
  33953. $self._subclassResponsibility();
  33954. return self;
  33955. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  33956. },
  33957. args: ["aPackage"],
  33958. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  33959. referencedClasses: [],
  33960. pragmas: [],
  33961. messageSends: ["subclassResponsibility"]
  33962. }),
  33963. $globals.PackageHandler);
  33964. $core.addMethod(
  33965. $core.method({
  33966. selector: "onCommitError:",
  33967. protocol: "error handling",
  33968. fn: function (anError){
  33969. var self=this,$self=this;
  33970. return $core.withContext(function($ctx1) {
  33971. var $1,$2;
  33972. $1=$recv($globals.PackageCommitError)._new();
  33973. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  33974. $ctx1.sendIdx[","]=1;
  33975. $recv($1)._messageText_($2);
  33976. $recv($1)._signal();
  33977. return self;
  33978. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError})});
  33979. },
  33980. args: ["anError"],
  33981. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  33982. referencedClasses: ["PackageCommitError"],
  33983. pragmas: [],
  33984. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  33985. }),
  33986. $globals.PackageHandler);
  33987. $core.addMethod(
  33988. $core.method({
  33989. selector: "setPath:forPackage:",
  33990. protocol: "accessing",
  33991. fn: function (aString,aPackage){
  33992. var self=this,$self=this;
  33993. return $core.withContext(function($ctx1) {
  33994. $self._subclassResponsibility();
  33995. return self;
  33996. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  33997. },
  33998. args: ["aString", "aPackage"],
  33999. source: "setPath: aString forPackage: aPackage\x0a\x09self subclassResponsibility",
  34000. referencedClasses: [],
  34001. pragmas: [],
  34002. messageSends: ["subclassResponsibility"]
  34003. }),
  34004. $globals.PackageHandler);
  34005. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  34006. $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.";
  34007. $core.addMethod(
  34008. $core.method({
  34009. selector: "commitPathJsFor:",
  34010. protocol: "accessing",
  34011. fn: function (aPackage){
  34012. var self=this,$self=this;
  34013. return $core.withContext(function($ctx1) {
  34014. return $self._toUrl_($self._namespaceFor_(aPackage));
  34015. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  34016. },
  34017. args: ["aPackage"],
  34018. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  34019. referencedClasses: [],
  34020. pragmas: [],
  34021. messageSends: ["toUrl:", "namespaceFor:"]
  34022. }),
  34023. $globals.AmdPackageHandler);
  34024. $core.addMethod(
  34025. $core.method({
  34026. selector: "commitPathStFor:",
  34027. protocol: "accessing",
  34028. fn: function (aPackage){
  34029. var self=this,$self=this;
  34030. var path,pathWithout;
  34031. return $core.withContext(function($ctx1) {
  34032. var $1,$2;
  34033. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  34034. $ctx1.sendIdx[","]=1;
  34035. path=$self._toUrl_($1);
  34036. pathWithout=$self._commitPathJsFor_(aPackage);
  34037. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  34038. if($core.assert($2)){
  34039. return pathWithout;
  34040. } else {
  34041. return path;
  34042. }
  34043. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout})});
  34044. },
  34045. args: ["aPackage"],
  34046. 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 ]",
  34047. referencedClasses: [],
  34048. pragmas: [],
  34049. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  34050. }),
  34051. $globals.AmdPackageHandler);
  34052. $core.addMethod(
  34053. $core.method({
  34054. selector: "exporterClass",
  34055. protocol: "accessing",
  34056. fn: function (){
  34057. var self=this,$self=this;
  34058. return $globals.AmdExporter;
  34059. },
  34060. args: [],
  34061. source: "exporterClass\x0a\x09^ AmdExporter",
  34062. referencedClasses: ["AmdExporter"],
  34063. pragmas: [],
  34064. messageSends: []
  34065. }),
  34066. $globals.AmdPackageHandler);
  34067. $core.addMethod(
  34068. $core.method({
  34069. selector: "load:",
  34070. protocol: "loading",
  34071. fn: function (aPackage){
  34072. var self=this,$self=this;
  34073. return $core.withContext(function($ctx1) {
  34074. var $1,$3,$2,$receiver;
  34075. return $recv($globals.Promise)._new_((function(model){
  34076. return $core.withContext(function($ctx2) {
  34077. $1=$recv($globals.Smalltalk)._amdRequire();
  34078. if(($receiver = $1) == null || $receiver.a$nil){
  34079. return $self._error_("AMD loader not present");
  34080. } else {
  34081. var require;
  34082. require=$receiver;
  34083. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  34084. $ctx2.sendIdx[","]=1;
  34085. $2=[$3];
  34086. return $recv(require)._value_value_value_($2,(function(result){
  34087. return $core.withContext(function($ctx3) {
  34088. return $recv(model)._value_(result);
  34089. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  34090. }),(function(error){
  34091. return $core.withContext(function($ctx3) {
  34092. return $recv(model)._signal_(error);
  34093. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  34094. }));
  34095. }
  34096. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  34097. }));
  34098. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  34099. },
  34100. args: ["aPackage"],
  34101. 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 ] ] ]",
  34102. referencedClasses: ["Promise", "Smalltalk"],
  34103. pragmas: [],
  34104. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  34105. }),
  34106. $globals.AmdPackageHandler);
  34107. $core.addMethod(
  34108. $core.method({
  34109. selector: "namespaceFor:",
  34110. protocol: "committing",
  34111. fn: function (aPackage){
  34112. var self=this,$self=this;
  34113. return $core.withContext(function($ctx1) {
  34114. return $recv($recv(aPackage)._transport())._namespace();
  34115. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage})});
  34116. },
  34117. args: ["aPackage"],
  34118. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  34119. referencedClasses: [],
  34120. pragmas: [],
  34121. messageSends: ["namespace", "transport"]
  34122. }),
  34123. $globals.AmdPackageHandler);
  34124. $core.addMethod(
  34125. $core.method({
  34126. selector: "setPath:forPackage:",
  34127. protocol: "accessing",
  34128. fn: function (aString,aPackage){
  34129. var self=this,$self=this;
  34130. return $core.withContext(function($ctx1) {
  34131. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespaceFor_(aPackage),aString])]));
  34132. return self;
  34133. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  34134. },
  34135. args: ["aString", "aPackage"],
  34136. source: "setPath: aString forPackage: aPackage\x0a\x09\x22Set the path the the package's `namespace`\x22\x0a\x09\x0a\x09\x22Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x22\x0a\x09\x09\x09require provided config: #{\x0a\x09\x09\x09\x09'paths' -> #{\x0a\x09\x09\x09\x09\x09(self namespaceFor: aPackage) -> aString\x0a\x09\x09\x09\x09}\x0a\x09\x09\x09}\x0a\x09\x09\x22]\x22",
  34137. referencedClasses: [],
  34138. pragmas: [],
  34139. messageSends: ["config:", "provided", "namespaceFor:"]
  34140. }),
  34141. $globals.AmdPackageHandler);
  34142. $core.addMethod(
  34143. $core.method({
  34144. selector: "toUrl:",
  34145. protocol: "private",
  34146. fn: function (aString){
  34147. var self=this,$self=this;
  34148. return $core.withContext(function($ctx1) {
  34149. var $1,$receiver;
  34150. $1=$recv($globals.Smalltalk)._amdRequire();
  34151. if(($receiver = $1) == null || $receiver.a$nil){
  34152. return $self._error_("AMD loader not present");
  34153. } else {
  34154. var require;
  34155. require=$receiver;
  34156. return $recv($recv(require)._provided())._toUrl_(aString);
  34157. }
  34158. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString})});
  34159. },
  34160. args: ["aString"],
  34161. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  34162. referencedClasses: ["Smalltalk"],
  34163. pragmas: [],
  34164. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  34165. }),
  34166. $globals.AmdPackageHandler);
  34167. $core.addMethod(
  34168. $core.method({
  34169. selector: "defaultNamespace",
  34170. protocol: "commit paths",
  34171. fn: function (){
  34172. var self=this,$self=this;
  34173. return $core.withContext(function($ctx1) {
  34174. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  34175. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  34176. },
  34177. args: [],
  34178. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  34179. referencedClasses: ["Smalltalk"],
  34180. pragmas: [],
  34181. messageSends: ["defaultAmdNamespace"]
  34182. }),
  34183. $globals.AmdPackageHandler.a$cls);
  34184. $core.addMethod(
  34185. $core.method({
  34186. selector: "defaultNamespace:",
  34187. protocol: "commit paths",
  34188. fn: function (aString){
  34189. var self=this,$self=this;
  34190. return $core.withContext(function($ctx1) {
  34191. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  34192. return self;
  34193. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString})});
  34194. },
  34195. args: ["aString"],
  34196. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  34197. referencedClasses: ["Smalltalk"],
  34198. pragmas: [],
  34199. messageSends: ["defaultAmdNamespace:"]
  34200. }),
  34201. $globals.AmdPackageHandler.a$cls);
  34202. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  34203. $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.";
  34204. $core.addMethod(
  34205. $core.method({
  34206. selector: "asJavaScriptObject",
  34207. protocol: "converting",
  34208. fn: function (){
  34209. var self=this,$self=this;
  34210. return $core.withContext(function($ctx1) {
  34211. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  34212. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  34213. },
  34214. args: [],
  34215. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  34216. referencedClasses: [],
  34217. pragmas: [],
  34218. messageSends: ["type"]
  34219. }),
  34220. $globals.PackageTransport);
  34221. $core.addMethod(
  34222. $core.method({
  34223. selector: "commit",
  34224. protocol: "committing",
  34225. fn: function (){
  34226. var self=this,$self=this;
  34227. return $core.withContext(function($ctx1) {
  34228. $recv($self._commitHandler())._commit_($self._package());
  34229. return self;
  34230. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  34231. },
  34232. args: [],
  34233. source: "commit\x0a\x09self commitHandler commit: self package",
  34234. referencedClasses: [],
  34235. pragmas: [],
  34236. messageSends: ["commit:", "commitHandler", "package"]
  34237. }),
  34238. $globals.PackageTransport);
  34239. $core.addMethod(
  34240. $core.method({
  34241. selector: "commitHandler",
  34242. protocol: "factory",
  34243. fn: function (){
  34244. var self=this,$self=this;
  34245. return $core.withContext(function($ctx1) {
  34246. return $recv($self._commitHandlerClass())._new();
  34247. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{})});
  34248. },
  34249. args: [],
  34250. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  34251. referencedClasses: [],
  34252. pragmas: [],
  34253. messageSends: ["new", "commitHandlerClass"]
  34254. }),
  34255. $globals.PackageTransport);
  34256. $core.addMethod(
  34257. $core.method({
  34258. selector: "commitHandlerClass",
  34259. protocol: "accessing",
  34260. fn: function (){
  34261. var self=this,$self=this;
  34262. return $core.withContext(function($ctx1) {
  34263. $self._subclassResponsibility();
  34264. return self;
  34265. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{})});
  34266. },
  34267. args: [],
  34268. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  34269. referencedClasses: [],
  34270. pragmas: [],
  34271. messageSends: ["subclassResponsibility"]
  34272. }),
  34273. $globals.PackageTransport);
  34274. $core.addMethod(
  34275. $core.method({
  34276. selector: "commitOnSuccess:onError:",
  34277. protocol: "committing",
  34278. fn: function (aBlock,anotherBlock){
  34279. var self=this,$self=this;
  34280. return $core.withContext(function($ctx1) {
  34281. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  34282. return self;
  34283. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  34284. },
  34285. args: ["aBlock", "anotherBlock"],
  34286. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  34287. referencedClasses: [],
  34288. pragmas: [],
  34289. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  34290. }),
  34291. $globals.PackageTransport);
  34292. $core.addMethod(
  34293. $core.method({
  34294. selector: "definition",
  34295. protocol: "accessing",
  34296. fn: function (){
  34297. var self=this,$self=this;
  34298. return "";
  34299. },
  34300. args: [],
  34301. source: "definition\x0a\x09^ ''",
  34302. referencedClasses: [],
  34303. pragmas: [],
  34304. messageSends: []
  34305. }),
  34306. $globals.PackageTransport);
  34307. $core.addMethod(
  34308. $core.method({
  34309. selector: "load",
  34310. protocol: "loading",
  34311. fn: function (){
  34312. var self=this,$self=this;
  34313. return $core.withContext(function($ctx1) {
  34314. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  34315. return $core.withContext(function($ctx2) {
  34316. return $recv($globals.Smalltalk)._postLoad();
  34317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34318. }));
  34319. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  34320. },
  34321. args: [],
  34322. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  34323. referencedClasses: ["Smalltalk"],
  34324. pragmas: [],
  34325. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  34326. }),
  34327. $globals.PackageTransport);
  34328. $core.addMethod(
  34329. $core.method({
  34330. selector: "package",
  34331. protocol: "accessing",
  34332. fn: function (){
  34333. var self=this,$self=this;
  34334. return $self.package;
  34335. },
  34336. args: [],
  34337. source: "package\x0a\x09^ package",
  34338. referencedClasses: [],
  34339. pragmas: [],
  34340. messageSends: []
  34341. }),
  34342. $globals.PackageTransport);
  34343. $core.addMethod(
  34344. $core.method({
  34345. selector: "package:",
  34346. protocol: "accessing",
  34347. fn: function (aPackage){
  34348. var self=this,$self=this;
  34349. $self.package=aPackage;
  34350. return self;
  34351. },
  34352. args: ["aPackage"],
  34353. source: "package: aPackage\x0a\x09package := aPackage",
  34354. referencedClasses: [],
  34355. pragmas: [],
  34356. messageSends: []
  34357. }),
  34358. $globals.PackageTransport);
  34359. $core.addMethod(
  34360. $core.method({
  34361. selector: "setPath:",
  34362. protocol: "actions",
  34363. fn: function (aString){
  34364. var self=this,$self=this;
  34365. return $core.withContext(function($ctx1) {
  34366. $recv($self._commitHandler())._setPath_forPackage_(aString,$self.package);
  34367. return self;
  34368. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString})});
  34369. },
  34370. args: ["aString"],
  34371. source: "setPath: aString\x0a\x09\x22Set the commit path for the package\x22\x0a\x0a\x09self commitHandler setPath: aString forPackage: package",
  34372. referencedClasses: [],
  34373. pragmas: [],
  34374. messageSends: ["setPath:forPackage:", "commitHandler"]
  34375. }),
  34376. $globals.PackageTransport);
  34377. $core.addMethod(
  34378. $core.method({
  34379. selector: "setupFromJson:",
  34380. protocol: "initialization",
  34381. fn: function (anObject){
  34382. var self=this,$self=this;
  34383. return self;
  34384. },
  34385. args: ["anObject"],
  34386. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  34387. referencedClasses: [],
  34388. pragmas: [],
  34389. messageSends: []
  34390. }),
  34391. $globals.PackageTransport);
  34392. $core.addMethod(
  34393. $core.method({
  34394. selector: "type",
  34395. protocol: "accessing",
  34396. fn: function (){
  34397. var self=this,$self=this;
  34398. return $core.withContext(function($ctx1) {
  34399. return $recv($self._class())._type();
  34400. }, function($ctx1) {$ctx1.fill(self,"type",{})});
  34401. },
  34402. args: [],
  34403. source: "type\x0a\x09^ self class type",
  34404. referencedClasses: [],
  34405. pragmas: [],
  34406. messageSends: ["type", "class"]
  34407. }),
  34408. $globals.PackageTransport);
  34409. $core.setSlots($globals.PackageTransport.a$cls, ["registry"]);
  34410. $core.addMethod(
  34411. $core.method({
  34412. selector: "classRegisteredFor:",
  34413. protocol: "accessing",
  34414. fn: function (aString){
  34415. var self=this,$self=this;
  34416. return $core.withContext(function($ctx1) {
  34417. return $recv($self.registry)._at_(aString);
  34418. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString})});
  34419. },
  34420. args: ["aString"],
  34421. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  34422. referencedClasses: [],
  34423. pragmas: [],
  34424. messageSends: ["at:"]
  34425. }),
  34426. $globals.PackageTransport.a$cls);
  34427. $core.addMethod(
  34428. $core.method({
  34429. selector: "defaultType",
  34430. protocol: "accessing",
  34431. fn: function (){
  34432. var self=this,$self=this;
  34433. return $core.withContext(function($ctx1) {
  34434. return $recv($globals.AmdPackageTransport)._type();
  34435. }, function($ctx1) {$ctx1.fill(self,"defaultType",{})});
  34436. },
  34437. args: [],
  34438. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  34439. referencedClasses: ["AmdPackageTransport"],
  34440. pragmas: [],
  34441. messageSends: ["type"]
  34442. }),
  34443. $globals.PackageTransport.a$cls);
  34444. $core.addMethod(
  34445. $core.method({
  34446. selector: "for:",
  34447. protocol: "instance creation",
  34448. fn: function (aString){
  34449. var self=this,$self=this;
  34450. return $core.withContext(function($ctx1) {
  34451. return $recv($self._classRegisteredFor_(aString))._new();
  34452. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString})});
  34453. },
  34454. args: ["aString"],
  34455. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  34456. referencedClasses: [],
  34457. pragmas: [],
  34458. messageSends: ["new", "classRegisteredFor:"]
  34459. }),
  34460. $globals.PackageTransport.a$cls);
  34461. $core.addMethod(
  34462. $core.method({
  34463. selector: "fromJson:",
  34464. protocol: "instance creation",
  34465. fn: function (anObject){
  34466. var self=this,$self=this;
  34467. return $core.withContext(function($ctx1) {
  34468. var $1,$2,$receiver;
  34469. if(($receiver = anObject) == null || $receiver.a$nil){
  34470. $1=$self._for_($self._defaultType());
  34471. $ctx1.sendIdx["for:"]=1;
  34472. return $1;
  34473. } else {
  34474. anObject;
  34475. }
  34476. $2=$self._for_($recv(anObject)._type());
  34477. $recv($2)._setupFromJson_(anObject);
  34478. return $recv($2)._yourself();
  34479. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject})});
  34480. },
  34481. args: ["anObject"],
  34482. 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",
  34483. referencedClasses: [],
  34484. pragmas: [],
  34485. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  34486. }),
  34487. $globals.PackageTransport.a$cls);
  34488. $core.addMethod(
  34489. $core.method({
  34490. selector: "initialize",
  34491. protocol: "initialization",
  34492. fn: function (){
  34493. var self=this,$self=this;
  34494. return $core.withContext(function($ctx1) {
  34495. var $1;
  34496. (
  34497. $ctx1.supercall = true,
  34498. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  34499. $ctx1.supercall = false;
  34500. $1=$self.__eq_eq($globals.PackageTransport);
  34501. if($core.assert($1)){
  34502. $self.registry=$globals.HashedCollection._newFromPairs_([]);
  34503. $self.registry;
  34504. } else {
  34505. $self._register();
  34506. }
  34507. return self;
  34508. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  34509. },
  34510. args: [],
  34511. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  34512. referencedClasses: ["PackageTransport"],
  34513. pragmas: [],
  34514. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  34515. }),
  34516. $globals.PackageTransport.a$cls);
  34517. $core.addMethod(
  34518. $core.method({
  34519. selector: "register",
  34520. protocol: "registration",
  34521. fn: function (){
  34522. var self=this,$self=this;
  34523. return $core.withContext(function($ctx1) {
  34524. $recv($globals.PackageTransport)._register_(self);
  34525. return self;
  34526. }, function($ctx1) {$ctx1.fill(self,"register",{})});
  34527. },
  34528. args: [],
  34529. source: "register\x0a\x09PackageTransport register: self",
  34530. referencedClasses: ["PackageTransport"],
  34531. pragmas: [],
  34532. messageSends: ["register:"]
  34533. }),
  34534. $globals.PackageTransport.a$cls);
  34535. $core.addMethod(
  34536. $core.method({
  34537. selector: "register:",
  34538. protocol: "registration",
  34539. fn: function (aClass){
  34540. var self=this,$self=this;
  34541. return $core.withContext(function($ctx1) {
  34542. var $1,$receiver;
  34543. $1=$recv(aClass)._type();
  34544. $ctx1.sendIdx["type"]=1;
  34545. if(($receiver = $1) == null || $receiver.a$nil){
  34546. $1;
  34547. } else {
  34548. $recv($self.registry)._at_put_($recv(aClass)._type(),aClass);
  34549. }
  34550. return self;
  34551. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass})});
  34552. },
  34553. args: ["aClass"],
  34554. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  34555. referencedClasses: [],
  34556. pragmas: [],
  34557. messageSends: ["ifNotNil:", "type", "at:put:"]
  34558. }),
  34559. $globals.PackageTransport.a$cls);
  34560. $core.addMethod(
  34561. $core.method({
  34562. selector: "type",
  34563. protocol: "accessing",
  34564. fn: function (){
  34565. var self=this,$self=this;
  34566. return nil;
  34567. },
  34568. args: [],
  34569. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  34570. referencedClasses: [],
  34571. pragmas: [],
  34572. messageSends: []
  34573. }),
  34574. $globals.PackageTransport.a$cls);
  34575. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  34576. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  34577. $core.addMethod(
  34578. $core.method({
  34579. selector: "asJavaScriptObject",
  34580. protocol: "converting",
  34581. fn: function (){
  34582. var self=this,$self=this;
  34583. return $core.withContext(function($ctx1) {
  34584. var $1;
  34585. $1=(
  34586. $ctx1.supercall = true,
  34587. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  34588. $ctx1.supercall = false;
  34589. $recv($1)._at_put_("amdNamespace",$self._namespace());
  34590. return $recv($1)._yourself();
  34591. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  34592. },
  34593. args: [],
  34594. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  34595. referencedClasses: [],
  34596. pragmas: [],
  34597. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  34598. }),
  34599. $globals.AmdPackageTransport);
  34600. $core.addMethod(
  34601. $core.method({
  34602. selector: "commitHandlerClass",
  34603. protocol: "accessing",
  34604. fn: function (){
  34605. var self=this,$self=this;
  34606. return $globals.AmdPackageHandler;
  34607. },
  34608. args: [],
  34609. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  34610. referencedClasses: ["AmdPackageHandler"],
  34611. pragmas: [],
  34612. messageSends: []
  34613. }),
  34614. $globals.AmdPackageTransport);
  34615. $core.addMethod(
  34616. $core.method({
  34617. selector: "defaultNamespace",
  34618. protocol: "defaults",
  34619. fn: function (){
  34620. var self=this,$self=this;
  34621. return $core.withContext(function($ctx1) {
  34622. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  34623. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  34624. },
  34625. args: [],
  34626. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  34627. referencedClasses: ["Smalltalk"],
  34628. pragmas: [],
  34629. messageSends: ["defaultAmdNamespace"]
  34630. }),
  34631. $globals.AmdPackageTransport);
  34632. $core.addMethod(
  34633. $core.method({
  34634. selector: "definition",
  34635. protocol: "accessing",
  34636. fn: function (){
  34637. var self=this,$self=this;
  34638. return $core.withContext(function($ctx1) {
  34639. return $recv($globals.String)._streamContents_((function(stream){
  34640. return $core.withContext(function($ctx2) {
  34641. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  34642. return $recv(stream)._print_($self._namespace());
  34643. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  34644. }));
  34645. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  34646. },
  34647. args: [],
  34648. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  34649. referencedClasses: ["String"],
  34650. pragmas: [],
  34651. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  34652. }),
  34653. $globals.AmdPackageTransport);
  34654. $core.addMethod(
  34655. $core.method({
  34656. selector: "namespace",
  34657. protocol: "accessing",
  34658. fn: function (){
  34659. var self=this,$self=this;
  34660. return $core.withContext(function($ctx1) {
  34661. var $1,$receiver;
  34662. $1=$self.namespace;
  34663. if(($receiver = $1) == null || $receiver.a$nil){
  34664. return $self._defaultNamespace();
  34665. } else {
  34666. return $1;
  34667. }
  34668. }, function($ctx1) {$ctx1.fill(self,"namespace",{})});
  34669. },
  34670. args: [],
  34671. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  34672. referencedClasses: [],
  34673. pragmas: [],
  34674. messageSends: ["ifNil:", "defaultNamespace"]
  34675. }),
  34676. $globals.AmdPackageTransport);
  34677. $core.addMethod(
  34678. $core.method({
  34679. selector: "namespace:",
  34680. protocol: "accessing",
  34681. fn: function (aString){
  34682. var self=this,$self=this;
  34683. $self.namespace=aString;
  34684. return self;
  34685. },
  34686. args: ["aString"],
  34687. source: "namespace: aString\x0a\x09namespace := aString",
  34688. referencedClasses: [],
  34689. pragmas: [],
  34690. messageSends: []
  34691. }),
  34692. $globals.AmdPackageTransport);
  34693. $core.addMethod(
  34694. $core.method({
  34695. selector: "printOn:",
  34696. protocol: "printing",
  34697. fn: function (aStream){
  34698. var self=this,$self=this;
  34699. return $core.withContext(function($ctx1) {
  34700. (
  34701. $ctx1.supercall = true,
  34702. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  34703. $ctx1.supercall = false;
  34704. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  34705. $ctx1.sendIdx["nextPutAll:"]=1;
  34706. $recv(aStream)._nextPutAll_($self._namespace());
  34707. $ctx1.sendIdx["nextPutAll:"]=2;
  34708. $recv(aStream)._nextPutAll_(")");
  34709. return self;
  34710. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  34711. },
  34712. args: ["aStream"],
  34713. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  34714. referencedClasses: [],
  34715. pragmas: [],
  34716. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  34717. }),
  34718. $globals.AmdPackageTransport);
  34719. $core.addMethod(
  34720. $core.method({
  34721. selector: "setupFromJson:",
  34722. protocol: "initialization",
  34723. fn: function (anObject){
  34724. var self=this,$self=this;
  34725. return $core.withContext(function($ctx1) {
  34726. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  34727. return self;
  34728. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject})});
  34729. },
  34730. args: ["anObject"],
  34731. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  34732. referencedClasses: [],
  34733. pragmas: [],
  34734. messageSends: ["namespace:", "at:"]
  34735. }),
  34736. $globals.AmdPackageTransport);
  34737. $core.addMethod(
  34738. $core.method({
  34739. selector: "namespace:",
  34740. protocol: "instance creation",
  34741. fn: function (aString){
  34742. var self=this,$self=this;
  34743. return $core.withContext(function($ctx1) {
  34744. var $1;
  34745. $1=$self._new();
  34746. $recv($1)._namespace_(aString);
  34747. return $recv($1)._yourself();
  34748. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString})});
  34749. },
  34750. args: ["aString"],
  34751. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  34752. referencedClasses: [],
  34753. pragmas: [],
  34754. messageSends: ["namespace:", "new", "yourself"]
  34755. }),
  34756. $globals.AmdPackageTransport.a$cls);
  34757. $core.addMethod(
  34758. $core.method({
  34759. selector: "type",
  34760. protocol: "accessing",
  34761. fn: function (){
  34762. var self=this,$self=this;
  34763. return "amd";
  34764. },
  34765. args: [],
  34766. source: "type\x0a\x09^ 'amd'",
  34767. referencedClasses: [],
  34768. pragmas: [],
  34769. messageSends: []
  34770. }),
  34771. $globals.AmdPackageTransport.a$cls);
  34772. $core.addMethod(
  34773. $core.method({
  34774. selector: "exportBehaviorDefinitionTo:using:",
  34775. protocol: "*Platform-ImportExport",
  34776. fn: function (aStream,anExporter){
  34777. var self=this,$self=this;
  34778. return $core.withContext(function($ctx1) {
  34779. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  34780. return self;
  34781. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34782. },
  34783. args: ["aStream", "anExporter"],
  34784. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  34785. referencedClasses: [],
  34786. pragmas: [],
  34787. messageSends: ["exportDefinitionOf:on:"]
  34788. }),
  34789. $globals.Class);
  34790. $core.addMethod(
  34791. $core.method({
  34792. selector: "exportBehaviorDefinitionTo:using:",
  34793. protocol: "*Platform-ImportExport",
  34794. fn: function (aStream,anExporter){
  34795. var self=this,$self=this;
  34796. return $core.withContext(function($ctx1) {
  34797. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  34798. return self;
  34799. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34800. },
  34801. args: ["aStream", "anExporter"],
  34802. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  34803. referencedClasses: [],
  34804. pragmas: [],
  34805. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  34806. }),
  34807. $globals.Metaclass);
  34808. $core.addMethod(
  34809. $core.method({
  34810. selector: "commit",
  34811. protocol: "*Platform-ImportExport",
  34812. fn: function (){
  34813. var self=this,$self=this;
  34814. return $core.withContext(function($ctx1) {
  34815. return $recv($self._transport())._commit();
  34816. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  34817. },
  34818. args: [],
  34819. source: "commit\x0a\x09^ self transport commit",
  34820. referencedClasses: [],
  34821. pragmas: [],
  34822. messageSends: ["commit", "transport"]
  34823. }),
  34824. $globals.Package);
  34825. $core.addMethod(
  34826. $core.method({
  34827. selector: "load",
  34828. protocol: "*Platform-ImportExport",
  34829. fn: function (){
  34830. var self=this,$self=this;
  34831. return $core.withContext(function($ctx1) {
  34832. return $recv($self._transport())._load();
  34833. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  34834. },
  34835. args: [],
  34836. source: "load\x0a\x09^ self transport load",
  34837. referencedClasses: [],
  34838. pragmas: [],
  34839. messageSends: ["load", "transport"]
  34840. }),
  34841. $globals.Package);
  34842. $core.addMethod(
  34843. $core.method({
  34844. selector: "loadFromNamespace:",
  34845. protocol: "*Platform-ImportExport",
  34846. fn: function (aString){
  34847. var self=this,$self=this;
  34848. return $core.withContext(function($ctx1) {
  34849. var $1;
  34850. $1=$self._transport();
  34851. $recv($1)._namespace_(aString);
  34852. return $recv($1)._load();
  34853. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString})});
  34854. },
  34855. args: ["aString"],
  34856. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  34857. referencedClasses: [],
  34858. pragmas: [],
  34859. messageSends: ["namespace:", "transport", "load"]
  34860. }),
  34861. $globals.Package);
  34862. $core.addMethod(
  34863. $core.method({
  34864. selector: "load:",
  34865. protocol: "*Platform-ImportExport",
  34866. fn: function (aPackageName){
  34867. var self=this,$self=this;
  34868. return $core.withContext(function($ctx1) {
  34869. return $recv($self._named_(aPackageName))._load();
  34870. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName})});
  34871. },
  34872. args: ["aPackageName"],
  34873. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  34874. referencedClasses: [],
  34875. pragmas: [],
  34876. messageSends: ["load", "named:"]
  34877. }),
  34878. $globals.Package.a$cls);
  34879. $core.addMethod(
  34880. $core.method({
  34881. selector: "load:fromNamespace:",
  34882. protocol: "*Platform-ImportExport",
  34883. fn: function (aPackageName,aString){
  34884. var self=this,$self=this;
  34885. return $core.withContext(function($ctx1) {
  34886. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  34887. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString})});
  34888. },
  34889. args: ["aPackageName", "aString"],
  34890. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  34891. referencedClasses: [],
  34892. pragmas: [],
  34893. messageSends: ["loadFromNamespace:", "named:"]
  34894. }),
  34895. $globals.Package.a$cls);
  34896. $core.addMethod(
  34897. $core.method({
  34898. selector: "methodsFor:",
  34899. protocol: "*Platform-ImportExport",
  34900. fn: function (aString){
  34901. var self=this,$self=this;
  34902. return $core.withContext(function($ctx1) {
  34903. var $1;
  34904. $1=$recv($globals.ClassProtocolReader)._new();
  34905. $recv($1)._class_category_(self,aString);
  34906. return $recv($1)._yourself();
  34907. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString})});
  34908. },
  34909. args: ["aString"],
  34910. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  34911. referencedClasses: ["ClassProtocolReader"],
  34912. pragmas: [],
  34913. messageSends: ["class:category:", "new", "yourself"]
  34914. }),
  34915. $globals.TBehaviorProvider);
  34916. $core.addMethod(
  34917. $core.method({
  34918. selector: "methodsFor:stamp:",
  34919. protocol: "*Platform-ImportExport",
  34920. fn: function (aString,aStamp){
  34921. var self=this,$self=this;
  34922. return $core.withContext(function($ctx1) {
  34923. return $self._methodsFor_(aString);
  34924. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp})});
  34925. },
  34926. args: ["aString", "aStamp"],
  34927. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  34928. referencedClasses: [],
  34929. pragmas: [],
  34930. messageSends: ["methodsFor:"]
  34931. }),
  34932. $globals.TBehaviorProvider);
  34933. $core.addMethod(
  34934. $core.method({
  34935. selector: "commentStamp",
  34936. protocol: "*Platform-ImportExport",
  34937. fn: function (){
  34938. var self=this,$self=this;
  34939. return $core.withContext(function($ctx1) {
  34940. var $1;
  34941. $1=$recv($globals.ClassCommentReader)._new();
  34942. $recv($1)._class_(self);
  34943. return $recv($1)._yourself();
  34944. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{})});
  34945. },
  34946. args: [],
  34947. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  34948. referencedClasses: ["ClassCommentReader"],
  34949. pragmas: [],
  34950. messageSends: ["class:", "new", "yourself"]
  34951. }),
  34952. $globals.TMasterBehavior);
  34953. $core.addMethod(
  34954. $core.method({
  34955. selector: "commentStamp:prior:",
  34956. protocol: "*Platform-ImportExport",
  34957. fn: function (aStamp,prior){
  34958. var self=this,$self=this;
  34959. return $core.withContext(function($ctx1) {
  34960. return $self._commentStamp();
  34961. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior})});
  34962. },
  34963. args: ["aStamp", "prior"],
  34964. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  34965. referencedClasses: [],
  34966. pragmas: [],
  34967. messageSends: ["commentStamp"]
  34968. }),
  34969. $globals.TMasterBehavior);
  34970. $core.addMethod(
  34971. $core.method({
  34972. selector: "exportBehaviorDefinitionTo:using:",
  34973. protocol: "*Platform-ImportExport",
  34974. fn: function (aStream,anExporter){
  34975. var self=this,$self=this;
  34976. return $core.withContext(function($ctx1) {
  34977. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  34978. return self;
  34979. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  34980. },
  34981. args: ["aStream", "anExporter"],
  34982. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  34983. referencedClasses: [],
  34984. pragmas: [],
  34985. messageSends: ["exportTraitDefinitionOf:on:"]
  34986. }),
  34987. $globals.Trait);
  34988. });
  34989. define('amber/core/Compiler-Core',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  34990. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34991. var $pkg = $core.addPackage("Compiler-Core");
  34992. $pkg.innerEval = function (expr) { return eval(expr); };
  34993. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  34994. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  34995. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  34996. $core.addMethod(
  34997. $core.method({
  34998. selector: "compileNode:",
  34999. protocol: "compiling",
  35000. fn: function (aNode){
  35001. var self=this,$self=this;
  35002. return $core.withContext(function($ctx1) {
  35003. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35004. return $core.withContext(function($ctx2) {
  35005. return $recv(transformer)._value_(input);
  35006. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35007. }));
  35008. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode})});
  35009. },
  35010. args: ["aNode"],
  35011. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35012. referencedClasses: [],
  35013. pragmas: [],
  35014. messageSends: ["inject:into:", "transformers", "value:"]
  35015. }),
  35016. $globals.AbstractCodeGenerator);
  35017. $core.addMethod(
  35018. $core.method({
  35019. selector: "currentClass",
  35020. protocol: "accessing",
  35021. fn: function (){
  35022. var self=this,$self=this;
  35023. return $self.currentClass;
  35024. },
  35025. args: [],
  35026. source: "currentClass\x0a\x09^ currentClass",
  35027. referencedClasses: [],
  35028. pragmas: [],
  35029. messageSends: []
  35030. }),
  35031. $globals.AbstractCodeGenerator);
  35032. $core.addMethod(
  35033. $core.method({
  35034. selector: "currentClass:",
  35035. protocol: "accessing",
  35036. fn: function (aClass){
  35037. var self=this,$self=this;
  35038. $self.currentClass=aClass;
  35039. return self;
  35040. },
  35041. args: ["aClass"],
  35042. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35043. referencedClasses: [],
  35044. pragmas: [],
  35045. messageSends: []
  35046. }),
  35047. $globals.AbstractCodeGenerator);
  35048. $core.addMethod(
  35049. $core.method({
  35050. selector: "currentPackage",
  35051. protocol: "accessing",
  35052. fn: function (){
  35053. var self=this,$self=this;
  35054. return $self.currentPackage;
  35055. },
  35056. args: [],
  35057. source: "currentPackage\x0a\x09^ currentPackage",
  35058. referencedClasses: [],
  35059. pragmas: [],
  35060. messageSends: []
  35061. }),
  35062. $globals.AbstractCodeGenerator);
  35063. $core.addMethod(
  35064. $core.method({
  35065. selector: "currentPackage:",
  35066. protocol: "accessing",
  35067. fn: function (anObject){
  35068. var self=this,$self=this;
  35069. $self.currentPackage=anObject;
  35070. return self;
  35071. },
  35072. args: ["anObject"],
  35073. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35074. referencedClasses: [],
  35075. pragmas: [],
  35076. messageSends: []
  35077. }),
  35078. $globals.AbstractCodeGenerator);
  35079. $core.addMethod(
  35080. $core.method({
  35081. selector: "pseudoVariables",
  35082. protocol: "accessing",
  35083. fn: function (){
  35084. var self=this,$self=this;
  35085. return $core.withContext(function($ctx1) {
  35086. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35087. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{})});
  35088. },
  35089. args: [],
  35090. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35091. referencedClasses: ["Smalltalk"],
  35092. pragmas: [],
  35093. messageSends: ["pseudoVariableNames"]
  35094. }),
  35095. $globals.AbstractCodeGenerator);
  35096. $core.addMethod(
  35097. $core.method({
  35098. selector: "source",
  35099. protocol: "accessing",
  35100. fn: function (){
  35101. var self=this,$self=this;
  35102. return $core.withContext(function($ctx1) {
  35103. var $1,$receiver;
  35104. $1=$self.source;
  35105. if(($receiver = $1) == null || $receiver.a$nil){
  35106. return "";
  35107. } else {
  35108. return $1;
  35109. }
  35110. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  35111. },
  35112. args: [],
  35113. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35114. referencedClasses: [],
  35115. pragmas: [],
  35116. messageSends: ["ifNil:"]
  35117. }),
  35118. $globals.AbstractCodeGenerator);
  35119. $core.addMethod(
  35120. $core.method({
  35121. selector: "source:",
  35122. protocol: "accessing",
  35123. fn: function (aString){
  35124. var self=this,$self=this;
  35125. $self.source=aString;
  35126. return self;
  35127. },
  35128. args: ["aString"],
  35129. source: "source: aString\x0a\x09source := aString",
  35130. referencedClasses: [],
  35131. pragmas: [],
  35132. messageSends: []
  35133. }),
  35134. $globals.AbstractCodeGenerator);
  35135. $core.addMethod(
  35136. $core.method({
  35137. selector: "transformers",
  35138. protocol: "compiling",
  35139. fn: function (){
  35140. var self=this,$self=this;
  35141. var dict;
  35142. return $core.withContext(function($ctx1) {
  35143. dict=$self._transformersDictionary();
  35144. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35145. return $core.withContext(function($ctx2) {
  35146. return $recv(dict)._at_(each);
  35147. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35148. }));
  35149. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict})});
  35150. },
  35151. args: [],
  35152. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35153. referencedClasses: [],
  35154. pragmas: [],
  35155. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35156. }),
  35157. $globals.AbstractCodeGenerator);
  35158. $core.addMethod(
  35159. $core.method({
  35160. selector: "transformersDictionary",
  35161. protocol: "compiling",
  35162. fn: function (){
  35163. var self=this,$self=this;
  35164. return $core.withContext(function($ctx1) {
  35165. $self._subclassResponsibility();
  35166. return self;
  35167. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  35168. },
  35169. args: [],
  35170. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35171. referencedClasses: [],
  35172. pragmas: [],
  35173. messageSends: ["subclassResponsibility"]
  35174. }),
  35175. $globals.AbstractCodeGenerator);
  35176. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35177. $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.";
  35178. $core.addMethod(
  35179. $core.method({
  35180. selector: "earlyAstPragmator",
  35181. protocol: "compiling",
  35182. fn: function (){
  35183. var self=this,$self=this;
  35184. return $core.withContext(function($ctx1) {
  35185. return $recv($globals.AstEarlyPragmator)._new();
  35186. }, function($ctx1) {$ctx1.fill(self,"earlyAstPragmator",{})});
  35187. },
  35188. args: [],
  35189. source: "earlyAstPragmator\x0a\x09^ AstEarlyPragmator new",
  35190. referencedClasses: ["AstEarlyPragmator"],
  35191. pragmas: [],
  35192. messageSends: ["new"]
  35193. }),
  35194. $globals.CodeGenerator);
  35195. $core.addMethod(
  35196. $core.method({
  35197. selector: "irTranslator",
  35198. protocol: "compiling",
  35199. fn: function (){
  35200. var self=this,$self=this;
  35201. return $core.withContext(function($ctx1) {
  35202. var $1;
  35203. $1=$recv($self._irTranslatorClass())._new();
  35204. $recv($1)._currentClass_($self._currentClass());
  35205. return $recv($1)._yourself();
  35206. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{})});
  35207. },
  35208. args: [],
  35209. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35210. referencedClasses: [],
  35211. pragmas: [],
  35212. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35213. }),
  35214. $globals.CodeGenerator);
  35215. $core.addMethod(
  35216. $core.method({
  35217. selector: "irTranslatorClass",
  35218. protocol: "compiling",
  35219. fn: function (){
  35220. var self=this,$self=this;
  35221. return $globals.IRJSTranslator;
  35222. },
  35223. args: [],
  35224. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35225. referencedClasses: ["IRJSTranslator"],
  35226. pragmas: [],
  35227. messageSends: []
  35228. }),
  35229. $globals.CodeGenerator);
  35230. $core.addMethod(
  35231. $core.method({
  35232. selector: "semanticAnalyzer",
  35233. protocol: "compiling",
  35234. fn: function (){
  35235. var self=this,$self=this;
  35236. return $core.withContext(function($ctx1) {
  35237. var $1;
  35238. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35239. $recv($1)._thePackage_($self._currentPackage());
  35240. return $recv($1)._yourself();
  35241. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{})});
  35242. },
  35243. args: [],
  35244. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35245. referencedClasses: ["SemanticAnalyzer"],
  35246. pragmas: [],
  35247. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35248. }),
  35249. $globals.CodeGenerator);
  35250. $core.addMethod(
  35251. $core.method({
  35252. selector: "transformersDictionary",
  35253. protocol: "compiling",
  35254. fn: function (){
  35255. var self=this,$self=this;
  35256. return $core.withContext(function($ctx1) {
  35257. var $1,$2,$receiver;
  35258. $1=$self.transformersDictionary;
  35259. if(($receiver = $1) == null || $receiver.a$nil){
  35260. $2=$recv($globals.Dictionary)._new();
  35261. $recv($2)._at_put_("1000-earlyPragmas",$self._earlyAstPragmator());
  35262. $ctx1.sendIdx["at:put:"]=1;
  35263. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35264. $ctx1.sendIdx["at:put:"]=2;
  35265. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35266. $ctx1.sendIdx["at:put:"]=3;
  35267. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35268. $self.transformersDictionary=$recv($2)._yourself();
  35269. return $self.transformersDictionary;
  35270. } else {
  35271. return $1;
  35272. }
  35273. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  35274. },
  35275. args: [],
  35276. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: self earlyAstPragmator;\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 ]",
  35277. referencedClasses: ["Dictionary"],
  35278. pragmas: [],
  35279. messageSends: ["ifNil:", "at:put:", "new", "earlyAstPragmator", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35280. }),
  35281. $globals.CodeGenerator);
  35282. $core.addMethod(
  35283. $core.method({
  35284. selector: "translator",
  35285. protocol: "compiling",
  35286. fn: function (){
  35287. var self=this,$self=this;
  35288. return $core.withContext(function($ctx1) {
  35289. var $1;
  35290. $1=$recv($globals.IRASTTranslator)._new();
  35291. $recv($1)._source_($self._source());
  35292. $recv($1)._theClass_($self._currentClass());
  35293. return $recv($1)._yourself();
  35294. }, function($ctx1) {$ctx1.fill(self,"translator",{})});
  35295. },
  35296. args: [],
  35297. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35298. referencedClasses: ["IRASTTranslator"],
  35299. pragmas: [],
  35300. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35301. }),
  35302. $globals.CodeGenerator);
  35303. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35304. $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`";
  35305. $core.addMethod(
  35306. $core.method({
  35307. selector: "ast:forClass:protocol:",
  35308. protocol: "compiling",
  35309. fn: function (aString,aClass,anotherString){
  35310. var self=this,$self=this;
  35311. return $core.withContext(function($ctx1) {
  35312. var $early={};
  35313. try {
  35314. $self._source_(aString);
  35315. $self._forClass_protocol_(aClass,anotherString);
  35316. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35317. throw $early=[x];
  35318. }));
  35319. $self._compileNode_($self._parse_(aString));
  35320. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35321. return self;
  35322. }
  35323. catch(e) {if(e===$early)return e[0]; throw e}
  35324. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString})});
  35325. },
  35326. args: ["aString", "aClass", "anotherString"],
  35327. 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.'",
  35328. referencedClasses: ["CompilerError"],
  35329. pragmas: [],
  35330. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35331. }),
  35332. $globals.Compiler);
  35333. $core.addMethod(
  35334. $core.method({
  35335. selector: "cleanCodeGenerator",
  35336. protocol: "accessing",
  35337. fn: function (){
  35338. var self=this,$self=this;
  35339. $self.codeGenerator=nil;
  35340. return self;
  35341. },
  35342. args: [],
  35343. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35344. referencedClasses: [],
  35345. pragmas: [],
  35346. messageSends: []
  35347. }),
  35348. $globals.Compiler);
  35349. $core.addMethod(
  35350. $core.method({
  35351. selector: "codeGenerator",
  35352. protocol: "accessing",
  35353. fn: function (){
  35354. var self=this,$self=this;
  35355. return $core.withContext(function($ctx1) {
  35356. var $1,$2,$receiver;
  35357. $1=$self.codeGenerator;
  35358. if(($receiver = $1) == null || $receiver.a$nil){
  35359. $2=$recv($self._codeGeneratorClass())._new();
  35360. $recv($2)._source_($self._source());
  35361. $recv($2)._currentClass_($self._currentClass());
  35362. $recv($2)._currentPackage_($self._currentPackage());
  35363. $self.codeGenerator=$recv($2)._yourself();
  35364. return $self.codeGenerator;
  35365. } else {
  35366. return $1;
  35367. }
  35368. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{})});
  35369. },
  35370. args: [],
  35371. 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 ]",
  35372. referencedClasses: [],
  35373. pragmas: [],
  35374. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35375. }),
  35376. $globals.Compiler);
  35377. $core.addMethod(
  35378. $core.method({
  35379. selector: "codeGeneratorClass",
  35380. protocol: "accessing",
  35381. fn: function (){
  35382. var self=this,$self=this;
  35383. return $core.withContext(function($ctx1) {
  35384. var $1,$receiver;
  35385. $1=$self.codeGeneratorClass;
  35386. if(($receiver = $1) == null || $receiver.a$nil){
  35387. return $globals.InliningCodeGenerator;
  35388. } else {
  35389. return $1;
  35390. }
  35391. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{})});
  35392. },
  35393. args: [],
  35394. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35395. referencedClasses: ["InliningCodeGenerator"],
  35396. pragmas: [],
  35397. messageSends: ["ifNil:"]
  35398. }),
  35399. $globals.Compiler);
  35400. $core.addMethod(
  35401. $core.method({
  35402. selector: "codeGeneratorClass:",
  35403. protocol: "accessing",
  35404. fn: function (aClass){
  35405. var self=this,$self=this;
  35406. $self.codeGeneratorClass=aClass;
  35407. return self;
  35408. },
  35409. args: ["aClass"],
  35410. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  35411. referencedClasses: [],
  35412. pragmas: [],
  35413. messageSends: []
  35414. }),
  35415. $globals.Compiler);
  35416. $core.addMethod(
  35417. $core.method({
  35418. selector: "compile:forClass:protocol:",
  35419. protocol: "compiling",
  35420. fn: function (aString,aClass,anotherString){
  35421. var self=this,$self=this;
  35422. var compilationResult,result,pragmas,closure;
  35423. return $core.withContext(function($ctx1) {
  35424. var $1,$2;
  35425. compilationResult=$self._compileSource_forClass_protocol_(aString,aClass,anotherString);
  35426. pragmas=$recv(compilationResult)._at_("pragmas");
  35427. $ctx1.sendIdx["at:"]=1;
  35428. closure=$self._eval_forPackage_($recv(compilationResult)._at_("fn"),$self._currentPackage());
  35429. $1=compilationResult;
  35430. $recv($1)._removeKey_("fn");
  35431. $ctx1.sendIdx["removeKey:"]=1;
  35432. $recv($1)._removeKey_("pragmas");
  35433. result=$recv($recv($globals.Smalltalk)._core())._method_(compilationResult);
  35434. $2=result;
  35435. $recv($2)._protocol_(anotherString);
  35436. $recv($2)._pragmas_(pragmas);
  35437. $recv($2)._fn_(closure);
  35438. return result;
  35439. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,compilationResult:compilationResult,result:result,pragmas:pragmas,closure:closure})});
  35440. },
  35441. args: ["aString", "aClass", "anotherString"],
  35442. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09| compilationResult result pragmas closure |\x0a\x09compilationResult :=\x0a\x09\x09self compileSource: aString forClass: aClass protocol: anotherString.\x0a\x09pragmas := compilationResult at: #pragmas.\x0a\x09closure := self eval: (compilationResult at: #fn) forPackage: self currentPackage.\x0a\x09compilationResult removeKey: #fn; removeKey: #pragmas.\x0a\x09result := Smalltalk core method: compilationResult.\x0a\x09result protocol: anotherString; pragmas: pragmas; fn: closure.\x0a\x09^ result",
  35443. referencedClasses: ["Smalltalk"],
  35444. pragmas: [],
  35445. messageSends: ["compileSource:forClass:protocol:", "at:", "eval:forPackage:", "currentPackage", "removeKey:", "method:", "core", "protocol:", "pragmas:", "fn:"]
  35446. }),
  35447. $globals.Compiler);
  35448. $core.addMethod(
  35449. $core.method({
  35450. selector: "compileExpression:on:",
  35451. protocol: "compiling",
  35452. fn: function (aString,anObject){
  35453. var self=this,$self=this;
  35454. return $core.withContext(function($ctx1) {
  35455. var $1;
  35456. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  35457. $ctx1.sendIdx[","]=1;
  35458. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  35459. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject})});
  35460. },
  35461. args: ["aString", "anObject"],
  35462. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  35463. referencedClasses: [],
  35464. pragmas: [],
  35465. messageSends: ["compile:forClass:protocol:", ",", "class"]
  35466. }),
  35467. $globals.Compiler);
  35468. $core.addMethod(
  35469. $core.method({
  35470. selector: "compileNode:",
  35471. protocol: "compiling",
  35472. fn: function (aNode){
  35473. var self=this,$self=this;
  35474. var result;
  35475. return $core.withContext(function($ctx1) {
  35476. result=$recv($self._codeGenerator())._compileNode_(aNode);
  35477. $self._cleanCodeGenerator();
  35478. return result;
  35479. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result})});
  35480. },
  35481. args: ["aNode"],
  35482. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  35483. referencedClasses: [],
  35484. pragmas: [],
  35485. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  35486. }),
  35487. $globals.Compiler);
  35488. $core.addMethod(
  35489. $core.method({
  35490. selector: "compileSource:forClass:protocol:",
  35491. protocol: "compiling",
  35492. fn: function (aString,aClass,anotherString){
  35493. var self=this,$self=this;
  35494. return $core.withContext(function($ctx1) {
  35495. $self._source_(aString);
  35496. $self._forClass_protocol_(aClass,anotherString);
  35497. return $self._compileNode_($self._parse_(aString));
  35498. }, function($ctx1) {$ctx1.fill(self,"compileSource:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString})});
  35499. },
  35500. args: ["aString", "aClass", "anotherString"],
  35501. source: "compileSource: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  35502. referencedClasses: [],
  35503. pragmas: [],
  35504. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  35505. }),
  35506. $globals.Compiler);
  35507. $core.addMethod(
  35508. $core.method({
  35509. selector: "currentClass",
  35510. protocol: "accessing",
  35511. fn: function (){
  35512. var self=this,$self=this;
  35513. return $self.currentClass;
  35514. },
  35515. args: [],
  35516. source: "currentClass\x0a\x09^ currentClass",
  35517. referencedClasses: [],
  35518. pragmas: [],
  35519. messageSends: []
  35520. }),
  35521. $globals.Compiler);
  35522. $core.addMethod(
  35523. $core.method({
  35524. selector: "currentClass:",
  35525. protocol: "accessing",
  35526. fn: function (aClass){
  35527. var self=this,$self=this;
  35528. $self.currentClass=aClass;
  35529. return self;
  35530. },
  35531. args: ["aClass"],
  35532. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35533. referencedClasses: [],
  35534. pragmas: [],
  35535. messageSends: []
  35536. }),
  35537. $globals.Compiler);
  35538. $core.addMethod(
  35539. $core.method({
  35540. selector: "currentPackage",
  35541. protocol: "accessing",
  35542. fn: function (){
  35543. var self=this,$self=this;
  35544. return $self.currentPackage;
  35545. },
  35546. args: [],
  35547. source: "currentPackage\x0a\x09^ currentPackage",
  35548. referencedClasses: [],
  35549. pragmas: [],
  35550. messageSends: []
  35551. }),
  35552. $globals.Compiler);
  35553. $core.addMethod(
  35554. $core.method({
  35555. selector: "currentPackage:",
  35556. protocol: "accessing",
  35557. fn: function (anObject){
  35558. var self=this,$self=this;
  35559. $self.currentPackage=anObject;
  35560. return self;
  35561. },
  35562. args: ["anObject"],
  35563. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35564. referencedClasses: [],
  35565. pragmas: [],
  35566. messageSends: []
  35567. }),
  35568. $globals.Compiler);
  35569. $core.addMethod(
  35570. $core.method({
  35571. selector: "eval:",
  35572. protocol: "compiling",
  35573. fn: function (aString){
  35574. var self=this,$self=this;
  35575. return $core.withContext(function($ctx1) {
  35576. return eval(aString);
  35577. return self;
  35578. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  35579. },
  35580. args: ["aString"],
  35581. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  35582. referencedClasses: [],
  35583. pragmas: [["inlineJS:", ["return eval(aString)"]]],
  35584. messageSends: []
  35585. }),
  35586. $globals.Compiler);
  35587. $core.addMethod(
  35588. $core.method({
  35589. selector: "eval:forPackage:",
  35590. protocol: "compiling",
  35591. fn: function (aString,aPackage){
  35592. var self=this,$self=this;
  35593. return $core.withContext(function($ctx1) {
  35594. var $receiver;
  35595. if(($receiver = aPackage) == null || $receiver.a$nil){
  35596. return $self._eval_(aString);
  35597. $ctx1.sendIdx["eval:"]=1;
  35598. } else {
  35599. return $recv(aPackage)._eval_(aString);
  35600. }
  35601. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage})});
  35602. },
  35603. args: ["aString", "aPackage"],
  35604. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  35605. referencedClasses: [],
  35606. pragmas: [],
  35607. messageSends: ["ifNil:ifNotNil:", "eval:"]
  35608. }),
  35609. $globals.Compiler);
  35610. $core.addMethod(
  35611. $core.method({
  35612. selector: "evaluateExpression:",
  35613. protocol: "compiling",
  35614. fn: function (aString){
  35615. var self=this,$self=this;
  35616. return $core.withContext(function($ctx1) {
  35617. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  35618. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString})});
  35619. },
  35620. args: ["aString"],
  35621. 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",
  35622. referencedClasses: ["DoIt"],
  35623. pragmas: [],
  35624. messageSends: ["evaluateExpression:on:", "new"]
  35625. }),
  35626. $globals.Compiler);
  35627. $core.addMethod(
  35628. $core.method({
  35629. selector: "evaluateExpression:on:",
  35630. protocol: "compiling",
  35631. fn: function (aString,anObject){
  35632. var self=this,$self=this;
  35633. var result,method;
  35634. return $core.withContext(function($ctx1) {
  35635. var $1;
  35636. method=$self._compileExpression_on_(aString,anObject);
  35637. $1=$recv(anObject)._class();
  35638. $ctx1.sendIdx["class"]=1;
  35639. $recv($1)._addCompiledMethod_(method);
  35640. result=$recv(anObject)._xxxDoIt();
  35641. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  35642. return result;
  35643. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method})});
  35644. },
  35645. args: ["aString", "anObject"],
  35646. 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 compileExpression: aString on: anObject.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  35647. referencedClasses: [],
  35648. pragmas: [],
  35649. messageSends: ["compileExpression:on:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  35650. }),
  35651. $globals.Compiler);
  35652. $core.addMethod(
  35653. $core.method({
  35654. selector: "forClass:protocol:",
  35655. protocol: "compiling",
  35656. fn: function (aClass,anotherString){
  35657. var self=this,$self=this;
  35658. return $core.withContext(function($ctx1) {
  35659. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  35660. $self._currentClass_(aClass);
  35661. return self;
  35662. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString})});
  35663. },
  35664. args: ["aClass", "anotherString"],
  35665. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  35666. referencedClasses: [],
  35667. pragmas: [],
  35668. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  35669. }),
  35670. $globals.Compiler);
  35671. $core.addMethod(
  35672. $core.method({
  35673. selector: "install:forClass:protocol:",
  35674. protocol: "compiling",
  35675. fn: function (aString,aBehavior,anotherString){
  35676. var self=this,$self=this;
  35677. var compiledMethod;
  35678. return $core.withContext(function($ctx1) {
  35679. compiledMethod=$self._compile_forClass_protocol_(aString,aBehavior,anotherString);
  35680. $recv(aBehavior)._addCompiledMethod_(compiledMethod);
  35681. return compiledMethod;
  35682. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod})});
  35683. },
  35684. args: ["aString", "aBehavior", "anotherString"],
  35685. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self compile: aString forClass: aBehavior protocol: anotherString.\x0a\x09aBehavior addCompiledMethod: compiledMethod.\x0a\x09^ compiledMethod",
  35686. referencedClasses: [],
  35687. pragmas: [],
  35688. messageSends: ["compile:forClass:protocol:", "addCompiledMethod:"]
  35689. }),
  35690. $globals.Compiler);
  35691. $core.addMethod(
  35692. $core.method({
  35693. selector: "parse:",
  35694. protocol: "compiling",
  35695. fn: function (aString){
  35696. var self=this,$self=this;
  35697. return $core.withContext(function($ctx1) {
  35698. return $recv($globals.Smalltalk)._parse_(aString);
  35699. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString})});
  35700. },
  35701. args: ["aString"],
  35702. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  35703. referencedClasses: ["Smalltalk"],
  35704. pragmas: [],
  35705. messageSends: ["parse:"]
  35706. }),
  35707. $globals.Compiler);
  35708. $core.addMethod(
  35709. $core.method({
  35710. selector: "parseExpression:",
  35711. protocol: "compiling",
  35712. fn: function (aString){
  35713. var self=this,$self=this;
  35714. return $core.withContext(function($ctx1) {
  35715. var $1;
  35716. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  35717. $ctx1.sendIdx[","]=1;
  35718. return $self._parse_($1);
  35719. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString})});
  35720. },
  35721. args: ["aString"],
  35722. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  35723. referencedClasses: [],
  35724. pragmas: [],
  35725. messageSends: ["parse:", ","]
  35726. }),
  35727. $globals.Compiler);
  35728. $core.addMethod(
  35729. $core.method({
  35730. selector: "recompile:",
  35731. protocol: "compiling",
  35732. fn: function (aClass){
  35733. var self=this,$self=this;
  35734. return $core.withContext(function($ctx1) {
  35735. var $1;
  35736. $recv(aClass)._includingPossibleMetaDo_((function(eachSide){
  35737. return $core.withContext(function($ctx2) {
  35738. return $recv($recv($recv(eachSide)._methodDictionary())._values())._do_displayingProgress_((function(each){
  35739. return $core.withContext(function($ctx3) {
  35740. $1=$recv($recv(each)._origin()).__eq(eachSide);
  35741. if($core.assert($1)){
  35742. return $self._install_forClass_protocol_($recv(each)._source(),eachSide,$recv(each)._protocol());
  35743. }
  35744. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  35745. }),"Recompiling ".__comma($recv(eachSide)._name()));
  35746. }, function($ctx2) {$ctx2.fillBlock({eachSide:eachSide},$ctx1,1)});
  35747. }));
  35748. return self;
  35749. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  35750. },
  35751. args: ["aClass"],
  35752. source: "recompile: aClass\x0a\x09aClass includingPossibleMetaDo: [ :eachSide |\x0a\x09\x09eachSide methodDictionary values\x0a\x09\x09\x09do: [ :each | each origin = eachSide ifTrue: [ \x0a\x09\x09\x09\x09self \x0a\x09\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09\x09forClass: eachSide \x0a\x09\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09\x09displayingProgress: 'Recompiling ', eachSide name ]",
  35753. referencedClasses: [],
  35754. pragmas: [],
  35755. messageSends: ["includingPossibleMetaDo:", "do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "source", "protocol", ",", "name"]
  35756. }),
  35757. $globals.Compiler);
  35758. $core.addMethod(
  35759. $core.method({
  35760. selector: "recompileAll",
  35761. protocol: "compiling",
  35762. fn: function (){
  35763. var self=this,$self=this;
  35764. return $core.withContext(function($ctx1) {
  35765. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  35766. return $core.withContext(function($ctx2) {
  35767. return $self._recompile_(each);
  35768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35769. }),"Compiling all classes...");
  35770. return self;
  35771. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  35772. },
  35773. args: [],
  35774. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  35775. referencedClasses: ["Smalltalk"],
  35776. pragmas: [],
  35777. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  35778. }),
  35779. $globals.Compiler);
  35780. $core.addMethod(
  35781. $core.method({
  35782. selector: "source",
  35783. protocol: "accessing",
  35784. fn: function (){
  35785. var self=this,$self=this;
  35786. return $core.withContext(function($ctx1) {
  35787. var $1,$receiver;
  35788. $1=$self.source;
  35789. if(($receiver = $1) == null || $receiver.a$nil){
  35790. return "";
  35791. } else {
  35792. return $1;
  35793. }
  35794. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  35795. },
  35796. args: [],
  35797. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35798. referencedClasses: [],
  35799. pragmas: [],
  35800. messageSends: ["ifNil:"]
  35801. }),
  35802. $globals.Compiler);
  35803. $core.addMethod(
  35804. $core.method({
  35805. selector: "source:",
  35806. protocol: "accessing",
  35807. fn: function (aString){
  35808. var self=this,$self=this;
  35809. $self.source=aString;
  35810. return self;
  35811. },
  35812. args: ["aString"],
  35813. source: "source: aString\x0a\x09source := aString",
  35814. referencedClasses: [],
  35815. pragmas: [],
  35816. messageSends: []
  35817. }),
  35818. $globals.Compiler);
  35819. $core.addMethod(
  35820. $core.method({
  35821. selector: "eval:",
  35822. protocol: "evaluating",
  35823. fn: function (aString){
  35824. var self=this,$self=this;
  35825. return $core.withContext(function($ctx1) {
  35826. return $recv($self._new())._eval_(aString);
  35827. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  35828. },
  35829. args: ["aString"],
  35830. source: "eval: aString\x0a\x09^ self new eval: aString",
  35831. referencedClasses: [],
  35832. pragmas: [],
  35833. messageSends: ["eval:", "new"]
  35834. }),
  35835. $globals.Compiler.a$cls);
  35836. $core.addMethod(
  35837. $core.method({
  35838. selector: "recompile:",
  35839. protocol: "compiling",
  35840. fn: function (aClass){
  35841. var self=this,$self=this;
  35842. return $core.withContext(function($ctx1) {
  35843. $recv($self._new())._recompile_(aClass);
  35844. return self;
  35845. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  35846. },
  35847. args: ["aClass"],
  35848. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  35849. referencedClasses: [],
  35850. pragmas: [],
  35851. messageSends: ["recompile:", "new"]
  35852. }),
  35853. $globals.Compiler.a$cls);
  35854. $core.addMethod(
  35855. $core.method({
  35856. selector: "recompileAll",
  35857. protocol: "compiling",
  35858. fn: function (){
  35859. var self=this,$self=this;
  35860. return $core.withContext(function($ctx1) {
  35861. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  35862. return $core.withContext(function($ctx2) {
  35863. return $self._recompile_(each);
  35864. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35865. }));
  35866. return self;
  35867. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  35868. },
  35869. args: [],
  35870. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  35871. referencedClasses: ["Smalltalk"],
  35872. pragmas: [],
  35873. messageSends: ["do:", "classes", "recompile:"]
  35874. }),
  35875. $globals.Compiler.a$cls);
  35876. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  35877. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  35878. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  35879. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  35880. $core.addMethod(
  35881. $core.method({
  35882. selector: "evaluate:context:",
  35883. protocol: "evaluating",
  35884. fn: function (aString,aContext){
  35885. var self=this,$self=this;
  35886. var compiler,ast;
  35887. return $core.withContext(function($ctx1) {
  35888. var $1;
  35889. var $early={};
  35890. try {
  35891. compiler=$recv($globals.Compiler)._new();
  35892. $recv((function(){
  35893. return $core.withContext(function($ctx2) {
  35894. ast=$recv(compiler)._parseExpression_(aString);
  35895. return ast;
  35896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35897. }))._on_do_($globals.Error,(function(ex){
  35898. return $core.withContext(function($ctx2) {
  35899. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  35900. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  35901. }));
  35902. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  35903. $recv($1)._context_(aContext);
  35904. $recv($1)._visit_(ast);
  35905. return $recv(aContext)._evaluateNode_(ast);
  35906. }
  35907. catch(e) {if(e===$early)return e[0]; throw e}
  35908. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast})});
  35909. },
  35910. args: ["aString", "aContext"],
  35911. 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",
  35912. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  35913. pragmas: [],
  35914. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  35915. }),
  35916. $globals.Evaluator);
  35917. $core.addMethod(
  35918. $core.method({
  35919. selector: "evaluate:for:",
  35920. protocol: "evaluating",
  35921. fn: function (aString,anObject){
  35922. var self=this,$self=this;
  35923. return $core.withContext(function($ctx1) {
  35924. return $recv(anObject)._evaluate_on_(aString,self);
  35925. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  35926. },
  35927. args: ["aString", "anObject"],
  35928. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  35929. referencedClasses: [],
  35930. pragmas: [],
  35931. messageSends: ["evaluate:on:"]
  35932. }),
  35933. $globals.Evaluator);
  35934. $core.addMethod(
  35935. $core.method({
  35936. selector: "evaluate:receiver:",
  35937. protocol: "evaluating",
  35938. fn: function (aString,anObject){
  35939. var self=this,$self=this;
  35940. var compiler;
  35941. return $core.withContext(function($ctx1) {
  35942. var $early={};
  35943. try {
  35944. compiler=$recv($globals.Compiler)._new();
  35945. $recv((function(){
  35946. return $core.withContext(function($ctx2) {
  35947. return $recv(compiler)._parseExpression_(aString);
  35948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35949. }))._on_do_($globals.Error,(function(ex){
  35950. return $core.withContext(function($ctx2) {
  35951. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  35952. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  35953. }));
  35954. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  35955. }
  35956. catch(e) {if(e===$early)return e[0]; throw e}
  35957. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler})});
  35958. },
  35959. args: ["aString", "anObject"],
  35960. 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",
  35961. referencedClasses: ["Compiler", "Error", "Terminal"],
  35962. pragmas: [],
  35963. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  35964. }),
  35965. $globals.Evaluator);
  35966. $core.addMethod(
  35967. $core.method({
  35968. selector: "evaluate:for:",
  35969. protocol: "instance creation",
  35970. fn: function (aString,anObject){
  35971. var self=this,$self=this;
  35972. return $core.withContext(function($ctx1) {
  35973. return $recv($self._new())._evaluate_for_(aString,anObject);
  35974. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  35975. },
  35976. args: ["aString", "anObject"],
  35977. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  35978. referencedClasses: [],
  35979. pragmas: [],
  35980. messageSends: ["evaluate:for:", "new"]
  35981. }),
  35982. $globals.Evaluator.a$cls);
  35983. $core.addMethod(
  35984. $core.method({
  35985. selector: "asVariableName",
  35986. protocol: "*Compiler-Core",
  35987. fn: function (){
  35988. var self=this,$self=this;
  35989. return $core.withContext(function($ctx1) {
  35990. var $1;
  35991. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  35992. if($core.assert($1)){
  35993. return $self.__comma("_");
  35994. } else {
  35995. return self;
  35996. }
  35997. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{})});
  35998. },
  35999. args: [],
  36000. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36001. referencedClasses: ["Smalltalk"],
  36002. pragmas: [],
  36003. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36004. }),
  36005. $globals.String);
  36006. });
  36007. define('amber/core/Compiler-AST',["amber/boot", "require", "amber/core/Kernel-Dag", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Helpers", "amber/core/Kernel-Methods"], function($boot,requirejs){"use strict";
  36008. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36009. var $pkg = $core.addPackage("Compiler-AST");
  36010. $pkg.innerEval = function (expr) { return eval(expr); };
  36011. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  36012. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  36013. $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.";
  36014. $core.addMethod(
  36015. $core.method({
  36016. selector: "inPosition:",
  36017. protocol: "testing",
  36018. fn: function (aPoint){
  36019. var self=this,$self=this;
  36020. return $core.withContext(function($ctx1) {
  36021. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  36022. return $core.withContext(function($ctx2) {
  36023. return $recv($self._positionEnd()).__gt_eq(aPoint);
  36024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36025. }));
  36026. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint})});
  36027. },
  36028. args: ["aPoint"],
  36029. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  36030. referencedClasses: [],
  36031. pragmas: [],
  36032. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  36033. }),
  36034. $globals.ASTNode);
  36035. $core.addMethod(
  36036. $core.method({
  36037. selector: "isAssignmentNode",
  36038. protocol: "testing",
  36039. fn: function (){
  36040. var self=this,$self=this;
  36041. return false;
  36042. },
  36043. args: [],
  36044. source: "isAssignmentNode\x0a\x09^ false",
  36045. referencedClasses: [],
  36046. pragmas: [],
  36047. messageSends: []
  36048. }),
  36049. $globals.ASTNode);
  36050. $core.addMethod(
  36051. $core.method({
  36052. selector: "isBlockNode",
  36053. protocol: "testing",
  36054. fn: function (){
  36055. var self=this,$self=this;
  36056. return false;
  36057. },
  36058. args: [],
  36059. source: "isBlockNode\x0a\x09^ false",
  36060. referencedClasses: [],
  36061. pragmas: [],
  36062. messageSends: []
  36063. }),
  36064. $globals.ASTNode);
  36065. $core.addMethod(
  36066. $core.method({
  36067. selector: "isBlockSequenceNode",
  36068. protocol: "testing",
  36069. fn: function (){
  36070. var self=this,$self=this;
  36071. return false;
  36072. },
  36073. args: [],
  36074. source: "isBlockSequenceNode\x0a\x09^ false",
  36075. referencedClasses: [],
  36076. pragmas: [],
  36077. messageSends: []
  36078. }),
  36079. $globals.ASTNode);
  36080. $core.addMethod(
  36081. $core.method({
  36082. selector: "isCascadeNode",
  36083. protocol: "testing",
  36084. fn: function (){
  36085. var self=this,$self=this;
  36086. return false;
  36087. },
  36088. args: [],
  36089. source: "isCascadeNode\x0a\x09^ false",
  36090. referencedClasses: [],
  36091. pragmas: [],
  36092. messageSends: []
  36093. }),
  36094. $globals.ASTNode);
  36095. $core.addMethod(
  36096. $core.method({
  36097. selector: "isImmutable",
  36098. protocol: "testing",
  36099. fn: function (){
  36100. var self=this,$self=this;
  36101. return false;
  36102. },
  36103. args: [],
  36104. source: "isImmutable\x0a\x09^ false",
  36105. referencedClasses: [],
  36106. pragmas: [],
  36107. messageSends: []
  36108. }),
  36109. $globals.ASTNode);
  36110. $core.addMethod(
  36111. $core.method({
  36112. selector: "isJSStatementNode",
  36113. protocol: "testing",
  36114. fn: function (){
  36115. var self=this,$self=this;
  36116. return false;
  36117. },
  36118. args: [],
  36119. source: "isJSStatementNode\x0a\x09^ false",
  36120. referencedClasses: [],
  36121. pragmas: [],
  36122. messageSends: []
  36123. }),
  36124. $globals.ASTNode);
  36125. $core.addMethod(
  36126. $core.method({
  36127. selector: "isNavigationNode",
  36128. protocol: "testing",
  36129. fn: function (){
  36130. var self=this,$self=this;
  36131. return false;
  36132. },
  36133. args: [],
  36134. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  36135. referencedClasses: [],
  36136. pragmas: [],
  36137. messageSends: []
  36138. }),
  36139. $globals.ASTNode);
  36140. $core.addMethod(
  36141. $core.method({
  36142. selector: "isReturnNode",
  36143. protocol: "testing",
  36144. fn: function (){
  36145. var self=this,$self=this;
  36146. return false;
  36147. },
  36148. args: [],
  36149. source: "isReturnNode\x0a\x09^ false",
  36150. referencedClasses: [],
  36151. pragmas: [],
  36152. messageSends: []
  36153. }),
  36154. $globals.ASTNode);
  36155. $core.addMethod(
  36156. $core.method({
  36157. selector: "isSendNode",
  36158. protocol: "testing",
  36159. fn: function (){
  36160. var self=this,$self=this;
  36161. return false;
  36162. },
  36163. args: [],
  36164. source: "isSendNode\x0a\x09^ false",
  36165. referencedClasses: [],
  36166. pragmas: [],
  36167. messageSends: []
  36168. }),
  36169. $globals.ASTNode);
  36170. $core.addMethod(
  36171. $core.method({
  36172. selector: "isSequenceNode",
  36173. protocol: "testing",
  36174. fn: function (){
  36175. var self=this,$self=this;
  36176. return false;
  36177. },
  36178. args: [],
  36179. source: "isSequenceNode\x0a\x09^ false",
  36180. referencedClasses: [],
  36181. pragmas: [],
  36182. messageSends: []
  36183. }),
  36184. $globals.ASTNode);
  36185. $core.addMethod(
  36186. $core.method({
  36187. selector: "isSuper",
  36188. protocol: "testing",
  36189. fn: function (){
  36190. var self=this,$self=this;
  36191. return false;
  36192. },
  36193. args: [],
  36194. source: "isSuper\x0a\x09^ false",
  36195. referencedClasses: [],
  36196. pragmas: [],
  36197. messageSends: []
  36198. }),
  36199. $globals.ASTNode);
  36200. $core.addMethod(
  36201. $core.method({
  36202. selector: "isValueNode",
  36203. protocol: "testing",
  36204. fn: function (){
  36205. var self=this,$self=this;
  36206. return false;
  36207. },
  36208. args: [],
  36209. source: "isValueNode\x0a\x09^ false",
  36210. referencedClasses: [],
  36211. pragmas: [],
  36212. messageSends: []
  36213. }),
  36214. $globals.ASTNode);
  36215. $core.addMethod(
  36216. $core.method({
  36217. selector: "isVariableNode",
  36218. protocol: "testing",
  36219. fn: function (){
  36220. var self=this,$self=this;
  36221. return false;
  36222. },
  36223. args: [],
  36224. source: "isVariableNode\x0a\x09^ false",
  36225. referencedClasses: [],
  36226. pragmas: [],
  36227. messageSends: []
  36228. }),
  36229. $globals.ASTNode);
  36230. $core.addMethod(
  36231. $core.method({
  36232. selector: "location:",
  36233. protocol: "accessing",
  36234. fn: function (aLocation){
  36235. var self=this,$self=this;
  36236. return $core.withContext(function($ctx1) {
  36237. var $3,$2,$1;
  36238. $3=$recv(aLocation)._start();
  36239. $ctx1.sendIdx["start"]=1;
  36240. $2=$recv($3)._line();
  36241. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  36242. $self._position_($1);
  36243. return self;
  36244. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation})});
  36245. },
  36246. args: ["aLocation"],
  36247. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  36248. referencedClasses: [],
  36249. pragmas: [],
  36250. messageSends: ["position:", "@", "line", "start", "column"]
  36251. }),
  36252. $globals.ASTNode);
  36253. $core.addMethod(
  36254. $core.method({
  36255. selector: "method",
  36256. protocol: "accessing",
  36257. fn: function (){
  36258. var self=this,$self=this;
  36259. return $core.withContext(function($ctx1) {
  36260. var $1,$receiver;
  36261. $1=$self._parent();
  36262. if(($receiver = $1) == null || $receiver.a$nil){
  36263. return $1;
  36264. } else {
  36265. var node;
  36266. node=$receiver;
  36267. return $recv(node)._method();
  36268. }
  36269. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  36270. },
  36271. args: [],
  36272. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  36273. referencedClasses: [],
  36274. pragmas: [],
  36275. messageSends: ["ifNotNil:", "parent", "method"]
  36276. }),
  36277. $globals.ASTNode);
  36278. $core.addMethod(
  36279. $core.method({
  36280. selector: "navigationNodeAt:ifAbsent:",
  36281. protocol: "accessing",
  36282. fn: function (aPoint,aBlock){
  36283. var self=this,$self=this;
  36284. var children;
  36285. return $core.withContext(function($ctx1) {
  36286. var $2,$1;
  36287. var $early={};
  36288. try {
  36289. children=$recv($self._allDagChildren())._select_((function(each){
  36290. return $core.withContext(function($ctx2) {
  36291. return $recv($recv(each)._isNavigationNode())._and_((function(){
  36292. return $core.withContext(function($ctx3) {
  36293. return $recv(each)._inPosition_(aPoint);
  36294. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36295. }));
  36296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36297. }));
  36298. $recv(children)._ifEmpty_((function(){
  36299. return $core.withContext(function($ctx2) {
  36300. throw $early=[$recv(aBlock)._value()];
  36301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  36302. }));
  36303. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  36304. return $core.withContext(function($ctx2) {
  36305. $2=$recv(a)._positionStart();
  36306. $ctx2.sendIdx["positionStart"]=1;
  36307. $1=$recv($2)._dist_(aPoint);
  36308. $ctx2.sendIdx["dist:"]=1;
  36309. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  36310. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  36311. })))._first();
  36312. }
  36313. catch(e) {if(e===$early)return e[0]; throw e}
  36314. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children})});
  36315. },
  36316. args: ["aPoint", "aBlock"],
  36317. 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",
  36318. referencedClasses: [],
  36319. pragmas: [],
  36320. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  36321. }),
  36322. $globals.ASTNode);
  36323. $core.addMethod(
  36324. $core.method({
  36325. selector: "parent",
  36326. protocol: "accessing",
  36327. fn: function (){
  36328. var self=this,$self=this;
  36329. return $self.parent;
  36330. },
  36331. args: [],
  36332. source: "parent\x0a\x09^ parent",
  36333. referencedClasses: [],
  36334. pragmas: [],
  36335. messageSends: []
  36336. }),
  36337. $globals.ASTNode);
  36338. $core.addMethod(
  36339. $core.method({
  36340. selector: "parent:",
  36341. protocol: "accessing",
  36342. fn: function (aNode){
  36343. var self=this,$self=this;
  36344. $self.parent=aNode;
  36345. return self;
  36346. },
  36347. args: ["aNode"],
  36348. source: "parent: aNode\x0a\x09parent := aNode",
  36349. referencedClasses: [],
  36350. pragmas: [],
  36351. messageSends: []
  36352. }),
  36353. $globals.ASTNode);
  36354. $core.addMethod(
  36355. $core.method({
  36356. selector: "position",
  36357. protocol: "accessing",
  36358. fn: function (){
  36359. var self=this,$self=this;
  36360. return $core.withContext(function($ctx1) {
  36361. var $1,$2,$receiver;
  36362. $1=$self.position;
  36363. if(($receiver = $1) == null || $receiver.a$nil){
  36364. $2=$self._parent();
  36365. if(($receiver = $2) == null || $receiver.a$nil){
  36366. return $2;
  36367. } else {
  36368. var node;
  36369. node=$receiver;
  36370. return $recv(node)._position();
  36371. }
  36372. } else {
  36373. return $1;
  36374. }
  36375. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  36376. },
  36377. args: [],
  36378. 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 ] ]",
  36379. referencedClasses: [],
  36380. pragmas: [],
  36381. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  36382. }),
  36383. $globals.ASTNode);
  36384. $core.addMethod(
  36385. $core.method({
  36386. selector: "position:",
  36387. protocol: "accessing",
  36388. fn: function (aPosition){
  36389. var self=this,$self=this;
  36390. $self.position=aPosition;
  36391. return self;
  36392. },
  36393. args: ["aPosition"],
  36394. source: "position: aPosition\x0a\x09position := aPosition",
  36395. referencedClasses: [],
  36396. pragmas: [],
  36397. messageSends: []
  36398. }),
  36399. $globals.ASTNode);
  36400. $core.addMethod(
  36401. $core.method({
  36402. selector: "positionEnd",
  36403. protocol: "accessing",
  36404. fn: function (){
  36405. var self=this,$self=this;
  36406. return $core.withContext(function($ctx1) {
  36407. var $1,$6,$5,$4,$3,$2;
  36408. $1=$self._positionStart();
  36409. $6=$self._source();
  36410. $ctx1.sendIdx["source"]=1;
  36411. $5=$recv($6)._lines();
  36412. $ctx1.sendIdx["lines"]=1;
  36413. $4=$recv($5)._size();
  36414. $ctx1.sendIdx["size"]=1;
  36415. $3=$recv($4).__minus((1));
  36416. $ctx1.sendIdx["-"]=1;
  36417. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  36418. return $recv($1).__plus($2);
  36419. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{})});
  36420. },
  36421. args: [],
  36422. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  36423. referencedClasses: [],
  36424. pragmas: [],
  36425. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  36426. }),
  36427. $globals.ASTNode);
  36428. $core.addMethod(
  36429. $core.method({
  36430. selector: "positionStart",
  36431. protocol: "accessing",
  36432. fn: function (){
  36433. var self=this,$self=this;
  36434. return $core.withContext(function($ctx1) {
  36435. return $self._position();
  36436. }, function($ctx1) {$ctx1.fill(self,"positionStart",{})});
  36437. },
  36438. args: [],
  36439. source: "positionStart\x0a\x09^ self position",
  36440. referencedClasses: [],
  36441. pragmas: [],
  36442. messageSends: ["position"]
  36443. }),
  36444. $globals.ASTNode);
  36445. $core.addMethod(
  36446. $core.method({
  36447. selector: "requiresSmalltalkContext",
  36448. protocol: "testing",
  36449. fn: function (){
  36450. var self=this,$self=this;
  36451. return $core.withContext(function($ctx1) {
  36452. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  36453. return $core.withContext(function($ctx2) {
  36454. return $recv(each)._requiresSmalltalkContext();
  36455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36456. }),(function(){
  36457. return nil;
  36458. })))._notNil();
  36459. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  36460. },
  36461. args: [],
  36462. 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",
  36463. referencedClasses: [],
  36464. pragmas: [],
  36465. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  36466. }),
  36467. $globals.ASTNode);
  36468. $core.addMethod(
  36469. $core.method({
  36470. selector: "shouldBeAliased",
  36471. protocol: "accessing",
  36472. fn: function (){
  36473. var self=this,$self=this;
  36474. return $core.withContext(function($ctx1) {
  36475. var $1,$receiver;
  36476. $1=$self.shouldBeAliased;
  36477. if(($receiver = $1) == null || $receiver.a$nil){
  36478. return false;
  36479. } else {
  36480. return $1;
  36481. }
  36482. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{})});
  36483. },
  36484. args: [],
  36485. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  36486. referencedClasses: [],
  36487. pragmas: [],
  36488. messageSends: ["ifNil:"]
  36489. }),
  36490. $globals.ASTNode);
  36491. $core.addMethod(
  36492. $core.method({
  36493. selector: "shouldBeAliased:",
  36494. protocol: "accessing",
  36495. fn: function (aBoolean){
  36496. var self=this,$self=this;
  36497. $self.shouldBeAliased=aBoolean;
  36498. return self;
  36499. },
  36500. args: ["aBoolean"],
  36501. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  36502. referencedClasses: [],
  36503. pragmas: [],
  36504. messageSends: []
  36505. }),
  36506. $globals.ASTNode);
  36507. $core.addMethod(
  36508. $core.method({
  36509. selector: "size",
  36510. protocol: "accessing",
  36511. fn: function (){
  36512. var self=this,$self=this;
  36513. return $core.withContext(function($ctx1) {
  36514. return $recv($self._source())._size();
  36515. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  36516. },
  36517. args: [],
  36518. source: "size\x0a\x09^ self source size",
  36519. referencedClasses: [],
  36520. pragmas: [],
  36521. messageSends: ["size", "source"]
  36522. }),
  36523. $globals.ASTNode);
  36524. $core.addMethod(
  36525. $core.method({
  36526. selector: "source",
  36527. protocol: "accessing",
  36528. fn: function (){
  36529. var self=this,$self=this;
  36530. return $core.withContext(function($ctx1) {
  36531. var $1,$receiver;
  36532. $1=$self.source;
  36533. if(($receiver = $1) == null || $receiver.a$nil){
  36534. return "";
  36535. } else {
  36536. return $1;
  36537. }
  36538. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  36539. },
  36540. args: [],
  36541. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36542. referencedClasses: [],
  36543. pragmas: [],
  36544. messageSends: ["ifNil:"]
  36545. }),
  36546. $globals.ASTNode);
  36547. $core.addMethod(
  36548. $core.method({
  36549. selector: "source:",
  36550. protocol: "accessing",
  36551. fn: function (aString){
  36552. var self=this,$self=this;
  36553. $self.source=aString;
  36554. return self;
  36555. },
  36556. args: ["aString"],
  36557. source: "source: aString\x0a\x09source := aString",
  36558. referencedClasses: [],
  36559. pragmas: [],
  36560. messageSends: []
  36561. }),
  36562. $globals.ASTNode);
  36563. $core.addMethod(
  36564. $core.method({
  36565. selector: "withTail:",
  36566. protocol: "building",
  36567. fn: function (aCollection){
  36568. var self=this,$self=this;
  36569. return $core.withContext(function($ctx1) {
  36570. var $1;
  36571. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  36572. return $core.withContext(function($ctx2) {
  36573. $1=$recv($globals.SendNode)._new();
  36574. $recv($1)._position_($recv(send)._position());
  36575. $recv($1)._source_($recv(send)._source());
  36576. $recv($1)._receiver_(receiver);
  36577. $recv($1)._selector_($recv(send)._selector());
  36578. $recv($1)._arguments_($recv(send)._arguments());
  36579. return $recv($1)._yourself();
  36580. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  36581. }));
  36582. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection})});
  36583. },
  36584. args: ["aCollection"],
  36585. 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 ]",
  36586. referencedClasses: ["SendNode"],
  36587. pragmas: [],
  36588. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  36589. }),
  36590. $globals.ASTNode);
  36591. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  36592. $globals.AssignmentNode.comment="I represent an assignment node.";
  36593. $core.addMethod(
  36594. $core.method({
  36595. selector: "acceptDagVisitor:",
  36596. protocol: "visiting",
  36597. fn: function (aVisitor){
  36598. var self=this,$self=this;
  36599. return $core.withContext(function($ctx1) {
  36600. return $recv(aVisitor)._visitAssignmentNode_(self);
  36601. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36602. },
  36603. args: ["aVisitor"],
  36604. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  36605. referencedClasses: [],
  36606. pragmas: [],
  36607. messageSends: ["visitAssignmentNode:"]
  36608. }),
  36609. $globals.AssignmentNode);
  36610. $core.addMethod(
  36611. $core.method({
  36612. selector: "dagChildren",
  36613. protocol: "accessing",
  36614. fn: function (){
  36615. var self=this,$self=this;
  36616. return $core.withContext(function($ctx1) {
  36617. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  36618. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  36619. },
  36620. args: [],
  36621. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  36622. referencedClasses: ["Array"],
  36623. pragmas: [],
  36624. messageSends: ["with:with:", "left", "right"]
  36625. }),
  36626. $globals.AssignmentNode);
  36627. $core.addMethod(
  36628. $core.method({
  36629. selector: "isAssignmentNode",
  36630. protocol: "testing",
  36631. fn: function (){
  36632. var self=this,$self=this;
  36633. return true;
  36634. },
  36635. args: [],
  36636. source: "isAssignmentNode\x0a\x09^ true",
  36637. referencedClasses: [],
  36638. pragmas: [],
  36639. messageSends: []
  36640. }),
  36641. $globals.AssignmentNode);
  36642. $core.addMethod(
  36643. $core.method({
  36644. selector: "left",
  36645. protocol: "accessing",
  36646. fn: function (){
  36647. var self=this,$self=this;
  36648. return $self.left;
  36649. },
  36650. args: [],
  36651. source: "left\x0a\x09^ left",
  36652. referencedClasses: [],
  36653. pragmas: [],
  36654. messageSends: []
  36655. }),
  36656. $globals.AssignmentNode);
  36657. $core.addMethod(
  36658. $core.method({
  36659. selector: "left:",
  36660. protocol: "accessing",
  36661. fn: function (aNode){
  36662. var self=this,$self=this;
  36663. $self.left=aNode;
  36664. return self;
  36665. },
  36666. args: ["aNode"],
  36667. source: "left: aNode\x0a\x09left := aNode",
  36668. referencedClasses: [],
  36669. pragmas: [],
  36670. messageSends: []
  36671. }),
  36672. $globals.AssignmentNode);
  36673. $core.addMethod(
  36674. $core.method({
  36675. selector: "right",
  36676. protocol: "accessing",
  36677. fn: function (){
  36678. var self=this,$self=this;
  36679. return $self.right;
  36680. },
  36681. args: [],
  36682. source: "right\x0a\x09^ right",
  36683. referencedClasses: [],
  36684. pragmas: [],
  36685. messageSends: []
  36686. }),
  36687. $globals.AssignmentNode);
  36688. $core.addMethod(
  36689. $core.method({
  36690. selector: "right:",
  36691. protocol: "accessing",
  36692. fn: function (aNode){
  36693. var self=this,$self=this;
  36694. $self.right=aNode;
  36695. return self;
  36696. },
  36697. args: ["aNode"],
  36698. source: "right: aNode\x0a\x09right := aNode",
  36699. referencedClasses: [],
  36700. pragmas: [],
  36701. messageSends: []
  36702. }),
  36703. $globals.AssignmentNode);
  36704. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  36705. $globals.BlockNode.comment="I represent an block closure node.";
  36706. $core.addMethod(
  36707. $core.method({
  36708. selector: "acceptDagVisitor:",
  36709. protocol: "visiting",
  36710. fn: function (aVisitor){
  36711. var self=this,$self=this;
  36712. return $core.withContext(function($ctx1) {
  36713. return $recv(aVisitor)._visitBlockNode_(self);
  36714. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36715. },
  36716. args: ["aVisitor"],
  36717. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  36718. referencedClasses: [],
  36719. pragmas: [],
  36720. messageSends: ["visitBlockNode:"]
  36721. }),
  36722. $globals.BlockNode);
  36723. $core.addMethod(
  36724. $core.method({
  36725. selector: "isBlockNode",
  36726. protocol: "testing",
  36727. fn: function (){
  36728. var self=this,$self=this;
  36729. return true;
  36730. },
  36731. args: [],
  36732. source: "isBlockNode\x0a\x09^ true",
  36733. referencedClasses: [],
  36734. pragmas: [],
  36735. messageSends: []
  36736. }),
  36737. $globals.BlockNode);
  36738. $core.addMethod(
  36739. $core.method({
  36740. selector: "parameters",
  36741. protocol: "accessing",
  36742. fn: function (){
  36743. var self=this,$self=this;
  36744. return $core.withContext(function($ctx1) {
  36745. var $1,$receiver;
  36746. $1=$self.parameters;
  36747. if(($receiver = $1) == null || $receiver.a$nil){
  36748. $self.parameters=$recv($globals.Array)._new();
  36749. return $self.parameters;
  36750. } else {
  36751. return $1;
  36752. }
  36753. }, function($ctx1) {$ctx1.fill(self,"parameters",{})});
  36754. },
  36755. args: [],
  36756. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  36757. referencedClasses: ["Array"],
  36758. pragmas: [],
  36759. messageSends: ["ifNil:", "new"]
  36760. }),
  36761. $globals.BlockNode);
  36762. $core.addMethod(
  36763. $core.method({
  36764. selector: "parameters:",
  36765. protocol: "accessing",
  36766. fn: function (aCollection){
  36767. var self=this,$self=this;
  36768. $self.parameters=aCollection;
  36769. return self;
  36770. },
  36771. args: ["aCollection"],
  36772. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  36773. referencedClasses: [],
  36774. pragmas: [],
  36775. messageSends: []
  36776. }),
  36777. $globals.BlockNode);
  36778. $core.addMethod(
  36779. $core.method({
  36780. selector: "scope",
  36781. protocol: "accessing",
  36782. fn: function (){
  36783. var self=this,$self=this;
  36784. return $self.scope;
  36785. },
  36786. args: [],
  36787. source: "scope\x0a\x09^ scope",
  36788. referencedClasses: [],
  36789. pragmas: [],
  36790. messageSends: []
  36791. }),
  36792. $globals.BlockNode);
  36793. $core.addMethod(
  36794. $core.method({
  36795. selector: "scope:",
  36796. protocol: "accessing",
  36797. fn: function (aLexicalScope){
  36798. var self=this,$self=this;
  36799. $self.scope=aLexicalScope;
  36800. return self;
  36801. },
  36802. args: ["aLexicalScope"],
  36803. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  36804. referencedClasses: [],
  36805. pragmas: [],
  36806. messageSends: []
  36807. }),
  36808. $globals.BlockNode);
  36809. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  36810. $globals.CascadeNode.comment="I represent an cascade node.";
  36811. $core.addMethod(
  36812. $core.method({
  36813. selector: "acceptDagVisitor:",
  36814. protocol: "visiting",
  36815. fn: function (aVisitor){
  36816. var self=this,$self=this;
  36817. return $core.withContext(function($ctx1) {
  36818. return $recv(aVisitor)._visitCascadeNode_(self);
  36819. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36820. },
  36821. args: ["aVisitor"],
  36822. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  36823. referencedClasses: [],
  36824. pragmas: [],
  36825. messageSends: ["visitCascadeNode:"]
  36826. }),
  36827. $globals.CascadeNode);
  36828. $core.addMethod(
  36829. $core.method({
  36830. selector: "isCascadeNode",
  36831. protocol: "testing",
  36832. fn: function (){
  36833. var self=this,$self=this;
  36834. return true;
  36835. },
  36836. args: [],
  36837. source: "isCascadeNode\x0a\x09^ true",
  36838. referencedClasses: [],
  36839. pragmas: [],
  36840. messageSends: []
  36841. }),
  36842. $globals.CascadeNode);
  36843. $core.addMethod(
  36844. $core.method({
  36845. selector: "receiver",
  36846. protocol: "accessing",
  36847. fn: function (){
  36848. var self=this,$self=this;
  36849. return $self.receiver;
  36850. },
  36851. args: [],
  36852. source: "receiver\x0a\x09^ receiver",
  36853. referencedClasses: [],
  36854. pragmas: [],
  36855. messageSends: []
  36856. }),
  36857. $globals.CascadeNode);
  36858. $core.addMethod(
  36859. $core.method({
  36860. selector: "receiver:",
  36861. protocol: "accessing",
  36862. fn: function (aNode){
  36863. var self=this,$self=this;
  36864. $self.receiver=aNode;
  36865. return self;
  36866. },
  36867. args: ["aNode"],
  36868. source: "receiver: aNode\x0a\x09receiver := aNode",
  36869. referencedClasses: [],
  36870. pragmas: [],
  36871. messageSends: []
  36872. }),
  36873. $globals.CascadeNode);
  36874. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  36875. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "acceptDagVisitor:",
  36879. protocol: "visiting",
  36880. fn: function (aVisitor){
  36881. var self=this,$self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  36884. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36885. },
  36886. args: ["aVisitor"],
  36887. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  36888. referencedClasses: [],
  36889. pragmas: [],
  36890. messageSends: ["visitDynamicArrayNode:"]
  36891. }),
  36892. $globals.DynamicArrayNode);
  36893. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  36894. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  36895. $core.addMethod(
  36896. $core.method({
  36897. selector: "acceptDagVisitor:",
  36898. protocol: "visiting",
  36899. fn: function (aVisitor){
  36900. var self=this,$self=this;
  36901. return $core.withContext(function($ctx1) {
  36902. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  36903. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36904. },
  36905. args: ["aVisitor"],
  36906. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  36907. referencedClasses: [],
  36908. pragmas: [],
  36909. messageSends: ["visitDynamicDictionaryNode:"]
  36910. }),
  36911. $globals.DynamicDictionaryNode);
  36912. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  36913. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  36914. $core.addMethod(
  36915. $core.method({
  36916. selector: "acceptDagVisitor:",
  36917. protocol: "visiting",
  36918. fn: function (aVisitor){
  36919. var self=this,$self=this;
  36920. return $core.withContext(function($ctx1) {
  36921. return $recv(aVisitor)._visitJSStatementNode_(self);
  36922. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36923. },
  36924. args: ["aVisitor"],
  36925. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  36926. referencedClasses: [],
  36927. pragmas: [],
  36928. messageSends: ["visitJSStatementNode:"]
  36929. }),
  36930. $globals.JSStatementNode);
  36931. $core.addMethod(
  36932. $core.method({
  36933. selector: "isJSStatementNode",
  36934. protocol: "testing",
  36935. fn: function (){
  36936. var self=this,$self=this;
  36937. return true;
  36938. },
  36939. args: [],
  36940. source: "isJSStatementNode\x0a\x09^ true",
  36941. referencedClasses: [],
  36942. pragmas: [],
  36943. messageSends: []
  36944. }),
  36945. $globals.JSStatementNode);
  36946. $core.addMethod(
  36947. $core.method({
  36948. selector: "requiresSmalltalkContext",
  36949. protocol: "testing",
  36950. fn: function (){
  36951. var self=this,$self=this;
  36952. return true;
  36953. },
  36954. args: [],
  36955. source: "requiresSmalltalkContext\x0a\x09^ true",
  36956. referencedClasses: [],
  36957. pragmas: [],
  36958. messageSends: []
  36959. }),
  36960. $globals.JSStatementNode);
  36961. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "pragmas", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  36962. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  36963. $core.addMethod(
  36964. $core.method({
  36965. selector: "acceptDagVisitor:",
  36966. protocol: "visiting",
  36967. fn: function (aVisitor){
  36968. var self=this,$self=this;
  36969. return $core.withContext(function($ctx1) {
  36970. return $recv(aVisitor)._visitMethodNode_(self);
  36971. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36972. },
  36973. args: ["aVisitor"],
  36974. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  36975. referencedClasses: [],
  36976. pragmas: [],
  36977. messageSends: ["visitMethodNode:"]
  36978. }),
  36979. $globals.MethodNode);
  36980. $core.addMethod(
  36981. $core.method({
  36982. selector: "arguments",
  36983. protocol: "accessing",
  36984. fn: function (){
  36985. var self=this,$self=this;
  36986. return $core.withContext(function($ctx1) {
  36987. var $1,$receiver;
  36988. $1=$self.arguments;
  36989. if(($receiver = $1) == null || $receiver.a$nil){
  36990. return [];
  36991. } else {
  36992. return $1;
  36993. }
  36994. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  36995. },
  36996. args: [],
  36997. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36998. referencedClasses: [],
  36999. pragmas: [],
  37000. messageSends: ["ifNil:"]
  37001. }),
  37002. $globals.MethodNode);
  37003. $core.addMethod(
  37004. $core.method({
  37005. selector: "arguments:",
  37006. protocol: "accessing",
  37007. fn: function (aCollection){
  37008. var self=this,$self=this;
  37009. $self.arguments=aCollection;
  37010. return self;
  37011. },
  37012. args: ["aCollection"],
  37013. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37014. referencedClasses: [],
  37015. pragmas: [],
  37016. messageSends: []
  37017. }),
  37018. $globals.MethodNode);
  37019. $core.addMethod(
  37020. $core.method({
  37021. selector: "classReferences",
  37022. protocol: "accessing",
  37023. fn: function (){
  37024. var self=this,$self=this;
  37025. return $self.classReferences;
  37026. },
  37027. args: [],
  37028. source: "classReferences\x0a\x09^ classReferences",
  37029. referencedClasses: [],
  37030. pragmas: [],
  37031. messageSends: []
  37032. }),
  37033. $globals.MethodNode);
  37034. $core.addMethod(
  37035. $core.method({
  37036. selector: "classReferences:",
  37037. protocol: "accessing",
  37038. fn: function (aCollection){
  37039. var self=this,$self=this;
  37040. $self.classReferences=aCollection;
  37041. return self;
  37042. },
  37043. args: ["aCollection"],
  37044. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37045. referencedClasses: [],
  37046. pragmas: [],
  37047. messageSends: []
  37048. }),
  37049. $globals.MethodNode);
  37050. $core.addMethod(
  37051. $core.method({
  37052. selector: "messageSends",
  37053. protocol: "accessing",
  37054. fn: function (){
  37055. var self=this,$self=this;
  37056. return $core.withContext(function($ctx1) {
  37057. return $recv($self._sendIndexes())._keys();
  37058. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  37059. },
  37060. args: [],
  37061. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37062. referencedClasses: [],
  37063. pragmas: [],
  37064. messageSends: ["keys", "sendIndexes"]
  37065. }),
  37066. $globals.MethodNode);
  37067. $core.addMethod(
  37068. $core.method({
  37069. selector: "method",
  37070. protocol: "accessing",
  37071. fn: function (){
  37072. var self=this,$self=this;
  37073. return self;
  37074. },
  37075. args: [],
  37076. source: "method\x0a\x09^ self",
  37077. referencedClasses: [],
  37078. pragmas: [],
  37079. messageSends: []
  37080. }),
  37081. $globals.MethodNode);
  37082. $core.addMethod(
  37083. $core.method({
  37084. selector: "pragmas",
  37085. protocol: "accessing",
  37086. fn: function (){
  37087. var self=this,$self=this;
  37088. return $core.withContext(function($ctx1) {
  37089. var $1,$receiver;
  37090. $1=$self.pragmas;
  37091. if(($receiver = $1) == null || $receiver.a$nil){
  37092. return [];
  37093. } else {
  37094. return $1;
  37095. }
  37096. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  37097. },
  37098. args: [],
  37099. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  37100. referencedClasses: [],
  37101. pragmas: [],
  37102. messageSends: ["ifNil:"]
  37103. }),
  37104. $globals.MethodNode);
  37105. $core.addMethod(
  37106. $core.method({
  37107. selector: "pragmas:",
  37108. protocol: "accessing",
  37109. fn: function (aCollection){
  37110. var self=this,$self=this;
  37111. $self.pragmas=aCollection;
  37112. return self;
  37113. },
  37114. args: ["aCollection"],
  37115. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  37116. referencedClasses: [],
  37117. pragmas: [],
  37118. messageSends: []
  37119. }),
  37120. $globals.MethodNode);
  37121. $core.addMethod(
  37122. $core.method({
  37123. selector: "scope",
  37124. protocol: "accessing",
  37125. fn: function (){
  37126. var self=this,$self=this;
  37127. return $self.scope;
  37128. },
  37129. args: [],
  37130. source: "scope\x0a\x09^ scope",
  37131. referencedClasses: [],
  37132. pragmas: [],
  37133. messageSends: []
  37134. }),
  37135. $globals.MethodNode);
  37136. $core.addMethod(
  37137. $core.method({
  37138. selector: "scope:",
  37139. protocol: "accessing",
  37140. fn: function (aMethodScope){
  37141. var self=this,$self=this;
  37142. $self.scope=aMethodScope;
  37143. return self;
  37144. },
  37145. args: ["aMethodScope"],
  37146. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  37147. referencedClasses: [],
  37148. pragmas: [],
  37149. messageSends: []
  37150. }),
  37151. $globals.MethodNode);
  37152. $core.addMethod(
  37153. $core.method({
  37154. selector: "selector",
  37155. protocol: "accessing",
  37156. fn: function (){
  37157. var self=this,$self=this;
  37158. return $self.selector;
  37159. },
  37160. args: [],
  37161. source: "selector\x0a\x09^ selector",
  37162. referencedClasses: [],
  37163. pragmas: [],
  37164. messageSends: []
  37165. }),
  37166. $globals.MethodNode);
  37167. $core.addMethod(
  37168. $core.method({
  37169. selector: "selector:",
  37170. protocol: "accessing",
  37171. fn: function (aString){
  37172. var self=this,$self=this;
  37173. $self.selector=aString;
  37174. return self;
  37175. },
  37176. args: ["aString"],
  37177. source: "selector: aString\x0a\x09selector := aString",
  37178. referencedClasses: [],
  37179. pragmas: [],
  37180. messageSends: []
  37181. }),
  37182. $globals.MethodNode);
  37183. $core.addMethod(
  37184. $core.method({
  37185. selector: "sendIndexes",
  37186. protocol: "accessing",
  37187. fn: function (){
  37188. var self=this,$self=this;
  37189. return $self.sendIndexes;
  37190. },
  37191. args: [],
  37192. source: "sendIndexes\x0a\x09^ sendIndexes",
  37193. referencedClasses: [],
  37194. pragmas: [],
  37195. messageSends: []
  37196. }),
  37197. $globals.MethodNode);
  37198. $core.addMethod(
  37199. $core.method({
  37200. selector: "sendIndexes:",
  37201. protocol: "accessing",
  37202. fn: function (aDictionary){
  37203. var self=this,$self=this;
  37204. $self.sendIndexes=aDictionary;
  37205. return self;
  37206. },
  37207. args: ["aDictionary"],
  37208. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37209. referencedClasses: [],
  37210. pragmas: [],
  37211. messageSends: []
  37212. }),
  37213. $globals.MethodNode);
  37214. $core.addMethod(
  37215. $core.method({
  37216. selector: "sequenceNode",
  37217. protocol: "accessing",
  37218. fn: function (){
  37219. var self=this,$self=this;
  37220. return $core.withContext(function($ctx1) {
  37221. var $1;
  37222. var $early={};
  37223. try {
  37224. $recv($self._dagChildren())._do_((function(each){
  37225. return $core.withContext(function($ctx2) {
  37226. $1=$recv(each)._isSequenceNode();
  37227. if($core.assert($1)){
  37228. throw $early=[each];
  37229. }
  37230. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37231. }));
  37232. return nil;
  37233. }
  37234. catch(e) {if(e===$early)return e[0]; throw e}
  37235. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{})});
  37236. },
  37237. args: [],
  37238. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  37239. referencedClasses: [],
  37240. pragmas: [],
  37241. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  37242. }),
  37243. $globals.MethodNode);
  37244. $core.addMethod(
  37245. $core.method({
  37246. selector: "source",
  37247. protocol: "accessing",
  37248. fn: function (){
  37249. var self=this,$self=this;
  37250. return $self.source;
  37251. },
  37252. args: [],
  37253. source: "source\x0a\x09^ source",
  37254. referencedClasses: [],
  37255. pragmas: [],
  37256. messageSends: []
  37257. }),
  37258. $globals.MethodNode);
  37259. $core.addMethod(
  37260. $core.method({
  37261. selector: "source:",
  37262. protocol: "accessing",
  37263. fn: function (aString){
  37264. var self=this,$self=this;
  37265. $self.source=aString;
  37266. return self;
  37267. },
  37268. args: ["aString"],
  37269. source: "source: aString\x0a\x09source := aString",
  37270. referencedClasses: [],
  37271. pragmas: [],
  37272. messageSends: []
  37273. }),
  37274. $globals.MethodNode);
  37275. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  37276. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  37277. $core.addMethod(
  37278. $core.method({
  37279. selector: "acceptDagVisitor:",
  37280. protocol: "visiting",
  37281. fn: function (aVisitor){
  37282. var self=this,$self=this;
  37283. return $core.withContext(function($ctx1) {
  37284. return $recv(aVisitor)._visitReturnNode_(self);
  37285. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37286. },
  37287. args: ["aVisitor"],
  37288. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  37289. referencedClasses: [],
  37290. pragmas: [],
  37291. messageSends: ["visitReturnNode:"]
  37292. }),
  37293. $globals.ReturnNode);
  37294. $core.addMethod(
  37295. $core.method({
  37296. selector: "isReturnNode",
  37297. protocol: "testing",
  37298. fn: function (){
  37299. var self=this,$self=this;
  37300. return true;
  37301. },
  37302. args: [],
  37303. source: "isReturnNode\x0a\x09^ true",
  37304. referencedClasses: [],
  37305. pragmas: [],
  37306. messageSends: []
  37307. }),
  37308. $globals.ReturnNode);
  37309. $core.addMethod(
  37310. $core.method({
  37311. selector: "nonLocalReturn",
  37312. protocol: "testing",
  37313. fn: function (){
  37314. var self=this,$self=this;
  37315. return $core.withContext(function($ctx1) {
  37316. return $recv($recv($self._scope())._isMethodScope())._not();
  37317. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{})});
  37318. },
  37319. args: [],
  37320. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  37321. referencedClasses: [],
  37322. pragmas: [],
  37323. messageSends: ["not", "isMethodScope", "scope"]
  37324. }),
  37325. $globals.ReturnNode);
  37326. $core.addMethod(
  37327. $core.method({
  37328. selector: "scope",
  37329. protocol: "accessing",
  37330. fn: function (){
  37331. var self=this,$self=this;
  37332. return $self.scope;
  37333. },
  37334. args: [],
  37335. source: "scope\x0a\x09^ scope",
  37336. referencedClasses: [],
  37337. pragmas: [],
  37338. messageSends: []
  37339. }),
  37340. $globals.ReturnNode);
  37341. $core.addMethod(
  37342. $core.method({
  37343. selector: "scope:",
  37344. protocol: "accessing",
  37345. fn: function (aLexicalScope){
  37346. var self=this,$self=this;
  37347. $self.scope=aLexicalScope;
  37348. return self;
  37349. },
  37350. args: ["aLexicalScope"],
  37351. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  37352. referencedClasses: [],
  37353. pragmas: [],
  37354. messageSends: []
  37355. }),
  37356. $globals.ReturnNode);
  37357. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  37358. $globals.SendNode.comment="I represent an message send node.";
  37359. $core.addMethod(
  37360. $core.method({
  37361. selector: "acceptDagVisitor:",
  37362. protocol: "visiting",
  37363. fn: function (aVisitor){
  37364. var self=this,$self=this;
  37365. return $core.withContext(function($ctx1) {
  37366. return $recv(aVisitor)._visitSendNode_(self);
  37367. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37368. },
  37369. args: ["aVisitor"],
  37370. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  37371. referencedClasses: [],
  37372. pragmas: [],
  37373. messageSends: ["visitSendNode:"]
  37374. }),
  37375. $globals.SendNode);
  37376. $core.addMethod(
  37377. $core.method({
  37378. selector: "arguments",
  37379. protocol: "accessing",
  37380. fn: function (){
  37381. var self=this,$self=this;
  37382. return $core.withContext(function($ctx1) {
  37383. var $1,$receiver;
  37384. $1=$self.arguments;
  37385. if(($receiver = $1) == null || $receiver.a$nil){
  37386. $self.arguments=[];
  37387. return $self.arguments;
  37388. } else {
  37389. return $1;
  37390. }
  37391. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  37392. },
  37393. args: [],
  37394. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  37395. referencedClasses: [],
  37396. pragmas: [],
  37397. messageSends: ["ifNil:"]
  37398. }),
  37399. $globals.SendNode);
  37400. $core.addMethod(
  37401. $core.method({
  37402. selector: "arguments:",
  37403. protocol: "accessing",
  37404. fn: function (aCollection){
  37405. var self=this,$self=this;
  37406. $self.arguments=aCollection;
  37407. return self;
  37408. },
  37409. args: ["aCollection"],
  37410. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37411. referencedClasses: [],
  37412. pragmas: [],
  37413. messageSends: []
  37414. }),
  37415. $globals.SendNode);
  37416. $core.addMethod(
  37417. $core.method({
  37418. selector: "dagChildren",
  37419. protocol: "accessing",
  37420. fn: function (){
  37421. var self=this,$self=this;
  37422. return $core.withContext(function($ctx1) {
  37423. var $1,$2,$3,$receiver;
  37424. $1=$self._receiver();
  37425. $ctx1.sendIdx["receiver"]=1;
  37426. if(($receiver = $1) == null || $receiver.a$nil){
  37427. $2=$self._arguments();
  37428. $ctx1.sendIdx["arguments"]=1;
  37429. return $recv($2)._copy();
  37430. } else {
  37431. $1;
  37432. }
  37433. $3=$recv($globals.Array)._with_($self._receiver());
  37434. $recv($3)._addAll_($self._arguments());
  37435. return $recv($3)._yourself();
  37436. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  37437. },
  37438. args: [],
  37439. 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",
  37440. referencedClasses: ["Array"],
  37441. pragmas: [],
  37442. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  37443. }),
  37444. $globals.SendNode);
  37445. $core.addMethod(
  37446. $core.method({
  37447. selector: "index",
  37448. protocol: "accessing",
  37449. fn: function (){
  37450. var self=this,$self=this;
  37451. return $self.index;
  37452. },
  37453. args: [],
  37454. source: "index\x0a\x09^ index",
  37455. referencedClasses: [],
  37456. pragmas: [],
  37457. messageSends: []
  37458. }),
  37459. $globals.SendNode);
  37460. $core.addMethod(
  37461. $core.method({
  37462. selector: "index:",
  37463. protocol: "accessing",
  37464. fn: function (anInteger){
  37465. var self=this,$self=this;
  37466. $self.index=anInteger;
  37467. return self;
  37468. },
  37469. args: ["anInteger"],
  37470. source: "index: anInteger\x0a\x09index := anInteger",
  37471. referencedClasses: [],
  37472. pragmas: [],
  37473. messageSends: []
  37474. }),
  37475. $globals.SendNode);
  37476. $core.addMethod(
  37477. $core.method({
  37478. selector: "isNavigationNode",
  37479. protocol: "testing",
  37480. fn: function (){
  37481. var self=this,$self=this;
  37482. return true;
  37483. },
  37484. args: [],
  37485. source: "isNavigationNode\x0a\x09^ true",
  37486. referencedClasses: [],
  37487. pragmas: [],
  37488. messageSends: []
  37489. }),
  37490. $globals.SendNode);
  37491. $core.addMethod(
  37492. $core.method({
  37493. selector: "isSendNode",
  37494. protocol: "testing",
  37495. fn: function (){
  37496. var self=this,$self=this;
  37497. return true;
  37498. },
  37499. args: [],
  37500. source: "isSendNode\x0a\x09^ true",
  37501. referencedClasses: [],
  37502. pragmas: [],
  37503. messageSends: []
  37504. }),
  37505. $globals.SendNode);
  37506. $core.addMethod(
  37507. $core.method({
  37508. selector: "navigationLink",
  37509. protocol: "accessing",
  37510. fn: function (){
  37511. var self=this,$self=this;
  37512. return $core.withContext(function($ctx1) {
  37513. return $self._selector();
  37514. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  37515. },
  37516. args: [],
  37517. source: "navigationLink\x0a\x09^ self selector",
  37518. referencedClasses: [],
  37519. pragmas: [],
  37520. messageSends: ["selector"]
  37521. }),
  37522. $globals.SendNode);
  37523. $core.addMethod(
  37524. $core.method({
  37525. selector: "receiver",
  37526. protocol: "accessing",
  37527. fn: function (){
  37528. var self=this,$self=this;
  37529. return $self.receiver;
  37530. },
  37531. args: [],
  37532. source: "receiver\x0a\x09^ receiver",
  37533. referencedClasses: [],
  37534. pragmas: [],
  37535. messageSends: []
  37536. }),
  37537. $globals.SendNode);
  37538. $core.addMethod(
  37539. $core.method({
  37540. selector: "receiver:",
  37541. protocol: "accessing",
  37542. fn: function (aNode){
  37543. var self=this,$self=this;
  37544. $self.receiver=aNode;
  37545. return self;
  37546. },
  37547. args: ["aNode"],
  37548. source: "receiver: aNode\x0a\x09receiver := aNode",
  37549. referencedClasses: [],
  37550. pragmas: [],
  37551. messageSends: []
  37552. }),
  37553. $globals.SendNode);
  37554. $core.addMethod(
  37555. $core.method({
  37556. selector: "requiresSmalltalkContext",
  37557. protocol: "testing",
  37558. fn: function (){
  37559. var self=this,$self=this;
  37560. return true;
  37561. },
  37562. args: [],
  37563. source: "requiresSmalltalkContext\x0a\x09^ true",
  37564. referencedClasses: [],
  37565. pragmas: [],
  37566. messageSends: []
  37567. }),
  37568. $globals.SendNode);
  37569. $core.addMethod(
  37570. $core.method({
  37571. selector: "selector",
  37572. protocol: "accessing",
  37573. fn: function (){
  37574. var self=this,$self=this;
  37575. return $self.selector;
  37576. },
  37577. args: [],
  37578. source: "selector\x0a\x09^ selector",
  37579. referencedClasses: [],
  37580. pragmas: [],
  37581. messageSends: []
  37582. }),
  37583. $globals.SendNode);
  37584. $core.addMethod(
  37585. $core.method({
  37586. selector: "selector:",
  37587. protocol: "accessing",
  37588. fn: function (aString){
  37589. var self=this,$self=this;
  37590. $self.selector=aString;
  37591. return self;
  37592. },
  37593. args: ["aString"],
  37594. source: "selector: aString\x0a\x09selector := aString",
  37595. referencedClasses: [],
  37596. pragmas: [],
  37597. messageSends: []
  37598. }),
  37599. $globals.SendNode);
  37600. $core.addMethod(
  37601. $core.method({
  37602. selector: "shouldBeInlined",
  37603. protocol: "accessing",
  37604. fn: function (){
  37605. var self=this,$self=this;
  37606. return $core.withContext(function($ctx1) {
  37607. var $1,$receiver;
  37608. $1=$self.shouldBeInlined;
  37609. if(($receiver = $1) == null || $receiver.a$nil){
  37610. return false;
  37611. } else {
  37612. return $1;
  37613. }
  37614. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{})});
  37615. },
  37616. args: [],
  37617. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  37618. referencedClasses: [],
  37619. pragmas: [],
  37620. messageSends: ["ifNil:"]
  37621. }),
  37622. $globals.SendNode);
  37623. $core.addMethod(
  37624. $core.method({
  37625. selector: "shouldBeInlined:",
  37626. protocol: "accessing",
  37627. fn: function (aBoolean){
  37628. var self=this,$self=this;
  37629. $self.shouldBeInlined=aBoolean;
  37630. return self;
  37631. },
  37632. args: ["aBoolean"],
  37633. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  37634. referencedClasses: [],
  37635. pragmas: [],
  37636. messageSends: []
  37637. }),
  37638. $globals.SendNode);
  37639. $core.addMethod(
  37640. $core.method({
  37641. selector: "superSend",
  37642. protocol: "accessing",
  37643. fn: function (){
  37644. var self=this,$self=this;
  37645. return $core.withContext(function($ctx1) {
  37646. var $2,$1;
  37647. $2=$self._receiver();
  37648. $ctx1.sendIdx["receiver"]=1;
  37649. $1=$recv($2)._notNil();
  37650. return $recv($1)._and_((function(){
  37651. return $core.withContext(function($ctx2) {
  37652. return $recv($self._receiver())._isSuper();
  37653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37654. }));
  37655. }, function($ctx1) {$ctx1.fill(self,"superSend",{})});
  37656. },
  37657. args: [],
  37658. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuper ]",
  37659. referencedClasses: [],
  37660. pragmas: [],
  37661. messageSends: ["and:", "notNil", "receiver", "isSuper"]
  37662. }),
  37663. $globals.SendNode);
  37664. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  37665. $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).";
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "acceptDagVisitor:",
  37669. protocol: "visiting",
  37670. fn: function (aVisitor){
  37671. var self=this,$self=this;
  37672. return $core.withContext(function($ctx1) {
  37673. return $recv(aVisitor)._visitSequenceNode_(self);
  37674. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37675. },
  37676. args: ["aVisitor"],
  37677. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  37678. referencedClasses: [],
  37679. pragmas: [],
  37680. messageSends: ["visitSequenceNode:"]
  37681. }),
  37682. $globals.SequenceNode);
  37683. $core.addMethod(
  37684. $core.method({
  37685. selector: "isSequenceNode",
  37686. protocol: "testing",
  37687. fn: function (){
  37688. var self=this,$self=this;
  37689. return true;
  37690. },
  37691. args: [],
  37692. source: "isSequenceNode\x0a\x09^ true",
  37693. referencedClasses: [],
  37694. pragmas: [],
  37695. messageSends: []
  37696. }),
  37697. $globals.SequenceNode);
  37698. $core.addMethod(
  37699. $core.method({
  37700. selector: "scope",
  37701. protocol: "accessing",
  37702. fn: function (){
  37703. var self=this,$self=this;
  37704. return $self.scope;
  37705. },
  37706. args: [],
  37707. source: "scope\x0a\x09^ scope",
  37708. referencedClasses: [],
  37709. pragmas: [],
  37710. messageSends: []
  37711. }),
  37712. $globals.SequenceNode);
  37713. $core.addMethod(
  37714. $core.method({
  37715. selector: "scope:",
  37716. protocol: "accessing",
  37717. fn: function (aLexicalScope){
  37718. var self=this,$self=this;
  37719. $self.scope=aLexicalScope;
  37720. return self;
  37721. },
  37722. args: ["aLexicalScope"],
  37723. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  37724. referencedClasses: [],
  37725. pragmas: [],
  37726. messageSends: []
  37727. }),
  37728. $globals.SequenceNode);
  37729. $core.addMethod(
  37730. $core.method({
  37731. selector: "temps",
  37732. protocol: "accessing",
  37733. fn: function (){
  37734. var self=this,$self=this;
  37735. return $core.withContext(function($ctx1) {
  37736. var $1,$receiver;
  37737. $1=$self.temps;
  37738. if(($receiver = $1) == null || $receiver.a$nil){
  37739. return [];
  37740. } else {
  37741. return $1;
  37742. }
  37743. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  37744. },
  37745. args: [],
  37746. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  37747. referencedClasses: [],
  37748. pragmas: [],
  37749. messageSends: ["ifNil:"]
  37750. }),
  37751. $globals.SequenceNode);
  37752. $core.addMethod(
  37753. $core.method({
  37754. selector: "temps:",
  37755. protocol: "accessing",
  37756. fn: function (aCollection){
  37757. var self=this,$self=this;
  37758. $self.temps=aCollection;
  37759. return self;
  37760. },
  37761. args: ["aCollection"],
  37762. source: "temps: aCollection\x0a\x09temps := aCollection",
  37763. referencedClasses: [],
  37764. pragmas: [],
  37765. messageSends: []
  37766. }),
  37767. $globals.SequenceNode);
  37768. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  37769. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  37770. $core.addMethod(
  37771. $core.method({
  37772. selector: "acceptDagVisitor:",
  37773. protocol: "visiting",
  37774. fn: function (aVisitor){
  37775. var self=this,$self=this;
  37776. return $core.withContext(function($ctx1) {
  37777. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  37778. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37779. },
  37780. args: ["aVisitor"],
  37781. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  37782. referencedClasses: [],
  37783. pragmas: [],
  37784. messageSends: ["visitBlockSequenceNode:"]
  37785. }),
  37786. $globals.BlockSequenceNode);
  37787. $core.addMethod(
  37788. $core.method({
  37789. selector: "isBlockSequenceNode",
  37790. protocol: "testing",
  37791. fn: function (){
  37792. var self=this,$self=this;
  37793. return true;
  37794. },
  37795. args: [],
  37796. source: "isBlockSequenceNode\x0a\x09^ true",
  37797. referencedClasses: [],
  37798. pragmas: [],
  37799. messageSends: []
  37800. }),
  37801. $globals.BlockSequenceNode);
  37802. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  37803. $globals.ValueNode.comment="I represent a value node.";
  37804. $core.addMethod(
  37805. $core.method({
  37806. selector: "acceptDagVisitor:",
  37807. protocol: "visiting",
  37808. fn: function (aVisitor){
  37809. var self=this,$self=this;
  37810. return $core.withContext(function($ctx1) {
  37811. return $recv(aVisitor)._visitValueNode_(self);
  37812. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37813. },
  37814. args: ["aVisitor"],
  37815. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  37816. referencedClasses: [],
  37817. pragmas: [],
  37818. messageSends: ["visitValueNode:"]
  37819. }),
  37820. $globals.ValueNode);
  37821. $core.addMethod(
  37822. $core.method({
  37823. selector: "isImmutable",
  37824. protocol: "testing",
  37825. fn: function (){
  37826. var self=this,$self=this;
  37827. return $core.withContext(function($ctx1) {
  37828. return $recv($self._value())._isImmutable();
  37829. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  37830. },
  37831. args: [],
  37832. source: "isImmutable\x0a\x09^ self value isImmutable",
  37833. referencedClasses: [],
  37834. pragmas: [],
  37835. messageSends: ["isImmutable", "value"]
  37836. }),
  37837. $globals.ValueNode);
  37838. $core.addMethod(
  37839. $core.method({
  37840. selector: "isValueNode",
  37841. protocol: "testing",
  37842. fn: function (){
  37843. var self=this,$self=this;
  37844. return true;
  37845. },
  37846. args: [],
  37847. source: "isValueNode\x0a\x09^ true",
  37848. referencedClasses: [],
  37849. pragmas: [],
  37850. messageSends: []
  37851. }),
  37852. $globals.ValueNode);
  37853. $core.addMethod(
  37854. $core.method({
  37855. selector: "value",
  37856. protocol: "accessing",
  37857. fn: function (){
  37858. var self=this,$self=this;
  37859. return $self.value;
  37860. },
  37861. args: [],
  37862. source: "value\x0a\x09^ value",
  37863. referencedClasses: [],
  37864. pragmas: [],
  37865. messageSends: []
  37866. }),
  37867. $globals.ValueNode);
  37868. $core.addMethod(
  37869. $core.method({
  37870. selector: "value:",
  37871. protocol: "accessing",
  37872. fn: function (anObject){
  37873. var self=this,$self=this;
  37874. $self.value=anObject;
  37875. return self;
  37876. },
  37877. args: ["anObject"],
  37878. source: "value: anObject\x0a\x09value := anObject",
  37879. referencedClasses: [],
  37880. pragmas: [],
  37881. messageSends: []
  37882. }),
  37883. $globals.ValueNode);
  37884. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  37885. $globals.VariableNode.comment="I represent an variable node.";
  37886. $core.addMethod(
  37887. $core.method({
  37888. selector: "acceptDagVisitor:",
  37889. protocol: "visiting",
  37890. fn: function (aVisitor){
  37891. var self=this,$self=this;
  37892. return $core.withContext(function($ctx1) {
  37893. return $recv(aVisitor)._visitVariableNode_(self);
  37894. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  37895. },
  37896. args: ["aVisitor"],
  37897. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  37898. referencedClasses: [],
  37899. pragmas: [],
  37900. messageSends: ["visitVariableNode:"]
  37901. }),
  37902. $globals.VariableNode);
  37903. $core.addMethod(
  37904. $core.method({
  37905. selector: "alias",
  37906. protocol: "accessing",
  37907. fn: function (){
  37908. var self=this,$self=this;
  37909. return $core.withContext(function($ctx1) {
  37910. return $recv($self._binding())._alias();
  37911. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  37912. },
  37913. args: [],
  37914. source: "alias\x0a\x09^ self binding alias",
  37915. referencedClasses: [],
  37916. pragmas: [],
  37917. messageSends: ["alias", "binding"]
  37918. }),
  37919. $globals.VariableNode);
  37920. $core.addMethod(
  37921. $core.method({
  37922. selector: "assigned",
  37923. protocol: "accessing",
  37924. fn: function (){
  37925. var self=this,$self=this;
  37926. return $core.withContext(function($ctx1) {
  37927. var $1,$receiver;
  37928. $1=$self.assigned;
  37929. if(($receiver = $1) == null || $receiver.a$nil){
  37930. return false;
  37931. } else {
  37932. return $1;
  37933. }
  37934. }, function($ctx1) {$ctx1.fill(self,"assigned",{})});
  37935. },
  37936. args: [],
  37937. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  37938. referencedClasses: [],
  37939. pragmas: [],
  37940. messageSends: ["ifNil:"]
  37941. }),
  37942. $globals.VariableNode);
  37943. $core.addMethod(
  37944. $core.method({
  37945. selector: "assigned:",
  37946. protocol: "accessing",
  37947. fn: function (aBoolean){
  37948. var self=this,$self=this;
  37949. $self.assigned=aBoolean;
  37950. return self;
  37951. },
  37952. args: ["aBoolean"],
  37953. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  37954. referencedClasses: [],
  37955. pragmas: [],
  37956. messageSends: []
  37957. }),
  37958. $globals.VariableNode);
  37959. $core.addMethod(
  37960. $core.method({
  37961. selector: "beAssigned",
  37962. protocol: "accessing",
  37963. fn: function (){
  37964. var self=this,$self=this;
  37965. return $core.withContext(function($ctx1) {
  37966. $recv($self._binding())._validateAssignment();
  37967. $self.assigned=true;
  37968. return self;
  37969. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{})});
  37970. },
  37971. args: [],
  37972. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  37973. referencedClasses: [],
  37974. pragmas: [],
  37975. messageSends: ["validateAssignment", "binding"]
  37976. }),
  37977. $globals.VariableNode);
  37978. $core.addMethod(
  37979. $core.method({
  37980. selector: "binding",
  37981. protocol: "accessing",
  37982. fn: function (){
  37983. var self=this,$self=this;
  37984. return $self.binding;
  37985. },
  37986. args: [],
  37987. source: "binding\x0a\x09^ binding",
  37988. referencedClasses: [],
  37989. pragmas: [],
  37990. messageSends: []
  37991. }),
  37992. $globals.VariableNode);
  37993. $core.addMethod(
  37994. $core.method({
  37995. selector: "binding:",
  37996. protocol: "accessing",
  37997. fn: function (aScopeVar){
  37998. var self=this,$self=this;
  37999. $self.binding=aScopeVar;
  38000. return self;
  38001. },
  38002. args: ["aScopeVar"],
  38003. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  38004. referencedClasses: [],
  38005. pragmas: [],
  38006. messageSends: []
  38007. }),
  38008. $globals.VariableNode);
  38009. $core.addMethod(
  38010. $core.method({
  38011. selector: "isArgument",
  38012. protocol: "testing",
  38013. fn: function (){
  38014. var self=this,$self=this;
  38015. return $core.withContext(function($ctx1) {
  38016. return $recv($self._binding())._isArgVar();
  38017. }, function($ctx1) {$ctx1.fill(self,"isArgument",{})});
  38018. },
  38019. args: [],
  38020. source: "isArgument\x0a\x09^ self binding isArgVar",
  38021. referencedClasses: [],
  38022. pragmas: [],
  38023. messageSends: ["isArgVar", "binding"]
  38024. }),
  38025. $globals.VariableNode);
  38026. $core.addMethod(
  38027. $core.method({
  38028. selector: "isImmutable",
  38029. protocol: "testing",
  38030. fn: function (){
  38031. var self=this,$self=this;
  38032. return $core.withContext(function($ctx1) {
  38033. return $recv($self._binding())._isImmutable();
  38034. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  38035. },
  38036. args: [],
  38037. source: "isImmutable\x0a\x09^ self binding isImmutable",
  38038. referencedClasses: [],
  38039. pragmas: [],
  38040. messageSends: ["isImmutable", "binding"]
  38041. }),
  38042. $globals.VariableNode);
  38043. $core.addMethod(
  38044. $core.method({
  38045. selector: "isNavigationNode",
  38046. protocol: "testing",
  38047. fn: function (){
  38048. var self=this,$self=this;
  38049. return true;
  38050. },
  38051. args: [],
  38052. source: "isNavigationNode\x0a\x09^ true",
  38053. referencedClasses: [],
  38054. pragmas: [],
  38055. messageSends: []
  38056. }),
  38057. $globals.VariableNode);
  38058. $core.addMethod(
  38059. $core.method({
  38060. selector: "isSuper",
  38061. protocol: "testing",
  38062. fn: function (){
  38063. var self=this,$self=this;
  38064. return $core.withContext(function($ctx1) {
  38065. return $recv($self._binding())._isSuper();
  38066. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  38067. },
  38068. args: [],
  38069. source: "isSuper\x0a\x09^ self binding isSuper",
  38070. referencedClasses: [],
  38071. pragmas: [],
  38072. messageSends: ["isSuper", "binding"]
  38073. }),
  38074. $globals.VariableNode);
  38075. $core.addMethod(
  38076. $core.method({
  38077. selector: "isVariableNode",
  38078. protocol: "testing",
  38079. fn: function (){
  38080. var self=this,$self=this;
  38081. return true;
  38082. },
  38083. args: [],
  38084. source: "isVariableNode\x0a\x09^ true",
  38085. referencedClasses: [],
  38086. pragmas: [],
  38087. messageSends: []
  38088. }),
  38089. $globals.VariableNode);
  38090. $core.addMethod(
  38091. $core.method({
  38092. selector: "navigationLink",
  38093. protocol: "accessing",
  38094. fn: function (){
  38095. var self=this,$self=this;
  38096. return $core.withContext(function($ctx1) {
  38097. return $self._value();
  38098. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  38099. },
  38100. args: [],
  38101. source: "navigationLink\x0a\x09^ self value",
  38102. referencedClasses: [],
  38103. pragmas: [],
  38104. messageSends: ["value"]
  38105. }),
  38106. $globals.VariableNode);
  38107. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  38108. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  38109. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  38110. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  38111. $core.addMethod(
  38112. $core.method({
  38113. selector: "visit:",
  38114. protocol: "visiting",
  38115. fn: function (aNode){
  38116. var self=this,$self=this;
  38117. return $core.withContext(function($ctx1) {
  38118. var $1;
  38119. $recv($self._path())._ifNotEmpty_((function(p){
  38120. return $core.withContext(function($ctx2) {
  38121. return $recv(aNode)._parent_($recv(p)._last());
  38122. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  38123. }));
  38124. $1=(
  38125. $ctx1.supercall = true,
  38126. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  38127. $ctx1.supercall = false;
  38128. return $1;
  38129. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  38130. },
  38131. args: ["aNode"],
  38132. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  38133. referencedClasses: [],
  38134. pragmas: [],
  38135. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  38136. }),
  38137. $globals.ParentFakingPathDagVisitor);
  38138. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  38139. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  38140. $core.addMethod(
  38141. $core.method({
  38142. selector: "visitAssignmentNode:",
  38143. protocol: "visiting",
  38144. fn: function (aNode){
  38145. var self=this,$self=this;
  38146. return $core.withContext(function($ctx1) {
  38147. return $self._visitDagNode_(aNode);
  38148. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
  38149. },
  38150. args: ["aNode"],
  38151. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38152. referencedClasses: [],
  38153. pragmas: [],
  38154. messageSends: ["visitDagNode:"]
  38155. }),
  38156. $globals.NodeVisitor);
  38157. $core.addMethod(
  38158. $core.method({
  38159. selector: "visitBlockNode:",
  38160. protocol: "visiting",
  38161. fn: function (aNode){
  38162. var self=this,$self=this;
  38163. return $core.withContext(function($ctx1) {
  38164. return $self._visitDagNode_(aNode);
  38165. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  38166. },
  38167. args: ["aNode"],
  38168. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38169. referencedClasses: [],
  38170. pragmas: [],
  38171. messageSends: ["visitDagNode:"]
  38172. }),
  38173. $globals.NodeVisitor);
  38174. $core.addMethod(
  38175. $core.method({
  38176. selector: "visitBlockSequenceNode:",
  38177. protocol: "visiting",
  38178. fn: function (aNode){
  38179. var self=this,$self=this;
  38180. return $core.withContext(function($ctx1) {
  38181. return $self._visitSequenceNode_(aNode);
  38182. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  38183. },
  38184. args: ["aNode"],
  38185. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  38186. referencedClasses: [],
  38187. pragmas: [],
  38188. messageSends: ["visitSequenceNode:"]
  38189. }),
  38190. $globals.NodeVisitor);
  38191. $core.addMethod(
  38192. $core.method({
  38193. selector: "visitCascadeNode:",
  38194. protocol: "visiting",
  38195. fn: function (aNode){
  38196. var self=this,$self=this;
  38197. return $core.withContext(function($ctx1) {
  38198. return $self._visitDagNode_(aNode);
  38199. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  38200. },
  38201. args: ["aNode"],
  38202. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38203. referencedClasses: [],
  38204. pragmas: [],
  38205. messageSends: ["visitDagNode:"]
  38206. }),
  38207. $globals.NodeVisitor);
  38208. $core.addMethod(
  38209. $core.method({
  38210. selector: "visitDagNode:",
  38211. protocol: "visiting",
  38212. fn: function (aNode){
  38213. var self=this,$self=this;
  38214. return $core.withContext(function($ctx1) {
  38215. return $self._visitDagNodeVariantSimple_(aNode);
  38216. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  38217. },
  38218. args: ["aNode"],
  38219. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  38220. referencedClasses: [],
  38221. pragmas: [],
  38222. messageSends: ["visitDagNodeVariantSimple:"]
  38223. }),
  38224. $globals.NodeVisitor);
  38225. $core.addMethod(
  38226. $core.method({
  38227. selector: "visitDynamicArrayNode:",
  38228. protocol: "visiting",
  38229. fn: function (aNode){
  38230. var self=this,$self=this;
  38231. return $core.withContext(function($ctx1) {
  38232. return $self._visitDagNode_(aNode);
  38233. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode})});
  38234. },
  38235. args: ["aNode"],
  38236. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38237. referencedClasses: [],
  38238. pragmas: [],
  38239. messageSends: ["visitDagNode:"]
  38240. }),
  38241. $globals.NodeVisitor);
  38242. $core.addMethod(
  38243. $core.method({
  38244. selector: "visitDynamicDictionaryNode:",
  38245. protocol: "visiting",
  38246. fn: function (aNode){
  38247. var self=this,$self=this;
  38248. return $core.withContext(function($ctx1) {
  38249. return $self._visitDagNode_(aNode);
  38250. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode})});
  38251. },
  38252. args: ["aNode"],
  38253. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38254. referencedClasses: [],
  38255. pragmas: [],
  38256. messageSends: ["visitDagNode:"]
  38257. }),
  38258. $globals.NodeVisitor);
  38259. $core.addMethod(
  38260. $core.method({
  38261. selector: "visitJSStatementNode:",
  38262. protocol: "visiting",
  38263. fn: function (aNode){
  38264. var self=this,$self=this;
  38265. return $core.withContext(function($ctx1) {
  38266. return $self._visitDagNode_(aNode);
  38267. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  38268. },
  38269. args: ["aNode"],
  38270. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38271. referencedClasses: [],
  38272. pragmas: [],
  38273. messageSends: ["visitDagNode:"]
  38274. }),
  38275. $globals.NodeVisitor);
  38276. $core.addMethod(
  38277. $core.method({
  38278. selector: "visitMethodNode:",
  38279. protocol: "visiting",
  38280. fn: function (aNode){
  38281. var self=this,$self=this;
  38282. return $core.withContext(function($ctx1) {
  38283. return $self._visitDagNode_(aNode);
  38284. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  38285. },
  38286. args: ["aNode"],
  38287. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38288. referencedClasses: [],
  38289. pragmas: [],
  38290. messageSends: ["visitDagNode:"]
  38291. }),
  38292. $globals.NodeVisitor);
  38293. $core.addMethod(
  38294. $core.method({
  38295. selector: "visitReturnNode:",
  38296. protocol: "visiting",
  38297. fn: function (aNode){
  38298. var self=this,$self=this;
  38299. return $core.withContext(function($ctx1) {
  38300. return $self._visitDagNode_(aNode);
  38301. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  38302. },
  38303. args: ["aNode"],
  38304. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38305. referencedClasses: [],
  38306. pragmas: [],
  38307. messageSends: ["visitDagNode:"]
  38308. }),
  38309. $globals.NodeVisitor);
  38310. $core.addMethod(
  38311. $core.method({
  38312. selector: "visitSendNode:",
  38313. protocol: "visiting",
  38314. fn: function (aNode){
  38315. var self=this,$self=this;
  38316. return $core.withContext(function($ctx1) {
  38317. return $self._visitDagNode_(aNode);
  38318. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  38319. },
  38320. args: ["aNode"],
  38321. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38322. referencedClasses: [],
  38323. pragmas: [],
  38324. messageSends: ["visitDagNode:"]
  38325. }),
  38326. $globals.NodeVisitor);
  38327. $core.addMethod(
  38328. $core.method({
  38329. selector: "visitSequenceNode:",
  38330. protocol: "visiting",
  38331. fn: function (aNode){
  38332. var self=this,$self=this;
  38333. return $core.withContext(function($ctx1) {
  38334. return $self._visitDagNode_(aNode);
  38335. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  38336. },
  38337. args: ["aNode"],
  38338. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38339. referencedClasses: [],
  38340. pragmas: [],
  38341. messageSends: ["visitDagNode:"]
  38342. }),
  38343. $globals.NodeVisitor);
  38344. $core.addMethod(
  38345. $core.method({
  38346. selector: "visitValueNode:",
  38347. protocol: "visiting",
  38348. fn: function (aNode){
  38349. var self=this,$self=this;
  38350. return $core.withContext(function($ctx1) {
  38351. return $self._visitDagNode_(aNode);
  38352. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  38353. },
  38354. args: ["aNode"],
  38355. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38356. referencedClasses: [],
  38357. pragmas: [],
  38358. messageSends: ["visitDagNode:"]
  38359. }),
  38360. $globals.NodeVisitor);
  38361. $core.addMethod(
  38362. $core.method({
  38363. selector: "visitVariableNode:",
  38364. protocol: "visiting",
  38365. fn: function (aNode){
  38366. var self=this,$self=this;
  38367. return $core.withContext(function($ctx1) {
  38368. return $self._visitDagNode_(aNode);
  38369. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  38370. },
  38371. args: ["aNode"],
  38372. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  38373. referencedClasses: [],
  38374. pragmas: [],
  38375. messageSends: ["visitDagNode:"]
  38376. }),
  38377. $globals.NodeVisitor);
  38378. $core.addClass("AstPragmator", $globals.NodeVisitor, ["methodNode"], "Compiler-AST");
  38379. $globals.AstPragmator.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.";
  38380. $core.addMethod(
  38381. $core.method({
  38382. selector: "methodNode",
  38383. protocol: "accessing",
  38384. fn: function (){
  38385. var self=this,$self=this;
  38386. return $self.methodNode;
  38387. },
  38388. args: [],
  38389. source: "methodNode\x0a\x09^ methodNode",
  38390. referencedClasses: [],
  38391. pragmas: [],
  38392. messageSends: []
  38393. }),
  38394. $globals.AstPragmator);
  38395. $core.addMethod(
  38396. $core.method({
  38397. selector: "methodNode:",
  38398. protocol: "accessing",
  38399. fn: function (anObject){
  38400. var self=this,$self=this;
  38401. $self.methodNode=anObject;
  38402. return self;
  38403. },
  38404. args: ["anObject"],
  38405. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  38406. referencedClasses: [],
  38407. pragmas: [],
  38408. messageSends: []
  38409. }),
  38410. $globals.AstPragmator);
  38411. $core.addMethod(
  38412. $core.method({
  38413. selector: "visitMethodNode:",
  38414. protocol: "visiting",
  38415. fn: function (aNode){
  38416. var self=this,$self=this;
  38417. return $core.withContext(function($ctx1) {
  38418. var $1;
  38419. $self._methodNode_(aNode);
  38420. $self._processPragmas_($recv(aNode)._pragmas());
  38421. $1=(
  38422. $ctx1.supercall = true,
  38423. ($globals.AstPragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38424. $ctx1.supercall = false;
  38425. return $1;
  38426. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  38427. },
  38428. args: ["aNode"],
  38429. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09self processPragmas: aNode pragmas.\x0a\x09^ super visitMethodNode: aNode",
  38430. referencedClasses: [],
  38431. pragmas: [],
  38432. messageSends: ["methodNode:", "processPragmas:", "pragmas", "visitMethodNode:"]
  38433. }),
  38434. $globals.AstPragmator);
  38435. $core.addClass("AstEarlyPragmator", $globals.AstPragmator, [], "Compiler-AST");
  38436. $core.addMethod(
  38437. $core.method({
  38438. selector: "inlineJS:",
  38439. protocol: "pragmas",
  38440. fn: function (aString){
  38441. var self=this,$self=this;
  38442. return $core.withContext(function($ctx1) {
  38443. var $3,$2,$1,$4,$6,$5;
  38444. $3=$self._methodNode();
  38445. $ctx1.sendIdx["methodNode"]=1;
  38446. $2=$recv($3)._sequenceNode();
  38447. $ctx1.sendIdx["sequenceNode"]=1;
  38448. $1=$recv($2)._dagChildren();
  38449. $recv($1)._ifNotEmpty_((function(){
  38450. return $core.withContext(function($ctx2) {
  38451. return $recv($globals.CompilerError)._signal_("There must be no other code or code generator pragma than a lone inlineJS:");
  38452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38453. }));
  38454. $4=$recv($self._methodNode())._sequenceNode();
  38455. $6=$recv($globals.JSStatementNode)._new();
  38456. $recv($6)._source_(aString);
  38457. $5=$recv($6)._yourself();
  38458. $recv($4)._addDagChild_($5);
  38459. return self;
  38460. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString})});
  38461. },
  38462. args: ["aString"],
  38463. source: "inlineJS: aString\x0a\x09self methodNode sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'There must be no other code or code generator pragma than a lone inlineJS:' ].\x0a\x09self methodNode sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38464. referencedClasses: ["CompilerError", "JSStatementNode"],
  38465. pragmas: [],
  38466. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "methodNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38467. }),
  38468. $globals.AstEarlyPragmator);
  38469. $core.setTraitComposition([{trait: $globals.TPragmator}], $globals.AstPragmator);
  38470. $core.addMethod(
  38471. $core.method({
  38472. selector: "ast",
  38473. protocol: "*Compiler-AST",
  38474. fn: function (){
  38475. var self=this,$self=this;
  38476. return $core.withContext(function($ctx1) {
  38477. var $1;
  38478. $1=$self._source();
  38479. $ctx1.sendIdx["source"]=1;
  38480. $recv($1)._ifEmpty_((function(){
  38481. return $core.withContext(function($ctx2) {
  38482. return $recv($globals.CompilerError)._signal_("Method source is empty");
  38483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38484. }));
  38485. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._origin(),$self._protocol());
  38486. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  38487. },
  38488. args: [],
  38489. 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 origin\x0a\x09\x09protocol: self protocol",
  38490. referencedClasses: ["CompilerError", "Compiler"],
  38491. pragmas: [],
  38492. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "origin", "protocol"]
  38493. }),
  38494. $globals.CompiledMethod);
  38495. });
  38496. define('amber/core/Compiler-Semantic',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  38497. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38498. var $pkg = $core.addPackage("Compiler-Semantic");
  38499. $pkg.innerEval = function (expr) { return eval(expr); };
  38500. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  38501. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  38502. $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.";
  38503. $core.addMethod(
  38504. $core.method({
  38505. selector: "addArg:",
  38506. protocol: "adding",
  38507. fn: function (aString){
  38508. var self=this,$self=this;
  38509. return $core.withContext(function($ctx1) {
  38510. var $1;
  38511. $1=$self._args();
  38512. $ctx1.sendIdx["args"]=1;
  38513. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  38514. $recv($recv($self._args())._at_(aString))._scope_(self);
  38515. return self;
  38516. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString})});
  38517. },
  38518. args: ["aString"],
  38519. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  38520. referencedClasses: ["ArgVar"],
  38521. pragmas: [],
  38522. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  38523. }),
  38524. $globals.LexicalScope);
  38525. $core.addMethod(
  38526. $core.method({
  38527. selector: "addTemp:",
  38528. protocol: "adding",
  38529. fn: function (aString){
  38530. var self=this,$self=this;
  38531. return $core.withContext(function($ctx1) {
  38532. var $1;
  38533. $1=$self._temps();
  38534. $ctx1.sendIdx["temps"]=1;
  38535. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  38536. $recv($recv($self._temps())._at_(aString))._scope_(self);
  38537. return self;
  38538. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString})});
  38539. },
  38540. args: ["aString"],
  38541. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  38542. referencedClasses: ["TempVar"],
  38543. pragmas: [],
  38544. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  38545. }),
  38546. $globals.LexicalScope);
  38547. $core.addMethod(
  38548. $core.method({
  38549. selector: "alias",
  38550. protocol: "accessing",
  38551. fn: function (){
  38552. var self=this,$self=this;
  38553. return $core.withContext(function($ctx1) {
  38554. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  38555. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38556. },
  38557. args: [],
  38558. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  38559. referencedClasses: [],
  38560. pragmas: [],
  38561. messageSends: [",", "asString", "scopeLevel"]
  38562. }),
  38563. $globals.LexicalScope);
  38564. $core.addMethod(
  38565. $core.method({
  38566. selector: "allVariableNames",
  38567. protocol: "accessing",
  38568. fn: function (){
  38569. var self=this,$self=this;
  38570. return $core.withContext(function($ctx1) {
  38571. var $1;
  38572. $1=$recv($self._args())._keys();
  38573. $ctx1.sendIdx["keys"]=1;
  38574. return $recv($1).__comma($recv($self._temps())._keys());
  38575. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  38576. },
  38577. args: [],
  38578. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  38579. referencedClasses: [],
  38580. pragmas: [],
  38581. messageSends: [",", "keys", "args", "temps"]
  38582. }),
  38583. $globals.LexicalScope);
  38584. $core.addMethod(
  38585. $core.method({
  38586. selector: "args",
  38587. protocol: "accessing",
  38588. fn: function (){
  38589. var self=this,$self=this;
  38590. return $core.withContext(function($ctx1) {
  38591. var $1,$receiver;
  38592. $1=$self.args;
  38593. if(($receiver = $1) == null || $receiver.a$nil){
  38594. $self.args=$recv($globals.Dictionary)._new();
  38595. return $self.args;
  38596. } else {
  38597. return $1;
  38598. }
  38599. }, function($ctx1) {$ctx1.fill(self,"args",{})});
  38600. },
  38601. args: [],
  38602. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  38603. referencedClasses: ["Dictionary"],
  38604. pragmas: [],
  38605. messageSends: ["ifNil:", "new"]
  38606. }),
  38607. $globals.LexicalScope);
  38608. $core.addMethod(
  38609. $core.method({
  38610. selector: "bindingFor:",
  38611. protocol: "accessing",
  38612. fn: function (aStringOrNode){
  38613. var self=this,$self=this;
  38614. return $core.withContext(function($ctx1) {
  38615. var $2,$3,$4,$5,$1;
  38616. $2=$self._pseudoVars();
  38617. $3=$recv(aStringOrNode)._value();
  38618. $ctx1.sendIdx["value"]=1;
  38619. $1=$recv($2)._at_ifAbsent_($3,(function(){
  38620. return $core.withContext(function($ctx2) {
  38621. $4=$self._args();
  38622. $5=$recv(aStringOrNode)._value();
  38623. $ctx2.sendIdx["value"]=2;
  38624. return $recv($4)._at_ifAbsent_($5,(function(){
  38625. return $core.withContext(function($ctx3) {
  38626. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  38627. return nil;
  38628. }));
  38629. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38630. }));
  38631. $ctx2.sendIdx["at:ifAbsent:"]=2;
  38632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38633. }));
  38634. $ctx1.sendIdx["at:ifAbsent:"]=1;
  38635. return $1;
  38636. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode})});
  38637. },
  38638. args: ["aStringOrNode"],
  38639. 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 ]]]",
  38640. referencedClasses: [],
  38641. pragmas: [],
  38642. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  38643. }),
  38644. $globals.LexicalScope);
  38645. $core.addMethod(
  38646. $core.method({
  38647. selector: "blockIndex",
  38648. protocol: "accessing",
  38649. fn: function (){
  38650. var self=this,$self=this;
  38651. return $core.withContext(function($ctx1) {
  38652. var $1,$receiver;
  38653. $1=$self.blockIndex;
  38654. if(($receiver = $1) == null || $receiver.a$nil){
  38655. return (0);
  38656. } else {
  38657. return $1;
  38658. }
  38659. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{})});
  38660. },
  38661. args: [],
  38662. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  38663. referencedClasses: [],
  38664. pragmas: [],
  38665. messageSends: ["ifNil:"]
  38666. }),
  38667. $globals.LexicalScope);
  38668. $core.addMethod(
  38669. $core.method({
  38670. selector: "blockIndex:",
  38671. protocol: "accessing",
  38672. fn: function (anInteger){
  38673. var self=this,$self=this;
  38674. $self.blockIndex=anInteger;
  38675. return self;
  38676. },
  38677. args: ["anInteger"],
  38678. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  38679. referencedClasses: [],
  38680. pragmas: [],
  38681. messageSends: []
  38682. }),
  38683. $globals.LexicalScope);
  38684. $core.addMethod(
  38685. $core.method({
  38686. selector: "canInlineNonLocalReturns",
  38687. protocol: "testing",
  38688. fn: function (){
  38689. var self=this,$self=this;
  38690. return $core.withContext(function($ctx1) {
  38691. return $recv($self._isInlined())._and_((function(){
  38692. return $core.withContext(function($ctx2) {
  38693. return $recv($self._outerScope())._canInlineNonLocalReturns();
  38694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38695. }));
  38696. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{})});
  38697. },
  38698. args: [],
  38699. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  38700. referencedClasses: [],
  38701. pragmas: [],
  38702. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  38703. }),
  38704. $globals.LexicalScope);
  38705. $core.addMethod(
  38706. $core.method({
  38707. selector: "instruction",
  38708. protocol: "accessing",
  38709. fn: function (){
  38710. var self=this,$self=this;
  38711. return $self.instruction;
  38712. },
  38713. args: [],
  38714. source: "instruction\x0a\x09^ instruction",
  38715. referencedClasses: [],
  38716. pragmas: [],
  38717. messageSends: []
  38718. }),
  38719. $globals.LexicalScope);
  38720. $core.addMethod(
  38721. $core.method({
  38722. selector: "instruction:",
  38723. protocol: "accessing",
  38724. fn: function (anIRInstruction){
  38725. var self=this,$self=this;
  38726. $self.instruction=anIRInstruction;
  38727. return self;
  38728. },
  38729. args: ["anIRInstruction"],
  38730. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  38731. referencedClasses: [],
  38732. pragmas: [],
  38733. messageSends: []
  38734. }),
  38735. $globals.LexicalScope);
  38736. $core.addMethod(
  38737. $core.method({
  38738. selector: "isBlockScope",
  38739. protocol: "testing",
  38740. fn: function (){
  38741. var self=this,$self=this;
  38742. return $core.withContext(function($ctx1) {
  38743. return $recv($self._isMethodScope())._not();
  38744. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{})});
  38745. },
  38746. args: [],
  38747. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  38748. referencedClasses: [],
  38749. pragmas: [],
  38750. messageSends: ["not", "isMethodScope"]
  38751. }),
  38752. $globals.LexicalScope);
  38753. $core.addMethod(
  38754. $core.method({
  38755. selector: "isInlined",
  38756. protocol: "testing",
  38757. fn: function (){
  38758. var self=this,$self=this;
  38759. return $core.withContext(function($ctx1) {
  38760. var $2,$1;
  38761. $2=$self._instruction();
  38762. $ctx1.sendIdx["instruction"]=1;
  38763. $1=$recv($2)._notNil();
  38764. return $recv($1)._and_((function(){
  38765. return $core.withContext(function($ctx2) {
  38766. return $recv($self._instruction())._isInlined();
  38767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38768. }));
  38769. }, function($ctx1) {$ctx1.fill(self,"isInlined",{})});
  38770. },
  38771. args: [],
  38772. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  38773. referencedClasses: [],
  38774. pragmas: [],
  38775. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  38776. }),
  38777. $globals.LexicalScope);
  38778. $core.addMethod(
  38779. $core.method({
  38780. selector: "isMethodScope",
  38781. protocol: "testing",
  38782. fn: function (){
  38783. var self=this,$self=this;
  38784. return false;
  38785. },
  38786. args: [],
  38787. source: "isMethodScope\x0a\x09^ false",
  38788. referencedClasses: [],
  38789. pragmas: [],
  38790. messageSends: []
  38791. }),
  38792. $globals.LexicalScope);
  38793. $core.addMethod(
  38794. $core.method({
  38795. selector: "lookupVariable:",
  38796. protocol: "accessing",
  38797. fn: function (aNode){
  38798. var self=this,$self=this;
  38799. var lookup;
  38800. return $core.withContext(function($ctx1) {
  38801. var $1,$2,$receiver;
  38802. lookup=$self._bindingFor_(aNode);
  38803. $1=lookup;
  38804. if(($receiver = $1) == null || $receiver.a$nil){
  38805. $2=$self._outerScope();
  38806. $ctx1.sendIdx["outerScope"]=1;
  38807. if(($receiver = $2) == null || $receiver.a$nil){
  38808. lookup=$2;
  38809. } else {
  38810. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  38811. }
  38812. lookup;
  38813. } else {
  38814. $1;
  38815. }
  38816. return lookup;
  38817. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup})});
  38818. },
  38819. args: ["aNode"],
  38820. 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",
  38821. referencedClasses: [],
  38822. pragmas: [],
  38823. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  38824. }),
  38825. $globals.LexicalScope);
  38826. $core.addMethod(
  38827. $core.method({
  38828. selector: "methodScope",
  38829. protocol: "accessing",
  38830. fn: function (){
  38831. var self=this,$self=this;
  38832. return $core.withContext(function($ctx1) {
  38833. var $1,$receiver;
  38834. $1=$self._outerScope();
  38835. $ctx1.sendIdx["outerScope"]=1;
  38836. if(($receiver = $1) == null || $receiver.a$nil){
  38837. return $1;
  38838. } else {
  38839. return $recv($self._outerScope())._methodScope();
  38840. }
  38841. }, function($ctx1) {$ctx1.fill(self,"methodScope",{})});
  38842. },
  38843. args: [],
  38844. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  38845. referencedClasses: [],
  38846. pragmas: [],
  38847. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  38848. }),
  38849. $globals.LexicalScope);
  38850. $core.addMethod(
  38851. $core.method({
  38852. selector: "node",
  38853. protocol: "accessing",
  38854. fn: function (){
  38855. var self=this,$self=this;
  38856. return $self.node;
  38857. },
  38858. args: [],
  38859. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  38860. referencedClasses: [],
  38861. pragmas: [],
  38862. messageSends: []
  38863. }),
  38864. $globals.LexicalScope);
  38865. $core.addMethod(
  38866. $core.method({
  38867. selector: "node:",
  38868. protocol: "accessing",
  38869. fn: function (aNode){
  38870. var self=this,$self=this;
  38871. $self.node=aNode;
  38872. return self;
  38873. },
  38874. args: ["aNode"],
  38875. source: "node: aNode\x0a\x09node := aNode",
  38876. referencedClasses: [],
  38877. pragmas: [],
  38878. messageSends: []
  38879. }),
  38880. $globals.LexicalScope);
  38881. $core.addMethod(
  38882. $core.method({
  38883. selector: "outerScope",
  38884. protocol: "accessing",
  38885. fn: function (){
  38886. var self=this,$self=this;
  38887. return $self.outerScope;
  38888. },
  38889. args: [],
  38890. source: "outerScope\x0a\x09^ outerScope",
  38891. referencedClasses: [],
  38892. pragmas: [],
  38893. messageSends: []
  38894. }),
  38895. $globals.LexicalScope);
  38896. $core.addMethod(
  38897. $core.method({
  38898. selector: "outerScope:",
  38899. protocol: "accessing",
  38900. fn: function (aLexicalScope){
  38901. var self=this,$self=this;
  38902. $self.outerScope=aLexicalScope;
  38903. return self;
  38904. },
  38905. args: ["aLexicalScope"],
  38906. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  38907. referencedClasses: [],
  38908. pragmas: [],
  38909. messageSends: []
  38910. }),
  38911. $globals.LexicalScope);
  38912. $core.addMethod(
  38913. $core.method({
  38914. selector: "pseudoVars",
  38915. protocol: "accessing",
  38916. fn: function (){
  38917. var self=this,$self=this;
  38918. return $core.withContext(function($ctx1) {
  38919. return $recv($self._methodScope())._pseudoVars();
  38920. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  38921. },
  38922. args: [],
  38923. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  38924. referencedClasses: [],
  38925. pragmas: [],
  38926. messageSends: ["pseudoVars", "methodScope"]
  38927. }),
  38928. $globals.LexicalScope);
  38929. $core.addMethod(
  38930. $core.method({
  38931. selector: "scopeLevel",
  38932. protocol: "accessing",
  38933. fn: function (){
  38934. var self=this,$self=this;
  38935. return $core.withContext(function($ctx1) {
  38936. var $1,$2,$4,$3,$receiver;
  38937. $1=$self._outerScope();
  38938. $ctx1.sendIdx["outerScope"]=1;
  38939. if(($receiver = $1) == null || $receiver.a$nil){
  38940. return (1);
  38941. } else {
  38942. $1;
  38943. }
  38944. $2=$self._isInlined();
  38945. if($core.assert($2)){
  38946. $4=$self._outerScope();
  38947. $ctx1.sendIdx["outerScope"]=2;
  38948. $3=$recv($4)._scopeLevel();
  38949. $ctx1.sendIdx["scopeLevel"]=1;
  38950. return $3;
  38951. }
  38952. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  38953. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{})});
  38954. },
  38955. args: [],
  38956. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  38957. referencedClasses: [],
  38958. pragmas: [],
  38959. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  38960. }),
  38961. $globals.LexicalScope);
  38962. $core.addMethod(
  38963. $core.method({
  38964. selector: "temps",
  38965. protocol: "accessing",
  38966. fn: function (){
  38967. var self=this,$self=this;
  38968. return $core.withContext(function($ctx1) {
  38969. var $1,$receiver;
  38970. $1=$self.temps;
  38971. if(($receiver = $1) == null || $receiver.a$nil){
  38972. $self.temps=$recv($globals.Dictionary)._new();
  38973. return $self.temps;
  38974. } else {
  38975. return $1;
  38976. }
  38977. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  38978. },
  38979. args: [],
  38980. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  38981. referencedClasses: ["Dictionary"],
  38982. pragmas: [],
  38983. messageSends: ["ifNil:", "new"]
  38984. }),
  38985. $globals.LexicalScope);
  38986. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  38987. $globals.MethodLexicalScope.comment="I represent a method scope.";
  38988. $core.addMethod(
  38989. $core.method({
  38990. selector: "addIVar:",
  38991. protocol: "adding",
  38992. fn: function (aString){
  38993. var self=this,$self=this;
  38994. return $core.withContext(function($ctx1) {
  38995. var $1;
  38996. $1=$self._iVars();
  38997. $ctx1.sendIdx["iVars"]=1;
  38998. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  38999. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  39000. return self;
  39001. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString})});
  39002. },
  39003. args: ["aString"],
  39004. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  39005. referencedClasses: ["InstanceVar"],
  39006. pragmas: [],
  39007. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  39008. }),
  39009. $globals.MethodLexicalScope);
  39010. $core.addMethod(
  39011. $core.method({
  39012. selector: "addNonLocalReturn:",
  39013. protocol: "adding",
  39014. fn: function (aScope){
  39015. var self=this,$self=this;
  39016. return $core.withContext(function($ctx1) {
  39017. $recv($self._nonLocalReturns())._add_(aScope);
  39018. return self;
  39019. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope})});
  39020. },
  39021. args: ["aScope"],
  39022. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  39023. referencedClasses: [],
  39024. pragmas: [],
  39025. messageSends: ["add:", "nonLocalReturns"]
  39026. }),
  39027. $globals.MethodLexicalScope);
  39028. $core.addMethod(
  39029. $core.method({
  39030. selector: "allVariableNames",
  39031. protocol: "accessing",
  39032. fn: function (){
  39033. var self=this,$self=this;
  39034. return $core.withContext(function($ctx1) {
  39035. var $1;
  39036. $1=(
  39037. $ctx1.supercall = true,
  39038. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  39039. $ctx1.supercall = false;
  39040. return $recv($1).__comma($recv($self._iVars())._keys());
  39041. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  39042. },
  39043. args: [],
  39044. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  39045. referencedClasses: [],
  39046. pragmas: [],
  39047. messageSends: [",", "allVariableNames", "keys", "iVars"]
  39048. }),
  39049. $globals.MethodLexicalScope);
  39050. $core.addMethod(
  39051. $core.method({
  39052. selector: "bindingFor:",
  39053. protocol: "accessing",
  39054. fn: function (aNode){
  39055. var self=this,$self=this;
  39056. return $core.withContext(function($ctx1) {
  39057. var $1,$receiver;
  39058. $1=(
  39059. $ctx1.supercall = true,
  39060. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  39061. $ctx1.supercall = false;
  39062. if(($receiver = $1) == null || $receiver.a$nil){
  39063. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  39064. return nil;
  39065. }));
  39066. } else {
  39067. return $1;
  39068. }
  39069. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode})});
  39070. },
  39071. args: ["aNode"],
  39072. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  39073. referencedClasses: [],
  39074. pragmas: [],
  39075. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  39076. }),
  39077. $globals.MethodLexicalScope);
  39078. $core.addMethod(
  39079. $core.method({
  39080. selector: "canInlineNonLocalReturns",
  39081. protocol: "testing",
  39082. fn: function (){
  39083. var self=this,$self=this;
  39084. return true;
  39085. },
  39086. args: [],
  39087. source: "canInlineNonLocalReturns\x0a\x09^ true",
  39088. referencedClasses: [],
  39089. pragmas: [],
  39090. messageSends: []
  39091. }),
  39092. $globals.MethodLexicalScope);
  39093. $core.addMethod(
  39094. $core.method({
  39095. selector: "hasLocalReturn",
  39096. protocol: "testing",
  39097. fn: function (){
  39098. var self=this,$self=this;
  39099. return $core.withContext(function($ctx1) {
  39100. return $self._localReturn();
  39101. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{})});
  39102. },
  39103. args: [],
  39104. source: "hasLocalReturn\x0a\x09^ self localReturn",
  39105. referencedClasses: [],
  39106. pragmas: [],
  39107. messageSends: ["localReturn"]
  39108. }),
  39109. $globals.MethodLexicalScope);
  39110. $core.addMethod(
  39111. $core.method({
  39112. selector: "hasNonLocalReturn",
  39113. protocol: "testing",
  39114. fn: function (){
  39115. var self=this,$self=this;
  39116. return $core.withContext(function($ctx1) {
  39117. return $recv($self._nonLocalReturns())._notEmpty();
  39118. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{})});
  39119. },
  39120. args: [],
  39121. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  39122. referencedClasses: [],
  39123. pragmas: [],
  39124. messageSends: ["notEmpty", "nonLocalReturns"]
  39125. }),
  39126. $globals.MethodLexicalScope);
  39127. $core.addMethod(
  39128. $core.method({
  39129. selector: "iVars",
  39130. protocol: "accessing",
  39131. fn: function (){
  39132. var self=this,$self=this;
  39133. return $core.withContext(function($ctx1) {
  39134. var $1,$receiver;
  39135. $1=$self.iVars;
  39136. if(($receiver = $1) == null || $receiver.a$nil){
  39137. $self.iVars=$recv($globals.Dictionary)._new();
  39138. return $self.iVars;
  39139. } else {
  39140. return $1;
  39141. }
  39142. }, function($ctx1) {$ctx1.fill(self,"iVars",{})});
  39143. },
  39144. args: [],
  39145. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  39146. referencedClasses: ["Dictionary"],
  39147. pragmas: [],
  39148. messageSends: ["ifNil:", "new"]
  39149. }),
  39150. $globals.MethodLexicalScope);
  39151. $core.addMethod(
  39152. $core.method({
  39153. selector: "isMethodScope",
  39154. protocol: "testing",
  39155. fn: function (){
  39156. var self=this,$self=this;
  39157. return true;
  39158. },
  39159. args: [],
  39160. source: "isMethodScope\x0a\x09^ true",
  39161. referencedClasses: [],
  39162. pragmas: [],
  39163. messageSends: []
  39164. }),
  39165. $globals.MethodLexicalScope);
  39166. $core.addMethod(
  39167. $core.method({
  39168. selector: "localReturn",
  39169. protocol: "accessing",
  39170. fn: function (){
  39171. var self=this,$self=this;
  39172. return $core.withContext(function($ctx1) {
  39173. var $1,$receiver;
  39174. $1=$self.localReturn;
  39175. if(($receiver = $1) == null || $receiver.a$nil){
  39176. return false;
  39177. } else {
  39178. return $1;
  39179. }
  39180. }, function($ctx1) {$ctx1.fill(self,"localReturn",{})});
  39181. },
  39182. args: [],
  39183. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  39184. referencedClasses: [],
  39185. pragmas: [],
  39186. messageSends: ["ifNil:"]
  39187. }),
  39188. $globals.MethodLexicalScope);
  39189. $core.addMethod(
  39190. $core.method({
  39191. selector: "localReturn:",
  39192. protocol: "accessing",
  39193. fn: function (aBoolean){
  39194. var self=this,$self=this;
  39195. $self.localReturn=aBoolean;
  39196. return self;
  39197. },
  39198. args: ["aBoolean"],
  39199. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  39200. referencedClasses: [],
  39201. pragmas: [],
  39202. messageSends: []
  39203. }),
  39204. $globals.MethodLexicalScope);
  39205. $core.addMethod(
  39206. $core.method({
  39207. selector: "methodScope",
  39208. protocol: "accessing",
  39209. fn: function (){
  39210. var self=this,$self=this;
  39211. return self;
  39212. },
  39213. args: [],
  39214. source: "methodScope\x0a\x09^ self",
  39215. referencedClasses: [],
  39216. pragmas: [],
  39217. messageSends: []
  39218. }),
  39219. $globals.MethodLexicalScope);
  39220. $core.addMethod(
  39221. $core.method({
  39222. selector: "nonLocalReturns",
  39223. protocol: "accessing",
  39224. fn: function (){
  39225. var self=this,$self=this;
  39226. return $core.withContext(function($ctx1) {
  39227. var $1,$receiver;
  39228. $1=$self.nonLocalReturns;
  39229. if(($receiver = $1) == null || $receiver.a$nil){
  39230. $self.nonLocalReturns=$recv($globals.OrderedCollection)._new();
  39231. return $self.nonLocalReturns;
  39232. } else {
  39233. return $1;
  39234. }
  39235. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{})});
  39236. },
  39237. args: [],
  39238. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  39239. referencedClasses: ["OrderedCollection"],
  39240. pragmas: [],
  39241. messageSends: ["ifNil:", "new"]
  39242. }),
  39243. $globals.MethodLexicalScope);
  39244. $core.addMethod(
  39245. $core.method({
  39246. selector: "pseudoVars",
  39247. protocol: "accessing",
  39248. fn: function (){
  39249. var self=this,$self=this;
  39250. return $core.withContext(function($ctx1) {
  39251. var $1,$2,$4,$5,$6,$3,$7,$9,$8,$receiver;
  39252. $1=$self.pseudoVars;
  39253. if(($receiver = $1) == null || $receiver.a$nil){
  39254. $self.pseudoVars=$recv($globals.Dictionary)._new();
  39255. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  39256. return $core.withContext(function($ctx2) {
  39257. $2=$self.pseudoVars;
  39258. $4=$recv($globals.PseudoVar)._on_(each);
  39259. $ctx2.sendIdx["on:"]=1;
  39260. $5=$self._methodScope();
  39261. $ctx2.sendIdx["methodScope"]=1;
  39262. $recv($4)._scope_($5);
  39263. $ctx2.sendIdx["scope:"]=1;
  39264. $6=$recv($4)._yourself();
  39265. $ctx2.sendIdx["yourself"]=1;
  39266. $3=$6;
  39267. return $recv($2)._at_put_(each,$3);
  39268. $ctx2.sendIdx["at:put:"]=1;
  39269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39270. }));
  39271. $7=$self.pseudoVars;
  39272. $9=$recv($globals.SuperVar)._on_("super");
  39273. $recv($9)._scope_($self._methodScope());
  39274. $8=$recv($9)._yourself();
  39275. $recv($7)._at_put_("super",$8);
  39276. } else {
  39277. $1;
  39278. }
  39279. return $self.pseudoVars;
  39280. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  39281. },
  39282. args: [],
  39283. 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\x09pseudoVars at: #super put: ((SuperVar on: #super) scope: self methodScope; yourself) ].\x0a\x09^ pseudoVars",
  39284. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar", "SuperVar"],
  39285. pragmas: [],
  39286. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  39287. }),
  39288. $globals.MethodLexicalScope);
  39289. $core.addMethod(
  39290. $core.method({
  39291. selector: "removeNonLocalReturn:",
  39292. protocol: "adding",
  39293. fn: function (aScope){
  39294. var self=this,$self=this;
  39295. return $core.withContext(function($ctx1) {
  39296. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  39297. }));
  39298. return self;
  39299. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope})});
  39300. },
  39301. args: ["aScope"],
  39302. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  39303. referencedClasses: [],
  39304. pragmas: [],
  39305. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  39306. }),
  39307. $globals.MethodLexicalScope);
  39308. $core.addMethod(
  39309. $core.method({
  39310. selector: "unknownVariables",
  39311. protocol: "accessing",
  39312. fn: function (){
  39313. var self=this,$self=this;
  39314. return $core.withContext(function($ctx1) {
  39315. var $1,$receiver;
  39316. $1=$self.unknownVariables;
  39317. if(($receiver = $1) == null || $receiver.a$nil){
  39318. $self.unknownVariables=$recv($globals.OrderedCollection)._new();
  39319. return $self.unknownVariables;
  39320. } else {
  39321. return $1;
  39322. }
  39323. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{})});
  39324. },
  39325. args: [],
  39326. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  39327. referencedClasses: ["OrderedCollection"],
  39328. pragmas: [],
  39329. messageSends: ["ifNil:", "new"]
  39330. }),
  39331. $globals.MethodLexicalScope);
  39332. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  39333. $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.";
  39334. $core.addMethod(
  39335. $core.method({
  39336. selector: "alias",
  39337. protocol: "accessing",
  39338. fn: function (){
  39339. var self=this,$self=this;
  39340. return $core.withContext(function($ctx1) {
  39341. return $recv($self._name())._asVariableName();
  39342. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39343. },
  39344. args: [],
  39345. source: "alias\x0a\x09^ self name asVariableName",
  39346. referencedClasses: [],
  39347. pragmas: [],
  39348. messageSends: ["asVariableName", "name"]
  39349. }),
  39350. $globals.ScopeVar);
  39351. $core.addMethod(
  39352. $core.method({
  39353. selector: "isArgVar",
  39354. protocol: "testing",
  39355. fn: function (){
  39356. var self=this,$self=this;
  39357. return false;
  39358. },
  39359. args: [],
  39360. source: "isArgVar\x0a\x09^ false",
  39361. referencedClasses: [],
  39362. pragmas: [],
  39363. messageSends: []
  39364. }),
  39365. $globals.ScopeVar);
  39366. $core.addMethod(
  39367. $core.method({
  39368. selector: "isClassRefVar",
  39369. protocol: "testing",
  39370. fn: function (){
  39371. var self=this,$self=this;
  39372. return false;
  39373. },
  39374. args: [],
  39375. source: "isClassRefVar\x0a\x09^ false",
  39376. referencedClasses: [],
  39377. pragmas: [],
  39378. messageSends: []
  39379. }),
  39380. $globals.ScopeVar);
  39381. $core.addMethod(
  39382. $core.method({
  39383. selector: "isImmutable",
  39384. protocol: "testing",
  39385. fn: function (){
  39386. var self=this,$self=this;
  39387. return false;
  39388. },
  39389. args: [],
  39390. source: "isImmutable\x0a\x09^ false",
  39391. referencedClasses: [],
  39392. pragmas: [],
  39393. messageSends: []
  39394. }),
  39395. $globals.ScopeVar);
  39396. $core.addMethod(
  39397. $core.method({
  39398. selector: "isInstanceVar",
  39399. protocol: "testing",
  39400. fn: function (){
  39401. var self=this,$self=this;
  39402. return false;
  39403. },
  39404. args: [],
  39405. source: "isInstanceVar\x0a\x09^ false",
  39406. referencedClasses: [],
  39407. pragmas: [],
  39408. messageSends: []
  39409. }),
  39410. $globals.ScopeVar);
  39411. $core.addMethod(
  39412. $core.method({
  39413. selector: "isPseudoVar",
  39414. protocol: "testing",
  39415. fn: function (){
  39416. var self=this,$self=this;
  39417. return false;
  39418. },
  39419. args: [],
  39420. source: "isPseudoVar\x0a\x09^ false",
  39421. referencedClasses: [],
  39422. pragmas: [],
  39423. messageSends: []
  39424. }),
  39425. $globals.ScopeVar);
  39426. $core.addMethod(
  39427. $core.method({
  39428. selector: "isSelf",
  39429. protocol: "testing",
  39430. fn: function (){
  39431. var self=this,$self=this;
  39432. return false;
  39433. },
  39434. args: [],
  39435. source: "isSelf\x0a\x09^ false",
  39436. referencedClasses: [],
  39437. pragmas: [],
  39438. messageSends: []
  39439. }),
  39440. $globals.ScopeVar);
  39441. $core.addMethod(
  39442. $core.method({
  39443. selector: "isSuper",
  39444. protocol: "testing",
  39445. fn: function (){
  39446. var self=this,$self=this;
  39447. return false;
  39448. },
  39449. args: [],
  39450. source: "isSuper\x0a\x09^ false",
  39451. referencedClasses: [],
  39452. pragmas: [],
  39453. messageSends: []
  39454. }),
  39455. $globals.ScopeVar);
  39456. $core.addMethod(
  39457. $core.method({
  39458. selector: "isTempVar",
  39459. protocol: "testing",
  39460. fn: function (){
  39461. var self=this,$self=this;
  39462. return false;
  39463. },
  39464. args: [],
  39465. source: "isTempVar\x0a\x09^ false",
  39466. referencedClasses: [],
  39467. pragmas: [],
  39468. messageSends: []
  39469. }),
  39470. $globals.ScopeVar);
  39471. $core.addMethod(
  39472. $core.method({
  39473. selector: "isUnknownVar",
  39474. protocol: "testing",
  39475. fn: function (){
  39476. var self=this,$self=this;
  39477. return false;
  39478. },
  39479. args: [],
  39480. source: "isUnknownVar\x0a\x09^ false",
  39481. referencedClasses: [],
  39482. pragmas: [],
  39483. messageSends: []
  39484. }),
  39485. $globals.ScopeVar);
  39486. $core.addMethod(
  39487. $core.method({
  39488. selector: "name",
  39489. protocol: "accessing",
  39490. fn: function (){
  39491. var self=this,$self=this;
  39492. return $self.name;
  39493. },
  39494. args: [],
  39495. source: "name\x0a\x09^ name",
  39496. referencedClasses: [],
  39497. pragmas: [],
  39498. messageSends: []
  39499. }),
  39500. $globals.ScopeVar);
  39501. $core.addMethod(
  39502. $core.method({
  39503. selector: "name:",
  39504. protocol: "accessing",
  39505. fn: function (aString){
  39506. var self=this,$self=this;
  39507. $self.name=aString;
  39508. return self;
  39509. },
  39510. args: ["aString"],
  39511. source: "name: aString\x0a\x09name := aString",
  39512. referencedClasses: [],
  39513. pragmas: [],
  39514. messageSends: []
  39515. }),
  39516. $globals.ScopeVar);
  39517. $core.addMethod(
  39518. $core.method({
  39519. selector: "scope",
  39520. protocol: "accessing",
  39521. fn: function (){
  39522. var self=this,$self=this;
  39523. return $self.scope;
  39524. },
  39525. args: [],
  39526. source: "scope\x0a\x09^ scope",
  39527. referencedClasses: [],
  39528. pragmas: [],
  39529. messageSends: []
  39530. }),
  39531. $globals.ScopeVar);
  39532. $core.addMethod(
  39533. $core.method({
  39534. selector: "scope:",
  39535. protocol: "accessing",
  39536. fn: function (aScope){
  39537. var self=this,$self=this;
  39538. $self.scope=aScope;
  39539. return self;
  39540. },
  39541. args: ["aScope"],
  39542. source: "scope: aScope\x0a\x09scope := aScope",
  39543. referencedClasses: [],
  39544. pragmas: [],
  39545. messageSends: []
  39546. }),
  39547. $globals.ScopeVar);
  39548. $core.addMethod(
  39549. $core.method({
  39550. selector: "validateAssignment",
  39551. protocol: "testing",
  39552. fn: function (){
  39553. var self=this,$self=this;
  39554. return $core.withContext(function($ctx1) {
  39555. var $1,$2;
  39556. $1=$recv($self._isArgVar())._or_((function(){
  39557. return $core.withContext(function($ctx2) {
  39558. return $self._isPseudoVar();
  39559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39560. }));
  39561. if($core.assert($1)){
  39562. $2=$recv($globals.InvalidAssignmentError)._new();
  39563. $recv($2)._variableName_($self._name());
  39564. $recv($2)._signal();
  39565. }
  39566. return self;
  39567. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{})});
  39568. },
  39569. args: [],
  39570. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  39571. referencedClasses: ["InvalidAssignmentError"],
  39572. pragmas: [],
  39573. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  39574. }),
  39575. $globals.ScopeVar);
  39576. $core.addMethod(
  39577. $core.method({
  39578. selector: "on:",
  39579. protocol: "instance creation",
  39580. fn: function (aString){
  39581. var self=this,$self=this;
  39582. return $core.withContext(function($ctx1) {
  39583. var $1;
  39584. $1=$self._new();
  39585. $recv($1)._name_(aString);
  39586. return $recv($1)._yourself();
  39587. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString})});
  39588. },
  39589. args: ["aString"],
  39590. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  39591. referencedClasses: [],
  39592. pragmas: [],
  39593. messageSends: ["name:", "new", "yourself"]
  39594. }),
  39595. $globals.ScopeVar.a$cls);
  39596. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  39597. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  39598. $core.addMethod(
  39599. $core.method({
  39600. selector: "isImmutable",
  39601. protocol: "testing",
  39602. fn: function (){
  39603. var self=this,$self=this;
  39604. return true;
  39605. },
  39606. args: [],
  39607. source: "isImmutable\x0a\x09^ true",
  39608. referencedClasses: [],
  39609. pragmas: [],
  39610. messageSends: []
  39611. }),
  39612. $globals.AliasVar);
  39613. $core.addMethod(
  39614. $core.method({
  39615. selector: "node",
  39616. protocol: "accessing",
  39617. fn: function (){
  39618. var self=this,$self=this;
  39619. return $self.node;
  39620. },
  39621. args: [],
  39622. source: "node\x0a\x09^ node",
  39623. referencedClasses: [],
  39624. pragmas: [],
  39625. messageSends: []
  39626. }),
  39627. $globals.AliasVar);
  39628. $core.addMethod(
  39629. $core.method({
  39630. selector: "node:",
  39631. protocol: "accessing",
  39632. fn: function (aNode){
  39633. var self=this,$self=this;
  39634. $self.node=aNode;
  39635. return self;
  39636. },
  39637. args: ["aNode"],
  39638. source: "node: aNode\x0a\x09node := aNode",
  39639. referencedClasses: [],
  39640. pragmas: [],
  39641. messageSends: []
  39642. }),
  39643. $globals.AliasVar);
  39644. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39645. $globals.ArgVar.comment="I am an argument of a method or block.";
  39646. $core.addMethod(
  39647. $core.method({
  39648. selector: "isArgVar",
  39649. protocol: "testing",
  39650. fn: function (){
  39651. var self=this,$self=this;
  39652. return true;
  39653. },
  39654. args: [],
  39655. source: "isArgVar\x0a\x09^ true",
  39656. referencedClasses: [],
  39657. pragmas: [],
  39658. messageSends: []
  39659. }),
  39660. $globals.ArgVar);
  39661. $core.addMethod(
  39662. $core.method({
  39663. selector: "isImmutable",
  39664. protocol: "testing",
  39665. fn: function (){
  39666. var self=this,$self=this;
  39667. return true;
  39668. },
  39669. args: [],
  39670. source: "isImmutable\x0a\x09^ true",
  39671. referencedClasses: [],
  39672. pragmas: [],
  39673. messageSends: []
  39674. }),
  39675. $globals.ArgVar);
  39676. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39677. $globals.ClassRefVar.comment="I am an class reference variable";
  39678. $core.addMethod(
  39679. $core.method({
  39680. selector: "alias",
  39681. protocol: "accessing",
  39682. fn: function (){
  39683. var self=this,$self=this;
  39684. return $core.withContext(function($ctx1) {
  39685. return "$globals.".__comma($self._name());
  39686. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39687. },
  39688. args: [],
  39689. 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",
  39690. referencedClasses: [],
  39691. pragmas: [],
  39692. messageSends: [",", "name"]
  39693. }),
  39694. $globals.ClassRefVar);
  39695. $core.addMethod(
  39696. $core.method({
  39697. selector: "isClassRefVar",
  39698. protocol: "testing",
  39699. fn: function (){
  39700. var self=this,$self=this;
  39701. return true;
  39702. },
  39703. args: [],
  39704. source: "isClassRefVar\x0a\x09^ true",
  39705. referencedClasses: [],
  39706. pragmas: [],
  39707. messageSends: []
  39708. }),
  39709. $globals.ClassRefVar);
  39710. $core.addMethod(
  39711. $core.method({
  39712. selector: "isImmutable",
  39713. protocol: "testing",
  39714. fn: function (){
  39715. var self=this,$self=this;
  39716. return true;
  39717. },
  39718. args: [],
  39719. source: "isImmutable\x0a\x09^ true",
  39720. referencedClasses: [],
  39721. pragmas: [],
  39722. messageSends: []
  39723. }),
  39724. $globals.ClassRefVar);
  39725. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39726. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  39727. $core.addMethod(
  39728. $core.method({
  39729. selector: "alias",
  39730. protocol: "testing",
  39731. fn: function (){
  39732. var self=this,$self=this;
  39733. return $core.withContext(function($ctx1) {
  39734. return "$self.".__comma($self._name());
  39735. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39736. },
  39737. args: [],
  39738. source: "alias\x0a\x09^ '$self.', self name",
  39739. referencedClasses: [],
  39740. pragmas: [],
  39741. messageSends: [",", "name"]
  39742. }),
  39743. $globals.InstanceVar);
  39744. $core.addMethod(
  39745. $core.method({
  39746. selector: "isInstanceVar",
  39747. protocol: "testing",
  39748. fn: function (){
  39749. var self=this,$self=this;
  39750. return true;
  39751. },
  39752. args: [],
  39753. source: "isInstanceVar\x0a\x09^ true",
  39754. referencedClasses: [],
  39755. pragmas: [],
  39756. messageSends: []
  39757. }),
  39758. $globals.InstanceVar);
  39759. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39760. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  39761. $core.addMethod(
  39762. $core.method({
  39763. selector: "alias",
  39764. protocol: "accessing",
  39765. fn: function (){
  39766. var self=this,$self=this;
  39767. return $core.withContext(function($ctx1) {
  39768. return $self._name();
  39769. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  39770. },
  39771. args: [],
  39772. source: "alias\x0a\x09^ self name",
  39773. referencedClasses: [],
  39774. pragmas: [],
  39775. messageSends: ["name"]
  39776. }),
  39777. $globals.PseudoVar);
  39778. $core.addMethod(
  39779. $core.method({
  39780. selector: "isImmutable",
  39781. protocol: "testing",
  39782. fn: function (){
  39783. var self=this,$self=this;
  39784. return true;
  39785. },
  39786. args: [],
  39787. source: "isImmutable\x0a\x09^ true",
  39788. referencedClasses: [],
  39789. pragmas: [],
  39790. messageSends: []
  39791. }),
  39792. $globals.PseudoVar);
  39793. $core.addMethod(
  39794. $core.method({
  39795. selector: "isPseudoVar",
  39796. protocol: "testing",
  39797. fn: function (){
  39798. var self=this,$self=this;
  39799. return true;
  39800. },
  39801. args: [],
  39802. source: "isPseudoVar\x0a\x09^ true",
  39803. referencedClasses: [],
  39804. pragmas: [],
  39805. messageSends: []
  39806. }),
  39807. $globals.PseudoVar);
  39808. $core.addMethod(
  39809. $core.method({
  39810. selector: "isSelf",
  39811. protocol: "testing",
  39812. fn: function (){
  39813. var self=this,$self=this;
  39814. return $core.withContext(function($ctx1) {
  39815. return $recv($self.name).__eq("self");
  39816. }, function($ctx1) {$ctx1.fill(self,"isSelf",{})});
  39817. },
  39818. args: [],
  39819. source: "isSelf\x0a\x09^ name = 'self'",
  39820. referencedClasses: [],
  39821. pragmas: [],
  39822. messageSends: ["="]
  39823. }),
  39824. $globals.PseudoVar);
  39825. $core.addClass("SuperVar", $globals.PseudoVar, [], "Compiler-Semantic");
  39826. $globals.SuperVar.comment="I am a 'super' pseudo variable.";
  39827. $core.addMethod(
  39828. $core.method({
  39829. selector: "alias",
  39830. protocol: "accessing",
  39831. fn: function (){
  39832. var self=this,$self=this;
  39833. return "self";
  39834. },
  39835. args: [],
  39836. source: "alias\x0a\x09^ 'self'",
  39837. referencedClasses: [],
  39838. pragmas: [],
  39839. messageSends: []
  39840. }),
  39841. $globals.SuperVar);
  39842. $core.addMethod(
  39843. $core.method({
  39844. selector: "isSuper",
  39845. protocol: "testing",
  39846. fn: function (){
  39847. var self=this,$self=this;
  39848. return true;
  39849. },
  39850. args: [],
  39851. source: "isSuper\x0a\x09^ true",
  39852. referencedClasses: [],
  39853. pragmas: [],
  39854. messageSends: []
  39855. }),
  39856. $globals.SuperVar);
  39857. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39858. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  39859. $core.addMethod(
  39860. $core.method({
  39861. selector: "isTempVar",
  39862. protocol: "testing",
  39863. fn: function (){
  39864. var self=this,$self=this;
  39865. return true;
  39866. },
  39867. args: [],
  39868. source: "isTempVar\x0a\x09^ true",
  39869. referencedClasses: [],
  39870. pragmas: [],
  39871. messageSends: []
  39872. }),
  39873. $globals.TempVar);
  39874. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  39875. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  39876. $core.addMethod(
  39877. $core.method({
  39878. selector: "isUnknownVar",
  39879. protocol: "testing",
  39880. fn: function (){
  39881. var self=this,$self=this;
  39882. return true;
  39883. },
  39884. args: [],
  39885. source: "isUnknownVar\x0a\x09^ true",
  39886. referencedClasses: [],
  39887. pragmas: [],
  39888. messageSends: []
  39889. }),
  39890. $globals.UnknownVar);
  39891. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  39892. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  39893. $core.addMethod(
  39894. $core.method({
  39895. selector: "classReferences",
  39896. protocol: "accessing",
  39897. fn: function (){
  39898. var self=this,$self=this;
  39899. return $core.withContext(function($ctx1) {
  39900. var $1,$receiver;
  39901. $1=$self.classReferences;
  39902. if(($receiver = $1) == null || $receiver.a$nil){
  39903. $self.classReferences=$recv($globals.Set)._new();
  39904. return $self.classReferences;
  39905. } else {
  39906. return $1;
  39907. }
  39908. }, function($ctx1) {$ctx1.fill(self,"classReferences",{})});
  39909. },
  39910. args: [],
  39911. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  39912. referencedClasses: ["Set"],
  39913. pragmas: [],
  39914. messageSends: ["ifNil:", "new"]
  39915. }),
  39916. $globals.SemanticAnalyzer);
  39917. $core.addMethod(
  39918. $core.method({
  39919. selector: "errorShadowingVariable:",
  39920. protocol: "error handling",
  39921. fn: function (aString){
  39922. var self=this,$self=this;
  39923. return $core.withContext(function($ctx1) {
  39924. var $1;
  39925. $1=$recv($globals.ShadowingVariableError)._new();
  39926. $recv($1)._variableName_(aString);
  39927. $recv($1)._signal();
  39928. return self;
  39929. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString})});
  39930. },
  39931. args: ["aString"],
  39932. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  39933. referencedClasses: ["ShadowingVariableError"],
  39934. pragmas: [],
  39935. messageSends: ["variableName:", "new", "signal"]
  39936. }),
  39937. $globals.SemanticAnalyzer);
  39938. $core.addMethod(
  39939. $core.method({
  39940. selector: "errorUnknownVariable:",
  39941. protocol: "error handling",
  39942. fn: function (aNode){
  39943. var self=this,$self=this;
  39944. var identifier;
  39945. return $core.withContext(function($ctx1) {
  39946. var $1,$2,$3;
  39947. identifier=$recv(aNode)._value();
  39948. $ctx1.sendIdx["value"]=1;
  39949. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  39950. return $core.withContext(function($ctx2) {
  39951. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  39952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39953. }));
  39954. if($core.assert($1)){
  39955. $2=$recv($globals.UnknownVariableError)._new();
  39956. $3=$recv(aNode)._value();
  39957. $ctx1.sendIdx["value"]=2;
  39958. $recv($2)._variableName_($3);
  39959. $recv($2)._signal();
  39960. } else {
  39961. $recv($recv($recv($self.currentScope)._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  39962. }
  39963. return self;
  39964. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier})});
  39965. },
  39966. args: ["aNode"],
  39967. 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 ]",
  39968. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  39969. pragmas: [],
  39970. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  39971. }),
  39972. $globals.SemanticAnalyzer);
  39973. $core.addMethod(
  39974. $core.method({
  39975. selector: "isVariableUndefined:inPackage:",
  39976. protocol: "testing",
  39977. fn: function (aString,aPackage){
  39978. var self=this,$self=this;
  39979. return $core.withContext(function($ctx1) {
  39980. var $1,$2,$receiver;
  39981. if(($receiver = aPackage) == null || $receiver.a$nil){
  39982. aPackage;
  39983. } else {
  39984. var packageKnownVars;
  39985. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  39986. $1=$recv(packageKnownVars)._includes_(aString);
  39987. if($core.assert($1)){
  39988. return false;
  39989. }
  39990. }
  39991. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  39992. $ctx1.sendIdx[","]=1;
  39993. return $recv($globals.Compiler)._eval_($2);
  39994. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage})});
  39995. },
  39996. args: ["aString", "aPackage"],
  39997. 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'",
  39998. referencedClasses: ["Compiler"],
  39999. pragmas: [],
  40000. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  40001. }),
  40002. $globals.SemanticAnalyzer);
  40003. $core.addMethod(
  40004. $core.method({
  40005. selector: "messageSends",
  40006. protocol: "accessing",
  40007. fn: function (){
  40008. var self=this,$self=this;
  40009. return $core.withContext(function($ctx1) {
  40010. var $1,$receiver;
  40011. $1=$self.messageSends;
  40012. if(($receiver = $1) == null || $receiver.a$nil){
  40013. $self.messageSends=$recv($globals.Dictionary)._new();
  40014. return $self.messageSends;
  40015. } else {
  40016. return $1;
  40017. }
  40018. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  40019. },
  40020. args: [],
  40021. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  40022. referencedClasses: ["Dictionary"],
  40023. pragmas: [],
  40024. messageSends: ["ifNil:", "new"]
  40025. }),
  40026. $globals.SemanticAnalyzer);
  40027. $core.addMethod(
  40028. $core.method({
  40029. selector: "newBlockScope",
  40030. protocol: "factory",
  40031. fn: function (){
  40032. var self=this,$self=this;
  40033. return $core.withContext(function($ctx1) {
  40034. return $self._newScopeOfClass_($globals.LexicalScope);
  40035. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{})});
  40036. },
  40037. args: [],
  40038. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  40039. referencedClasses: ["LexicalScope"],
  40040. pragmas: [],
  40041. messageSends: ["newScopeOfClass:"]
  40042. }),
  40043. $globals.SemanticAnalyzer);
  40044. $core.addMethod(
  40045. $core.method({
  40046. selector: "newMethodScope",
  40047. protocol: "factory",
  40048. fn: function (){
  40049. var self=this,$self=this;
  40050. return $core.withContext(function($ctx1) {
  40051. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  40052. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{})});
  40053. },
  40054. args: [],
  40055. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  40056. referencedClasses: ["MethodLexicalScope"],
  40057. pragmas: [],
  40058. messageSends: ["newScopeOfClass:"]
  40059. }),
  40060. $globals.SemanticAnalyzer);
  40061. $core.addMethod(
  40062. $core.method({
  40063. selector: "newScopeOfClass:",
  40064. protocol: "factory",
  40065. fn: function (aLexicalScopeClass){
  40066. var self=this,$self=this;
  40067. return $core.withContext(function($ctx1) {
  40068. var $1;
  40069. $1=$recv(aLexicalScopeClass)._new();
  40070. $recv($1)._outerScope_($self.currentScope);
  40071. return $recv($1)._yourself();
  40072. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass})});
  40073. },
  40074. args: ["aLexicalScopeClass"],
  40075. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  40076. referencedClasses: [],
  40077. pragmas: [],
  40078. messageSends: ["outerScope:", "new", "yourself"]
  40079. }),
  40080. $globals.SemanticAnalyzer);
  40081. $core.addMethod(
  40082. $core.method({
  40083. selector: "nextBlockIndex",
  40084. protocol: "private",
  40085. fn: function (){
  40086. var self=this,$self=this;
  40087. return $core.withContext(function($ctx1) {
  40088. var $1,$receiver;
  40089. $1=$self.blockIndex;
  40090. if(($receiver = $1) == null || $receiver.a$nil){
  40091. $self.blockIndex=(0);
  40092. $self.blockIndex;
  40093. } else {
  40094. $1;
  40095. }
  40096. $self.blockIndex=$recv($self.blockIndex).__plus((1));
  40097. return $self.blockIndex;
  40098. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{})});
  40099. },
  40100. args: [],
  40101. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  40102. referencedClasses: [],
  40103. pragmas: [],
  40104. messageSends: ["ifNil:", "+"]
  40105. }),
  40106. $globals.SemanticAnalyzer);
  40107. $core.addMethod(
  40108. $core.method({
  40109. selector: "popScope",
  40110. protocol: "scope",
  40111. fn: function (){
  40112. var self=this,$self=this;
  40113. return $core.withContext(function($ctx1) {
  40114. var $1,$receiver;
  40115. $1=$self.currentScope;
  40116. if(($receiver = $1) == null || $receiver.a$nil){
  40117. $1;
  40118. } else {
  40119. $self.currentScope=$recv($self.currentScope)._outerScope();
  40120. $self.currentScope;
  40121. }
  40122. return self;
  40123. }, function($ctx1) {$ctx1.fill(self,"popScope",{})});
  40124. },
  40125. args: [],
  40126. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  40127. referencedClasses: [],
  40128. pragmas: [],
  40129. messageSends: ["ifNotNil:", "outerScope"]
  40130. }),
  40131. $globals.SemanticAnalyzer);
  40132. $core.addMethod(
  40133. $core.method({
  40134. selector: "pushScope:",
  40135. protocol: "scope",
  40136. fn: function (aScope){
  40137. var self=this,$self=this;
  40138. return $core.withContext(function($ctx1) {
  40139. $recv(aScope)._outerScope_($self.currentScope);
  40140. $self.currentScope=aScope;
  40141. return self;
  40142. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope})});
  40143. },
  40144. args: ["aScope"],
  40145. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  40146. referencedClasses: [],
  40147. pragmas: [],
  40148. messageSends: ["outerScope:"]
  40149. }),
  40150. $globals.SemanticAnalyzer);
  40151. $core.addMethod(
  40152. $core.method({
  40153. selector: "theClass",
  40154. protocol: "accessing",
  40155. fn: function (){
  40156. var self=this,$self=this;
  40157. return $self.theClass;
  40158. },
  40159. args: [],
  40160. source: "theClass\x0a\x09^ theClass",
  40161. referencedClasses: [],
  40162. pragmas: [],
  40163. messageSends: []
  40164. }),
  40165. $globals.SemanticAnalyzer);
  40166. $core.addMethod(
  40167. $core.method({
  40168. selector: "theClass:",
  40169. protocol: "accessing",
  40170. fn: function (aClass){
  40171. var self=this,$self=this;
  40172. $self.theClass=aClass;
  40173. return self;
  40174. },
  40175. args: ["aClass"],
  40176. source: "theClass: aClass\x0a\x09theClass := aClass",
  40177. referencedClasses: [],
  40178. pragmas: [],
  40179. messageSends: []
  40180. }),
  40181. $globals.SemanticAnalyzer);
  40182. $core.addMethod(
  40183. $core.method({
  40184. selector: "thePackage",
  40185. protocol: "accessing",
  40186. fn: function (){
  40187. var self=this,$self=this;
  40188. return $self.thePackage;
  40189. },
  40190. args: [],
  40191. source: "thePackage\x0a\x09^ thePackage",
  40192. referencedClasses: [],
  40193. pragmas: [],
  40194. messageSends: []
  40195. }),
  40196. $globals.SemanticAnalyzer);
  40197. $core.addMethod(
  40198. $core.method({
  40199. selector: "thePackage:",
  40200. protocol: "accessing",
  40201. fn: function (aPackage){
  40202. var self=this,$self=this;
  40203. $self.thePackage=aPackage;
  40204. return self;
  40205. },
  40206. args: ["aPackage"],
  40207. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  40208. referencedClasses: [],
  40209. pragmas: [],
  40210. messageSends: []
  40211. }),
  40212. $globals.SemanticAnalyzer);
  40213. $core.addMethod(
  40214. $core.method({
  40215. selector: "validateVariableScope:",
  40216. protocol: "scope",
  40217. fn: function (aString){
  40218. var self=this,$self=this;
  40219. return $core.withContext(function($ctx1) {
  40220. var $1,$receiver;
  40221. $1=$recv($self.currentScope)._lookupVariable_(aString);
  40222. if(($receiver = $1) == null || $receiver.a$nil){
  40223. $1;
  40224. } else {
  40225. $self._errorShadowingVariable_(aString);
  40226. }
  40227. return self;
  40228. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString})});
  40229. },
  40230. args: ["aString"],
  40231. 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 ]",
  40232. referencedClasses: [],
  40233. pragmas: [],
  40234. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  40235. }),
  40236. $globals.SemanticAnalyzer);
  40237. $core.addMethod(
  40238. $core.method({
  40239. selector: "visitAssignmentNode:",
  40240. protocol: "visiting",
  40241. fn: function (aNode){
  40242. var self=this,$self=this;
  40243. return $core.withContext(function($ctx1) {
  40244. (
  40245. $ctx1.supercall = true,
  40246. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  40247. $ctx1.supercall = false;
  40248. $recv($recv(aNode)._left())._beAssigned();
  40249. return self;
  40250. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
  40251. },
  40252. args: ["aNode"],
  40253. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  40254. referencedClasses: [],
  40255. pragmas: [],
  40256. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  40257. }),
  40258. $globals.SemanticAnalyzer);
  40259. $core.addMethod(
  40260. $core.method({
  40261. selector: "visitBlockNode:",
  40262. protocol: "visiting",
  40263. fn: function (aNode){
  40264. var self=this,$self=this;
  40265. return $core.withContext(function($ctx1) {
  40266. $self._pushScope_($self._newBlockScope());
  40267. $recv(aNode)._scope_($self.currentScope);
  40268. $recv($self.currentScope)._node_(aNode);
  40269. $recv($self.currentScope)._blockIndex_($self._nextBlockIndex());
  40270. $recv($recv(aNode)._parameters())._do_((function(each){
  40271. return $core.withContext(function($ctx2) {
  40272. $self._validateVariableScope_(each);
  40273. return $recv($self.currentScope)._addArg_(each);
  40274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40275. }));
  40276. (
  40277. $ctx1.supercall = true,
  40278. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  40279. $ctx1.supercall = false;
  40280. $self._popScope();
  40281. return self;
  40282. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  40283. },
  40284. args: ["aNode"],
  40285. 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",
  40286. referencedClasses: [],
  40287. pragmas: [],
  40288. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  40289. }),
  40290. $globals.SemanticAnalyzer);
  40291. $core.addMethod(
  40292. $core.method({
  40293. selector: "visitCascadeNode:",
  40294. protocol: "visiting",
  40295. fn: function (aNode){
  40296. var self=this,$self=this;
  40297. return $core.withContext(function($ctx1) {
  40298. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  40299. (
  40300. $ctx1.supercall = true,
  40301. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  40302. $ctx1.supercall = false;
  40303. return self;
  40304. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  40305. },
  40306. args: ["aNode"],
  40307. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  40308. referencedClasses: [],
  40309. pragmas: [],
  40310. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  40311. }),
  40312. $globals.SemanticAnalyzer);
  40313. $core.addMethod(
  40314. $core.method({
  40315. selector: "visitMethodNode:",
  40316. protocol: "visiting",
  40317. fn: function (aNode){
  40318. var self=this,$self=this;
  40319. return $core.withContext(function($ctx1) {
  40320. $self._pushScope_($self._newMethodScope());
  40321. $recv(aNode)._scope_($self.currentScope);
  40322. $recv($self.currentScope)._node_(aNode);
  40323. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  40324. return $core.withContext(function($ctx2) {
  40325. return $recv($self.currentScope)._addIVar_(each);
  40326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40327. }));
  40328. $ctx1.sendIdx["do:"]=1;
  40329. $recv($recv(aNode)._arguments())._do_((function(each){
  40330. return $core.withContext(function($ctx2) {
  40331. $self._validateVariableScope_(each);
  40332. return $recv($self.currentScope)._addArg_(each);
  40333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40334. }));
  40335. (
  40336. $ctx1.supercall = true,
  40337. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  40338. $ctx1.supercall = false;
  40339. $recv(aNode)._classReferences_($self._classReferences());
  40340. $recv(aNode)._sendIndexes_($self._messageSends());
  40341. $self._popScope();
  40342. return aNode;
  40343. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  40344. },
  40345. args: ["aNode"],
  40346. 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",
  40347. referencedClasses: [],
  40348. pragmas: [],
  40349. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  40350. }),
  40351. $globals.SemanticAnalyzer);
  40352. $core.addMethod(
  40353. $core.method({
  40354. selector: "visitReturnNode:",
  40355. protocol: "visiting",
  40356. fn: function (aNode){
  40357. var self=this,$self=this;
  40358. return $core.withContext(function($ctx1) {
  40359. var $1;
  40360. $recv(aNode)._scope_($self.currentScope);
  40361. $1=$recv($self.currentScope)._isMethodScope();
  40362. if($core.assert($1)){
  40363. $recv($self.currentScope)._localReturn_(true);
  40364. } else {
  40365. $recv($recv($self.currentScope)._methodScope())._addNonLocalReturn_($self.currentScope);
  40366. }
  40367. (
  40368. $ctx1.supercall = true,
  40369. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  40370. $ctx1.supercall = false;
  40371. return self;
  40372. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  40373. },
  40374. args: ["aNode"],
  40375. 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",
  40376. referencedClasses: [],
  40377. pragmas: [],
  40378. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  40379. }),
  40380. $globals.SemanticAnalyzer);
  40381. $core.addMethod(
  40382. $core.method({
  40383. selector: "visitSendNode:",
  40384. protocol: "visiting",
  40385. fn: function (aNode){
  40386. var self=this,$self=this;
  40387. var sends;
  40388. return $core.withContext(function($ctx1) {
  40389. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  40390. return $core.withContext(function($ctx2) {
  40391. return $recv($globals.OrderedCollection)._new();
  40392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40393. }));
  40394. $recv(sends)._add_(aNode);
  40395. $recv(aNode)._index_($recv(sends)._size());
  40396. (
  40397. $ctx1.supercall = true,
  40398. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  40399. $ctx1.supercall = false;
  40400. return self;
  40401. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends})});
  40402. },
  40403. args: ["aNode"],
  40404. 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",
  40405. referencedClasses: ["OrderedCollection"],
  40406. pragmas: [],
  40407. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  40408. }),
  40409. $globals.SemanticAnalyzer);
  40410. $core.addMethod(
  40411. $core.method({
  40412. selector: "visitSequenceNode:",
  40413. protocol: "visiting",
  40414. fn: function (aNode){
  40415. var self=this,$self=this;
  40416. return $core.withContext(function($ctx1) {
  40417. $recv($recv(aNode)._temps())._do_((function(each){
  40418. return $core.withContext(function($ctx2) {
  40419. $self._validateVariableScope_(each);
  40420. return $recv($self.currentScope)._addTemp_(each);
  40421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40422. }));
  40423. (
  40424. $ctx1.supercall = true,
  40425. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  40426. $ctx1.supercall = false;
  40427. return self;
  40428. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  40429. },
  40430. args: ["aNode"],
  40431. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  40432. referencedClasses: [],
  40433. pragmas: [],
  40434. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  40435. }),
  40436. $globals.SemanticAnalyzer);
  40437. $core.addMethod(
  40438. $core.method({
  40439. selector: "visitVariableNode:",
  40440. protocol: "visiting",
  40441. fn: function (aNode){
  40442. var self=this,$self=this;
  40443. var binding;
  40444. return $core.withContext(function($ctx1) {
  40445. var $1,$3,$2,$4,$5,$6,$7,$8,$receiver;
  40446. binding=$recv($self.currentScope)._lookupVariable_(aNode);
  40447. $1=binding;
  40448. if(($receiver = $1) == null || $receiver.a$nil){
  40449. $3=$recv(aNode)._value();
  40450. $ctx1.sendIdx["value"]=1;
  40451. $2=$recv($3)._isCapitalized();
  40452. if($core.assert($2)){
  40453. $4=$recv($globals.ClassRefVar)._new();
  40454. $ctx1.sendIdx["new"]=1;
  40455. $5=$recv(aNode)._value();
  40456. $ctx1.sendIdx["value"]=2;
  40457. $recv($4)._name_($5);
  40458. $ctx1.sendIdx["name:"]=1;
  40459. binding=$recv($4)._yourself();
  40460. $ctx1.sendIdx["yourself"]=1;
  40461. $6=$self._classReferences();
  40462. $7=$recv(aNode)._value();
  40463. $ctx1.sendIdx["value"]=3;
  40464. $recv($6)._add_($7);
  40465. } else {
  40466. $self._errorUnknownVariable_(aNode);
  40467. $8=$recv($globals.UnknownVar)._new();
  40468. $recv($8)._name_($recv(aNode)._value());
  40469. binding=$recv($8)._yourself();
  40470. binding;
  40471. }
  40472. } else {
  40473. $1;
  40474. }
  40475. $recv(aNode)._binding_(binding);
  40476. return self;
  40477. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding})});
  40478. },
  40479. args: ["aNode"],
  40480. 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.",
  40481. referencedClasses: ["ClassRefVar", "UnknownVar"],
  40482. pragmas: [],
  40483. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  40484. }),
  40485. $globals.SemanticAnalyzer);
  40486. $core.addMethod(
  40487. $core.method({
  40488. selector: "on:",
  40489. protocol: "instance creation",
  40490. fn: function (aClass){
  40491. var self=this,$self=this;
  40492. return $core.withContext(function($ctx1) {
  40493. var $1;
  40494. $1=$self._new();
  40495. $recv($1)._theClass_(aClass);
  40496. return $recv($1)._yourself();
  40497. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  40498. },
  40499. args: ["aClass"],
  40500. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  40501. referencedClasses: [],
  40502. pragmas: [],
  40503. messageSends: ["theClass:", "new", "yourself"]
  40504. }),
  40505. $globals.SemanticAnalyzer.a$cls);
  40506. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  40507. $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";
  40508. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40509. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  40510. $core.addMethod(
  40511. $core.method({
  40512. selector: "messageText",
  40513. protocol: "accessing",
  40514. fn: function (){
  40515. var self=this,$self=this;
  40516. return $core.withContext(function($ctx1) {
  40517. return " Invalid assignment to variable: ".__comma($self._variableName());
  40518. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40519. },
  40520. args: [],
  40521. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  40522. referencedClasses: [],
  40523. pragmas: [],
  40524. messageSends: [",", "variableName"]
  40525. }),
  40526. $globals.InvalidAssignmentError);
  40527. $core.addMethod(
  40528. $core.method({
  40529. selector: "variableName",
  40530. protocol: "accessing",
  40531. fn: function (){
  40532. var self=this,$self=this;
  40533. return $self.variableName;
  40534. },
  40535. args: [],
  40536. source: "variableName\x0a\x09^ variableName",
  40537. referencedClasses: [],
  40538. pragmas: [],
  40539. messageSends: []
  40540. }),
  40541. $globals.InvalidAssignmentError);
  40542. $core.addMethod(
  40543. $core.method({
  40544. selector: "variableName:",
  40545. protocol: "accessing",
  40546. fn: function (aString){
  40547. var self=this,$self=this;
  40548. $self.variableName=aString;
  40549. return self;
  40550. },
  40551. args: ["aString"],
  40552. source: "variableName: aString\x0a\x09variableName := aString",
  40553. referencedClasses: [],
  40554. pragmas: [],
  40555. messageSends: []
  40556. }),
  40557. $globals.InvalidAssignmentError);
  40558. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40559. $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.";
  40560. $core.addMethod(
  40561. $core.method({
  40562. selector: "messageText",
  40563. protocol: "accessing",
  40564. fn: function (){
  40565. var self=this,$self=this;
  40566. return $core.withContext(function($ctx1) {
  40567. var $1;
  40568. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  40569. $ctx1.sendIdx[","]=1;
  40570. return $1;
  40571. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40572. },
  40573. args: [],
  40574. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  40575. referencedClasses: [],
  40576. pragmas: [],
  40577. messageSends: [",", "variableName"]
  40578. }),
  40579. $globals.ShadowingVariableError);
  40580. $core.addMethod(
  40581. $core.method({
  40582. selector: "variableName",
  40583. protocol: "accessing",
  40584. fn: function (){
  40585. var self=this,$self=this;
  40586. return $self.variableName;
  40587. },
  40588. args: [],
  40589. source: "variableName\x0a\x09^ variableName",
  40590. referencedClasses: [],
  40591. pragmas: [],
  40592. messageSends: []
  40593. }),
  40594. $globals.ShadowingVariableError);
  40595. $core.addMethod(
  40596. $core.method({
  40597. selector: "variableName:",
  40598. protocol: "accessing",
  40599. fn: function (aString){
  40600. var self=this,$self=this;
  40601. $self.variableName=aString;
  40602. return self;
  40603. },
  40604. args: ["aString"],
  40605. source: "variableName: aString\x0a\x09variableName := aString",
  40606. referencedClasses: [],
  40607. pragmas: [],
  40608. messageSends: []
  40609. }),
  40610. $globals.ShadowingVariableError);
  40611. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  40612. $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.";
  40613. $core.addMethod(
  40614. $core.method({
  40615. selector: "messageText",
  40616. protocol: "accessing",
  40617. fn: function (){
  40618. var self=this,$self=this;
  40619. return $core.withContext(function($ctx1) {
  40620. var $1;
  40621. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  40622. $ctx1.sendIdx[","]=1;
  40623. return $1;
  40624. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  40625. },
  40626. args: [],
  40627. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  40628. referencedClasses: [],
  40629. pragmas: [],
  40630. messageSends: [",", "variableName"]
  40631. }),
  40632. $globals.UnknownVariableError);
  40633. $core.addMethod(
  40634. $core.method({
  40635. selector: "variableName",
  40636. protocol: "accessing",
  40637. fn: function (){
  40638. var self=this,$self=this;
  40639. return $self.variableName;
  40640. },
  40641. args: [],
  40642. source: "variableName\x0a\x09^ variableName",
  40643. referencedClasses: [],
  40644. pragmas: [],
  40645. messageSends: []
  40646. }),
  40647. $globals.UnknownVariableError);
  40648. $core.addMethod(
  40649. $core.method({
  40650. selector: "variableName:",
  40651. protocol: "accessing",
  40652. fn: function (aString){
  40653. var self=this,$self=this;
  40654. $self.variableName=aString;
  40655. return self;
  40656. },
  40657. args: ["aString"],
  40658. source: "variableName: aString\x0a\x09variableName := aString",
  40659. referencedClasses: [],
  40660. pragmas: [],
  40661. messageSends: []
  40662. }),
  40663. $globals.UnknownVariableError);
  40664. });
  40665. define('amber/core/Compiler-IR',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Dag", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  40666. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40667. var $pkg = $core.addPackage("Compiler-IR");
  40668. $pkg.innerEval = function (expr) { return eval(expr); };
  40669. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  40670. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  40671. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  40672. $core.addMethod(
  40673. $core.method({
  40674. selector: "addToSequence:",
  40675. protocol: "visiting",
  40676. fn: function (anInstruction){
  40677. var self=this,$self=this;
  40678. return $core.withContext(function($ctx1) {
  40679. var $1,$receiver;
  40680. if(($receiver = anInstruction) == null || $receiver.a$nil){
  40681. anInstruction;
  40682. } else {
  40683. $1=$recv(anInstruction)._isVariable();
  40684. if(!$core.assert($1)){
  40685. $recv($self._sequence())._add_(anInstruction);
  40686. }
  40687. }
  40688. return anInstruction;
  40689. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction})});
  40690. },
  40691. args: ["anInstruction"],
  40692. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  40693. referencedClasses: [],
  40694. pragmas: [],
  40695. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  40696. }),
  40697. $globals.IRASTTranslator);
  40698. $core.addMethod(
  40699. $core.method({
  40700. selector: "alias:",
  40701. protocol: "visiting",
  40702. fn: function (aNode){
  40703. var self=this,$self=this;
  40704. var variable;
  40705. return $core.withContext(function($ctx1) {
  40706. var $1,$2,$3,$5,$4,$7,$6;
  40707. $1=$recv(aNode)._isImmutable();
  40708. if($core.assert($1)){
  40709. $2=$self._visit_(aNode);
  40710. $ctx1.sendIdx["visit:"]=1;
  40711. return $2;
  40712. }
  40713. $3=$recv($globals.IRVariable)._new();
  40714. $ctx1.sendIdx["new"]=1;
  40715. $5=$recv($globals.AliasVar)._new();
  40716. $ctx1.sendIdx["new"]=2;
  40717. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  40718. $recv($3)._variable_($4);
  40719. variable=$recv($3)._yourself();
  40720. $ctx1.sendIdx["yourself"]=1;
  40721. $7=$recv($globals.IRAssignment)._new();
  40722. $recv($7)._add_(variable);
  40723. $ctx1.sendIdx["add:"]=1;
  40724. $recv($7)._add_($self._visit_(aNode));
  40725. $ctx1.sendIdx["add:"]=2;
  40726. $6=$recv($7)._yourself();
  40727. $self._addToSequence_($6);
  40728. $recv($recv($self._method())._internalVariables())._add_(variable);
  40729. return variable;
  40730. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable})});
  40731. },
  40732. args: ["aNode"],
  40733. 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",
  40734. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  40735. pragmas: [],
  40736. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  40737. }),
  40738. $globals.IRASTTranslator);
  40739. $core.addMethod(
  40740. $core.method({
  40741. selector: "aliasTemporally:",
  40742. protocol: "visiting",
  40743. fn: function (aCollection){
  40744. var self=this,$self=this;
  40745. var threshold,result;
  40746. return $core.withContext(function($ctx1) {
  40747. var $1,$2,$4,$3;
  40748. threshold=(0);
  40749. $recv(aCollection)._withIndexDo_((function(each,i){
  40750. return $core.withContext(function($ctx2) {
  40751. $1=$recv(each)._subtreeNeedsAliasing();
  40752. if($core.assert($1)){
  40753. threshold=i;
  40754. return threshold;
  40755. }
  40756. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  40757. }));
  40758. $ctx1.sendIdx["withIndexDo:"]=1;
  40759. result=$recv($globals.OrderedCollection)._new();
  40760. $recv(aCollection)._withIndexDo_((function(each,i){
  40761. return $core.withContext(function($ctx2) {
  40762. $2=result;
  40763. $4=$recv(i).__lt_eq(threshold);
  40764. if($core.assert($4)){
  40765. $3=$self._alias_(each);
  40766. } else {
  40767. $3=$self._visit_(each);
  40768. }
  40769. return $recv($2)._add_($3);
  40770. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  40771. }));
  40772. return result;
  40773. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result})});
  40774. },
  40775. args: ["aCollection"],
  40776. 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",
  40777. referencedClasses: ["OrderedCollection"],
  40778. pragmas: [],
  40779. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  40780. }),
  40781. $globals.IRASTTranslator);
  40782. $core.addMethod(
  40783. $core.method({
  40784. selector: "method",
  40785. protocol: "accessing",
  40786. fn: function (){
  40787. var self=this,$self=this;
  40788. return $self.method;
  40789. },
  40790. args: [],
  40791. source: "method\x0a\x09^ method",
  40792. referencedClasses: [],
  40793. pragmas: [],
  40794. messageSends: []
  40795. }),
  40796. $globals.IRASTTranslator);
  40797. $core.addMethod(
  40798. $core.method({
  40799. selector: "method:",
  40800. protocol: "accessing",
  40801. fn: function (anIRMethod){
  40802. var self=this,$self=this;
  40803. $self.method=anIRMethod;
  40804. return self;
  40805. },
  40806. args: ["anIRMethod"],
  40807. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  40808. referencedClasses: [],
  40809. pragmas: [],
  40810. messageSends: []
  40811. }),
  40812. $globals.IRASTTranslator);
  40813. $core.addMethod(
  40814. $core.method({
  40815. selector: "nextAlias",
  40816. protocol: "accessing",
  40817. fn: function (){
  40818. var self=this,$self=this;
  40819. return $core.withContext(function($ctx1) {
  40820. var $1,$receiver;
  40821. $1=$self.nextAlias;
  40822. if(($receiver = $1) == null || $receiver.a$nil){
  40823. $self.nextAlias=(0);
  40824. $self.nextAlias;
  40825. } else {
  40826. $1;
  40827. }
  40828. $self.nextAlias=$recv($self.nextAlias).__plus((1));
  40829. return $recv($self.nextAlias)._asString();
  40830. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{})});
  40831. },
  40832. args: [],
  40833. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  40834. referencedClasses: [],
  40835. pragmas: [],
  40836. messageSends: ["ifNil:", "+", "asString"]
  40837. }),
  40838. $globals.IRASTTranslator);
  40839. $core.addMethod(
  40840. $core.method({
  40841. selector: "sequence",
  40842. protocol: "accessing",
  40843. fn: function (){
  40844. var self=this,$self=this;
  40845. return $self.sequence;
  40846. },
  40847. args: [],
  40848. source: "sequence\x0a\x09^ sequence",
  40849. referencedClasses: [],
  40850. pragmas: [],
  40851. messageSends: []
  40852. }),
  40853. $globals.IRASTTranslator);
  40854. $core.addMethod(
  40855. $core.method({
  40856. selector: "sequence:",
  40857. protocol: "accessing",
  40858. fn: function (anIRSequence){
  40859. var self=this,$self=this;
  40860. $self.sequence=anIRSequence;
  40861. return self;
  40862. },
  40863. args: ["anIRSequence"],
  40864. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  40865. referencedClasses: [],
  40866. pragmas: [],
  40867. messageSends: []
  40868. }),
  40869. $globals.IRASTTranslator);
  40870. $core.addMethod(
  40871. $core.method({
  40872. selector: "source",
  40873. protocol: "accessing",
  40874. fn: function (){
  40875. var self=this,$self=this;
  40876. return $self.source;
  40877. },
  40878. args: [],
  40879. source: "source\x0a\x09^ source",
  40880. referencedClasses: [],
  40881. pragmas: [],
  40882. messageSends: []
  40883. }),
  40884. $globals.IRASTTranslator);
  40885. $core.addMethod(
  40886. $core.method({
  40887. selector: "source:",
  40888. protocol: "accessing",
  40889. fn: function (aString){
  40890. var self=this,$self=this;
  40891. $self.source=aString;
  40892. return self;
  40893. },
  40894. args: ["aString"],
  40895. source: "source: aString\x0a\x09source := aString",
  40896. referencedClasses: [],
  40897. pragmas: [],
  40898. messageSends: []
  40899. }),
  40900. $globals.IRASTTranslator);
  40901. $core.addMethod(
  40902. $core.method({
  40903. selector: "theClass",
  40904. protocol: "accessing",
  40905. fn: function (){
  40906. var self=this,$self=this;
  40907. return $self.theClass;
  40908. },
  40909. args: [],
  40910. source: "theClass\x0a\x09^ theClass",
  40911. referencedClasses: [],
  40912. pragmas: [],
  40913. messageSends: []
  40914. }),
  40915. $globals.IRASTTranslator);
  40916. $core.addMethod(
  40917. $core.method({
  40918. selector: "theClass:",
  40919. protocol: "accessing",
  40920. fn: function (aClass){
  40921. var self=this,$self=this;
  40922. $self.theClass=aClass;
  40923. return self;
  40924. },
  40925. args: ["aClass"],
  40926. source: "theClass: aClass\x0a\x09theClass := aClass",
  40927. referencedClasses: [],
  40928. pragmas: [],
  40929. messageSends: []
  40930. }),
  40931. $globals.IRASTTranslator);
  40932. $core.addMethod(
  40933. $core.method({
  40934. selector: "visitAssignmentNode:",
  40935. protocol: "visiting",
  40936. fn: function (aNode){
  40937. var self=this,$self=this;
  40938. var left,right,assignment;
  40939. return $core.withContext(function($ctx1) {
  40940. var $2,$1;
  40941. right=$self._visit_($recv(aNode)._right());
  40942. $ctx1.sendIdx["visit:"]=1;
  40943. left=$self._visit_($recv(aNode)._left());
  40944. $2=$recv($globals.IRAssignment)._new();
  40945. $recv($2)._add_(left);
  40946. $ctx1.sendIdx["add:"]=1;
  40947. $recv($2)._add_(right);
  40948. $1=$recv($2)._yourself();
  40949. $self._addToSequence_($1);
  40950. return left;
  40951. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment})});
  40952. },
  40953. args: ["aNode"],
  40954. 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",
  40955. referencedClasses: ["IRAssignment"],
  40956. pragmas: [],
  40957. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  40958. }),
  40959. $globals.IRASTTranslator);
  40960. $core.addMethod(
  40961. $core.method({
  40962. selector: "visitBlockNode:",
  40963. protocol: "visiting",
  40964. fn: function (aNode){
  40965. var self=this,$self=this;
  40966. var closure;
  40967. return $core.withContext(function($ctx1) {
  40968. var $1,$2,$4,$3,$5,$7,$6;
  40969. $1=$recv($globals.IRClosure)._new();
  40970. $ctx1.sendIdx["new"]=1;
  40971. $recv($1)._arguments_($recv(aNode)._parameters());
  40972. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  40973. $2=$recv(aNode)._scope();
  40974. $ctx1.sendIdx["scope"]=1;
  40975. $recv($1)._scope_($2);
  40976. $ctx1.sendIdx["scope:"]=1;
  40977. closure=$recv($1)._yourself();
  40978. $ctx1.sendIdx["yourself"]=1;
  40979. $4=$recv(aNode)._scope();
  40980. $ctx1.sendIdx["scope"]=2;
  40981. $3=$recv($4)._temps();
  40982. $recv($3)._do_((function(each){
  40983. return $core.withContext(function($ctx2) {
  40984. $5=closure;
  40985. $7=$recv($globals.IRTempDeclaration)._new();
  40986. $recv($7)._name_($recv(each)._name());
  40987. $recv($7)._scope_($recv(aNode)._scope());
  40988. $6=$recv($7)._yourself();
  40989. return $recv($5)._add_($6);
  40990. $ctx2.sendIdx["add:"]=1;
  40991. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40992. }));
  40993. $ctx1.sendIdx["do:"]=1;
  40994. $recv($recv(aNode)._dagChildren())._do_((function(each){
  40995. return $core.withContext(function($ctx2) {
  40996. return $recv(closure)._add_($self._visit_(each));
  40997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40998. }));
  40999. return closure;
  41000. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure})});
  41001. },
  41002. args: ["aNode"],
  41003. 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",
  41004. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  41005. pragmas: [],
  41006. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  41007. }),
  41008. $globals.IRASTTranslator);
  41009. $core.addMethod(
  41010. $core.method({
  41011. selector: "visitBlockSequenceNode:",
  41012. protocol: "visiting",
  41013. fn: function (aNode){
  41014. var self=this,$self=this;
  41015. return $core.withContext(function($ctx1) {
  41016. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  41017. $1=$recv($globals.IRBlockSequence)._new();
  41018. $ctx1.sendIdx["new"]=1;
  41019. return $self._withSequence_do_($1,(function(){
  41020. return $core.withContext(function($ctx2) {
  41021. $2=$recv(aNode)._dagChildren();
  41022. $ctx2.sendIdx["dagChildren"]=1;
  41023. return $recv($2)._ifNotEmpty_((function(){
  41024. return $core.withContext(function($ctx3) {
  41025. $4=$recv(aNode)._dagChildren();
  41026. $ctx3.sendIdx["dagChildren"]=2;
  41027. $3=$recv($4)._allButLast();
  41028. $recv($3)._do_((function(each){
  41029. return $core.withContext(function($ctx4) {
  41030. $5=$self._visitOrAlias_(each);
  41031. $ctx4.sendIdx["visitOrAlias:"]=1;
  41032. return $self._addToSequence_($5);
  41033. $ctx4.sendIdx["addToSequence:"]=1;
  41034. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41035. }));
  41036. $8=$recv(aNode)._dagChildren();
  41037. $ctx3.sendIdx["dagChildren"]=3;
  41038. $7=$recv($8)._last();
  41039. $ctx3.sendIdx["last"]=1;
  41040. $6=$recv($7)._isReturnNode();
  41041. if($core.assert($6)){
  41042. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  41043. } else {
  41044. $10=$recv($globals.IRBlockReturn)._new();
  41045. $13=$recv(aNode)._dagChildren();
  41046. $ctx3.sendIdx["dagChildren"]=4;
  41047. $12=$recv($13)._last();
  41048. $ctx3.sendIdx["last"]=2;
  41049. $11=$self._visitOrAlias_($12);
  41050. $ctx3.sendIdx["visitOrAlias:"]=2;
  41051. $recv($10)._add_($11);
  41052. $9=$recv($10)._yourself();
  41053. return $self._addToSequence_($9);
  41054. $ctx3.sendIdx["addToSequence:"]=2;
  41055. }
  41056. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41057. }));
  41058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41059. }));
  41060. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  41061. },
  41062. args: ["aNode"],
  41063. 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) ] ]]",
  41064. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  41065. pragmas: [],
  41066. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  41067. }),
  41068. $globals.IRASTTranslator);
  41069. $core.addMethod(
  41070. $core.method({
  41071. selector: "visitCascadeNode:",
  41072. protocol: "visiting",
  41073. fn: function (aNode){
  41074. var self=this,$self=this;
  41075. var receiver;
  41076. return $core.withContext(function($ctx1) {
  41077. var $1,$2,$4,$3;
  41078. receiver=$recv(aNode)._receiver();
  41079. $1=$recv(receiver)._isImmutable();
  41080. if(!$core.assert($1)){
  41081. var alias;
  41082. alias=$self._alias_(receiver);
  41083. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  41084. receiver;
  41085. }
  41086. $2=$recv(aNode)._dagChildren();
  41087. $ctx1.sendIdx["dagChildren"]=1;
  41088. $recv($2)._do_((function(each){
  41089. return $core.withContext(function($ctx2) {
  41090. return $recv(each)._receiver_(receiver);
  41091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41092. }));
  41093. $ctx1.sendIdx["do:"]=1;
  41094. $4=$recv(aNode)._dagChildren();
  41095. $ctx1.sendIdx["dagChildren"]=2;
  41096. $3=$recv($4)._allButLast();
  41097. $recv($3)._do_((function(each){
  41098. return $core.withContext(function($ctx2) {
  41099. return $self._addToSequence_($self._visit_(each));
  41100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41101. }));
  41102. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  41103. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver})});
  41104. },
  41105. args: ["aNode"],
  41106. 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",
  41107. referencedClasses: ["VariableNode"],
  41108. pragmas: [],
  41109. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  41110. }),
  41111. $globals.IRASTTranslator);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "visitDynamicArrayNode:",
  41115. protocol: "visiting",
  41116. fn: function (aNode){
  41117. var self=this,$self=this;
  41118. var array;
  41119. return $core.withContext(function($ctx1) {
  41120. array=$recv($globals.IRDynamicArray)._new();
  41121. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41122. return $core.withContext(function($ctx2) {
  41123. return $recv(array)._add_(each);
  41124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41125. }));
  41126. return array;
  41127. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  41128. },
  41129. args: ["aNode"],
  41130. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  41131. referencedClasses: ["IRDynamicArray"],
  41132. pragmas: [],
  41133. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41134. }),
  41135. $globals.IRASTTranslator);
  41136. $core.addMethod(
  41137. $core.method({
  41138. selector: "visitDynamicDictionaryNode:",
  41139. protocol: "visiting",
  41140. fn: function (aNode){
  41141. var self=this,$self=this;
  41142. var dictionary;
  41143. return $core.withContext(function($ctx1) {
  41144. dictionary=$recv($globals.IRDynamicDictionary)._new();
  41145. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41146. return $core.withContext(function($ctx2) {
  41147. return $recv(dictionary)._add_(each);
  41148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41149. }));
  41150. return dictionary;
  41151. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary})});
  41152. },
  41153. args: ["aNode"],
  41154. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  41155. referencedClasses: ["IRDynamicDictionary"],
  41156. pragmas: [],
  41157. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41158. }),
  41159. $globals.IRASTTranslator);
  41160. $core.addMethod(
  41161. $core.method({
  41162. selector: "visitJSStatementNode:",
  41163. protocol: "visiting",
  41164. fn: function (aNode){
  41165. var self=this,$self=this;
  41166. return $core.withContext(function($ctx1) {
  41167. var $1;
  41168. $1=$recv($globals.IRVerbatim)._new();
  41169. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  41170. return $recv($1)._yourself();
  41171. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  41172. },
  41173. args: ["aNode"],
  41174. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  41175. referencedClasses: ["IRVerbatim"],
  41176. pragmas: [],
  41177. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  41178. }),
  41179. $globals.IRASTTranslator);
  41180. $core.addMethod(
  41181. $core.method({
  41182. selector: "visitMethodNode:",
  41183. protocol: "visiting",
  41184. fn: function (aNode){
  41185. var self=this,$self=this;
  41186. return $core.withContext(function($ctx1) {
  41187. var $2,$3,$5,$7,$8,$6,$4,$9,$10,$1,$12,$11,$13,$15,$16,$17,$14,$18,$20,$19,$21,$23,$25,$26,$24,$27,$22,$29,$28;
  41188. $2=$recv($globals.IRMethod)._new();
  41189. $ctx1.sendIdx["new"]=1;
  41190. $3=$recv($self._source())._crlfSanitized();
  41191. $ctx1.sendIdx["crlfSanitized"]=1;
  41192. $recv($2)._source_($3);
  41193. $ctx1.sendIdx["source:"]=1;
  41194. $4=$recv($recv(aNode)._pragmas())._collect_((function(each){
  41195. return $core.withContext(function($ctx2) {
  41196. $5=$recv(each)._selector();
  41197. $ctx2.sendIdx["selector"]=1;
  41198. $7=$recv(each)._arguments();
  41199. $ctx2.sendIdx["arguments"]=1;
  41200. $6=$recv($7)._collect_((function(eachArg){
  41201. return $core.withContext(function($ctx3) {
  41202. $8=$recv(eachArg)._isString();
  41203. if($core.assert($8)){
  41204. return $recv(eachArg)._crlfSanitized();
  41205. } else {
  41206. return eachArg;
  41207. }
  41208. }, function($ctx3) {$ctx3.fillBlock({eachArg:eachArg},$ctx2,2)});
  41209. }));
  41210. return $recv($globals.Message)._selector_arguments_($5,$6);
  41211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41212. }));
  41213. $ctx1.sendIdx["collect:"]=1;
  41214. $recv($2)._pragmas_($4);
  41215. $recv($2)._theClass_($self._theClass());
  41216. $recv($2)._arguments_($recv(aNode)._arguments());
  41217. $recv($2)._selector_($recv(aNode)._selector());
  41218. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  41219. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  41220. $recv($2)._classReferences_($recv(aNode)._classReferences());
  41221. $9=$recv(aNode)._scope();
  41222. $ctx1.sendIdx["scope"]=1;
  41223. $recv($2)._scope_($9);
  41224. $ctx1.sendIdx["scope:"]=1;
  41225. $10=$recv($2)._yourself();
  41226. $ctx1.sendIdx["yourself"]=1;
  41227. $1=$10;
  41228. $self._method_($1);
  41229. $12=$recv(aNode)._scope();
  41230. $ctx1.sendIdx["scope"]=2;
  41231. $11=$recv($12)._temps();
  41232. $recv($11)._do_((function(each){
  41233. return $core.withContext(function($ctx2) {
  41234. $13=$self._method();
  41235. $ctx2.sendIdx["method"]=1;
  41236. $15=$recv($globals.IRTempDeclaration)._new();
  41237. $ctx2.sendIdx["new"]=2;
  41238. $recv($15)._name_($recv(each)._name());
  41239. $16=$recv(aNode)._scope();
  41240. $ctx2.sendIdx["scope"]=3;
  41241. $recv($15)._scope_($16);
  41242. $17=$recv($15)._yourself();
  41243. $ctx2.sendIdx["yourself"]=2;
  41244. $14=$17;
  41245. return $recv($13)._add_($14);
  41246. $ctx2.sendIdx["add:"]=1;
  41247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  41248. }));
  41249. $ctx1.sendIdx["do:"]=1;
  41250. $recv($recv(aNode)._dagChildren())._do_((function(each){
  41251. return $core.withContext(function($ctx2) {
  41252. $18=$self._method();
  41253. $ctx2.sendIdx["method"]=2;
  41254. return $recv($18)._add_($self._visit_(each));
  41255. $ctx2.sendIdx["add:"]=2;
  41256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  41257. }));
  41258. $20=$recv(aNode)._scope();
  41259. $ctx1.sendIdx["scope"]=4;
  41260. $19=$recv($20)._hasLocalReturn();
  41261. if(!$core.assert($19)){
  41262. $21=$self._method();
  41263. $ctx1.sendIdx["method"]=3;
  41264. $23=$recv($globals.IRReturn)._new();
  41265. $ctx1.sendIdx["new"]=3;
  41266. $25=$recv($globals.IRVariable)._new();
  41267. $ctx1.sendIdx["new"]=4;
  41268. $recv($25)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  41269. $26=$recv($25)._yourself();
  41270. $ctx1.sendIdx["yourself"]=3;
  41271. $24=$26;
  41272. $recv($23)._add_($24);
  41273. $ctx1.sendIdx["add:"]=4;
  41274. $27=$recv($23)._yourself();
  41275. $ctx1.sendIdx["yourself"]=4;
  41276. $22=$27;
  41277. $recv($21)._add_($22);
  41278. $ctx1.sendIdx["add:"]=3;
  41279. $29=$recv($globals.IRVerbatim)._new();
  41280. $recv($29)._source_(";".__comma($recv($globals.String)._lf()));
  41281. $28=$recv($29)._yourself();
  41282. $recv($21)._add_($28);
  41283. }
  41284. return $self._method();
  41285. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  41286. },
  41287. args: ["aNode"],
  41288. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09pragmas: (aNode pragmas collect: [ :each |\x0a\x09\x09\x09Message\x0a\x09\x09\x09\x09selector: each\x0a\x09\x09\x09\x09selector arguments: (each arguments collect: [ :eachArg |\x0a\x09\x09\x09\x09\x09eachArg isString ifTrue: [ eachArg crlfSanitized ] ifFalse: [ eachArg ]])]);\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",
  41289. referencedClasses: ["IRMethod", "Message", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  41290. pragmas: [],
  41291. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "pragmas:", "collect:", "pragmas", "selector:arguments:", "selector", "arguments", "ifTrue:ifFalse:", "isString", "theClass:", "theClass", "arguments:", "selector:", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  41292. }),
  41293. $globals.IRASTTranslator);
  41294. $core.addMethod(
  41295. $core.method({
  41296. selector: "visitOrAlias:",
  41297. protocol: "visiting",
  41298. fn: function (aNode){
  41299. var self=this,$self=this;
  41300. return $core.withContext(function($ctx1) {
  41301. var $1;
  41302. $1=$recv(aNode)._shouldBeAliased();
  41303. if($core.assert($1)){
  41304. return $self._alias_(aNode);
  41305. } else {
  41306. return $self._visit_(aNode);
  41307. }
  41308. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode})});
  41309. },
  41310. args: ["aNode"],
  41311. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  41312. referencedClasses: [],
  41313. pragmas: [],
  41314. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  41315. }),
  41316. $globals.IRASTTranslator);
  41317. $core.addMethod(
  41318. $core.method({
  41319. selector: "visitReturnNode:",
  41320. protocol: "visiting",
  41321. fn: function (aNode){
  41322. var self=this,$self=this;
  41323. var return_;
  41324. return $core.withContext(function($ctx1) {
  41325. var $1;
  41326. $1=$recv(aNode)._nonLocalReturn();
  41327. if($core.assert($1)){
  41328. return_=$recv($globals.IRNonLocalReturn)._new();
  41329. $ctx1.sendIdx["new"]=1;
  41330. } else {
  41331. return_=$recv($globals.IRReturn)._new();
  41332. }
  41333. $recv(return_)._scope_($recv(aNode)._scope());
  41334. $recv($recv(aNode)._dagChildren())._do_((function(each){
  41335. return $core.withContext(function($ctx2) {
  41336. return $recv(return_)._add_($self._visitOrAlias_(each));
  41337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41338. }));
  41339. return return_;
  41340. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_})});
  41341. },
  41342. args: ["aNode"],
  41343. 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",
  41344. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  41345. pragmas: [],
  41346. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  41347. }),
  41348. $globals.IRASTTranslator);
  41349. $core.addMethod(
  41350. $core.method({
  41351. selector: "visitSendNode:",
  41352. protocol: "visiting",
  41353. fn: function (aNode){
  41354. var self=this,$self=this;
  41355. var send;
  41356. return $core.withContext(function($ctx1) {
  41357. var $1;
  41358. send=$recv($globals.IRSend)._new();
  41359. $1=send;
  41360. $recv($1)._selector_($recv(aNode)._selector());
  41361. $recv($1)._index_($recv(aNode)._index());
  41362. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  41363. return $core.withContext(function($ctx2) {
  41364. return $recv(send)._add_(each);
  41365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41366. }));
  41367. return send;
  41368. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send})});
  41369. },
  41370. args: ["aNode"],
  41371. 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",
  41372. referencedClasses: ["IRSend"],
  41373. pragmas: [],
  41374. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  41375. }),
  41376. $globals.IRASTTranslator);
  41377. $core.addMethod(
  41378. $core.method({
  41379. selector: "visitSequenceNode:",
  41380. protocol: "visiting",
  41381. fn: function (aNode){
  41382. var self=this,$self=this;
  41383. return $core.withContext(function($ctx1) {
  41384. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  41385. return $core.withContext(function($ctx2) {
  41386. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  41387. return $core.withContext(function($ctx3) {
  41388. return $self._addToSequence_($self._visitOrAlias_(each));
  41389. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41390. }));
  41391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41392. }));
  41393. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  41394. },
  41395. args: ["aNode"],
  41396. 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) ] ]",
  41397. referencedClasses: ["IRSequence"],
  41398. pragmas: [],
  41399. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  41400. }),
  41401. $globals.IRASTTranslator);
  41402. $core.addMethod(
  41403. $core.method({
  41404. selector: "visitValueNode:",
  41405. protocol: "visiting",
  41406. fn: function (aNode){
  41407. var self=this,$self=this;
  41408. return $core.withContext(function($ctx1) {
  41409. var $1;
  41410. $1=$recv($globals.IRValue)._new();
  41411. $recv($1)._value_($recv(aNode)._value());
  41412. return $recv($1)._yourself();
  41413. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  41414. },
  41415. args: ["aNode"],
  41416. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  41417. referencedClasses: ["IRValue"],
  41418. pragmas: [],
  41419. messageSends: ["value:", "new", "value", "yourself"]
  41420. }),
  41421. $globals.IRASTTranslator);
  41422. $core.addMethod(
  41423. $core.method({
  41424. selector: "visitVariableNode:",
  41425. protocol: "visiting",
  41426. fn: function (aNode){
  41427. var self=this,$self=this;
  41428. return $core.withContext(function($ctx1) {
  41429. var $1;
  41430. $1=$recv($globals.IRVariable)._new();
  41431. $recv($1)._variable_($recv(aNode)._binding());
  41432. return $recv($1)._yourself();
  41433. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  41434. },
  41435. args: ["aNode"],
  41436. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  41437. referencedClasses: ["IRVariable"],
  41438. pragmas: [],
  41439. messageSends: ["variable:", "new", "binding", "yourself"]
  41440. }),
  41441. $globals.IRASTTranslator);
  41442. $core.addMethod(
  41443. $core.method({
  41444. selector: "withSequence:do:",
  41445. protocol: "accessing",
  41446. fn: function (aSequence,aBlock){
  41447. var self=this,$self=this;
  41448. var outerSequence;
  41449. return $core.withContext(function($ctx1) {
  41450. outerSequence=$self._sequence();
  41451. $self._sequence_(aSequence);
  41452. $ctx1.sendIdx["sequence:"]=1;
  41453. $recv(aBlock)._value();
  41454. $self._sequence_(outerSequence);
  41455. return aSequence;
  41456. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence})});
  41457. },
  41458. args: ["aSequence", "aBlock"],
  41459. 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",
  41460. referencedClasses: [],
  41461. pragmas: [],
  41462. messageSends: ["sequence", "sequence:", "value"]
  41463. }),
  41464. $globals.IRASTTranslator);
  41465. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  41466. $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.";
  41467. $core.addMethod(
  41468. $core.method({
  41469. selector: "add:",
  41470. protocol: "building",
  41471. fn: function (anObject){
  41472. var self=this,$self=this;
  41473. return $core.withContext(function($ctx1) {
  41474. $recv(anObject)._parent_(self);
  41475. return $recv($self._dagChildren())._add_(anObject);
  41476. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  41477. },
  41478. args: ["anObject"],
  41479. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  41480. referencedClasses: [],
  41481. pragmas: [],
  41482. messageSends: ["parent:", "add:", "dagChildren"]
  41483. }),
  41484. $globals.IRInstruction);
  41485. $core.addMethod(
  41486. $core.method({
  41487. selector: "isClosure",
  41488. protocol: "testing",
  41489. fn: function (){
  41490. var self=this,$self=this;
  41491. return false;
  41492. },
  41493. args: [],
  41494. source: "isClosure\x0a\x09^ false",
  41495. referencedClasses: [],
  41496. pragmas: [],
  41497. messageSends: []
  41498. }),
  41499. $globals.IRInstruction);
  41500. $core.addMethod(
  41501. $core.method({
  41502. selector: "isInlined",
  41503. protocol: "testing",
  41504. fn: function (){
  41505. var self=this,$self=this;
  41506. return false;
  41507. },
  41508. args: [],
  41509. source: "isInlined\x0a\x09^ false",
  41510. referencedClasses: [],
  41511. pragmas: [],
  41512. messageSends: []
  41513. }),
  41514. $globals.IRInstruction);
  41515. $core.addMethod(
  41516. $core.method({
  41517. selector: "isMethod",
  41518. protocol: "testing",
  41519. fn: function (){
  41520. var self=this,$self=this;
  41521. return false;
  41522. },
  41523. args: [],
  41524. source: "isMethod\x0a\x09^ false",
  41525. referencedClasses: [],
  41526. pragmas: [],
  41527. messageSends: []
  41528. }),
  41529. $globals.IRInstruction);
  41530. $core.addMethod(
  41531. $core.method({
  41532. selector: "isSelf",
  41533. protocol: "testing",
  41534. fn: function (){
  41535. var self=this,$self=this;
  41536. return false;
  41537. },
  41538. args: [],
  41539. source: "isSelf\x0a\x09^ false",
  41540. referencedClasses: [],
  41541. pragmas: [],
  41542. messageSends: []
  41543. }),
  41544. $globals.IRInstruction);
  41545. $core.addMethod(
  41546. $core.method({
  41547. selector: "isSend",
  41548. protocol: "testing",
  41549. fn: function (){
  41550. var self=this,$self=this;
  41551. return false;
  41552. },
  41553. args: [],
  41554. source: "isSend\x0a\x09^ false",
  41555. referencedClasses: [],
  41556. pragmas: [],
  41557. messageSends: []
  41558. }),
  41559. $globals.IRInstruction);
  41560. $core.addMethod(
  41561. $core.method({
  41562. selector: "isSequence",
  41563. protocol: "testing",
  41564. fn: function (){
  41565. var self=this,$self=this;
  41566. return false;
  41567. },
  41568. args: [],
  41569. source: "isSequence\x0a\x09^ false",
  41570. referencedClasses: [],
  41571. pragmas: [],
  41572. messageSends: []
  41573. }),
  41574. $globals.IRInstruction);
  41575. $core.addMethod(
  41576. $core.method({
  41577. selector: "isSuper",
  41578. protocol: "testing",
  41579. fn: function (){
  41580. var self=this,$self=this;
  41581. return false;
  41582. },
  41583. args: [],
  41584. source: "isSuper\x0a\x09^ false",
  41585. referencedClasses: [],
  41586. pragmas: [],
  41587. messageSends: []
  41588. }),
  41589. $globals.IRInstruction);
  41590. $core.addMethod(
  41591. $core.method({
  41592. selector: "isTempDeclaration",
  41593. protocol: "testing",
  41594. fn: function (){
  41595. var self=this,$self=this;
  41596. return false;
  41597. },
  41598. args: [],
  41599. source: "isTempDeclaration\x0a\x09^ false",
  41600. referencedClasses: [],
  41601. pragmas: [],
  41602. messageSends: []
  41603. }),
  41604. $globals.IRInstruction);
  41605. $core.addMethod(
  41606. $core.method({
  41607. selector: "isVariable",
  41608. protocol: "testing",
  41609. fn: function (){
  41610. var self=this,$self=this;
  41611. return false;
  41612. },
  41613. args: [],
  41614. source: "isVariable\x0a\x09^ false",
  41615. referencedClasses: [],
  41616. pragmas: [],
  41617. messageSends: []
  41618. }),
  41619. $globals.IRInstruction);
  41620. $core.addMethod(
  41621. $core.method({
  41622. selector: "method",
  41623. protocol: "accessing",
  41624. fn: function (){
  41625. var self=this,$self=this;
  41626. return $core.withContext(function($ctx1) {
  41627. return $recv($self._parent())._method();
  41628. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  41629. },
  41630. args: [],
  41631. source: "method\x0a\x09^ self parent method",
  41632. referencedClasses: [],
  41633. pragmas: [],
  41634. messageSends: ["method", "parent"]
  41635. }),
  41636. $globals.IRInstruction);
  41637. $core.addMethod(
  41638. $core.method({
  41639. selector: "needsBoxingAsReceiver",
  41640. protocol: "testing",
  41641. fn: function (){
  41642. var self=this,$self=this;
  41643. return true;
  41644. },
  41645. args: [],
  41646. source: "needsBoxingAsReceiver\x0a\x09^ true",
  41647. referencedClasses: [],
  41648. pragmas: [],
  41649. messageSends: []
  41650. }),
  41651. $globals.IRInstruction);
  41652. $core.addMethod(
  41653. $core.method({
  41654. selector: "parent",
  41655. protocol: "accessing",
  41656. fn: function (){
  41657. var self=this,$self=this;
  41658. return $self.parent;
  41659. },
  41660. args: [],
  41661. source: "parent\x0a\x09^ parent",
  41662. referencedClasses: [],
  41663. pragmas: [],
  41664. messageSends: []
  41665. }),
  41666. $globals.IRInstruction);
  41667. $core.addMethod(
  41668. $core.method({
  41669. selector: "parent:",
  41670. protocol: "accessing",
  41671. fn: function (anIRInstruction){
  41672. var self=this,$self=this;
  41673. $self.parent=anIRInstruction;
  41674. return self;
  41675. },
  41676. args: ["anIRInstruction"],
  41677. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  41678. referencedClasses: [],
  41679. pragmas: [],
  41680. messageSends: []
  41681. }),
  41682. $globals.IRInstruction);
  41683. $core.addMethod(
  41684. $core.method({
  41685. selector: "remove:",
  41686. protocol: "building",
  41687. fn: function (anIRInstruction){
  41688. var self=this,$self=this;
  41689. return $core.withContext(function($ctx1) {
  41690. $recv($self._dagChildren())._remove_(anIRInstruction);
  41691. return self;
  41692. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction})});
  41693. },
  41694. args: ["anIRInstruction"],
  41695. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  41696. referencedClasses: [],
  41697. pragmas: [],
  41698. messageSends: ["remove:", "dagChildren"]
  41699. }),
  41700. $globals.IRInstruction);
  41701. $core.addMethod(
  41702. $core.method({
  41703. selector: "replace:with:",
  41704. protocol: "building",
  41705. fn: function (anIRInstruction,anotherIRInstruction){
  41706. var self=this,$self=this;
  41707. return $core.withContext(function($ctx1) {
  41708. var $1;
  41709. $recv(anotherIRInstruction)._parent_(self);
  41710. $1=$self._dagChildren();
  41711. $ctx1.sendIdx["dagChildren"]=1;
  41712. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  41713. return self;
  41714. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  41715. },
  41716. args: ["anIRInstruction", "anotherIRInstruction"],
  41717. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  41718. referencedClasses: [],
  41719. pragmas: [],
  41720. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  41721. }),
  41722. $globals.IRInstruction);
  41723. $core.addMethod(
  41724. $core.method({
  41725. selector: "replaceWith:",
  41726. protocol: "building",
  41727. fn: function (anIRInstruction){
  41728. var self=this,$self=this;
  41729. return $core.withContext(function($ctx1) {
  41730. $recv($self._parent())._replace_with_(self,anIRInstruction);
  41731. return self;
  41732. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction})});
  41733. },
  41734. args: ["anIRInstruction"],
  41735. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  41736. referencedClasses: [],
  41737. pragmas: [],
  41738. messageSends: ["replace:with:", "parent"]
  41739. }),
  41740. $globals.IRInstruction);
  41741. $core.addMethod(
  41742. $core.method({
  41743. selector: "scope",
  41744. protocol: "accessing",
  41745. fn: function (){
  41746. var self=this,$self=this;
  41747. return $core.withContext(function($ctx1) {
  41748. var $1,$receiver;
  41749. $1=$self._parent();
  41750. if(($receiver = $1) == null || $receiver.a$nil){
  41751. return $1;
  41752. } else {
  41753. var node;
  41754. node=$receiver;
  41755. return $recv(node)._scope();
  41756. }
  41757. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  41758. },
  41759. args: [],
  41760. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  41761. referencedClasses: [],
  41762. pragmas: [],
  41763. messageSends: ["ifNotNil:", "parent", "scope"]
  41764. }),
  41765. $globals.IRInstruction);
  41766. $core.addMethod(
  41767. $core.method({
  41768. selector: "yieldsValue",
  41769. protocol: "testing",
  41770. fn: function (){
  41771. var self=this,$self=this;
  41772. return true;
  41773. },
  41774. args: [],
  41775. source: "yieldsValue\x0a\x09^ true",
  41776. referencedClasses: [],
  41777. pragmas: [],
  41778. messageSends: []
  41779. }),
  41780. $globals.IRInstruction);
  41781. $core.addMethod(
  41782. $core.method({
  41783. selector: "on:",
  41784. protocol: "instance creation",
  41785. fn: function (aBuilder){
  41786. var self=this,$self=this;
  41787. return $core.withContext(function($ctx1) {
  41788. var $1;
  41789. $1=$self._new();
  41790. $recv($1)._builder_(aBuilder);
  41791. return $recv($1)._yourself();
  41792. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder})});
  41793. },
  41794. args: ["aBuilder"],
  41795. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  41796. referencedClasses: [],
  41797. pragmas: [],
  41798. messageSends: ["builder:", "new", "yourself"]
  41799. }),
  41800. $globals.IRInstruction.a$cls);
  41801. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  41802. $core.addMethod(
  41803. $core.method({
  41804. selector: "acceptDagVisitor:",
  41805. protocol: "visiting",
  41806. fn: function (aVisitor){
  41807. var self=this,$self=this;
  41808. return $core.withContext(function($ctx1) {
  41809. return $recv(aVisitor)._visitIRAssignment_(self);
  41810. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41811. },
  41812. args: ["aVisitor"],
  41813. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  41814. referencedClasses: [],
  41815. pragmas: [],
  41816. messageSends: ["visitIRAssignment:"]
  41817. }),
  41818. $globals.IRAssignment);
  41819. $core.addMethod(
  41820. $core.method({
  41821. selector: "left",
  41822. protocol: "accessing",
  41823. fn: function (){
  41824. var self=this,$self=this;
  41825. return $core.withContext(function($ctx1) {
  41826. return $recv($self._dagChildren())._first();
  41827. }, function($ctx1) {$ctx1.fill(self,"left",{})});
  41828. },
  41829. args: [],
  41830. source: "left\x0a\x09^ self dagChildren first",
  41831. referencedClasses: [],
  41832. pragmas: [],
  41833. messageSends: ["first", "dagChildren"]
  41834. }),
  41835. $globals.IRAssignment);
  41836. $core.addMethod(
  41837. $core.method({
  41838. selector: "right",
  41839. protocol: "accessing",
  41840. fn: function (){
  41841. var self=this,$self=this;
  41842. return $core.withContext(function($ctx1) {
  41843. return $recv($self._dagChildren())._last();
  41844. }, function($ctx1) {$ctx1.fill(self,"right",{})});
  41845. },
  41846. args: [],
  41847. source: "right\x0a\x09^ self dagChildren last",
  41848. referencedClasses: [],
  41849. pragmas: [],
  41850. messageSends: ["last", "dagChildren"]
  41851. }),
  41852. $globals.IRAssignment);
  41853. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  41854. $core.addMethod(
  41855. $core.method({
  41856. selector: "acceptDagVisitor:",
  41857. protocol: "visiting",
  41858. fn: function (aVisitor){
  41859. var self=this,$self=this;
  41860. return $core.withContext(function($ctx1) {
  41861. return $recv(aVisitor)._visitIRDynamicArray_(self);
  41862. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41863. },
  41864. args: ["aVisitor"],
  41865. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  41866. referencedClasses: [],
  41867. pragmas: [],
  41868. messageSends: ["visitIRDynamicArray:"]
  41869. }),
  41870. $globals.IRDynamicArray);
  41871. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  41872. $core.addMethod(
  41873. $core.method({
  41874. selector: "acceptDagVisitor:",
  41875. protocol: "visiting",
  41876. fn: function (aVisitor){
  41877. var self=this,$self=this;
  41878. return $core.withContext(function($ctx1) {
  41879. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  41880. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41881. },
  41882. args: ["aVisitor"],
  41883. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  41884. referencedClasses: [],
  41885. pragmas: [],
  41886. messageSends: ["visitIRDynamicDictionary:"]
  41887. }),
  41888. $globals.IRDynamicDictionary);
  41889. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  41890. $core.addMethod(
  41891. $core.method({
  41892. selector: "scope",
  41893. protocol: "accessing",
  41894. fn: function (){
  41895. var self=this,$self=this;
  41896. return $self.scope;
  41897. },
  41898. args: [],
  41899. source: "scope\x0a\x09^ scope",
  41900. referencedClasses: [],
  41901. pragmas: [],
  41902. messageSends: []
  41903. }),
  41904. $globals.IRScopedInstruction);
  41905. $core.addMethod(
  41906. $core.method({
  41907. selector: "scope:",
  41908. protocol: "accessing",
  41909. fn: function (aScope){
  41910. var self=this,$self=this;
  41911. $self.scope=aScope;
  41912. return self;
  41913. },
  41914. args: ["aScope"],
  41915. source: "scope: aScope\x0a\x09scope := aScope",
  41916. referencedClasses: [],
  41917. pragmas: [],
  41918. messageSends: []
  41919. }),
  41920. $globals.IRScopedInstruction);
  41921. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  41922. $core.addMethod(
  41923. $core.method({
  41924. selector: "arguments",
  41925. protocol: "accessing",
  41926. fn: function (){
  41927. var self=this,$self=this;
  41928. return $core.withContext(function($ctx1) {
  41929. var $1,$receiver;
  41930. $1=$self.arguments;
  41931. if(($receiver = $1) == null || $receiver.a$nil){
  41932. return [];
  41933. } else {
  41934. return $1;
  41935. }
  41936. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  41937. },
  41938. args: [],
  41939. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  41940. referencedClasses: [],
  41941. pragmas: [],
  41942. messageSends: ["ifNil:"]
  41943. }),
  41944. $globals.IRClosureInstruction);
  41945. $core.addMethod(
  41946. $core.method({
  41947. selector: "arguments:",
  41948. protocol: "accessing",
  41949. fn: function (aCollection){
  41950. var self=this,$self=this;
  41951. $self.arguments=aCollection;
  41952. return self;
  41953. },
  41954. args: ["aCollection"],
  41955. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  41956. referencedClasses: [],
  41957. pragmas: [],
  41958. messageSends: []
  41959. }),
  41960. $globals.IRClosureInstruction);
  41961. $core.addMethod(
  41962. $core.method({
  41963. selector: "locals",
  41964. protocol: "accessing",
  41965. fn: function (){
  41966. var self=this,$self=this;
  41967. return $core.withContext(function($ctx1) {
  41968. var $1;
  41969. $1=$recv($self._arguments())._copy();
  41970. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  41971. return $core.withContext(function($ctx2) {
  41972. return $recv(each)._name();
  41973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41974. })));
  41975. return $recv($1)._yourself();
  41976. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  41977. },
  41978. args: [],
  41979. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  41980. referencedClasses: [],
  41981. pragmas: [],
  41982. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  41983. }),
  41984. $globals.IRClosureInstruction);
  41985. $core.addMethod(
  41986. $core.method({
  41987. selector: "requiresSmalltalkContext",
  41988. protocol: "accessing",
  41989. fn: function (){
  41990. var self=this,$self=this;
  41991. return $core.withContext(function($ctx1) {
  41992. var $1,$receiver;
  41993. $1=$self.requiresSmalltalkContext;
  41994. if(($receiver = $1) == null || $receiver.a$nil){
  41995. return false;
  41996. } else {
  41997. return $1;
  41998. }
  41999. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  42000. },
  42001. args: [],
  42002. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  42003. referencedClasses: [],
  42004. pragmas: [],
  42005. messageSends: ["ifNil:"]
  42006. }),
  42007. $globals.IRClosureInstruction);
  42008. $core.addMethod(
  42009. $core.method({
  42010. selector: "requiresSmalltalkContext:",
  42011. protocol: "accessing",
  42012. fn: function (anObject){
  42013. var self=this,$self=this;
  42014. $self.requiresSmalltalkContext=anObject;
  42015. return self;
  42016. },
  42017. args: ["anObject"],
  42018. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  42019. referencedClasses: [],
  42020. pragmas: [],
  42021. messageSends: []
  42022. }),
  42023. $globals.IRClosureInstruction);
  42024. $core.addMethod(
  42025. $core.method({
  42026. selector: "scope:",
  42027. protocol: "accessing",
  42028. fn: function (aScope){
  42029. var self=this,$self=this;
  42030. return $core.withContext(function($ctx1) {
  42031. (
  42032. $ctx1.supercall = true,
  42033. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  42034. $ctx1.supercall = false;
  42035. $recv(aScope)._instruction_(self);
  42036. return self;
  42037. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope})});
  42038. },
  42039. args: ["aScope"],
  42040. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  42041. referencedClasses: [],
  42042. pragmas: [],
  42043. messageSends: ["scope:", "instruction:"]
  42044. }),
  42045. $globals.IRClosureInstruction);
  42046. $core.addMethod(
  42047. $core.method({
  42048. selector: "tempDeclarations",
  42049. protocol: "accessing",
  42050. fn: function (){
  42051. var self=this,$self=this;
  42052. return $core.withContext(function($ctx1) {
  42053. return $recv($self._dagChildren())._select_((function(each){
  42054. return $core.withContext(function($ctx2) {
  42055. return $recv(each)._isTempDeclaration();
  42056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42057. }));
  42058. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{})});
  42059. },
  42060. args: [],
  42061. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  42062. referencedClasses: [],
  42063. pragmas: [],
  42064. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  42065. }),
  42066. $globals.IRClosureInstruction);
  42067. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  42068. $core.addMethod(
  42069. $core.method({
  42070. selector: "acceptDagVisitor:",
  42071. protocol: "visiting",
  42072. fn: function (aVisitor){
  42073. var self=this,$self=this;
  42074. return $core.withContext(function($ctx1) {
  42075. return $recv(aVisitor)._visitIRClosure_(self);
  42076. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42077. },
  42078. args: ["aVisitor"],
  42079. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  42080. referencedClasses: [],
  42081. pragmas: [],
  42082. messageSends: ["visitIRClosure:"]
  42083. }),
  42084. $globals.IRClosure);
  42085. $core.addMethod(
  42086. $core.method({
  42087. selector: "isClosure",
  42088. protocol: "testing",
  42089. fn: function (){
  42090. var self=this,$self=this;
  42091. return true;
  42092. },
  42093. args: [],
  42094. source: "isClosure\x0a\x09^ true",
  42095. referencedClasses: [],
  42096. pragmas: [],
  42097. messageSends: []
  42098. }),
  42099. $globals.IRClosure);
  42100. $core.addMethod(
  42101. $core.method({
  42102. selector: "sequence",
  42103. protocol: "accessing",
  42104. fn: function (){
  42105. var self=this,$self=this;
  42106. return $core.withContext(function($ctx1) {
  42107. return $recv($self._dagChildren())._last();
  42108. }, function($ctx1) {$ctx1.fill(self,"sequence",{})});
  42109. },
  42110. args: [],
  42111. source: "sequence\x0a\x09^ self dagChildren last",
  42112. referencedClasses: [],
  42113. pragmas: [],
  42114. messageSends: ["last", "dagChildren"]
  42115. }),
  42116. $globals.IRClosure);
  42117. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "pragmas", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  42118. $globals.IRMethod.comment="I am a method instruction";
  42119. $core.addMethod(
  42120. $core.method({
  42121. selector: "acceptDagVisitor:",
  42122. protocol: "visiting",
  42123. fn: function (aVisitor){
  42124. var self=this,$self=this;
  42125. return $core.withContext(function($ctx1) {
  42126. return $recv(aVisitor)._visitIRMethod_(self);
  42127. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42128. },
  42129. args: ["aVisitor"],
  42130. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  42131. referencedClasses: [],
  42132. pragmas: [],
  42133. messageSends: ["visitIRMethod:"]
  42134. }),
  42135. $globals.IRMethod);
  42136. $core.addMethod(
  42137. $core.method({
  42138. selector: "classReferences",
  42139. protocol: "accessing",
  42140. fn: function (){
  42141. var self=this,$self=this;
  42142. return $self.classReferences;
  42143. },
  42144. args: [],
  42145. source: "classReferences\x0a\x09^ classReferences",
  42146. referencedClasses: [],
  42147. pragmas: [],
  42148. messageSends: []
  42149. }),
  42150. $globals.IRMethod);
  42151. $core.addMethod(
  42152. $core.method({
  42153. selector: "classReferences:",
  42154. protocol: "accessing",
  42155. fn: function (aCollection){
  42156. var self=this,$self=this;
  42157. $self.classReferences=aCollection;
  42158. return self;
  42159. },
  42160. args: ["aCollection"],
  42161. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  42162. referencedClasses: [],
  42163. pragmas: [],
  42164. messageSends: []
  42165. }),
  42166. $globals.IRMethod);
  42167. $core.addMethod(
  42168. $core.method({
  42169. selector: "internalVariables",
  42170. protocol: "accessing",
  42171. fn: function (){
  42172. var self=this,$self=this;
  42173. return $core.withContext(function($ctx1) {
  42174. var $1,$receiver;
  42175. $1=$self.internalVariables;
  42176. if(($receiver = $1) == null || $receiver.a$nil){
  42177. $self.internalVariables=$recv($globals.Set)._new();
  42178. return $self.internalVariables;
  42179. } else {
  42180. return $1;
  42181. }
  42182. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{})});
  42183. },
  42184. args: [],
  42185. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  42186. referencedClasses: ["Set"],
  42187. pragmas: [],
  42188. messageSends: ["ifNil:", "new"]
  42189. }),
  42190. $globals.IRMethod);
  42191. $core.addMethod(
  42192. $core.method({
  42193. selector: "isMethod",
  42194. protocol: "testing",
  42195. fn: function (){
  42196. var self=this,$self=this;
  42197. return true;
  42198. },
  42199. args: [],
  42200. source: "isMethod\x0a\x09^ true",
  42201. referencedClasses: [],
  42202. pragmas: [],
  42203. messageSends: []
  42204. }),
  42205. $globals.IRMethod);
  42206. $core.addMethod(
  42207. $core.method({
  42208. selector: "messageSends",
  42209. protocol: "accessing",
  42210. fn: function (){
  42211. var self=this,$self=this;
  42212. return $core.withContext(function($ctx1) {
  42213. return $recv($self._sendIndexes())._keys();
  42214. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  42215. },
  42216. args: [],
  42217. source: "messageSends\x0a\x09^ self sendIndexes keys",
  42218. referencedClasses: [],
  42219. pragmas: [],
  42220. messageSends: ["keys", "sendIndexes"]
  42221. }),
  42222. $globals.IRMethod);
  42223. $core.addMethod(
  42224. $core.method({
  42225. selector: "method",
  42226. protocol: "accessing",
  42227. fn: function (){
  42228. var self=this,$self=this;
  42229. return self;
  42230. },
  42231. args: [],
  42232. source: "method\x0a\x09^ self",
  42233. referencedClasses: [],
  42234. pragmas: [],
  42235. messageSends: []
  42236. }),
  42237. $globals.IRMethod);
  42238. $core.addMethod(
  42239. $core.method({
  42240. selector: "pragmas",
  42241. protocol: "accessing",
  42242. fn: function (){
  42243. var self=this,$self=this;
  42244. return $self.pragmas;
  42245. },
  42246. args: [],
  42247. source: "pragmas\x0a\x09^ pragmas",
  42248. referencedClasses: [],
  42249. pragmas: [],
  42250. messageSends: []
  42251. }),
  42252. $globals.IRMethod);
  42253. $core.addMethod(
  42254. $core.method({
  42255. selector: "pragmas:",
  42256. protocol: "accessing",
  42257. fn: function (aCollection){
  42258. var self=this,$self=this;
  42259. $self.pragmas=aCollection;
  42260. return self;
  42261. },
  42262. args: ["aCollection"],
  42263. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  42264. referencedClasses: [],
  42265. pragmas: [],
  42266. messageSends: []
  42267. }),
  42268. $globals.IRMethod);
  42269. $core.addMethod(
  42270. $core.method({
  42271. selector: "selector",
  42272. protocol: "accessing",
  42273. fn: function (){
  42274. var self=this,$self=this;
  42275. return $self.selector;
  42276. },
  42277. args: [],
  42278. source: "selector\x0a\x09^ selector",
  42279. referencedClasses: [],
  42280. pragmas: [],
  42281. messageSends: []
  42282. }),
  42283. $globals.IRMethod);
  42284. $core.addMethod(
  42285. $core.method({
  42286. selector: "selector:",
  42287. protocol: "accessing",
  42288. fn: function (aString){
  42289. var self=this,$self=this;
  42290. $self.selector=aString;
  42291. return self;
  42292. },
  42293. args: ["aString"],
  42294. source: "selector: aString\x0a\x09selector := aString",
  42295. referencedClasses: [],
  42296. pragmas: [],
  42297. messageSends: []
  42298. }),
  42299. $globals.IRMethod);
  42300. $core.addMethod(
  42301. $core.method({
  42302. selector: "sendIndexes",
  42303. protocol: "accessing",
  42304. fn: function (){
  42305. var self=this,$self=this;
  42306. return $self.sendIndexes;
  42307. },
  42308. args: [],
  42309. source: "sendIndexes\x0a\x09^ sendIndexes",
  42310. referencedClasses: [],
  42311. pragmas: [],
  42312. messageSends: []
  42313. }),
  42314. $globals.IRMethod);
  42315. $core.addMethod(
  42316. $core.method({
  42317. selector: "sendIndexes:",
  42318. protocol: "accessing",
  42319. fn: function (aDictionary){
  42320. var self=this,$self=this;
  42321. $self.sendIndexes=aDictionary;
  42322. return self;
  42323. },
  42324. args: ["aDictionary"],
  42325. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  42326. referencedClasses: [],
  42327. pragmas: [],
  42328. messageSends: []
  42329. }),
  42330. $globals.IRMethod);
  42331. $core.addMethod(
  42332. $core.method({
  42333. selector: "source",
  42334. protocol: "accessing",
  42335. fn: function (){
  42336. var self=this,$self=this;
  42337. return $self.source;
  42338. },
  42339. args: [],
  42340. source: "source\x0a\x09^ source",
  42341. referencedClasses: [],
  42342. pragmas: [],
  42343. messageSends: []
  42344. }),
  42345. $globals.IRMethod);
  42346. $core.addMethod(
  42347. $core.method({
  42348. selector: "source:",
  42349. protocol: "accessing",
  42350. fn: function (aString){
  42351. var self=this,$self=this;
  42352. $self.source=aString;
  42353. return self;
  42354. },
  42355. args: ["aString"],
  42356. source: "source: aString\x0a\x09source := aString",
  42357. referencedClasses: [],
  42358. pragmas: [],
  42359. messageSends: []
  42360. }),
  42361. $globals.IRMethod);
  42362. $core.addMethod(
  42363. $core.method({
  42364. selector: "theClass",
  42365. protocol: "accessing",
  42366. fn: function (){
  42367. var self=this,$self=this;
  42368. return $self.theClass;
  42369. },
  42370. args: [],
  42371. source: "theClass\x0a\x09^ theClass",
  42372. referencedClasses: [],
  42373. pragmas: [],
  42374. messageSends: []
  42375. }),
  42376. $globals.IRMethod);
  42377. $core.addMethod(
  42378. $core.method({
  42379. selector: "theClass:",
  42380. protocol: "accessing",
  42381. fn: function (aClass){
  42382. var self=this,$self=this;
  42383. $self.theClass=aClass;
  42384. return self;
  42385. },
  42386. args: ["aClass"],
  42387. source: "theClass: aClass\x0a\x09theClass := aClass",
  42388. referencedClasses: [],
  42389. pragmas: [],
  42390. messageSends: []
  42391. }),
  42392. $globals.IRMethod);
  42393. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  42394. $globals.IRReturn.comment="I am a local return instruction.";
  42395. $core.addMethod(
  42396. $core.method({
  42397. selector: "acceptDagVisitor:",
  42398. protocol: "visiting",
  42399. fn: function (aVisitor){
  42400. var self=this,$self=this;
  42401. return $core.withContext(function($ctx1) {
  42402. return $recv(aVisitor)._visitIRReturn_(self);
  42403. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42404. },
  42405. args: ["aVisitor"],
  42406. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  42407. referencedClasses: [],
  42408. pragmas: [],
  42409. messageSends: ["visitIRReturn:"]
  42410. }),
  42411. $globals.IRReturn);
  42412. $core.addMethod(
  42413. $core.method({
  42414. selector: "expression",
  42415. protocol: "accessing",
  42416. fn: function (){
  42417. var self=this,$self=this;
  42418. return $core.withContext(function($ctx1) {
  42419. return $recv($self._dagChildren())._single();
  42420. }, function($ctx1) {$ctx1.fill(self,"expression",{})});
  42421. },
  42422. args: [],
  42423. source: "expression\x0a\x09^ self dagChildren single",
  42424. referencedClasses: [],
  42425. pragmas: [],
  42426. messageSends: ["single", "dagChildren"]
  42427. }),
  42428. $globals.IRReturn);
  42429. $core.addMethod(
  42430. $core.method({
  42431. selector: "scope",
  42432. protocol: "accessing",
  42433. fn: function (){
  42434. var self=this,$self=this;
  42435. return $core.withContext(function($ctx1) {
  42436. var $1,$receiver;
  42437. $1=$self.scope;
  42438. if(($receiver = $1) == null || $receiver.a$nil){
  42439. return $recv($self._parent())._scope();
  42440. } else {
  42441. return $1;
  42442. }
  42443. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  42444. },
  42445. args: [],
  42446. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  42447. referencedClasses: [],
  42448. pragmas: [],
  42449. messageSends: ["ifNil:", "scope", "parent"]
  42450. }),
  42451. $globals.IRReturn);
  42452. $core.addMethod(
  42453. $core.method({
  42454. selector: "yieldsValue",
  42455. protocol: "testing",
  42456. fn: function (){
  42457. var self=this,$self=this;
  42458. return false;
  42459. },
  42460. args: [],
  42461. source: "yieldsValue\x0a\x09^ false",
  42462. referencedClasses: [],
  42463. pragmas: [],
  42464. messageSends: []
  42465. }),
  42466. $globals.IRReturn);
  42467. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  42468. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  42469. $core.addMethod(
  42470. $core.method({
  42471. selector: "acceptDagVisitor:",
  42472. protocol: "visiting",
  42473. fn: function (aVisitor){
  42474. var self=this,$self=this;
  42475. return $core.withContext(function($ctx1) {
  42476. return $recv(aVisitor)._visitIRBlockReturn_(self);
  42477. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42478. },
  42479. args: ["aVisitor"],
  42480. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  42481. referencedClasses: [],
  42482. pragmas: [],
  42483. messageSends: ["visitIRBlockReturn:"]
  42484. }),
  42485. $globals.IRBlockReturn);
  42486. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  42487. $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.";
  42488. $core.addMethod(
  42489. $core.method({
  42490. selector: "acceptDagVisitor:",
  42491. protocol: "visiting",
  42492. fn: function (aVisitor){
  42493. var self=this,$self=this;
  42494. return $core.withContext(function($ctx1) {
  42495. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  42496. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42497. },
  42498. args: ["aVisitor"],
  42499. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  42500. referencedClasses: [],
  42501. pragmas: [],
  42502. messageSends: ["visitIRNonLocalReturn:"]
  42503. }),
  42504. $globals.IRNonLocalReturn);
  42505. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  42506. $core.addMethod(
  42507. $core.method({
  42508. selector: "acceptDagVisitor:",
  42509. protocol: "visiting",
  42510. fn: function (aVisitor){
  42511. var self=this,$self=this;
  42512. return $core.withContext(function($ctx1) {
  42513. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  42514. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42515. },
  42516. args: ["aVisitor"],
  42517. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  42518. referencedClasses: [],
  42519. pragmas: [],
  42520. messageSends: ["visitIRTempDeclaration:"]
  42521. }),
  42522. $globals.IRTempDeclaration);
  42523. $core.addMethod(
  42524. $core.method({
  42525. selector: "isTempDeclaration",
  42526. protocol: "testing",
  42527. fn: function (){
  42528. var self=this,$self=this;
  42529. return true;
  42530. },
  42531. args: [],
  42532. source: "isTempDeclaration\x0a\x09^ true",
  42533. referencedClasses: [],
  42534. pragmas: [],
  42535. messageSends: []
  42536. }),
  42537. $globals.IRTempDeclaration);
  42538. $core.addMethod(
  42539. $core.method({
  42540. selector: "name",
  42541. protocol: "accessing",
  42542. fn: function (){
  42543. var self=this,$self=this;
  42544. return $self.name;
  42545. },
  42546. args: [],
  42547. source: "name\x0a\x09^ name",
  42548. referencedClasses: [],
  42549. pragmas: [],
  42550. messageSends: []
  42551. }),
  42552. $globals.IRTempDeclaration);
  42553. $core.addMethod(
  42554. $core.method({
  42555. selector: "name:",
  42556. protocol: "accessing",
  42557. fn: function (aString){
  42558. var self=this,$self=this;
  42559. $self.name=aString;
  42560. return self;
  42561. },
  42562. args: ["aString"],
  42563. source: "name: aString\x0a\x09name := aString",
  42564. referencedClasses: [],
  42565. pragmas: [],
  42566. messageSends: []
  42567. }),
  42568. $globals.IRTempDeclaration);
  42569. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "javaScriptSelector", "index"], "Compiler-IR");
  42570. $globals.IRSend.comment="I am a message send instruction.";
  42571. $core.addMethod(
  42572. $core.method({
  42573. selector: "acceptDagVisitor:",
  42574. protocol: "visiting",
  42575. fn: function (aVisitor){
  42576. var self=this,$self=this;
  42577. return $core.withContext(function($ctx1) {
  42578. return $recv(aVisitor)._visitIRSend_(self);
  42579. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42580. },
  42581. args: ["aVisitor"],
  42582. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  42583. referencedClasses: [],
  42584. pragmas: [],
  42585. messageSends: ["visitIRSend:"]
  42586. }),
  42587. $globals.IRSend);
  42588. $core.addMethod(
  42589. $core.method({
  42590. selector: "arguments",
  42591. protocol: "accessing",
  42592. fn: function (){
  42593. var self=this,$self=this;
  42594. return $core.withContext(function($ctx1) {
  42595. return $recv($self._dagChildren())._allButFirst();
  42596. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  42597. },
  42598. args: [],
  42599. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  42600. referencedClasses: [],
  42601. pragmas: [],
  42602. messageSends: ["allButFirst", "dagChildren"]
  42603. }),
  42604. $globals.IRSend);
  42605. $core.addMethod(
  42606. $core.method({
  42607. selector: "index",
  42608. protocol: "accessing",
  42609. fn: function (){
  42610. var self=this,$self=this;
  42611. return $self.index;
  42612. },
  42613. args: [],
  42614. source: "index\x0a\x09^ index",
  42615. referencedClasses: [],
  42616. pragmas: [],
  42617. messageSends: []
  42618. }),
  42619. $globals.IRSend);
  42620. $core.addMethod(
  42621. $core.method({
  42622. selector: "index:",
  42623. protocol: "accessing",
  42624. fn: function (anInteger){
  42625. var self=this,$self=this;
  42626. $self.index=anInteger;
  42627. return self;
  42628. },
  42629. args: ["anInteger"],
  42630. source: "index: anInteger\x0a\x09index := anInteger",
  42631. referencedClasses: [],
  42632. pragmas: [],
  42633. messageSends: []
  42634. }),
  42635. $globals.IRSend);
  42636. $core.addMethod(
  42637. $core.method({
  42638. selector: "isSend",
  42639. protocol: "testing",
  42640. fn: function (){
  42641. var self=this,$self=this;
  42642. return true;
  42643. },
  42644. args: [],
  42645. source: "isSend\x0a\x09^ true",
  42646. referencedClasses: [],
  42647. pragmas: [],
  42648. messageSends: []
  42649. }),
  42650. $globals.IRSend);
  42651. $core.addMethod(
  42652. $core.method({
  42653. selector: "javaScriptSelector",
  42654. protocol: "accessing",
  42655. fn: function (){
  42656. var self=this,$self=this;
  42657. return $core.withContext(function($ctx1) {
  42658. var $1,$receiver;
  42659. $1=$self.javaScriptSelector;
  42660. if(($receiver = $1) == null || $receiver.a$nil){
  42661. $self.javaScriptSelector=$recv($self._selector())._asJavaScriptMethodName();
  42662. return $self.javaScriptSelector;
  42663. } else {
  42664. return $1;
  42665. }
  42666. }, function($ctx1) {$ctx1.fill(self,"javaScriptSelector",{})});
  42667. },
  42668. args: [],
  42669. source: "javaScriptSelector\x0a\x09^ javaScriptSelector ifNil: [ javaScriptSelector := self selector asJavaScriptMethodName ]",
  42670. referencedClasses: [],
  42671. pragmas: [],
  42672. messageSends: ["ifNil:", "asJavaScriptMethodName", "selector"]
  42673. }),
  42674. $globals.IRSend);
  42675. $core.addMethod(
  42676. $core.method({
  42677. selector: "javaScriptSelector:",
  42678. protocol: "accessing",
  42679. fn: function (aString){
  42680. var self=this,$self=this;
  42681. $self.javaScriptSelector=aString;
  42682. return self;
  42683. },
  42684. args: ["aString"],
  42685. source: "javaScriptSelector: aString\x0a\x09javaScriptSelector := aString",
  42686. referencedClasses: [],
  42687. pragmas: [],
  42688. messageSends: []
  42689. }),
  42690. $globals.IRSend);
  42691. $core.addMethod(
  42692. $core.method({
  42693. selector: "receiver",
  42694. protocol: "accessing",
  42695. fn: function (){
  42696. var self=this,$self=this;
  42697. return $core.withContext(function($ctx1) {
  42698. return $recv($self._dagChildren())._first();
  42699. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  42700. },
  42701. args: [],
  42702. source: "receiver\x0a\x09^ self dagChildren first",
  42703. referencedClasses: [],
  42704. pragmas: [],
  42705. messageSends: ["first", "dagChildren"]
  42706. }),
  42707. $globals.IRSend);
  42708. $core.addMethod(
  42709. $core.method({
  42710. selector: "selector",
  42711. protocol: "accessing",
  42712. fn: function (){
  42713. var self=this,$self=this;
  42714. return $self.selector;
  42715. },
  42716. args: [],
  42717. source: "selector\x0a\x09^ selector",
  42718. referencedClasses: [],
  42719. pragmas: [],
  42720. messageSends: []
  42721. }),
  42722. $globals.IRSend);
  42723. $core.addMethod(
  42724. $core.method({
  42725. selector: "selector:",
  42726. protocol: "accessing",
  42727. fn: function (aString){
  42728. var self=this,$self=this;
  42729. $self.selector=aString;
  42730. return self;
  42731. },
  42732. args: ["aString"],
  42733. source: "selector: aString\x0a\x09selector := aString",
  42734. referencedClasses: [],
  42735. pragmas: [],
  42736. messageSends: []
  42737. }),
  42738. $globals.IRSend);
  42739. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  42740. $core.addMethod(
  42741. $core.method({
  42742. selector: "acceptDagVisitor:",
  42743. protocol: "visiting",
  42744. fn: function (aVisitor){
  42745. var self=this,$self=this;
  42746. return $core.withContext(function($ctx1) {
  42747. return $recv(aVisitor)._visitIRSequence_(self);
  42748. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42749. },
  42750. args: ["aVisitor"],
  42751. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  42752. referencedClasses: [],
  42753. pragmas: [],
  42754. messageSends: ["visitIRSequence:"]
  42755. }),
  42756. $globals.IRSequence);
  42757. $core.addMethod(
  42758. $core.method({
  42759. selector: "isSequence",
  42760. protocol: "testing",
  42761. fn: function (){
  42762. var self=this,$self=this;
  42763. return true;
  42764. },
  42765. args: [],
  42766. source: "isSequence\x0a\x09^ true",
  42767. referencedClasses: [],
  42768. pragmas: [],
  42769. messageSends: []
  42770. }),
  42771. $globals.IRSequence);
  42772. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  42773. $core.addMethod(
  42774. $core.method({
  42775. selector: "acceptDagVisitor:",
  42776. protocol: "visiting",
  42777. fn: function (aVisitor){
  42778. var self=this,$self=this;
  42779. return $core.withContext(function($ctx1) {
  42780. return $recv(aVisitor)._visitIRBlockSequence_(self);
  42781. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42782. },
  42783. args: ["aVisitor"],
  42784. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  42785. referencedClasses: [],
  42786. pragmas: [],
  42787. messageSends: ["visitIRBlockSequence:"]
  42788. }),
  42789. $globals.IRBlockSequence);
  42790. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  42791. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  42792. $core.addMethod(
  42793. $core.method({
  42794. selector: "acceptDagVisitor:",
  42795. protocol: "visiting",
  42796. fn: function (aVisitor){
  42797. var self=this,$self=this;
  42798. return $core.withContext(function($ctx1) {
  42799. return $recv(aVisitor)._visitIRValue_(self);
  42800. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42801. },
  42802. args: ["aVisitor"],
  42803. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  42804. referencedClasses: [],
  42805. pragmas: [],
  42806. messageSends: ["visitIRValue:"]
  42807. }),
  42808. $globals.IRValue);
  42809. $core.addMethod(
  42810. $core.method({
  42811. selector: "needsBoxingAsReceiver",
  42812. protocol: "testing",
  42813. fn: function (){
  42814. var self=this,$self=this;
  42815. return false;
  42816. },
  42817. args: [],
  42818. source: "needsBoxingAsReceiver\x0a\x09^ false",
  42819. referencedClasses: [],
  42820. pragmas: [],
  42821. messageSends: []
  42822. }),
  42823. $globals.IRValue);
  42824. $core.addMethod(
  42825. $core.method({
  42826. selector: "value",
  42827. protocol: "accessing",
  42828. fn: function (){
  42829. var self=this,$self=this;
  42830. return $self.value;
  42831. },
  42832. args: [],
  42833. source: "value\x0a\x09^ value",
  42834. referencedClasses: [],
  42835. pragmas: [],
  42836. messageSends: []
  42837. }),
  42838. $globals.IRValue);
  42839. $core.addMethod(
  42840. $core.method({
  42841. selector: "value:",
  42842. protocol: "accessing",
  42843. fn: function (aString){
  42844. var self=this,$self=this;
  42845. $self.value=aString;
  42846. return self;
  42847. },
  42848. args: ["aString"],
  42849. source: "value: aString\x0a\x09value := aString",
  42850. referencedClasses: [],
  42851. pragmas: [],
  42852. messageSends: []
  42853. }),
  42854. $globals.IRValue);
  42855. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  42856. $globals.IRVariable.comment="I am a variable instruction.";
  42857. $core.addMethod(
  42858. $core.method({
  42859. selector: "acceptDagVisitor:",
  42860. protocol: "visiting",
  42861. fn: function (aVisitor){
  42862. var self=this,$self=this;
  42863. return $core.withContext(function($ctx1) {
  42864. return $recv(aVisitor)._visitIRVariable_(self);
  42865. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42866. },
  42867. args: ["aVisitor"],
  42868. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  42869. referencedClasses: [],
  42870. pragmas: [],
  42871. messageSends: ["visitIRVariable:"]
  42872. }),
  42873. $globals.IRVariable);
  42874. $core.addMethod(
  42875. $core.method({
  42876. selector: "isSelf",
  42877. protocol: "testing",
  42878. fn: function (){
  42879. var self=this,$self=this;
  42880. return $core.withContext(function($ctx1) {
  42881. return $recv($self._variable())._isSelf();
  42882. }, function($ctx1) {$ctx1.fill(self,"isSelf",{})});
  42883. },
  42884. args: [],
  42885. source: "isSelf\x0a\x09^ self variable isSelf",
  42886. referencedClasses: [],
  42887. pragmas: [],
  42888. messageSends: ["isSelf", "variable"]
  42889. }),
  42890. $globals.IRVariable);
  42891. $core.addMethod(
  42892. $core.method({
  42893. selector: "isSuper",
  42894. protocol: "testing",
  42895. fn: function (){
  42896. var self=this,$self=this;
  42897. return $core.withContext(function($ctx1) {
  42898. return $recv($self._variable())._isSuper();
  42899. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  42900. },
  42901. args: [],
  42902. source: "isSuper\x0a\x09^ self variable isSuper",
  42903. referencedClasses: [],
  42904. pragmas: [],
  42905. messageSends: ["isSuper", "variable"]
  42906. }),
  42907. $globals.IRVariable);
  42908. $core.addMethod(
  42909. $core.method({
  42910. selector: "isVariable",
  42911. protocol: "testing",
  42912. fn: function (){
  42913. var self=this,$self=this;
  42914. return true;
  42915. },
  42916. args: [],
  42917. source: "isVariable\x0a\x09^ true",
  42918. referencedClasses: [],
  42919. pragmas: [],
  42920. messageSends: []
  42921. }),
  42922. $globals.IRVariable);
  42923. $core.addMethod(
  42924. $core.method({
  42925. selector: "needsBoxingAsReceiver",
  42926. protocol: "testing",
  42927. fn: function (){
  42928. var self=this,$self=this;
  42929. return $core.withContext(function($ctx1) {
  42930. return $recv($recv($self._variable())._isPseudoVar())._not();
  42931. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{})});
  42932. },
  42933. args: [],
  42934. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  42935. referencedClasses: [],
  42936. pragmas: [],
  42937. messageSends: ["not", "isPseudoVar", "variable"]
  42938. }),
  42939. $globals.IRVariable);
  42940. $core.addMethod(
  42941. $core.method({
  42942. selector: "variable",
  42943. protocol: "accessing",
  42944. fn: function (){
  42945. var self=this,$self=this;
  42946. return $self.variable;
  42947. },
  42948. args: [],
  42949. source: "variable\x0a\x09^ variable",
  42950. referencedClasses: [],
  42951. pragmas: [],
  42952. messageSends: []
  42953. }),
  42954. $globals.IRVariable);
  42955. $core.addMethod(
  42956. $core.method({
  42957. selector: "variable:",
  42958. protocol: "accessing",
  42959. fn: function (aScopeVariable){
  42960. var self=this,$self=this;
  42961. $self.variable=aScopeVariable;
  42962. return self;
  42963. },
  42964. args: ["aScopeVariable"],
  42965. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  42966. referencedClasses: [],
  42967. pragmas: [],
  42968. messageSends: []
  42969. }),
  42970. $globals.IRVariable);
  42971. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  42972. $core.addMethod(
  42973. $core.method({
  42974. selector: "acceptDagVisitor:",
  42975. protocol: "visiting",
  42976. fn: function (aVisitor){
  42977. var self=this,$self=this;
  42978. return $core.withContext(function($ctx1) {
  42979. return $recv(aVisitor)._visitIRVerbatim_(self);
  42980. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  42981. },
  42982. args: ["aVisitor"],
  42983. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  42984. referencedClasses: [],
  42985. pragmas: [],
  42986. messageSends: ["visitIRVerbatim:"]
  42987. }),
  42988. $globals.IRVerbatim);
  42989. $core.addMethod(
  42990. $core.method({
  42991. selector: "source",
  42992. protocol: "accessing",
  42993. fn: function (){
  42994. var self=this,$self=this;
  42995. return $self.source;
  42996. },
  42997. args: [],
  42998. source: "source\x0a\x09^ source",
  42999. referencedClasses: [],
  43000. pragmas: [],
  43001. messageSends: []
  43002. }),
  43003. $globals.IRVerbatim);
  43004. $core.addMethod(
  43005. $core.method({
  43006. selector: "source:",
  43007. protocol: "accessing",
  43008. fn: function (aString){
  43009. var self=this,$self=this;
  43010. $self.source=aString;
  43011. return self;
  43012. },
  43013. args: ["aString"],
  43014. source: "source: aString\x0a\x09source := aString",
  43015. referencedClasses: [],
  43016. pragmas: [],
  43017. messageSends: []
  43018. }),
  43019. $globals.IRVerbatim);
  43020. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  43021. $core.addMethod(
  43022. $core.method({
  43023. selector: "visitDagNode:",
  43024. protocol: "visiting",
  43025. fn: function (aNode){
  43026. var self=this,$self=this;
  43027. return $core.withContext(function($ctx1) {
  43028. return $self._visitDagNodeVariantSimple_(aNode);
  43029. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  43030. },
  43031. args: ["aNode"],
  43032. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  43033. referencedClasses: [],
  43034. pragmas: [],
  43035. messageSends: ["visitDagNodeVariantSimple:"]
  43036. }),
  43037. $globals.IRVisitor);
  43038. $core.addMethod(
  43039. $core.method({
  43040. selector: "visitIRAssignment:",
  43041. protocol: "visiting",
  43042. fn: function (anIRAssignment){
  43043. var self=this,$self=this;
  43044. return $core.withContext(function($ctx1) {
  43045. return $self._visitDagNode_(anIRAssignment);
  43046. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  43047. },
  43048. args: ["anIRAssignment"],
  43049. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  43050. referencedClasses: [],
  43051. pragmas: [],
  43052. messageSends: ["visitDagNode:"]
  43053. }),
  43054. $globals.IRVisitor);
  43055. $core.addMethod(
  43056. $core.method({
  43057. selector: "visitIRBlockReturn:",
  43058. protocol: "visiting",
  43059. fn: function (anIRBlockReturn){
  43060. var self=this,$self=this;
  43061. return $core.withContext(function($ctx1) {
  43062. return $self._visitIRReturn_(anIRBlockReturn);
  43063. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn})});
  43064. },
  43065. args: ["anIRBlockReturn"],
  43066. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  43067. referencedClasses: [],
  43068. pragmas: [],
  43069. messageSends: ["visitIRReturn:"]
  43070. }),
  43071. $globals.IRVisitor);
  43072. $core.addMethod(
  43073. $core.method({
  43074. selector: "visitIRBlockSequence:",
  43075. protocol: "visiting",
  43076. fn: function (anIRBlockSequence){
  43077. var self=this,$self=this;
  43078. return $core.withContext(function($ctx1) {
  43079. return $self._visitIRSequence_(anIRBlockSequence);
  43080. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence})});
  43081. },
  43082. args: ["anIRBlockSequence"],
  43083. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  43084. referencedClasses: [],
  43085. pragmas: [],
  43086. messageSends: ["visitIRSequence:"]
  43087. }),
  43088. $globals.IRVisitor);
  43089. $core.addMethod(
  43090. $core.method({
  43091. selector: "visitIRClosure:",
  43092. protocol: "visiting",
  43093. fn: function (anIRClosure){
  43094. var self=this,$self=this;
  43095. return $core.withContext(function($ctx1) {
  43096. return $self._visitDagNode_(anIRClosure);
  43097. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  43098. },
  43099. args: ["anIRClosure"],
  43100. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  43101. referencedClasses: [],
  43102. pragmas: [],
  43103. messageSends: ["visitDagNode:"]
  43104. }),
  43105. $globals.IRVisitor);
  43106. $core.addMethod(
  43107. $core.method({
  43108. selector: "visitIRDynamicArray:",
  43109. protocol: "visiting",
  43110. fn: function (anIRDynamicArray){
  43111. var self=this,$self=this;
  43112. return $core.withContext(function($ctx1) {
  43113. return $self._visitDagNode_(anIRDynamicArray);
  43114. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  43115. },
  43116. args: ["anIRDynamicArray"],
  43117. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  43118. referencedClasses: [],
  43119. pragmas: [],
  43120. messageSends: ["visitDagNode:"]
  43121. }),
  43122. $globals.IRVisitor);
  43123. $core.addMethod(
  43124. $core.method({
  43125. selector: "visitIRDynamicDictionary:",
  43126. protocol: "visiting",
  43127. fn: function (anIRDynamicDictionary){
  43128. var self=this,$self=this;
  43129. return $core.withContext(function($ctx1) {
  43130. return $self._visitDagNode_(anIRDynamicDictionary);
  43131. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  43132. },
  43133. args: ["anIRDynamicDictionary"],
  43134. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  43135. referencedClasses: [],
  43136. pragmas: [],
  43137. messageSends: ["visitDagNode:"]
  43138. }),
  43139. $globals.IRVisitor);
  43140. $core.addMethod(
  43141. $core.method({
  43142. selector: "visitIRInlinedClosure:",
  43143. protocol: "visiting",
  43144. fn: function (anIRInlinedClosure){
  43145. var self=this,$self=this;
  43146. return $core.withContext(function($ctx1) {
  43147. return $self._visitIRClosure_(anIRInlinedClosure);
  43148. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  43149. },
  43150. args: ["anIRInlinedClosure"],
  43151. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  43152. referencedClasses: [],
  43153. pragmas: [],
  43154. messageSends: ["visitIRClosure:"]
  43155. }),
  43156. $globals.IRVisitor);
  43157. $core.addMethod(
  43158. $core.method({
  43159. selector: "visitIRInlinedSequence:",
  43160. protocol: "visiting",
  43161. fn: function (anIRInlinedSequence){
  43162. var self=this,$self=this;
  43163. return $core.withContext(function($ctx1) {
  43164. return $self._visitIRSequence_(anIRInlinedSequence);
  43165. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence})});
  43166. },
  43167. args: ["anIRInlinedSequence"],
  43168. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  43169. referencedClasses: [],
  43170. pragmas: [],
  43171. messageSends: ["visitIRSequence:"]
  43172. }),
  43173. $globals.IRVisitor);
  43174. $core.addMethod(
  43175. $core.method({
  43176. selector: "visitIRMethod:",
  43177. protocol: "visiting",
  43178. fn: function (anIRMethod){
  43179. var self=this,$self=this;
  43180. return $core.withContext(function($ctx1) {
  43181. return $self._visitDagNode_(anIRMethod);
  43182. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  43183. },
  43184. args: ["anIRMethod"],
  43185. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  43186. referencedClasses: [],
  43187. pragmas: [],
  43188. messageSends: ["visitDagNode:"]
  43189. }),
  43190. $globals.IRVisitor);
  43191. $core.addMethod(
  43192. $core.method({
  43193. selector: "visitIRNonLocalReturn:",
  43194. protocol: "visiting",
  43195. fn: function (anIRNonLocalReturn){
  43196. var self=this,$self=this;
  43197. return $core.withContext(function($ctx1) {
  43198. return $self._visitDagNode_(anIRNonLocalReturn);
  43199. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  43200. },
  43201. args: ["anIRNonLocalReturn"],
  43202. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  43203. referencedClasses: [],
  43204. pragmas: [],
  43205. messageSends: ["visitDagNode:"]
  43206. }),
  43207. $globals.IRVisitor);
  43208. $core.addMethod(
  43209. $core.method({
  43210. selector: "visitIRNonLocalReturnHandling:",
  43211. protocol: "visiting",
  43212. fn: function (anIRNonLocalReturnHandling){
  43213. var self=this,$self=this;
  43214. return $core.withContext(function($ctx1) {
  43215. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  43216. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling})});
  43217. },
  43218. args: ["anIRNonLocalReturnHandling"],
  43219. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  43220. referencedClasses: [],
  43221. pragmas: [],
  43222. messageSends: ["visitDagNode:"]
  43223. }),
  43224. $globals.IRVisitor);
  43225. $core.addMethod(
  43226. $core.method({
  43227. selector: "visitIRReturn:",
  43228. protocol: "visiting",
  43229. fn: function (anIRReturn){
  43230. var self=this,$self=this;
  43231. return $core.withContext(function($ctx1) {
  43232. return $self._visitDagNode_(anIRReturn);
  43233. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  43234. },
  43235. args: ["anIRReturn"],
  43236. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  43237. referencedClasses: [],
  43238. pragmas: [],
  43239. messageSends: ["visitDagNode:"]
  43240. }),
  43241. $globals.IRVisitor);
  43242. $core.addMethod(
  43243. $core.method({
  43244. selector: "visitIRSend:",
  43245. protocol: "visiting",
  43246. fn: function (anIRSend){
  43247. var self=this,$self=this;
  43248. return $core.withContext(function($ctx1) {
  43249. return $self._visitDagNode_(anIRSend);
  43250. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  43251. },
  43252. args: ["anIRSend"],
  43253. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  43254. referencedClasses: [],
  43255. pragmas: [],
  43256. messageSends: ["visitDagNode:"]
  43257. }),
  43258. $globals.IRVisitor);
  43259. $core.addMethod(
  43260. $core.method({
  43261. selector: "visitIRSequence:",
  43262. protocol: "visiting",
  43263. fn: function (anIRSequence){
  43264. var self=this,$self=this;
  43265. return $core.withContext(function($ctx1) {
  43266. return $self._visitDagNode_(anIRSequence);
  43267. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  43268. },
  43269. args: ["anIRSequence"],
  43270. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  43271. referencedClasses: [],
  43272. pragmas: [],
  43273. messageSends: ["visitDagNode:"]
  43274. }),
  43275. $globals.IRVisitor);
  43276. $core.addMethod(
  43277. $core.method({
  43278. selector: "visitIRTempDeclaration:",
  43279. protocol: "visiting",
  43280. fn: function (anIRTempDeclaration){
  43281. var self=this,$self=this;
  43282. return $core.withContext(function($ctx1) {
  43283. return $self._visitDagNode_(anIRTempDeclaration);
  43284. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration})});
  43285. },
  43286. args: ["anIRTempDeclaration"],
  43287. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  43288. referencedClasses: [],
  43289. pragmas: [],
  43290. messageSends: ["visitDagNode:"]
  43291. }),
  43292. $globals.IRVisitor);
  43293. $core.addMethod(
  43294. $core.method({
  43295. selector: "visitIRValue:",
  43296. protocol: "visiting",
  43297. fn: function (anIRValue){
  43298. var self=this,$self=this;
  43299. return $core.withContext(function($ctx1) {
  43300. return $self._visitDagNode_(anIRValue);
  43301. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  43302. },
  43303. args: ["anIRValue"],
  43304. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  43305. referencedClasses: [],
  43306. pragmas: [],
  43307. messageSends: ["visitDagNode:"]
  43308. }),
  43309. $globals.IRVisitor);
  43310. $core.addMethod(
  43311. $core.method({
  43312. selector: "visitIRVariable:",
  43313. protocol: "visiting",
  43314. fn: function (anIRVariable){
  43315. var self=this,$self=this;
  43316. return $core.withContext(function($ctx1) {
  43317. return $self._visitDagNode_(anIRVariable);
  43318. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  43319. },
  43320. args: ["anIRVariable"],
  43321. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  43322. referencedClasses: [],
  43323. pragmas: [],
  43324. messageSends: ["visitDagNode:"]
  43325. }),
  43326. $globals.IRVisitor);
  43327. $core.addMethod(
  43328. $core.method({
  43329. selector: "visitIRVerbatim:",
  43330. protocol: "visiting",
  43331. fn: function (anIRVerbatim){
  43332. var self=this,$self=this;
  43333. return $core.withContext(function($ctx1) {
  43334. return $self._visitDagNode_(anIRVerbatim);
  43335. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  43336. },
  43337. args: ["anIRVerbatim"],
  43338. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  43339. referencedClasses: [],
  43340. pragmas: [],
  43341. messageSends: ["visitDagNode:"]
  43342. }),
  43343. $globals.IRVisitor);
  43344. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  43345. $core.addMethod(
  43346. $core.method({
  43347. selector: "buildMethodDeclaration:with:",
  43348. protocol: "building",
  43349. fn: function (aMethod,aBlock){
  43350. var self=this,$self=this;
  43351. return $core.withContext(function($ctx1) {
  43352. var $1,$2,$3,$4,$5,$6;
  43353. $1=$recv(aMethod)._selector();
  43354. $2=$recv(aMethod)._source();
  43355. $3=$recv(aMethod)._pragmas();
  43356. $4=$recv((function(){
  43357. return $core.withContext(function($ctx2) {
  43358. $recv(aBlock)._value();
  43359. $ctx2.sendIdx["value"]=2;
  43360. return $self._contents();
  43361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43362. }))._value();
  43363. $ctx1.sendIdx["value"]=1;
  43364. $5=$recv($recv(aMethod)._messageSends())._asArray();
  43365. $ctx1.sendIdx["asArray"]=1;
  43366. $6=$recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  43367. return $core.withContext(function($ctx2) {
  43368. return $recv(each)._value();
  43369. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43370. })))._asArray();
  43371. $ctx1.sendIdx["asArray"]=2;
  43372. return $globals.HashedCollection._newFromPairs_(["selector",$1,"source",$2,"pragmas",$3,"fn",$4,"messageSends",$5,"args",$6,"referencedClasses",$recv($recv(aMethod)._classReferences())._asArray()]);
  43373. }, function($ctx1) {$ctx1.fill(self,"buildMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock})});
  43374. },
  43375. args: ["aMethod", "aBlock"],
  43376. source: "buildMethodDeclaration: aMethod with: aBlock\x0a\x09^ #{\x0a\x09\x09#selector -> aMethod selector.\x0a\x09\x09#source -> aMethod source.\x0a\x09\x09#pragmas -> aMethod pragmas.\x0a\x09\x09#fn -> [ aBlock value. self contents ] value.\x0a\x09\x09#messageSends -> aMethod messageSends asArray.\x0a\x09\x09#args -> (aMethod arguments collect: [ :each | each value ]) asArray.\x0a\x09\x09#referencedClasses -> aMethod classReferences asArray.\x0a\x09}",
  43377. referencedClasses: [],
  43378. pragmas: [],
  43379. messageSends: ["selector", "source", "pragmas", "value", "contents", "asArray", "messageSends", "collect:", "arguments", "classReferences"]
  43380. }),
  43381. $globals.IRJSTranslator);
  43382. $core.addMethod(
  43383. $core.method({
  43384. selector: "contents",
  43385. protocol: "accessing",
  43386. fn: function (){
  43387. var self=this,$self=this;
  43388. return $core.withContext(function($ctx1) {
  43389. return $recv($self._stream())._contents();
  43390. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  43391. },
  43392. args: [],
  43393. source: "contents\x0a\x09^ self stream contents",
  43394. referencedClasses: [],
  43395. pragmas: [],
  43396. messageSends: ["contents", "stream"]
  43397. }),
  43398. $globals.IRJSTranslator);
  43399. $core.addMethod(
  43400. $core.method({
  43401. selector: "currentClass",
  43402. protocol: "accessing",
  43403. fn: function (){
  43404. var self=this,$self=this;
  43405. return $self.currentClass;
  43406. },
  43407. args: [],
  43408. source: "currentClass\x0a\x09^ currentClass",
  43409. referencedClasses: [],
  43410. pragmas: [],
  43411. messageSends: []
  43412. }),
  43413. $globals.IRJSTranslator);
  43414. $core.addMethod(
  43415. $core.method({
  43416. selector: "currentClass:",
  43417. protocol: "accessing",
  43418. fn: function (aClass){
  43419. var self=this,$self=this;
  43420. $self.currentClass=aClass;
  43421. return self;
  43422. },
  43423. args: ["aClass"],
  43424. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  43425. referencedClasses: [],
  43426. pragmas: [],
  43427. messageSends: []
  43428. }),
  43429. $globals.IRJSTranslator);
  43430. $core.addMethod(
  43431. $core.method({
  43432. selector: "initialize",
  43433. protocol: "initialization",
  43434. fn: function (){
  43435. var self=this,$self=this;
  43436. return $core.withContext(function($ctx1) {
  43437. (
  43438. $ctx1.supercall = true,
  43439. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  43440. $ctx1.supercall = false;
  43441. $self.stream=$recv($globals.JSStream)._new();
  43442. return self;
  43443. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  43444. },
  43445. args: [],
  43446. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  43447. referencedClasses: ["JSStream"],
  43448. pragmas: [],
  43449. messageSends: ["initialize", "new"]
  43450. }),
  43451. $globals.IRJSTranslator);
  43452. $core.addMethod(
  43453. $core.method({
  43454. selector: "stream",
  43455. protocol: "accessing",
  43456. fn: function (){
  43457. var self=this,$self=this;
  43458. return $self.stream;
  43459. },
  43460. args: [],
  43461. source: "stream\x0a\x09^ stream",
  43462. referencedClasses: [],
  43463. pragmas: [],
  43464. messageSends: []
  43465. }),
  43466. $globals.IRJSTranslator);
  43467. $core.addMethod(
  43468. $core.method({
  43469. selector: "stream:",
  43470. protocol: "accessing",
  43471. fn: function (aStream){
  43472. var self=this,$self=this;
  43473. $self.stream=aStream;
  43474. return self;
  43475. },
  43476. args: ["aStream"],
  43477. source: "stream: aStream\x0a\x09stream := aStream",
  43478. referencedClasses: [],
  43479. pragmas: [],
  43480. messageSends: []
  43481. }),
  43482. $globals.IRJSTranslator);
  43483. $core.addMethod(
  43484. $core.method({
  43485. selector: "visitIRAssignment:",
  43486. protocol: "visiting",
  43487. fn: function (anIRAssignment){
  43488. var self=this,$self=this;
  43489. return $core.withContext(function($ctx1) {
  43490. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  43491. return $core.withContext(function($ctx2) {
  43492. return $self._visit_($recv(anIRAssignment)._left());
  43493. $ctx2.sendIdx["visit:"]=1;
  43494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43495. }),(function(){
  43496. return $core.withContext(function($ctx2) {
  43497. return $self._visit_($recv(anIRAssignment)._right());
  43498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43499. }));
  43500. return self;
  43501. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  43502. },
  43503. args: ["anIRAssignment"],
  43504. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  43505. referencedClasses: [],
  43506. pragmas: [],
  43507. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  43508. }),
  43509. $globals.IRJSTranslator);
  43510. $core.addMethod(
  43511. $core.method({
  43512. selector: "visitIRClosure:",
  43513. protocol: "visiting",
  43514. fn: function (anIRClosure){
  43515. var self=this,$self=this;
  43516. return $core.withContext(function($ctx1) {
  43517. var $1,$2;
  43518. $1=$self._stream();
  43519. $ctx1.sendIdx["stream"]=1;
  43520. $recv($1)._nextPutClosureWith_arguments_((function(){
  43521. return $core.withContext(function($ctx2) {
  43522. $2=$self._stream();
  43523. $ctx2.sendIdx["stream"]=2;
  43524. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  43525. return $core.withContext(function($ctx3) {
  43526. return $recv($recv(each)._name())._asVariableName();
  43527. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43528. })));
  43529. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  43530. return $core.withContext(function($ctx3) {
  43531. return (
  43532. $ctx3.supercall = true,
  43533. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  43534. $ctx3.supercall = false;
  43535. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43536. }));
  43537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43538. }),$recv(anIRClosure)._arguments());
  43539. return self;
  43540. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  43541. },
  43542. args: ["anIRClosure"],
  43543. 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",
  43544. referencedClasses: [],
  43545. pragmas: [],
  43546. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  43547. }),
  43548. $globals.IRJSTranslator);
  43549. $core.addMethod(
  43550. $core.method({
  43551. selector: "visitIRDynamicArray:",
  43552. protocol: "visiting",
  43553. fn: function (anIRDynamicArray){
  43554. var self=this,$self=this;
  43555. return $core.withContext(function($ctx1) {
  43556. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  43557. return self;
  43558. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  43559. },
  43560. args: ["anIRDynamicArray"],
  43561. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  43562. referencedClasses: [],
  43563. pragmas: [],
  43564. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  43565. }),
  43566. $globals.IRJSTranslator);
  43567. $core.addMethod(
  43568. $core.method({
  43569. selector: "visitIRDynamicDictionary:",
  43570. protocol: "visiting",
  43571. fn: function (anIRDynamicDictionary){
  43572. var self=this,$self=this;
  43573. return $core.withContext(function($ctx1) {
  43574. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  43575. return self;
  43576. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  43577. },
  43578. args: ["anIRDynamicDictionary"],
  43579. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  43580. referencedClasses: [],
  43581. pragmas: [],
  43582. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  43583. }),
  43584. $globals.IRJSTranslator);
  43585. $core.addMethod(
  43586. $core.method({
  43587. selector: "visitIRMethod:",
  43588. protocol: "visiting",
  43589. fn: function (anIRMethod){
  43590. var self=this,$self=this;
  43591. return $core.withContext(function($ctx1) {
  43592. var $1,$2,$3,$4,$5,$6;
  43593. return $self._buildMethodDeclaration_with_(anIRMethod,(function(){
  43594. return $core.withContext(function($ctx2) {
  43595. $1=$self._stream();
  43596. $ctx2.sendIdx["stream"]=1;
  43597. return $recv($1)._nextPutFunctionWith_arguments_((function(){
  43598. return $core.withContext(function($ctx3) {
  43599. $2=$self._stream();
  43600. $ctx3.sendIdx["stream"]=2;
  43601. $3=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  43602. return $core.withContext(function($ctx4) {
  43603. return $recv($recv(each)._name())._asVariableName();
  43604. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  43605. }));
  43606. $ctx3.sendIdx["collect:"]=1;
  43607. $recv($2)._nextPutVars_($3);
  43608. $ctx3.sendIdx["nextPutVars:"]=1;
  43609. $4=$self._stream();
  43610. $ctx3.sendIdx["stream"]=3;
  43611. return $recv($4)._nextPutContextFor_during_(anIRMethod,(function(){
  43612. return $core.withContext(function($ctx4) {
  43613. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  43614. return $core.withContext(function($ctx5) {
  43615. $5=$self._stream();
  43616. $ctx5.sendIdx["stream"]=4;
  43617. return $recv($5)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  43618. return $core.withContext(function($ctx6) {
  43619. return $recv($recv(each)._variable())._alias();
  43620. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  43621. })));
  43622. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  43623. }));
  43624. $6=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  43625. if($core.assert($6)){
  43626. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  43627. return $core.withContext(function($ctx5) {
  43628. return (
  43629. $ctx5.supercall = true,
  43630. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  43631. $ctx5.supercall = false;
  43632. $ctx5.sendIdx["visitIRMethod:"]=1;
  43633. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  43634. }));
  43635. } else {
  43636. return (
  43637. $ctx4.supercall = true,
  43638. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  43639. $ctx4.supercall = false;
  43640. }
  43641. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  43642. }));
  43643. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43644. }),$recv(anIRMethod)._arguments());
  43645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43646. }));
  43647. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  43648. },
  43649. args: ["anIRMethod"],
  43650. source: "visitIRMethod: anIRMethod\x0a\x0a\x09^ self\x0a\x09\x09buildMethodDeclaration: 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 ]",
  43651. referencedClasses: [],
  43652. pragmas: [],
  43653. messageSends: ["buildMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  43654. }),
  43655. $globals.IRJSTranslator);
  43656. $core.addMethod(
  43657. $core.method({
  43658. selector: "visitIRNonLocalReturn:",
  43659. protocol: "visiting",
  43660. fn: function (anIRNonLocalReturn){
  43661. var self=this,$self=this;
  43662. return $core.withContext(function($ctx1) {
  43663. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  43664. return $core.withContext(function($ctx2) {
  43665. return (
  43666. $ctx2.supercall = true,
  43667. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43668. $ctx2.supercall = false;
  43669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43670. }));
  43671. return self;
  43672. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  43673. },
  43674. args: ["anIRNonLocalReturn"],
  43675. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  43676. referencedClasses: [],
  43677. pragmas: [],
  43678. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  43679. }),
  43680. $globals.IRJSTranslator);
  43681. $core.addMethod(
  43682. $core.method({
  43683. selector: "visitIRReturn:",
  43684. protocol: "visiting",
  43685. fn: function (anIRReturn){
  43686. var self=this,$self=this;
  43687. return $core.withContext(function($ctx1) {
  43688. $recv($self._stream())._nextPutReturnWith_((function(){
  43689. return $core.withContext(function($ctx2) {
  43690. return (
  43691. $ctx2.supercall = true,
  43692. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43693. $ctx2.supercall = false;
  43694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43695. }));
  43696. return self;
  43697. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  43698. },
  43699. args: ["anIRReturn"],
  43700. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  43701. referencedClasses: [],
  43702. pragmas: [],
  43703. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  43704. }),
  43705. $globals.IRJSTranslator);
  43706. $core.addMethod(
  43707. $core.method({
  43708. selector: "visitIRSend:",
  43709. protocol: "visiting",
  43710. fn: function (anIRSend){
  43711. var self=this,$self=this;
  43712. var sends,superclass;
  43713. return $core.withContext(function($ctx1) {
  43714. var $1,$2;
  43715. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  43716. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  43717. if($core.assert($1)){
  43718. $self._visitSuperSend_(anIRSend);
  43719. } else {
  43720. $self._visitSend_(anIRSend);
  43721. }
  43722. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  43723. if($core.assert($2)){
  43724. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  43725. }
  43726. return self;
  43727. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass})});
  43728. },
  43729. args: ["anIRSend"],
  43730. 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 ]",
  43731. referencedClasses: [],
  43732. pragmas: [],
  43733. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  43734. }),
  43735. $globals.IRJSTranslator);
  43736. $core.addMethod(
  43737. $core.method({
  43738. selector: "visitIRSequence:",
  43739. protocol: "visiting",
  43740. fn: function (anIRSequence){
  43741. var self=this,$self=this;
  43742. return $core.withContext(function($ctx1) {
  43743. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  43744. return $core.withContext(function($ctx2) {
  43745. return $recv($self._stream())._nextPutStatementWith_((function(){
  43746. return $core.withContext(function($ctx3) {
  43747. return $self._visit_(each);
  43748. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43749. }));
  43750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43751. }));
  43752. return self;
  43753. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  43754. },
  43755. args: ["anIRSequence"],
  43756. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  43757. referencedClasses: [],
  43758. pragmas: [],
  43759. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  43760. }),
  43761. $globals.IRJSTranslator);
  43762. $core.addMethod(
  43763. $core.method({
  43764. selector: "visitIRTempDeclaration:",
  43765. protocol: "visiting",
  43766. fn: function (anIRTempDeclaration){
  43767. var self=this,$self=this;
  43768. return self;
  43769. },
  43770. args: ["anIRTempDeclaration"],
  43771. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  43772. referencedClasses: [],
  43773. pragmas: [],
  43774. messageSends: []
  43775. }),
  43776. $globals.IRJSTranslator);
  43777. $core.addMethod(
  43778. $core.method({
  43779. selector: "visitIRValue:",
  43780. protocol: "visiting",
  43781. fn: function (anIRValue){
  43782. var self=this,$self=this;
  43783. return $core.withContext(function($ctx1) {
  43784. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  43785. return self;
  43786. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  43787. },
  43788. args: ["anIRValue"],
  43789. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  43790. referencedClasses: [],
  43791. pragmas: [],
  43792. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  43793. }),
  43794. $globals.IRJSTranslator);
  43795. $core.addMethod(
  43796. $core.method({
  43797. selector: "visitIRVariable:",
  43798. protocol: "visiting",
  43799. fn: function (anIRVariable){
  43800. var self=this,$self=this;
  43801. return $core.withContext(function($ctx1) {
  43802. var $3,$2,$1,$4;
  43803. $3=$recv(anIRVariable)._variable();
  43804. $ctx1.sendIdx["variable"]=1;
  43805. $2=$recv($3)._name();
  43806. $1=$recv($2).__eq("thisContext");
  43807. if($core.assert($1)){
  43808. $4=$self._stream();
  43809. $ctx1.sendIdx["stream"]=1;
  43810. $recv($4)._nextPutAll_("$core.getThisContext()");
  43811. $ctx1.sendIdx["nextPutAll:"]=1;
  43812. } else {
  43813. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  43814. }
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  43817. },
  43818. args: ["anIRVariable"],
  43819. 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 ]",
  43820. referencedClasses: [],
  43821. pragmas: [],
  43822. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  43823. }),
  43824. $globals.IRJSTranslator);
  43825. $core.addMethod(
  43826. $core.method({
  43827. selector: "visitIRVerbatim:",
  43828. protocol: "visiting",
  43829. fn: function (anIRVerbatim){
  43830. var self=this,$self=this;
  43831. return $core.withContext(function($ctx1) {
  43832. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  43833. return self;
  43834. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  43835. },
  43836. args: ["anIRVerbatim"],
  43837. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  43838. referencedClasses: [],
  43839. pragmas: [],
  43840. messageSends: ["nextPutAll:", "stream", "source"]
  43841. }),
  43842. $globals.IRJSTranslator);
  43843. $core.addMethod(
  43844. $core.method({
  43845. selector: "visitInstructionList:enclosedBetween:and:",
  43846. protocol: "visiting",
  43847. fn: function (anArray,aString,anotherString){
  43848. var self=this,$self=this;
  43849. return $core.withContext(function($ctx1) {
  43850. var $1;
  43851. $1=$self._stream();
  43852. $ctx1.sendIdx["stream"]=1;
  43853. $recv($1)._nextPutAll_(aString);
  43854. $ctx1.sendIdx["nextPutAll:"]=1;
  43855. $recv(anArray)._do_separatedBy_((function(each){
  43856. return $core.withContext(function($ctx2) {
  43857. return $self._visit_(each);
  43858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43859. }),(function(){
  43860. return $core.withContext(function($ctx2) {
  43861. return $recv($self._stream())._nextPutAll_(",");
  43862. $ctx2.sendIdx["nextPutAll:"]=2;
  43863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43864. }));
  43865. $recv($self.stream)._nextPutAll_(anotherString);
  43866. return self;
  43867. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString})});
  43868. },
  43869. args: ["anArray", "aString", "anotherString"],
  43870. 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",
  43871. referencedClasses: [],
  43872. pragmas: [],
  43873. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  43874. }),
  43875. $globals.IRJSTranslator);
  43876. $core.addMethod(
  43877. $core.method({
  43878. selector: "visitReceiver:",
  43879. protocol: "visiting",
  43880. fn: function (anIRInstruction){
  43881. var self=this,$self=this;
  43882. var instr;
  43883. return $core.withContext(function($ctx1) {
  43884. var $1,$2,$4,$5,$3,$6,$7,$8;
  43885. $1=$recv(anIRInstruction)._isSelf();
  43886. if($core.assert($1)){
  43887. $2=$recv(anIRInstruction)._copy();
  43888. $ctx1.sendIdx["copy"]=1;
  43889. $4=$recv($recv(anIRInstruction)._variable())._copy();
  43890. $recv($4)._name_("$self");
  43891. $5=$recv($4)._yourself();
  43892. $ctx1.sendIdx["yourself"]=1;
  43893. $3=$5;
  43894. $recv($2)._variable_($3);
  43895. instr=$recv($2)._yourself();
  43896. instr;
  43897. } else {
  43898. instr=anIRInstruction;
  43899. instr;
  43900. }
  43901. $6=$recv(instr)._needsBoxingAsReceiver();
  43902. if(!$core.assert($6)){
  43903. $7=$self._visit_(instr);
  43904. $ctx1.sendIdx["visit:"]=1;
  43905. return $7;
  43906. }
  43907. $8=$self._stream();
  43908. $ctx1.sendIdx["stream"]=1;
  43909. $recv($8)._nextPutAll_("$recv(");
  43910. $ctx1.sendIdx["nextPutAll:"]=1;
  43911. $self._visit_(instr);
  43912. $recv($self._stream())._nextPutAll_(")");
  43913. return self;
  43914. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr})});
  43915. },
  43916. args: ["anIRInstruction"],
  43917. 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: ')'",
  43918. referencedClasses: [],
  43919. pragmas: [],
  43920. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  43921. }),
  43922. $globals.IRJSTranslator);
  43923. $core.addMethod(
  43924. $core.method({
  43925. selector: "visitSend:",
  43926. protocol: "visiting",
  43927. fn: function (anIRSend){
  43928. var self=this,$self=this;
  43929. return $core.withContext(function($ctx1) {
  43930. $self._visitReceiver_($recv(anIRSend)._receiver());
  43931. $recv($self._stream())._nextPutAll_(".".__comma($recv(anIRSend)._javaScriptSelector()));
  43932. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  43933. return self;
  43934. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend})});
  43935. },
  43936. args: ["anIRSend"],
  43937. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend javaScriptSelector.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  43938. referencedClasses: [],
  43939. pragmas: [],
  43940. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "javaScriptSelector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  43941. }),
  43942. $globals.IRJSTranslator);
  43943. $core.addMethod(
  43944. $core.method({
  43945. selector: "visitSuperSend:",
  43946. protocol: "visiting",
  43947. fn: function (anIRSend){
  43948. var self=this,$self=this;
  43949. return $core.withContext(function($ctx1) {
  43950. var $1,$4,$3,$2,$5;
  43951. $1=$self._stream();
  43952. $ctx1.sendIdx["stream"]=1;
  43953. $recv($1)._nextPutAll_("(");
  43954. $ctx1.sendIdx["nextPutAll:"]=1;
  43955. $recv($1)._lf();
  43956. $ctx1.sendIdx["lf"]=1;
  43957. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  43958. $ctx1.sendIdx["nextPutAll:"]=2;
  43959. $recv($1)._lf();
  43960. $ctx1.sendIdx["lf"]=2;
  43961. $4=$recv(anIRSend)._scope();
  43962. $ctx1.sendIdx["scope"]=1;
  43963. $3=$recv($4)._alias();
  43964. $ctx1.sendIdx["alias"]=1;
  43965. $2=$recv($3).__comma(".supercall = true,");
  43966. $ctx1.sendIdx[","]=1;
  43967. $recv($1)._nextPutAll_($2);
  43968. $ctx1.sendIdx["nextPutAll:"]=3;
  43969. $recv($1)._lf();
  43970. $ctx1.sendIdx["lf"]=3;
  43971. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43972. $ctx1.sendIdx["nextPutAll:"]=4;
  43973. $recv($1)._lf();
  43974. $ctx1.sendIdx["lf"]=4;
  43975. $self._writeActualSuperSend_(anIRSend);
  43976. $5=$self._stream();
  43977. $recv($5)._nextPutAll_(");");
  43978. $ctx1.sendIdx["nextPutAll:"]=5;
  43979. $recv($5)._lf();
  43980. $ctx1.sendIdx["lf"]=5;
  43981. $recv($5)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  43982. $ctx1.sendIdx["nextPutAll:"]=6;
  43983. $recv($5)._lf();
  43984. $ctx1.sendIdx["lf"]=6;
  43985. $recv($5)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  43986. $ctx1.sendIdx["nextPutAll:"]=7;
  43987. $recv($5)._lf();
  43988. $recv($5)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43989. return self;
  43990. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend})});
  43991. },
  43992. args: ["anIRSend"],
  43993. 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\x09self writeActualSuperSend: anIRSend.\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);'",
  43994. referencedClasses: [],
  43995. pragmas: [],
  43996. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "writeActualSuperSend:"]
  43997. }),
  43998. $globals.IRJSTranslator);
  43999. $core.addMethod(
  44000. $core.method({
  44001. selector: "writeActualSuperSend:",
  44002. protocol: "visiting",
  44003. fn: function (anIRSend){
  44004. var self=this,$self=this;
  44005. return $core.withContext(function($ctx1) {
  44006. var $1,$2;
  44007. $1=$self._stream();
  44008. $ctx1.sendIdx["stream"]=1;
  44009. $2="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  44010. $ctx1.sendIdx[","]=1;
  44011. $recv($1)._nextPutAll_($2);
  44012. $ctx1.sendIdx["nextPutAll:"]=1;
  44013. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  44014. $ctx1.sendIdx["nextPutAll:"]=2;
  44015. $recv($1)._nextPutAll_($recv($recv(anIRSend)._javaScriptSelector()).__comma(".apply("));
  44016. $ctx1.sendIdx["nextPutAll:"]=3;
  44017. $recv($1)._nextPutAll_("$self, ");
  44018. $ctx1.sendIdx["nextPutAll:"]=4;
  44019. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  44020. $recv($self._stream())._nextPutAll_(")");
  44021. return self;
  44022. }, function($ctx1) {$ctx1.fill(self,"writeActualSuperSend:",{anIRSend:anIRSend})});
  44023. },
  44024. args: ["anIRSend"],
  44025. source: "writeActualSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend javaScriptSelector, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream\x0a\x09\x09nextPutAll: ')'",
  44026. referencedClasses: [],
  44027. pragmas: [],
  44028. messageSends: ["nextPutAll:", "stream", ",", "asJavaScriptSource", "currentClass", "javaScriptSelector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  44029. }),
  44030. $globals.IRJSTranslator);
  44031. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  44032. $core.addMethod(
  44033. $core.method({
  44034. selector: "contents",
  44035. protocol: "accessing",
  44036. fn: function (){
  44037. var self=this,$self=this;
  44038. return $core.withContext(function($ctx1) {
  44039. return $recv($self.stream)._contents();
  44040. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  44041. },
  44042. args: [],
  44043. source: "contents\x0a\x09^ stream contents",
  44044. referencedClasses: [],
  44045. pragmas: [],
  44046. messageSends: ["contents"]
  44047. }),
  44048. $globals.JSStream);
  44049. $core.addMethod(
  44050. $core.method({
  44051. selector: "initialize",
  44052. protocol: "initialization",
  44053. fn: function (){
  44054. var self=this,$self=this;
  44055. return $core.withContext(function($ctx1) {
  44056. (
  44057. $ctx1.supercall = true,
  44058. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  44059. $ctx1.supercall = false;
  44060. $self.stream=""._writeStream();
  44061. return self;
  44062. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  44063. },
  44064. args: [],
  44065. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  44066. referencedClasses: [],
  44067. pragmas: [],
  44068. messageSends: ["initialize", "writeStream"]
  44069. }),
  44070. $globals.JSStream);
  44071. $core.addMethod(
  44072. $core.method({
  44073. selector: "lf",
  44074. protocol: "streaming",
  44075. fn: function (){
  44076. var self=this,$self=this;
  44077. return $core.withContext(function($ctx1) {
  44078. $recv($self.stream)._lf();
  44079. return self;
  44080. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  44081. },
  44082. args: [],
  44083. source: "lf\x0a\x09stream lf",
  44084. referencedClasses: [],
  44085. pragmas: [],
  44086. messageSends: ["lf"]
  44087. }),
  44088. $globals.JSStream);
  44089. $core.addMethod(
  44090. $core.method({
  44091. selector: "nextPut:",
  44092. protocol: "streaming",
  44093. fn: function (aString){
  44094. var self=this,$self=this;
  44095. return $core.withContext(function($ctx1) {
  44096. $recv($self.stream)._nextPut_(aString);
  44097. return self;
  44098. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  44099. },
  44100. args: ["aString"],
  44101. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  44102. referencedClasses: [],
  44103. pragmas: [],
  44104. messageSends: ["nextPut:"]
  44105. }),
  44106. $globals.JSStream);
  44107. $core.addMethod(
  44108. $core.method({
  44109. selector: "nextPutAll:",
  44110. protocol: "streaming",
  44111. fn: function (aString){
  44112. var self=this,$self=this;
  44113. return $core.withContext(function($ctx1) {
  44114. $recv($self.stream)._nextPutAll_(aString);
  44115. return self;
  44116. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString})});
  44117. },
  44118. args: ["aString"],
  44119. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  44120. referencedClasses: [],
  44121. pragmas: [],
  44122. messageSends: ["nextPutAll:"]
  44123. }),
  44124. $globals.JSStream);
  44125. $core.addMethod(
  44126. $core.method({
  44127. selector: "nextPutAssignLhs:rhs:",
  44128. protocol: "streaming",
  44129. fn: function (aBlock,anotherBlock){
  44130. var self=this,$self=this;
  44131. return $core.withContext(function($ctx1) {
  44132. $recv(aBlock)._value();
  44133. $ctx1.sendIdx["value"]=1;
  44134. $recv($self.stream)._nextPutAll_("=");
  44135. $recv(anotherBlock)._value();
  44136. return self;
  44137. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  44138. },
  44139. args: ["aBlock", "anotherBlock"],
  44140. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  44141. referencedClasses: [],
  44142. pragmas: [],
  44143. messageSends: ["value", "nextPutAll:"]
  44144. }),
  44145. $globals.JSStream);
  44146. $core.addMethod(
  44147. $core.method({
  44148. selector: "nextPutBlockContextFor:during:",
  44149. protocol: "streaming",
  44150. fn: function (anIRClosure,aBlock){
  44151. var self=this,$self=this;
  44152. return $core.withContext(function($ctx1) {
  44153. var $1,$2,$6,$5,$4,$3,$10,$9,$8,$7,$13,$12,$11,$14,$20,$19,$18,$17,$16,$15;
  44154. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  44155. if(!$core.assert($1)){
  44156. $2=$recv(aBlock)._value();
  44157. $ctx1.sendIdx["value"]=1;
  44158. return $2;
  44159. }
  44160. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44161. $ctx1.sendIdx["nextPutAll:"]=1;
  44162. $self._lf();
  44163. $ctx1.sendIdx["lf"]=1;
  44164. $6=$recv(anIRClosure)._scope();
  44165. $ctx1.sendIdx["scope"]=1;
  44166. $5=$recv($6)._alias();
  44167. $ctx1.sendIdx["alias"]=1;
  44168. $4="return $core.withContext(function(".__comma($5);
  44169. $ctx1.sendIdx[","]=2;
  44170. $3=$recv($4).__comma(") {");
  44171. $ctx1.sendIdx[","]=1;
  44172. $self._nextPutAll_($3);
  44173. $ctx1.sendIdx["nextPutAll:"]=2;
  44174. $self._lf();
  44175. $ctx1.sendIdx["lf"]=2;
  44176. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44177. $ctx1.sendIdx["nextPutAll:"]=3;
  44178. $self._lf();
  44179. $ctx1.sendIdx["lf"]=3;
  44180. $recv(aBlock)._value();
  44181. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44182. $ctx1.sendIdx["nextPutAll:"]=4;
  44183. $self._lf();
  44184. $ctx1.sendIdx["lf"]=4;
  44185. $10=$recv(anIRClosure)._scope();
  44186. $ctx1.sendIdx["scope"]=2;
  44187. $9=$recv($10)._alias();
  44188. $ctx1.sendIdx["alias"]=2;
  44189. $8="}, function(".__comma($9);
  44190. $ctx1.sendIdx[","]=4;
  44191. $7=$recv($8).__comma(") {");
  44192. $ctx1.sendIdx[","]=3;
  44193. $self._nextPutAll_($7);
  44194. $ctx1.sendIdx["nextPutAll:"]=5;
  44195. $13=$recv(anIRClosure)._scope();
  44196. $ctx1.sendIdx["scope"]=3;
  44197. $12=$recv($13)._alias();
  44198. $ctx1.sendIdx["alias"]=3;
  44199. $11=$recv($12).__comma(".fillBlock({");
  44200. $ctx1.sendIdx[","]=5;
  44201. $self._nextPutAll_($11);
  44202. $ctx1.sendIdx["nextPutAll:"]=6;
  44203. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  44204. return $core.withContext(function($ctx2) {
  44205. $14=$recv(each)._asVariableName();
  44206. $ctx2.sendIdx["asVariableName"]=1;
  44207. $self._nextPutAll_($14);
  44208. $ctx2.sendIdx["nextPutAll:"]=7;
  44209. $self._nextPutAll_(":");
  44210. $ctx2.sendIdx["nextPutAll:"]=8;
  44211. return $self._nextPutAll_($recv(each)._asVariableName());
  44212. $ctx2.sendIdx["nextPutAll:"]=9;
  44213. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44214. }),(function(){
  44215. return $core.withContext(function($ctx2) {
  44216. return $self._nextPutAll_(",");
  44217. $ctx2.sendIdx["nextPutAll:"]=10;
  44218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44219. }));
  44220. $self._nextPutAll_("},");
  44221. $ctx1.sendIdx["nextPutAll:"]=11;
  44222. $20=$recv(anIRClosure)._scope();
  44223. $ctx1.sendIdx["scope"]=4;
  44224. $19=$recv($20)._outerScope();
  44225. $18=$recv($19)._alias();
  44226. $17=$recv($18).__comma(",");
  44227. $16=$recv($17).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  44228. $ctx1.sendIdx[","]=7;
  44229. $15=$recv($16).__comma(")});");
  44230. $ctx1.sendIdx[","]=6;
  44231. $self._nextPutAll_($15);
  44232. $ctx1.sendIdx["nextPutAll:"]=12;
  44233. $self._lf();
  44234. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44235. return self;
  44236. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock})});
  44237. },
  44238. args: ["anIRClosure", "aBlock"],
  44239. 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);'",
  44240. referencedClasses: [],
  44241. pragmas: [],
  44242. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  44243. }),
  44244. $globals.JSStream);
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "nextPutClosureWith:arguments:",
  44248. protocol: "streaming",
  44249. fn: function (aBlock,anArray){
  44250. var self=this,$self=this;
  44251. return $core.withContext(function($ctx1) {
  44252. var $1,$2;
  44253. $recv($self.stream)._nextPutAll_("(function(");
  44254. $ctx1.sendIdx["nextPutAll:"]=1;
  44255. $recv(anArray)._do_separatedBy_((function(each){
  44256. return $core.withContext(function($ctx2) {
  44257. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  44258. $ctx2.sendIdx["nextPutAll:"]=2;
  44259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44260. }),(function(){
  44261. return $core.withContext(function($ctx2) {
  44262. return $recv($self.stream)._nextPut_(",");
  44263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44264. }));
  44265. $1=$self.stream;
  44266. $recv($1)._nextPutAll_("){");
  44267. $ctx1.sendIdx["nextPutAll:"]=3;
  44268. $recv($1)._lf();
  44269. $ctx1.sendIdx["lf"]=1;
  44270. $recv(aBlock)._value();
  44271. $2=$self.stream;
  44272. $recv($2)._lf();
  44273. $recv($2)._nextPutAll_("})");
  44274. return self;
  44275. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  44276. },
  44277. args: ["aBlock", "anArray"],
  44278. 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: '})'",
  44279. referencedClasses: [],
  44280. pragmas: [],
  44281. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  44282. }),
  44283. $globals.JSStream);
  44284. $core.addMethod(
  44285. $core.method({
  44286. selector: "nextPutContextFor:during:",
  44287. protocol: "streaming",
  44288. fn: function (aMethod,aBlock){
  44289. var self=this,$self=this;
  44290. return $core.withContext(function($ctx1) {
  44291. var $1,$2,$6,$5,$4,$3,$11,$10,$9,$8,$7,$12,$13;
  44292. $1=$recv(aMethod)._requiresSmalltalkContext();
  44293. if(!$core.assert($1)){
  44294. $2=$recv(aBlock)._value();
  44295. $ctx1.sendIdx["value"]=1;
  44296. return $2;
  44297. }
  44298. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44299. $ctx1.sendIdx["nextPutAll:"]=1;
  44300. $self._lf();
  44301. $ctx1.sendIdx["lf"]=1;
  44302. $6=$recv(aMethod)._scope();
  44303. $ctx1.sendIdx["scope"]=1;
  44304. $5=$recv($6)._alias();
  44305. $ctx1.sendIdx["alias"]=1;
  44306. $4="return $core.withContext(function(".__comma($5);
  44307. $ctx1.sendIdx[","]=2;
  44308. $3=$recv($4).__comma(") {");
  44309. $ctx1.sendIdx[","]=1;
  44310. $self._nextPutAll_($3);
  44311. $ctx1.sendIdx["nextPutAll:"]=2;
  44312. $self._lf();
  44313. $ctx1.sendIdx["lf"]=2;
  44314. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44315. $ctx1.sendIdx["nextPutAll:"]=3;
  44316. $self._lf();
  44317. $ctx1.sendIdx["lf"]=3;
  44318. $recv(aBlock)._value();
  44319. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44320. $ctx1.sendIdx["nextPutAll:"]=4;
  44321. $self._lf();
  44322. $ctx1.sendIdx["lf"]=4;
  44323. $11=$recv(aMethod)._scope();
  44324. $ctx1.sendIdx["scope"]=2;
  44325. $10=$recv($11)._alias();
  44326. $ctx1.sendIdx["alias"]=2;
  44327. $9="}, function(".__comma($10);
  44328. $ctx1.sendIdx[","]=5;
  44329. $8=$recv($9).__comma(") {");
  44330. $ctx1.sendIdx[","]=4;
  44331. $7=$recv($8).__comma($recv($recv(aMethod)._scope())._alias());
  44332. $ctx1.sendIdx[","]=3;
  44333. $self._nextPutAll_($7);
  44334. $ctx1.sendIdx["nextPutAll:"]=5;
  44335. $12=$recv(".fill(self,".__comma($recv($recv(aMethod)._selector())._asJavaScriptSource())).__comma(",{");
  44336. $ctx1.sendIdx[","]=6;
  44337. $self._nextPutAll_($12);
  44338. $ctx1.sendIdx["nextPutAll:"]=6;
  44339. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  44340. return $core.withContext(function($ctx2) {
  44341. $13=$recv(each)._asVariableName();
  44342. $ctx2.sendIdx["asVariableName"]=1;
  44343. $self._nextPutAll_($13);
  44344. $ctx2.sendIdx["nextPutAll:"]=7;
  44345. $self._nextPutAll_(":");
  44346. $ctx2.sendIdx["nextPutAll:"]=8;
  44347. return $self._nextPutAll_($recv(each)._asVariableName());
  44348. $ctx2.sendIdx["nextPutAll:"]=9;
  44349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44350. }),(function(){
  44351. return $core.withContext(function($ctx2) {
  44352. return $self._nextPutAll_(",");
  44353. $ctx2.sendIdx["nextPutAll:"]=10;
  44354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44355. }));
  44356. $self._nextPutAll_("})});");
  44357. $ctx1.sendIdx["nextPutAll:"]=11;
  44358. $self._lf();
  44359. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  44360. return self;
  44361. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock})});
  44362. },
  44363. args: ["aMethod", "aBlock"],
  44364. 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\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  44365. referencedClasses: [],
  44366. pragmas: [],
  44367. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName"]
  44368. }),
  44369. $globals.JSStream);
  44370. $core.addMethod(
  44371. $core.method({
  44372. selector: "nextPutFunctionWith:arguments:",
  44373. protocol: "streaming",
  44374. fn: function (aBlock,anArray){
  44375. var self=this,$self=this;
  44376. return $core.withContext(function($ctx1) {
  44377. var $1,$2,$3;
  44378. $recv($self.stream)._nextPutAll_("(function (");
  44379. $ctx1.sendIdx["nextPutAll:"]=1;
  44380. $recv(anArray)._do_separatedBy_((function(each){
  44381. return $core.withContext(function($ctx2) {
  44382. return $recv($self.stream)._nextPutAll_($recv(each)._asVariableName());
  44383. $ctx2.sendIdx["nextPutAll:"]=2;
  44384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44385. }),(function(){
  44386. return $core.withContext(function($ctx2) {
  44387. return $recv($self.stream)._nextPut_(",");
  44388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44389. }));
  44390. $1=$self.stream;
  44391. $recv($1)._nextPutAll_("){");
  44392. $ctx1.sendIdx["nextPutAll:"]=3;
  44393. $recv($1)._lf();
  44394. $ctx1.sendIdx["lf"]=1;
  44395. $2=$self.stream;
  44396. $recv($2)._nextPutAll_("var self=this,$self=this;");
  44397. $ctx1.sendIdx["nextPutAll:"]=4;
  44398. $recv($2)._lf();
  44399. $ctx1.sendIdx["lf"]=2;
  44400. $recv(aBlock)._value();
  44401. $3=$self.stream;
  44402. $recv($3)._lf();
  44403. $recv($3)._nextPutAll_("})");
  44404. return self;
  44405. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  44406. },
  44407. args: ["aBlock", "anArray"],
  44408. source: "nextPutFunctionWith: 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\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'",
  44409. referencedClasses: [],
  44410. pragmas: [],
  44411. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  44412. }),
  44413. $globals.JSStream);
  44414. $core.addMethod(
  44415. $core.method({
  44416. selector: "nextPutIf:then:",
  44417. protocol: "streaming",
  44418. fn: function (aBlock,anotherBlock){
  44419. var self=this,$self=this;
  44420. return $core.withContext(function($ctx1) {
  44421. var $1;
  44422. $recv($self.stream)._nextPutAll_("if(");
  44423. $ctx1.sendIdx["nextPutAll:"]=1;
  44424. $recv(aBlock)._value();
  44425. $ctx1.sendIdx["value"]=1;
  44426. $1=$self.stream;
  44427. $recv($1)._nextPutAll_("){");
  44428. $ctx1.sendIdx["nextPutAll:"]=2;
  44429. $recv($1)._lf();
  44430. $recv(anotherBlock)._value();
  44431. $recv($self.stream)._nextPutAll_("}");
  44432. $self._omitSemicolon_(true);
  44433. return self;
  44434. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  44435. },
  44436. args: ["aBlock", "anotherBlock"],
  44437. 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",
  44438. referencedClasses: [],
  44439. pragmas: [],
  44440. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  44441. }),
  44442. $globals.JSStream);
  44443. $core.addMethod(
  44444. $core.method({
  44445. selector: "nextPutIf:then:else:",
  44446. protocol: "streaming",
  44447. fn: function (aBlock,ifBlock,elseBlock){
  44448. var self=this,$self=this;
  44449. return $core.withContext(function($ctx1) {
  44450. var $1,$2;
  44451. $recv($self.stream)._nextPutAll_("if(");
  44452. $ctx1.sendIdx["nextPutAll:"]=1;
  44453. $recv(aBlock)._value();
  44454. $ctx1.sendIdx["value"]=1;
  44455. $1=$self.stream;
  44456. $recv($1)._nextPutAll_("){");
  44457. $ctx1.sendIdx["nextPutAll:"]=2;
  44458. $recv($1)._lf();
  44459. $ctx1.sendIdx["lf"]=1;
  44460. $recv(ifBlock)._value();
  44461. $ctx1.sendIdx["value"]=2;
  44462. $2=$self.stream;
  44463. $recv($2)._nextPutAll_("} else {");
  44464. $ctx1.sendIdx["nextPutAll:"]=3;
  44465. $recv($2)._lf();
  44466. $recv(elseBlock)._value();
  44467. $recv($self.stream)._nextPutAll_("}");
  44468. $self._omitSemicolon_(true);
  44469. return self;
  44470. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock})});
  44471. },
  44472. args: ["aBlock", "ifBlock", "elseBlock"],
  44473. 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",
  44474. referencedClasses: [],
  44475. pragmas: [],
  44476. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  44477. }),
  44478. $globals.JSStream);
  44479. $core.addMethod(
  44480. $core.method({
  44481. selector: "nextPutMethodDeclaration:with:",
  44482. protocol: "streaming",
  44483. fn: function (aMethod,aBlock){
  44484. var self=this,$self=this;
  44485. return $core.withContext(function($ctx1) {
  44486. var $1,$4,$3,$2,$7,$6,$5,$8,$11,$10,$9,$14,$13,$12,$17,$16,$15,$18;
  44487. $1=$self.stream;
  44488. $recv($1)._nextPutAll_("$core.method({");
  44489. $ctx1.sendIdx["nextPutAll:"]=1;
  44490. $recv($1)._lf();
  44491. $ctx1.sendIdx["lf"]=1;
  44492. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  44493. $ctx1.sendIdx["asJavaScriptSource"]=1;
  44494. $3="selector: ".__comma($4);
  44495. $ctx1.sendIdx[","]=2;
  44496. $2=$recv($3).__comma(",");
  44497. $ctx1.sendIdx[","]=1;
  44498. $recv($1)._nextPutAll_($2);
  44499. $ctx1.sendIdx["nextPutAll:"]=2;
  44500. $recv($1)._lf();
  44501. $ctx1.sendIdx["lf"]=2;
  44502. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  44503. $ctx1.sendIdx["asJavaScriptSource"]=2;
  44504. $6="source: ".__comma($7);
  44505. $ctx1.sendIdx[","]=4;
  44506. $5=$recv($6).__comma(",");
  44507. $ctx1.sendIdx[","]=3;
  44508. $recv($1)._nextPutAll_($5);
  44509. $ctx1.sendIdx["nextPutAll:"]=3;
  44510. $recv($1)._lf();
  44511. $ctx1.sendIdx["lf"]=3;
  44512. $recv(aBlock)._value();
  44513. $ctx1.sendIdx["value"]=1;
  44514. $8=$self.stream;
  44515. $11=$recv($globals.String)._lf();
  44516. $ctx1.sendIdx["lf"]=4;
  44517. $10=",".__comma($11);
  44518. $ctx1.sendIdx[","]=6;
  44519. $9=$recv($10).__comma("messageSends: ");
  44520. $ctx1.sendIdx[","]=5;
  44521. $recv($8)._nextPutAll_($9);
  44522. $ctx1.sendIdx["nextPutAll:"]=4;
  44523. $14=$recv($recv(aMethod)._messageSends())._asArray();
  44524. $ctx1.sendIdx["asArray"]=1;
  44525. $13=$recv($14)._asJavaScriptSource();
  44526. $ctx1.sendIdx["asJavaScriptSource"]=3;
  44527. $12=$recv($13).__comma(",");
  44528. $ctx1.sendIdx[","]=7;
  44529. $recv($8)._nextPutAll_($12);
  44530. $ctx1.sendIdx["nextPutAll:"]=5;
  44531. $recv($8)._lf();
  44532. $ctx1.sendIdx["lf"]=5;
  44533. $17=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  44534. return $core.withContext(function($ctx2) {
  44535. return $recv(each)._value();
  44536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44537. })))._asArray())._asJavaScriptSource();
  44538. $ctx1.sendIdx["asJavaScriptSource"]=4;
  44539. $16="args: ".__comma($17);
  44540. $15=$recv($16).__comma(",");
  44541. $ctx1.sendIdx[","]=8;
  44542. $recv($8)._nextPutAll_($15);
  44543. $ctx1.sendIdx["nextPutAll:"]=6;
  44544. $recv($8)._lf();
  44545. $recv($8)._nextPutAll_("referencedClasses: [");
  44546. $ctx1.sendIdx["nextPutAll:"]=7;
  44547. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  44548. return $core.withContext(function($ctx2) {
  44549. return $recv($self.stream)._nextPutAll_($recv(each)._asJavaScriptSource());
  44550. $ctx2.sendIdx["nextPutAll:"]=8;
  44551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44552. }),(function(){
  44553. return $core.withContext(function($ctx2) {
  44554. return $recv($self.stream)._nextPutAll_(",");
  44555. $ctx2.sendIdx["nextPutAll:"]=9;
  44556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44557. }));
  44558. $18=$self.stream;
  44559. $recv($18)._nextPutAll_("]");
  44560. $ctx1.sendIdx["nextPutAll:"]=10;
  44561. $recv($18)._nextPutAll_("})");
  44562. return self;
  44563. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock})});
  44564. },
  44565. args: ["aMethod", "aBlock"],
  44566. 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: '})'",
  44567. referencedClasses: ["String"],
  44568. pragmas: [],
  44569. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  44570. }),
  44571. $globals.JSStream);
  44572. $core.addMethod(
  44573. $core.method({
  44574. selector: "nextPutNonLocalReturnHandlingWith:",
  44575. protocol: "streaming",
  44576. fn: function (aBlock){
  44577. var self=this,$self=this;
  44578. return $core.withContext(function($ctx1) {
  44579. var $1,$2;
  44580. $1=$self.stream;
  44581. $recv($1)._nextPutAll_("var $early={};");
  44582. $ctx1.sendIdx["nextPutAll:"]=1;
  44583. $recv($1)._lf();
  44584. $ctx1.sendIdx["lf"]=1;
  44585. $recv($1)._nextPutAll_("try {");
  44586. $ctx1.sendIdx["nextPutAll:"]=2;
  44587. $recv($1)._lf();
  44588. $ctx1.sendIdx["lf"]=2;
  44589. $recv(aBlock)._value();
  44590. $2=$self.stream;
  44591. $recv($2)._nextPutAll_("}");
  44592. $ctx1.sendIdx["nextPutAll:"]=3;
  44593. $recv($2)._lf();
  44594. $ctx1.sendIdx["lf"]=3;
  44595. $recv($2)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  44596. $recv($2)._lf();
  44597. return self;
  44598. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock})});
  44599. },
  44600. args: ["aBlock"],
  44601. 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",
  44602. referencedClasses: [],
  44603. pragmas: [],
  44604. messageSends: ["nextPutAll:", "lf", "value"]
  44605. }),
  44606. $globals.JSStream);
  44607. $core.addMethod(
  44608. $core.method({
  44609. selector: "nextPutNonLocalReturnWith:",
  44610. protocol: "streaming",
  44611. fn: function (aBlock){
  44612. var self=this,$self=this;
  44613. return $core.withContext(function($ctx1) {
  44614. $recv($self.stream)._nextPutAll_("throw $early=[");
  44615. $ctx1.sendIdx["nextPutAll:"]=1;
  44616. $recv(aBlock)._value();
  44617. $recv($self.stream)._nextPutAll_("]");
  44618. return self;
  44619. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock})});
  44620. },
  44621. args: ["aBlock"],
  44622. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  44623. referencedClasses: [],
  44624. pragmas: [],
  44625. messageSends: ["nextPutAll:", "value"]
  44626. }),
  44627. $globals.JSStream);
  44628. $core.addMethod(
  44629. $core.method({
  44630. selector: "nextPutReturnWith:",
  44631. protocol: "streaming",
  44632. fn: function (aBlock){
  44633. var self=this,$self=this;
  44634. return $core.withContext(function($ctx1) {
  44635. $recv($self.stream)._nextPutAll_("return ");
  44636. $recv(aBlock)._value();
  44637. return self;
  44638. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock})});
  44639. },
  44640. args: ["aBlock"],
  44641. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  44642. referencedClasses: [],
  44643. pragmas: [],
  44644. messageSends: ["nextPutAll:", "value"]
  44645. }),
  44646. $globals.JSStream);
  44647. $core.addMethod(
  44648. $core.method({
  44649. selector: "nextPutSendIndexFor:",
  44650. protocol: "streaming",
  44651. fn: function (anIRSend){
  44652. var self=this,$self=this;
  44653. return $core.withContext(function($ctx1) {
  44654. $self._nextPutAll_(";");
  44655. $ctx1.sendIdx["nextPutAll:"]=1;
  44656. $self._lf();
  44657. $ctx1.sendIdx["lf"]=1;
  44658. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  44659. $ctx1.sendIdx["nextPutAll:"]=2;
  44660. $self._lf();
  44661. $ctx1.sendIdx["lf"]=2;
  44662. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  44663. $ctx1.sendIdx["nextPutAll:"]=3;
  44664. $self._nextPutAll_(".sendIdx[");
  44665. $ctx1.sendIdx["nextPutAll:"]=4;
  44666. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  44667. $ctx1.sendIdx["nextPutAll:"]=5;
  44668. $self._nextPutAll_("]=");
  44669. $ctx1.sendIdx["nextPutAll:"]=6;
  44670. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  44671. $ctx1.sendIdx["nextPutAll:"]=7;
  44672. $self._nextPutAll_(";");
  44673. $ctx1.sendIdx["nextPutAll:"]=8;
  44674. $self._lf();
  44675. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  44676. return self;
  44677. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend})});
  44678. },
  44679. args: ["anIRSend"],
  44680. 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)'",
  44681. referencedClasses: [],
  44682. pragmas: [],
  44683. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  44684. }),
  44685. $globals.JSStream);
  44686. $core.addMethod(
  44687. $core.method({
  44688. selector: "nextPutStatementWith:",
  44689. protocol: "streaming",
  44690. fn: function (aBlock){
  44691. var self=this,$self=this;
  44692. return $core.withContext(function($ctx1) {
  44693. var $1;
  44694. $self._omitSemicolon_(false);
  44695. $ctx1.sendIdx["omitSemicolon:"]=1;
  44696. $recv(aBlock)._value();
  44697. $1=$self._omitSemicolon();
  44698. if(!$core.assert($1)){
  44699. $recv($self.stream)._nextPutAll_(";");
  44700. }
  44701. $self._omitSemicolon_(false);
  44702. $recv($self.stream)._lf();
  44703. return self;
  44704. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock})});
  44705. },
  44706. args: ["aBlock"],
  44707. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  44708. referencedClasses: [],
  44709. pragmas: [],
  44710. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  44711. }),
  44712. $globals.JSStream);
  44713. $core.addMethod(
  44714. $core.method({
  44715. selector: "nextPutVars:",
  44716. protocol: "streaming",
  44717. fn: function (aCollection){
  44718. var self=this,$self=this;
  44719. return $core.withContext(function($ctx1) {
  44720. var $1;
  44721. $recv(aCollection)._ifNotEmpty_((function(){
  44722. return $core.withContext(function($ctx2) {
  44723. $recv($self.stream)._nextPutAll_("var ");
  44724. $ctx2.sendIdx["nextPutAll:"]=1;
  44725. $recv(aCollection)._do_separatedBy_((function(each){
  44726. return $core.withContext(function($ctx3) {
  44727. return $recv($self.stream)._nextPutAll_(each);
  44728. $ctx3.sendIdx["nextPutAll:"]=2;
  44729. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44730. }),(function(){
  44731. return $core.withContext(function($ctx3) {
  44732. return $recv($self.stream)._nextPutAll_(",");
  44733. $ctx3.sendIdx["nextPutAll:"]=3;
  44734. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44735. }));
  44736. $1=$self.stream;
  44737. $recv($1)._nextPutAll_(";");
  44738. return $recv($1)._lf();
  44739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44740. }));
  44741. return self;
  44742. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection})});
  44743. },
  44744. args: ["aCollection"],
  44745. 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 ]",
  44746. referencedClasses: [],
  44747. pragmas: [],
  44748. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  44749. }),
  44750. $globals.JSStream);
  44751. $core.addMethod(
  44752. $core.method({
  44753. selector: "omitSemicolon",
  44754. protocol: "accessing",
  44755. fn: function (){
  44756. var self=this,$self=this;
  44757. return $self.omitSemicolon;
  44758. },
  44759. args: [],
  44760. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  44761. referencedClasses: [],
  44762. pragmas: [],
  44763. messageSends: []
  44764. }),
  44765. $globals.JSStream);
  44766. $core.addMethod(
  44767. $core.method({
  44768. selector: "omitSemicolon:",
  44769. protocol: "accessing",
  44770. fn: function (aBoolean){
  44771. var self=this,$self=this;
  44772. $self.omitSemicolon=aBoolean;
  44773. return self;
  44774. },
  44775. args: ["aBoolean"],
  44776. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  44777. referencedClasses: [],
  44778. pragmas: [],
  44779. messageSends: []
  44780. }),
  44781. $globals.JSStream);
  44782. $core.addMethod(
  44783. $core.method({
  44784. selector: "isReferenced",
  44785. protocol: "*Compiler-IR",
  44786. fn: function (){
  44787. var self=this,$self=this;
  44788. return $core.withContext(function($ctx1) {
  44789. var $2,$1,$4,$3,$6,$5;
  44790. $2=$self._parent();
  44791. $ctx1.sendIdx["parent"]=1;
  44792. $1=$recv($2)._isSequenceNode();
  44793. if($core.assert($1)){
  44794. return false;
  44795. }
  44796. $4=$self._parent();
  44797. $ctx1.sendIdx["parent"]=2;
  44798. $3=$recv($4)._isAssignmentNode();
  44799. if($core.assert($3)){
  44800. return false;
  44801. }
  44802. $6=$self._parent();
  44803. $ctx1.sendIdx["parent"]=3;
  44804. $5=$recv($6)._isCascadeNode();
  44805. if($core.assert($5)){
  44806. return $recv($self._parent())._isReferenced();
  44807. }
  44808. return true;
  44809. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{})});
  44810. },
  44811. args: [],
  44812. 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\x09self parent isSequenceNode ifTrue: [ ^ false ].\x0a\x09self parent isAssignmentNode ifTrue: [ ^ false ].\x0a\x09self parent isCascadeNode ifTrue: [ ^ self parent isReferenced ].\x0a\x09\x0a\x09^ true",
  44813. referencedClasses: [],
  44814. pragmas: [],
  44815. messageSends: ["ifTrue:", "isSequenceNode", "parent", "isAssignmentNode", "isCascadeNode", "isReferenced"]
  44816. }),
  44817. $globals.ASTNode);
  44818. $core.addMethod(
  44819. $core.method({
  44820. selector: "subtreeNeedsAliasing",
  44821. protocol: "*Compiler-IR",
  44822. fn: function (){
  44823. var self=this,$self=this;
  44824. return $core.withContext(function($ctx1) {
  44825. return $recv($self._shouldBeAliased())._or_((function(){
  44826. return $core.withContext(function($ctx2) {
  44827. return $recv($self._dagChildren())._anySatisfy_((function(each){
  44828. return $core.withContext(function($ctx3) {
  44829. return $recv(each)._subtreeNeedsAliasing();
  44830. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44831. }));
  44832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44833. }));
  44834. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44835. },
  44836. args: [],
  44837. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  44838. referencedClasses: [],
  44839. pragmas: [],
  44840. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  44841. }),
  44842. $globals.ASTNode);
  44843. $core.addMethod(
  44844. $core.method({
  44845. selector: "shouldBeAliased",
  44846. protocol: "*Compiler-IR",
  44847. fn: function (){
  44848. var self=this,$self=this;
  44849. return $core.withContext(function($ctx1) {
  44850. var $1;
  44851. $1=(
  44852. $ctx1.supercall = true,
  44853. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  44854. $ctx1.supercall = false;
  44855. return $recv($1)._or_((function(){
  44856. return $core.withContext(function($ctx2) {
  44857. return $self._isReferenced();
  44858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44859. }));
  44860. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{})});
  44861. },
  44862. args: [],
  44863. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  44864. referencedClasses: [],
  44865. pragmas: [],
  44866. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  44867. }),
  44868. $globals.AssignmentNode);
  44869. $core.addMethod(
  44870. $core.method({
  44871. selector: "appendToInstruction:",
  44872. protocol: "*Compiler-IR",
  44873. fn: function (anIRInstruction){
  44874. var self=this,$self=this;
  44875. return $core.withContext(function($ctx1) {
  44876. $recv(anIRInstruction)._appendBlock_(self);
  44877. return self;
  44878. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction})});
  44879. },
  44880. args: ["anIRInstruction"],
  44881. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  44882. referencedClasses: [],
  44883. pragmas: [],
  44884. messageSends: ["appendBlock:"]
  44885. }),
  44886. $globals.BlockClosure);
  44887. $core.addMethod(
  44888. $core.method({
  44889. selector: "subtreeNeedsAliasing",
  44890. protocol: "*Compiler-IR",
  44891. fn: function (){
  44892. var self=this,$self=this;
  44893. return $core.withContext(function($ctx1) {
  44894. return $self._shouldBeAliased();
  44895. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44896. },
  44897. args: [],
  44898. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  44899. referencedClasses: [],
  44900. pragmas: [],
  44901. messageSends: ["shouldBeAliased"]
  44902. }),
  44903. $globals.BlockNode);
  44904. $core.addMethod(
  44905. $core.method({
  44906. selector: "subtreeNeedsAliasing",
  44907. protocol: "*Compiler-IR",
  44908. fn: function (){
  44909. var self=this,$self=this;
  44910. return $core.withContext(function($ctx1) {
  44911. return $recv($recv($self._parent())._isSequenceNode())._not();
  44912. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44913. },
  44914. args: [],
  44915. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  44916. referencedClasses: [],
  44917. pragmas: [],
  44918. messageSends: ["not", "isSequenceNode", "parent"]
  44919. }),
  44920. $globals.CascadeNode);
  44921. $core.addMethod(
  44922. $core.method({
  44923. selector: "shouldBeAliased",
  44924. protocol: "*Compiler-IR",
  44925. fn: function (){
  44926. var self=this,$self=this;
  44927. var sends;
  44928. return $core.withContext(function($ctx1) {
  44929. var $2,$1;
  44930. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  44931. $2=(
  44932. $ctx1.supercall = true,
  44933. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  44934. $ctx1.supercall = false;
  44935. $1=$recv($2)._or_((function(){
  44936. return $core.withContext(function($ctx2) {
  44937. return $recv($self._isReferenced())._and_((function(){
  44938. return $core.withContext(function($ctx3) {
  44939. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  44940. return $core.withContext(function($ctx4) {
  44941. return $self._superSend();
  44942. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  44943. }));
  44944. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44945. }));
  44946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44947. }));
  44948. $ctx1.sendIdx["or:"]=1;
  44949. return $1;
  44950. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends})});
  44951. },
  44952. args: [],
  44953. 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 ] ] ])",
  44954. referencedClasses: [],
  44955. pragmas: [],
  44956. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  44957. }),
  44958. $globals.SendNode);
  44959. $core.addMethod(
  44960. $core.method({
  44961. selector: "subtreeNeedsAliasing",
  44962. protocol: "*Compiler-IR",
  44963. fn: function (){
  44964. var self=this,$self=this;
  44965. return $core.withContext(function($ctx1) {
  44966. return $recv($self._shouldBeInlined())._or_((function(){
  44967. return $core.withContext(function($ctx2) {
  44968. return (
  44969. $ctx2.supercall = true,
  44970. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  44971. $ctx2.supercall = false;
  44972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44973. }));
  44974. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  44975. },
  44976. args: [],
  44977. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  44978. referencedClasses: [],
  44979. pragmas: [],
  44980. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  44981. }),
  44982. $globals.SendNode);
  44983. });
  44984. define('amber/core/Compiler-Inlining',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-IR", "amber/core/Compiler-Semantic", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  44985. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44986. var $pkg = $core.addPackage("Compiler-Inlining");
  44987. $pkg.innerEval = function (expr) { return eval(expr); };
  44988. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  44989. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  44990. $core.addMethod(
  44991. $core.method({
  44992. selector: "visitSendNode:",
  44993. protocol: "visiting",
  44994. fn: function (aNode){
  44995. var self=this,$self=this;
  44996. return $core.withContext(function($ctx1) {
  44997. var $1,$2,$3,$4,$receiver;
  44998. $1=$recv(aNode)._superSend();
  44999. if(!$core.assert($1)){
  45000. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  45001. if($core.assert($2)){
  45002. $recv(aNode)._shouldBeInlined_(true);
  45003. $3=$recv(aNode)._receiver();
  45004. if(($receiver = $3) == null || $receiver.a$nil){
  45005. $3;
  45006. } else {
  45007. var receiver;
  45008. receiver=$receiver;
  45009. $recv(receiver)._shouldBeAliased_(true);
  45010. }
  45011. }
  45012. }
  45013. $4=(
  45014. $ctx1.supercall = true,
  45015. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  45016. $ctx1.supercall = false;
  45017. return $4;
  45018. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  45019. },
  45020. args: ["aNode"],
  45021. 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",
  45022. referencedClasses: ["IRSendInliner"],
  45023. pragmas: [],
  45024. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  45025. }),
  45026. $globals.ASTPreInliner);
  45027. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  45028. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  45029. $core.addMethod(
  45030. $core.method({
  45031. selector: "acceptDagVisitor:",
  45032. protocol: "visiting",
  45033. fn: function (aVisitor){
  45034. var self=this,$self=this;
  45035. return $core.withContext(function($ctx1) {
  45036. $recv(aVisitor)._visitIRInlinedClosure_(self);
  45037. return self;
  45038. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45039. },
  45040. args: ["aVisitor"],
  45041. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  45042. referencedClasses: [],
  45043. pragmas: [],
  45044. messageSends: ["visitIRInlinedClosure:"]
  45045. }),
  45046. $globals.IRInlinedClosure);
  45047. $core.addMethod(
  45048. $core.method({
  45049. selector: "isInlined",
  45050. protocol: "testing",
  45051. fn: function (){
  45052. var self=this,$self=this;
  45053. return true;
  45054. },
  45055. args: [],
  45056. source: "isInlined\x0a\x09^ true",
  45057. referencedClasses: [],
  45058. pragmas: [],
  45059. messageSends: []
  45060. }),
  45061. $globals.IRInlinedClosure);
  45062. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  45063. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  45064. $core.addMethod(
  45065. $core.method({
  45066. selector: "acceptDagVisitor:",
  45067. protocol: "visiting",
  45068. fn: function (aVisitor){
  45069. var self=this,$self=this;
  45070. return $core.withContext(function($ctx1) {
  45071. $recv(aVisitor)._visitInlinedSend_(self);
  45072. return self;
  45073. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45074. },
  45075. args: ["aVisitor"],
  45076. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  45077. referencedClasses: [],
  45078. pragmas: [],
  45079. messageSends: ["visitInlinedSend:"]
  45080. }),
  45081. $globals.IRInlinedSend);
  45082. $core.addMethod(
  45083. $core.method({
  45084. selector: "internalVariables",
  45085. protocol: "accessing",
  45086. fn: function (){
  45087. var self=this,$self=this;
  45088. return [];
  45089. },
  45090. args: [],
  45091. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  45092. referencedClasses: [],
  45093. pragmas: [],
  45094. messageSends: []
  45095. }),
  45096. $globals.IRInlinedSend);
  45097. $core.addMethod(
  45098. $core.method({
  45099. selector: "isInlined",
  45100. protocol: "testing",
  45101. fn: function (){
  45102. var self=this,$self=this;
  45103. return true;
  45104. },
  45105. args: [],
  45106. source: "isInlined\x0a\x09^ true",
  45107. referencedClasses: [],
  45108. pragmas: [],
  45109. messageSends: []
  45110. }),
  45111. $globals.IRInlinedSend);
  45112. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45113. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  45114. $core.addMethod(
  45115. $core.method({
  45116. selector: "acceptDagVisitor:",
  45117. protocol: "visiting",
  45118. fn: function (aVisitor){
  45119. var self=this,$self=this;
  45120. return $core.withContext(function($ctx1) {
  45121. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  45122. return self;
  45123. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45124. },
  45125. args: ["aVisitor"],
  45126. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  45127. referencedClasses: [],
  45128. pragmas: [],
  45129. messageSends: ["visitIRInlinedIfFalse:"]
  45130. }),
  45131. $globals.IRInlinedIfFalse);
  45132. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45133. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  45134. $core.addMethod(
  45135. $core.method({
  45136. selector: "acceptDagVisitor:",
  45137. protocol: "visiting",
  45138. fn: function (aVisitor){
  45139. var self=this,$self=this;
  45140. return $core.withContext(function($ctx1) {
  45141. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  45142. return self;
  45143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45144. },
  45145. args: ["aVisitor"],
  45146. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  45147. referencedClasses: [],
  45148. pragmas: [],
  45149. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  45150. }),
  45151. $globals.IRInlinedIfNilIfNotNil);
  45152. $core.addMethod(
  45153. $core.method({
  45154. selector: "internalVariables",
  45155. protocol: "accessing",
  45156. fn: function (){
  45157. var self=this,$self=this;
  45158. return $core.withContext(function($ctx1) {
  45159. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  45160. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{})});
  45161. },
  45162. args: [],
  45163. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  45164. referencedClasses: ["Array"],
  45165. pragmas: [],
  45166. messageSends: ["with:", "receiverInternalVariable"]
  45167. }),
  45168. $globals.IRInlinedIfNilIfNotNil);
  45169. $core.addMethod(
  45170. $core.method({
  45171. selector: "receiverInternalVariable",
  45172. protocol: "accessing",
  45173. fn: function (){
  45174. var self=this,$self=this;
  45175. return $core.withContext(function($ctx1) {
  45176. var $1;
  45177. $1=$recv($globals.IRVariable)._new();
  45178. $ctx1.sendIdx["new"]=1;
  45179. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  45180. return $recv($1)._yourself();
  45181. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{})});
  45182. },
  45183. args: [],
  45184. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  45185. referencedClasses: ["IRVariable", "AliasVar"],
  45186. pragmas: [],
  45187. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  45188. }),
  45189. $globals.IRInlinedIfNilIfNotNil);
  45190. $core.addMethod(
  45191. $core.method({
  45192. selector: "receiverInternalVariableName",
  45193. protocol: "accessing",
  45194. fn: function (){
  45195. var self=this,$self=this;
  45196. return "$receiver";
  45197. },
  45198. args: [],
  45199. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  45200. referencedClasses: [],
  45201. pragmas: [],
  45202. messageSends: []
  45203. }),
  45204. $globals.IRInlinedIfNilIfNotNil);
  45205. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45206. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  45207. $core.addMethod(
  45208. $core.method({
  45209. selector: "acceptDagVisitor:",
  45210. protocol: "visiting",
  45211. fn: function (aVisitor){
  45212. var self=this,$self=this;
  45213. return $core.withContext(function($ctx1) {
  45214. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  45215. return self;
  45216. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45217. },
  45218. args: ["aVisitor"],
  45219. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  45220. referencedClasses: [],
  45221. pragmas: [],
  45222. messageSends: ["visitIRInlinedIfTrue:"]
  45223. }),
  45224. $globals.IRInlinedIfTrue);
  45225. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  45226. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  45227. $core.addMethod(
  45228. $core.method({
  45229. selector: "acceptDagVisitor:",
  45230. protocol: "visiting",
  45231. fn: function (aVisitor){
  45232. var self=this,$self=this;
  45233. return $core.withContext(function($ctx1) {
  45234. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  45235. return self;
  45236. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45237. },
  45238. args: ["aVisitor"],
  45239. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  45240. referencedClasses: [],
  45241. pragmas: [],
  45242. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  45243. }),
  45244. $globals.IRInlinedIfTrueIfFalse);
  45245. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  45246. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  45247. $core.addMethod(
  45248. $core.method({
  45249. selector: "acceptDagVisitor:",
  45250. protocol: "visiting",
  45251. fn: function (aVisitor){
  45252. var self=this,$self=this;
  45253. return $core.withContext(function($ctx1) {
  45254. $recv(aVisitor)._visitIRInlinedSequence_(self);
  45255. return self;
  45256. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  45257. },
  45258. args: ["aVisitor"],
  45259. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  45260. referencedClasses: [],
  45261. pragmas: [],
  45262. messageSends: ["visitIRInlinedSequence:"]
  45263. }),
  45264. $globals.IRInlinedSequence);
  45265. $core.addMethod(
  45266. $core.method({
  45267. selector: "isInlined",
  45268. protocol: "testing",
  45269. fn: function (){
  45270. var self=this,$self=this;
  45271. return true;
  45272. },
  45273. args: [],
  45274. source: "isInlined\x0a\x09^ true",
  45275. referencedClasses: [],
  45276. pragmas: [],
  45277. messageSends: []
  45278. }),
  45279. $globals.IRInlinedSequence);
  45280. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  45281. $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`";
  45282. $core.addMethod(
  45283. $core.method({
  45284. selector: "assignmentInliner",
  45285. protocol: "factory",
  45286. fn: function (){
  45287. var self=this,$self=this;
  45288. return $core.withContext(function($ctx1) {
  45289. var $1;
  45290. $1=$recv($globals.IRAssignmentInliner)._new();
  45291. $recv($1)._translator_(self);
  45292. return $recv($1)._yourself();
  45293. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{})});
  45294. },
  45295. args: [],
  45296. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45297. referencedClasses: ["IRAssignmentInliner"],
  45298. pragmas: [],
  45299. messageSends: ["translator:", "new", "yourself"]
  45300. }),
  45301. $globals.IRInliner);
  45302. $core.addMethod(
  45303. $core.method({
  45304. selector: "returnInliner",
  45305. protocol: "factory",
  45306. fn: function (){
  45307. var self=this,$self=this;
  45308. return $core.withContext(function($ctx1) {
  45309. var $1;
  45310. $1=$recv($globals.IRReturnInliner)._new();
  45311. $recv($1)._translator_(self);
  45312. return $recv($1)._yourself();
  45313. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{})});
  45314. },
  45315. args: [],
  45316. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45317. referencedClasses: ["IRReturnInliner"],
  45318. pragmas: [],
  45319. messageSends: ["translator:", "new", "yourself"]
  45320. }),
  45321. $globals.IRInliner);
  45322. $core.addMethod(
  45323. $core.method({
  45324. selector: "sendInliner",
  45325. protocol: "factory",
  45326. fn: function (){
  45327. var self=this,$self=this;
  45328. return $core.withContext(function($ctx1) {
  45329. var $1;
  45330. $1=$recv($globals.IRSendInliner)._new();
  45331. $recv($1)._translator_(self);
  45332. return $recv($1)._yourself();
  45333. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{})});
  45334. },
  45335. args: [],
  45336. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  45337. referencedClasses: ["IRSendInliner"],
  45338. pragmas: [],
  45339. messageSends: ["translator:", "new", "yourself"]
  45340. }),
  45341. $globals.IRInliner);
  45342. $core.addMethod(
  45343. $core.method({
  45344. selector: "shouldInlineAssignment:",
  45345. protocol: "testing",
  45346. fn: function (anIRAssignment){
  45347. var self=this,$self=this;
  45348. return $core.withContext(function($ctx1) {
  45349. var $3,$2,$1;
  45350. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  45351. return $core.withContext(function($ctx2) {
  45352. $3=$recv(anIRAssignment)._right();
  45353. $ctx2.sendIdx["right"]=1;
  45354. $2=$recv($3)._isSend();
  45355. return $recv($2)._and_((function(){
  45356. return $core.withContext(function($ctx3) {
  45357. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  45358. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45359. }));
  45360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45361. }));
  45362. $ctx1.sendIdx["and:"]=1;
  45363. return $1;
  45364. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment})});
  45365. },
  45366. args: ["anIRAssignment"],
  45367. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  45368. referencedClasses: [],
  45369. pragmas: [],
  45370. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  45371. }),
  45372. $globals.IRInliner);
  45373. $core.addMethod(
  45374. $core.method({
  45375. selector: "shouldInlineReturn:",
  45376. protocol: "testing",
  45377. fn: function (anIRReturn){
  45378. var self=this,$self=this;
  45379. return $core.withContext(function($ctx1) {
  45380. var $3,$2,$1;
  45381. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  45382. return $core.withContext(function($ctx2) {
  45383. $3=$recv(anIRReturn)._expression();
  45384. $ctx2.sendIdx["expression"]=1;
  45385. $2=$recv($3)._isSend();
  45386. return $recv($2)._and_((function(){
  45387. return $core.withContext(function($ctx3) {
  45388. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  45389. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45390. }));
  45391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45392. }));
  45393. $ctx1.sendIdx["and:"]=1;
  45394. return $1;
  45395. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn})});
  45396. },
  45397. args: ["anIRReturn"],
  45398. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  45399. referencedClasses: [],
  45400. pragmas: [],
  45401. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  45402. }),
  45403. $globals.IRInliner);
  45404. $core.addMethod(
  45405. $core.method({
  45406. selector: "shouldInlineSend:",
  45407. protocol: "testing",
  45408. fn: function (anIRSend){
  45409. var self=this,$self=this;
  45410. return $core.withContext(function($ctx1) {
  45411. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  45412. return $core.withContext(function($ctx2) {
  45413. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  45414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45415. }));
  45416. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend})});
  45417. },
  45418. args: ["anIRSend"],
  45419. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  45420. referencedClasses: ["IRSendInliner"],
  45421. pragmas: [],
  45422. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  45423. }),
  45424. $globals.IRInliner);
  45425. $core.addMethod(
  45426. $core.method({
  45427. selector: "visitIRAssignment:",
  45428. protocol: "visiting",
  45429. fn: function (anIRAssignment){
  45430. var self=this,$self=this;
  45431. return $core.withContext(function($ctx1) {
  45432. var $1;
  45433. $1=$self._shouldInlineAssignment_(anIRAssignment);
  45434. if($core.assert($1)){
  45435. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  45436. } else {
  45437. return (
  45438. $ctx1.supercall = true,
  45439. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  45440. $ctx1.supercall = false;
  45441. }
  45442. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  45443. },
  45444. args: ["anIRAssignment"],
  45445. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  45446. referencedClasses: [],
  45447. pragmas: [],
  45448. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  45449. }),
  45450. $globals.IRInliner);
  45451. $core.addMethod(
  45452. $core.method({
  45453. selector: "visitIRNonLocalReturn:",
  45454. protocol: "visiting",
  45455. fn: function (anIRNonLocalReturn){
  45456. var self=this,$self=this;
  45457. var localReturn;
  45458. return $core.withContext(function($ctx1) {
  45459. var $2,$1,$4,$3,$5,$6,$7;
  45460. $2=$recv(anIRNonLocalReturn)._scope();
  45461. $ctx1.sendIdx["scope"]=1;
  45462. $1=$recv($2)._canInlineNonLocalReturns();
  45463. if($core.assert($1)){
  45464. $4=$recv(anIRNonLocalReturn)._scope();
  45465. $ctx1.sendIdx["scope"]=2;
  45466. $3=$recv($4)._methodScope();
  45467. $5=$recv(anIRNonLocalReturn)._scope();
  45468. $ctx1.sendIdx["scope"]=3;
  45469. $recv($3)._removeNonLocalReturn_($5);
  45470. $6=$recv($globals.IRReturn)._new();
  45471. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  45472. localReturn=$recv($6)._yourself();
  45473. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  45474. return $core.withContext(function($ctx2) {
  45475. return $recv(localReturn)._add_(each);
  45476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45477. }));
  45478. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  45479. return $self._visitIRReturn_(localReturn);
  45480. }
  45481. $7=(
  45482. $ctx1.supercall = true,
  45483. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  45484. $ctx1.supercall = false;
  45485. return $7;
  45486. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn})});
  45487. },
  45488. args: ["anIRNonLocalReturn"],
  45489. 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",
  45490. referencedClasses: ["IRReturn"],
  45491. pragmas: [],
  45492. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  45493. }),
  45494. $globals.IRInliner);
  45495. $core.addMethod(
  45496. $core.method({
  45497. selector: "visitIRReturn:",
  45498. protocol: "visiting",
  45499. fn: function (anIRReturn){
  45500. var self=this,$self=this;
  45501. return $core.withContext(function($ctx1) {
  45502. var $1;
  45503. $1=$self._shouldInlineReturn_(anIRReturn);
  45504. if($core.assert($1)){
  45505. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  45506. } else {
  45507. return (
  45508. $ctx1.supercall = true,
  45509. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  45510. $ctx1.supercall = false;
  45511. }
  45512. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  45513. },
  45514. args: ["anIRReturn"],
  45515. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  45516. referencedClasses: [],
  45517. pragmas: [],
  45518. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  45519. }),
  45520. $globals.IRInliner);
  45521. $core.addMethod(
  45522. $core.method({
  45523. selector: "visitIRSend:",
  45524. protocol: "visiting",
  45525. fn: function (anIRSend){
  45526. var self=this,$self=this;
  45527. return $core.withContext(function($ctx1) {
  45528. var $1;
  45529. $1=$self._shouldInlineSend_(anIRSend);
  45530. if($core.assert($1)){
  45531. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  45532. } else {
  45533. return (
  45534. $ctx1.supercall = true,
  45535. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  45536. $ctx1.supercall = false;
  45537. }
  45538. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  45539. },
  45540. args: ["anIRSend"],
  45541. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  45542. referencedClasses: [],
  45543. pragmas: [],
  45544. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  45545. }),
  45546. $globals.IRInliner);
  45547. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  45548. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  45549. $core.addMethod(
  45550. $core.method({
  45551. selector: "visitIRInlinedClosure:",
  45552. protocol: "visiting",
  45553. fn: function (anIRInlinedClosure){
  45554. var self=this,$self=this;
  45555. return $core.withContext(function($ctx1) {
  45556. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  45557. return $core.withContext(function($ctx2) {
  45558. return $recv($recv(each)._name())._asVariableName();
  45559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45560. })));
  45561. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  45562. return self;
  45563. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  45564. },
  45565. args: ["anIRInlinedClosure"],
  45566. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  45567. referencedClasses: [],
  45568. pragmas: [],
  45569. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  45570. }),
  45571. $globals.IRInliningJSTranslator);
  45572. $core.addMethod(
  45573. $core.method({
  45574. selector: "visitIRInlinedIfFalse:",
  45575. protocol: "visiting",
  45576. fn: function (anIRInlinedIfFalse){
  45577. var self=this,$self=this;
  45578. return $core.withContext(function($ctx1) {
  45579. var $1,$2,$4,$3;
  45580. $1=$self._stream();
  45581. $ctx1.sendIdx["stream"]=1;
  45582. $recv($1)._nextPutIf_then_((function(){
  45583. return $core.withContext(function($ctx2) {
  45584. $2=$self._stream();
  45585. $ctx2.sendIdx["stream"]=2;
  45586. $recv($2)._nextPutAll_("!$core.assert(");
  45587. $ctx2.sendIdx["nextPutAll:"]=1;
  45588. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  45589. $ctx2.sendIdx["dagChildren"]=1;
  45590. $3=$recv($4)._first();
  45591. $self._visit_($3);
  45592. $ctx2.sendIdx["visit:"]=1;
  45593. return $recv($self._stream())._nextPutAll_(")");
  45594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45595. }),(function(){
  45596. return $core.withContext(function($ctx2) {
  45597. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  45598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45599. }));
  45600. return self;
  45601. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse})});
  45602. },
  45603. args: ["anIRInlinedIfFalse"],
  45604. 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 ]",
  45605. referencedClasses: [],
  45606. pragmas: [],
  45607. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  45608. }),
  45609. $globals.IRInliningJSTranslator);
  45610. $core.addMethod(
  45611. $core.method({
  45612. selector: "visitIRInlinedIfNilIfNotNil:",
  45613. protocol: "visiting",
  45614. fn: function (anIRInlinedIfNilIfNotNil){
  45615. var self=this,$self=this;
  45616. return $core.withContext(function($ctx1) {
  45617. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  45618. $1=$self._stream();
  45619. $ctx1.sendIdx["stream"]=1;
  45620. $recv($1)._nextPutIf_then_else_((function(){
  45621. var recvVarName;
  45622. return $core.withContext(function($ctx2) {
  45623. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  45624. $2=$self._stream();
  45625. $ctx2.sendIdx["stream"]=2;
  45626. $4="(".__comma(recvVarName);
  45627. $ctx2.sendIdx[","]=2;
  45628. $3=$recv($4).__comma(" = ");
  45629. $ctx2.sendIdx[","]=1;
  45630. $recv($2)._nextPutAll_($3);
  45631. $ctx2.sendIdx["nextPutAll:"]=1;
  45632. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  45633. $ctx2.sendIdx["dagChildren"]=1;
  45634. $5=$recv($6)._first();
  45635. $self._visit_($5);
  45636. $ctx2.sendIdx["visit:"]=1;
  45637. $7=$self._stream();
  45638. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  45639. $ctx2.sendIdx[","]=3;
  45640. return $recv($7)._nextPutAll_($8);
  45641. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  45642. }),(function(){
  45643. return $core.withContext(function($ctx2) {
  45644. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  45645. $ctx2.sendIdx["dagChildren"]=2;
  45646. $9=$recv($10)._second();
  45647. return $self._visit_($9);
  45648. $ctx2.sendIdx["visit:"]=2;
  45649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45650. }),(function(){
  45651. return $core.withContext(function($ctx2) {
  45652. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  45653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45654. }));
  45655. return self;
  45656. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil})});
  45657. },
  45658. args: ["anIRInlinedIfNilIfNotNil"],
  45659. 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 ]",
  45660. referencedClasses: [],
  45661. pragmas: [],
  45662. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  45663. }),
  45664. $globals.IRInliningJSTranslator);
  45665. $core.addMethod(
  45666. $core.method({
  45667. selector: "visitIRInlinedIfTrue:",
  45668. protocol: "visiting",
  45669. fn: function (anIRInlinedIfTrue){
  45670. var self=this,$self=this;
  45671. return $core.withContext(function($ctx1) {
  45672. var $1,$2,$4,$3;
  45673. $1=$self._stream();
  45674. $ctx1.sendIdx["stream"]=1;
  45675. $recv($1)._nextPutIf_then_((function(){
  45676. return $core.withContext(function($ctx2) {
  45677. $2=$self._stream();
  45678. $ctx2.sendIdx["stream"]=2;
  45679. $recv($2)._nextPutAll_("$core.assert(");
  45680. $ctx2.sendIdx["nextPutAll:"]=1;
  45681. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  45682. $ctx2.sendIdx["dagChildren"]=1;
  45683. $3=$recv($4)._first();
  45684. $self._visit_($3);
  45685. $ctx2.sendIdx["visit:"]=1;
  45686. return $recv($self._stream())._nextPutAll_(")");
  45687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45688. }),(function(){
  45689. return $core.withContext(function($ctx2) {
  45690. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  45691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45692. }));
  45693. return self;
  45694. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue})});
  45695. },
  45696. args: ["anIRInlinedIfTrue"],
  45697. 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 ]",
  45698. referencedClasses: [],
  45699. pragmas: [],
  45700. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  45701. }),
  45702. $globals.IRInliningJSTranslator);
  45703. $core.addMethod(
  45704. $core.method({
  45705. selector: "visitIRInlinedIfTrueIfFalse:",
  45706. protocol: "visiting",
  45707. fn: function (anIRInlinedIfTrueIfFalse){
  45708. var self=this,$self=this;
  45709. return $core.withContext(function($ctx1) {
  45710. var $1,$2,$4,$3,$6,$5;
  45711. $1=$self._stream();
  45712. $ctx1.sendIdx["stream"]=1;
  45713. $recv($1)._nextPutIf_then_else_((function(){
  45714. return $core.withContext(function($ctx2) {
  45715. $2=$self._stream();
  45716. $ctx2.sendIdx["stream"]=2;
  45717. $recv($2)._nextPutAll_("$core.assert(");
  45718. $ctx2.sendIdx["nextPutAll:"]=1;
  45719. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  45720. $ctx2.sendIdx["dagChildren"]=1;
  45721. $3=$recv($4)._first();
  45722. $self._visit_($3);
  45723. $ctx2.sendIdx["visit:"]=1;
  45724. return $recv($self._stream())._nextPutAll_(")");
  45725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45726. }),(function(){
  45727. return $core.withContext(function($ctx2) {
  45728. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  45729. $ctx2.sendIdx["dagChildren"]=2;
  45730. $5=$recv($6)._second();
  45731. return $self._visit_($5);
  45732. $ctx2.sendIdx["visit:"]=2;
  45733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45734. }),(function(){
  45735. return $core.withContext(function($ctx2) {
  45736. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  45737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45738. }));
  45739. return self;
  45740. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse})});
  45741. },
  45742. args: ["anIRInlinedIfTrueIfFalse"],
  45743. 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 ]",
  45744. referencedClasses: [],
  45745. pragmas: [],
  45746. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  45747. }),
  45748. $globals.IRInliningJSTranslator);
  45749. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  45750. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  45751. $core.addMethod(
  45752. $core.method({
  45753. selector: "ifFalse:",
  45754. protocol: "inlining",
  45755. fn: function (anIRInstruction){
  45756. var self=this,$self=this;
  45757. return $core.withContext(function($ctx1) {
  45758. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  45759. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction})});
  45760. },
  45761. args: ["anIRInstruction"],
  45762. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  45763. referencedClasses: ["IRInlinedIfFalse"],
  45764. pragmas: [],
  45765. messageSends: ["inlinedSend:withBlock:", "new"]
  45766. }),
  45767. $globals.IRSendInliner);
  45768. $core.addMethod(
  45769. $core.method({
  45770. selector: "ifFalse:ifTrue:",
  45771. protocol: "inlining",
  45772. fn: function (anIRInstruction,anotherIRInstruction){
  45773. var self=this,$self=this;
  45774. return $core.withContext(function($ctx1) {
  45775. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  45776. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45777. },
  45778. args: ["anIRInstruction", "anotherIRInstruction"],
  45779. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  45780. referencedClasses: [],
  45781. pragmas: [],
  45782. messageSends: ["perform:withArguments:"]
  45783. }),
  45784. $globals.IRSendInliner);
  45785. $core.addMethod(
  45786. $core.method({
  45787. selector: "ifNil:",
  45788. protocol: "inlining",
  45789. fn: function (anIRInstruction){
  45790. var self=this,$self=this;
  45791. return $core.withContext(function($ctx1) {
  45792. var $1,$3,$5,$6,$4,$2;
  45793. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  45794. $ctx1.sendIdx["new"]=1;
  45795. $3=$recv($globals.IRClosure)._new();
  45796. $ctx1.sendIdx["new"]=2;
  45797. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  45798. $5=$recv($globals.IRBlockSequence)._new();
  45799. $recv($5)._add_($recv($self._send())._receiver());
  45800. $6=$recv($5)._yourself();
  45801. $ctx1.sendIdx["yourself"]=1;
  45802. $4=$6;
  45803. $recv($3)._add_($4);
  45804. $ctx1.sendIdx["add:"]=1;
  45805. $2=$recv($3)._yourself();
  45806. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  45807. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction})});
  45808. },
  45809. args: ["anIRInstruction"],
  45810. 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)",
  45811. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  45812. pragmas: [],
  45813. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  45814. }),
  45815. $globals.IRSendInliner);
  45816. $core.addMethod(
  45817. $core.method({
  45818. selector: "ifNil:ifNotNil:",
  45819. protocol: "inlining",
  45820. fn: function (anIRInstruction,anotherIRInstruction){
  45821. var self=this,$self=this;
  45822. return $core.withContext(function($ctx1) {
  45823. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  45824. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45825. },
  45826. args: ["anIRInstruction", "anotherIRInstruction"],
  45827. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  45828. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  45829. pragmas: [],
  45830. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45831. }),
  45832. $globals.IRSendInliner);
  45833. $core.addMethod(
  45834. $core.method({
  45835. selector: "ifNotNil:",
  45836. protocol: "inlining",
  45837. fn: function (anIRInstruction){
  45838. var self=this,$self=this;
  45839. return $core.withContext(function($ctx1) {
  45840. var $1,$3,$5,$6,$4,$2;
  45841. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  45842. $ctx1.sendIdx["new"]=1;
  45843. $3=$recv($globals.IRClosure)._new();
  45844. $ctx1.sendIdx["new"]=2;
  45845. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  45846. $5=$recv($globals.IRBlockSequence)._new();
  45847. $recv($5)._add_($recv($self._send())._receiver());
  45848. $6=$recv($5)._yourself();
  45849. $ctx1.sendIdx["yourself"]=1;
  45850. $4=$6;
  45851. $recv($3)._add_($4);
  45852. $ctx1.sendIdx["add:"]=1;
  45853. $2=$recv($3)._yourself();
  45854. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  45855. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction})});
  45856. },
  45857. args: ["anIRInstruction"],
  45858. 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",
  45859. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  45860. pragmas: [],
  45861. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  45862. }),
  45863. $globals.IRSendInliner);
  45864. $core.addMethod(
  45865. $core.method({
  45866. selector: "ifNotNil:ifNil:",
  45867. protocol: "inlining",
  45868. fn: function (anIRInstruction,anotherIRInstruction){
  45869. var self=this,$self=this;
  45870. return $core.withContext(function($ctx1) {
  45871. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  45872. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45873. },
  45874. args: ["anIRInstruction", "anotherIRInstruction"],
  45875. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  45876. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  45877. pragmas: [],
  45878. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45879. }),
  45880. $globals.IRSendInliner);
  45881. $core.addMethod(
  45882. $core.method({
  45883. selector: "ifTrue:",
  45884. protocol: "inlining",
  45885. fn: function (anIRInstruction){
  45886. var self=this,$self=this;
  45887. return $core.withContext(function($ctx1) {
  45888. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  45889. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction})});
  45890. },
  45891. args: ["anIRInstruction"],
  45892. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  45893. referencedClasses: ["IRInlinedIfTrue"],
  45894. pragmas: [],
  45895. messageSends: ["inlinedSend:withBlock:", "new"]
  45896. }),
  45897. $globals.IRSendInliner);
  45898. $core.addMethod(
  45899. $core.method({
  45900. selector: "ifTrue:ifFalse:",
  45901. protocol: "inlining",
  45902. fn: function (anIRInstruction,anotherIRInstruction){
  45903. var self=this,$self=this;
  45904. return $core.withContext(function($ctx1) {
  45905. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  45906. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  45907. },
  45908. args: ["anIRInstruction", "anotherIRInstruction"],
  45909. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  45910. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  45911. pragmas: [],
  45912. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  45913. }),
  45914. $globals.IRSendInliner);
  45915. $core.addMethod(
  45916. $core.method({
  45917. selector: "inlineClosure:",
  45918. protocol: "inlining",
  45919. fn: function (anIRClosure){
  45920. var self=this,$self=this;
  45921. var inlinedClosure,sequence,statements;
  45922. return $core.withContext(function($ctx1) {
  45923. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  45924. inlinedClosure=$self._inlinedClosure();
  45925. $1=inlinedClosure;
  45926. $2=$recv(anIRClosure)._scope();
  45927. $ctx1.sendIdx["scope"]=1;
  45928. $recv($1)._scope_($2);
  45929. $ctx1.sendIdx["scope:"]=1;
  45930. $recv($1)._parent_($recv(anIRClosure)._parent());
  45931. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  45932. return $core.withContext(function($ctx2) {
  45933. return $recv(inlinedClosure)._add_(each);
  45934. $ctx2.sendIdx["add:"]=1;
  45935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45936. }));
  45937. $ctx1.sendIdx["do:"]=1;
  45938. sequence=$self._inlinedSequence();
  45939. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  45940. return $core.withContext(function($ctx2) {
  45941. $3=inlinedClosure;
  45942. $5=$recv($globals.IRTempDeclaration)._new();
  45943. $ctx2.sendIdx["new"]=1;
  45944. $recv($5)._name_(each);
  45945. $ctx2.sendIdx["name:"]=1;
  45946. $6=$recv($5)._yourself();
  45947. $ctx2.sendIdx["yourself"]=1;
  45948. $4=$6;
  45949. $recv($3)._add_($4);
  45950. $ctx2.sendIdx["add:"]=2;
  45951. $7=sequence;
  45952. $9=$recv($globals.IRAssignment)._new();
  45953. $ctx2.sendIdx["new"]=2;
  45954. $11=$recv($globals.IRVariable)._new();
  45955. $ctx2.sendIdx["new"]=3;
  45956. $13=$recv($globals.AliasVar)._new();
  45957. $ctx2.sendIdx["new"]=4;
  45958. $14=$recv(inlinedClosure)._scope();
  45959. $ctx2.sendIdx["scope"]=2;
  45960. $recv($13)._scope_($14);
  45961. $ctx2.sendIdx["scope:"]=2;
  45962. $recv($13)._name_(each);
  45963. $ctx2.sendIdx["name:"]=2;
  45964. $15=$recv($13)._yourself();
  45965. $ctx2.sendIdx["yourself"]=2;
  45966. $12=$15;
  45967. $10=$recv($11)._variable_($12);
  45968. $ctx2.sendIdx["variable:"]=1;
  45969. $recv($9)._add_($10);
  45970. $ctx2.sendIdx["add:"]=4;
  45971. $17=$recv($globals.IRVariable)._new();
  45972. $ctx2.sendIdx["new"]=5;
  45973. $19=$recv($globals.AliasVar)._new();
  45974. $recv($19)._scope_($recv(inlinedClosure)._scope());
  45975. $recv($19)._name_("$receiver");
  45976. $20=$recv($19)._yourself();
  45977. $ctx2.sendIdx["yourself"]=3;
  45978. $18=$20;
  45979. $16=$recv($17)._variable_($18);
  45980. $recv($9)._add_($16);
  45981. $ctx2.sendIdx["add:"]=5;
  45982. $8=$recv($9)._yourself();
  45983. return $recv($7)._add_($8);
  45984. $ctx2.sendIdx["add:"]=3;
  45985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45986. }));
  45987. $ctx1.sendIdx["do:"]=2;
  45988. $recv(inlinedClosure)._add_(sequence);
  45989. $ctx1.sendIdx["add:"]=6;
  45990. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  45991. $recv(statements)._ifNotEmpty_((function(){
  45992. return $core.withContext(function($ctx2) {
  45993. $recv($recv(statements)._allButLast())._do_((function(each){
  45994. return $core.withContext(function($ctx3) {
  45995. return $recv(sequence)._add_(each);
  45996. $ctx3.sendIdx["add:"]=7;
  45997. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  45998. }));
  45999. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  46000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46001. }));
  46002. return inlinedClosure;
  46003. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements})});
  46004. },
  46005. args: ["anIRClosure"],
  46006. 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",
  46007. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  46008. pragmas: [],
  46009. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  46010. }),
  46011. $globals.IRSendInliner);
  46012. $core.addMethod(
  46013. $core.method({
  46014. selector: "inlineSend:",
  46015. protocol: "inlining",
  46016. fn: function (anIRSend){
  46017. var self=this,$self=this;
  46018. return $core.withContext(function($ctx1) {
  46019. var $2,$1;
  46020. $self._send_(anIRSend);
  46021. $2=$self._send();
  46022. $ctx1.sendIdx["send"]=1;
  46023. $1=$recv($2)._selector();
  46024. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  46025. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend})});
  46026. },
  46027. args: ["anIRSend"],
  46028. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  46029. referencedClasses: [],
  46030. pragmas: [],
  46031. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  46032. }),
  46033. $globals.IRSendInliner);
  46034. $core.addMethod(
  46035. $core.method({
  46036. selector: "inlineSend:andReplace:",
  46037. protocol: "private",
  46038. fn: function (anIRSend,anIRInstruction){
  46039. var self=this,$self=this;
  46040. return $core.withContext(function($ctx1) {
  46041. $recv(anIRInstruction)._replaceWith_(anIRSend);
  46042. return $self._inlineSend_(anIRSend);
  46043. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction})});
  46044. },
  46045. args: ["anIRSend", "anIRInstruction"],
  46046. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  46047. referencedClasses: [],
  46048. pragmas: [],
  46049. messageSends: ["replaceWith:", "inlineSend:"]
  46050. }),
  46051. $globals.IRSendInliner);
  46052. $core.addMethod(
  46053. $core.method({
  46054. selector: "inlinedClosure",
  46055. protocol: "factory",
  46056. fn: function (){
  46057. var self=this,$self=this;
  46058. return $core.withContext(function($ctx1) {
  46059. return $recv($globals.IRInlinedClosure)._new();
  46060. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{})});
  46061. },
  46062. args: [],
  46063. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  46064. referencedClasses: ["IRInlinedClosure"],
  46065. pragmas: [],
  46066. messageSends: ["new"]
  46067. }),
  46068. $globals.IRSendInliner);
  46069. $core.addMethod(
  46070. $core.method({
  46071. selector: "inlinedSend:withBlock:",
  46072. protocol: "private",
  46073. fn: function (inlinedSend,anIRInstruction){
  46074. var self=this,$self=this;
  46075. var inlinedClosure;
  46076. return $core.withContext(function($ctx1) {
  46077. var $1,$2,$4,$3,$5;
  46078. $1=$recv(anIRInstruction)._isClosure();
  46079. if(!$core.assert($1)){
  46080. $self._inliningError_("Message argument should be a block");
  46081. $ctx1.sendIdx["inliningError:"]=1;
  46082. }
  46083. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  46084. if(!$core.assert($2)){
  46085. $self._inliningError_("Inlined block should have zero argument");
  46086. }
  46087. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  46088. $4=$self._send();
  46089. $ctx1.sendIdx["send"]=1;
  46090. $3=$recv($4)._receiver();
  46091. $recv(inlinedSend)._add_($3);
  46092. $ctx1.sendIdx["add:"]=1;
  46093. $recv(inlinedSend)._add_(inlinedClosure);
  46094. $recv($self._send())._replaceWith_(inlinedSend);
  46095. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  46096. $ctx1.sendIdx["internalVariables"]=1;
  46097. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  46098. return inlinedSend;
  46099. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure})});
  46100. },
  46101. args: ["inlinedSend", "anIRInstruction"],
  46102. 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",
  46103. referencedClasses: [],
  46104. pragmas: [],
  46105. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  46106. }),
  46107. $globals.IRSendInliner);
  46108. $core.addMethod(
  46109. $core.method({
  46110. selector: "inlinedSend:withBlock:withBlock:",
  46111. protocol: "private",
  46112. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  46113. var self=this,$self=this;
  46114. var inlinedClosure1,inlinedClosure2;
  46115. return $core.withContext(function($ctx1) {
  46116. var $1,$2,$3,$4,$6,$5,$7;
  46117. $1=$recv(anIRInstruction)._isClosure();
  46118. $ctx1.sendIdx["isClosure"]=1;
  46119. if(!$core.assert($1)){
  46120. $self._inliningError_("Message argument should be a block");
  46121. $ctx1.sendIdx["inliningError:"]=1;
  46122. }
  46123. $2=$recv(anotherIRInstruction)._isClosure();
  46124. if(!$core.assert($2)){
  46125. $self._inliningError_("Message argument should be a block");
  46126. }
  46127. $3=$self._translator();
  46128. $ctx1.sendIdx["translator"]=1;
  46129. $4=$self._inlineClosure_(anIRInstruction);
  46130. $ctx1.sendIdx["inlineClosure:"]=1;
  46131. inlinedClosure1=$recv($3)._visit_($4);
  46132. $ctx1.sendIdx["visit:"]=1;
  46133. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  46134. $6=$self._send();
  46135. $ctx1.sendIdx["send"]=1;
  46136. $5=$recv($6)._receiver();
  46137. $recv(inlinedSend)._add_($5);
  46138. $ctx1.sendIdx["add:"]=1;
  46139. $recv(inlinedSend)._add_(inlinedClosure1);
  46140. $ctx1.sendIdx["add:"]=2;
  46141. $recv(inlinedSend)._add_(inlinedClosure2);
  46142. $recv($self._send())._replaceWith_(inlinedSend);
  46143. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  46144. $ctx1.sendIdx["internalVariables"]=1;
  46145. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  46146. return inlinedSend;
  46147. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2})});
  46148. },
  46149. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  46150. 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",
  46151. referencedClasses: [],
  46152. pragmas: [],
  46153. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  46154. }),
  46155. $globals.IRSendInliner);
  46156. $core.addMethod(
  46157. $core.method({
  46158. selector: "inlinedSequence",
  46159. protocol: "factory",
  46160. fn: function (){
  46161. var self=this,$self=this;
  46162. return $core.withContext(function($ctx1) {
  46163. return $recv($globals.IRInlinedSequence)._new();
  46164. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{})});
  46165. },
  46166. args: [],
  46167. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  46168. referencedClasses: ["IRInlinedSequence"],
  46169. pragmas: [],
  46170. messageSends: ["new"]
  46171. }),
  46172. $globals.IRSendInliner);
  46173. $core.addMethod(
  46174. $core.method({
  46175. selector: "inliningError:",
  46176. protocol: "error handling",
  46177. fn: function (aString){
  46178. var self=this,$self=this;
  46179. return $core.withContext(function($ctx1) {
  46180. $recv($globals.InliningError)._signal_(aString);
  46181. return self;
  46182. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString})});
  46183. },
  46184. args: ["aString"],
  46185. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  46186. referencedClasses: ["InliningError"],
  46187. pragmas: [],
  46188. messageSends: ["signal:"]
  46189. }),
  46190. $globals.IRSendInliner);
  46191. $core.addMethod(
  46192. $core.method({
  46193. selector: "send",
  46194. protocol: "accessing",
  46195. fn: function (){
  46196. var self=this,$self=this;
  46197. return $self.send;
  46198. },
  46199. args: [],
  46200. source: "send\x0a\x09^ send",
  46201. referencedClasses: [],
  46202. pragmas: [],
  46203. messageSends: []
  46204. }),
  46205. $globals.IRSendInliner);
  46206. $core.addMethod(
  46207. $core.method({
  46208. selector: "send:",
  46209. protocol: "accessing",
  46210. fn: function (anIRSend){
  46211. var self=this,$self=this;
  46212. $self.send=anIRSend;
  46213. return self;
  46214. },
  46215. args: ["anIRSend"],
  46216. source: "send: anIRSend\x0a\x09send := anIRSend",
  46217. referencedClasses: [],
  46218. pragmas: [],
  46219. messageSends: []
  46220. }),
  46221. $globals.IRSendInliner);
  46222. $core.addMethod(
  46223. $core.method({
  46224. selector: "translator",
  46225. protocol: "accessing",
  46226. fn: function (){
  46227. var self=this,$self=this;
  46228. return $self.translator;
  46229. },
  46230. args: [],
  46231. source: "translator\x0a\x09^ translator",
  46232. referencedClasses: [],
  46233. pragmas: [],
  46234. messageSends: []
  46235. }),
  46236. $globals.IRSendInliner);
  46237. $core.addMethod(
  46238. $core.method({
  46239. selector: "translator:",
  46240. protocol: "accessing",
  46241. fn: function (anASTTranslator){
  46242. var self=this,$self=this;
  46243. $self.translator=anASTTranslator;
  46244. return self;
  46245. },
  46246. args: ["anASTTranslator"],
  46247. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  46248. referencedClasses: [],
  46249. pragmas: [],
  46250. messageSends: []
  46251. }),
  46252. $globals.IRSendInliner);
  46253. $core.addMethod(
  46254. $core.method({
  46255. selector: "inlinedSelectors",
  46256. protocol: "accessing",
  46257. fn: function (){
  46258. var self=this,$self=this;
  46259. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  46260. },
  46261. args: [],
  46262. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  46263. referencedClasses: [],
  46264. pragmas: [],
  46265. messageSends: []
  46266. }),
  46267. $globals.IRSendInliner.a$cls);
  46268. $core.addMethod(
  46269. $core.method({
  46270. selector: "shouldInline:",
  46271. protocol: "accessing",
  46272. fn: function (anIRSend){
  46273. var self=this,$self=this;
  46274. return $core.withContext(function($ctx1) {
  46275. var $1;
  46276. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  46277. if(!$core.assert($1)){
  46278. return false;
  46279. }
  46280. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  46281. return $core.withContext(function($ctx2) {
  46282. return $recv(each)._isClosure();
  46283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46284. }));
  46285. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend})});
  46286. },
  46287. args: ["anIRSend"],
  46288. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  46289. referencedClasses: [],
  46290. pragmas: [],
  46291. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  46292. }),
  46293. $globals.IRSendInliner.a$cls);
  46294. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  46295. $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};";
  46296. $core.addMethod(
  46297. $core.method({
  46298. selector: "inlineAssignment:",
  46299. protocol: "inlining",
  46300. fn: function (anIRAssignment){
  46301. var self=this,$self=this;
  46302. return $core.withContext(function($ctx1) {
  46303. $self._target_($recv(anIRAssignment)._left());
  46304. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  46305. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment})});
  46306. },
  46307. args: ["anIRAssignment"],
  46308. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  46309. referencedClasses: [],
  46310. pragmas: [],
  46311. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  46312. }),
  46313. $globals.IRAssignmentInliner);
  46314. $core.addMethod(
  46315. $core.method({
  46316. selector: "inlineClosure:",
  46317. protocol: "inlining",
  46318. fn: function (anIRClosure){
  46319. var self=this,$self=this;
  46320. var closure,sequence,statements;
  46321. return $core.withContext(function($ctx1) {
  46322. var $1,$2,$3,$5,$4;
  46323. closure=(
  46324. $ctx1.supercall = true,
  46325. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  46326. $ctx1.supercall = false;
  46327. sequence=$recv(closure)._sequence();
  46328. statements=$recv(sequence)._dagChildren();
  46329. $recv(statements)._ifNotEmpty_((function(){
  46330. var final;
  46331. return $core.withContext(function($ctx2) {
  46332. final=$recv(statements)._last();
  46333. $1=$recv(final)._yieldsValue();
  46334. if($core.assert($1)){
  46335. $2=sequence;
  46336. $3=final;
  46337. $5=$recv($globals.IRAssignment)._new();
  46338. $recv($5)._add_($self._target());
  46339. $ctx2.sendIdx["add:"]=1;
  46340. $recv($5)._add_($recv(final)._copy());
  46341. $4=$recv($5)._yourself();
  46342. return $recv($2)._replace_with_($3,$4);
  46343. }
  46344. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  46345. }));
  46346. return closure;
  46347. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements})});
  46348. },
  46349. args: ["anIRClosure"],
  46350. 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",
  46351. referencedClasses: ["IRAssignment"],
  46352. pragmas: [],
  46353. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  46354. }),
  46355. $globals.IRAssignmentInliner);
  46356. $core.addMethod(
  46357. $core.method({
  46358. selector: "target",
  46359. protocol: "accessing",
  46360. fn: function (){
  46361. var self=this,$self=this;
  46362. return $self.target;
  46363. },
  46364. args: [],
  46365. source: "target\x0a\x09^ target",
  46366. referencedClasses: [],
  46367. pragmas: [],
  46368. messageSends: []
  46369. }),
  46370. $globals.IRAssignmentInliner);
  46371. $core.addMethod(
  46372. $core.method({
  46373. selector: "target:",
  46374. protocol: "accessing",
  46375. fn: function (anObject){
  46376. var self=this,$self=this;
  46377. $self.target=anObject;
  46378. return self;
  46379. },
  46380. args: ["anObject"],
  46381. source: "target: anObject\x0a\x09target := anObject",
  46382. referencedClasses: [],
  46383. pragmas: [],
  46384. messageSends: []
  46385. }),
  46386. $globals.IRAssignmentInliner);
  46387. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  46388. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  46389. $core.addMethod(
  46390. $core.method({
  46391. selector: "inlineClosure:",
  46392. protocol: "inlining",
  46393. fn: function (anIRClosure){
  46394. var self=this,$self=this;
  46395. var closure,sequence,statements;
  46396. return $core.withContext(function($ctx1) {
  46397. var $1,$2,$3,$5,$4;
  46398. closure=(
  46399. $ctx1.supercall = true,
  46400. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  46401. $ctx1.supercall = false;
  46402. sequence=$recv(closure)._sequence();
  46403. statements=$recv(sequence)._dagChildren();
  46404. $recv(statements)._ifNotEmpty_((function(){
  46405. var final;
  46406. return $core.withContext(function($ctx2) {
  46407. final=$recv(statements)._last();
  46408. $1=$recv(final)._yieldsValue();
  46409. if($core.assert($1)){
  46410. $2=sequence;
  46411. $3=final;
  46412. $5=$recv($globals.IRReturn)._new();
  46413. $recv($5)._add_($recv(final)._copy());
  46414. $4=$recv($5)._yourself();
  46415. return $recv($2)._replace_with_($3,$4);
  46416. }
  46417. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  46418. }));
  46419. return closure;
  46420. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements})});
  46421. },
  46422. args: ["anIRClosure"],
  46423. 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",
  46424. referencedClasses: ["IRReturn"],
  46425. pragmas: [],
  46426. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  46427. }),
  46428. $globals.IRReturnInliner);
  46429. $core.addMethod(
  46430. $core.method({
  46431. selector: "inlineReturn:",
  46432. protocol: "inlining",
  46433. fn: function (anIRReturn){
  46434. var self=this,$self=this;
  46435. return $core.withContext(function($ctx1) {
  46436. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  46437. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  46438. },
  46439. args: ["anIRReturn"],
  46440. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  46441. referencedClasses: [],
  46442. pragmas: [],
  46443. messageSends: ["inlineSend:andReplace:", "expression"]
  46444. }),
  46445. $globals.IRReturnInliner);
  46446. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  46447. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  46448. $core.addMethod(
  46449. $core.method({
  46450. selector: "inliner",
  46451. protocol: "compiling",
  46452. fn: function (){
  46453. var self=this,$self=this;
  46454. return $core.withContext(function($ctx1) {
  46455. return $recv($globals.IRInliner)._new();
  46456. }, function($ctx1) {$ctx1.fill(self,"inliner",{})});
  46457. },
  46458. args: [],
  46459. source: "inliner\x0a\x09^ IRInliner new",
  46460. referencedClasses: ["IRInliner"],
  46461. pragmas: [],
  46462. messageSends: ["new"]
  46463. }),
  46464. $globals.InliningCodeGenerator);
  46465. $core.addMethod(
  46466. $core.method({
  46467. selector: "irTranslatorClass",
  46468. protocol: "compiling",
  46469. fn: function (){
  46470. var self=this,$self=this;
  46471. return $globals.IRInliningJSTranslator;
  46472. },
  46473. args: [],
  46474. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  46475. referencedClasses: ["IRInliningJSTranslator"],
  46476. pragmas: [],
  46477. messageSends: []
  46478. }),
  46479. $globals.InliningCodeGenerator);
  46480. $core.addMethod(
  46481. $core.method({
  46482. selector: "preInliner",
  46483. protocol: "compiling",
  46484. fn: function (){
  46485. var self=this,$self=this;
  46486. return $core.withContext(function($ctx1) {
  46487. return $recv($globals.ASTPreInliner)._new();
  46488. }, function($ctx1) {$ctx1.fill(self,"preInliner",{})});
  46489. },
  46490. args: [],
  46491. source: "preInliner\x0a\x09^ ASTPreInliner new",
  46492. referencedClasses: ["ASTPreInliner"],
  46493. pragmas: [],
  46494. messageSends: ["new"]
  46495. }),
  46496. $globals.InliningCodeGenerator);
  46497. $core.addMethod(
  46498. $core.method({
  46499. selector: "transformersDictionary",
  46500. protocol: "compiling",
  46501. fn: function (){
  46502. var self=this,$self=this;
  46503. return $core.withContext(function($ctx1) {
  46504. var $1,$2,$receiver;
  46505. $1=$self.transformersDictionary;
  46506. if(($receiver = $1) == null || $receiver.a$nil){
  46507. $2=(
  46508. $ctx1.supercall = true,
  46509. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  46510. $ctx1.supercall = false;
  46511. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  46512. $ctx1.sendIdx["at:put:"]=1;
  46513. $recv($2)._at_put_("6000-inliner",$self._inliner());
  46514. $ctx1.sendIdx["at:put:"]=2;
  46515. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  46516. $self.transformersDictionary=$recv($2)._yourself();
  46517. return $self.transformersDictionary;
  46518. } else {
  46519. return $1;
  46520. }
  46521. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  46522. },
  46523. args: [],
  46524. 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 ]",
  46525. referencedClasses: [],
  46526. pragmas: [],
  46527. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  46528. }),
  46529. $globals.InliningCodeGenerator);
  46530. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  46531. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  46532. $core.addMethod(
  46533. $core.method({
  46534. selector: "asInlinedBlockResult",
  46535. protocol: "*Compiler-Inlining",
  46536. fn: function (){
  46537. var self=this,$self=this;
  46538. return $core.withContext(function($ctx1) {
  46539. return $self._expression();
  46540. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{})});
  46541. },
  46542. args: [],
  46543. source: "asInlinedBlockResult\x0a\x09^ self expression",
  46544. referencedClasses: [],
  46545. pragmas: [],
  46546. messageSends: ["expression"]
  46547. }),
  46548. $globals.IRBlockReturn);
  46549. $core.addMethod(
  46550. $core.method({
  46551. selector: "asInlinedBlockResult",
  46552. protocol: "*Compiler-Inlining",
  46553. fn: function (){
  46554. var self=this,$self=this;
  46555. return self;
  46556. },
  46557. args: [],
  46558. source: "asInlinedBlockResult\x0a\x09^ self",
  46559. referencedClasses: [],
  46560. pragmas: [],
  46561. messageSends: []
  46562. }),
  46563. $globals.IRInstruction);
  46564. });
  46565. define('amber/core/Compiler-Interpreter',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Semantic", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  46566. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46567. var $pkg = $core.addPackage("Compiler-Interpreter");
  46568. $pkg.innerEval = function (expr) { return eval(expr); };
  46569. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  46570. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  46571. $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`).";
  46572. $core.addMethod(
  46573. $core.method({
  46574. selector: "applyTo:arguments:",
  46575. protocol: "evaluating",
  46576. fn: function (anObject,aCollection){
  46577. var self=this,$self=this;
  46578. return $core.withContext(function($ctx1) {
  46579. $self._interpreterError();
  46580. return self;
  46581. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  46582. },
  46583. args: ["anObject", "aCollection"],
  46584. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  46585. referencedClasses: [],
  46586. pragmas: [],
  46587. messageSends: ["interpreterError"]
  46588. }),
  46589. $globals.AIBlockClosure);
  46590. $core.addMethod(
  46591. $core.method({
  46592. selector: "compiledSource",
  46593. protocol: "accessing",
  46594. fn: function (){
  46595. var self=this,$self=this;
  46596. return "[ AST Block closure ]";
  46597. },
  46598. args: [],
  46599. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  46600. referencedClasses: [],
  46601. pragmas: [],
  46602. messageSends: []
  46603. }),
  46604. $globals.AIBlockClosure);
  46605. $core.addMethod(
  46606. $core.method({
  46607. selector: "currySelf",
  46608. protocol: "converting",
  46609. fn: function (){
  46610. var self=this,$self=this;
  46611. return $core.withContext(function($ctx1) {
  46612. $self._interpreterError();
  46613. return self;
  46614. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  46615. },
  46616. args: [],
  46617. source: "currySelf\x0a\x09self interpreterError",
  46618. referencedClasses: [],
  46619. pragmas: [],
  46620. messageSends: ["interpreterError"]
  46621. }),
  46622. $globals.AIBlockClosure);
  46623. $core.addMethod(
  46624. $core.method({
  46625. selector: "initializeWithContext:node:",
  46626. protocol: "initialization",
  46627. fn: function (aContext,aNode){
  46628. var self=this,$self=this;
  46629. $self.node=aNode;
  46630. $self.outerContext=aContext;
  46631. return self;
  46632. },
  46633. args: ["aContext", "aNode"],
  46634. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  46635. referencedClasses: [],
  46636. pragmas: [],
  46637. messageSends: []
  46638. }),
  46639. $globals.AIBlockClosure);
  46640. $core.addMethod(
  46641. $core.method({
  46642. selector: "interpreterError",
  46643. protocol: "error handling",
  46644. fn: function (){
  46645. var self=this,$self=this;
  46646. return $core.withContext(function($ctx1) {
  46647. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  46648. return self;
  46649. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{})});
  46650. },
  46651. args: [],
  46652. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  46653. referencedClasses: ["ASTInterpreterError"],
  46654. pragmas: [],
  46655. messageSends: ["signal:"]
  46656. }),
  46657. $globals.AIBlockClosure);
  46658. $core.addMethod(
  46659. $core.method({
  46660. selector: "numArgs",
  46661. protocol: "accessing",
  46662. fn: function (){
  46663. var self=this,$self=this;
  46664. return $core.withContext(function($ctx1) {
  46665. return $recv($recv($self.node)._temps())._size();
  46666. }, function($ctx1) {$ctx1.fill(self,"numArgs",{})});
  46667. },
  46668. args: [],
  46669. source: "numArgs\x0a\x09^ node temps size",
  46670. referencedClasses: [],
  46671. pragmas: [],
  46672. messageSends: ["size", "temps"]
  46673. }),
  46674. $globals.AIBlockClosure);
  46675. $core.addMethod(
  46676. $core.method({
  46677. selector: "value",
  46678. protocol: "evaluating",
  46679. fn: function (){
  46680. var self=this,$self=this;
  46681. return $core.withContext(function($ctx1) {
  46682. return $self._valueWithPossibleArguments_([]);
  46683. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  46684. },
  46685. args: [],
  46686. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  46687. referencedClasses: [],
  46688. pragmas: [],
  46689. messageSends: ["valueWithPossibleArguments:"]
  46690. }),
  46691. $globals.AIBlockClosure);
  46692. $core.addMethod(
  46693. $core.method({
  46694. selector: "value:",
  46695. protocol: "evaluating",
  46696. fn: function (anArgument){
  46697. var self=this,$self=this;
  46698. return $core.withContext(function($ctx1) {
  46699. return $self._valueWithPossibleArguments_([anArgument]);
  46700. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument})});
  46701. },
  46702. args: ["anArgument"],
  46703. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  46704. referencedClasses: [],
  46705. pragmas: [],
  46706. messageSends: ["valueWithPossibleArguments:"]
  46707. }),
  46708. $globals.AIBlockClosure);
  46709. $core.addMethod(
  46710. $core.method({
  46711. selector: "value:value:",
  46712. protocol: "evaluating",
  46713. fn: function (firstArgument,secondArgument){
  46714. var self=this,$self=this;
  46715. return $core.withContext(function($ctx1) {
  46716. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  46717. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  46718. },
  46719. args: ["firstArgument", "secondArgument"],
  46720. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  46721. referencedClasses: [],
  46722. pragmas: [],
  46723. messageSends: ["valueWithPossibleArguments:"]
  46724. }),
  46725. $globals.AIBlockClosure);
  46726. $core.addMethod(
  46727. $core.method({
  46728. selector: "value:value:value:",
  46729. protocol: "evaluating",
  46730. fn: function (firstArgument,secondArgument,thirdArgument){
  46731. var self=this,$self=this;
  46732. return $core.withContext(function($ctx1) {
  46733. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  46734. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  46735. },
  46736. args: ["firstArgument", "secondArgument", "thirdArgument"],
  46737. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  46738. referencedClasses: [],
  46739. pragmas: [],
  46740. messageSends: ["valueWithPossibleArguments:"]
  46741. }),
  46742. $globals.AIBlockClosure);
  46743. $core.addMethod(
  46744. $core.method({
  46745. selector: "valueWithPossibleArguments:",
  46746. protocol: "evaluating",
  46747. fn: function (aCollection){
  46748. var self=this,$self=this;
  46749. var context,sequenceNode;
  46750. return $core.withContext(function($ctx1) {
  46751. var $1,$2,$3;
  46752. context=$recv($self.outerContext)._newInnerContext();
  46753. $1=$recv($recv($recv($self.node)._dagChildren())._first())._copy();
  46754. $recv($1)._parent_(nil);
  46755. sequenceNode=$recv($1)._yourself();
  46756. $recv($recv(sequenceNode)._temps())._do_((function(each){
  46757. return $core.withContext(function($ctx2) {
  46758. return $recv(context)._defineLocal_(each);
  46759. $ctx2.sendIdx["defineLocal:"]=1;
  46760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46761. }));
  46762. $recv($recv($self.node)._parameters())._withIndexDo_((function(each,index){
  46763. return $core.withContext(function($ctx2) {
  46764. $recv(context)._defineLocal_(each);
  46765. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  46766. return nil;
  46767. })));
  46768. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  46769. }));
  46770. $2=$recv(context)._interpreter();
  46771. $ctx1.sendIdx["interpreter"]=1;
  46772. $recv($2)._node_(sequenceNode);
  46773. $recv($2)._enterNode();
  46774. $recv($2)._proceed();
  46775. $3=$recv($self.outerContext)._interpreter();
  46776. $ctx1.sendIdx["interpreter"]=2;
  46777. $recv($3)._setNonLocalReturnFromContext_(context);
  46778. return $recv($recv(context)._interpreter())._pop();
  46779. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode})});
  46780. },
  46781. args: ["aCollection"],
  46782. 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",
  46783. referencedClasses: [],
  46784. pragmas: [],
  46785. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  46786. }),
  46787. $globals.AIBlockClosure);
  46788. $core.addMethod(
  46789. $core.method({
  46790. selector: "forContext:node:",
  46791. protocol: "instance creation",
  46792. fn: function (aContext,aNode){
  46793. var self=this,$self=this;
  46794. return $core.withContext(function($ctx1) {
  46795. var $1;
  46796. $1=$self._new();
  46797. $recv($1)._initializeWithContext_node_(aContext,aNode);
  46798. return $recv($1)._yourself();
  46799. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode})});
  46800. },
  46801. args: ["aContext", "aNode"],
  46802. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  46803. referencedClasses: [],
  46804. pragmas: [],
  46805. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  46806. }),
  46807. $globals.AIBlockClosure.a$cls);
  46808. $core.addClass("AIContext", $globals.Object, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  46809. $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)";
  46810. $core.addMethod(
  46811. $core.method({
  46812. selector: "arguments",
  46813. protocol: "interpreting",
  46814. fn: function (){
  46815. var self=this,$self=this;
  46816. return $core.withContext(function($ctx1) {
  46817. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  46818. return $core.withContext(function($ctx2) {
  46819. return $self._localAt_ifAbsent_(each,(function(){
  46820. return $core.withContext(function($ctx3) {
  46821. return $self._error_("Argument not in context");
  46822. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46823. }));
  46824. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46825. }));
  46826. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  46827. },
  46828. args: [],
  46829. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  46830. referencedClasses: [],
  46831. pragmas: [],
  46832. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  46833. }),
  46834. $globals.AIContext);
  46835. $core.addMethod(
  46836. $core.method({
  46837. selector: "ast",
  46838. protocol: "interpreting",
  46839. fn: function (){
  46840. var self=this,$self=this;
  46841. return $core.withContext(function($ctx1) {
  46842. var $1,$2,$3,$receiver;
  46843. $1=$self._isBlockContext();
  46844. if($core.assert($1)){
  46845. $2=$self._outerContext();
  46846. if(($receiver = $2) == null || $receiver.a$nil){
  46847. return $2;
  46848. } else {
  46849. var context;
  46850. context=$receiver;
  46851. return $recv(context)._ast();
  46852. }
  46853. }
  46854. $3=$self.ast;
  46855. if(($receiver = $3) == null || $receiver.a$nil){
  46856. $self._initializeAST();
  46857. } else {
  46858. $3;
  46859. }
  46860. return $self.ast;
  46861. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  46862. },
  46863. args: [],
  46864. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  46865. referencedClasses: [],
  46866. pragmas: [],
  46867. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  46868. }),
  46869. $globals.AIContext);
  46870. $core.addMethod(
  46871. $core.method({
  46872. selector: "basicLocalAt:",
  46873. protocol: "private",
  46874. fn: function (aString){
  46875. var self=this,$self=this;
  46876. return $core.withContext(function($ctx1) {
  46877. return $recv($self._locals())._at_(aString);
  46878. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString})});
  46879. },
  46880. args: ["aString"],
  46881. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  46882. referencedClasses: [],
  46883. pragmas: [],
  46884. messageSends: ["at:", "locals"]
  46885. }),
  46886. $globals.AIContext);
  46887. $core.addMethod(
  46888. $core.method({
  46889. selector: "basicLocalAt:put:",
  46890. protocol: "private",
  46891. fn: function (aString,anObject){
  46892. var self=this,$self=this;
  46893. return $core.withContext(function($ctx1) {
  46894. $recv($self._locals())._at_put_(aString,anObject);
  46895. return self;
  46896. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject})});
  46897. },
  46898. args: ["aString", "anObject"],
  46899. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  46900. referencedClasses: [],
  46901. pragmas: [],
  46902. messageSends: ["at:put:", "locals"]
  46903. }),
  46904. $globals.AIContext);
  46905. $core.addMethod(
  46906. $core.method({
  46907. selector: "basicReceiver",
  46908. protocol: "interpreting",
  46909. fn: function (){
  46910. var self=this,$self=this;
  46911. return $core.withContext(function($ctx1) {
  46912. return $self._localAt_("self");
  46913. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  46914. },
  46915. args: [],
  46916. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  46917. referencedClasses: [],
  46918. pragmas: [],
  46919. messageSends: ["localAt:"]
  46920. }),
  46921. $globals.AIContext);
  46922. $core.addMethod(
  46923. $core.method({
  46924. selector: "defineLocal:",
  46925. protocol: "accessing",
  46926. fn: function (aString){
  46927. var self=this,$self=this;
  46928. return $core.withContext(function($ctx1) {
  46929. $recv($self._locals())._at_put_(aString,nil);
  46930. return self;
  46931. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString})});
  46932. },
  46933. args: ["aString"],
  46934. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  46935. referencedClasses: [],
  46936. pragmas: [],
  46937. messageSends: ["at:put:", "locals"]
  46938. }),
  46939. $globals.AIContext);
  46940. $core.addMethod(
  46941. $core.method({
  46942. selector: "evaluate:on:",
  46943. protocol: "evaluating",
  46944. fn: function (aString,anEvaluator){
  46945. var self=this,$self=this;
  46946. return $core.withContext(function($ctx1) {
  46947. return $recv(anEvaluator)._evaluate_context_(aString,self);
  46948. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  46949. },
  46950. args: ["aString", "anEvaluator"],
  46951. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  46952. referencedClasses: [],
  46953. pragmas: [],
  46954. messageSends: ["evaluate:context:"]
  46955. }),
  46956. $globals.AIContext);
  46957. $core.addMethod(
  46958. $core.method({
  46959. selector: "evaluateNode:",
  46960. protocol: "evaluating",
  46961. fn: function (aNode){
  46962. var self=this,$self=this;
  46963. return $core.withContext(function($ctx1) {
  46964. var $1;
  46965. $1=$recv($globals.ASTInterpreter)._new();
  46966. $recv($1)._context_(self);
  46967. $recv($1)._node_(aNode);
  46968. $recv($1)._enterNode();
  46969. $recv($1)._proceed();
  46970. return $recv($1)._result();
  46971. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode})});
  46972. },
  46973. args: ["aNode"],
  46974. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  46975. referencedClasses: ["ASTInterpreter"],
  46976. pragmas: [],
  46977. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  46978. }),
  46979. $globals.AIContext);
  46980. $core.addMethod(
  46981. $core.method({
  46982. selector: "evaluatedSelector",
  46983. protocol: "accessing",
  46984. fn: function (){
  46985. var self=this,$self=this;
  46986. return $self.evaluatedSelector;
  46987. },
  46988. args: [],
  46989. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  46990. referencedClasses: [],
  46991. pragmas: [],
  46992. messageSends: []
  46993. }),
  46994. $globals.AIContext);
  46995. $core.addMethod(
  46996. $core.method({
  46997. selector: "evaluatedSelector:",
  46998. protocol: "accessing",
  46999. fn: function (aString){
  47000. var self=this,$self=this;
  47001. $self.evaluatedSelector=aString;
  47002. return self;
  47003. },
  47004. args: ["aString"],
  47005. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  47006. referencedClasses: [],
  47007. pragmas: [],
  47008. messageSends: []
  47009. }),
  47010. $globals.AIContext);
  47011. $core.addMethod(
  47012. $core.method({
  47013. selector: "home",
  47014. protocol: "accessing",
  47015. fn: function (){
  47016. var self=this,$self=this;
  47017. return nil;
  47018. },
  47019. args: [],
  47020. source: "home\x0a\x09^ nil",
  47021. referencedClasses: [],
  47022. pragmas: [],
  47023. messageSends: []
  47024. }),
  47025. $globals.AIContext);
  47026. $core.addMethod(
  47027. $core.method({
  47028. selector: "index",
  47029. protocol: "accessing",
  47030. fn: function (){
  47031. var self=this,$self=this;
  47032. return $core.withContext(function($ctx1) {
  47033. var $1,$receiver;
  47034. $1=$self.index;
  47035. if(($receiver = $1) == null || $receiver.a$nil){
  47036. return (0);
  47037. } else {
  47038. return $1;
  47039. }
  47040. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  47041. },
  47042. args: [],
  47043. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  47044. referencedClasses: [],
  47045. pragmas: [],
  47046. messageSends: ["ifNil:"]
  47047. }),
  47048. $globals.AIContext);
  47049. $core.addMethod(
  47050. $core.method({
  47051. selector: "index:",
  47052. protocol: "accessing",
  47053. fn: function (anInteger){
  47054. var self=this,$self=this;
  47055. $self.index=anInteger;
  47056. return self;
  47057. },
  47058. args: ["anInteger"],
  47059. source: "index: anInteger\x0a\x09index := anInteger",
  47060. referencedClasses: [],
  47061. pragmas: [],
  47062. messageSends: []
  47063. }),
  47064. $globals.AIContext);
  47065. $core.addMethod(
  47066. $core.method({
  47067. selector: "initializeAST",
  47068. protocol: "initialization",
  47069. fn: function (){
  47070. var self=this,$self=this;
  47071. return $core.withContext(function($ctx1) {
  47072. var $1;
  47073. $1=$self._method();
  47074. $ctx1.sendIdx["method"]=1;
  47075. $self.ast=$recv($1)._ast();
  47076. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._origin()))._visit_($self.ast);
  47077. return self;
  47078. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{})});
  47079. },
  47080. args: [],
  47081. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method origin)\x0a\x09\x09visit: ast",
  47082. referencedClasses: ["SemanticAnalyzer"],
  47083. pragmas: [],
  47084. messageSends: ["ast", "method", "visit:", "on:", "origin"]
  47085. }),
  47086. $globals.AIContext);
  47087. $core.addMethod(
  47088. $core.method({
  47089. selector: "initializeFromMethodContext:",
  47090. protocol: "initialization",
  47091. fn: function (aMethodContext){
  47092. var self=this,$self=this;
  47093. return $core.withContext(function($ctx1) {
  47094. var $1,$2,$3,$receiver;
  47095. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  47096. $self._index_($recv(aMethodContext)._index());
  47097. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  47098. $self._receiver_($recv(aMethodContext)._receiver());
  47099. $self._supercall_($recv(aMethodContext)._supercall());
  47100. $self._selector_($recv(aMethodContext)._selector());
  47101. $1=$recv(aMethodContext)._outerContext();
  47102. $ctx1.sendIdx["outerContext"]=1;
  47103. if(($receiver = $1) == null || $receiver.a$nil){
  47104. $1;
  47105. } else {
  47106. var outer;
  47107. outer=$receiver;
  47108. $2=$recv(outer)._methodContext();
  47109. if(($receiver = $2) == null || $receiver.a$nil){
  47110. $2;
  47111. } else {
  47112. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  47113. }
  47114. $3=$recv(aMethodContext)._locals();
  47115. $ctx1.sendIdx["locals"]=1;
  47116. $recv($3)._keysAndValuesDo_((function(key,value){
  47117. return $core.withContext(function($ctx2) {
  47118. return $recv($self._locals())._at_put_(key,value);
  47119. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47120. }));
  47121. }
  47122. return self;
  47123. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext})});
  47124. },
  47125. args: ["aMethodContext"],
  47126. 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 ] ]",
  47127. referencedClasses: [],
  47128. pragmas: [],
  47129. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  47130. }),
  47131. $globals.AIContext);
  47132. $core.addMethod(
  47133. $core.method({
  47134. selector: "initializeInterpreter",
  47135. protocol: "initialization",
  47136. fn: function (){
  47137. var self=this,$self=this;
  47138. return $core.withContext(function($ctx1) {
  47139. var $1,$2,$receiver;
  47140. $1=$recv($globals.ASTInterpreter)._new();
  47141. $recv($1)._context_(self);
  47142. $self.interpreter=$recv($1)._yourself();
  47143. $2=$self._innerContext();
  47144. if(($receiver = $2) == null || $receiver.a$nil){
  47145. $2;
  47146. } else {
  47147. $self._setupInterpreter_($self.interpreter);
  47148. }
  47149. return self;
  47150. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{})});
  47151. },
  47152. args: [],
  47153. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  47154. referencedClasses: ["ASTInterpreter"],
  47155. pragmas: [],
  47156. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  47157. }),
  47158. $globals.AIContext);
  47159. $core.addMethod(
  47160. $core.method({
  47161. selector: "initializeLocals",
  47162. protocol: "initialization",
  47163. fn: function (){
  47164. var self=this,$self=this;
  47165. return $core.withContext(function($ctx1) {
  47166. $self.locals=$recv($globals.Dictionary)._new();
  47167. $recv($self.locals)._at_put_("thisContext",self);
  47168. return self;
  47169. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{})});
  47170. },
  47171. args: [],
  47172. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  47173. referencedClasses: ["Dictionary"],
  47174. pragmas: [],
  47175. messageSends: ["new", "at:put:"]
  47176. }),
  47177. $globals.AIContext);
  47178. $core.addMethod(
  47179. $core.method({
  47180. selector: "innerContext",
  47181. protocol: "accessing",
  47182. fn: function (){
  47183. var self=this,$self=this;
  47184. return $self.innerContext;
  47185. },
  47186. args: [],
  47187. source: "innerContext\x0a\x09^ innerContext",
  47188. referencedClasses: [],
  47189. pragmas: [],
  47190. messageSends: []
  47191. }),
  47192. $globals.AIContext);
  47193. $core.addMethod(
  47194. $core.method({
  47195. selector: "innerContext:",
  47196. protocol: "accessing",
  47197. fn: function (anAIContext){
  47198. var self=this,$self=this;
  47199. $self.innerContext=anAIContext;
  47200. return self;
  47201. },
  47202. args: ["anAIContext"],
  47203. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  47204. referencedClasses: [],
  47205. pragmas: [],
  47206. messageSends: []
  47207. }),
  47208. $globals.AIContext);
  47209. $core.addMethod(
  47210. $core.method({
  47211. selector: "interpreter",
  47212. protocol: "interpreting",
  47213. fn: function (){
  47214. var self=this,$self=this;
  47215. return $core.withContext(function($ctx1) {
  47216. var $1,$receiver;
  47217. $1=$self.interpreter;
  47218. if(($receiver = $1) == null || $receiver.a$nil){
  47219. $self._initializeInterpreter();
  47220. } else {
  47221. $1;
  47222. }
  47223. return $self.interpreter;
  47224. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  47225. },
  47226. args: [],
  47227. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  47228. referencedClasses: [],
  47229. pragmas: [],
  47230. messageSends: ["ifNil:", "initializeInterpreter"]
  47231. }),
  47232. $globals.AIContext);
  47233. $core.addMethod(
  47234. $core.method({
  47235. selector: "interpreter:",
  47236. protocol: "interpreting",
  47237. fn: function (anInterpreter){
  47238. var self=this,$self=this;
  47239. $self.interpreter=anInterpreter;
  47240. return self;
  47241. },
  47242. args: ["anInterpreter"],
  47243. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  47244. referencedClasses: [],
  47245. pragmas: [],
  47246. messageSends: []
  47247. }),
  47248. $globals.AIContext);
  47249. $core.addMethod(
  47250. $core.method({
  47251. selector: "isTopContext",
  47252. protocol: "testing",
  47253. fn: function (){
  47254. var self=this,$self=this;
  47255. return $core.withContext(function($ctx1) {
  47256. return $recv($self._innerContext())._isNil();
  47257. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{})});
  47258. },
  47259. args: [],
  47260. source: "isTopContext\x0a\x09^ self innerContext isNil",
  47261. referencedClasses: [],
  47262. pragmas: [],
  47263. messageSends: ["isNil", "innerContext"]
  47264. }),
  47265. $globals.AIContext);
  47266. $core.addMethod(
  47267. $core.method({
  47268. selector: "localAt:",
  47269. protocol: "accessing",
  47270. fn: function (aString){
  47271. var self=this,$self=this;
  47272. var context;
  47273. return $core.withContext(function($ctx1) {
  47274. context=$self._lookupContextForLocal_(aString);
  47275. return $recv(context)._basicLocalAt_(aString);
  47276. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context})});
  47277. },
  47278. args: ["aString"],
  47279. 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",
  47280. referencedClasses: [],
  47281. pragmas: [],
  47282. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  47283. }),
  47284. $globals.AIContext);
  47285. $core.addMethod(
  47286. $core.method({
  47287. selector: "localAt:ifAbsent:",
  47288. protocol: "accessing",
  47289. fn: function (aString,aBlock){
  47290. var self=this,$self=this;
  47291. var context;
  47292. return $core.withContext(function($ctx1) {
  47293. var $early={};
  47294. try {
  47295. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  47296. return $core.withContext(function($ctx2) {
  47297. throw $early=[$recv(aBlock)._value()];
  47298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47299. }));
  47300. return $recv(context)._basicLocalAt_(aString);
  47301. }
  47302. catch(e) {if(e===$early)return e[0]; throw e}
  47303. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context})});
  47304. },
  47305. args: ["aString", "aBlock"],
  47306. 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",
  47307. referencedClasses: [],
  47308. pragmas: [],
  47309. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  47310. }),
  47311. $globals.AIContext);
  47312. $core.addMethod(
  47313. $core.method({
  47314. selector: "localAt:put:",
  47315. protocol: "accessing",
  47316. fn: function (aString,anObject){
  47317. var self=this,$self=this;
  47318. var context;
  47319. return $core.withContext(function($ctx1) {
  47320. context=$self._lookupContextForLocal_(aString);
  47321. $recv(context)._basicLocalAt_put_(aString,anObject);
  47322. return self;
  47323. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context})});
  47324. },
  47325. args: ["aString", "anObject"],
  47326. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  47327. referencedClasses: [],
  47328. pragmas: [],
  47329. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  47330. }),
  47331. $globals.AIContext);
  47332. $core.addMethod(
  47333. $core.method({
  47334. selector: "locals",
  47335. protocol: "accessing",
  47336. fn: function (){
  47337. var self=this,$self=this;
  47338. return $core.withContext(function($ctx1) {
  47339. var $1,$receiver;
  47340. $1=$self.locals;
  47341. if(($receiver = $1) == null || $receiver.a$nil){
  47342. $self._initializeLocals();
  47343. } else {
  47344. $1;
  47345. }
  47346. return $self.locals;
  47347. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  47348. },
  47349. args: [],
  47350. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  47351. referencedClasses: [],
  47352. pragmas: [],
  47353. messageSends: ["ifNil:", "initializeLocals"]
  47354. }),
  47355. $globals.AIContext);
  47356. $core.addMethod(
  47357. $core.method({
  47358. selector: "lookupContextForLocal:",
  47359. protocol: "private",
  47360. fn: function (aString){
  47361. var self=this,$self=this;
  47362. return $core.withContext(function($ctx1) {
  47363. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  47364. return $core.withContext(function($ctx2) {
  47365. return $self._variableNotFound();
  47366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47367. }));
  47368. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString})});
  47369. },
  47370. args: ["aString"],
  47371. 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 ]",
  47372. referencedClasses: [],
  47373. pragmas: [],
  47374. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  47375. }),
  47376. $globals.AIContext);
  47377. $core.addMethod(
  47378. $core.method({
  47379. selector: "lookupContextForLocal:ifNone:",
  47380. protocol: "private",
  47381. fn: function (aString,aBlock){
  47382. var self=this,$self=this;
  47383. return $core.withContext(function($ctx1) {
  47384. var $1;
  47385. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  47386. return self;
  47387. }),(function(){
  47388. return $core.withContext(function($ctx2) {
  47389. $1=$self._outerContext();
  47390. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  47391. return $core.withContext(function($ctx3) {
  47392. return $recv(context)._lookupContextForLocal_(aString);
  47393. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  47394. }));
  47395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47396. }));
  47397. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock})});
  47398. },
  47399. args: ["aString", "aBlock"],
  47400. 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 ] ]",
  47401. referencedClasses: [],
  47402. pragmas: [],
  47403. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  47404. }),
  47405. $globals.AIContext);
  47406. $core.addMethod(
  47407. $core.method({
  47408. selector: "newInnerContext",
  47409. protocol: "factory",
  47410. fn: function (){
  47411. var self=this,$self=this;
  47412. return $core.withContext(function($ctx1) {
  47413. var $1;
  47414. $1=$recv($self._class())._new();
  47415. $recv($1)._outerContext_(self);
  47416. return $recv($1)._yourself();
  47417. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{})});
  47418. },
  47419. args: [],
  47420. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  47421. referencedClasses: [],
  47422. pragmas: [],
  47423. messageSends: ["outerContext:", "new", "class", "yourself"]
  47424. }),
  47425. $globals.AIContext);
  47426. $core.addMethod(
  47427. $core.method({
  47428. selector: "outerContext",
  47429. protocol: "accessing",
  47430. fn: function (){
  47431. var self=this,$self=this;
  47432. return $self.outerContext;
  47433. },
  47434. args: [],
  47435. source: "outerContext\x0a\x09^ outerContext",
  47436. referencedClasses: [],
  47437. pragmas: [],
  47438. messageSends: []
  47439. }),
  47440. $globals.AIContext);
  47441. $core.addMethod(
  47442. $core.method({
  47443. selector: "outerContext:",
  47444. protocol: "accessing",
  47445. fn: function (anAIContext){
  47446. var self=this,$self=this;
  47447. return $core.withContext(function($ctx1) {
  47448. var $1,$receiver;
  47449. $self.outerContext=anAIContext;
  47450. $1=$self.outerContext;
  47451. if(($receiver = $1) == null || $receiver.a$nil){
  47452. $1;
  47453. } else {
  47454. var context;
  47455. context=$receiver;
  47456. $recv(context)._innerContext_(self);
  47457. }
  47458. return self;
  47459. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext})});
  47460. },
  47461. args: ["anAIContext"],
  47462. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  47463. referencedClasses: [],
  47464. pragmas: [],
  47465. messageSends: ["ifNotNil:", "innerContext:"]
  47466. }),
  47467. $globals.AIContext);
  47468. $core.addMethod(
  47469. $core.method({
  47470. selector: "receiver:",
  47471. protocol: "interpreting",
  47472. fn: function (anObject){
  47473. var self=this,$self=this;
  47474. return $core.withContext(function($ctx1) {
  47475. $recv($self._locals())._at_put_("self",anObject);
  47476. return self;
  47477. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject})});
  47478. },
  47479. args: ["anObject"],
  47480. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  47481. referencedClasses: [],
  47482. pragmas: [],
  47483. messageSends: ["at:put:", "locals"]
  47484. }),
  47485. $globals.AIContext);
  47486. $core.addMethod(
  47487. $core.method({
  47488. selector: "selector",
  47489. protocol: "accessing",
  47490. fn: function (){
  47491. var self=this,$self=this;
  47492. return $self.selector;
  47493. },
  47494. args: [],
  47495. source: "selector\x0a\x09^ selector",
  47496. referencedClasses: [],
  47497. pragmas: [],
  47498. messageSends: []
  47499. }),
  47500. $globals.AIContext);
  47501. $core.addMethod(
  47502. $core.method({
  47503. selector: "selector:",
  47504. protocol: "accessing",
  47505. fn: function (aString){
  47506. var self=this,$self=this;
  47507. $self.selector=aString;
  47508. return self;
  47509. },
  47510. args: ["aString"],
  47511. source: "selector: aString\x0a\x09selector := aString",
  47512. referencedClasses: [],
  47513. pragmas: [],
  47514. messageSends: []
  47515. }),
  47516. $globals.AIContext);
  47517. $core.addMethod(
  47518. $core.method({
  47519. selector: "sendIndexAt:",
  47520. protocol: "accessing",
  47521. fn: function (aString){
  47522. var self=this,$self=this;
  47523. return $core.withContext(function($ctx1) {
  47524. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  47525. return (0);
  47526. }));
  47527. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString})});
  47528. },
  47529. args: ["aString"],
  47530. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  47531. referencedClasses: [],
  47532. pragmas: [],
  47533. messageSends: ["at:ifAbsent:", "sendIndexes"]
  47534. }),
  47535. $globals.AIContext);
  47536. $core.addMethod(
  47537. $core.method({
  47538. selector: "sendIndexes",
  47539. protocol: "accessing",
  47540. fn: function (){
  47541. var self=this,$self=this;
  47542. return $core.withContext(function($ctx1) {
  47543. var $1,$receiver;
  47544. $1=$self.sendIndexes;
  47545. if(($receiver = $1) == null || $receiver.a$nil){
  47546. return $recv($globals.Dictionary)._new();
  47547. } else {
  47548. return $1;
  47549. }
  47550. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  47551. },
  47552. args: [],
  47553. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  47554. referencedClasses: ["Dictionary"],
  47555. pragmas: [],
  47556. messageSends: ["ifNil:", "new"]
  47557. }),
  47558. $globals.AIContext);
  47559. $core.addMethod(
  47560. $core.method({
  47561. selector: "sendIndexes:",
  47562. protocol: "accessing",
  47563. fn: function (aDictionary){
  47564. var self=this,$self=this;
  47565. $self.sendIndexes=aDictionary;
  47566. return self;
  47567. },
  47568. args: ["aDictionary"],
  47569. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  47570. referencedClasses: [],
  47571. pragmas: [],
  47572. messageSends: []
  47573. }),
  47574. $globals.AIContext);
  47575. $core.addMethod(
  47576. $core.method({
  47577. selector: "setupInterpreter:",
  47578. protocol: "interpreting",
  47579. fn: function (anInterpreter){
  47580. var self=this,$self=this;
  47581. var currentNode;
  47582. return $core.withContext(function($ctx1) {
  47583. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  47584. $1=$recv($globals.ASTPCNodeVisitor)._new();
  47585. $2=$self._evaluatedSelector();
  47586. $ctx1.sendIdx["evaluatedSelector"]=1;
  47587. $recv($1)._selector_($2);
  47588. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  47589. $3=$self._ast();
  47590. $ctx1.sendIdx["ast"]=1;
  47591. $recv($1)._visit_($3);
  47592. currentNode=$recv($1)._currentNode();
  47593. $4=$recv($self._ast())._sequenceNode();
  47594. if(($receiver = $4) == null || $receiver.a$nil){
  47595. $4;
  47596. } else {
  47597. var sequence;
  47598. sequence=$receiver;
  47599. $recv($recv(sequence)._temps())._do_((function(each){
  47600. return $core.withContext(function($ctx2) {
  47601. return $self._defineLocal_(each);
  47602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47603. }));
  47604. $ctx1.sendIdx["do:"]=1;
  47605. }
  47606. $recv(anInterpreter)._node_(currentNode);
  47607. $7=$self._innerContext();
  47608. $ctx1.sendIdx["innerContext"]=1;
  47609. $6=$recv($7)._arguments();
  47610. $5=$recv($6)._reversed();
  47611. $recv($5)._do_((function(each){
  47612. return $core.withContext(function($ctx2) {
  47613. return $recv(anInterpreter)._push_(each);
  47614. $ctx2.sendIdx["push:"]=1;
  47615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  47616. }));
  47617. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  47618. return self;
  47619. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode})});
  47620. },
  47621. args: ["anInterpreter"],
  47622. 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)",
  47623. referencedClasses: ["ASTPCNodeVisitor"],
  47624. pragmas: [],
  47625. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  47626. }),
  47627. $globals.AIContext);
  47628. $core.addMethod(
  47629. $core.method({
  47630. selector: "supercall",
  47631. protocol: "interpreting",
  47632. fn: function (){
  47633. var self=this,$self=this;
  47634. return $core.withContext(function($ctx1) {
  47635. var $1,$receiver;
  47636. $1=$self.supercall;
  47637. if(($receiver = $1) == null || $receiver.a$nil){
  47638. return false;
  47639. } else {
  47640. return $1;
  47641. }
  47642. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  47643. },
  47644. args: [],
  47645. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  47646. referencedClasses: [],
  47647. pragmas: [],
  47648. messageSends: ["ifNil:"]
  47649. }),
  47650. $globals.AIContext);
  47651. $core.addMethod(
  47652. $core.method({
  47653. selector: "supercall:",
  47654. protocol: "interpreting",
  47655. fn: function (aBoolean){
  47656. var self=this,$self=this;
  47657. $self.supercall=aBoolean;
  47658. return self;
  47659. },
  47660. args: ["aBoolean"],
  47661. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  47662. referencedClasses: [],
  47663. pragmas: [],
  47664. messageSends: []
  47665. }),
  47666. $globals.AIContext);
  47667. $core.addMethod(
  47668. $core.method({
  47669. selector: "variableNotFound",
  47670. protocol: "error handling",
  47671. fn: function (){
  47672. var self=this,$self=this;
  47673. return $core.withContext(function($ctx1) {
  47674. $self._error_("Variable missing");
  47675. return self;
  47676. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{})});
  47677. },
  47678. args: [],
  47679. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  47680. referencedClasses: [],
  47681. pragmas: [],
  47682. messageSends: ["error:"]
  47683. }),
  47684. $globals.AIContext);
  47685. $core.addMethod(
  47686. $core.method({
  47687. selector: "fromMethodContext:",
  47688. protocol: "instance creation",
  47689. fn: function (aMethodContext){
  47690. var self=this,$self=this;
  47691. return $core.withContext(function($ctx1) {
  47692. var $1;
  47693. $1=$self._new();
  47694. $recv($1)._initializeFromMethodContext_(aMethodContext);
  47695. return $recv($1)._yourself();
  47696. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext})});
  47697. },
  47698. args: ["aMethodContext"],
  47699. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  47700. referencedClasses: [],
  47701. pragmas: [],
  47702. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  47703. }),
  47704. $globals.AIContext.a$cls);
  47705. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  47706. $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.";
  47707. $core.addMethod(
  47708. $core.method({
  47709. selector: "context",
  47710. protocol: "accessing",
  47711. fn: function (){
  47712. var self=this,$self=this;
  47713. return $self.context;
  47714. },
  47715. args: [],
  47716. source: "context\x0a\x09^ context",
  47717. referencedClasses: [],
  47718. pragmas: [],
  47719. messageSends: []
  47720. }),
  47721. $globals.AISemanticAnalyzer);
  47722. $core.addMethod(
  47723. $core.method({
  47724. selector: "context:",
  47725. protocol: "accessing",
  47726. fn: function (anAIContext){
  47727. var self=this,$self=this;
  47728. $self.context=anAIContext;
  47729. return self;
  47730. },
  47731. args: ["anAIContext"],
  47732. source: "context: anAIContext\x0a\x09context := anAIContext",
  47733. referencedClasses: [],
  47734. pragmas: [],
  47735. messageSends: []
  47736. }),
  47737. $globals.AISemanticAnalyzer);
  47738. $core.addMethod(
  47739. $core.method({
  47740. selector: "visitVariableNode:",
  47741. protocol: "visiting",
  47742. fn: function (aNode){
  47743. var self=this,$self=this;
  47744. return $core.withContext(function($ctx1) {
  47745. var $1;
  47746. var $early={};
  47747. try {
  47748. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  47749. return $core.withContext(function($ctx2) {
  47750. $1=(
  47751. $ctx2.supercall = true,
  47752. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  47753. $ctx2.supercall = false;
  47754. throw $early=[$1];
  47755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47756. }));
  47757. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  47758. return self;
  47759. }
  47760. catch(e) {if(e===$early)return e[0]; throw e}
  47761. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  47762. },
  47763. args: ["aNode"],
  47764. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  47765. referencedClasses: ["ASTContextVar"],
  47766. pragmas: [],
  47767. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  47768. }),
  47769. $globals.AISemanticAnalyzer);
  47770. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  47771. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  47772. $core.addMethod(
  47773. $core.method({
  47774. selector: "context",
  47775. protocol: "accessing",
  47776. fn: function (){
  47777. var self=this,$self=this;
  47778. return $self.context;
  47779. },
  47780. args: [],
  47781. source: "context\x0a\x09^ context",
  47782. referencedClasses: [],
  47783. pragmas: [],
  47784. messageSends: []
  47785. }),
  47786. $globals.ASTContextVar);
  47787. $core.addMethod(
  47788. $core.method({
  47789. selector: "context:",
  47790. protocol: "accessing",
  47791. fn: function (anObject){
  47792. var self=this,$self=this;
  47793. $self.context=anObject;
  47794. return self;
  47795. },
  47796. args: ["anObject"],
  47797. source: "context: anObject\x0a\x09context := anObject",
  47798. referencedClasses: [],
  47799. pragmas: [],
  47800. messageSends: []
  47801. }),
  47802. $globals.ASTContextVar);
  47803. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  47804. $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.";
  47805. $core.addMethod(
  47806. $core.method({
  47807. selector: "atEnd",
  47808. protocol: "testing",
  47809. fn: function (){
  47810. var self=this,$self=this;
  47811. return $core.withContext(function($ctx1) {
  47812. var $1,$receiver;
  47813. $1=$self._context();
  47814. $ctx1.sendIdx["context"]=1;
  47815. if(($receiver = $1) == null || $receiver.a$nil){
  47816. return true;
  47817. } else {
  47818. $1;
  47819. }
  47820. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  47821. return $core.withContext(function($ctx2) {
  47822. return $recv($self._context())._isTopContext();
  47823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47824. }));
  47825. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  47826. },
  47827. args: [],
  47828. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  47829. referencedClasses: [],
  47830. pragmas: [],
  47831. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  47832. }),
  47833. $globals.ASTDebugger);
  47834. $core.addMethod(
  47835. $core.method({
  47836. selector: "context",
  47837. protocol: "accessing",
  47838. fn: function (){
  47839. var self=this,$self=this;
  47840. return $self.context;
  47841. },
  47842. args: [],
  47843. source: "context\x0a\x09^ context",
  47844. referencedClasses: [],
  47845. pragmas: [],
  47846. messageSends: []
  47847. }),
  47848. $globals.ASTDebugger);
  47849. $core.addMethod(
  47850. $core.method({
  47851. selector: "context:",
  47852. protocol: "accessing",
  47853. fn: function (aContext){
  47854. var self=this,$self=this;
  47855. $self.context=aContext;
  47856. return self;
  47857. },
  47858. args: ["aContext"],
  47859. source: "context: aContext\x0a\x09context := aContext",
  47860. referencedClasses: [],
  47861. pragmas: [],
  47862. messageSends: []
  47863. }),
  47864. $globals.ASTDebugger);
  47865. $core.addMethod(
  47866. $core.method({
  47867. selector: "flushInnerContexts",
  47868. protocol: "actions",
  47869. fn: function (){
  47870. var self=this,$self=this;
  47871. return $core.withContext(function($ctx1) {
  47872. var $1,$receiver;
  47873. $1=$self._context();
  47874. if(($receiver = $1) == null || $receiver.a$nil){
  47875. $1;
  47876. } else {
  47877. var cxt;
  47878. cxt=$receiver;
  47879. $recv(cxt)._innerContext_(nil);
  47880. }
  47881. return self;
  47882. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{})});
  47883. },
  47884. args: [],
  47885. 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 ]",
  47886. referencedClasses: [],
  47887. pragmas: [],
  47888. messageSends: ["ifNotNil:", "context", "innerContext:"]
  47889. }),
  47890. $globals.ASTDebugger);
  47891. $core.addMethod(
  47892. $core.method({
  47893. selector: "interpreter",
  47894. protocol: "accessing",
  47895. fn: function (){
  47896. var self=this,$self=this;
  47897. return $core.withContext(function($ctx1) {
  47898. var $1,$receiver;
  47899. $1=$self._context();
  47900. if(($receiver = $1) == null || $receiver.a$nil){
  47901. return $1;
  47902. } else {
  47903. var ctx;
  47904. ctx=$receiver;
  47905. return $recv(ctx)._interpreter();
  47906. }
  47907. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  47908. },
  47909. args: [],
  47910. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  47911. referencedClasses: [],
  47912. pragmas: [],
  47913. messageSends: ["ifNotNil:", "context", "interpreter"]
  47914. }),
  47915. $globals.ASTDebugger);
  47916. $core.addMethod(
  47917. $core.method({
  47918. selector: "method",
  47919. protocol: "accessing",
  47920. fn: function (){
  47921. var self=this,$self=this;
  47922. return $core.withContext(function($ctx1) {
  47923. return $recv($self._context())._method();
  47924. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  47925. },
  47926. args: [],
  47927. source: "method\x0a\x09^ self context method",
  47928. referencedClasses: [],
  47929. pragmas: [],
  47930. messageSends: ["method", "context"]
  47931. }),
  47932. $globals.ASTDebugger);
  47933. $core.addMethod(
  47934. $core.method({
  47935. selector: "node",
  47936. protocol: "accessing",
  47937. fn: function (){
  47938. var self=this,$self=this;
  47939. return $core.withContext(function($ctx1) {
  47940. var $1,$receiver;
  47941. $1=$self._interpreter();
  47942. $ctx1.sendIdx["interpreter"]=1;
  47943. if(($receiver = $1) == null || $receiver.a$nil){
  47944. return $1;
  47945. } else {
  47946. return $recv($self._interpreter())._node();
  47947. }
  47948. }, function($ctx1) {$ctx1.fill(self,"node",{})});
  47949. },
  47950. args: [],
  47951. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  47952. referencedClasses: [],
  47953. pragmas: [],
  47954. messageSends: ["ifNotNil:", "interpreter", "node"]
  47955. }),
  47956. $globals.ASTDebugger);
  47957. $core.addMethod(
  47958. $core.method({
  47959. selector: "onStep",
  47960. protocol: "private",
  47961. fn: function (){
  47962. var self=this,$self=this;
  47963. return $core.withContext(function($ctx1) {
  47964. var $1,$3,$2,$4,$6,$5,$receiver;
  47965. $1=$self._interpreter();
  47966. $ctx1.sendIdx["interpreter"]=1;
  47967. $self.result=$recv($1)._result();
  47968. $3=$self._interpreter();
  47969. $ctx1.sendIdx["interpreter"]=2;
  47970. $2=$recv($3)._atEnd();
  47971. $ctx1.sendIdx["atEnd"]=1;
  47972. if($core.assert($2)){
  47973. $4=$recv($self._context())._outerContext();
  47974. if(($receiver = $4) == null || $receiver.a$nil){
  47975. $4;
  47976. } else {
  47977. var outerContext;
  47978. outerContext=$receiver;
  47979. $self._context_(outerContext);
  47980. }
  47981. $6=$self._interpreter();
  47982. $ctx1.sendIdx["interpreter"]=3;
  47983. $5=$recv($6)._atEnd();
  47984. if(!$core.assert($5)){
  47985. $recv($self._interpreter())._skip();
  47986. }
  47987. }
  47988. $self._flushInnerContexts();
  47989. return self;
  47990. }, function($ctx1) {$ctx1.fill(self,"onStep",{})});
  47991. },
  47992. args: [],
  47993. 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",
  47994. referencedClasses: [],
  47995. pragmas: [],
  47996. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  47997. }),
  47998. $globals.ASTDebugger);
  47999. $core.addMethod(
  48000. $core.method({
  48001. selector: "proceed",
  48002. protocol: "stepping",
  48003. fn: function (){
  48004. var self=this,$self=this;
  48005. return $core.withContext(function($ctx1) {
  48006. $recv((function(){
  48007. return $core.withContext(function($ctx2) {
  48008. return $self._atEnd();
  48009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48010. }))._whileFalse_((function(){
  48011. return $core.withContext(function($ctx2) {
  48012. return $self._stepOver();
  48013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48014. }));
  48015. return self;
  48016. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  48017. },
  48018. args: [],
  48019. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  48020. referencedClasses: [],
  48021. pragmas: [],
  48022. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  48023. }),
  48024. $globals.ASTDebugger);
  48025. $core.addMethod(
  48026. $core.method({
  48027. selector: "restart",
  48028. protocol: "stepping",
  48029. fn: function (){
  48030. var self=this,$self=this;
  48031. return $core.withContext(function($ctx1) {
  48032. $recv($self._interpreter())._restart();
  48033. $self._flushInnerContexts();
  48034. return self;
  48035. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  48036. },
  48037. args: [],
  48038. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  48039. referencedClasses: [],
  48040. pragmas: [],
  48041. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  48042. }),
  48043. $globals.ASTDebugger);
  48044. $core.addMethod(
  48045. $core.method({
  48046. selector: "result",
  48047. protocol: "accessing",
  48048. fn: function (){
  48049. var self=this,$self=this;
  48050. return $self.result;
  48051. },
  48052. args: [],
  48053. source: "result\x0a\x09^ result",
  48054. referencedClasses: [],
  48055. pragmas: [],
  48056. messageSends: []
  48057. }),
  48058. $globals.ASTDebugger);
  48059. $core.addMethod(
  48060. $core.method({
  48061. selector: "stepInto",
  48062. protocol: "stepping",
  48063. fn: function (){
  48064. var self=this,$self=this;
  48065. return $core.withContext(function($ctx1) {
  48066. $self._shouldBeImplemented();
  48067. return self;
  48068. }, function($ctx1) {$ctx1.fill(self,"stepInto",{})});
  48069. },
  48070. args: [],
  48071. source: "stepInto\x0a\x09self shouldBeImplemented",
  48072. referencedClasses: [],
  48073. pragmas: [],
  48074. messageSends: ["shouldBeImplemented"]
  48075. }),
  48076. $globals.ASTDebugger);
  48077. $core.addMethod(
  48078. $core.method({
  48079. selector: "stepOver",
  48080. protocol: "stepping",
  48081. fn: function (){
  48082. var self=this,$self=this;
  48083. return $core.withContext(function($ctx1) {
  48084. var $1,$2;
  48085. $1=$recv($self._context())._isTopContext();
  48086. if($core.assert($1)){
  48087. $recv($self._interpreter())._stepOver();
  48088. } else {
  48089. $2=$self._interpreter();
  48090. $ctx1.sendIdx["interpreter"]=1;
  48091. $recv($2)._skip();
  48092. }
  48093. $self._onStep();
  48094. return self;
  48095. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  48096. },
  48097. args: [],
  48098. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  48099. referencedClasses: [],
  48100. pragmas: [],
  48101. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  48102. }),
  48103. $globals.ASTDebugger);
  48104. $core.addMethod(
  48105. $core.method({
  48106. selector: "context:",
  48107. protocol: "instance creation",
  48108. fn: function (aContext){
  48109. var self=this,$self=this;
  48110. return $core.withContext(function($ctx1) {
  48111. var $1;
  48112. $1=$self._new();
  48113. $recv($1)._context_(aContext);
  48114. return $recv($1)._yourself();
  48115. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext})});
  48116. },
  48117. args: ["aContext"],
  48118. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  48119. referencedClasses: [],
  48120. pragmas: [],
  48121. messageSends: ["context:", "new", "yourself"]
  48122. }),
  48123. $globals.ASTDebugger.a$cls);
  48124. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  48125. $core.addMethod(
  48126. $core.method({
  48127. selector: "interpreter",
  48128. protocol: "accessing",
  48129. fn: function (){
  48130. var self=this,$self=this;
  48131. return $self.interpreter;
  48132. },
  48133. args: [],
  48134. source: "interpreter\x0a\x09^ interpreter",
  48135. referencedClasses: [],
  48136. pragmas: [],
  48137. messageSends: []
  48138. }),
  48139. $globals.ASTEnterNode);
  48140. $core.addMethod(
  48141. $core.method({
  48142. selector: "interpreter:",
  48143. protocol: "accessing",
  48144. fn: function (anObject){
  48145. var self=this,$self=this;
  48146. $self.interpreter=anObject;
  48147. return self;
  48148. },
  48149. args: ["anObject"],
  48150. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  48151. referencedClasses: [],
  48152. pragmas: [],
  48153. messageSends: []
  48154. }),
  48155. $globals.ASTEnterNode);
  48156. $core.addMethod(
  48157. $core.method({
  48158. selector: "visitBlockNode:",
  48159. protocol: "visiting",
  48160. fn: function (aNode){
  48161. var self=this,$self=this;
  48162. return aNode;
  48163. },
  48164. args: ["aNode"],
  48165. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  48166. referencedClasses: [],
  48167. pragmas: [],
  48168. messageSends: []
  48169. }),
  48170. $globals.ASTEnterNode);
  48171. $core.addMethod(
  48172. $core.method({
  48173. selector: "visitDagNode:",
  48174. protocol: "visiting",
  48175. fn: function (aNode){
  48176. var self=this,$self=this;
  48177. return $core.withContext(function($ctx1) {
  48178. return $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  48179. return aNode;
  48180. }),(function(nodes){
  48181. return $core.withContext(function($ctx2) {
  48182. return $self._visit_($recv(nodes)._first());
  48183. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  48184. }));
  48185. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  48186. },
  48187. args: ["aNode"],
  48188. source: "visitDagNode: aNode\x0a\x09^ aNode dagChildren\x0a\x09\x09ifEmpty: [ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | self visit: nodes first ]",
  48189. referencedClasses: [],
  48190. pragmas: [],
  48191. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  48192. }),
  48193. $globals.ASTEnterNode);
  48194. $core.addMethod(
  48195. $core.method({
  48196. selector: "visitSequenceNode:",
  48197. protocol: "visiting",
  48198. fn: function (aNode){
  48199. var self=this,$self=this;
  48200. return $core.withContext(function($ctx1) {
  48201. var $1;
  48202. $recv($recv(aNode)._temps())._do_((function(each){
  48203. return $core.withContext(function($ctx2) {
  48204. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  48205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48206. }));
  48207. $1=(
  48208. $ctx1.supercall = true,
  48209. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  48210. $ctx1.supercall = false;
  48211. return $1;
  48212. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  48213. },
  48214. args: ["aNode"],
  48215. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  48216. referencedClasses: [],
  48217. pragmas: [],
  48218. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  48219. }),
  48220. $globals.ASTEnterNode);
  48221. $core.addMethod(
  48222. $core.method({
  48223. selector: "on:",
  48224. protocol: "instance creation",
  48225. fn: function (anInterpreter){
  48226. var self=this,$self=this;
  48227. return $core.withContext(function($ctx1) {
  48228. var $1;
  48229. $1=$self._new();
  48230. $recv($1)._interpreter_(anInterpreter);
  48231. return $recv($1)._yourself();
  48232. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter})});
  48233. },
  48234. args: ["anInterpreter"],
  48235. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  48236. referencedClasses: [],
  48237. pragmas: [],
  48238. messageSends: ["interpreter:", "new", "yourself"]
  48239. }),
  48240. $globals.ASTEnterNode.a$cls);
  48241. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  48242. $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";
  48243. $core.addMethod(
  48244. $core.method({
  48245. selector: "assign:to:",
  48246. protocol: "private",
  48247. fn: function (aNode,anObject){
  48248. var self=this,$self=this;
  48249. return $core.withContext(function($ctx1) {
  48250. var $1,$3,$2,$4;
  48251. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  48252. if($core.assert($1)){
  48253. $3=$self._context();
  48254. $ctx1.sendIdx["context"]=1;
  48255. $2=$recv($3)._receiver();
  48256. $4=$recv(aNode)._value();
  48257. $ctx1.sendIdx["value"]=1;
  48258. $recv($2)._instVarAt_put_($4,anObject);
  48259. } else {
  48260. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  48261. }
  48262. return self;
  48263. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject})});
  48264. },
  48265. args: ["aNode", "anObject"],
  48266. 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 ]",
  48267. referencedClasses: [],
  48268. pragmas: [],
  48269. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  48270. }),
  48271. $globals.ASTInterpreter);
  48272. $core.addMethod(
  48273. $core.method({
  48274. selector: "atEnd",
  48275. protocol: "testing",
  48276. fn: function (){
  48277. var self=this,$self=this;
  48278. return $core.withContext(function($ctx1) {
  48279. var $1;
  48280. $1=$self.forceAtEnd;
  48281. if($core.assert($1)){
  48282. return true;
  48283. }
  48284. return $recv($self._hasReturned())._or_((function(){
  48285. return $core.withContext(function($ctx2) {
  48286. return $recv($self._node())._isNil();
  48287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48288. }));
  48289. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  48290. },
  48291. args: [],
  48292. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  48293. referencedClasses: [],
  48294. pragmas: [],
  48295. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  48296. }),
  48297. $globals.ASTInterpreter);
  48298. $core.addMethod(
  48299. $core.method({
  48300. selector: "context",
  48301. protocol: "accessing",
  48302. fn: function (){
  48303. var self=this,$self=this;
  48304. return $self.context;
  48305. },
  48306. args: [],
  48307. source: "context\x0a\x09^ context",
  48308. referencedClasses: [],
  48309. pragmas: [],
  48310. messageSends: []
  48311. }),
  48312. $globals.ASTInterpreter);
  48313. $core.addMethod(
  48314. $core.method({
  48315. selector: "context:",
  48316. protocol: "accessing",
  48317. fn: function (aContext){
  48318. var self=this,$self=this;
  48319. $self.context=aContext;
  48320. return self;
  48321. },
  48322. args: ["aContext"],
  48323. source: "context: aContext\x0a\x09context := aContext",
  48324. referencedClasses: [],
  48325. pragmas: [],
  48326. messageSends: []
  48327. }),
  48328. $globals.ASTInterpreter);
  48329. $core.addMethod(
  48330. $core.method({
  48331. selector: "enterNode",
  48332. protocol: "interpreting",
  48333. fn: function (){
  48334. var self=this,$self=this;
  48335. return $core.withContext(function($ctx1) {
  48336. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  48337. return self;
  48338. }, function($ctx1) {$ctx1.fill(self,"enterNode",{})});
  48339. },
  48340. args: [],
  48341. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  48342. referencedClasses: ["ASTEnterNode"],
  48343. pragmas: [],
  48344. messageSends: ["node:", "visit:", "on:", "node"]
  48345. }),
  48346. $globals.ASTInterpreter);
  48347. $core.addMethod(
  48348. $core.method({
  48349. selector: "eval:",
  48350. protocol: "private",
  48351. fn: function (aString){
  48352. var self=this,$self=this;
  48353. var source,function_;
  48354. return $core.withContext(function($ctx1) {
  48355. var $3,$2,$1;
  48356. source=$recv($globals.String)._streamContents_((function(str){
  48357. return $core.withContext(function($ctx2) {
  48358. $recv(str)._nextPutAll_("0,(function(");
  48359. $ctx2.sendIdx["nextPutAll:"]=1;
  48360. $3=$self._context();
  48361. $ctx2.sendIdx["context"]=1;
  48362. $2=$recv($3)._locals();
  48363. $ctx2.sendIdx["locals"]=1;
  48364. $1=$recv($2)._keys();
  48365. $recv($1)._do_separatedBy_((function(each){
  48366. return $core.withContext(function($ctx3) {
  48367. return $recv(str)._nextPutAll_(each);
  48368. $ctx3.sendIdx["nextPutAll:"]=2;
  48369. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  48370. }),(function(){
  48371. return $core.withContext(function($ctx3) {
  48372. return $recv(str)._nextPutAll_(",");
  48373. $ctx3.sendIdx["nextPutAll:"]=3;
  48374. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48375. }));
  48376. $recv(str)._nextPutAll_("){ return (function() {");
  48377. $ctx2.sendIdx["nextPutAll:"]=4;
  48378. $recv(str)._nextPutAll_(aString);
  48379. $ctx2.sendIdx["nextPutAll:"]=5;
  48380. return $recv(str)._nextPutAll_("})()})");
  48381. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  48382. }));
  48383. function_=$recv($globals.Compiler)._eval_(source);
  48384. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  48385. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_})});
  48386. },
  48387. args: ["aString"],
  48388. 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",
  48389. referencedClasses: ["String", "Compiler"],
  48390. pragmas: [],
  48391. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  48392. }),
  48393. $globals.ASTInterpreter);
  48394. $core.addMethod(
  48395. $core.method({
  48396. selector: "hasReturned",
  48397. protocol: "testing",
  48398. fn: function (){
  48399. var self=this,$self=this;
  48400. return $core.withContext(function($ctx1) {
  48401. var $1,$receiver;
  48402. $1=$self.returned;
  48403. if(($receiver = $1) == null || $receiver.a$nil){
  48404. return false;
  48405. } else {
  48406. return $1;
  48407. }
  48408. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{})});
  48409. },
  48410. args: [],
  48411. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  48412. referencedClasses: [],
  48413. pragmas: [],
  48414. messageSends: ["ifNil:"]
  48415. }),
  48416. $globals.ASTInterpreter);
  48417. $core.addMethod(
  48418. $core.method({
  48419. selector: "initialize",
  48420. protocol: "initialization",
  48421. fn: function (){
  48422. var self=this,$self=this;
  48423. return $core.withContext(function($ctx1) {
  48424. (
  48425. $ctx1.supercall = true,
  48426. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48427. $ctx1.supercall = false;
  48428. $self.forceAtEnd=false;
  48429. return self;
  48430. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  48431. },
  48432. args: [],
  48433. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  48434. referencedClasses: [],
  48435. pragmas: [],
  48436. messageSends: ["initialize"]
  48437. }),
  48438. $globals.ASTInterpreter);
  48439. $core.addMethod(
  48440. $core.method({
  48441. selector: "interpret",
  48442. protocol: "interpreting",
  48443. fn: function (){
  48444. var self=this,$self=this;
  48445. return $core.withContext(function($ctx1) {
  48446. $self._visit_($self._node());
  48447. return self;
  48448. }, function($ctx1) {$ctx1.fill(self,"interpret",{})});
  48449. },
  48450. args: [],
  48451. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  48452. referencedClasses: [],
  48453. pragmas: [],
  48454. messageSends: ["visit:", "node"]
  48455. }),
  48456. $globals.ASTInterpreter);
  48457. $core.addMethod(
  48458. $core.method({
  48459. selector: "messageFromSendNode:arguments:",
  48460. protocol: "private",
  48461. fn: function (aSendNode,aCollection){
  48462. var self=this,$self=this;
  48463. return $core.withContext(function($ctx1) {
  48464. var $1;
  48465. $1=$recv($globals.Message)._new();
  48466. $recv($1)._selector_($recv(aSendNode)._selector());
  48467. $recv($1)._arguments_(aCollection);
  48468. return $recv($1)._yourself();
  48469. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection})});
  48470. },
  48471. args: ["aSendNode", "aCollection"],
  48472. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  48473. referencedClasses: ["Message"],
  48474. pragmas: [],
  48475. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  48476. }),
  48477. $globals.ASTInterpreter);
  48478. $core.addMethod(
  48479. $core.method({
  48480. selector: "messageNotUnderstood:receiver:",
  48481. protocol: "private",
  48482. fn: function (aMessage,anObject){
  48483. var self=this,$self=this;
  48484. return $core.withContext(function($ctx1) {
  48485. var $1;
  48486. $1=$recv($globals.MessageNotUnderstood)._new();
  48487. $recv($1)._message_(aMessage);
  48488. $recv($1)._receiver_(anObject);
  48489. $recv($1)._signal();
  48490. return self;
  48491. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject})});
  48492. },
  48493. args: ["aMessage", "anObject"],
  48494. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  48495. referencedClasses: ["MessageNotUnderstood"],
  48496. pragmas: [],
  48497. messageSends: ["message:", "new", "receiver:", "signal"]
  48498. }),
  48499. $globals.ASTInterpreter);
  48500. $core.addMethod(
  48501. $core.method({
  48502. selector: "next",
  48503. protocol: "interpreting",
  48504. fn: function (){
  48505. var self=this,$self=this;
  48506. var nd,nextNode;
  48507. return $core.withContext(function($ctx1) {
  48508. var $1,$2,$receiver;
  48509. nd=$self._node();
  48510. $1=$recv(nd)._parent();
  48511. if(($receiver = $1) == null || $receiver.a$nil){
  48512. nextNode=$1;
  48513. } else {
  48514. var parent;
  48515. parent=$receiver;
  48516. $2=$recv(parent)._nextSiblingNode_(nd);
  48517. if(($receiver = $2) == null || $receiver.a$nil){
  48518. nextNode=parent;
  48519. } else {
  48520. var sibling;
  48521. sibling=$receiver;
  48522. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  48523. }
  48524. }
  48525. $self._node_(nextNode);
  48526. return self;
  48527. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode})});
  48528. },
  48529. args: [],
  48530. 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",
  48531. referencedClasses: ["ASTEnterNode"],
  48532. pragmas: [],
  48533. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  48534. }),
  48535. $globals.ASTInterpreter);
  48536. $core.addMethod(
  48537. $core.method({
  48538. selector: "node",
  48539. protocol: "accessing",
  48540. fn: function (){
  48541. var self=this,$self=this;
  48542. return $self.node;
  48543. },
  48544. args: [],
  48545. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  48546. referencedClasses: [],
  48547. pragmas: [],
  48548. messageSends: []
  48549. }),
  48550. $globals.ASTInterpreter);
  48551. $core.addMethod(
  48552. $core.method({
  48553. selector: "node:",
  48554. protocol: "accessing",
  48555. fn: function (aNode){
  48556. var self=this,$self=this;
  48557. $self.node=aNode;
  48558. return self;
  48559. },
  48560. args: ["aNode"],
  48561. source: "node: aNode\x0a\x09node := aNode",
  48562. referencedClasses: [],
  48563. pragmas: [],
  48564. messageSends: []
  48565. }),
  48566. $globals.ASTInterpreter);
  48567. $core.addMethod(
  48568. $core.method({
  48569. selector: "peek",
  48570. protocol: "stack",
  48571. fn: function (){
  48572. var self=this,$self=this;
  48573. return $core.withContext(function($ctx1) {
  48574. var $1;
  48575. var $early={};
  48576. try {
  48577. $1=$self._stack();
  48578. $ctx1.sendIdx["stack"]=1;
  48579. $recv($1)._ifEmpty_((function(){
  48580. throw $early=[nil];
  48581. }));
  48582. return $recv($self._stack())._last();
  48583. }
  48584. catch(e) {if(e===$early)return e[0]; throw e}
  48585. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  48586. },
  48587. args: [],
  48588. 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",
  48589. referencedClasses: [],
  48590. pragmas: [],
  48591. messageSends: ["ifEmpty:", "stack", "last"]
  48592. }),
  48593. $globals.ASTInterpreter);
  48594. $core.addMethod(
  48595. $core.method({
  48596. selector: "pop",
  48597. protocol: "stack",
  48598. fn: function (){
  48599. var self=this,$self=this;
  48600. var peekedValue;
  48601. return $core.withContext(function($ctx1) {
  48602. peekedValue=$self._peek();
  48603. $recv($self._stack())._removeLast();
  48604. return peekedValue;
  48605. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue})});
  48606. },
  48607. args: [],
  48608. 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",
  48609. referencedClasses: [],
  48610. pragmas: [],
  48611. messageSends: ["peek", "removeLast", "stack"]
  48612. }),
  48613. $globals.ASTInterpreter);
  48614. $core.addMethod(
  48615. $core.method({
  48616. selector: "proceed",
  48617. protocol: "interpreting",
  48618. fn: function (){
  48619. var self=this,$self=this;
  48620. return $core.withContext(function($ctx1) {
  48621. $recv((function(){
  48622. return $core.withContext(function($ctx2) {
  48623. return $self._atEnd();
  48624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48625. }))._whileFalse_((function(){
  48626. return $core.withContext(function($ctx2) {
  48627. return $self._step();
  48628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48629. }));
  48630. return self;
  48631. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  48632. },
  48633. args: [],
  48634. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  48635. referencedClasses: [],
  48636. pragmas: [],
  48637. messageSends: ["whileFalse:", "atEnd", "step"]
  48638. }),
  48639. $globals.ASTInterpreter);
  48640. $core.addMethod(
  48641. $core.method({
  48642. selector: "push:",
  48643. protocol: "stack",
  48644. fn: function (anObject){
  48645. var self=this,$self=this;
  48646. return $core.withContext(function($ctx1) {
  48647. return $recv($self._stack())._add_(anObject);
  48648. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject})});
  48649. },
  48650. args: ["anObject"],
  48651. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  48652. referencedClasses: [],
  48653. pragmas: [],
  48654. messageSends: ["add:", "stack"]
  48655. }),
  48656. $globals.ASTInterpreter);
  48657. $core.addMethod(
  48658. $core.method({
  48659. selector: "restart",
  48660. protocol: "interpreting",
  48661. fn: function (){
  48662. var self=this,$self=this;
  48663. return $core.withContext(function($ctx1) {
  48664. $self._node_($recv($self._context())._ast());
  48665. $self._enterNode();
  48666. return self;
  48667. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  48668. },
  48669. args: [],
  48670. source: "restart\x0a\x09self node: self context ast; enterNode",
  48671. referencedClasses: [],
  48672. pragmas: [],
  48673. messageSends: ["node:", "ast", "context", "enterNode"]
  48674. }),
  48675. $globals.ASTInterpreter);
  48676. $core.addMethod(
  48677. $core.method({
  48678. selector: "result",
  48679. protocol: "accessing",
  48680. fn: function (){
  48681. var self=this,$self=this;
  48682. return $core.withContext(function($ctx1) {
  48683. var $1;
  48684. $1=$self._hasReturned();
  48685. if($core.assert($1)){
  48686. return $self._returnValue();
  48687. } else {
  48688. return $recv($self._context())._receiver();
  48689. }
  48690. }, function($ctx1) {$ctx1.fill(self,"result",{})});
  48691. },
  48692. args: [],
  48693. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  48694. referencedClasses: [],
  48695. pragmas: [],
  48696. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  48697. }),
  48698. $globals.ASTInterpreter);
  48699. $core.addMethod(
  48700. $core.method({
  48701. selector: "returnValue",
  48702. protocol: "accessing",
  48703. fn: function (){
  48704. var self=this,$self=this;
  48705. return $self.returnValue;
  48706. },
  48707. args: [],
  48708. source: "returnValue\x0a\x09^ returnValue",
  48709. referencedClasses: [],
  48710. pragmas: [],
  48711. messageSends: []
  48712. }),
  48713. $globals.ASTInterpreter);
  48714. $core.addMethod(
  48715. $core.method({
  48716. selector: "returnValue:",
  48717. protocol: "accessing",
  48718. fn: function (anObject){
  48719. var self=this,$self=this;
  48720. $self.returnValue=anObject;
  48721. return self;
  48722. },
  48723. args: ["anObject"],
  48724. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  48725. referencedClasses: [],
  48726. pragmas: [],
  48727. messageSends: []
  48728. }),
  48729. $globals.ASTInterpreter);
  48730. $core.addMethod(
  48731. $core.method({
  48732. selector: "sendMessage:to:superSend:",
  48733. protocol: "private",
  48734. fn: function (aMessage,anObject,aBoolean){
  48735. var self=this,$self=this;
  48736. var method;
  48737. return $core.withContext(function($ctx1) {
  48738. var $1,$2,$3,$receiver;
  48739. if(!$core.assert(aBoolean)){
  48740. return $recv(aMessage)._sendTo_(anObject);
  48741. }
  48742. $1=$recv($recv(anObject)._class())._superclass();
  48743. $ctx1.sendIdx["superclass"]=1;
  48744. if(($receiver = $1) == null || $receiver.a$nil){
  48745. $2=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  48746. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  48747. return $2;
  48748. } else {
  48749. $1;
  48750. }
  48751. $3=$recv($recv($recv($recv($self._context())._method())._methodClass())._superclass())._lookupSelector_($recv(aMessage)._selector());
  48752. if(($receiver = $3) == null || $receiver.a$nil){
  48753. return $self._messageNotUnderstood_receiver_(aMessage,anObject);
  48754. } else {
  48755. method=$3;
  48756. }
  48757. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  48758. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method})});
  48759. },
  48760. args: ["aMessage", "anObject", "aBoolean"],
  48761. 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 := (self context method methodClass superclass lookupSelector: aMessage selector)\x0a\x09\x09ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  48762. referencedClasses: [],
  48763. pragmas: [],
  48764. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "lookupSelector:", "methodClass", "method", "context", "selector", "sendTo:arguments:", "arguments"]
  48765. }),
  48766. $globals.ASTInterpreter);
  48767. $core.addMethod(
  48768. $core.method({
  48769. selector: "setNonLocalReturnFromContext:",
  48770. protocol: "interpreting",
  48771. fn: function (aContext){
  48772. var self=this,$self=this;
  48773. return $core.withContext(function($ctx1) {
  48774. var $2,$1;
  48775. $2=$recv(aContext)._interpreter();
  48776. $ctx1.sendIdx["interpreter"]=1;
  48777. $1=$recv($2)._hasReturned();
  48778. if($core.assert($1)){
  48779. $self.returned=true;
  48780. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  48781. }
  48782. return self;
  48783. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext})});
  48784. },
  48785. args: ["aContext"],
  48786. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  48787. referencedClasses: [],
  48788. pragmas: [],
  48789. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  48790. }),
  48791. $globals.ASTInterpreter);
  48792. $core.addMethod(
  48793. $core.method({
  48794. selector: "skip",
  48795. protocol: "interpreting",
  48796. fn: function (){
  48797. var self=this,$self=this;
  48798. return $core.withContext(function($ctx1) {
  48799. $self._next();
  48800. return self;
  48801. }, function($ctx1) {$ctx1.fill(self,"skip",{})});
  48802. },
  48803. args: [],
  48804. source: "skip\x0a\x09self next",
  48805. referencedClasses: [],
  48806. pragmas: [],
  48807. messageSends: ["next"]
  48808. }),
  48809. $globals.ASTInterpreter);
  48810. $core.addMethod(
  48811. $core.method({
  48812. selector: "stack",
  48813. protocol: "accessing",
  48814. fn: function (){
  48815. var self=this,$self=this;
  48816. return $core.withContext(function($ctx1) {
  48817. var $1,$receiver;
  48818. $1=$self.stack;
  48819. if(($receiver = $1) == null || $receiver.a$nil){
  48820. $self.stack=$recv($globals.OrderedCollection)._new();
  48821. return $self.stack;
  48822. } else {
  48823. return $1;
  48824. }
  48825. }, function($ctx1) {$ctx1.fill(self,"stack",{})});
  48826. },
  48827. args: [],
  48828. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  48829. referencedClasses: ["OrderedCollection"],
  48830. pragmas: [],
  48831. messageSends: ["ifNil:", "new"]
  48832. }),
  48833. $globals.ASTInterpreter);
  48834. $core.addMethod(
  48835. $core.method({
  48836. selector: "step",
  48837. protocol: "interpreting",
  48838. fn: function (){
  48839. var self=this,$self=this;
  48840. return $core.withContext(function($ctx1) {
  48841. $self._interpret();
  48842. $self._next();
  48843. return self;
  48844. }, function($ctx1) {$ctx1.fill(self,"step",{})});
  48845. },
  48846. args: [],
  48847. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  48848. referencedClasses: [],
  48849. pragmas: [],
  48850. messageSends: ["interpret", "next"]
  48851. }),
  48852. $globals.ASTInterpreter);
  48853. $core.addMethod(
  48854. $core.method({
  48855. selector: "stepOver",
  48856. protocol: "interpreting",
  48857. fn: function (){
  48858. var self=this,$self=this;
  48859. return $core.withContext(function($ctx1) {
  48860. var $2,$1;
  48861. $self._step();
  48862. $ctx1.sendIdx["step"]=1;
  48863. $recv((function(){
  48864. return $core.withContext(function($ctx2) {
  48865. $2=$self._node();
  48866. $ctx2.sendIdx["node"]=1;
  48867. $1=$recv($2)._isNil();
  48868. return $recv($1)._or_((function(){
  48869. return $core.withContext(function($ctx3) {
  48870. return $recv($self._node())._isSteppingNode();
  48871. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48872. }));
  48873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48874. }))._whileFalse_((function(){
  48875. return $core.withContext(function($ctx2) {
  48876. return $self._step();
  48877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48878. }));
  48879. return self;
  48880. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  48881. },
  48882. args: [],
  48883. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  48884. referencedClasses: [],
  48885. pragmas: [],
  48886. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  48887. }),
  48888. $globals.ASTInterpreter);
  48889. $core.addMethod(
  48890. $core.method({
  48891. selector: "visit:",
  48892. protocol: "visiting",
  48893. fn: function (aNode){
  48894. var self=this,$self=this;
  48895. return $core.withContext(function($ctx1) {
  48896. var $1;
  48897. $1=$self._hasReturned();
  48898. if(!$core.assert($1)){
  48899. (
  48900. $ctx1.supercall = true,
  48901. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  48902. $ctx1.supercall = false;
  48903. }
  48904. return self;
  48905. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  48906. },
  48907. args: ["aNode"],
  48908. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  48909. referencedClasses: [],
  48910. pragmas: [],
  48911. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  48912. }),
  48913. $globals.ASTInterpreter);
  48914. $core.addMethod(
  48915. $core.method({
  48916. selector: "visitAssignmentNode:",
  48917. protocol: "visiting",
  48918. fn: function (aNode){
  48919. var self=this,$self=this;
  48920. var poppedValue;
  48921. return $core.withContext(function($ctx1) {
  48922. poppedValue=$self._pop();
  48923. $ctx1.sendIdx["pop"]=1;
  48924. $self._pop();
  48925. $self._push_(poppedValue);
  48926. $self._assign_to_($recv(aNode)._left(),poppedValue);
  48927. return self;
  48928. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue})});
  48929. },
  48930. args: ["aNode"],
  48931. 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",
  48932. referencedClasses: [],
  48933. pragmas: [],
  48934. messageSends: ["pop", "push:", "assign:to:", "left"]
  48935. }),
  48936. $globals.ASTInterpreter);
  48937. $core.addMethod(
  48938. $core.method({
  48939. selector: "visitBlockNode:",
  48940. protocol: "visiting",
  48941. fn: function (aNode){
  48942. var self=this,$self=this;
  48943. var block;
  48944. return $core.withContext(function($ctx1) {
  48945. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  48946. $self._push_(block);
  48947. return self;
  48948. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block})});
  48949. },
  48950. args: ["aNode"],
  48951. 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",
  48952. referencedClasses: ["AIBlockClosure"],
  48953. pragmas: [],
  48954. messageSends: ["forContext:node:", "context", "push:"]
  48955. }),
  48956. $globals.ASTInterpreter);
  48957. $core.addMethod(
  48958. $core.method({
  48959. selector: "visitBlockSequenceNode:",
  48960. protocol: "visiting",
  48961. fn: function (aNode){
  48962. var self=this,$self=this;
  48963. return $core.withContext(function($ctx1) {
  48964. (
  48965. $ctx1.supercall = true,
  48966. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  48967. $ctx1.supercall = false;
  48968. $self.forceAtEnd=true;
  48969. return self;
  48970. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  48971. },
  48972. args: ["aNode"],
  48973. 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",
  48974. referencedClasses: [],
  48975. pragmas: [],
  48976. messageSends: ["visitBlockSequenceNode:"]
  48977. }),
  48978. $globals.ASTInterpreter);
  48979. $core.addMethod(
  48980. $core.method({
  48981. selector: "visitDagNode:",
  48982. protocol: "visiting",
  48983. fn: function (aNode){
  48984. var self=this,$self=this;
  48985. return self;
  48986. },
  48987. args: ["aNode"],
  48988. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  48989. referencedClasses: [],
  48990. pragmas: [],
  48991. messageSends: []
  48992. }),
  48993. $globals.ASTInterpreter);
  48994. $core.addMethod(
  48995. $core.method({
  48996. selector: "visitDynamicArrayNode:",
  48997. protocol: "visiting",
  48998. fn: function (aNode){
  48999. var self=this,$self=this;
  49000. var array;
  49001. return $core.withContext(function($ctx1) {
  49002. array=[];
  49003. $recv($recv(aNode)._dagChildren())._do_((function(each){
  49004. return $core.withContext(function($ctx2) {
  49005. return $recv(array)._addFirst_($self._pop());
  49006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49007. }));
  49008. $self._push_(array);
  49009. return self;
  49010. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  49011. },
  49012. args: ["aNode"],
  49013. 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",
  49014. referencedClasses: [],
  49015. pragmas: [],
  49016. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  49017. }),
  49018. $globals.ASTInterpreter);
  49019. $core.addMethod(
  49020. $core.method({
  49021. selector: "visitDynamicDictionaryNode:",
  49022. protocol: "visiting",
  49023. fn: function (aNode){
  49024. var self=this,$self=this;
  49025. var keyValueList;
  49026. return $core.withContext(function($ctx1) {
  49027. keyValueList=$recv($globals.OrderedCollection)._new();
  49028. $recv($recv(aNode)._dagChildren())._do_((function(each){
  49029. return $core.withContext(function($ctx2) {
  49030. return $recv(keyValueList)._add_($self._pop());
  49031. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49032. }));
  49033. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  49034. return self;
  49035. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList})});
  49036. },
  49037. args: ["aNode"],
  49038. 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)",
  49039. referencedClasses: ["OrderedCollection", "HashedCollection"],
  49040. pragmas: [],
  49041. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  49042. }),
  49043. $globals.ASTInterpreter);
  49044. $core.addMethod(
  49045. $core.method({
  49046. selector: "visitJSStatementNode:",
  49047. protocol: "visiting",
  49048. fn: function (aNode){
  49049. var self=this,$self=this;
  49050. return $core.withContext(function($ctx1) {
  49051. $self.returned=true;
  49052. $self._returnValue_($self._eval_($recv(aNode)._source()));
  49053. return self;
  49054. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  49055. },
  49056. args: ["aNode"],
  49057. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  49058. referencedClasses: [],
  49059. pragmas: [],
  49060. messageSends: ["returnValue:", "eval:", "source"]
  49061. }),
  49062. $globals.ASTInterpreter);
  49063. $core.addMethod(
  49064. $core.method({
  49065. selector: "visitReturnNode:",
  49066. protocol: "visiting",
  49067. fn: function (aNode){
  49068. var self=this,$self=this;
  49069. return $core.withContext(function($ctx1) {
  49070. $self.returned=true;
  49071. $self._returnValue_($self._pop());
  49072. return self;
  49073. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  49074. },
  49075. args: ["aNode"],
  49076. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  49077. referencedClasses: [],
  49078. pragmas: [],
  49079. messageSends: ["returnValue:", "pop"]
  49080. }),
  49081. $globals.ASTInterpreter);
  49082. $core.addMethod(
  49083. $core.method({
  49084. selector: "visitSendNode:",
  49085. protocol: "visiting",
  49086. fn: function (aNode){
  49087. var self=this,$self=this;
  49088. var receiver,args,message,result;
  49089. return $core.withContext(function($ctx1) {
  49090. var $1;
  49091. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  49092. return $core.withContext(function($ctx2) {
  49093. return $self._pop();
  49094. $ctx2.sendIdx["pop"]=1;
  49095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49096. }));
  49097. receiver=$self._peek();
  49098. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  49099. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  49100. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  49101. return $core.withContext(function($ctx2) {
  49102. return $recv($recv(aNode)._isLastChild())._not();
  49103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49104. }));
  49105. if(!$core.assert($1)){
  49106. $self._pop();
  49107. $self._push_(result);
  49108. }
  49109. return self;
  49110. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result})});
  49111. },
  49112. args: ["aNode"],
  49113. 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 ]",
  49114. referencedClasses: [],
  49115. pragmas: [],
  49116. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  49117. }),
  49118. $globals.ASTInterpreter);
  49119. $core.addMethod(
  49120. $core.method({
  49121. selector: "visitValueNode:",
  49122. protocol: "visiting",
  49123. fn: function (aNode){
  49124. var self=this,$self=this;
  49125. return $core.withContext(function($ctx1) {
  49126. $self._push_($recv(aNode)._value());
  49127. return self;
  49128. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  49129. },
  49130. args: ["aNode"],
  49131. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  49132. referencedClasses: [],
  49133. pragmas: [],
  49134. messageSends: ["push:", "value"]
  49135. }),
  49136. $globals.ASTInterpreter);
  49137. $core.addMethod(
  49138. $core.method({
  49139. selector: "visitVariableNode:",
  49140. protocol: "visiting",
  49141. fn: function (aNode){
  49142. var self=this,$self=this;
  49143. return $core.withContext(function($ctx1) {
  49144. var $2,$1,$5,$6,$4,$3,$9,$8,$11,$10,$12,$13,$15,$14,$17,$16,$18,$19,$7;
  49145. $2=$recv(aNode)._binding();
  49146. $ctx1.sendIdx["binding"]=1;
  49147. $1=$recv($2)._isUnknownVar();
  49148. if($core.assert($1)){
  49149. $5=$recv($globals.Platform)._globals();
  49150. $ctx1.sendIdx["globals"]=1;
  49151. $6=$recv(aNode)._value();
  49152. $ctx1.sendIdx["value"]=1;
  49153. $4=$recv($5)._at_ifAbsent_($6,(function(){
  49154. return $core.withContext(function($ctx2) {
  49155. return $self._error_("Unknown variable");
  49156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49157. }));
  49158. $ctx1.sendIdx["at:ifAbsent:"]=1;
  49159. $3=$self._push_($4);
  49160. $ctx1.sendIdx["push:"]=1;
  49161. return $3;
  49162. }
  49163. $9=$recv(aNode)._binding();
  49164. $ctx1.sendIdx["binding"]=2;
  49165. $8=$recv($9)._isInstanceVar();
  49166. if($core.assert($8)){
  49167. $11=$self._context();
  49168. $ctx1.sendIdx["context"]=1;
  49169. $10=$recv($11)._receiver();
  49170. $12=$recv(aNode)._value();
  49171. $ctx1.sendIdx["value"]=2;
  49172. $7=$recv($10)._instVarAt_($12);
  49173. } else {
  49174. $13=$self._context();
  49175. $15=$recv($recv(aNode)._binding())._isSuper();
  49176. if($core.assert($15)){
  49177. $14="self";
  49178. } else {
  49179. $14=$recv(aNode)._value();
  49180. $ctx1.sendIdx["value"]=3;
  49181. }
  49182. $7=$recv($13)._localAt_ifAbsent_($14,(function(){
  49183. return $core.withContext(function($ctx2) {
  49184. $17=$recv(aNode)._value();
  49185. $ctx2.sendIdx["value"]=4;
  49186. $16=$recv($17)._isCapitalized();
  49187. if($core.assert($16)){
  49188. $18=$recv($globals.Smalltalk)._globals();
  49189. $ctx2.sendIdx["globals"]=2;
  49190. $19=$recv(aNode)._value();
  49191. $ctx2.sendIdx["value"]=5;
  49192. return $recv($18)._at_ifAbsent_($19,(function(){
  49193. return $core.withContext(function($ctx3) {
  49194. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  49195. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,9)});
  49196. }));
  49197. }
  49198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49199. }));
  49200. }
  49201. $self._push_($7);
  49202. return self;
  49203. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  49204. },
  49205. args: ["aNode"],
  49206. 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 binding isSuper ifTrue: [ 'self' ] ifFalse: [ 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 ] ] ] ])",
  49207. referencedClasses: ["Platform", "Smalltalk"],
  49208. pragmas: [],
  49209. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isSuper", "isCapitalized", "at:"]
  49210. }),
  49211. $globals.ASTInterpreter);
  49212. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  49213. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  49214. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  49215. $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`";
  49216. $core.addMethod(
  49217. $core.method({
  49218. selector: "currentNode",
  49219. protocol: "accessing",
  49220. fn: function (){
  49221. var self=this,$self=this;
  49222. return $self.currentNode;
  49223. },
  49224. args: [],
  49225. source: "currentNode\x0a\x09^ currentNode",
  49226. referencedClasses: [],
  49227. pragmas: [],
  49228. messageSends: []
  49229. }),
  49230. $globals.ASTPCNodeVisitor);
  49231. $core.addMethod(
  49232. $core.method({
  49233. selector: "increaseTrackedIndex",
  49234. protocol: "accessing",
  49235. fn: function (){
  49236. var self=this,$self=this;
  49237. return $core.withContext(function($ctx1) {
  49238. $self.trackedIndex=$recv($self._trackedIndex()).__plus((1));
  49239. return self;
  49240. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{})});
  49241. },
  49242. args: [],
  49243. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  49244. referencedClasses: [],
  49245. pragmas: [],
  49246. messageSends: ["+", "trackedIndex"]
  49247. }),
  49248. $globals.ASTPCNodeVisitor);
  49249. $core.addMethod(
  49250. $core.method({
  49251. selector: "index",
  49252. protocol: "accessing",
  49253. fn: function (){
  49254. var self=this,$self=this;
  49255. return $self.index;
  49256. },
  49257. args: [],
  49258. source: "index\x0a\x09^ index",
  49259. referencedClasses: [],
  49260. pragmas: [],
  49261. messageSends: []
  49262. }),
  49263. $globals.ASTPCNodeVisitor);
  49264. $core.addMethod(
  49265. $core.method({
  49266. selector: "index:",
  49267. protocol: "accessing",
  49268. fn: function (aNumber){
  49269. var self=this,$self=this;
  49270. $self.index=aNumber;
  49271. return self;
  49272. },
  49273. args: ["aNumber"],
  49274. source: "index: aNumber\x0a\x09index := aNumber",
  49275. referencedClasses: [],
  49276. pragmas: [],
  49277. messageSends: []
  49278. }),
  49279. $globals.ASTPCNodeVisitor);
  49280. $core.addMethod(
  49281. $core.method({
  49282. selector: "selector",
  49283. protocol: "accessing",
  49284. fn: function (){
  49285. var self=this,$self=this;
  49286. return $self.selector;
  49287. },
  49288. args: [],
  49289. source: "selector\x0a\x09^ selector",
  49290. referencedClasses: [],
  49291. pragmas: [],
  49292. messageSends: []
  49293. }),
  49294. $globals.ASTPCNodeVisitor);
  49295. $core.addMethod(
  49296. $core.method({
  49297. selector: "selector:",
  49298. protocol: "accessing",
  49299. fn: function (aString){
  49300. var self=this,$self=this;
  49301. $self.selector=aString;
  49302. return self;
  49303. },
  49304. args: ["aString"],
  49305. source: "selector: aString\x0a\x09selector := aString",
  49306. referencedClasses: [],
  49307. pragmas: [],
  49308. messageSends: []
  49309. }),
  49310. $globals.ASTPCNodeVisitor);
  49311. $core.addMethod(
  49312. $core.method({
  49313. selector: "trackedIndex",
  49314. protocol: "accessing",
  49315. fn: function (){
  49316. var self=this,$self=this;
  49317. return $core.withContext(function($ctx1) {
  49318. var $1,$receiver;
  49319. $1=$self.trackedIndex;
  49320. if(($receiver = $1) == null || $receiver.a$nil){
  49321. $self.trackedIndex=(0);
  49322. return $self.trackedIndex;
  49323. } else {
  49324. return $1;
  49325. }
  49326. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{})});
  49327. },
  49328. args: [],
  49329. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  49330. referencedClasses: [],
  49331. pragmas: [],
  49332. messageSends: ["ifNil:"]
  49333. }),
  49334. $globals.ASTPCNodeVisitor);
  49335. $core.addMethod(
  49336. $core.method({
  49337. selector: "visitJSStatementNode:",
  49338. protocol: "visiting",
  49339. fn: function (aNode){
  49340. var self=this,$self=this;
  49341. $self.currentNode=aNode;
  49342. return self;
  49343. },
  49344. args: ["aNode"],
  49345. 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",
  49346. referencedClasses: [],
  49347. pragmas: [],
  49348. messageSends: []
  49349. }),
  49350. $globals.ASTPCNodeVisitor);
  49351. $core.addMethod(
  49352. $core.method({
  49353. selector: "visitSendNode:",
  49354. protocol: "visiting",
  49355. fn: function (aNode){
  49356. var self=this,$self=this;
  49357. return $core.withContext(function($ctx1) {
  49358. var $2,$1,$3;
  49359. (
  49360. $ctx1.supercall = true,
  49361. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  49362. $ctx1.supercall = false;
  49363. $2=$self._selector();
  49364. $ctx1.sendIdx["selector"]=1;
  49365. $1=$recv($2).__eq($recv(aNode)._selector());
  49366. $ctx1.sendIdx["="]=1;
  49367. if($core.assert($1)){
  49368. $3=$recv($self._trackedIndex()).__eq($self._index());
  49369. if($core.assert($3)){
  49370. $self.currentNode=aNode;
  49371. $self.currentNode;
  49372. }
  49373. $self._increaseTrackedIndex();
  49374. }
  49375. return self;
  49376. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  49377. },
  49378. args: ["aNode"],
  49379. 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 ]",
  49380. referencedClasses: [],
  49381. pragmas: [],
  49382. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  49383. }),
  49384. $globals.ASTPCNodeVisitor);
  49385. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.AIContext);
  49386. $core.addMethod(
  49387. $core.method({
  49388. selector: "isLastChild",
  49389. protocol: "*Compiler-Interpreter",
  49390. fn: function (){
  49391. var self=this,$self=this;
  49392. return $core.withContext(function($ctx1) {
  49393. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  49394. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{})});
  49395. },
  49396. args: [],
  49397. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  49398. referencedClasses: [],
  49399. pragmas: [],
  49400. messageSends: ["=", "last", "dagChildren", "parent"]
  49401. }),
  49402. $globals.ASTNode);
  49403. $core.addMethod(
  49404. $core.method({
  49405. selector: "isSteppingNode",
  49406. protocol: "*Compiler-Interpreter",
  49407. fn: function (){
  49408. var self=this,$self=this;
  49409. return false;
  49410. },
  49411. args: [],
  49412. source: "isSteppingNode\x0a\x09^ false",
  49413. referencedClasses: [],
  49414. pragmas: [],
  49415. messageSends: []
  49416. }),
  49417. $globals.ASTNode);
  49418. $core.addMethod(
  49419. $core.method({
  49420. selector: "nextSiblingNode:",
  49421. protocol: "*Compiler-Interpreter",
  49422. fn: function (aNode){
  49423. var self=this,$self=this;
  49424. return $core.withContext(function($ctx1) {
  49425. var $1;
  49426. $1=$self._dagChildren();
  49427. $ctx1.sendIdx["dagChildren"]=1;
  49428. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  49429. return nil;
  49430. }));
  49431. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode})});
  49432. },
  49433. args: ["aNode"],
  49434. 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 ]",
  49435. referencedClasses: [],
  49436. pragmas: [],
  49437. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  49438. }),
  49439. $globals.ASTNode);
  49440. $core.addMethod(
  49441. $core.method({
  49442. selector: "isSteppingNode",
  49443. protocol: "*Compiler-Interpreter",
  49444. fn: function (){
  49445. var self=this,$self=this;
  49446. return true;
  49447. },
  49448. args: [],
  49449. source: "isSteppingNode\x0a\x09^ true",
  49450. referencedClasses: [],
  49451. pragmas: [],
  49452. messageSends: []
  49453. }),
  49454. $globals.AssignmentNode);
  49455. $core.addMethod(
  49456. $core.method({
  49457. selector: "isSteppingNode",
  49458. protocol: "*Compiler-Interpreter",
  49459. fn: function (){
  49460. var self=this,$self=this;
  49461. return true;
  49462. },
  49463. args: [],
  49464. source: "isSteppingNode\x0a\x09^ true",
  49465. referencedClasses: [],
  49466. pragmas: [],
  49467. messageSends: []
  49468. }),
  49469. $globals.BlockNode);
  49470. $core.addMethod(
  49471. $core.method({
  49472. selector: "nextSiblingNode:",
  49473. protocol: "*Compiler-Interpreter",
  49474. fn: function (aNode){
  49475. var self=this,$self=this;
  49476. return nil;
  49477. },
  49478. args: ["aNode"],
  49479. 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",
  49480. referencedClasses: [],
  49481. pragmas: [],
  49482. messageSends: []
  49483. }),
  49484. $globals.BlockNode);
  49485. $core.addMethod(
  49486. $core.method({
  49487. selector: "isSteppingNode",
  49488. protocol: "*Compiler-Interpreter",
  49489. fn: function (){
  49490. var self=this,$self=this;
  49491. return true;
  49492. },
  49493. args: [],
  49494. source: "isSteppingNode\x0a\x09^ true",
  49495. referencedClasses: [],
  49496. pragmas: [],
  49497. messageSends: []
  49498. }),
  49499. $globals.DynamicArrayNode);
  49500. $core.addMethod(
  49501. $core.method({
  49502. selector: "isSteppingNode",
  49503. protocol: "*Compiler-Interpreter",
  49504. fn: function (){
  49505. var self=this,$self=this;
  49506. return true;
  49507. },
  49508. args: [],
  49509. source: "isSteppingNode\x0a\x09^ true",
  49510. referencedClasses: [],
  49511. pragmas: [],
  49512. messageSends: []
  49513. }),
  49514. $globals.DynamicDictionaryNode);
  49515. $core.addMethod(
  49516. $core.method({
  49517. selector: "isSteppingNode",
  49518. protocol: "*Compiler-Interpreter",
  49519. fn: function (){
  49520. var self=this,$self=this;
  49521. return true;
  49522. },
  49523. args: [],
  49524. source: "isSteppingNode\x0a\x09^ true",
  49525. referencedClasses: [],
  49526. pragmas: [],
  49527. messageSends: []
  49528. }),
  49529. $globals.JSStatementNode);
  49530. $core.addMethod(
  49531. $core.method({
  49532. selector: "isCascadeSendNode",
  49533. protocol: "*Compiler-Interpreter",
  49534. fn: function (){
  49535. var self=this,$self=this;
  49536. return $core.withContext(function($ctx1) {
  49537. return $recv($self._parent())._isCascadeNode();
  49538. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{})});
  49539. },
  49540. args: [],
  49541. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  49542. referencedClasses: [],
  49543. pragmas: [],
  49544. messageSends: ["isCascadeNode", "parent"]
  49545. }),
  49546. $globals.SendNode);
  49547. $core.addMethod(
  49548. $core.method({
  49549. selector: "isSteppingNode",
  49550. protocol: "*Compiler-Interpreter",
  49551. fn: function (){
  49552. var self=this,$self=this;
  49553. return true;
  49554. },
  49555. args: [],
  49556. source: "isSteppingNode\x0a\x09^ true",
  49557. referencedClasses: [],
  49558. pragmas: [],
  49559. messageSends: []
  49560. }),
  49561. $globals.SendNode);
  49562. });
  49563. define('amber/lang',[
  49564. './deploy',
  49565. './boot', // pre-fetch, dep of ./helpers
  49566. './helpers', // pre-fetch, dep of ./deploy
  49567. './parser',
  49568. // --- packages for the Amber reflection begin here ---
  49569. 'amber/core/Platform-ImportExport',
  49570. 'amber/core/Compiler-Core',
  49571. 'amber/core/Compiler-AST',
  49572. 'amber/core/Compiler-Semantic',
  49573. 'amber/core/Compiler-IR',
  49574. 'amber/core/Compiler-Inlining',
  49575. 'amber/core/Compiler-Interpreter'
  49576. // --- packages for the Amber reflection end here ---
  49577. ], function (amber) {
  49578. return amber;
  49579. });
  49580. define('amber/core/Platform-DOM',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  49581. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  49582. var $pkg = $core.addPackage("Platform-DOM");
  49583. $pkg.innerEval = function (expr) { return eval(expr); };
  49584. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  49585. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  49586. $core.addMethod(
  49587. $core.method({
  49588. selector: "isDomNode:",
  49589. protocol: "testing",
  49590. fn: function (anObject){
  49591. var self=this,$self=this;
  49592. return $core.withContext(function($ctx1) {
  49593. return anObject.nodeType > 0 &&
  49594. Object.prototype.toString.call(anObject) !== "[object Object]";
  49595. return self;
  49596. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject})});
  49597. },
  49598. args: ["anObject"],
  49599. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  49600. referencedClasses: [],
  49601. pragmas: [["inlineJS:", ["\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22"]]],
  49602. messageSends: []
  49603. }),
  49604. $globals.PlatformDom.a$cls);
  49605. $core.addMethod(
  49606. $core.method({
  49607. selector: "isFeasible",
  49608. protocol: "testing",
  49609. fn: function (){
  49610. var self=this,$self=this;
  49611. return $core.withContext(function($ctx1) {
  49612. if (typeof document === "undefined") return false;
  49613. try {
  49614. var d = document.createElement("div"),
  49615. f = document.createDocumentFragment(),
  49616. t = document.createTextNode("Hello, Amber!");
  49617. f.appendChild(t);
  49618. d.insertBefore(f, null);
  49619. return d.innerHTML === "Hello, Amber!";
  49620. } catch (e) {
  49621. return false;
  49622. };
  49623. return self;
  49624. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  49625. },
  49626. args: [],
  49627. 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'>",
  49628. referencedClasses: [],
  49629. pragmas: [["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 }"]]],
  49630. messageSends: []
  49631. }),
  49632. $globals.PlatformDom.a$cls);
  49633. $core.addMethod(
  49634. $core.method({
  49635. selector: "newCustomEvent:detail:",
  49636. protocol: "creation",
  49637. fn: function (aString,anObject){
  49638. var self=this,$self=this;
  49639. return $core.withContext(function($ctx1) {
  49640. return new CustomEvent(aString, {detail: anObject});
  49641. return self;
  49642. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject})});
  49643. },
  49644. args: ["aString", "anObject"],
  49645. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  49646. referencedClasses: [],
  49647. pragmas: [["inlineJS:", ["return new CustomEvent(aString, {detail: anObject})"]]],
  49648. messageSends: []
  49649. }),
  49650. $globals.PlatformDom.a$cls);
  49651. $core.addMethod(
  49652. $core.method({
  49653. selector: "toArray:",
  49654. protocol: "converting",
  49655. fn: function (aDomList){
  49656. var self=this,$self=this;
  49657. return $core.withContext(function($ctx1) {
  49658. return Array.prototype.slice.call(aDomList);
  49659. return self;
  49660. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList})});
  49661. },
  49662. args: ["aDomList"],
  49663. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  49664. referencedClasses: [],
  49665. pragmas: [["inlineJS:", ["return Array.prototype.slice.call(aDomList)"]]],
  49666. messageSends: []
  49667. }),
  49668. $globals.PlatformDom.a$cls);
  49669. $core.addMethod(
  49670. $core.method({
  49671. selector: "asDomNode",
  49672. protocol: "*Platform-DOM",
  49673. fn: function (){
  49674. var self=this,$self=this;
  49675. var fragment;
  49676. return $core.withContext(function($ctx1) {
  49677. fragment=$recv(document)._createDocumentFragment();
  49678. $self._do_((function(each){
  49679. return $core.withContext(function($ctx2) {
  49680. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  49681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49682. }));
  49683. return fragment;
  49684. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment})});
  49685. },
  49686. args: [],
  49687. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  49688. referencedClasses: [],
  49689. pragmas: [],
  49690. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  49691. }),
  49692. $globals.Collection);
  49693. $core.addMethod(
  49694. $core.method({
  49695. selector: "asDomNode",
  49696. protocol: "*Platform-DOM",
  49697. fn: function (){
  49698. var self=this,$self=this;
  49699. return $core.withContext(function($ctx1) {
  49700. var $1,$2;
  49701. $1=$recv($globals.PlatformDom)._isDomNode_($self.jsObject);
  49702. if($core.assert($1)){
  49703. return $self.jsObject;
  49704. } else {
  49705. $2=(
  49706. $ctx1.supercall = true,
  49707. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  49708. $ctx1.supercall = false;
  49709. return $2;
  49710. }
  49711. return self;
  49712. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  49713. },
  49714. args: [],
  49715. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  49716. referencedClasses: ["PlatformDom"],
  49717. pragmas: [],
  49718. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  49719. }),
  49720. $globals.JSObjectProxy);
  49721. $core.addMethod(
  49722. $core.method({
  49723. selector: "asDomNode",
  49724. protocol: "*Platform-DOM",
  49725. fn: function (){
  49726. var self=this,$self=this;
  49727. return $core.withContext(function($ctx1) {
  49728. return $recv(document)._createTextNode_($self._asString());
  49729. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  49730. },
  49731. args: [],
  49732. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  49733. referencedClasses: [],
  49734. pragmas: [],
  49735. messageSends: ["createTextNode:", "asString"]
  49736. }),
  49737. $globals.String);
  49738. $core.addMethod(
  49739. $core.method({
  49740. selector: "htmlTextContent",
  49741. protocol: "*Platform-DOM",
  49742. fn: function (){
  49743. var self=this,$self=this;
  49744. return $core.withContext(function($ctx1) {
  49745. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  49746. return self;
  49747. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{})});
  49748. },
  49749. args: [],
  49750. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  49751. referencedClasses: [],
  49752. pragmas: [["inlineJS:", ["var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;"]]],
  49753. messageSends: []
  49754. }),
  49755. $globals.String);
  49756. });
  49757. define('amber/core/SUnit',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  49758. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  49759. var $pkg = $core.addPackage("SUnit");
  49760. $pkg.innerEval = function (expr) { return eval(expr); };
  49761. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  49762. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  49763. $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.";
  49764. $core.addMethod(
  49765. $core.method({
  49766. selector: "result",
  49767. protocol: "accessing",
  49768. fn: function (){
  49769. var self=this,$self=this;
  49770. return $self.result;
  49771. },
  49772. args: [],
  49773. source: "result\x0a\x09^ result",
  49774. referencedClasses: [],
  49775. pragmas: [],
  49776. messageSends: []
  49777. }),
  49778. $globals.ResultAnnouncement);
  49779. $core.addMethod(
  49780. $core.method({
  49781. selector: "result:",
  49782. protocol: "accessing",
  49783. fn: function (aTestResult){
  49784. var self=this,$self=this;
  49785. $self.result=aTestResult;
  49786. return self;
  49787. },
  49788. args: ["aTestResult"],
  49789. source: "result: aTestResult\x0a\x09result := aTestResult",
  49790. referencedClasses: [],
  49791. pragmas: [],
  49792. messageSends: []
  49793. }),
  49794. $globals.ResultAnnouncement);
  49795. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  49796. $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.";
  49797. $core.addMethod(
  49798. $core.method({
  49799. selector: "assert:",
  49800. protocol: "testing",
  49801. fn: function (aBoolean){
  49802. var self=this,$self=this;
  49803. return $core.withContext(function($ctx1) {
  49804. $self._assert_description_(aBoolean,"Assertion failed");
  49805. return self;
  49806. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean})});
  49807. },
  49808. args: ["aBoolean"],
  49809. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  49810. referencedClasses: [],
  49811. pragmas: [],
  49812. messageSends: ["assert:description:"]
  49813. }),
  49814. $globals.TestCase);
  49815. $core.addMethod(
  49816. $core.method({
  49817. selector: "assert:description:",
  49818. protocol: "testing",
  49819. fn: function (aBoolean,aString){
  49820. var self=this,$self=this;
  49821. return $core.withContext(function($ctx1) {
  49822. if(!$core.assert(aBoolean)){
  49823. $self._signalFailure_(aString);
  49824. }
  49825. return self;
  49826. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString})});
  49827. },
  49828. args: ["aBoolean", "aString"],
  49829. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  49830. referencedClasses: [],
  49831. pragmas: [],
  49832. messageSends: ["ifFalse:", "signalFailure:"]
  49833. }),
  49834. $globals.TestCase);
  49835. $core.addMethod(
  49836. $core.method({
  49837. selector: "assert:equals:",
  49838. protocol: "testing",
  49839. fn: function (actual,expected){
  49840. var self=this,$self=this;
  49841. return $core.withContext(function($ctx1) {
  49842. var $1,$5,$4,$3,$2;
  49843. $1=$recv(actual).__eq(expected);
  49844. $5=$recv(expected)._printString();
  49845. $ctx1.sendIdx["printString"]=1;
  49846. $4="Expected: ".__comma($5);
  49847. $3=$recv($4).__comma(" but was: ");
  49848. $ctx1.sendIdx[","]=2;
  49849. $2=$recv($3).__comma($recv(actual)._printString());
  49850. $ctx1.sendIdx[","]=1;
  49851. return $self._assert_description_($1,$2);
  49852. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected})});
  49853. },
  49854. args: ["actual", "expected"],
  49855. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  49856. referencedClasses: [],
  49857. pragmas: [],
  49858. messageSends: ["assert:description:", "=", ",", "printString"]
  49859. }),
  49860. $globals.TestCase);
  49861. $core.addMethod(
  49862. $core.method({
  49863. selector: "async:",
  49864. protocol: "async",
  49865. fn: function (aBlock){
  49866. var self=this,$self=this;
  49867. var c;
  49868. return $core.withContext(function($ctx1) {
  49869. var $1;
  49870. $self._errorIfNotAsync_("#async");
  49871. c=$self.context;
  49872. return (function(){
  49873. return $core.withContext(function($ctx2) {
  49874. $1=$self._isAsync();
  49875. if($core.assert($1)){
  49876. return $recv(c)._execute_(aBlock);
  49877. }
  49878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49879. });
  49880. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c})});
  49881. },
  49882. args: ["aBlock"],
  49883. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  49884. referencedClasses: [],
  49885. pragmas: [],
  49886. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  49887. }),
  49888. $globals.TestCase);
  49889. $core.addMethod(
  49890. $core.method({
  49891. selector: "context:",
  49892. protocol: "accessing",
  49893. fn: function (aRunningTestContext){
  49894. var self=this,$self=this;
  49895. $self.context=aRunningTestContext;
  49896. return self;
  49897. },
  49898. args: ["aRunningTestContext"],
  49899. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  49900. referencedClasses: [],
  49901. pragmas: [],
  49902. messageSends: []
  49903. }),
  49904. $globals.TestCase);
  49905. $core.addMethod(
  49906. $core.method({
  49907. selector: "deny:",
  49908. protocol: "testing",
  49909. fn: function (aBoolean){
  49910. var self=this,$self=this;
  49911. return $core.withContext(function($ctx1) {
  49912. $self._assert_($recv(aBoolean)._not());
  49913. return self;
  49914. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean})});
  49915. },
  49916. args: ["aBoolean"],
  49917. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  49918. referencedClasses: [],
  49919. pragmas: [],
  49920. messageSends: ["assert:", "not"]
  49921. }),
  49922. $globals.TestCase);
  49923. $core.addMethod(
  49924. $core.method({
  49925. selector: "errorIfNotAsync:",
  49926. protocol: "error handling",
  49927. fn: function (aString){
  49928. var self=this,$self=this;
  49929. return $core.withContext(function($ctx1) {
  49930. var $1;
  49931. $1=$self._isAsync();
  49932. if(!$core.assert($1)){
  49933. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  49934. }
  49935. return self;
  49936. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString})});
  49937. },
  49938. args: ["aString"],
  49939. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  49940. referencedClasses: [],
  49941. pragmas: [],
  49942. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  49943. }),
  49944. $globals.TestCase);
  49945. $core.addMethod(
  49946. $core.method({
  49947. selector: "finished",
  49948. protocol: "async",
  49949. fn: function (){
  49950. var self=this,$self=this;
  49951. return $core.withContext(function($ctx1) {
  49952. $self._errorIfNotAsync_("#finished");
  49953. $self.asyncTimeout=nil;
  49954. return self;
  49955. }, function($ctx1) {$ctx1.fill(self,"finished",{})});
  49956. },
  49957. args: [],
  49958. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  49959. referencedClasses: [],
  49960. pragmas: [],
  49961. messageSends: ["errorIfNotAsync:"]
  49962. }),
  49963. $globals.TestCase);
  49964. $core.addMethod(
  49965. $core.method({
  49966. selector: "isAsync",
  49967. protocol: "testing",
  49968. fn: function (){
  49969. var self=this,$self=this;
  49970. return $core.withContext(function($ctx1) {
  49971. return $recv($self.asyncTimeout)._notNil();
  49972. }, function($ctx1) {$ctx1.fill(self,"isAsync",{})});
  49973. },
  49974. args: [],
  49975. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  49976. referencedClasses: [],
  49977. pragmas: [],
  49978. messageSends: ["notNil"]
  49979. }),
  49980. $globals.TestCase);
  49981. $core.addMethod(
  49982. $core.method({
  49983. selector: "performTest",
  49984. protocol: "running",
  49985. fn: function (){
  49986. var self=this,$self=this;
  49987. return $core.withContext(function($ctx1) {
  49988. $self.asyncTimeout=nil;
  49989. $self._perform_($self._selector());
  49990. return self;
  49991. }, function($ctx1) {$ctx1.fill(self,"performTest",{})});
  49992. },
  49993. args: [],
  49994. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  49995. referencedClasses: [],
  49996. pragmas: [],
  49997. messageSends: ["perform:", "selector"]
  49998. }),
  49999. $globals.TestCase);
  50000. $core.addMethod(
  50001. $core.method({
  50002. selector: "runCase",
  50003. protocol: "running",
  50004. fn: function (){
  50005. var self=this,$self=this;
  50006. return $core.withContext(function($ctx1) {
  50007. $recv($recv($globals.TestContext)._testCase_(self))._start();
  50008. return self;
  50009. }, function($ctx1) {$ctx1.fill(self,"runCase",{})});
  50010. },
  50011. args: [],
  50012. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  50013. referencedClasses: ["TestContext"],
  50014. pragmas: [],
  50015. messageSends: ["start", "testCase:"]
  50016. }),
  50017. $globals.TestCase);
  50018. $core.addMethod(
  50019. $core.method({
  50020. selector: "selector",
  50021. protocol: "accessing",
  50022. fn: function (){
  50023. var self=this,$self=this;
  50024. return $self.testSelector;
  50025. },
  50026. args: [],
  50027. source: "selector\x0a\x09^ testSelector",
  50028. referencedClasses: [],
  50029. pragmas: [],
  50030. messageSends: []
  50031. }),
  50032. $globals.TestCase);
  50033. $core.addMethod(
  50034. $core.method({
  50035. selector: "setTestSelector:",
  50036. protocol: "accessing",
  50037. fn: function (aSelector){
  50038. var self=this,$self=this;
  50039. $self.testSelector=aSelector;
  50040. return self;
  50041. },
  50042. args: ["aSelector"],
  50043. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  50044. referencedClasses: [],
  50045. pragmas: [],
  50046. messageSends: []
  50047. }),
  50048. $globals.TestCase);
  50049. $core.addMethod(
  50050. $core.method({
  50051. selector: "setUp",
  50052. protocol: "running",
  50053. fn: function (){
  50054. var self=this,$self=this;
  50055. return self;
  50056. },
  50057. args: [],
  50058. source: "setUp",
  50059. referencedClasses: [],
  50060. pragmas: [],
  50061. messageSends: []
  50062. }),
  50063. $globals.TestCase);
  50064. $core.addMethod(
  50065. $core.method({
  50066. selector: "should:",
  50067. protocol: "testing",
  50068. fn: function (aBlock){
  50069. var self=this,$self=this;
  50070. return $core.withContext(function($ctx1) {
  50071. $self._assert_($recv(aBlock)._value());
  50072. return self;
  50073. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock})});
  50074. },
  50075. args: ["aBlock"],
  50076. source: "should: aBlock\x0a\x09self assert: aBlock value",
  50077. referencedClasses: [],
  50078. pragmas: [],
  50079. messageSends: ["assert:", "value"]
  50080. }),
  50081. $globals.TestCase);
  50082. $core.addMethod(
  50083. $core.method({
  50084. selector: "should:raise:",
  50085. protocol: "testing",
  50086. fn: function (aBlock,anExceptionClass){
  50087. var self=this,$self=this;
  50088. return $core.withContext(function($ctx1) {
  50089. $self._assert_($recv((function(){
  50090. return $core.withContext(function($ctx2) {
  50091. $recv(aBlock)._value();
  50092. return false;
  50093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50094. }))._on_do_(anExceptionClass,(function(ex){
  50095. return true;
  50096. })));
  50097. return self;
  50098. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  50099. },
  50100. args: ["aBlock", "anExceptionClass"],
  50101. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  50102. referencedClasses: [],
  50103. pragmas: [],
  50104. messageSends: ["assert:", "on:do:", "value"]
  50105. }),
  50106. $globals.TestCase);
  50107. $core.addMethod(
  50108. $core.method({
  50109. selector: "shouldnt:raise:",
  50110. protocol: "testing",
  50111. fn: function (aBlock,anExceptionClass){
  50112. var self=this,$self=this;
  50113. return $core.withContext(function($ctx1) {
  50114. $self._assert_($recv((function(){
  50115. return $core.withContext(function($ctx2) {
  50116. $recv(aBlock)._value();
  50117. return true;
  50118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50119. }))._on_do_(anExceptionClass,(function(ex){
  50120. return false;
  50121. })));
  50122. return self;
  50123. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  50124. },
  50125. args: ["aBlock", "anExceptionClass"],
  50126. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  50127. referencedClasses: [],
  50128. pragmas: [],
  50129. messageSends: ["assert:", "on:do:", "value"]
  50130. }),
  50131. $globals.TestCase);
  50132. $core.addMethod(
  50133. $core.method({
  50134. selector: "signalFailure:",
  50135. protocol: "private",
  50136. fn: function (aString){
  50137. var self=this,$self=this;
  50138. return $core.withContext(function($ctx1) {
  50139. var $1;
  50140. $1=$recv($globals.TestFailure)._new();
  50141. $recv($1)._messageText_(aString);
  50142. $recv($1)._signal();
  50143. return self;
  50144. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString})});
  50145. },
  50146. args: ["aString"],
  50147. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  50148. referencedClasses: ["TestFailure"],
  50149. pragmas: [],
  50150. messageSends: ["messageText:", "new", "signal"]
  50151. }),
  50152. $globals.TestCase);
  50153. $core.addMethod(
  50154. $core.method({
  50155. selector: "tearDown",
  50156. protocol: "running",
  50157. fn: function (){
  50158. var self=this,$self=this;
  50159. return self;
  50160. },
  50161. args: [],
  50162. source: "tearDown",
  50163. referencedClasses: [],
  50164. pragmas: [],
  50165. messageSends: []
  50166. }),
  50167. $globals.TestCase);
  50168. $core.addMethod(
  50169. $core.method({
  50170. selector: "timeout:",
  50171. protocol: "async",
  50172. fn: function (aNumber){
  50173. var self=this,$self=this;
  50174. return $core.withContext(function($ctx1) {
  50175. var $1,$receiver;
  50176. $1=$self.asyncTimeout;
  50177. if(($receiver = $1) == null || $receiver.a$nil){
  50178. $1;
  50179. } else {
  50180. $recv($self.asyncTimeout)._clearTimeout();
  50181. }
  50182. $self.asyncTimeout=(0);
  50183. $self.asyncTimeout=$recv($self._async_((function(){
  50184. return $core.withContext(function($ctx2) {
  50185. return $self._assert_description_(false,"SUnit grace time exhausted");
  50186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50187. })))._valueWithTimeout_(aNumber);
  50188. return self;
  50189. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber})});
  50190. },
  50191. args: ["aNumber"],
  50192. 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",
  50193. referencedClasses: [],
  50194. pragmas: [],
  50195. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  50196. }),
  50197. $globals.TestCase);
  50198. $core.addMethod(
  50199. $core.method({
  50200. selector: "allTestSelectors",
  50201. protocol: "accessing",
  50202. fn: function (){
  50203. var self=this,$self=this;
  50204. var selectors;
  50205. return $core.withContext(function($ctx1) {
  50206. var $1;
  50207. selectors=$self._testSelectors();
  50208. $1=$self._shouldInheritSelectors();
  50209. if($core.assert($1)){
  50210. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  50211. }
  50212. return selectors;
  50213. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors})});
  50214. },
  50215. args: [],
  50216. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  50217. referencedClasses: [],
  50218. pragmas: [],
  50219. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  50220. }),
  50221. $globals.TestCase.a$cls);
  50222. $core.addMethod(
  50223. $core.method({
  50224. selector: "buildSuite",
  50225. protocol: "accessing",
  50226. fn: function (){
  50227. var self=this,$self=this;
  50228. return $core.withContext(function($ctx1) {
  50229. return $recv($self._allTestSelectors())._collect_((function(each){
  50230. return $core.withContext(function($ctx2) {
  50231. return $self._selector_(each);
  50232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50233. }));
  50234. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{})});
  50235. },
  50236. args: [],
  50237. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  50238. referencedClasses: [],
  50239. pragmas: [],
  50240. messageSends: ["collect:", "allTestSelectors", "selector:"]
  50241. }),
  50242. $globals.TestCase.a$cls);
  50243. $core.addMethod(
  50244. $core.method({
  50245. selector: "classTag",
  50246. protocol: "accessing",
  50247. fn: function (){
  50248. var self=this,$self=this;
  50249. return "test";
  50250. },
  50251. args: [],
  50252. 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'",
  50253. referencedClasses: [],
  50254. pragmas: [],
  50255. messageSends: []
  50256. }),
  50257. $globals.TestCase.a$cls);
  50258. $core.addMethod(
  50259. $core.method({
  50260. selector: "isAbstract",
  50261. protocol: "testing",
  50262. fn: function (){
  50263. var self=this,$self=this;
  50264. return $core.withContext(function($ctx1) {
  50265. return $recv($self._name()).__eq("TestCase");
  50266. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  50267. },
  50268. args: [],
  50269. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  50270. referencedClasses: [],
  50271. pragmas: [],
  50272. messageSends: ["=", "name"]
  50273. }),
  50274. $globals.TestCase.a$cls);
  50275. $core.addMethod(
  50276. $core.method({
  50277. selector: "isTestClass",
  50278. protocol: "testing",
  50279. fn: function (){
  50280. var self=this,$self=this;
  50281. return $core.withContext(function($ctx1) {
  50282. return $recv($self._isAbstract())._not();
  50283. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{})});
  50284. },
  50285. args: [],
  50286. source: "isTestClass\x0a\x09^ self isAbstract not",
  50287. referencedClasses: [],
  50288. pragmas: [],
  50289. messageSends: ["not", "isAbstract"]
  50290. }),
  50291. $globals.TestCase.a$cls);
  50292. $core.addMethod(
  50293. $core.method({
  50294. selector: "lookupHierarchyRoot",
  50295. protocol: "accessing",
  50296. fn: function (){
  50297. var self=this,$self=this;
  50298. return $globals.TestCase;
  50299. },
  50300. args: [],
  50301. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  50302. referencedClasses: ["TestCase"],
  50303. pragmas: [],
  50304. messageSends: []
  50305. }),
  50306. $globals.TestCase.a$cls);
  50307. $core.addMethod(
  50308. $core.method({
  50309. selector: "selector:",
  50310. protocol: "accessing",
  50311. fn: function (aSelector){
  50312. var self=this,$self=this;
  50313. return $core.withContext(function($ctx1) {
  50314. var $1;
  50315. $1=$self._new();
  50316. $recv($1)._setTestSelector_(aSelector);
  50317. return $recv($1)._yourself();
  50318. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector})});
  50319. },
  50320. args: ["aSelector"],
  50321. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  50322. referencedClasses: [],
  50323. pragmas: [],
  50324. messageSends: ["setTestSelector:", "new", "yourself"]
  50325. }),
  50326. $globals.TestCase.a$cls);
  50327. $core.addMethod(
  50328. $core.method({
  50329. selector: "shouldInheritSelectors",
  50330. protocol: "testing",
  50331. fn: function (){
  50332. var self=this,$self=this;
  50333. return $core.withContext(function($ctx1) {
  50334. return $self.__tild_eq($self._lookupHierarchyRoot());
  50335. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{})});
  50336. },
  50337. args: [],
  50338. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  50339. referencedClasses: [],
  50340. pragmas: [],
  50341. messageSends: ["~=", "lookupHierarchyRoot"]
  50342. }),
  50343. $globals.TestCase.a$cls);
  50344. $core.addMethod(
  50345. $core.method({
  50346. selector: "testSelectors",
  50347. protocol: "accessing",
  50348. fn: function (){
  50349. var self=this,$self=this;
  50350. return $core.withContext(function($ctx1) {
  50351. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  50352. return $core.withContext(function($ctx2) {
  50353. return $recv(each)._match_("^test");
  50354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50355. }));
  50356. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{})});
  50357. },
  50358. args: [],
  50359. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  50360. referencedClasses: [],
  50361. pragmas: [],
  50362. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  50363. }),
  50364. $globals.TestCase.a$cls);
  50365. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  50366. $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).";
  50367. $core.addMethod(
  50368. $core.method({
  50369. selector: "execute:",
  50370. protocol: "running",
  50371. fn: function (aBlock){
  50372. var self=this,$self=this;
  50373. var failed;
  50374. return $core.withContext(function($ctx1) {
  50375. var $1,$2;
  50376. $recv($self.testCase)._context_(self);
  50377. $ctx1.sendIdx["context:"]=1;
  50378. $recv((function(){
  50379. return $core.withContext(function($ctx2) {
  50380. failed=true;
  50381. $recv(aBlock)._value();
  50382. failed=false;
  50383. return failed;
  50384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50385. }))._ensure_((function(){
  50386. return $core.withContext(function($ctx2) {
  50387. $recv($self.testCase)._context_(nil);
  50388. $1=$recv(failed)._and_((function(){
  50389. return $core.withContext(function($ctx3) {
  50390. return $recv($self.testCase)._isAsync();
  50391. $ctx3.sendIdx["isAsync"]=1;
  50392. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50393. }));
  50394. if($core.assert($1)){
  50395. $recv($self.testCase)._finished();
  50396. }
  50397. $2=$recv($self.testCase)._isAsync();
  50398. if(!$core.assert($2)){
  50399. return $recv($self.testCase)._tearDown();
  50400. }
  50401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50402. }));
  50403. return self;
  50404. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed})});
  50405. },
  50406. args: ["aBlock"],
  50407. 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 ] ]",
  50408. referencedClasses: [],
  50409. pragmas: [],
  50410. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  50411. }),
  50412. $globals.TestContext);
  50413. $core.addMethod(
  50414. $core.method({
  50415. selector: "start",
  50416. protocol: "running",
  50417. fn: function (){
  50418. var self=this,$self=this;
  50419. return $core.withContext(function($ctx1) {
  50420. $self._execute_((function(){
  50421. return $core.withContext(function($ctx2) {
  50422. $recv($self.testCase)._setUp();
  50423. return $recv($self.testCase)._performTest();
  50424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50425. }));
  50426. return self;
  50427. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  50428. },
  50429. args: [],
  50430. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  50431. referencedClasses: [],
  50432. pragmas: [],
  50433. messageSends: ["execute:", "setUp", "performTest"]
  50434. }),
  50435. $globals.TestContext);
  50436. $core.addMethod(
  50437. $core.method({
  50438. selector: "testCase:",
  50439. protocol: "accessing",
  50440. fn: function (aTestCase){
  50441. var self=this,$self=this;
  50442. $self.testCase=aTestCase;
  50443. return self;
  50444. },
  50445. args: ["aTestCase"],
  50446. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  50447. referencedClasses: [],
  50448. pragmas: [],
  50449. messageSends: []
  50450. }),
  50451. $globals.TestContext);
  50452. $core.addMethod(
  50453. $core.method({
  50454. selector: "testCase:",
  50455. protocol: "instance creation",
  50456. fn: function (aTestCase){
  50457. var self=this,$self=this;
  50458. return $core.withContext(function($ctx1) {
  50459. var $1;
  50460. $1=$self._new();
  50461. $recv($1)._testCase_(aTestCase);
  50462. return $recv($1)._yourself();
  50463. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase})});
  50464. },
  50465. args: ["aTestCase"],
  50466. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  50467. referencedClasses: [],
  50468. pragmas: [],
  50469. messageSends: ["testCase:", "new", "yourself"]
  50470. }),
  50471. $globals.TestContext.a$cls);
  50472. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  50473. $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`.";
  50474. $core.addMethod(
  50475. $core.method({
  50476. selector: "execute:",
  50477. protocol: "running",
  50478. fn: function (aBlock){
  50479. var self=this,$self=this;
  50480. return $core.withContext(function($ctx1) {
  50481. var $1;
  50482. $recv((function(){
  50483. return $core.withContext(function($ctx2) {
  50484. return $self._withErrorReporting_((function(){
  50485. return $core.withContext(function($ctx3) {
  50486. return (
  50487. $ctx3.supercall = true,
  50488. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  50489. $ctx3.supercall = false;
  50490. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50491. }));
  50492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50493. }))._ensure_((function(){
  50494. return $core.withContext(function($ctx2) {
  50495. $1=$recv($self.testCase)._isAsync();
  50496. if(!$core.assert($1)){
  50497. $recv($self.result)._increaseRuns();
  50498. return $recv($self.finished)._value();
  50499. }
  50500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50501. }));
  50502. return self;
  50503. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock})});
  50504. },
  50505. args: ["aBlock"],
  50506. 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 ] ]",
  50507. referencedClasses: [],
  50508. pragmas: [],
  50509. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  50510. }),
  50511. $globals.ReportingTestContext);
  50512. $core.addMethod(
  50513. $core.method({
  50514. selector: "finished:",
  50515. protocol: "accessing",
  50516. fn: function (aBlock){
  50517. var self=this,$self=this;
  50518. $self.finished=aBlock;
  50519. return self;
  50520. },
  50521. args: ["aBlock"],
  50522. source: "finished: aBlock\x0a\x09finished := aBlock",
  50523. referencedClasses: [],
  50524. pragmas: [],
  50525. messageSends: []
  50526. }),
  50527. $globals.ReportingTestContext);
  50528. $core.addMethod(
  50529. $core.method({
  50530. selector: "result:",
  50531. protocol: "accessing",
  50532. fn: function (aTestResult){
  50533. var self=this,$self=this;
  50534. $self.result=aTestResult;
  50535. return self;
  50536. },
  50537. args: ["aTestResult"],
  50538. source: "result: aTestResult\x0a\x09result := aTestResult",
  50539. referencedClasses: [],
  50540. pragmas: [],
  50541. messageSends: []
  50542. }),
  50543. $globals.ReportingTestContext);
  50544. $core.addMethod(
  50545. $core.method({
  50546. selector: "withErrorReporting:",
  50547. protocol: "private",
  50548. fn: function (aBlock){
  50549. var self=this,$self=this;
  50550. return $core.withContext(function($ctx1) {
  50551. $recv((function(){
  50552. return $core.withContext(function($ctx2) {
  50553. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  50554. return $core.withContext(function($ctx3) {
  50555. return $recv($self.result)._addFailure_($self.testCase);
  50556. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  50557. }));
  50558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50559. }))._on_do_($globals.Error,(function(ex){
  50560. return $core.withContext(function($ctx2) {
  50561. return $recv($self.result)._addError_($self.testCase);
  50562. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  50563. }));
  50564. $ctx1.sendIdx["on:do:"]=1;
  50565. return self;
  50566. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock})});
  50567. },
  50568. args: ["aBlock"],
  50569. 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 ]",
  50570. referencedClasses: ["TestFailure", "Error"],
  50571. pragmas: [],
  50572. messageSends: ["on:do:", "addFailure:", "addError:"]
  50573. }),
  50574. $globals.ReportingTestContext);
  50575. $core.addMethod(
  50576. $core.method({
  50577. selector: "testCase:result:finished:",
  50578. protocol: "instance creation",
  50579. fn: function (aTestCase,aTestResult,aBlock){
  50580. var self=this,$self=this;
  50581. return $core.withContext(function($ctx1) {
  50582. var $1;
  50583. $1=(
  50584. $ctx1.supercall = true,
  50585. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  50586. $ctx1.supercall = false;
  50587. $recv($1)._result_(aTestResult);
  50588. $recv($1)._finished_(aBlock);
  50589. return $recv($1)._yourself();
  50590. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock})});
  50591. },
  50592. args: ["aTestCase", "aTestResult", "aBlock"],
  50593. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  50594. referencedClasses: [],
  50595. pragmas: [],
  50596. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  50597. }),
  50598. $globals.ReportingTestContext.a$cls);
  50599. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  50600. $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.";
  50601. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  50602. $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";
  50603. $core.addMethod(
  50604. $core.method({
  50605. selector: "addError:",
  50606. protocol: "accessing",
  50607. fn: function (anError){
  50608. var self=this,$self=this;
  50609. return $core.withContext(function($ctx1) {
  50610. $recv($self._errors())._add_(anError);
  50611. return self;
  50612. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError})});
  50613. },
  50614. args: ["anError"],
  50615. source: "addError: anError\x0a\x09self errors add: anError",
  50616. referencedClasses: [],
  50617. pragmas: [],
  50618. messageSends: ["add:", "errors"]
  50619. }),
  50620. $globals.TestResult);
  50621. $core.addMethod(
  50622. $core.method({
  50623. selector: "addFailure:",
  50624. protocol: "accessing",
  50625. fn: function (aFailure){
  50626. var self=this,$self=this;
  50627. return $core.withContext(function($ctx1) {
  50628. $recv($self._failures())._add_(aFailure);
  50629. return self;
  50630. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure})});
  50631. },
  50632. args: ["aFailure"],
  50633. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  50634. referencedClasses: [],
  50635. pragmas: [],
  50636. messageSends: ["add:", "failures"]
  50637. }),
  50638. $globals.TestResult);
  50639. $core.addMethod(
  50640. $core.method({
  50641. selector: "errors",
  50642. protocol: "accessing",
  50643. fn: function (){
  50644. var self=this,$self=this;
  50645. return $self.errors;
  50646. },
  50647. args: [],
  50648. source: "errors\x0a\x09^ errors",
  50649. referencedClasses: [],
  50650. pragmas: [],
  50651. messageSends: []
  50652. }),
  50653. $globals.TestResult);
  50654. $core.addMethod(
  50655. $core.method({
  50656. selector: "failures",
  50657. protocol: "accessing",
  50658. fn: function (){
  50659. var self=this,$self=this;
  50660. return $self.failures;
  50661. },
  50662. args: [],
  50663. source: "failures\x0a\x09^ failures",
  50664. referencedClasses: [],
  50665. pragmas: [],
  50666. messageSends: []
  50667. }),
  50668. $globals.TestResult);
  50669. $core.addMethod(
  50670. $core.method({
  50671. selector: "increaseRuns",
  50672. protocol: "accessing",
  50673. fn: function (){
  50674. var self=this,$self=this;
  50675. return $core.withContext(function($ctx1) {
  50676. $self.runs=$recv($self.runs).__plus((1));
  50677. return self;
  50678. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{})});
  50679. },
  50680. args: [],
  50681. source: "increaseRuns\x0a\x09runs := runs + 1",
  50682. referencedClasses: [],
  50683. pragmas: [],
  50684. messageSends: ["+"]
  50685. }),
  50686. $globals.TestResult);
  50687. $core.addMethod(
  50688. $core.method({
  50689. selector: "initialize",
  50690. protocol: "initialization",
  50691. fn: function (){
  50692. var self=this,$self=this;
  50693. return $core.withContext(function($ctx1) {
  50694. (
  50695. $ctx1.supercall = true,
  50696. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  50697. $ctx1.supercall = false;
  50698. $self.timestamp=$recv($globals.Date)._now();
  50699. $self.runs=(0);
  50700. $self.errors=$recv($globals.Array)._new();
  50701. $ctx1.sendIdx["new"]=1;
  50702. $self.failures=$recv($globals.Array)._new();
  50703. $self.total=(0);
  50704. return self;
  50705. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  50706. },
  50707. args: [],
  50708. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  50709. referencedClasses: ["Date", "Array"],
  50710. pragmas: [],
  50711. messageSends: ["initialize", "now", "new"]
  50712. }),
  50713. $globals.TestResult);
  50714. $core.addMethod(
  50715. $core.method({
  50716. selector: "nextRunDo:",
  50717. protocol: "running",
  50718. fn: function (aBlock){
  50719. var self=this,$self=this;
  50720. return $core.withContext(function($ctx1) {
  50721. var $2,$1;
  50722. $2=$self._runs();
  50723. $ctx1.sendIdx["runs"]=1;
  50724. $1=$recv($2).__eq_eq($self._total());
  50725. if(!$core.assert($1)){
  50726. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  50727. }
  50728. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock})});
  50729. },
  50730. args: ["aBlock"],
  50731. 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 ]",
  50732. referencedClasses: [],
  50733. pragmas: [],
  50734. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  50735. }),
  50736. $globals.TestResult);
  50737. $core.addMethod(
  50738. $core.method({
  50739. selector: "runCase:",
  50740. protocol: "running",
  50741. fn: function (aTestCase){
  50742. var self=this,$self=this;
  50743. return $core.withContext(function($ctx1) {
  50744. $recv((function(){
  50745. return $core.withContext(function($ctx2) {
  50746. return $recv((function(){
  50747. return $core.withContext(function($ctx3) {
  50748. $self._increaseRuns();
  50749. return $recv(aTestCase)._runCase();
  50750. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50751. }))._on_do_($globals.TestFailure,(function(ex){
  50752. return $core.withContext(function($ctx3) {
  50753. return $self._addFailure_(aTestCase);
  50754. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50755. }));
  50756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50757. }))._on_do_($globals.Error,(function(ex){
  50758. return $core.withContext(function($ctx2) {
  50759. return $self._addError_(aTestCase);
  50760. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  50761. }));
  50762. $ctx1.sendIdx["on:do:"]=1;
  50763. return self;
  50764. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase})});
  50765. },
  50766. args: ["aTestCase"],
  50767. 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 ]",
  50768. referencedClasses: ["TestFailure", "Error"],
  50769. pragmas: [],
  50770. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  50771. }),
  50772. $globals.TestResult);
  50773. $core.addMethod(
  50774. $core.method({
  50775. selector: "runs",
  50776. protocol: "accessing",
  50777. fn: function (){
  50778. var self=this,$self=this;
  50779. return $self.runs;
  50780. },
  50781. args: [],
  50782. source: "runs\x0a\x09^ runs",
  50783. referencedClasses: [],
  50784. pragmas: [],
  50785. messageSends: []
  50786. }),
  50787. $globals.TestResult);
  50788. $core.addMethod(
  50789. $core.method({
  50790. selector: "status",
  50791. protocol: "accessing",
  50792. fn: function (){
  50793. var self=this,$self=this;
  50794. return $core.withContext(function($ctx1) {
  50795. var $1;
  50796. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  50797. return "error";
  50798. }),(function(){
  50799. return $core.withContext(function($ctx2) {
  50800. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  50801. return "failure";
  50802. }),(function(){
  50803. return "success";
  50804. }));
  50805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50806. }));
  50807. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50808. return $1;
  50809. }, function($ctx1) {$ctx1.fill(self,"status",{})});
  50810. },
  50811. args: [],
  50812. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  50813. referencedClasses: [],
  50814. pragmas: [],
  50815. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  50816. }),
  50817. $globals.TestResult);
  50818. $core.addMethod(
  50819. $core.method({
  50820. selector: "timestamp",
  50821. protocol: "accessing",
  50822. fn: function (){
  50823. var self=this,$self=this;
  50824. return $self.timestamp;
  50825. },
  50826. args: [],
  50827. source: "timestamp\x0a\x09^ timestamp",
  50828. referencedClasses: [],
  50829. pragmas: [],
  50830. messageSends: []
  50831. }),
  50832. $globals.TestResult);
  50833. $core.addMethod(
  50834. $core.method({
  50835. selector: "total",
  50836. protocol: "accessing",
  50837. fn: function (){
  50838. var self=this,$self=this;
  50839. return $self.total;
  50840. },
  50841. args: [],
  50842. source: "total\x0a\x09^ total",
  50843. referencedClasses: [],
  50844. pragmas: [],
  50845. messageSends: []
  50846. }),
  50847. $globals.TestResult);
  50848. $core.addMethod(
  50849. $core.method({
  50850. selector: "total:",
  50851. protocol: "accessing",
  50852. fn: function (aNumber){
  50853. var self=this,$self=this;
  50854. $self.total=aNumber;
  50855. return self;
  50856. },
  50857. args: ["aNumber"],
  50858. source: "total: aNumber\x0a\x09total := aNumber",
  50859. referencedClasses: [],
  50860. pragmas: [],
  50861. messageSends: []
  50862. }),
  50863. $globals.TestResult);
  50864. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  50865. $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`.";
  50866. $core.addMethod(
  50867. $core.method({
  50868. selector: "announcer",
  50869. protocol: "accessing",
  50870. fn: function (){
  50871. var self=this,$self=this;
  50872. return $self.announcer;
  50873. },
  50874. args: [],
  50875. source: "announcer\x0a\x09^ announcer",
  50876. referencedClasses: [],
  50877. pragmas: [],
  50878. messageSends: []
  50879. }),
  50880. $globals.TestSuiteRunner);
  50881. $core.addMethod(
  50882. $core.method({
  50883. selector: "contextOf:",
  50884. protocol: "private",
  50885. fn: function (anInteger){
  50886. var self=this,$self=this;
  50887. return $core.withContext(function($ctx1) {
  50888. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self.suite)._at_(anInteger),$self.result,(function(){
  50889. return $core.withContext(function($ctx2) {
  50890. return $self._resume();
  50891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50892. }));
  50893. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger})});
  50894. },
  50895. args: ["anInteger"],
  50896. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  50897. referencedClasses: ["ReportingTestContext"],
  50898. pragmas: [],
  50899. messageSends: ["testCase:result:finished:", "at:", "resume"]
  50900. }),
  50901. $globals.TestSuiteRunner);
  50902. $core.addMethod(
  50903. $core.method({
  50904. selector: "initialize",
  50905. protocol: "initialization",
  50906. fn: function (){
  50907. var self=this,$self=this;
  50908. return $core.withContext(function($ctx1) {
  50909. var $1;
  50910. (
  50911. $ctx1.supercall = true,
  50912. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  50913. $ctx1.supercall = false;
  50914. $self.announcer=$recv($globals.Announcer)._new();
  50915. $ctx1.sendIdx["new"]=1;
  50916. $self.result=$recv($globals.TestResult)._new();
  50917. $self.runNextTest=(function(){
  50918. var runs;
  50919. return $core.withContext(function($ctx2) {
  50920. runs=$recv($self.result)._runs();
  50921. $1=$recv(runs).__lt($recv($self.result)._total());
  50922. if($core.assert($1)){
  50923. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  50924. }
  50925. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  50926. });
  50927. return self;
  50928. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  50929. },
  50930. args: [],
  50931. 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 ] ].",
  50932. referencedClasses: ["Announcer", "TestResult"],
  50933. pragmas: [],
  50934. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  50935. }),
  50936. $globals.TestSuiteRunner);
  50937. $core.addMethod(
  50938. $core.method({
  50939. selector: "result",
  50940. protocol: "accessing",
  50941. fn: function (){
  50942. var self=this,$self=this;
  50943. return $self.result;
  50944. },
  50945. args: [],
  50946. source: "result\x0a\x09^ result",
  50947. referencedClasses: [],
  50948. pragmas: [],
  50949. messageSends: []
  50950. }),
  50951. $globals.TestSuiteRunner);
  50952. $core.addMethod(
  50953. $core.method({
  50954. selector: "resume",
  50955. protocol: "actions",
  50956. fn: function (){
  50957. var self=this,$self=this;
  50958. return $core.withContext(function($ctx1) {
  50959. $recv($self.runNextTest)._fork();
  50960. $recv($self.announcer)._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self.result));
  50961. return self;
  50962. }, function($ctx1) {$ctx1.fill(self,"resume",{})});
  50963. },
  50964. args: [],
  50965. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  50966. referencedClasses: ["ResultAnnouncement"],
  50967. pragmas: [],
  50968. messageSends: ["fork", "announce:", "result:", "new"]
  50969. }),
  50970. $globals.TestSuiteRunner);
  50971. $core.addMethod(
  50972. $core.method({
  50973. selector: "run",
  50974. protocol: "actions",
  50975. fn: function (){
  50976. var self=this,$self=this;
  50977. return $core.withContext(function($ctx1) {
  50978. $recv($self.result)._total_($recv($self.suite)._size());
  50979. $self._resume();
  50980. return self;
  50981. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  50982. },
  50983. args: [],
  50984. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  50985. referencedClasses: [],
  50986. pragmas: [],
  50987. messageSends: ["total:", "size", "resume"]
  50988. }),
  50989. $globals.TestSuiteRunner);
  50990. $core.addMethod(
  50991. $core.method({
  50992. selector: "suite:",
  50993. protocol: "accessing",
  50994. fn: function (aCollection){
  50995. var self=this,$self=this;
  50996. $self.suite=aCollection;
  50997. return self;
  50998. },
  50999. args: ["aCollection"],
  51000. source: "suite: aCollection\x0a\x09suite := aCollection",
  51001. referencedClasses: [],
  51002. pragmas: [],
  51003. messageSends: []
  51004. }),
  51005. $globals.TestSuiteRunner);
  51006. $core.addMethod(
  51007. $core.method({
  51008. selector: "new",
  51009. protocol: "instance creation",
  51010. fn: function (){
  51011. var self=this,$self=this;
  51012. return $core.withContext(function($ctx1) {
  51013. $self._shouldNotImplement();
  51014. return self;
  51015. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  51016. },
  51017. args: [],
  51018. source: "new\x0a\x09self shouldNotImplement",
  51019. referencedClasses: [],
  51020. pragmas: [],
  51021. messageSends: ["shouldNotImplement"]
  51022. }),
  51023. $globals.TestSuiteRunner.a$cls);
  51024. $core.addMethod(
  51025. $core.method({
  51026. selector: "on:",
  51027. protocol: "instance creation",
  51028. fn: function (aCollection){
  51029. var self=this,$self=this;
  51030. return $core.withContext(function($ctx1) {
  51031. var $1;
  51032. $1=(
  51033. $ctx1.supercall = true,
  51034. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  51035. $ctx1.supercall = false;
  51036. return $recv($1)._suite_(aCollection);
  51037. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  51038. },
  51039. args: ["aCollection"],
  51040. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  51041. referencedClasses: [],
  51042. pragmas: [],
  51043. messageSends: ["suite:", "new"]
  51044. }),
  51045. $globals.TestSuiteRunner.a$cls);
  51046. $core.addMethod(
  51047. $core.method({
  51048. selector: "isTestPackage",
  51049. protocol: "*SUnit",
  51050. fn: function (){
  51051. var self=this,$self=this;
  51052. return $core.withContext(function($ctx1) {
  51053. return $recv($self._classes())._anySatisfy_((function(each){
  51054. return $core.withContext(function($ctx2) {
  51055. return $recv(each)._isTestClass();
  51056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51057. }));
  51058. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{})});
  51059. },
  51060. args: [],
  51061. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  51062. referencedClasses: [],
  51063. pragmas: [],
  51064. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  51065. }),
  51066. $globals.Package);
  51067. $core.addMethod(
  51068. $core.method({
  51069. selector: "isTestClass",
  51070. protocol: "*SUnit",
  51071. fn: function (){
  51072. var self=this,$self=this;
  51073. return false;
  51074. },
  51075. args: [],
  51076. source: "isTestClass\x0a\x09^ false",
  51077. referencedClasses: [],
  51078. pragmas: [],
  51079. messageSends: []
  51080. }),
  51081. $globals.TBehaviorDefaults);
  51082. });
  51083. define('amber/core/Compiler-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  51084. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  51085. var $pkg = $core.addPackage("Compiler-Tests");
  51086. $pkg.innerEval = function (expr) { return eval(expr); };
  51087. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  51088. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  51089. $core.addMethod(
  51090. $core.method({
  51091. selector: "parse:forClass:",
  51092. protocol: "parsing",
  51093. fn: function (aString,aClass){
  51094. var self=this,$self=this;
  51095. return $core.withContext(function($ctx1) {
  51096. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  51097. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass})});
  51098. },
  51099. args: ["aString", "aClass"],
  51100. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  51101. referencedClasses: ["Compiler"],
  51102. pragmas: [],
  51103. messageSends: ["ast:forClass:protocol:", "new"]
  51104. }),
  51105. $globals.ASTParsingTest);
  51106. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  51107. $core.addMethod(
  51108. $core.method({
  51109. selector: "astPCNodeVisitor",
  51110. protocol: "factory",
  51111. fn: function (){
  51112. var self=this,$self=this;
  51113. return $core.withContext(function($ctx1) {
  51114. var $1;
  51115. $1=$recv($globals.ASTPCNodeVisitor)._new();
  51116. $recv($1)._index_((0));
  51117. return $recv($1)._yourself();
  51118. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
  51119. },
  51120. args: [],
  51121. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  51122. referencedClasses: ["ASTPCNodeVisitor"],
  51123. pragmas: [],
  51124. messageSends: ["index:", "new", "yourself"]
  51125. }),
  51126. $globals.ASTPCNodeVisitorTest);
  51127. $core.addMethod(
  51128. $core.method({
  51129. selector: "astPCNodeVisitorForSelector:",
  51130. protocol: "factory",
  51131. fn: function (aString){
  51132. var self=this,$self=this;
  51133. return $core.withContext(function($ctx1) {
  51134. var $1;
  51135. $1=$recv($globals.ASTPCNodeVisitor)._new();
  51136. $recv($1)._selector_(aString);
  51137. $recv($1)._index_((0));
  51138. return $recv($1)._yourself();
  51139. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
  51140. },
  51141. args: ["aString"],
  51142. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  51143. referencedClasses: ["ASTPCNodeVisitor"],
  51144. pragmas: [],
  51145. messageSends: ["selector:", "new", "index:", "yourself"]
  51146. }),
  51147. $globals.ASTPCNodeVisitorTest);
  51148. $core.addMethod(
  51149. $core.method({
  51150. selector: "testJSStatementNode",
  51151. protocol: "tests",
  51152. fn: function (){
  51153. var self=this,$self=this;
  51154. var ast,visitor;
  51155. return $core.withContext(function($ctx1) {
  51156. var $3,$2,$1;
  51157. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  51158. $3=$self._astPCNodeVisitor();
  51159. $recv($3)._visit_(ast);
  51160. $2=$recv($3)._currentNode();
  51161. $1=$recv($2)._isJSStatementNode();
  51162. $self._assert_($1);
  51163. return self;
  51164. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor})});
  51165. },
  51166. args: [],
  51167. 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",
  51168. referencedClasses: ["Object"],
  51169. pragmas: [],
  51170. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  51171. }),
  51172. $globals.ASTPCNodeVisitorTest);
  51173. $core.addMethod(
  51174. $core.method({
  51175. selector: "testMessageSend",
  51176. protocol: "tests",
  51177. fn: function (){
  51178. var self=this,$self=this;
  51179. var ast;
  51180. return $core.withContext(function($ctx1) {
  51181. var $3,$2,$1;
  51182. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  51183. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51184. $recv($3)._visit_(ast);
  51185. $2=$recv($3)._currentNode();
  51186. $1=$recv($2)._selector();
  51187. $self._assert_equals_($1,"yourself");
  51188. return self;
  51189. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
  51190. },
  51191. args: [],
  51192. 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'",
  51193. referencedClasses: ["Object"],
  51194. pragmas: [],
  51195. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51196. }),
  51197. $globals.ASTPCNodeVisitorTest);
  51198. $core.addMethod(
  51199. $core.method({
  51200. selector: "testMessageSendWithBlocks",
  51201. protocol: "tests",
  51202. fn: function (){
  51203. var self=this,$self=this;
  51204. var ast;
  51205. return $core.withContext(function($ctx1) {
  51206. var $3,$2,$1;
  51207. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  51208. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51209. $recv($3)._visit_(ast);
  51210. $2=$recv($3)._currentNode();
  51211. $1=$recv($2)._selector();
  51212. $self._assert_equals_($1,"yourself");
  51213. return self;
  51214. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
  51215. },
  51216. args: [],
  51217. 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'",
  51218. referencedClasses: ["Object"],
  51219. pragmas: [],
  51220. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51221. }),
  51222. $globals.ASTPCNodeVisitorTest);
  51223. $core.addMethod(
  51224. $core.method({
  51225. selector: "testMessageSendWithInlining",
  51226. protocol: "tests",
  51227. fn: function (){
  51228. var self=this,$self=this;
  51229. var ast;
  51230. return $core.withContext(function($ctx1) {
  51231. var $3,$4,$2,$1,$7,$6,$5;
  51232. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  51233. $ctx1.sendIdx["parse:forClass:"]=1;
  51234. $3=$self._astPCNodeVisitorForSelector_("yourself");
  51235. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  51236. $recv($3)._visit_(ast);
  51237. $ctx1.sendIdx["visit:"]=1;
  51238. $4=$recv($3)._currentNode();
  51239. $ctx1.sendIdx["currentNode"]=1;
  51240. $2=$4;
  51241. $1=$recv($2)._selector();
  51242. $ctx1.sendIdx["selector"]=1;
  51243. $self._assert_equals_($1,"yourself");
  51244. $ctx1.sendIdx["assert:equals:"]=1;
  51245. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  51246. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  51247. $recv($7)._visit_(ast);
  51248. $6=$recv($7)._currentNode();
  51249. $5=$recv($6)._selector();
  51250. $self._assert_equals_($5,"asBoolean");
  51251. return self;
  51252. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast})});
  51253. },
  51254. args: [],
  51255. 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'",
  51256. referencedClasses: ["Object"],
  51257. pragmas: [],
  51258. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  51259. }),
  51260. $globals.ASTPCNodeVisitorTest);
  51261. $core.addMethod(
  51262. $core.method({
  51263. selector: "testNoMessageSend",
  51264. protocol: "tests",
  51265. fn: function (){
  51266. var self=this,$self=this;
  51267. var ast;
  51268. return $core.withContext(function($ctx1) {
  51269. var $3,$2,$1;
  51270. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  51271. $3=$self._astPCNodeVisitor();
  51272. $recv($3)._visit_(ast);
  51273. $2=$recv($3)._currentNode();
  51274. $1=$recv($2)._isNil();
  51275. $self._assert_($1);
  51276. return self;
  51277. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast})});
  51278. },
  51279. args: [],
  51280. 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",
  51281. referencedClasses: ["Object"],
  51282. pragmas: [],
  51283. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  51284. }),
  51285. $globals.ASTPCNodeVisitorTest);
  51286. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  51287. $core.addMethod(
  51288. $core.method({
  51289. selector: "testNodeAtPosition",
  51290. protocol: "tests",
  51291. fn: function (){
  51292. var self=this,$self=this;
  51293. var node;
  51294. return $core.withContext(function($ctx1) {
  51295. var $3,$4,$2,$1,$7,$8,$6,$5;
  51296. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  51297. $ctx1.sendIdx["parse:forClass:"]=1;
  51298. $3=node;
  51299. $4=(2).__at((4));
  51300. $ctx1.sendIdx["@"]=1;
  51301. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  51302. return nil;
  51303. }));
  51304. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  51305. $1=$recv($2)._source();
  51306. $self._assert_equals_($1,"self");
  51307. $ctx1.sendIdx["assert:equals:"]=1;
  51308. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  51309. $ctx1.sendIdx["parse:forClass:"]=2;
  51310. $7=node;
  51311. $8=(2).__at((7));
  51312. $ctx1.sendIdx["@"]=2;
  51313. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  51314. return nil;
  51315. }));
  51316. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  51317. $5=$recv($6)._selector();
  51318. $ctx1.sendIdx["selector"]=1;
  51319. $self._assert_equals_($5,"ifTrue:");
  51320. $ctx1.sendIdx["assert:equals:"]=2;
  51321. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  51322. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  51323. return nil;
  51324. })))._selector(),"foo");
  51325. return self;
  51326. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node})});
  51327. },
  51328. args: [],
  51329. 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'",
  51330. referencedClasses: ["Object"],
  51331. pragmas: [],
  51332. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  51333. }),
  51334. $globals.ASTPositionTest);
  51335. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  51336. $core.addMethod(
  51337. $core.method({
  51338. selector: "codeGeneratorClass",
  51339. protocol: "accessing",
  51340. fn: function (){
  51341. var self=this,$self=this;
  51342. return $globals.CodeGenerator;
  51343. },
  51344. args: [],
  51345. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  51346. referencedClasses: ["CodeGenerator"],
  51347. pragmas: [],
  51348. messageSends: []
  51349. }),
  51350. $globals.CodeGeneratorTest);
  51351. $core.addMethod(
  51352. $core.method({
  51353. selector: "compiler",
  51354. protocol: "factory",
  51355. fn: function (){
  51356. var self=this,$self=this;
  51357. return $core.withContext(function($ctx1) {
  51358. var $1;
  51359. $1=$recv($globals.Compiler)._new();
  51360. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  51361. return $recv($1)._yourself();
  51362. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  51363. },
  51364. args: [],
  51365. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  51366. referencedClasses: ["Compiler"],
  51367. pragmas: [],
  51368. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  51369. }),
  51370. $globals.CodeGeneratorTest);
  51371. $core.addMethod(
  51372. $core.method({
  51373. selector: "setUp",
  51374. protocol: "initialization",
  51375. fn: function (){
  51376. var self=this,$self=this;
  51377. return $core.withContext(function($ctx1) {
  51378. $self.receiver=$recv($globals.DoIt)._new();
  51379. return self;
  51380. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  51381. },
  51382. args: [],
  51383. source: "setUp\x0a\x09receiver := DoIt new",
  51384. referencedClasses: ["DoIt"],
  51385. pragmas: [],
  51386. messageSends: ["new"]
  51387. }),
  51388. $globals.CodeGeneratorTest);
  51389. $core.addMethod(
  51390. $core.method({
  51391. selector: "should:class:receiver:return:",
  51392. protocol: "testing",
  51393. fn: function (aString,aClass,anObject,aResult){
  51394. var self=this,$self=this;
  51395. var method,result;
  51396. return $core.withContext(function($ctx1) {
  51397. $self.receiver=anObject;
  51398. method=$recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  51399. result=$recv($self.receiver)._perform_($recv(method)._selector());
  51400. $recv(aClass)._removeCompiledMethod_(method);
  51401. $self._assert_equals_(aResult,result);
  51402. return self;
  51403. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult,method:method,result:result})});
  51404. },
  51405. args: ["aString", "aClass", "anObject", "aResult"],
  51406. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: aClass protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09aClass removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  51407. referencedClasses: [],
  51408. pragmas: [],
  51409. messageSends: ["install:forClass:protocol:", "compiler", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  51410. }),
  51411. $globals.CodeGeneratorTest);
  51412. $core.addMethod(
  51413. $core.method({
  51414. selector: "should:receiver:raise:",
  51415. protocol: "testing",
  51416. fn: function (aString,anObject,anErrorClass){
  51417. var self=this,$self=this;
  51418. var method,result;
  51419. return $core.withContext(function($ctx1) {
  51420. var $1,$2,$3,$receiver;
  51421. $self.receiver=anObject;
  51422. $recv((function(){
  51423. return $core.withContext(function($ctx2) {
  51424. return $self._should_raise_((function(){
  51425. return $core.withContext(function($ctx3) {
  51426. $1=$self._compiler();
  51427. $2=$recv(anObject)._class();
  51428. $ctx3.sendIdx["class"]=1;
  51429. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  51430. return $recv($self.receiver)._perform_($recv(method)._selector());
  51431. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51432. }),anErrorClass);
  51433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51434. }))._ensure_((function(){
  51435. return $core.withContext(function($ctx2) {
  51436. $3=method;
  51437. if(($receiver = $3) == null || $receiver.a$nil){
  51438. return $3;
  51439. } else {
  51440. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  51441. }
  51442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51443. }));
  51444. return self;
  51445. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result})});
  51446. },
  51447. args: ["aString", "anObject", "anErrorClass"],
  51448. 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 ] ]",
  51449. referencedClasses: [],
  51450. pragmas: [],
  51451. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  51452. }),
  51453. $globals.CodeGeneratorTest);
  51454. $core.addMethod(
  51455. $core.method({
  51456. selector: "should:receiver:return:",
  51457. protocol: "testing",
  51458. fn: function (aString,anObject,aResult){
  51459. var self=this,$self=this;
  51460. return $core.withContext(function($ctx1) {
  51461. return $self._should_class_receiver_return_(aString,$recv(anObject)._class(),anObject,aResult);
  51462. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult})});
  51463. },
  51464. args: ["aString", "anObject", "aResult"],
  51465. source: "should: aString receiver: anObject return: aResult\x0a\x09^ self should: aString class: anObject class receiver: anObject return: aResult",
  51466. referencedClasses: [],
  51467. pragmas: [],
  51468. messageSends: ["should:class:receiver:return:", "class"]
  51469. }),
  51470. $globals.CodeGeneratorTest);
  51471. $core.addMethod(
  51472. $core.method({
  51473. selector: "should:return:",
  51474. protocol: "testing",
  51475. fn: function (aString,anObject){
  51476. var self=this,$self=this;
  51477. return $core.withContext(function($ctx1) {
  51478. return $self._should_receiver_return_(aString,$self.receiver,anObject);
  51479. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject})});
  51480. },
  51481. args: ["aString", "anObject"],
  51482. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  51483. referencedClasses: [],
  51484. pragmas: [],
  51485. messageSends: ["should:receiver:return:"]
  51486. }),
  51487. $globals.CodeGeneratorTest);
  51488. $core.addMethod(
  51489. $core.method({
  51490. selector: "tearDown",
  51491. protocol: "initialization",
  51492. fn: function (){
  51493. var self=this,$self=this;
  51494. return self;
  51495. },
  51496. args: [],
  51497. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  51498. referencedClasses: [],
  51499. pragmas: [],
  51500. messageSends: []
  51501. }),
  51502. $globals.CodeGeneratorTest);
  51503. $core.addMethod(
  51504. $core.method({
  51505. selector: "testAssignment",
  51506. protocol: "tests",
  51507. fn: function (){
  51508. var self=this,$self=this;
  51509. return $core.withContext(function($ctx1) {
  51510. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  51511. $ctx1.sendIdx["should:return:"]=1;
  51512. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  51513. $ctx1.sendIdx["should:return:"]=2;
  51514. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  51515. return self;
  51516. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{})});
  51517. },
  51518. args: [],
  51519. 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",
  51520. referencedClasses: [],
  51521. pragmas: [],
  51522. messageSends: ["should:return:"]
  51523. }),
  51524. $globals.CodeGeneratorTest);
  51525. $core.addMethod(
  51526. $core.method({
  51527. selector: "testBackslashSelectors",
  51528. protocol: "tests",
  51529. fn: function (){
  51530. var self=this,$self=this;
  51531. return $core.withContext(function($ctx1) {
  51532. $self._should_return_("\x5c arg ^ 4",(4));
  51533. $ctx1.sendIdx["should:return:"]=1;
  51534. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  51535. return self;
  51536. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{})});
  51537. },
  51538. args: [],
  51539. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  51540. referencedClasses: [],
  51541. pragmas: [],
  51542. messageSends: ["should:return:"]
  51543. }),
  51544. $globals.CodeGeneratorTest);
  51545. $core.addMethod(
  51546. $core.method({
  51547. selector: "testBlockReturn",
  51548. protocol: "tests",
  51549. fn: function (){
  51550. var self=this,$self=this;
  51551. return $core.withContext(function($ctx1) {
  51552. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  51553. $ctx1.sendIdx["should:return:"]=1;
  51554. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  51555. $ctx1.sendIdx["should:return:"]=2;
  51556. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  51557. return self;
  51558. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{})});
  51559. },
  51560. args: [],
  51561. 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).",
  51562. referencedClasses: [],
  51563. pragmas: [],
  51564. messageSends: ["should:return:"]
  51565. }),
  51566. $globals.CodeGeneratorTest);
  51567. $core.addMethod(
  51568. $core.method({
  51569. selector: "testCascades",
  51570. protocol: "tests",
  51571. fn: function (){
  51572. var self=this,$self=this;
  51573. return $core.withContext(function($ctx1) {
  51574. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  51575. return self;
  51576. }, function($ctx1) {$ctx1.fill(self,"testCascades",{})});
  51577. },
  51578. args: [],
  51579. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  51580. referencedClasses: [],
  51581. pragmas: [],
  51582. messageSends: ["should:return:"]
  51583. }),
  51584. $globals.CodeGeneratorTest);
  51585. $core.addMethod(
  51586. $core.method({
  51587. selector: "testCascadesInDynamicArray",
  51588. protocol: "tests",
  51589. fn: function (){
  51590. var self=this,$self=this;
  51591. return $core.withContext(function($ctx1) {
  51592. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  51593. return self;
  51594. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{})});
  51595. },
  51596. args: [],
  51597. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  51598. referencedClasses: [],
  51599. pragmas: [],
  51600. messageSends: ["should:return:"]
  51601. }),
  51602. $globals.CodeGeneratorTest);
  51603. $core.addMethod(
  51604. $core.method({
  51605. selector: "testCascadesInDynamicDictioary",
  51606. protocol: "tests",
  51607. fn: function (){
  51608. var self=this,$self=this;
  51609. return $core.withContext(function($ctx1) {
  51610. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  51611. return self;
  51612. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{})});
  51613. },
  51614. args: [],
  51615. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  51616. referencedClasses: [],
  51617. pragmas: [],
  51618. messageSends: ["should:return:"]
  51619. }),
  51620. $globals.CodeGeneratorTest);
  51621. $core.addMethod(
  51622. $core.method({
  51623. selector: "testCascadesInSend",
  51624. protocol: "tests",
  51625. fn: function (){
  51626. var self=this,$self=this;
  51627. return $core.withContext(function($ctx1) {
  51628. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  51629. return self;
  51630. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{})});
  51631. },
  51632. args: [],
  51633. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  51634. referencedClasses: [],
  51635. pragmas: [],
  51636. messageSends: ["should:return:"]
  51637. }),
  51638. $globals.CodeGeneratorTest);
  51639. $core.addMethod(
  51640. $core.method({
  51641. selector: "testCascadesWithInlining",
  51642. protocol: "tests",
  51643. fn: function (){
  51644. var self=this,$self=this;
  51645. return $core.withContext(function($ctx1) {
  51646. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  51647. $ctx1.sendIdx["should:return:"]=1;
  51648. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  51649. return self;
  51650. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{})});
  51651. },
  51652. args: [],
  51653. 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",
  51654. referencedClasses: [],
  51655. pragmas: [],
  51656. messageSends: ["should:return:"]
  51657. }),
  51658. $globals.CodeGeneratorTest);
  51659. $core.addMethod(
  51660. $core.method({
  51661. selector: "testDynamicArrayElementsOrdered",
  51662. protocol: "tests",
  51663. fn: function (){
  51664. var self=this,$self=this;
  51665. return $core.withContext(function($ctx1) {
  51666. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  51667. $ctx1.sendIdx["should:return:"]=1;
  51668. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  51669. return self;
  51670. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{})});
  51671. },
  51672. args: [],
  51673. 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).",
  51674. referencedClasses: [],
  51675. pragmas: [],
  51676. messageSends: ["should:return:"]
  51677. }),
  51678. $globals.CodeGeneratorTest);
  51679. $core.addMethod(
  51680. $core.method({
  51681. selector: "testDynamicDictionaryElementsOrdered",
  51682. protocol: "tests",
  51683. fn: function (){
  51684. var self=this,$self=this;
  51685. return $core.withContext(function($ctx1) {
  51686. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  51687. return self;
  51688. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{})});
  51689. },
  51690. args: [],
  51691. 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}.",
  51692. referencedClasses: [],
  51693. pragmas: [],
  51694. messageSends: ["should:return:"]
  51695. }),
  51696. $globals.CodeGeneratorTest);
  51697. $core.addMethod(
  51698. $core.method({
  51699. selector: "testDynamicDictionaryWithMoreArrows",
  51700. protocol: "tests",
  51701. fn: function (){
  51702. var self=this,$self=this;
  51703. return $core.withContext(function($ctx1) {
  51704. var $2,$1;
  51705. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  51706. $ctx1.sendIdx["->"]=1;
  51707. $1=$recv($globals.HashedCollection)._with_($2);
  51708. $self._should_return_("foo ^ #{1->2->3}",$1);
  51709. return self;
  51710. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{})});
  51711. },
  51712. args: [],
  51713. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  51714. referencedClasses: ["HashedCollection"],
  51715. pragmas: [],
  51716. messageSends: ["should:return:", "with:", "->"]
  51717. }),
  51718. $globals.CodeGeneratorTest);
  51719. $core.addMethod(
  51720. $core.method({
  51721. selector: "testGlobalVar",
  51722. protocol: "tests",
  51723. fn: function (){
  51724. var self=this,$self=this;
  51725. return $core.withContext(function($ctx1) {
  51726. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  51727. $ctx1.sendIdx["should:return:"]=1;
  51728. $self._should_return_("foo ^ Math cos: 0",(1));
  51729. $ctx1.sendIdx["should:return:"]=2;
  51730. $self._should_return_("foo ^ NonExistingVar",nil);
  51731. return self;
  51732. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{})});
  51733. },
  51734. args: [],
  51735. 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",
  51736. referencedClasses: ["BlockClosure"],
  51737. pragmas: [],
  51738. messageSends: ["should:return:"]
  51739. }),
  51740. $globals.CodeGeneratorTest);
  51741. $core.addMethod(
  51742. $core.method({
  51743. selector: "testInnerTemporalDependentElementsOrdered",
  51744. protocol: "tests",
  51745. fn: function (){
  51746. var self=this,$self=this;
  51747. return $core.withContext(function($ctx1) {
  51748. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  51749. $2="foo".__minus_gt($globals.Array);
  51750. $ctx1.sendIdx["->"]=1;
  51751. $3="bar".__minus_gt((2));
  51752. $ctx1.sendIdx["->"]=2;
  51753. $1=[$2,$3];
  51754. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  51755. $ctx1.sendIdx["should:return:"]=1;
  51756. $5="foo".__minus_gt($globals.Array);
  51757. $ctx1.sendIdx["->"]=3;
  51758. $6="bar".__minus_gt((2));
  51759. $ctx1.sendIdx["->"]=4;
  51760. $4=[$5,$6];
  51761. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  51762. $ctx1.sendIdx["should:return:"]=2;
  51763. $8="foo".__minus_gt((1));
  51764. $ctx1.sendIdx["->"]=5;
  51765. $9="bar".__minus_gt((2));
  51766. $ctx1.sendIdx["->"]=6;
  51767. $7=[$8,$9];
  51768. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  51769. $ctx1.sendIdx["should:return:"]=3;
  51770. $11="foo".__minus_gt((1));
  51771. $ctx1.sendIdx["->"]=7;
  51772. $10=[$11,"bar".__minus_gt((2))];
  51773. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  51774. $ctx1.sendIdx["should:return:"]=4;
  51775. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  51776. return self;
  51777. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{})});
  51778. },
  51779. args: [],
  51780. 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}.",
  51781. referencedClasses: ["Array"],
  51782. pragmas: [],
  51783. messageSends: ["should:return:", "->"]
  51784. }),
  51785. $globals.CodeGeneratorTest);
  51786. $core.addMethod(
  51787. $core.method({
  51788. selector: "testLexicalScope",
  51789. protocol: "tests",
  51790. fn: function (){
  51791. var self=this,$self=this;
  51792. return $core.withContext(function($ctx1) {
  51793. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  51794. return self;
  51795. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{})});
  51796. },
  51797. args: [],
  51798. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  51799. referencedClasses: [],
  51800. pragmas: [],
  51801. messageSends: ["should:return:"]
  51802. }),
  51803. $globals.CodeGeneratorTest);
  51804. $core.addMethod(
  51805. $core.method({
  51806. selector: "testLiterals",
  51807. protocol: "tests",
  51808. fn: function (){
  51809. var self=this,$self=this;
  51810. return $core.withContext(function($ctx1) {
  51811. $self._should_return_("foo ^ 1",(1));
  51812. $ctx1.sendIdx["should:return:"]=1;
  51813. $self._should_return_("foo ^ 'hello'","hello");
  51814. $ctx1.sendIdx["should:return:"]=2;
  51815. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  51816. $ctx1.sendIdx["should:return:"]=3;
  51817. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  51818. $ctx1.sendIdx["should:return:"]=4;
  51819. $self._should_return_("foo ^ true",true);
  51820. $ctx1.sendIdx["should:return:"]=5;
  51821. $self._should_return_("foo ^ false",false);
  51822. $ctx1.sendIdx["should:return:"]=6;
  51823. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  51824. $ctx1.sendIdx["should:return:"]=7;
  51825. $self._should_return_("foo ^ #hello","hello");
  51826. $ctx1.sendIdx["should:return:"]=8;
  51827. $self._should_return_("foo ^ $h","h");
  51828. $ctx1.sendIdx["should:return:"]=9;
  51829. $self._should_return_("foo ^ -123.456",(-123.456));
  51830. $ctx1.sendIdx["should:return:"]=10;
  51831. $self._should_return_("foo ^ -2.5e4",(-25000));
  51832. return self;
  51833. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{})});
  51834. },
  51835. args: [],
  51836. 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.",
  51837. referencedClasses: [],
  51838. pragmas: [],
  51839. messageSends: ["should:return:"]
  51840. }),
  51841. $globals.CodeGeneratorTest);
  51842. $core.addMethod(
  51843. $core.method({
  51844. selector: "testLocalReturn",
  51845. protocol: "tests",
  51846. fn: function (){
  51847. var self=this,$self=this;
  51848. return $core.withContext(function($ctx1) {
  51849. $self._should_return_("foo ^ 1",(1));
  51850. $ctx1.sendIdx["should:return:"]=1;
  51851. $self._should_return_("foo ^ 1 + 1",(2));
  51852. $ctx1.sendIdx["should:return:"]=2;
  51853. $self._should_return_("foo ",$self.receiver);
  51854. $ctx1.sendIdx["should:return:"]=3;
  51855. $self._should_return_("foo self asString",$self.receiver);
  51856. $ctx1.sendIdx["should:return:"]=4;
  51857. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  51858. return self;
  51859. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{})});
  51860. },
  51861. args: [],
  51862. 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",
  51863. referencedClasses: [],
  51864. pragmas: [],
  51865. messageSends: ["should:return:"]
  51866. }),
  51867. $globals.CodeGeneratorTest);
  51868. $core.addMethod(
  51869. $core.method({
  51870. selector: "testMessageSends",
  51871. protocol: "tests",
  51872. fn: function (){
  51873. var self=this,$self=this;
  51874. return $core.withContext(function($ctx1) {
  51875. $self._should_return_("foo ^ 1 asString","1");
  51876. $ctx1.sendIdx["should:return:"]=1;
  51877. $self._should_return_("foo ^ 1 + 1",(2));
  51878. $ctx1.sendIdx["should:return:"]=2;
  51879. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  51880. $ctx1.sendIdx["should:return:"]=3;
  51881. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  51882. $ctx1.sendIdx["should:return:"]=4;
  51883. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  51884. return self;
  51885. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{})});
  51886. },
  51887. args: [],
  51888. 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)",
  51889. referencedClasses: [],
  51890. pragmas: [],
  51891. messageSends: ["should:return:"]
  51892. }),
  51893. $globals.CodeGeneratorTest);
  51894. $core.addMethod(
  51895. $core.method({
  51896. selector: "testMistypedPragmaJSStatement",
  51897. protocol: "tests",
  51898. fn: function (){
  51899. var self=this,$self=this;
  51900. return $core.withContext(function($ctx1) {
  51901. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self.receiver,$globals.ParseError);
  51902. return self;
  51903. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{})});
  51904. },
  51905. args: [],
  51906. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  51907. referencedClasses: ["ParseError"],
  51908. pragmas: [],
  51909. messageSends: ["should:receiver:raise:"]
  51910. }),
  51911. $globals.CodeGeneratorTest);
  51912. $core.addMethod(
  51913. $core.method({
  51914. selector: "testMultipleSequences",
  51915. protocol: "tests",
  51916. fn: function (){
  51917. var self=this,$self=this;
  51918. return $core.withContext(function($ctx1) {
  51919. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  51920. return self;
  51921. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{})});
  51922. },
  51923. args: [],
  51924. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  51925. referencedClasses: [],
  51926. pragmas: [],
  51927. messageSends: ["should:return:"]
  51928. }),
  51929. $globals.CodeGeneratorTest);
  51930. $core.addMethod(
  51931. $core.method({
  51932. selector: "testMutableLiterals",
  51933. protocol: "tests",
  51934. fn: function (){
  51935. var self=this,$self=this;
  51936. return $core.withContext(function($ctx1) {
  51937. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  51938. return self;
  51939. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{})});
  51940. },
  51941. args: [],
  51942. 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)",
  51943. referencedClasses: [],
  51944. pragmas: [],
  51945. messageSends: ["should:return:"]
  51946. }),
  51947. $globals.CodeGeneratorTest);
  51948. $core.addMethod(
  51949. $core.method({
  51950. selector: "testNestedIfTrue",
  51951. protocol: "tests",
  51952. fn: function (){
  51953. var self=this,$self=this;
  51954. return $core.withContext(function($ctx1) {
  51955. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  51956. $ctx1.sendIdx["should:return:"]=1;
  51957. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  51958. $ctx1.sendIdx["should:return:"]=2;
  51959. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  51960. $ctx1.sendIdx["should:return:"]=3;
  51961. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self.receiver);
  51962. return self;
  51963. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{})});
  51964. },
  51965. args: [],
  51966. 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.",
  51967. referencedClasses: [],
  51968. pragmas: [],
  51969. messageSends: ["should:return:"]
  51970. }),
  51971. $globals.CodeGeneratorTest);
  51972. $core.addMethod(
  51973. $core.method({
  51974. selector: "testNestedSends",
  51975. protocol: "tests",
  51976. fn: function (){
  51977. var self=this,$self=this;
  51978. return $core.withContext(function($ctx1) {
  51979. $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());
  51980. return self;
  51981. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{})});
  51982. },
  51983. args: [],
  51984. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  51985. referencedClasses: ["Point"],
  51986. pragmas: [],
  51987. messageSends: ["should:return:", "asString", "x:y:", "@"]
  51988. }),
  51989. $globals.CodeGeneratorTest);
  51990. $core.addMethod(
  51991. $core.method({
  51992. selector: "testNonLocalReturn",
  51993. protocol: "tests",
  51994. fn: function (){
  51995. var self=this,$self=this;
  51996. return $core.withContext(function($ctx1) {
  51997. $self._should_return_("foo [ ^ 1 ] value",(1));
  51998. $ctx1.sendIdx["should:return:"]=1;
  51999. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  52000. $ctx1.sendIdx["should:return:"]=2;
  52001. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  52002. $ctx1.sendIdx["should:return:"]=3;
  52003. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  52004. return self;
  52005. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{})});
  52006. },
  52007. args: [],
  52008. 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",
  52009. referencedClasses: [],
  52010. pragmas: [],
  52011. messageSends: ["should:return:"]
  52012. }),
  52013. $globals.CodeGeneratorTest);
  52014. $core.addMethod(
  52015. $core.method({
  52016. selector: "testPascalCaseGlobal",
  52017. protocol: "tests",
  52018. fn: function (){
  52019. var self=this,$self=this;
  52020. return $core.withContext(function($ctx1) {
  52021. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  52022. $ctx1.sendIdx["should:return:"]=1;
  52023. $self._should_return_("foo ^NonExistent",nil);
  52024. return self;
  52025. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{})});
  52026. },
  52027. args: [],
  52028. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  52029. referencedClasses: ["Smalltalk"],
  52030. pragmas: [],
  52031. messageSends: ["should:return:", "at:", "globals"]
  52032. }),
  52033. $globals.CodeGeneratorTest);
  52034. $core.addMethod(
  52035. $core.method({
  52036. selector: "testPragmaInBlock",
  52037. protocol: "tests",
  52038. fn: function (){
  52039. var self=this,$self=this;
  52040. return $core.withContext(function($ctx1) {
  52041. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self.receiver,$globals.ParseError);
  52042. return self;
  52043. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{})});
  52044. },
  52045. args: [],
  52046. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: ParseError",
  52047. referencedClasses: ["ParseError"],
  52048. pragmas: [],
  52049. messageSends: ["should:receiver:raise:"]
  52050. }),
  52051. $globals.CodeGeneratorTest);
  52052. $core.addMethod(
  52053. $core.method({
  52054. selector: "testPragmaJSStatement",
  52055. protocol: "tests",
  52056. fn: function (){
  52057. var self=this,$self=this;
  52058. return $core.withContext(function($ctx1) {
  52059. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  52060. return self;
  52061. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{})});
  52062. },
  52063. args: [],
  52064. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  52065. referencedClasses: [],
  52066. pragmas: [],
  52067. messageSends: ["should:return:"]
  52068. }),
  52069. $globals.CodeGeneratorTest);
  52070. $core.addMethod(
  52071. $core.method({
  52072. selector: "testRootSuperSend",
  52073. protocol: "tests",
  52074. fn: function (){
  52075. var self=this,$self=this;
  52076. return $core.withContext(function($ctx1) {
  52077. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  52078. return self;
  52079. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{})});
  52080. },
  52081. args: [],
  52082. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  52083. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  52084. pragmas: [],
  52085. messageSends: ["should:receiver:raise:", "new"]
  52086. }),
  52087. $globals.CodeGeneratorTest);
  52088. $core.addMethod(
  52089. $core.method({
  52090. selector: "testSendReceiverAndArgumentsOrdered",
  52091. protocol: "tests",
  52092. fn: function (){
  52093. var self=this,$self=this;
  52094. return $core.withContext(function($ctx1) {
  52095. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  52096. $ctx1.sendIdx["should:return:"]=1;
  52097. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  52098. return self;
  52099. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{})});
  52100. },
  52101. args: [],
  52102. 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}.",
  52103. referencedClasses: ["Array"],
  52104. pragmas: [],
  52105. messageSends: ["should:return:"]
  52106. }),
  52107. $globals.CodeGeneratorTest);
  52108. $core.addMethod(
  52109. $core.method({
  52110. selector: "testSuperSend",
  52111. protocol: "tests",
  52112. fn: function (){
  52113. var self=this,$self=this;
  52114. return $core.withContext(function($ctx1) {
  52115. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  52116. return self;
  52117. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{})});
  52118. },
  52119. args: [],
  52120. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  52121. referencedClasses: [],
  52122. pragmas: [],
  52123. messageSends: ["should:receiver:return:"]
  52124. }),
  52125. $globals.CodeGeneratorTest);
  52126. $core.addMethod(
  52127. $core.method({
  52128. selector: "testSuperSend2",
  52129. protocol: "tests",
  52130. fn: function (){
  52131. var self=this,$self=this;
  52132. return $core.withContext(function($ctx1) {
  52133. $self._should_receiver_return_("foo ^ super isNil",nil,false);
  52134. return self;
  52135. }, function($ctx1) {$ctx1.fill(self,"testSuperSend2",{})});
  52136. },
  52137. args: [],
  52138. source: "testSuperSend2\x0a\x09self \x0a\x09\x09should: 'foo ^ super isNil'\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  52139. referencedClasses: [],
  52140. pragmas: [],
  52141. messageSends: ["should:receiver:return:"]
  52142. }),
  52143. $globals.CodeGeneratorTest);
  52144. $core.addMethod(
  52145. $core.method({
  52146. selector: "testSuperSend3",
  52147. protocol: "tests",
  52148. fn: function (){
  52149. var self=this,$self=this;
  52150. return $core.withContext(function($ctx1) {
  52151. $self._should_class_receiver_return_("doo ^ super isNil",$globals.Object,nil,false);
  52152. return self;
  52153. }, function($ctx1) {$ctx1.fill(self,"testSuperSend3",{})});
  52154. },
  52155. args: [],
  52156. source: "testSuperSend3\x0a\x09self \x0a\x09\x09should: 'doo ^ super isNil'\x0a\x09\x09class: Object\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  52157. referencedClasses: ["Object"],
  52158. pragmas: [],
  52159. messageSends: ["should:class:receiver:return:"]
  52160. }),
  52161. $globals.CodeGeneratorTest);
  52162. $core.addMethod(
  52163. $core.method({
  52164. selector: "testSuperSend4",
  52165. protocol: "tests",
  52166. fn: function (){
  52167. var self=this,$self=this;
  52168. return $core.withContext(function($ctx1) {
  52169. $self._should_receiver_return_("foo ^ super asJavaScriptObject","me",["m", "e"]);
  52170. return self;
  52171. }, function($ctx1) {$ctx1.fill(self,"testSuperSend4",{})});
  52172. },
  52173. args: [],
  52174. source: "testSuperSend4\x0a\x09self \x0a\x09\x09should: 'foo ^ super asJavaScriptObject'\x0a\x09\x09receiver: 'me'\x0a\x09\x09return: #('m' 'e')",
  52175. referencedClasses: [],
  52176. pragmas: [],
  52177. messageSends: ["should:receiver:return:"]
  52178. }),
  52179. $globals.CodeGeneratorTest);
  52180. $core.addMethod(
  52181. $core.method({
  52182. selector: "testSuperSend5",
  52183. protocol: "tests",
  52184. fn: function (){
  52185. var self=this,$self=this;
  52186. return $core.withContext(function($ctx1) {
  52187. $self._should_class_receiver_return_("foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self",$globals.SequenceableCollection,[(1), (2), (3)],[(1), (2), (3), (5)]);
  52188. return self;
  52189. }, function($ctx1) {$ctx1.fill(self,"testSuperSend5",{})});
  52190. },
  52191. args: [],
  52192. source: "testSuperSend5\x0a\x09self \x0a\x09\x09should: 'foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self'\x0a\x09\x09class: SequenceableCollection\x0a\x09\x09receiver: #(1 2 3)\x0a\x09\x09return: #(1 2 3 5)",
  52193. referencedClasses: ["SequenceableCollection"],
  52194. pragmas: [],
  52195. messageSends: ["should:class:receiver:return:"]
  52196. }),
  52197. $globals.CodeGeneratorTest);
  52198. $core.addMethod(
  52199. $core.method({
  52200. selector: "testTempVariables",
  52201. protocol: "tests",
  52202. fn: function (){
  52203. var self=this,$self=this;
  52204. return $core.withContext(function($ctx1) {
  52205. $self._should_return_("foo | a | ^ a",nil);
  52206. $ctx1.sendIdx["should:return:"]=1;
  52207. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  52208. $ctx1.sendIdx["should:return:"]=2;
  52209. $self._should_return_("foo | a b c | ^ c",nil);
  52210. $ctx1.sendIdx["should:return:"]=3;
  52211. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  52212. $ctx1.sendIdx["should:return:"]=4;
  52213. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  52214. $ctx1.sendIdx["should:return:"]=5;
  52215. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  52216. return self;
  52217. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{})});
  52218. },
  52219. args: [],
  52220. 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.",
  52221. referencedClasses: [],
  52222. pragmas: [],
  52223. messageSends: ["should:return:"]
  52224. }),
  52225. $globals.CodeGeneratorTest);
  52226. $core.addMethod(
  52227. $core.method({
  52228. selector: "testThisContext",
  52229. protocol: "tests",
  52230. fn: function (){
  52231. var self=this,$self=this;
  52232. return $core.withContext(function($ctx1) {
  52233. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  52234. return self;
  52235. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{})});
  52236. },
  52237. args: [],
  52238. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  52239. referencedClasses: [],
  52240. pragmas: [],
  52241. messageSends: ["should:return:"]
  52242. }),
  52243. $globals.CodeGeneratorTest);
  52244. $core.addMethod(
  52245. $core.method({
  52246. selector: "testUnknownPragma",
  52247. protocol: "tests",
  52248. fn: function (){
  52249. var self=this,$self=this;
  52250. return $core.withContext(function($ctx1) {
  52251. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  52252. $ctx1.sendIdx["should:return:"]=1;
  52253. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  52254. return self;
  52255. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{})});
  52256. },
  52257. args: [],
  52258. 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",
  52259. referencedClasses: [],
  52260. pragmas: [],
  52261. messageSends: ["should:return:"]
  52262. }),
  52263. $globals.CodeGeneratorTest);
  52264. $core.addMethod(
  52265. $core.method({
  52266. selector: "testifFalse",
  52267. protocol: "tests",
  52268. fn: function (){
  52269. var self=this,$self=this;
  52270. return $core.withContext(function($ctx1) {
  52271. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self.receiver);
  52272. $ctx1.sendIdx["should:return:"]=1;
  52273. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  52274. $ctx1.sendIdx["should:return:"]=2;
  52275. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  52276. $ctx1.sendIdx["should:return:"]=3;
  52277. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  52278. return self;
  52279. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{})});
  52280. },
  52281. args: [],
  52282. 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.",
  52283. referencedClasses: [],
  52284. pragmas: [],
  52285. messageSends: ["should:return:"]
  52286. }),
  52287. $globals.CodeGeneratorTest);
  52288. $core.addMethod(
  52289. $core.method({
  52290. selector: "testifFalseIfTrue",
  52291. protocol: "tests",
  52292. fn: function (){
  52293. var self=this,$self=this;
  52294. return $core.withContext(function($ctx1) {
  52295. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  52296. $ctx1.sendIdx["should:return:"]=1;
  52297. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  52298. $ctx1.sendIdx["should:return:"]=2;
  52299. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  52300. $ctx1.sendIdx["should:return:"]=3;
  52301. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  52302. return self;
  52303. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{})});
  52304. },
  52305. args: [],
  52306. 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.",
  52307. referencedClasses: [],
  52308. pragmas: [],
  52309. messageSends: ["should:return:"]
  52310. }),
  52311. $globals.CodeGeneratorTest);
  52312. $core.addMethod(
  52313. $core.method({
  52314. selector: "testifNil",
  52315. protocol: "tests",
  52316. fn: function (){
  52317. var self=this,$self=this;
  52318. return $core.withContext(function($ctx1) {
  52319. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  52320. $ctx1.sendIdx["should:return:"]=1;
  52321. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  52322. $ctx1.sendIdx["should:return:"]=2;
  52323. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self.receiver);
  52324. $ctx1.sendIdx["should:return:"]=3;
  52325. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  52326. return self;
  52327. }, function($ctx1) {$ctx1.fill(self,"testifNil",{})});
  52328. },
  52329. args: [],
  52330. 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.",
  52331. referencedClasses: [],
  52332. pragmas: [],
  52333. messageSends: ["should:return:"]
  52334. }),
  52335. $globals.CodeGeneratorTest);
  52336. $core.addMethod(
  52337. $core.method({
  52338. selector: "testifNilIfNotNil",
  52339. protocol: "tests",
  52340. fn: function (){
  52341. var self=this,$self=this;
  52342. return $core.withContext(function($ctx1) {
  52343. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  52344. $ctx1.sendIdx["should:return:"]=1;
  52345. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  52346. $ctx1.sendIdx["should:return:"]=2;
  52347. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  52348. $ctx1.sendIdx["should:return:"]=3;
  52349. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  52350. return self;
  52351. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{})});
  52352. },
  52353. args: [],
  52354. 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.",
  52355. referencedClasses: [],
  52356. pragmas: [],
  52357. messageSends: ["should:return:"]
  52358. }),
  52359. $globals.CodeGeneratorTest);
  52360. $core.addMethod(
  52361. $core.method({
  52362. selector: "testifNotNil",
  52363. protocol: "tests",
  52364. fn: function (){
  52365. var self=this,$self=this;
  52366. return $core.withContext(function($ctx1) {
  52367. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  52368. $ctx1.sendIdx["should:return:"]=1;
  52369. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  52370. $ctx1.sendIdx["should:return:"]=2;
  52371. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  52372. $ctx1.sendIdx["should:return:"]=3;
  52373. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self.receiver);
  52374. return self;
  52375. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{})});
  52376. },
  52377. args: [],
  52378. 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.",
  52379. referencedClasses: [],
  52380. pragmas: [],
  52381. messageSends: ["should:return:"]
  52382. }),
  52383. $globals.CodeGeneratorTest);
  52384. $core.addMethod(
  52385. $core.method({
  52386. selector: "testifNotNilWithArgument",
  52387. protocol: "tests",
  52388. fn: function (){
  52389. var self=this,$self=this;
  52390. return $core.withContext(function($ctx1) {
  52391. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  52392. $ctx1.sendIdx["should:return:"]=1;
  52393. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  52394. $ctx1.sendIdx["should:return:"]=2;
  52395. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  52396. $ctx1.sendIdx["should:return:"]=3;
  52397. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  52398. $ctx1.sendIdx["should:return:"]=4;
  52399. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  52400. $ctx1.sendIdx["should:return:"]=5;
  52401. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  52402. return self;
  52403. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{})});
  52404. },
  52405. args: [],
  52406. 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",
  52407. referencedClasses: [],
  52408. pragmas: [],
  52409. messageSends: ["should:return:"]
  52410. }),
  52411. $globals.CodeGeneratorTest);
  52412. $core.addMethod(
  52413. $core.method({
  52414. selector: "testifTrue",
  52415. protocol: "tests",
  52416. fn: function (){
  52417. var self=this,$self=this;
  52418. return $core.withContext(function($ctx1) {
  52419. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self.receiver);
  52420. $ctx1.sendIdx["should:return:"]=1;
  52421. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  52422. $ctx1.sendIdx["should:return:"]=2;
  52423. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  52424. $ctx1.sendIdx["should:return:"]=3;
  52425. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  52426. return self;
  52427. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{})});
  52428. },
  52429. args: [],
  52430. 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.",
  52431. referencedClasses: [],
  52432. pragmas: [],
  52433. messageSends: ["should:return:"]
  52434. }),
  52435. $globals.CodeGeneratorTest);
  52436. $core.addMethod(
  52437. $core.method({
  52438. selector: "testifTrueIfFalse",
  52439. protocol: "tests",
  52440. fn: function (){
  52441. var self=this,$self=this;
  52442. return $core.withContext(function($ctx1) {
  52443. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  52444. $ctx1.sendIdx["should:return:"]=1;
  52445. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  52446. $ctx1.sendIdx["should:return:"]=2;
  52447. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  52448. $ctx1.sendIdx["should:return:"]=3;
  52449. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  52450. return self;
  52451. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{})});
  52452. },
  52453. args: [],
  52454. 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.",
  52455. referencedClasses: [],
  52456. pragmas: [],
  52457. messageSends: ["should:return:"]
  52458. }),
  52459. $globals.CodeGeneratorTest);
  52460. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  52461. $core.addMethod(
  52462. $core.method({
  52463. selector: "interpret:forClass:receiver:withArguments:",
  52464. protocol: "private",
  52465. fn: function (aString,aClass,anObject,aDictionary){
  52466. var self=this,$self=this;
  52467. var ctx;
  52468. return $core.withContext(function($ctx1) {
  52469. var $1;
  52470. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  52471. $1=$recv(ctx)._interpreter();
  52472. $recv($1)._proceed();
  52473. return $recv($1)._result();
  52474. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  52475. },
  52476. args: ["aString", "aClass", "anObject", "aDictionary"],
  52477. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ ctx interpreter proceed; result",
  52478. referencedClasses: [],
  52479. pragmas: [],
  52480. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
  52481. }),
  52482. $globals.ASTInterpreterTest);
  52483. $core.addMethod(
  52484. $core.method({
  52485. selector: "prepareContextFor:class:receiver:withArguments:",
  52486. protocol: "private",
  52487. fn: function (aString,aClass,anObject,aDictionary){
  52488. var self=this,$self=this;
  52489. var ctx,ast;
  52490. return $core.withContext(function($ctx1) {
  52491. var $1,$2,$3,$receiver;
  52492. ast=$self._parse_forClass_(aString,aClass);
  52493. $1=$recv($globals.AIContext)._new();
  52494. $ctx1.sendIdx["new"]=1;
  52495. $recv($1)._receiver_(anObject);
  52496. $recv($1)._selector_($recv(ast)._selector());
  52497. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  52498. ctx=$recv($1)._yourself();
  52499. $2=$recv(ast)._sequenceNode();
  52500. if(($receiver = $2) == null || $receiver.a$nil){
  52501. $2;
  52502. } else {
  52503. var sequence;
  52504. sequence=$receiver;
  52505. $recv($recv(sequence)._temps())._do_((function(each){
  52506. return $core.withContext(function($ctx2) {
  52507. return $recv(ctx)._defineLocal_(each);
  52508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52509. }));
  52510. }
  52511. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  52512. return $core.withContext(function($ctx2) {
  52513. return $recv(ctx)._localAt_put_(key,value);
  52514. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  52515. }));
  52516. $3=$recv(ctx)._interpreter();
  52517. $recv($3)._context_(ctx);
  52518. $recv($3)._node_(ast);
  52519. $recv($3)._enterNode();
  52520. return ctx;
  52521. }, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast})});
  52522. },
  52523. args: ["aString", "aClass", "anObject", "aDictionary"],
  52524. source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast |\x0a\x09\x0a\x09ast := self parse: aString forClass: aClass.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09selector: ast selector;\x0a\x09\x09interpreter: ASTInterpreter new;\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\x09ctx interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode.\x0a\x09\x0a\x09^ctx",
  52525. referencedClasses: ["AIContext", "ASTInterpreter"],
  52526. pragmas: [],
  52527. messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
  52528. }),
  52529. $globals.ASTInterpreterTest);
  52530. $core.addMethod(
  52531. $core.method({
  52532. selector: "should:class:receiver:return:",
  52533. protocol: "testing",
  52534. fn: function (aString,aClass,anObject,aResult){
  52535. var self=this,$self=this;
  52536. var method,result;
  52537. return $core.withContext(function($ctx1) {
  52538. $self.receiver=anObject;
  52539. method=$recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  52540. result=$self._interpret_forClass_receiver_withArguments_(aString,aClass,$self.receiver,$globals.HashedCollection._newFromPairs_([]));
  52541. $recv(aClass)._removeCompiledMethod_(method);
  52542. $self._assert_equals_(aResult,result);
  52543. return self;
  52544. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult,method:method,result:result})});
  52545. },
  52546. args: ["aString", "aClass", "anObject", "aResult"],
  52547. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: aClass protocol: 'tests'.\x0a\x09result := self interpret: aString forClass: aClass receiver: receiver withArguments: #{}.\x0a\x09aClass removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  52548. referencedClasses: [],
  52549. pragmas: [],
  52550. messageSends: ["install:forClass:protocol:", "compiler", "interpret:forClass:receiver:withArguments:", "removeCompiledMethod:", "assert:equals:"]
  52551. }),
  52552. $globals.ASTInterpreterTest);
  52553. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  52554. $core.addMethod(
  52555. $core.method({
  52556. selector: "interpret:forClass:receiver:withArguments:",
  52557. protocol: "private",
  52558. fn: function (aString,aClass,anObject,aDictionary){
  52559. var self=this,$self=this;
  52560. var ctx;
  52561. return $core.withContext(function($ctx1) {
  52562. var $1;
  52563. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  52564. $1=$recv($globals.ASTDebugger)._context_(ctx);
  52565. $recv($1)._proceed();
  52566. return $recv($1)._result();
  52567. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  52568. },
  52569. args: ["aString", "aClass", "anObject", "aDictionary"],
  52570. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ (ASTDebugger context: ctx) proceed; result",
  52571. referencedClasses: ["ASTDebugger"],
  52572. pragmas: [],
  52573. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
  52574. }),
  52575. $globals.ASTDebuggerTest);
  52576. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  52577. $core.addMethod(
  52578. $core.method({
  52579. selector: "codeGeneratorClass",
  52580. protocol: "accessing",
  52581. fn: function (){
  52582. var self=this,$self=this;
  52583. return $globals.InliningCodeGenerator;
  52584. },
  52585. args: [],
  52586. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  52587. referencedClasses: ["InliningCodeGenerator"],
  52588. pragmas: [],
  52589. messageSends: []
  52590. }),
  52591. $globals.InliningCodeGeneratorTest);
  52592. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  52593. $core.addMethod(
  52594. $core.method({
  52595. selector: "testClassRefVar",
  52596. protocol: "tests",
  52597. fn: function (){
  52598. var self=this,$self=this;
  52599. var node;
  52600. return $core.withContext(function($ctx1) {
  52601. var $1,$2;
  52602. $1=$recv($globals.VariableNode)._new();
  52603. $ctx1.sendIdx["new"]=1;
  52604. $recv($1)._value_("Object");
  52605. node=$recv($1)._yourself();
  52606. $2=$recv($globals.SemanticAnalyzer)._new();
  52607. $ctx1.sendIdx["new"]=2;
  52608. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  52609. $recv($2)._visit_(node);
  52610. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  52611. return self;
  52612. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node})});
  52613. },
  52614. args: [],
  52615. 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",
  52616. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  52617. pragmas: [],
  52618. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  52619. }),
  52620. $globals.ScopeVarTest);
  52621. $core.addMethod(
  52622. $core.method({
  52623. selector: "testInstanceVar",
  52624. protocol: "tests",
  52625. fn: function (){
  52626. var self=this,$self=this;
  52627. var node,scope;
  52628. return $core.withContext(function($ctx1) {
  52629. var $1;
  52630. $1=$recv($globals.VariableNode)._new();
  52631. $ctx1.sendIdx["new"]=1;
  52632. $recv($1)._value_("bzzz");
  52633. node=$recv($1)._yourself();
  52634. scope=$recv($globals.MethodLexicalScope)._new();
  52635. $recv(scope)._addIVar_("bzzz");
  52636. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  52637. return self;
  52638. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope})});
  52639. },
  52640. args: [],
  52641. 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",
  52642. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52643. pragmas: [],
  52644. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  52645. }),
  52646. $globals.ScopeVarTest);
  52647. $core.addMethod(
  52648. $core.method({
  52649. selector: "testPseudoVar",
  52650. protocol: "tests",
  52651. fn: function (){
  52652. var self=this,$self=this;
  52653. var node,pseudoVars;
  52654. return $core.withContext(function($ctx1) {
  52655. var $1;
  52656. pseudoVars=["self", "super", "true", "false", "nil"];
  52657. $recv(pseudoVars)._do_((function(each){
  52658. return $core.withContext(function($ctx2) {
  52659. $1=$recv($globals.VariableNode)._new();
  52660. $ctx2.sendIdx["new"]=1;
  52661. $recv($1)._value_(each);
  52662. node=$recv($1)._yourself();
  52663. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  52664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52665. }));
  52666. return self;
  52667. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars})});
  52668. },
  52669. args: [],
  52670. 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]",
  52671. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52672. pragmas: [],
  52673. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  52674. }),
  52675. $globals.ScopeVarTest);
  52676. $core.addMethod(
  52677. $core.method({
  52678. selector: "testTempVar",
  52679. protocol: "tests",
  52680. fn: function (){
  52681. var self=this,$self=this;
  52682. var node,scope;
  52683. return $core.withContext(function($ctx1) {
  52684. var $1;
  52685. $1=$recv($globals.VariableNode)._new();
  52686. $ctx1.sendIdx["new"]=1;
  52687. $recv($1)._value_("bzzz");
  52688. node=$recv($1)._yourself();
  52689. scope=$recv($globals.MethodLexicalScope)._new();
  52690. $recv(scope)._addTemp_("bzzz");
  52691. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  52692. return self;
  52693. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope})});
  52694. },
  52695. args: [],
  52696. 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",
  52697. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52698. pragmas: [],
  52699. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  52700. }),
  52701. $globals.ScopeVarTest);
  52702. $core.addMethod(
  52703. $core.method({
  52704. selector: "testUnknownVar",
  52705. protocol: "tests",
  52706. fn: function (){
  52707. var self=this,$self=this;
  52708. var node;
  52709. return $core.withContext(function($ctx1) {
  52710. var $1;
  52711. $1=$recv($globals.VariableNode)._new();
  52712. $ctx1.sendIdx["new"]=1;
  52713. $recv($1)._value_("bzzz");
  52714. node=$recv($1)._yourself();
  52715. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  52716. return self;
  52717. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node})});
  52718. },
  52719. args: [],
  52720. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  52721. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  52722. pragmas: [],
  52723. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  52724. }),
  52725. $globals.ScopeVarTest);
  52726. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  52727. $core.addMethod(
  52728. $core.method({
  52729. selector: "setUp",
  52730. protocol: "running",
  52731. fn: function (){
  52732. var self=this,$self=this;
  52733. return $core.withContext(function($ctx1) {
  52734. $self.analyzer=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  52735. return self;
  52736. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  52737. },
  52738. args: [],
  52739. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  52740. referencedClasses: ["SemanticAnalyzer", "Object"],
  52741. pragmas: [],
  52742. messageSends: ["on:"]
  52743. }),
  52744. $globals.SemanticAnalyzerTest);
  52745. $core.addMethod(
  52746. $core.method({
  52747. selector: "testAssignment",
  52748. protocol: "tests",
  52749. fn: function (){
  52750. var self=this,$self=this;
  52751. var src,ast;
  52752. return $core.withContext(function($ctx1) {
  52753. src="foo self := 1";
  52754. ast=$recv($globals.Smalltalk)._parse_(src);
  52755. $self._should_raise_((function(){
  52756. return $core.withContext(function($ctx2) {
  52757. return $recv($self.analyzer)._visit_(ast);
  52758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52759. }),$globals.InvalidAssignmentError);
  52760. return self;
  52761. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast})});
  52762. },
  52763. args: [],
  52764. 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",
  52765. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  52766. pragmas: [],
  52767. messageSends: ["parse:", "should:raise:", "visit:"]
  52768. }),
  52769. $globals.SemanticAnalyzerTest);
  52770. $core.addMethod(
  52771. $core.method({
  52772. selector: "testNonLocalReturn",
  52773. protocol: "tests",
  52774. fn: function (){
  52775. var self=this,$self=this;
  52776. var src,ast;
  52777. return $core.withContext(function($ctx1) {
  52778. src="foo | a | a + 1. ^ a";
  52779. ast=$recv($globals.Smalltalk)._parse_(src);
  52780. $recv($self.analyzer)._visit_(ast);
  52781. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  52782. return self;
  52783. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast})});
  52784. },
  52785. args: [],
  52786. 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",
  52787. referencedClasses: ["Smalltalk"],
  52788. pragmas: [],
  52789. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  52790. }),
  52791. $globals.SemanticAnalyzerTest);
  52792. $core.addMethod(
  52793. $core.method({
  52794. selector: "testNonLocalReturn2",
  52795. protocol: "tests",
  52796. fn: function (){
  52797. var self=this,$self=this;
  52798. var src,ast;
  52799. return $core.withContext(function($ctx1) {
  52800. src="foo | a | a + 1. [ [ ^ a] ]";
  52801. ast=$recv($globals.Smalltalk)._parse_(src);
  52802. $recv($self.analyzer)._visit_(ast);
  52803. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  52804. return self;
  52805. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast})});
  52806. },
  52807. args: [],
  52808. 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",
  52809. referencedClasses: ["Smalltalk"],
  52810. pragmas: [],
  52811. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  52812. }),
  52813. $globals.SemanticAnalyzerTest);
  52814. $core.addMethod(
  52815. $core.method({
  52816. selector: "testScope",
  52817. protocol: "tests",
  52818. fn: function (){
  52819. var self=this,$self=this;
  52820. var src,ast;
  52821. return $core.withContext(function($ctx1) {
  52822. var $4,$3,$2,$1;
  52823. src="foo | a | a + 1. [ | b | b := a ]";
  52824. ast=$recv($globals.Smalltalk)._parse_(src);
  52825. $recv($self.analyzer)._visit_(ast);
  52826. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52827. $ctx1.sendIdx["dagChildren"]=1;
  52828. $3=$recv($4)._last();
  52829. $2=$recv($3)._scope();
  52830. $ctx1.sendIdx["scope"]=1;
  52831. $1=$recv($2).__eq_eq($recv(ast)._scope());
  52832. $self._deny_($1);
  52833. return self;
  52834. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast})});
  52835. },
  52836. args: [],
  52837. 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.",
  52838. referencedClasses: ["Smalltalk"],
  52839. pragmas: [],
  52840. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  52841. }),
  52842. $globals.SemanticAnalyzerTest);
  52843. $core.addMethod(
  52844. $core.method({
  52845. selector: "testScope2",
  52846. protocol: "tests",
  52847. fn: function (){
  52848. var self=this,$self=this;
  52849. var src,ast;
  52850. return $core.withContext(function($ctx1) {
  52851. var $8,$7,$6,$5,$4,$3,$2,$1;
  52852. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  52853. ast=$recv($globals.Smalltalk)._parse_(src);
  52854. $recv($self.analyzer)._visit_(ast);
  52855. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52856. $ctx1.sendIdx["dagChildren"]=3;
  52857. $7=$recv($8)._last();
  52858. $6=$recv($7)._dagChildren();
  52859. $ctx1.sendIdx["dagChildren"]=2;
  52860. $5=$recv($6)._first();
  52861. $ctx1.sendIdx["first"]=2;
  52862. $4=$recv($5)._dagChildren();
  52863. $ctx1.sendIdx["dagChildren"]=1;
  52864. $3=$recv($4)._first();
  52865. $ctx1.sendIdx["first"]=1;
  52866. $2=$recv($3)._scope();
  52867. $ctx1.sendIdx["scope"]=1;
  52868. $1=$recv($2).__eq_eq($recv(ast)._scope());
  52869. $self._deny_($1);
  52870. return self;
  52871. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast})});
  52872. },
  52873. args: [],
  52874. 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.",
  52875. referencedClasses: ["Smalltalk"],
  52876. pragmas: [],
  52877. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  52878. }),
  52879. $globals.SemanticAnalyzerTest);
  52880. $core.addMethod(
  52881. $core.method({
  52882. selector: "testScopeLevel",
  52883. protocol: "tests",
  52884. fn: function (){
  52885. var self=this,$self=this;
  52886. var src,ast;
  52887. return $core.withContext(function($ctx1) {
  52888. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  52889. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  52890. ast=$recv($globals.Smalltalk)._parse_(src);
  52891. $recv($self.analyzer)._visit_(ast);
  52892. $2=$recv(ast)._scope();
  52893. $ctx1.sendIdx["scope"]=1;
  52894. $1=$recv($2)._scopeLevel();
  52895. $ctx1.sendIdx["scopeLevel"]=1;
  52896. $self._assert_equals_($1,(1));
  52897. $ctx1.sendIdx["assert:equals:"]=1;
  52898. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  52899. $ctx1.sendIdx["dagChildren"]=3;
  52900. $9=$recv($10)._last();
  52901. $8=$recv($9)._dagChildren();
  52902. $ctx1.sendIdx["dagChildren"]=2;
  52903. $7=$recv($8)._first();
  52904. $ctx1.sendIdx["first"]=2;
  52905. $6=$recv($7)._dagChildren();
  52906. $ctx1.sendIdx["dagChildren"]=1;
  52907. $5=$recv($6)._first();
  52908. $ctx1.sendIdx["first"]=1;
  52909. $4=$recv($5)._scope();
  52910. $3=$recv($4)._scopeLevel();
  52911. $self._assert_equals_($3,(3));
  52912. return self;
  52913. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast})});
  52914. },
  52915. args: [],
  52916. 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",
  52917. referencedClasses: ["Smalltalk"],
  52918. pragmas: [],
  52919. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  52920. }),
  52921. $globals.SemanticAnalyzerTest);
  52922. $core.addMethod(
  52923. $core.method({
  52924. selector: "testUnknownVariables",
  52925. protocol: "tests",
  52926. fn: function (){
  52927. var self=this,$self=this;
  52928. var src,ast;
  52929. return $core.withContext(function($ctx1) {
  52930. src="foo | a | b + a";
  52931. ast=$recv($globals.Smalltalk)._parse_(src);
  52932. $self._should_raise_((function(){
  52933. return $core.withContext(function($ctx2) {
  52934. return $recv($self.analyzer)._visit_(ast);
  52935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52936. }),$globals.UnknownVariableError);
  52937. return self;
  52938. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast})});
  52939. },
  52940. args: [],
  52941. 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",
  52942. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  52943. pragmas: [],
  52944. messageSends: ["parse:", "should:raise:", "visit:"]
  52945. }),
  52946. $globals.SemanticAnalyzerTest);
  52947. $core.addMethod(
  52948. $core.method({
  52949. selector: "testUnknownVariablesWithScope",
  52950. protocol: "tests",
  52951. fn: function (){
  52952. var self=this,$self=this;
  52953. var src,ast;
  52954. return $core.withContext(function($ctx1) {
  52955. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  52956. ast=$recv($globals.Smalltalk)._parse_(src);
  52957. $self._should_raise_((function(){
  52958. return $core.withContext(function($ctx2) {
  52959. return $recv($self.analyzer)._visit_(ast);
  52960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52961. }),$globals.UnknownVariableError);
  52962. return self;
  52963. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast})});
  52964. },
  52965. args: [],
  52966. 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",
  52967. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  52968. pragmas: [],
  52969. messageSends: ["parse:", "should:raise:", "visit:"]
  52970. }),
  52971. $globals.SemanticAnalyzerTest);
  52972. $core.addMethod(
  52973. $core.method({
  52974. selector: "testVariableShadowing",
  52975. protocol: "tests",
  52976. fn: function (){
  52977. var self=this,$self=this;
  52978. var src,ast;
  52979. return $core.withContext(function($ctx1) {
  52980. src="foo | a | a + 1";
  52981. ast=$recv($globals.Smalltalk)._parse_(src);
  52982. $recv($self.analyzer)._visit_(ast);
  52983. return self;
  52984. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast})});
  52985. },
  52986. args: [],
  52987. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52988. referencedClasses: ["Smalltalk"],
  52989. pragmas: [],
  52990. messageSends: ["parse:", "visit:"]
  52991. }),
  52992. $globals.SemanticAnalyzerTest);
  52993. $core.addMethod(
  52994. $core.method({
  52995. selector: "testVariableShadowing2",
  52996. protocol: "tests",
  52997. fn: function (){
  52998. var self=this,$self=this;
  52999. var src,ast;
  53000. return $core.withContext(function($ctx1) {
  53001. src="foo | a | a + 1. [ | a | a := 2 ]";
  53002. ast=$recv($globals.Smalltalk)._parse_(src);
  53003. $self._should_raise_((function(){
  53004. return $core.withContext(function($ctx2) {
  53005. return $recv($self.analyzer)._visit_(ast);
  53006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53007. }),$globals.ShadowingVariableError);
  53008. return self;
  53009. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast})});
  53010. },
  53011. args: [],
  53012. 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",
  53013. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  53014. pragmas: [],
  53015. messageSends: ["parse:", "should:raise:", "visit:"]
  53016. }),
  53017. $globals.SemanticAnalyzerTest);
  53018. $core.addMethod(
  53019. $core.method({
  53020. selector: "testVariableShadowing3",
  53021. protocol: "tests",
  53022. fn: function (){
  53023. var self=this,$self=this;
  53024. var src,ast;
  53025. return $core.withContext(function($ctx1) {
  53026. src="foo | a | a + 1. [ | b | b := 2 ]";
  53027. ast=$recv($globals.Smalltalk)._parse_(src);
  53028. $recv($self.analyzer)._visit_(ast);
  53029. return self;
  53030. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast})});
  53031. },
  53032. args: [],
  53033. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  53034. referencedClasses: ["Smalltalk"],
  53035. pragmas: [],
  53036. messageSends: ["parse:", "visit:"]
  53037. }),
  53038. $globals.SemanticAnalyzerTest);
  53039. $core.addMethod(
  53040. $core.method({
  53041. selector: "testVariableShadowing4",
  53042. protocol: "tests",
  53043. fn: function (){
  53044. var self=this,$self=this;
  53045. var src,ast;
  53046. return $core.withContext(function($ctx1) {
  53047. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  53048. ast=$recv($globals.Smalltalk)._parse_(src);
  53049. $recv($self.analyzer)._visit_(ast);
  53050. return self;
  53051. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast})});
  53052. },
  53053. args: [],
  53054. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  53055. referencedClasses: ["Smalltalk"],
  53056. pragmas: [],
  53057. messageSends: ["parse:", "visit:"]
  53058. }),
  53059. $globals.SemanticAnalyzerTest);
  53060. $core.addMethod(
  53061. $core.method({
  53062. selector: "testVariableShadowing5",
  53063. protocol: "tests",
  53064. fn: function (){
  53065. var self=this,$self=this;
  53066. var src,ast;
  53067. return $core.withContext(function($ctx1) {
  53068. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  53069. ast=$recv($globals.Smalltalk)._parse_(src);
  53070. $self._should_raise_((function(){
  53071. return $core.withContext(function($ctx2) {
  53072. return $recv($self.analyzer)._visit_(ast);
  53073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53074. }),$globals.ShadowingVariableError);
  53075. return self;
  53076. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast})});
  53077. },
  53078. args: [],
  53079. 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",
  53080. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  53081. pragmas: [],
  53082. messageSends: ["parse:", "should:raise:", "visit:"]
  53083. }),
  53084. $globals.SemanticAnalyzerTest);
  53085. $core.addMethod(
  53086. $core.method({
  53087. selector: "testVariablesLookup",
  53088. protocol: "tests",
  53089. fn: function (){
  53090. var self=this,$self=this;
  53091. var src,ast;
  53092. return $core.withContext(function($ctx1) {
  53093. 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;
  53094. src="foo | a | a + 1. [ | b | b := a ]";
  53095. ast=$recv($globals.Smalltalk)._parse_(src);
  53096. $recv($self.analyzer)._visit_(ast);
  53097. $7=$recv(ast)._dagChildren();
  53098. $ctx1.sendIdx["dagChildren"]=2;
  53099. $6=$recv($7)._first();
  53100. $ctx1.sendIdx["first"]=2;
  53101. $5=$recv($6)._dagChildren();
  53102. $ctx1.sendIdx["dagChildren"]=1;
  53103. $4=$recv($5)._first();
  53104. $ctx1.sendIdx["first"]=1;
  53105. $3=$recv($4)._receiver();
  53106. $ctx1.sendIdx["receiver"]=1;
  53107. $2=$recv($3)._binding();
  53108. $ctx1.sendIdx["binding"]=1;
  53109. $1=$recv($2)._isTempVar();
  53110. $ctx1.sendIdx["isTempVar"]=1;
  53111. $self._assert_($1);
  53112. $ctx1.sendIdx["assert:"]=1;
  53113. $15=$recv(ast)._dagChildren();
  53114. $ctx1.sendIdx["dagChildren"]=4;
  53115. $14=$recv($15)._first();
  53116. $ctx1.sendIdx["first"]=4;
  53117. $13=$recv($14)._dagChildren();
  53118. $ctx1.sendIdx["dagChildren"]=3;
  53119. $12=$recv($13)._first();
  53120. $ctx1.sendIdx["first"]=3;
  53121. $11=$recv($12)._receiver();
  53122. $10=$recv($11)._binding();
  53123. $ctx1.sendIdx["binding"]=2;
  53124. $9=$recv($10)._scope();
  53125. $ctx1.sendIdx["scope"]=1;
  53126. $16=$recv(ast)._scope();
  53127. $ctx1.sendIdx["scope"]=2;
  53128. $8=$recv($9).__eq_eq($16);
  53129. $ctx1.sendIdx["=="]=1;
  53130. $self._assert_($8);
  53131. $ctx1.sendIdx["assert:"]=2;
  53132. $27=$recv(ast)._dagChildren();
  53133. $ctx1.sendIdx["dagChildren"]=8;
  53134. $26=$recv($27)._first();
  53135. $ctx1.sendIdx["first"]=7;
  53136. $25=$recv($26)._dagChildren();
  53137. $ctx1.sendIdx["dagChildren"]=7;
  53138. $24=$recv($25)._last();
  53139. $ctx1.sendIdx["last"]=1;
  53140. $23=$recv($24)._dagChildren();
  53141. $ctx1.sendIdx["dagChildren"]=6;
  53142. $22=$recv($23)._first();
  53143. $ctx1.sendIdx["first"]=6;
  53144. $21=$recv($22)._dagChildren();
  53145. $ctx1.sendIdx["dagChildren"]=5;
  53146. $20=$recv($21)._first();
  53147. $ctx1.sendIdx["first"]=5;
  53148. $19=$recv($20)._left();
  53149. $ctx1.sendIdx["left"]=1;
  53150. $18=$recv($19)._binding();
  53151. $ctx1.sendIdx["binding"]=3;
  53152. $17=$recv($18)._isTempVar();
  53153. $self._assert_($17);
  53154. $ctx1.sendIdx["assert:"]=3;
  53155. $39=$recv(ast)._dagChildren();
  53156. $ctx1.sendIdx["dagChildren"]=12;
  53157. $38=$recv($39)._first();
  53158. $ctx1.sendIdx["first"]=10;
  53159. $37=$recv($38)._dagChildren();
  53160. $ctx1.sendIdx["dagChildren"]=11;
  53161. $36=$recv($37)._last();
  53162. $ctx1.sendIdx["last"]=2;
  53163. $35=$recv($36)._dagChildren();
  53164. $ctx1.sendIdx["dagChildren"]=10;
  53165. $34=$recv($35)._first();
  53166. $ctx1.sendIdx["first"]=9;
  53167. $33=$recv($34)._dagChildren();
  53168. $ctx1.sendIdx["dagChildren"]=9;
  53169. $32=$recv($33)._first();
  53170. $ctx1.sendIdx["first"]=8;
  53171. $31=$recv($32)._left();
  53172. $30=$recv($31)._binding();
  53173. $29=$recv($30)._scope();
  53174. $ctx1.sendIdx["scope"]=3;
  53175. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  53176. $ctx1.sendIdx["dagChildren"]=13;
  53177. $41=$recv($42)._last();
  53178. $40=$recv($41)._scope();
  53179. $28=$recv($29).__eq_eq($40);
  53180. $self._assert_($28);
  53181. return self;
  53182. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast})});
  53183. },
  53184. args: [],
  53185. 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.",
  53186. referencedClasses: ["Smalltalk"],
  53187. pragmas: [],
  53188. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  53189. }),
  53190. $globals.SemanticAnalyzerTest);
  53191. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  53192. $core.addMethod(
  53193. $core.method({
  53194. selector: "setUp",
  53195. protocol: "running",
  53196. fn: function (){
  53197. var self=this,$self=this;
  53198. return $core.withContext(function($ctx1) {
  53199. var $1,$3,$4,$2;
  53200. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  53201. $3=$recv($globals.AIContext)._new();
  53202. $recv($3)._defineLocal_("local");
  53203. $recv($3)._localAt_put_("local",(3));
  53204. $4=$recv($3)._yourself();
  53205. $ctx1.sendIdx["yourself"]=1;
  53206. $2=$4;
  53207. $recv($1)._context_($2);
  53208. $self.analyzer=$recv($1)._yourself();
  53209. return self;
  53210. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  53211. },
  53212. args: [],
  53213. 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",
  53214. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  53215. pragmas: [],
  53216. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  53217. }),
  53218. $globals.AISemanticAnalyzerTest);
  53219. $core.addMethod(
  53220. $core.method({
  53221. selector: "testContextVariables",
  53222. protocol: "tests",
  53223. fn: function (){
  53224. var self=this,$self=this;
  53225. var src,ast;
  53226. return $core.withContext(function($ctx1) {
  53227. src="foo | a | local + a";
  53228. ast=$recv($globals.Smalltalk)._parse_(src);
  53229. $self._shouldnt_raise_((function(){
  53230. return $core.withContext(function($ctx2) {
  53231. return $recv($self.analyzer)._visit_(ast);
  53232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53233. }),$globals.UnknownVariableError);
  53234. return self;
  53235. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast})});
  53236. },
  53237. args: [],
  53238. 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",
  53239. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  53240. pragmas: [],
  53241. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  53242. }),
  53243. $globals.AISemanticAnalyzerTest);
  53244. });
  53245. define('amber/core/Kernel-Tests',["amber/boot", "require", "amber/core/Kernel-Objects", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  53246. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  53247. var $pkg = $core.addPackage("Kernel-Tests");
  53248. $pkg.innerEval = function (expr) { return eval(expr); };
  53249. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  53250. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  53251. $core.addMethod(
  53252. $core.method({
  53253. selector: "testAddExtensionMethod",
  53254. protocol: "tests",
  53255. fn: function (){
  53256. var self=this,$self=this;
  53257. var method,dirty;
  53258. return $core.withContext(function($ctx1) {
  53259. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  53260. $2=$self._class();
  53261. $ctx1.sendIdx["class"]=1;
  53262. $1=$recv($2)._package();
  53263. $ctx1.sendIdx["package"]=1;
  53264. dirty=$recv($1)._isDirty();
  53265. $ctx1.sendIdx["isDirty"]=1;
  53266. $4=$self._class();
  53267. $ctx1.sendIdx["class"]=2;
  53268. $3=$recv($4)._package();
  53269. $ctx1.sendIdx["package"]=2;
  53270. $recv($3)._beClean();
  53271. $5=$self._class();
  53272. $ctx1.sendIdx["class"]=3;
  53273. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  53274. $8=$self._class();
  53275. $ctx1.sendIdx["class"]=4;
  53276. $7=$recv($8)._package();
  53277. $ctx1.sendIdx["package"]=3;
  53278. $6=$recv($7)._isDirty();
  53279. $self._deny_($6);
  53280. $9=$self._class();
  53281. $ctx1.sendIdx["class"]=5;
  53282. $recv($9)._removeCompiledMethod_(method);
  53283. $10=dirty;
  53284. if($core.assert($10)){
  53285. $recv($recv($self._class())._package())._beDirty();
  53286. }
  53287. return self;
  53288. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty})});
  53289. },
  53290. args: [],
  53291. 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 ]",
  53292. referencedClasses: [],
  53293. pragmas: [],
  53294. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  53295. }),
  53296. $globals.AnnouncementSubscriptionTest);
  53297. $core.addMethod(
  53298. $core.method({
  53299. selector: "testHandlesAnnouncement",
  53300. protocol: "tests",
  53301. fn: function (){
  53302. var self=this,$self=this;
  53303. var subscription,announcementClass1,announcementClass2,classBuilder;
  53304. return $core.withContext(function($ctx1) {
  53305. var $1,$3,$4,$2,$6,$7,$5;
  53306. classBuilder=$recv($globals.ClassBuilder)._new();
  53307. $ctx1.sendIdx["new"]=1;
  53308. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  53309. $1=$recv($globals.AnnouncementSubscription)._new();
  53310. $ctx1.sendIdx["new"]=2;
  53311. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  53312. $3=subscription;
  53313. $4=$recv($globals.SystemAnnouncement)._new();
  53314. $ctx1.sendIdx["new"]=3;
  53315. $2=$recv($3)._handlesAnnouncement_($4);
  53316. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  53317. $self._assert_equals_($2,true);
  53318. $ctx1.sendIdx["assert:equals:"]=1;
  53319. $6=subscription;
  53320. $7=$recv(announcementClass1)._new();
  53321. $ctx1.sendIdx["new"]=4;
  53322. $5=$recv($6)._handlesAnnouncement_($7);
  53323. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  53324. $self._assert_equals_($5,true);
  53325. $ctx1.sendIdx["assert:equals:"]=2;
  53326. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  53327. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  53328. return self;
  53329. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder})});
  53330. },
  53331. args: [],
  53332. 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.",
  53333. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  53334. pragmas: [],
  53335. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  53336. }),
  53337. $globals.AnnouncementSubscriptionTest);
  53338. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  53339. $core.addMethod(
  53340. $core.method({
  53341. selector: "testOnDo",
  53342. protocol: "tests",
  53343. fn: function (){
  53344. var self=this,$self=this;
  53345. var counter,announcer;
  53346. return $core.withContext(function($ctx1) {
  53347. var $1,$2;
  53348. counter=(0);
  53349. announcer=$recv($globals.Announcer)._new();
  53350. $ctx1.sendIdx["new"]=1;
  53351. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  53352. return $core.withContext(function($ctx2) {
  53353. counter=$recv(counter).__plus((1));
  53354. return counter;
  53355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53356. }));
  53357. $1=announcer;
  53358. $2=$recv($globals.SystemAnnouncement)._new();
  53359. $ctx1.sendIdx["new"]=2;
  53360. $recv($1)._announce_($2);
  53361. $ctx1.sendIdx["announce:"]=1;
  53362. $self._assert_equals_(counter,(1));
  53363. $ctx1.sendIdx["assert:equals:"]=1;
  53364. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53365. $self._assert_equals_(counter,(2));
  53366. return self;
  53367. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer})});
  53368. },
  53369. args: [],
  53370. 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.",
  53371. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53372. pragmas: [],
  53373. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  53374. }),
  53375. $globals.AnnouncerTest);
  53376. $core.addMethod(
  53377. $core.method({
  53378. selector: "testOnDoFor",
  53379. protocol: "tests",
  53380. fn: function (){
  53381. var self=this,$self=this;
  53382. var counter,announcer;
  53383. return $core.withContext(function($ctx1) {
  53384. var $1,$2,$3,$4;
  53385. counter=(0);
  53386. announcer=$recv($globals.Announcer)._new();
  53387. $ctx1.sendIdx["new"]=1;
  53388. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  53389. return $core.withContext(function($ctx2) {
  53390. counter=$recv(counter).__plus((1));
  53391. return counter;
  53392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53393. }),self);
  53394. $1=announcer;
  53395. $2=$recv($globals.SystemAnnouncement)._new();
  53396. $ctx1.sendIdx["new"]=2;
  53397. $recv($1)._announce_($2);
  53398. $ctx1.sendIdx["announce:"]=1;
  53399. $self._assert_equals_(counter,(1));
  53400. $ctx1.sendIdx["assert:equals:"]=1;
  53401. $3=announcer;
  53402. $4=$recv($globals.SystemAnnouncement)._new();
  53403. $ctx1.sendIdx["new"]=3;
  53404. $recv($3)._announce_($4);
  53405. $ctx1.sendIdx["announce:"]=2;
  53406. $self._assert_equals_(counter,(2));
  53407. $ctx1.sendIdx["assert:equals:"]=2;
  53408. $recv(announcer)._unsubscribe_(self);
  53409. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53410. $self._assert_equals_(counter,(2));
  53411. return self;
  53412. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer})});
  53413. },
  53414. args: [],
  53415. 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.",
  53416. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53417. pragmas: [],
  53418. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  53419. }),
  53420. $globals.AnnouncerTest);
  53421. $core.addMethod(
  53422. $core.method({
  53423. selector: "testOnDoOnce",
  53424. protocol: "tests",
  53425. fn: function (){
  53426. var self=this,$self=this;
  53427. var counter,announcer;
  53428. return $core.withContext(function($ctx1) {
  53429. var $1,$2;
  53430. counter=(0);
  53431. announcer=$recv($globals.Announcer)._new();
  53432. $ctx1.sendIdx["new"]=1;
  53433. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  53434. return $core.withContext(function($ctx2) {
  53435. counter=$recv(counter).__plus((1));
  53436. return counter;
  53437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53438. }));
  53439. $1=announcer;
  53440. $2=$recv($globals.SystemAnnouncement)._new();
  53441. $ctx1.sendIdx["new"]=2;
  53442. $recv($1)._announce_($2);
  53443. $ctx1.sendIdx["announce:"]=1;
  53444. $self._assert_equals_(counter,(1));
  53445. $ctx1.sendIdx["assert:equals:"]=1;
  53446. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  53447. $self._assert_equals_(counter,(1));
  53448. return self;
  53449. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer})});
  53450. },
  53451. args: [],
  53452. 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.",
  53453. referencedClasses: ["Announcer", "SystemAnnouncement"],
  53454. pragmas: [],
  53455. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  53456. }),
  53457. $globals.AnnouncerTest);
  53458. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  53459. $core.addMethod(
  53460. $core.method({
  53461. selector: "localReturnOnDoCatch",
  53462. protocol: "fixture",
  53463. fn: function (){
  53464. var self=this,$self=this;
  53465. return $core.withContext(function($ctx1) {
  53466. var $early={};
  53467. try {
  53468. $recv((function(){
  53469. throw $early=[(2)];
  53470. }))._on_do_($globals.Error,(function(){
  53471. }));
  53472. return (3);
  53473. }
  53474. catch(e) {if(e===$early)return e[0]; throw e}
  53475. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{})});
  53476. },
  53477. args: [],
  53478. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  53479. referencedClasses: ["Error"],
  53480. pragmas: [],
  53481. messageSends: ["on:do:"]
  53482. }),
  53483. $globals.BlockClosureTest);
  53484. $core.addMethod(
  53485. $core.method({
  53486. selector: "localReturnOnDoMiss",
  53487. protocol: "fixture",
  53488. fn: function (){
  53489. var self=this,$self=this;
  53490. return $core.withContext(function($ctx1) {
  53491. var $early={};
  53492. try {
  53493. $recv((function(){
  53494. throw $early=[(2)];
  53495. }))._on_do_($globals.Class,(function(){
  53496. }));
  53497. return (3);
  53498. }
  53499. catch(e) {if(e===$early)return e[0]; throw e}
  53500. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{})});
  53501. },
  53502. args: [],
  53503. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  53504. referencedClasses: ["Class"],
  53505. pragmas: [],
  53506. messageSends: ["on:do:"]
  53507. }),
  53508. $globals.BlockClosureTest);
  53509. $core.addMethod(
  53510. $core.method({
  53511. selector: "testCanClearInterval",
  53512. protocol: "tests",
  53513. fn: function (){
  53514. var self=this,$self=this;
  53515. return $core.withContext(function($ctx1) {
  53516. $self._shouldnt_raise_((function(){
  53517. return $core.withContext(function($ctx2) {
  53518. return $recv($recv((function(){
  53519. return $core.withContext(function($ctx3) {
  53520. return $recv($recv($globals.Error)._new())._signal();
  53521. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53522. }))._valueWithInterval_((0)))._clearInterval();
  53523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53524. }),$globals.Error);
  53525. return self;
  53526. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{})});
  53527. },
  53528. args: [],
  53529. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  53530. referencedClasses: ["Error"],
  53531. pragmas: [],
  53532. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  53533. }),
  53534. $globals.BlockClosureTest);
  53535. $core.addMethod(
  53536. $core.method({
  53537. selector: "testCanClearTimeout",
  53538. protocol: "tests",
  53539. fn: function (){
  53540. var self=this,$self=this;
  53541. return $core.withContext(function($ctx1) {
  53542. $self._shouldnt_raise_((function(){
  53543. return $core.withContext(function($ctx2) {
  53544. return $recv($recv((function(){
  53545. return $core.withContext(function($ctx3) {
  53546. return $recv($recv($globals.Error)._new())._signal();
  53547. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53548. }))._valueWithTimeout_((0)))._clearTimeout();
  53549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53550. }),$globals.Error);
  53551. return self;
  53552. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{})});
  53553. },
  53554. args: [],
  53555. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  53556. referencedClasses: ["Error"],
  53557. pragmas: [],
  53558. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  53559. }),
  53560. $globals.BlockClosureTest);
  53561. $core.addMethod(
  53562. $core.method({
  53563. selector: "testCompiledSource",
  53564. protocol: "tests",
  53565. fn: function (){
  53566. var self=this,$self=this;
  53567. return $core.withContext(function($ctx1) {
  53568. $self._assert_($recv($recv((function(){
  53569. return $core.withContext(function($ctx2) {
  53570. return (1).__plus((1));
  53571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53572. }))._compiledSource())._includesSubString_("function"));
  53573. return self;
  53574. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{})});
  53575. },
  53576. args: [],
  53577. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  53578. referencedClasses: [],
  53579. pragmas: [],
  53580. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  53581. }),
  53582. $globals.BlockClosureTest);
  53583. $core.addMethod(
  53584. $core.method({
  53585. selector: "testCurrySelf",
  53586. protocol: "tests",
  53587. fn: function (){
  53588. var self=this,$self=this;
  53589. var curriedMethod,array;
  53590. return $core.withContext(function($ctx1) {
  53591. curriedMethod=$recv($recv((function(selfarg,x){
  53592. return $core.withContext(function($ctx2) {
  53593. return $recv(selfarg)._at_(x);
  53594. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  53595. }))._currySelf())._asCompiledMethod_("foo:");
  53596. $recv(curriedMethod)._protocol_("**test helper");
  53597. array=[(3), (1), (4)];
  53598. $recv($globals.Array)._addCompiledMethod_(curriedMethod);
  53599. $recv((function(){
  53600. return $core.withContext(function($ctx2) {
  53601. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  53602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53603. }))._ensure_((function(){
  53604. return $core.withContext(function($ctx2) {
  53605. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  53606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53607. }));
  53608. return self;
  53609. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array})});
  53610. },
  53611. args: [],
  53612. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09curriedMethod protocol: '**test helper'.\x0a\x09array := #(3 1 4).\x0a\x09Array addCompiledMethod: curriedMethod.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  53613. referencedClasses: ["Array"],
  53614. pragmas: [],
  53615. messageSends: ["asCompiledMethod:", "currySelf", "at:", "protocol:", "addCompiledMethod:", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  53616. }),
  53617. $globals.BlockClosureTest);
  53618. $core.addMethod(
  53619. $core.method({
  53620. selector: "testEnsure",
  53621. protocol: "tests",
  53622. fn: function (){
  53623. var self=this,$self=this;
  53624. return $core.withContext(function($ctx1) {
  53625. $self._assert_equals_($recv((function(){
  53626. return (3);
  53627. }))._ensure_((function(){
  53628. return (4);
  53629. })),(3));
  53630. return self;
  53631. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{})});
  53632. },
  53633. args: [],
  53634. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  53635. referencedClasses: [],
  53636. pragmas: [],
  53637. messageSends: ["assert:equals:", "ensure:"]
  53638. }),
  53639. $globals.BlockClosureTest);
  53640. $core.addMethod(
  53641. $core.method({
  53642. selector: "testEnsureRaises",
  53643. protocol: "tests",
  53644. fn: function (){
  53645. var self=this,$self=this;
  53646. return $core.withContext(function($ctx1) {
  53647. $self._should_raise_((function(){
  53648. return $core.withContext(function($ctx2) {
  53649. return $recv((function(){
  53650. return $core.withContext(function($ctx3) {
  53651. return $recv($recv($globals.Error)._new())._signal();
  53652. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53653. }))._ensure_((function(){
  53654. return true;
  53655. }));
  53656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53657. }),$globals.Error);
  53658. return self;
  53659. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{})});
  53660. },
  53661. args: [],
  53662. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  53663. referencedClasses: ["Error"],
  53664. pragmas: [],
  53665. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  53666. }),
  53667. $globals.BlockClosureTest);
  53668. $core.addMethod(
  53669. $core.method({
  53670. selector: "testExceptionSemantics",
  53671. protocol: "tests",
  53672. fn: function (){
  53673. var self=this,$self=this;
  53674. return $core.withContext(function($ctx1) {
  53675. $self._timeout_((100));
  53676. $recv($self._async_((function(){
  53677. return $core.withContext(function($ctx2) {
  53678. return $recv((function(){
  53679. return $core.withContext(function($ctx3) {
  53680. $self._assert_(true);
  53681. $recv($globals.Error)._signal();
  53682. $self._deny_(true);
  53683. return $self._finished();
  53684. $ctx3.sendIdx["finished"]=1;
  53685. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53686. }))._on_do_($globals.Error,(function(ex){
  53687. return $core.withContext(function($ctx3) {
  53688. return $self._finished();
  53689. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  53690. }));
  53691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53692. })))._valueWithTimeout_((0));
  53693. return self;
  53694. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{})});
  53695. },
  53696. args: [],
  53697. 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",
  53698. referencedClasses: ["Error"],
  53699. pragmas: [],
  53700. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  53701. }),
  53702. $globals.BlockClosureTest);
  53703. $core.addMethod(
  53704. $core.method({
  53705. selector: "testLocalReturnOnDoCatch",
  53706. protocol: "tests",
  53707. fn: function (){
  53708. var self=this,$self=this;
  53709. return $core.withContext(function($ctx1) {
  53710. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  53711. return self;
  53712. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{})});
  53713. },
  53714. args: [],
  53715. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  53716. referencedClasses: [],
  53717. pragmas: [],
  53718. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  53719. }),
  53720. $globals.BlockClosureTest);
  53721. $core.addMethod(
  53722. $core.method({
  53723. selector: "testLocalReturnOnDoMiss",
  53724. protocol: "tests",
  53725. fn: function (){
  53726. var self=this,$self=this;
  53727. return $core.withContext(function($ctx1) {
  53728. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  53729. return self;
  53730. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{})});
  53731. },
  53732. args: [],
  53733. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  53734. referencedClasses: [],
  53735. pragmas: [],
  53736. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  53737. }),
  53738. $globals.BlockClosureTest);
  53739. $core.addMethod(
  53740. $core.method({
  53741. selector: "testNewWithValues",
  53742. protocol: "tests",
  53743. fn: function (){
  53744. var self=this,$self=this;
  53745. return $core.withContext(function($ctx1) {
  53746. function TestConstructor(arg1, arg2, arg3) {}
  53747. TestConstructor.prototype.name = "theTestPrototype";
  53748. var wrappedConstructor = $recv(TestConstructor);
  53749. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  53750. $self._assert_(result instanceof TestConstructor);
  53751. $self._assert_equals_(result.name, "theTestPrototype");
  53752. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  53753. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  53754. return self;
  53755. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{})});
  53756. },
  53757. args: [],
  53758. 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'>",
  53759. referencedClasses: [],
  53760. pragmas: [["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);"]]],
  53761. messageSends: []
  53762. }),
  53763. $globals.BlockClosureTest);
  53764. $core.addMethod(
  53765. $core.method({
  53766. selector: "testNumArgs",
  53767. protocol: "tests",
  53768. fn: function (){
  53769. var self=this,$self=this;
  53770. return $core.withContext(function($ctx1) {
  53771. var $1;
  53772. $1=$recv((function(){
  53773. }))._numArgs();
  53774. $ctx1.sendIdx["numArgs"]=1;
  53775. $self._assert_equals_($1,(0));
  53776. $ctx1.sendIdx["assert:equals:"]=1;
  53777. $self._assert_equals_($recv((function(a,b){
  53778. }))._numArgs(),(2));
  53779. return self;
  53780. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{})});
  53781. },
  53782. args: [],
  53783. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  53784. referencedClasses: [],
  53785. pragmas: [],
  53786. messageSends: ["assert:equals:", "numArgs"]
  53787. }),
  53788. $globals.BlockClosureTest);
  53789. $core.addMethod(
  53790. $core.method({
  53791. selector: "testOnDo",
  53792. protocol: "tests",
  53793. fn: function (){
  53794. var self=this,$self=this;
  53795. return $core.withContext(function($ctx1) {
  53796. $self._assert_($recv((function(){
  53797. return $core.withContext(function($ctx2) {
  53798. return $recv($recv($globals.Error)._new())._signal();
  53799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53800. }))._on_do_($globals.Error,(function(ex){
  53801. return true;
  53802. })));
  53803. return self;
  53804. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{})});
  53805. },
  53806. args: [],
  53807. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  53808. referencedClasses: ["Error"],
  53809. pragmas: [],
  53810. messageSends: ["assert:", "on:do:", "signal", "new"]
  53811. }),
  53812. $globals.BlockClosureTest);
  53813. $core.addMethod(
  53814. $core.method({
  53815. selector: "testValue",
  53816. protocol: "tests",
  53817. fn: function (){
  53818. var self=this,$self=this;
  53819. return $core.withContext(function($ctx1) {
  53820. var $1;
  53821. $1=$recv((function(){
  53822. return $core.withContext(function($ctx2) {
  53823. return (1).__plus((1));
  53824. $ctx2.sendIdx["+"]=1;
  53825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53826. }))._value();
  53827. $ctx1.sendIdx["value"]=1;
  53828. $self._assert_equals_($1,(2));
  53829. $ctx1.sendIdx["assert:equals:"]=1;
  53830. $self._assert_equals_($recv((function(x){
  53831. return $core.withContext(function($ctx2) {
  53832. return $recv(x).__plus((1));
  53833. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53834. }))._value_((2)),(3));
  53835. $ctx1.sendIdx["assert:equals:"]=2;
  53836. $self._assert_equals_($recv((function(x,y){
  53837. return $core.withContext(function($ctx2) {
  53838. return $recv(x).__star(y);
  53839. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  53840. }))._value_value_((2),(4)),(8));
  53841. $ctx1.sendIdx["assert:equals:"]=3;
  53842. $self._assert_equals_($recv((function(a,b,c){
  53843. return (1);
  53844. }))._value(),(1));
  53845. return self;
  53846. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  53847. },
  53848. args: [],
  53849. 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",
  53850. referencedClasses: [],
  53851. pragmas: [],
  53852. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  53853. }),
  53854. $globals.BlockClosureTest);
  53855. $core.addMethod(
  53856. $core.method({
  53857. selector: "testValueWithPossibleArguments",
  53858. protocol: "tests",
  53859. fn: function (){
  53860. var self=this,$self=this;
  53861. return $core.withContext(function($ctx1) {
  53862. var $1,$2;
  53863. $1=$recv((function(){
  53864. return (1);
  53865. }))._valueWithPossibleArguments_([(3), (4)]);
  53866. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  53867. $self._assert_equals_($1,(1));
  53868. $ctx1.sendIdx["assert:equals:"]=1;
  53869. $2=$recv((function(a){
  53870. return $core.withContext(function($ctx2) {
  53871. return $recv(a).__plus((4));
  53872. $ctx2.sendIdx["+"]=1;
  53873. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  53874. }))._valueWithPossibleArguments_([(3), (4)]);
  53875. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  53876. $self._assert_equals_($2,(7));
  53877. $ctx1.sendIdx["assert:equals:"]=2;
  53878. $self._assert_equals_($recv((function(a,b){
  53879. return $core.withContext(function($ctx2) {
  53880. return $recv(a).__plus(b);
  53881. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  53882. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  53883. return self;
  53884. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{})});
  53885. },
  53886. args: [],
  53887. 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.",
  53888. referencedClasses: [],
  53889. pragmas: [],
  53890. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  53891. }),
  53892. $globals.BlockClosureTest);
  53893. $core.addMethod(
  53894. $core.method({
  53895. selector: "testWhileFalse",
  53896. protocol: "tests",
  53897. fn: function (){
  53898. var self=this,$self=this;
  53899. var i;
  53900. return $core.withContext(function($ctx1) {
  53901. i=(0);
  53902. $recv((function(){
  53903. return $core.withContext(function($ctx2) {
  53904. return $recv(i).__gt((5));
  53905. $ctx2.sendIdx[">"]=1;
  53906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53907. }))._whileFalse_((function(){
  53908. return $core.withContext(function($ctx2) {
  53909. i=$recv(i).__plus((1));
  53910. $ctx2.sendIdx["+"]=1;
  53911. return i;
  53912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53913. }));
  53914. $self._assert_equals_(i,(6));
  53915. $ctx1.sendIdx["assert:equals:"]=1;
  53916. i=(0);
  53917. $recv((function(){
  53918. return $core.withContext(function($ctx2) {
  53919. i=$recv(i).__plus((1));
  53920. return $recv(i).__gt((5));
  53921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53922. }))._whileFalse();
  53923. $self._assert_equals_(i,(6));
  53924. return self;
  53925. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i})});
  53926. },
  53927. args: [],
  53928. 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",
  53929. referencedClasses: [],
  53930. pragmas: [],
  53931. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  53932. }),
  53933. $globals.BlockClosureTest);
  53934. $core.addMethod(
  53935. $core.method({
  53936. selector: "testWhileTrue",
  53937. protocol: "tests",
  53938. fn: function (){
  53939. var self=this,$self=this;
  53940. var i;
  53941. return $core.withContext(function($ctx1) {
  53942. i=(0);
  53943. $recv((function(){
  53944. return $core.withContext(function($ctx2) {
  53945. return $recv(i).__lt((5));
  53946. $ctx2.sendIdx["<"]=1;
  53947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53948. }))._whileTrue_((function(){
  53949. return $core.withContext(function($ctx2) {
  53950. i=$recv(i).__plus((1));
  53951. $ctx2.sendIdx["+"]=1;
  53952. return i;
  53953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53954. }));
  53955. $self._assert_equals_(i,(5));
  53956. $ctx1.sendIdx["assert:equals:"]=1;
  53957. i=(0);
  53958. $recv((function(){
  53959. return $core.withContext(function($ctx2) {
  53960. i=$recv(i).__plus((1));
  53961. return $recv(i).__lt((5));
  53962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53963. }))._whileTrue();
  53964. $self._assert_equals_(i,(5));
  53965. return self;
  53966. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i})});
  53967. },
  53968. args: [],
  53969. 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",
  53970. referencedClasses: [],
  53971. pragmas: [],
  53972. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  53973. }),
  53974. $globals.BlockClosureTest);
  53975. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  53976. $core.addMethod(
  53977. $core.method({
  53978. selector: "testEquality",
  53979. protocol: "tests",
  53980. fn: function (){
  53981. var self=this,$self=this;
  53982. return $core.withContext(function($ctx1) {
  53983. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  53984. $1=(0).__eq(false);
  53985. $ctx1.sendIdx["="]=1;
  53986. $self._deny_($1);
  53987. $ctx1.sendIdx["deny:"]=1;
  53988. $2=false.__eq((0));
  53989. $ctx1.sendIdx["="]=2;
  53990. $self._deny_($2);
  53991. $ctx1.sendIdx["deny:"]=2;
  53992. $3="".__eq(false);
  53993. $ctx1.sendIdx["="]=3;
  53994. $self._deny_($3);
  53995. $ctx1.sendIdx["deny:"]=3;
  53996. $4=false.__eq("");
  53997. $ctx1.sendIdx["="]=4;
  53998. $self._deny_($4);
  53999. $ctx1.sendIdx["deny:"]=4;
  54000. $5=true.__eq(true);
  54001. $ctx1.sendIdx["="]=5;
  54002. $self._assert_($5);
  54003. $ctx1.sendIdx["assert:"]=1;
  54004. $6=false.__eq(true);
  54005. $ctx1.sendIdx["="]=6;
  54006. $self._deny_($6);
  54007. $ctx1.sendIdx["deny:"]=5;
  54008. $7=true.__eq(false);
  54009. $ctx1.sendIdx["="]=7;
  54010. $self._deny_($7);
  54011. $8=false.__eq(false);
  54012. $ctx1.sendIdx["="]=8;
  54013. $self._assert_($8);
  54014. $ctx1.sendIdx["assert:"]=2;
  54015. $10=true._yourself();
  54016. $ctx1.sendIdx["yourself"]=1;
  54017. $9=$recv($10).__eq(true);
  54018. $ctx1.sendIdx["="]=9;
  54019. $self._assert_($9);
  54020. $ctx1.sendIdx["assert:"]=3;
  54021. $12=true._yourself();
  54022. $ctx1.sendIdx["yourself"]=2;
  54023. $11=$recv($12).__eq(true._yourself());
  54024. $self._assert_($11);
  54025. return self;
  54026. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  54027. },
  54028. args: [],
  54029. 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)",
  54030. referencedClasses: [],
  54031. pragmas: [],
  54032. messageSends: ["deny:", "=", "assert:", "yourself"]
  54033. }),
  54034. $globals.BooleanTest);
  54035. $core.addMethod(
  54036. $core.method({
  54037. selector: "testIdentity",
  54038. protocol: "tests",
  54039. fn: function (){
  54040. var self=this,$self=this;
  54041. return $core.withContext(function($ctx1) {
  54042. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  54043. $1=(0).__eq_eq(false);
  54044. $ctx1.sendIdx["=="]=1;
  54045. $self._deny_($1);
  54046. $ctx1.sendIdx["deny:"]=1;
  54047. $2=false.__eq_eq((0));
  54048. $ctx1.sendIdx["=="]=2;
  54049. $self._deny_($2);
  54050. $ctx1.sendIdx["deny:"]=2;
  54051. $3="".__eq_eq(false);
  54052. $ctx1.sendIdx["=="]=3;
  54053. $self._deny_($3);
  54054. $ctx1.sendIdx["deny:"]=3;
  54055. $4=false.__eq_eq("");
  54056. $ctx1.sendIdx["=="]=4;
  54057. $self._deny_($4);
  54058. $ctx1.sendIdx["deny:"]=4;
  54059. $5=true.__eq_eq(true);
  54060. $ctx1.sendIdx["=="]=5;
  54061. $self._assert_($5);
  54062. $ctx1.sendIdx["assert:"]=1;
  54063. $6=false.__eq_eq(true);
  54064. $ctx1.sendIdx["=="]=6;
  54065. $self._deny_($6);
  54066. $ctx1.sendIdx["deny:"]=5;
  54067. $7=true.__eq_eq(false);
  54068. $ctx1.sendIdx["=="]=7;
  54069. $self._deny_($7);
  54070. $8=false.__eq_eq(false);
  54071. $ctx1.sendIdx["=="]=8;
  54072. $self._assert_($8);
  54073. $ctx1.sendIdx["assert:"]=2;
  54074. $10=true._yourself();
  54075. $ctx1.sendIdx["yourself"]=1;
  54076. $9=$recv($10).__eq_eq(true);
  54077. $ctx1.sendIdx["=="]=9;
  54078. $self._assert_($9);
  54079. $ctx1.sendIdx["assert:"]=3;
  54080. $12=true._yourself();
  54081. $ctx1.sendIdx["yourself"]=2;
  54082. $11=$recv($12).__eq_eq(true._yourself());
  54083. $self._assert_($11);
  54084. return self;
  54085. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  54086. },
  54087. args: [],
  54088. 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",
  54089. referencedClasses: [],
  54090. pragmas: [],
  54091. messageSends: ["deny:", "==", "assert:", "yourself"]
  54092. }),
  54093. $globals.BooleanTest);
  54094. $core.addMethod(
  54095. $core.method({
  54096. selector: "testIfTrueIfFalse",
  54097. protocol: "tests",
  54098. fn: function (){
  54099. var self=this,$self=this;
  54100. return $core.withContext(function($ctx1) {
  54101. var $1,$2,$3,$4,$5,$6,$7,$8;
  54102. if($core.assert(true)){
  54103. $1="alternative block";
  54104. }
  54105. $self._assert_equals_($1,"alternative block");
  54106. $ctx1.sendIdx["assert:equals:"]=1;
  54107. if(!$core.assert(true)){
  54108. $2="alternative block";
  54109. }
  54110. $self._assert_equals_($2,nil);
  54111. $ctx1.sendIdx["assert:equals:"]=2;
  54112. if($core.assert(false)){
  54113. $3="alternative block";
  54114. }
  54115. $self._assert_equals_($3,nil);
  54116. $ctx1.sendIdx["assert:equals:"]=3;
  54117. if(!$core.assert(false)){
  54118. $4="alternative block";
  54119. }
  54120. $self._assert_equals_($4,"alternative block");
  54121. $ctx1.sendIdx["assert:equals:"]=4;
  54122. if($core.assert(false)){
  54123. $5="alternative block";
  54124. } else {
  54125. $5="alternative block2";
  54126. }
  54127. $self._assert_equals_($5,"alternative block2");
  54128. $ctx1.sendIdx["assert:equals:"]=5;
  54129. if($core.assert(false)){
  54130. $6="alternative block2";
  54131. } else {
  54132. $6="alternative block";
  54133. }
  54134. $self._assert_equals_($6,"alternative block");
  54135. $ctx1.sendIdx["assert:equals:"]=6;
  54136. if($core.assert(true)){
  54137. $7="alternative block";
  54138. } else {
  54139. $7="alternative block2";
  54140. }
  54141. $self._assert_equals_($7,"alternative block");
  54142. $ctx1.sendIdx["assert:equals:"]=7;
  54143. if($core.assert(true)){
  54144. $8="alternative block2";
  54145. } else {
  54146. $8="alternative block";
  54147. }
  54148. $self._assert_equals_($8,"alternative block2");
  54149. return self;
  54150. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{})});
  54151. },
  54152. args: [],
  54153. 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'.",
  54154. referencedClasses: [],
  54155. pragmas: [],
  54156. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  54157. }),
  54158. $globals.BooleanTest);
  54159. $core.addMethod(
  54160. $core.method({
  54161. selector: "testIfTrueIfFalseWithBoxing",
  54162. protocol: "tests",
  54163. fn: function (){
  54164. var self=this,$self=this;
  54165. return $core.withContext(function($ctx1) {
  54166. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  54167. $2=true._yourself();
  54168. $ctx1.sendIdx["yourself"]=1;
  54169. if($core.assert($2)){
  54170. $1="alternative block";
  54171. }
  54172. $self._assert_equals_($1,"alternative block");
  54173. $ctx1.sendIdx["assert:equals:"]=1;
  54174. $4=true._yourself();
  54175. $ctx1.sendIdx["yourself"]=2;
  54176. if(!$core.assert($4)){
  54177. $3="alternative block";
  54178. }
  54179. $self._assert_equals_($3,nil);
  54180. $ctx1.sendIdx["assert:equals:"]=2;
  54181. $6=false._yourself();
  54182. $ctx1.sendIdx["yourself"]=3;
  54183. if($core.assert($6)){
  54184. $5="alternative block";
  54185. }
  54186. $self._assert_equals_($5,nil);
  54187. $ctx1.sendIdx["assert:equals:"]=3;
  54188. $8=false._yourself();
  54189. $ctx1.sendIdx["yourself"]=4;
  54190. if(!$core.assert($8)){
  54191. $7="alternative block";
  54192. }
  54193. $self._assert_equals_($7,"alternative block");
  54194. $ctx1.sendIdx["assert:equals:"]=4;
  54195. $10=false._yourself();
  54196. $ctx1.sendIdx["yourself"]=5;
  54197. if($core.assert($10)){
  54198. $9="alternative block";
  54199. } else {
  54200. $9="alternative block2";
  54201. }
  54202. $self._assert_equals_($9,"alternative block2");
  54203. $ctx1.sendIdx["assert:equals:"]=5;
  54204. $12=false._yourself();
  54205. $ctx1.sendIdx["yourself"]=6;
  54206. if($core.assert($12)){
  54207. $11="alternative block2";
  54208. } else {
  54209. $11="alternative block";
  54210. }
  54211. $self._assert_equals_($11,"alternative block");
  54212. $ctx1.sendIdx["assert:equals:"]=6;
  54213. $14=true._yourself();
  54214. $ctx1.sendIdx["yourself"]=7;
  54215. if($core.assert($14)){
  54216. $13="alternative block";
  54217. } else {
  54218. $13="alternative block2";
  54219. }
  54220. $self._assert_equals_($13,"alternative block");
  54221. $ctx1.sendIdx["assert:equals:"]=7;
  54222. $16=true._yourself();
  54223. if($core.assert($16)){
  54224. $15="alternative block2";
  54225. } else {
  54226. $15="alternative block";
  54227. }
  54228. $self._assert_equals_($15,"alternative block2");
  54229. return self;
  54230. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{})});
  54231. },
  54232. args: [],
  54233. 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'.",
  54234. referencedClasses: [],
  54235. pragmas: [],
  54236. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  54237. }),
  54238. $globals.BooleanTest);
  54239. $core.addMethod(
  54240. $core.method({
  54241. selector: "testLogic",
  54242. protocol: "tests",
  54243. fn: function (){
  54244. var self=this,$self=this;
  54245. return $core.withContext(function($ctx1) {
  54246. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$17,$16,$19,$18,$21,$20;
  54247. $1=true.__and(true);
  54248. $ctx1.sendIdx["&"]=1;
  54249. $self._assert_($1);
  54250. $ctx1.sendIdx["assert:"]=1;
  54251. $2=true.__and(false);
  54252. $ctx1.sendIdx["&"]=2;
  54253. $self._deny_($2);
  54254. $ctx1.sendIdx["deny:"]=1;
  54255. $3=false.__and(true);
  54256. $ctx1.sendIdx["&"]=3;
  54257. $self._deny_($3);
  54258. $ctx1.sendIdx["deny:"]=2;
  54259. $4=false.__and(false);
  54260. $ctx1.sendIdx["&"]=4;
  54261. $self._deny_($4);
  54262. $ctx1.sendIdx["deny:"]=3;
  54263. $5=true.__or(true);
  54264. $ctx1.sendIdx["|"]=1;
  54265. $self._assert_($5);
  54266. $ctx1.sendIdx["assert:"]=2;
  54267. $6=true.__or(false);
  54268. $ctx1.sendIdx["|"]=2;
  54269. $self._assert_($6);
  54270. $ctx1.sendIdx["assert:"]=3;
  54271. $7=false.__or(true);
  54272. $ctx1.sendIdx["|"]=3;
  54273. $self._assert_($7);
  54274. $ctx1.sendIdx["assert:"]=4;
  54275. $8=false.__or(false);
  54276. $ctx1.sendIdx["|"]=4;
  54277. $self._deny_($8);
  54278. $ctx1.sendIdx["deny:"]=4;
  54279. $10=(1).__gt((0));
  54280. $ctx1.sendIdx[">"]=1;
  54281. $9=true.__and($10);
  54282. $ctx1.sendIdx["&"]=5;
  54283. $self._assert_($9);
  54284. $ctx1.sendIdx["assert:"]=5;
  54285. $12=(1).__gt((0));
  54286. $ctx1.sendIdx[">"]=2;
  54287. $11=$recv($12).__and(false);
  54288. $ctx1.sendIdx["&"]=6;
  54289. $self._deny_($11);
  54290. $ctx1.sendIdx["deny:"]=5;
  54291. $14=(1).__gt((0));
  54292. $ctx1.sendIdx[">"]=3;
  54293. $15=(1).__gt((2));
  54294. $ctx1.sendIdx[">"]=4;
  54295. $13=$recv($14).__and($15);
  54296. $self._deny_($13);
  54297. $17=(1).__gt((0));
  54298. $ctx1.sendIdx[">"]=5;
  54299. $16=false.__or($17);
  54300. $ctx1.sendIdx["|"]=5;
  54301. $self._assert_($16);
  54302. $ctx1.sendIdx["assert:"]=6;
  54303. $19=(1).__gt((0));
  54304. $ctx1.sendIdx[">"]=6;
  54305. $18=$recv($19).__or(false);
  54306. $ctx1.sendIdx["|"]=6;
  54307. $self._assert_($18);
  54308. $ctx1.sendIdx["assert:"]=7;
  54309. $21=(1).__gt((0));
  54310. $ctx1.sendIdx[">"]=7;
  54311. $20=$recv($21).__or((1).__gt((2)));
  54312. $self._assert_($20);
  54313. return self;
  54314. }, function($ctx1) {$ctx1.fill(self,"testLogic",{})});
  54315. },
  54316. args: [],
  54317. 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))",
  54318. referencedClasses: [],
  54319. pragmas: [],
  54320. messageSends: ["assert:", "&", "deny:", "|", ">"]
  54321. }),
  54322. $globals.BooleanTest);
  54323. $core.addMethod(
  54324. $core.method({
  54325. selector: "testLogicKeywords",
  54326. protocol: "tests",
  54327. fn: function (){
  54328. var self=this,$self=this;
  54329. return $core.withContext(function($ctx1) {
  54330. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$11,$10,$13,$12,$14,$16,$15,$18,$17;
  54331. $1=true._and_((function(){
  54332. return true;
  54333. }));
  54334. $ctx1.sendIdx["and:"]=1;
  54335. $self._assert_($1);
  54336. $ctx1.sendIdx["assert:"]=1;
  54337. $2=true._and_((function(){
  54338. return false;
  54339. }));
  54340. $ctx1.sendIdx["and:"]=2;
  54341. $self._deny_($2);
  54342. $ctx1.sendIdx["deny:"]=1;
  54343. $3=false._and_((function(){
  54344. return true;
  54345. }));
  54346. $ctx1.sendIdx["and:"]=3;
  54347. $self._deny_($3);
  54348. $ctx1.sendIdx["deny:"]=2;
  54349. $4=false._and_((function(){
  54350. return false;
  54351. }));
  54352. $ctx1.sendIdx["and:"]=4;
  54353. $self._deny_($4);
  54354. $ctx1.sendIdx["deny:"]=3;
  54355. $5=true._or_((function(){
  54356. return true;
  54357. }));
  54358. $ctx1.sendIdx["or:"]=1;
  54359. $self._assert_($5);
  54360. $ctx1.sendIdx["assert:"]=2;
  54361. $6=true._or_((function(){
  54362. return false;
  54363. }));
  54364. $ctx1.sendIdx["or:"]=2;
  54365. $self._assert_($6);
  54366. $ctx1.sendIdx["assert:"]=3;
  54367. $7=false._or_((function(){
  54368. return true;
  54369. }));
  54370. $ctx1.sendIdx["or:"]=3;
  54371. $self._assert_($7);
  54372. $ctx1.sendIdx["assert:"]=4;
  54373. $8=false._or_((function(){
  54374. return false;
  54375. }));
  54376. $ctx1.sendIdx["or:"]=4;
  54377. $self._deny_($8);
  54378. $ctx1.sendIdx["deny:"]=4;
  54379. $9=true._and_((function(){
  54380. return $core.withContext(function($ctx2) {
  54381. return (1).__gt((0));
  54382. $ctx2.sendIdx[">"]=1;
  54383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  54384. }));
  54385. $ctx1.sendIdx["and:"]=5;
  54386. $self._assert_($9);
  54387. $ctx1.sendIdx["assert:"]=5;
  54388. $11=(1).__gt((0));
  54389. $ctx1.sendIdx[">"]=2;
  54390. $10=$recv($11)._and_((function(){
  54391. return false;
  54392. }));
  54393. $ctx1.sendIdx["and:"]=6;
  54394. $self._deny_($10);
  54395. $ctx1.sendIdx["deny:"]=5;
  54396. $13=(1).__gt((0));
  54397. $ctx1.sendIdx[">"]=3;
  54398. $12=$recv($13)._and_((function(){
  54399. return $core.withContext(function($ctx2) {
  54400. return (1).__gt((2));
  54401. $ctx2.sendIdx[">"]=4;
  54402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  54403. }));
  54404. $self._deny_($12);
  54405. $14=false._or_((function(){
  54406. return $core.withContext(function($ctx2) {
  54407. return (1).__gt((0));
  54408. $ctx2.sendIdx[">"]=5;
  54409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  54410. }));
  54411. $ctx1.sendIdx["or:"]=5;
  54412. $self._assert_($14);
  54413. $ctx1.sendIdx["assert:"]=6;
  54414. $16=(1).__gt((0));
  54415. $ctx1.sendIdx[">"]=6;
  54416. $15=$recv($16)._or_((function(){
  54417. return false;
  54418. }));
  54419. $ctx1.sendIdx["or:"]=6;
  54420. $self._assert_($15);
  54421. $ctx1.sendIdx["assert:"]=7;
  54422. $18=(1).__gt((0));
  54423. $ctx1.sendIdx[">"]=7;
  54424. $17=$recv($18)._or_((function(){
  54425. return $core.withContext(function($ctx2) {
  54426. return (1).__gt((2));
  54427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  54428. }));
  54429. $self._assert_($17);
  54430. return self;
  54431. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{})});
  54432. },
  54433. args: [],
  54434. 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 ])",
  54435. referencedClasses: [],
  54436. pragmas: [],
  54437. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  54438. }),
  54439. $globals.BooleanTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "testNonBooleanError",
  54443. protocol: "tests",
  54444. fn: function (){
  54445. var self=this,$self=this;
  54446. return $core.withContext(function($ctx1) {
  54447. $self._should_raise_((function(){
  54448. return $core.withContext(function($ctx2) {
  54449. if($core.assert("")){
  54450. } else {
  54451. }
  54452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54453. }),$globals.NonBooleanReceiver);
  54454. return self;
  54455. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{})});
  54456. },
  54457. args: [],
  54458. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  54459. referencedClasses: ["NonBooleanReceiver"],
  54460. pragmas: [],
  54461. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  54462. }),
  54463. $globals.BooleanTest);
  54464. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  54465. $core.addMethod(
  54466. $core.method({
  54467. selector: "setUp",
  54468. protocol: "running",
  54469. fn: function (){
  54470. var self=this,$self=this;
  54471. return $core.withContext(function($ctx1) {
  54472. $self.builder=$recv($globals.ClassBuilder)._new();
  54473. return self;
  54474. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  54475. },
  54476. args: [],
  54477. source: "setUp\x0a\x09builder := ClassBuilder new",
  54478. referencedClasses: ["ClassBuilder"],
  54479. pragmas: [],
  54480. messageSends: ["new"]
  54481. }),
  54482. $globals.ClassBuilderTest);
  54483. $core.addMethod(
  54484. $core.method({
  54485. selector: "tearDown",
  54486. protocol: "running",
  54487. fn: function (){
  54488. var self=this,$self=this;
  54489. return $core.withContext(function($ctx1) {
  54490. var $1,$receiver;
  54491. $1=$self.theClass;
  54492. if(($receiver = $1) == null || $receiver.a$nil){
  54493. $1;
  54494. } else {
  54495. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  54496. $self._deny_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  54497. $self._assert_equals_($recv($recv($globals.Smalltalk)._globals())._at_($recv($self.theClass)._name()),nil);
  54498. $self.theClass=nil;
  54499. $self.theClass;
  54500. }
  54501. return self;
  54502. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  54503. },
  54504. args: [],
  54505. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09self assert: (Smalltalk globals at: theClass name) equals: nil.\x0a\x09\x09theClass := nil ]",
  54506. referencedClasses: ["Smalltalk"],
  54507. pragmas: [],
  54508. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package", "assert:equals:", "at:", "globals", "name"]
  54509. }),
  54510. $globals.ClassBuilderTest);
  54511. $core.addMethod(
  54512. $core.method({
  54513. selector: "testAddTrait",
  54514. protocol: "tests",
  54515. fn: function (){
  54516. var self=this,$self=this;
  54517. return $core.withContext(function($ctx1) {
  54518. var $3,$2,$1,$4;
  54519. $self.theClass=$recv($self.builder)._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  54520. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54521. $ctx1.sendIdx["assert:equals:"]=1;
  54522. $3=$recv($self.theClass)._package();
  54523. $ctx1.sendIdx["package"]=1;
  54524. $2=$recv($3)._classes();
  54525. $1=$recv($2)._occurrencesOf_($self.theClass);
  54526. $self._assert_equals_($1,(1));
  54527. $ctx1.sendIdx["assert:equals:"]=2;
  54528. $4=$recv($self.theClass)._package();
  54529. $ctx1.sendIdx["package"]=2;
  54530. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  54531. return self;
  54532. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{})});
  54533. },
  54534. args: [],
  54535. 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",
  54536. referencedClasses: ["ObjectMock"],
  54537. pragmas: [],
  54538. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  54539. }),
  54540. $globals.ClassBuilderTest);
  54541. $core.addMethod(
  54542. $core.method({
  54543. selector: "testClassCopy",
  54544. protocol: "tests",
  54545. fn: function (){
  54546. var self=this,$self=this;
  54547. return $core.withContext(function($ctx1) {
  54548. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  54549. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54550. $2=$recv($self.theClass)._superclass();
  54551. $ctx1.sendIdx["superclass"]=1;
  54552. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54553. $ctx1.sendIdx["=="]=1;
  54554. $self._assert_($1);
  54555. $ctx1.sendIdx["assert:"]=1;
  54556. $4=$recv($self.theClass)._instanceVariableNames();
  54557. $ctx1.sendIdx["instanceVariableNames"]=1;
  54558. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54559. $ctx1.sendIdx["=="]=2;
  54560. $self._assert_($3);
  54561. $ctx1.sendIdx["assert:"]=2;
  54562. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54563. $ctx1.sendIdx["assert:equals:"]=1;
  54564. $6=$recv($self.theClass)._package();
  54565. $ctx1.sendIdx["package"]=1;
  54566. $7=$recv($globals.ObjectMock)._package();
  54567. $ctx1.sendIdx["package"]=2;
  54568. $5=$recv($6).__eq_eq($7);
  54569. $self._assert_($5);
  54570. $ctx1.sendIdx["assert:"]=3;
  54571. $self._assert_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  54572. $9=$recv($self.theClass)._methodDictionary();
  54573. $ctx1.sendIdx["methodDictionary"]=1;
  54574. $8=$recv($9)._keys();
  54575. $ctx1.sendIdx["keys"]=1;
  54576. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54577. return self;
  54578. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{})});
  54579. },
  54580. args: [],
  54581. 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",
  54582. referencedClasses: ["ObjectMock"],
  54583. pragmas: [],
  54584. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  54585. }),
  54586. $globals.ClassBuilderTest);
  54587. $core.addMethod(
  54588. $core.method({
  54589. selector: "testClassMigration",
  54590. protocol: "tests",
  54591. fn: function (){
  54592. var self=this,$self=this;
  54593. var instance,oldClass;
  54594. return $core.withContext(function($ctx1) {
  54595. var $2,$1,$3,$4,$5,$6,$8,$7,$10,$9;
  54596. oldClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54597. $2=$recv($globals.Smalltalk)._globals();
  54598. $ctx1.sendIdx["globals"]=1;
  54599. $1=$recv($2)._at_("ObjectMock2");
  54600. $ctx1.sendIdx["at:"]=1;
  54601. instance=$recv($1)._new();
  54602. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  54603. $3=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  54604. $ctx1.sendIdx["=="]=1;
  54605. $self._deny_($3);
  54606. $ctx1.sendIdx["deny:"]=1;
  54607. $4=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  54608. $ctx1.sendIdx["=="]=2;
  54609. $self._assert_($4);
  54610. $ctx1.sendIdx["assert:"]=1;
  54611. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  54612. $ctx1.sendIdx["assert:"]=2;
  54613. $5=$recv($globals.ObjectMock2)._selectors();
  54614. $ctx1.sendIdx["selectors"]=1;
  54615. $self._assert_equals_($5,$recv(oldClass)._selectors());
  54616. $ctx1.sendIdx["assert:equals:"]=1;
  54617. $6=$recv($globals.ObjectMock2)._comment();
  54618. $ctx1.sendIdx["comment"]=1;
  54619. $self._assert_equals_($6,$recv(oldClass)._comment());
  54620. $ctx1.sendIdx["assert:equals:"]=2;
  54621. $8=$recv($globals.ObjectMock2)._package();
  54622. $ctx1.sendIdx["package"]=1;
  54623. $7=$recv($8)._name();
  54624. $ctx1.sendIdx["name"]=1;
  54625. $self._assert_equals_($7,"Kernel-Tests");
  54626. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  54627. $ctx1.sendIdx["assert:"]=3;
  54628. $10=$recv(instance)._class();
  54629. $ctx1.sendIdx["class"]=1;
  54630. $9=$recv($10).__eq_eq($globals.ObjectMock2);
  54631. $self._deny_($9);
  54632. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  54633. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  54634. return self;
  54635. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass})});
  54636. },
  54637. args: [],
  54638. 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: #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",
  54639. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  54640. pragmas: [],
  54641. 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:"]
  54642. }),
  54643. $globals.ClassBuilderTest);
  54644. $core.addMethod(
  54645. $core.method({
  54646. selector: "testClassMigrationWithClassInstanceVariables",
  54647. protocol: "tests",
  54648. fn: function (){
  54649. var self=this,$self=this;
  54650. return $core.withContext(function($ctx1) {
  54651. var $1;
  54652. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54653. $1=$recv($globals.ObjectMock2)._class();
  54654. $ctx1.sendIdx["class"]=1;
  54655. $recv($1)._instanceVariableNames_("foo bar");
  54656. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"))._name(),"","Kernel-Tests");
  54657. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  54658. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  54659. return self;
  54660. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{})});
  54661. },
  54662. args: [],
  54663. 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') name\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",
  54664. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  54665. pragmas: [],
  54666. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "name", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  54667. }),
  54668. $globals.ClassBuilderTest);
  54669. $core.addMethod(
  54670. $core.method({
  54671. selector: "testClassMigrationWithSubclasses",
  54672. protocol: "tests",
  54673. fn: function (){
  54674. var self=this,$self=this;
  54675. return $core.withContext(function($ctx1) {
  54676. var $2,$1,$4,$3;
  54677. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54678. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  54679. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  54680. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  54681. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  54682. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  54683. $2=$recv($globals.ObjectMock)._subclasses();
  54684. $ctx1.sendIdx["subclasses"]=1;
  54685. $1=$recv($2)._includes_($globals.ObjectMock2);
  54686. $ctx1.sendIdx["includes:"]=1;
  54687. $self._assert_($1);
  54688. $ctx1.sendIdx["assert:"]=1;
  54689. $4=$recv($globals.ObjectMock2)._subclasses();
  54690. $ctx1.sendIdx["subclasses"]=2;
  54691. $3=$recv($4)._includes_($globals.ObjectMock3);
  54692. $ctx1.sendIdx["includes:"]=2;
  54693. $self._assert_($3);
  54694. $ctx1.sendIdx["assert:"]=2;
  54695. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  54696. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  54697. return $core.withContext(function($ctx2) {
  54698. return $recv($globals.Smalltalk)._removeClass_(each);
  54699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54700. }));
  54701. return self;
  54702. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{})});
  54703. },
  54704. args: [],
  54705. 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: '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 ]",
  54706. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "ObjectMock4", "Smalltalk"],
  54707. pragmas: [],
  54708. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  54709. }),
  54710. $globals.ClassBuilderTest);
  54711. $core.addMethod(
  54712. $core.method({
  54713. selector: "testSubclass",
  54714. protocol: "tests",
  54715. fn: function (){
  54716. var self=this,$self=this;
  54717. return $core.withContext(function($ctx1) {
  54718. var $3,$2,$1,$4;
  54719. $self.theClass=$recv($self.builder)._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2",["foo", "bar"],"Kernel-Tests");
  54720. $self._assert_equals_($recv($self.theClass)._superclass(),$globals.ObjectMock);
  54721. $ctx1.sendIdx["assert:equals:"]=1;
  54722. $self._assert_equals_($recv($self.theClass)._instanceVariableNames(),["foo", "bar"]);
  54723. $ctx1.sendIdx["assert:equals:"]=2;
  54724. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54725. $ctx1.sendIdx["assert:equals:"]=3;
  54726. $3=$recv($self.theClass)._package();
  54727. $ctx1.sendIdx["package"]=1;
  54728. $2=$recv($3)._classes();
  54729. $1=$recv($2)._occurrencesOf_($self.theClass);
  54730. $self._assert_equals_($1,(1));
  54731. $ctx1.sendIdx["assert:equals:"]=4;
  54732. $4=$recv($self.theClass)._package();
  54733. $ctx1.sendIdx["package"]=2;
  54734. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  54735. $ctx1.sendIdx["assert:equals:"]=5;
  54736. $self._assert_equals_($recv($recv($recv($self.theClass)._methodDictionary())._keys())._size(),(0));
  54737. return self;
  54738. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{})});
  54739. },
  54740. args: [],
  54741. 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",
  54742. referencedClasses: ["ObjectMock"],
  54743. pragmas: [],
  54744. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  54745. }),
  54746. $globals.ClassBuilderTest);
  54747. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  54748. $core.addMethod(
  54749. $core.method({
  54750. selector: "jsConstructor",
  54751. protocol: "running",
  54752. fn: function (){
  54753. var self=this,$self=this;
  54754. return $core.withContext(function($ctx1) {
  54755. function Foo(){}
  54756. Foo.prototype.valueOf = function () {return 4;};
  54757. return Foo;
  54758. ;
  54759. return self;
  54760. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{})});
  54761. },
  54762. args: [],
  54763. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  54764. referencedClasses: [],
  54765. pragmas: [["inlineJS:", ["\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09"]]],
  54766. messageSends: []
  54767. }),
  54768. $globals.ClassTest);
  54769. $core.addMethod(
  54770. $core.method({
  54771. selector: "setUp",
  54772. protocol: "running",
  54773. fn: function (){
  54774. var self=this,$self=this;
  54775. return $core.withContext(function($ctx1) {
  54776. $self.builder=$recv($globals.ClassBuilder)._new();
  54777. return self;
  54778. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  54779. },
  54780. args: [],
  54781. source: "setUp\x0a\x09builder := ClassBuilder new",
  54782. referencedClasses: ["ClassBuilder"],
  54783. pragmas: [],
  54784. messageSends: ["new"]
  54785. }),
  54786. $globals.ClassTest);
  54787. $core.addMethod(
  54788. $core.method({
  54789. selector: "tearDown",
  54790. protocol: "running",
  54791. fn: function (){
  54792. var self=this,$self=this;
  54793. return $core.withContext(function($ctx1) {
  54794. var $1,$receiver;
  54795. $1=$self.theClass;
  54796. if(($receiver = $1) == null || $receiver.a$nil){
  54797. $1;
  54798. } else {
  54799. $recv($recv($self.theClass)._allSubclasses())._reverseDo_((function(each){
  54800. return $core.withContext(function($ctx2) {
  54801. return $recv($globals.Smalltalk)._removeClass_(each);
  54802. $ctx2.sendIdx["removeClass:"]=1;
  54803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54804. }));
  54805. $recv($globals.Smalltalk)._removeClass_($self.theClass);
  54806. $self.theClass=nil;
  54807. $self.theClass;
  54808. }
  54809. return self;
  54810. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  54811. },
  54812. args: [],
  54813. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  54814. referencedClasses: ["Smalltalk"],
  54815. pragmas: [],
  54816. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  54817. }),
  54818. $globals.ClassTest);
  54819. $core.addMethod(
  54820. $core.method({
  54821. selector: "testAllSubclasses",
  54822. protocol: "tests",
  54823. fn: function (){
  54824. var self=this,$self=this;
  54825. var subclasses,index;
  54826. return $core.withContext(function($ctx1) {
  54827. subclasses=$recv($globals.Object)._subclasses();
  54828. $ctx1.sendIdx["subclasses"]=1;
  54829. index=(1);
  54830. $recv((function(){
  54831. return $core.withContext(function($ctx2) {
  54832. return $recv(index).__gt($recv(subclasses)._size());
  54833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54834. }))._whileFalse_((function(){
  54835. return $core.withContext(function($ctx2) {
  54836. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  54837. index=$recv(index).__plus((1));
  54838. return index;
  54839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54840. }));
  54841. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  54842. return self;
  54843. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index})});
  54844. },
  54845. args: [],
  54846. 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",
  54847. referencedClasses: ["Object"],
  54848. pragmas: [],
  54849. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  54850. }),
  54851. $globals.ClassTest);
  54852. $core.addMethod(
  54853. $core.method({
  54854. selector: "testMetaclassSubclasses",
  54855. protocol: "tests",
  54856. fn: function (){
  54857. var self=this,$self=this;
  54858. var subclasses;
  54859. return $core.withContext(function($ctx1) {
  54860. var $4,$3,$2,$1;
  54861. $4=$recv($globals.Object)._class();
  54862. $ctx1.sendIdx["class"]=1;
  54863. $3=$recv($4)._instanceClass();
  54864. $2=$recv($3)._subclasses();
  54865. $ctx1.sendIdx["subclasses"]=1;
  54866. $1=$recv($2)._select_((function(each){
  54867. return $core.withContext(function($ctx2) {
  54868. return $recv($recv(each)._isMetaclass())._not();
  54869. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54870. }));
  54871. subclasses=$recv($1)._collect_((function(each){
  54872. return $core.withContext(function($ctx2) {
  54873. return $recv(each)._theMetaClass();
  54874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54875. }));
  54876. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  54877. return self;
  54878. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses})});
  54879. },
  54880. args: [],
  54881. 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",
  54882. referencedClasses: ["Object"],
  54883. pragmas: [],
  54884. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  54885. }),
  54886. $globals.ClassTest);
  54887. $core.addMethod(
  54888. $core.method({
  54889. selector: "testSetJavaScriptConstructor",
  54890. protocol: "tests",
  54891. fn: function (){
  54892. var self=this,$self=this;
  54893. var instance;
  54894. return $core.withContext(function($ctx1) {
  54895. var $2,$1,$4,$3,$6,$5,$8,$7;
  54896. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54897. $recv($self.theClass)._javascriptConstructor_($self._jsConstructor());
  54898. $2=$recv($self.theClass)._superclass();
  54899. $ctx1.sendIdx["superclass"]=1;
  54900. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54901. $ctx1.sendIdx["=="]=1;
  54902. $self._assert_($1);
  54903. $ctx1.sendIdx["assert:"]=1;
  54904. $4=$recv($self.theClass)._instanceVariableNames();
  54905. $ctx1.sendIdx["instanceVariableNames"]=1;
  54906. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54907. $ctx1.sendIdx["=="]=2;
  54908. $self._assert_($3);
  54909. $ctx1.sendIdx["assert:"]=2;
  54910. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54911. $ctx1.sendIdx["assert:equals:"]=1;
  54912. $6=$recv($self.theClass)._package();
  54913. $ctx1.sendIdx["package"]=1;
  54914. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  54915. $ctx1.sendIdx["=="]=3;
  54916. $self._assert_($5);
  54917. $ctx1.sendIdx["assert:"]=3;
  54918. $8=$recv($self.theClass)._methodDictionary();
  54919. $ctx1.sendIdx["methodDictionary"]=1;
  54920. $7=$recv($8)._keys();
  54921. $ctx1.sendIdx["keys"]=1;
  54922. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54923. $ctx1.sendIdx["assert:equals:"]=2;
  54924. instance=$recv($self.theClass)._new();
  54925. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  54926. $self._assert_equals_($recv(instance)._value(),(4));
  54927. $ctx1.sendIdx["assert:equals:"]=3;
  54928. $self._shouldnt_raise_((function(){
  54929. return $core.withContext(function($ctx2) {
  54930. return $recv(instance)._foo_((9));
  54931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54932. }),$globals.Error);
  54933. $self._assert_equals_($recv(instance)._foo(),(9));
  54934. return self;
  54935. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance})});
  54936. },
  54937. args: [],
  54938. 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",
  54939. referencedClasses: ["ObjectMock", "Error"],
  54940. pragmas: [],
  54941. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  54942. }),
  54943. $globals.ClassTest);
  54944. $core.addMethod(
  54945. $core.method({
  54946. selector: "testSlotsFromInstanceVariablesString",
  54947. protocol: "tests",
  54948. fn: function (){
  54949. var self=this,$self=this;
  54950. return $core.withContext(function($ctx1) {
  54951. $self._assert_equals_(" hello world "._instanceVariablesStringAsSlotList(),["hello", "world"]);
  54952. return self;
  54953. }, function($ctx1) {$ctx1.fill(self,"testSlotsFromInstanceVariablesString",{})});
  54954. },
  54955. args: [],
  54956. source: "testSlotsFromInstanceVariablesString\x0a\x09self assert: ' hello world ' instanceVariablesStringAsSlotList equals: #('hello' 'world')",
  54957. referencedClasses: [],
  54958. pragmas: [],
  54959. messageSends: ["assert:equals:", "instanceVariablesStringAsSlotList"]
  54960. }),
  54961. $globals.ClassTest);
  54962. $core.addMethod(
  54963. $core.method({
  54964. selector: "testTrickySetJavaScriptConstructor",
  54965. protocol: "tests",
  54966. fn: function (){
  54967. var self=this,$self=this;
  54968. var instance;
  54969. return $core.withContext(function($ctx1) {
  54970. var $2,$1,$4,$3,$6,$5,$8,$7;
  54971. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  54972. $recv($self.theClass)._javascriptConstructor_($self._trickyJsConstructor());
  54973. $2=$recv($self.theClass)._superclass();
  54974. $ctx1.sendIdx["superclass"]=1;
  54975. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  54976. $ctx1.sendIdx["=="]=1;
  54977. $self._assert_($1);
  54978. $ctx1.sendIdx["assert:"]=1;
  54979. $4=$recv($self.theClass)._instanceVariableNames();
  54980. $ctx1.sendIdx["instanceVariableNames"]=1;
  54981. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  54982. $ctx1.sendIdx["=="]=2;
  54983. $self._assert_($3);
  54984. $ctx1.sendIdx["assert:"]=2;
  54985. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  54986. $ctx1.sendIdx["assert:equals:"]=1;
  54987. $6=$recv($self.theClass)._package();
  54988. $ctx1.sendIdx["package"]=1;
  54989. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  54990. $ctx1.sendIdx["=="]=3;
  54991. $self._assert_($5);
  54992. $ctx1.sendIdx["assert:"]=3;
  54993. $8=$recv($self.theClass)._methodDictionary();
  54994. $ctx1.sendIdx["methodDictionary"]=1;
  54995. $7=$recv($8)._keys();
  54996. $ctx1.sendIdx["keys"]=1;
  54997. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  54998. $ctx1.sendIdx["assert:equals:"]=2;
  54999. instance=$recv($self.theClass)._new();
  55000. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  55001. $self._assert_equals_($recv(instance)._value(),(4));
  55002. $ctx1.sendIdx["assert:equals:"]=3;
  55003. $self._shouldnt_raise_((function(){
  55004. return $core.withContext(function($ctx2) {
  55005. return $recv(instance)._foo_((9));
  55006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55007. }),$globals.Error);
  55008. $self._assert_equals_($recv(instance)._foo(),(9));
  55009. return self;
  55010. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance})});
  55011. },
  55012. args: [],
  55013. 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",
  55014. referencedClasses: ["ObjectMock", "Error"],
  55015. pragmas: [],
  55016. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  55017. }),
  55018. $globals.ClassTest);
  55019. $core.addMethod(
  55020. $core.method({
  55021. selector: "trickyJsConstructor",
  55022. protocol: "running",
  55023. fn: function (){
  55024. var self=this,$self=this;
  55025. return $core.withContext(function($ctx1) {
  55026. function Foo(){}
  55027. Foo.prototype.valueOf = function () {return 4;};
  55028. Foo.prototype._foo = function () {return "bar";};
  55029. return Foo;
  55030. ;
  55031. return self;
  55032. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{})});
  55033. },
  55034. args: [],
  55035. 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'>",
  55036. referencedClasses: [],
  55037. pragmas: [["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"]]],
  55038. messageSends: []
  55039. }),
  55040. $globals.ClassTest);
  55041. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  55042. $core.addMethod(
  55043. $core.method({
  55044. selector: "assertSameContents:as:",
  55045. protocol: "convenience",
  55046. fn: function (aCollection,anotherCollection){
  55047. var self=this,$self=this;
  55048. return $core.withContext(function($ctx1) {
  55049. var $2,$1,$4,$3;
  55050. $2=$recv(aCollection)._size();
  55051. $ctx1.sendIdx["size"]=1;
  55052. $1=$recv($2).__eq($recv(anotherCollection)._size());
  55053. $ctx1.sendIdx["="]=1;
  55054. $self._assert_($1);
  55055. $ctx1.sendIdx["assert:"]=1;
  55056. $recv(aCollection)._do_((function(each){
  55057. return $core.withContext(function($ctx2) {
  55058. $4=$recv(aCollection)._occurrencesOf_(each);
  55059. $ctx2.sendIdx["occurrencesOf:"]=1;
  55060. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  55061. return $self._assert_($3);
  55062. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55063. }));
  55064. return self;
  55065. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection})});
  55066. },
  55067. args: ["aCollection", "anotherCollection"],
  55068. 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)) ]",
  55069. referencedClasses: [],
  55070. pragmas: [],
  55071. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  55072. }),
  55073. $globals.CollectionTest);
  55074. $core.addMethod(
  55075. $core.method({
  55076. selector: "collection",
  55077. protocol: "fixture",
  55078. fn: function (){
  55079. var self=this,$self=this;
  55080. return $core.withContext(function($ctx1) {
  55081. $self._subclassResponsibility();
  55082. return self;
  55083. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  55084. },
  55085. args: [],
  55086. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  55087. referencedClasses: [],
  55088. pragmas: [],
  55089. messageSends: ["subclassResponsibility"]
  55090. }),
  55091. $globals.CollectionTest);
  55092. $core.addMethod(
  55093. $core.method({
  55094. selector: "collectionClass",
  55095. protocol: "fixture",
  55096. fn: function (){
  55097. var self=this,$self=this;
  55098. return $core.withContext(function($ctx1) {
  55099. return $recv($self._class())._collectionClass();
  55100. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  55101. },
  55102. args: [],
  55103. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  55104. referencedClasses: [],
  55105. pragmas: [],
  55106. messageSends: ["collectionClass", "class"]
  55107. }),
  55108. $globals.CollectionTest);
  55109. $core.addMethod(
  55110. $core.method({
  55111. selector: "collectionOfPrintStrings",
  55112. protocol: "fixture",
  55113. fn: function (){
  55114. var self=this,$self=this;
  55115. return $core.withContext(function($ctx1) {
  55116. $self._subclassResponsibility();
  55117. return self;
  55118. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  55119. },
  55120. args: [],
  55121. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  55122. referencedClasses: [],
  55123. pragmas: [],
  55124. messageSends: ["subclassResponsibility"]
  55125. }),
  55126. $globals.CollectionTest);
  55127. $core.addMethod(
  55128. $core.method({
  55129. selector: "collectionSize",
  55130. protocol: "fixture",
  55131. fn: function (){
  55132. var self=this,$self=this;
  55133. return $core.withContext(function($ctx1) {
  55134. $self._subclassResponsibility();
  55135. return self;
  55136. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{})});
  55137. },
  55138. args: [],
  55139. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  55140. referencedClasses: [],
  55141. pragmas: [],
  55142. messageSends: ["subclassResponsibility"]
  55143. }),
  55144. $globals.CollectionTest);
  55145. $core.addMethod(
  55146. $core.method({
  55147. selector: "collectionWithDuplicates",
  55148. protocol: "fixture",
  55149. fn: function (){
  55150. var self=this,$self=this;
  55151. return $core.withContext(function($ctx1) {
  55152. $self._subclassResponsibility();
  55153. return self;
  55154. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  55155. },
  55156. args: [],
  55157. 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",
  55158. referencedClasses: [],
  55159. pragmas: [],
  55160. messageSends: ["subclassResponsibility"]
  55161. }),
  55162. $globals.CollectionTest);
  55163. $core.addMethod(
  55164. $core.method({
  55165. selector: "collectionWithNewValue",
  55166. protocol: "fixture",
  55167. fn: function (){
  55168. var self=this,$self=this;
  55169. return $core.withContext(function($ctx1) {
  55170. $self._subclassResponsibility();
  55171. return self;
  55172. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  55173. },
  55174. args: [],
  55175. 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",
  55176. referencedClasses: [],
  55177. pragmas: [],
  55178. messageSends: ["subclassResponsibility"]
  55179. }),
  55180. $globals.CollectionTest);
  55181. $core.addMethod(
  55182. $core.method({
  55183. selector: "initialize",
  55184. protocol: "initialization",
  55185. fn: function (){
  55186. var self=this,$self=this;
  55187. return $core.withContext(function($ctx1) {
  55188. (
  55189. $ctx1.supercall = true,
  55190. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  55191. $ctx1.supercall = false;
  55192. $self.sampleBlock=(function(){
  55193. });
  55194. return self;
  55195. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  55196. },
  55197. args: [],
  55198. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  55199. referencedClasses: [],
  55200. pragmas: [],
  55201. messageSends: ["initialize"]
  55202. }),
  55203. $globals.CollectionTest);
  55204. $core.addMethod(
  55205. $core.method({
  55206. selector: "sampleNewValue",
  55207. protocol: "fixture",
  55208. fn: function (){
  55209. var self=this,$self=this;
  55210. return "N";
  55211. },
  55212. args: [],
  55213. 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'",
  55214. referencedClasses: [],
  55215. pragmas: [],
  55216. messageSends: []
  55217. }),
  55218. $globals.CollectionTest);
  55219. $core.addMethod(
  55220. $core.method({
  55221. selector: "sampleNewValueAsCollection",
  55222. protocol: "fixture",
  55223. fn: function (){
  55224. var self=this,$self=this;
  55225. return $core.withContext(function($ctx1) {
  55226. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  55227. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  55228. },
  55229. args: [],
  55230. 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",
  55231. referencedClasses: [],
  55232. pragmas: [],
  55233. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  55234. }),
  55235. $globals.CollectionTest);
  55236. $core.addMethod(
  55237. $core.method({
  55238. selector: "testAddAll",
  55239. protocol: "tests",
  55240. fn: function (){
  55241. var self=this,$self=this;
  55242. return $core.withContext(function($ctx1) {
  55243. 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;
  55244. $2=$self._collection();
  55245. $ctx1.sendIdx["collection"]=1;
  55246. $4=$self._collectionClass();
  55247. $ctx1.sendIdx["collectionClass"]=1;
  55248. $3=$recv($4)._new();
  55249. $ctx1.sendIdx["new"]=1;
  55250. $recv($2)._addAll_($3);
  55251. $ctx1.sendIdx["addAll:"]=1;
  55252. $5=$recv($2)._yourself();
  55253. $ctx1.sendIdx["yourself"]=1;
  55254. $1=$5;
  55255. $6=$self._collection();
  55256. $ctx1.sendIdx["collection"]=2;
  55257. $self._assert_equals_($1,$6);
  55258. $ctx1.sendIdx["assert:equals:"]=1;
  55259. $9=$self._collectionClass();
  55260. $ctx1.sendIdx["collectionClass"]=2;
  55261. $8=$recv($9)._new();
  55262. $ctx1.sendIdx["new"]=2;
  55263. $10=$self._collection();
  55264. $ctx1.sendIdx["collection"]=3;
  55265. $recv($8)._addAll_($10);
  55266. $ctx1.sendIdx["addAll:"]=2;
  55267. $11=$recv($8)._yourself();
  55268. $ctx1.sendIdx["yourself"]=2;
  55269. $7=$11;
  55270. $12=$self._collection();
  55271. $ctx1.sendIdx["collection"]=4;
  55272. $self._assert_equals_($7,$12);
  55273. $ctx1.sendIdx["assert:equals:"]=2;
  55274. $15=$self._collectionClass();
  55275. $ctx1.sendIdx["collectionClass"]=3;
  55276. $14=$recv($15)._new();
  55277. $ctx1.sendIdx["new"]=3;
  55278. $17=$self._collectionClass();
  55279. $ctx1.sendIdx["collectionClass"]=4;
  55280. $16=$recv($17)._new();
  55281. $ctx1.sendIdx["new"]=4;
  55282. $recv($14)._addAll_($16);
  55283. $ctx1.sendIdx["addAll:"]=3;
  55284. $18=$recv($14)._yourself();
  55285. $ctx1.sendIdx["yourself"]=3;
  55286. $13=$18;
  55287. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  55288. $ctx1.sendIdx["assert:equals:"]=3;
  55289. $20=$self._collection();
  55290. $ctx1.sendIdx["collection"]=5;
  55291. $21=$self._sampleNewValueAsCollection();
  55292. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  55293. $recv($20)._addAll_($21);
  55294. $ctx1.sendIdx["addAll:"]=4;
  55295. $22=$recv($20)._yourself();
  55296. $ctx1.sendIdx["yourself"]=4;
  55297. $19=$22;
  55298. $23=$self._collectionWithNewValue();
  55299. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55300. $self._assert_equals_($19,$23);
  55301. $25=$self._sampleNewValueAsCollection();
  55302. $recv($25)._addAll_($self._collection());
  55303. $24=$recv($25)._yourself();
  55304. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  55305. return self;
  55306. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  55307. },
  55308. args: [],
  55309. 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",
  55310. referencedClasses: [],
  55311. pragmas: [],
  55312. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  55313. }),
  55314. $globals.CollectionTest);
  55315. $core.addMethod(
  55316. $core.method({
  55317. selector: "testAllSatisfy",
  55318. protocol: "tests",
  55319. fn: function (){
  55320. var self=this,$self=this;
  55321. var collection,anyOne;
  55322. return $core.withContext(function($ctx1) {
  55323. var $1;
  55324. collection=$self._collection();
  55325. anyOne=$recv(collection)._anyOne();
  55326. $1=$recv(collection)._allSatisfy_((function(each){
  55327. return $core.withContext(function($ctx2) {
  55328. return $recv(collection)._includes_(each);
  55329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55330. }));
  55331. $ctx1.sendIdx["allSatisfy:"]=1;
  55332. $self._assert_($1);
  55333. $self._deny_($recv(collection)._allSatisfy_((function(each){
  55334. return $core.withContext(function($ctx2) {
  55335. return $recv(each).__tild_eq(anyOne);
  55336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55337. })));
  55338. return self;
  55339. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne})});
  55340. },
  55341. args: [],
  55342. 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 ])",
  55343. referencedClasses: [],
  55344. pragmas: [],
  55345. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  55346. }),
  55347. $globals.CollectionTest);
  55348. $core.addMethod(
  55349. $core.method({
  55350. selector: "testAnyOne",
  55351. protocol: "tests",
  55352. fn: function (){
  55353. var self=this,$self=this;
  55354. return $core.withContext(function($ctx1) {
  55355. var $2,$1;
  55356. $self._should_raise_((function(){
  55357. return $core.withContext(function($ctx2) {
  55358. return $recv($recv($self._collectionClass())._new())._anyOne();
  55359. $ctx2.sendIdx["anyOne"]=1;
  55360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55361. }),$globals.Error);
  55362. $2=$self._collection();
  55363. $ctx1.sendIdx["collection"]=1;
  55364. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  55365. $self._assert_($1);
  55366. return self;
  55367. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{})});
  55368. },
  55369. args: [],
  55370. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  55371. referencedClasses: ["Error"],
  55372. pragmas: [],
  55373. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  55374. }),
  55375. $globals.CollectionTest);
  55376. $core.addMethod(
  55377. $core.method({
  55378. selector: "testAnySatisfy",
  55379. protocol: "tests",
  55380. fn: function (){
  55381. var self=this,$self=this;
  55382. var anyOne;
  55383. return $core.withContext(function($ctx1) {
  55384. var $1,$3,$2;
  55385. $1=$self._collection();
  55386. $ctx1.sendIdx["collection"]=1;
  55387. anyOne=$recv($1)._anyOne();
  55388. $3=$self._collection();
  55389. $ctx1.sendIdx["collection"]=2;
  55390. $2=$recv($3)._anySatisfy_((function(each){
  55391. return $core.withContext(function($ctx2) {
  55392. return $recv(each).__eq(anyOne);
  55393. $ctx2.sendIdx["="]=1;
  55394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55395. }));
  55396. $ctx1.sendIdx["anySatisfy:"]=1;
  55397. $self._assert_($2);
  55398. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  55399. return $core.withContext(function($ctx2) {
  55400. return $recv(each).__eq($recv($globals.Object)._new());
  55401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55402. })));
  55403. return self;
  55404. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne})});
  55405. },
  55406. args: [],
  55407. 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 ])",
  55408. referencedClasses: ["Object"],
  55409. pragmas: [],
  55410. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  55411. }),
  55412. $globals.CollectionTest);
  55413. $core.addMethod(
  55414. $core.method({
  55415. selector: "testAsArray",
  55416. protocol: "tests",
  55417. fn: function (){
  55418. var self=this,$self=this;
  55419. return $core.withContext(function($ctx1) {
  55420. var $1;
  55421. $1=$self._collection();
  55422. $ctx1.sendIdx["collection"]=1;
  55423. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  55424. return self;
  55425. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  55426. },
  55427. args: [],
  55428. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  55429. referencedClasses: [],
  55430. pragmas: [],
  55431. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  55432. }),
  55433. $globals.CollectionTest);
  55434. $core.addMethod(
  55435. $core.method({
  55436. selector: "testAsOrderedCollection",
  55437. protocol: "tests",
  55438. fn: function (){
  55439. var self=this,$self=this;
  55440. return $core.withContext(function($ctx1) {
  55441. var $1;
  55442. $1=$self._collection();
  55443. $ctx1.sendIdx["collection"]=1;
  55444. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  55445. return self;
  55446. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{})});
  55447. },
  55448. args: [],
  55449. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  55450. referencedClasses: [],
  55451. pragmas: [],
  55452. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  55453. }),
  55454. $globals.CollectionTest);
  55455. $core.addMethod(
  55456. $core.method({
  55457. selector: "testAsSet",
  55458. protocol: "tests",
  55459. fn: function (){
  55460. var self=this,$self=this;
  55461. var c,set;
  55462. return $core.withContext(function($ctx1) {
  55463. c=$self._collectionWithDuplicates();
  55464. set=$recv(c)._asSet();
  55465. $self._assert_equals_($recv(set)._size(),(6));
  55466. $recv(c)._do_((function(each){
  55467. return $core.withContext(function($ctx2) {
  55468. return $self._assert_($recv(set)._includes_(each));
  55469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55470. }));
  55471. return self;
  55472. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set})});
  55473. },
  55474. args: [],
  55475. 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) ]",
  55476. referencedClasses: [],
  55477. pragmas: [],
  55478. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  55479. }),
  55480. $globals.CollectionTest);
  55481. $core.addMethod(
  55482. $core.method({
  55483. selector: "testCollect",
  55484. protocol: "tests",
  55485. fn: function (){
  55486. var self=this,$self=this;
  55487. return $core.withContext(function($ctx1) {
  55488. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  55489. $2=$self._collection();
  55490. $ctx1.sendIdx["collection"]=1;
  55491. $1=$recv($2)._collect_((function(each){
  55492. return each;
  55493. }));
  55494. $ctx1.sendIdx["collect:"]=1;
  55495. $3=$self._collection();
  55496. $ctx1.sendIdx["collection"]=2;
  55497. $self._assert_equals_($1,$3);
  55498. $ctx1.sendIdx["assert:equals:"]=1;
  55499. $5=$self._collectionWithNewValue();
  55500. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55501. $4=$recv($5)._collect_((function(each){
  55502. return each;
  55503. }));
  55504. $ctx1.sendIdx["collect:"]=2;
  55505. $self._assert_equals_($4,$self._collectionWithNewValue());
  55506. $ctx1.sendIdx["assert:equals:"]=2;
  55507. $8=$self._collectionClass();
  55508. $ctx1.sendIdx["collectionClass"]=1;
  55509. $7=$recv($8)._new();
  55510. $ctx1.sendIdx["new"]=1;
  55511. $6=$recv($7)._collect_((function(each){
  55512. return $core.withContext(function($ctx2) {
  55513. return $recv(each)._printString();
  55514. $ctx2.sendIdx["printString"]=1;
  55515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  55516. }));
  55517. $ctx1.sendIdx["collect:"]=3;
  55518. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  55519. $ctx1.sendIdx["assert:equals:"]=3;
  55520. $11=$self._collection();
  55521. $ctx1.sendIdx["collection"]=3;
  55522. $10=$recv($11)._collect_((function(){
  55523. return $core.withContext(function($ctx2) {
  55524. return $self._sampleNewValue();
  55525. $ctx2.sendIdx["sampleNewValue"]=1;
  55526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55527. }));
  55528. $ctx1.sendIdx["collect:"]=4;
  55529. $9=$recv($10)._detect_((function(){
  55530. return true;
  55531. }));
  55532. $self._assert_equals_($9,$self._sampleNewValue());
  55533. $ctx1.sendIdx["assert:equals:"]=4;
  55534. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  55535. return $core.withContext(function($ctx2) {
  55536. return $recv(each)._printString();
  55537. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  55538. })),$self._collectionOfPrintStrings());
  55539. return self;
  55540. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  55541. },
  55542. args: [],
  55543. 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",
  55544. referencedClasses: [],
  55545. pragmas: [],
  55546. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  55547. }),
  55548. $globals.CollectionTest);
  55549. $core.addMethod(
  55550. $core.method({
  55551. selector: "testComma",
  55552. protocol: "tests",
  55553. fn: function (){
  55554. var self=this,$self=this;
  55555. return $core.withContext(function($ctx1) {
  55556. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  55557. $2=$self._collection();
  55558. $ctx1.sendIdx["collection"]=1;
  55559. $4=$self._collectionClass();
  55560. $ctx1.sendIdx["collectionClass"]=1;
  55561. $3=$recv($4)._new();
  55562. $ctx1.sendIdx["new"]=1;
  55563. $1=$recv($2).__comma($3);
  55564. $ctx1.sendIdx[","]=1;
  55565. $5=$self._collection();
  55566. $ctx1.sendIdx["collection"]=2;
  55567. $self._assert_equals_($1,$5);
  55568. $ctx1.sendIdx["assert:equals:"]=1;
  55569. $8=$self._collectionClass();
  55570. $ctx1.sendIdx["collectionClass"]=2;
  55571. $7=$recv($8)._new();
  55572. $ctx1.sendIdx["new"]=2;
  55573. $9=$self._collection();
  55574. $ctx1.sendIdx["collection"]=3;
  55575. $6=$recv($7).__comma($9);
  55576. $ctx1.sendIdx[","]=2;
  55577. $10=$self._collection();
  55578. $ctx1.sendIdx["collection"]=4;
  55579. $self._assert_equals_($6,$10);
  55580. $ctx1.sendIdx["assert:equals:"]=2;
  55581. $13=$self._collectionClass();
  55582. $ctx1.sendIdx["collectionClass"]=3;
  55583. $12=$recv($13)._new();
  55584. $ctx1.sendIdx["new"]=3;
  55585. $15=$self._collectionClass();
  55586. $ctx1.sendIdx["collectionClass"]=4;
  55587. $14=$recv($15)._new();
  55588. $ctx1.sendIdx["new"]=4;
  55589. $11=$recv($12).__comma($14);
  55590. $ctx1.sendIdx[","]=3;
  55591. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  55592. $ctx1.sendIdx["assert:equals:"]=3;
  55593. $17=$self._collection();
  55594. $ctx1.sendIdx["collection"]=5;
  55595. $18=$self._sampleNewValueAsCollection();
  55596. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  55597. $16=$recv($17).__comma($18);
  55598. $ctx1.sendIdx[","]=4;
  55599. $19=$self._collectionWithNewValue();
  55600. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55601. $self._assert_equals_($16,$19);
  55602. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  55603. return self;
  55604. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  55605. },
  55606. args: [],
  55607. 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",
  55608. referencedClasses: [],
  55609. pragmas: [],
  55610. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  55611. }),
  55612. $globals.CollectionTest);
  55613. $core.addMethod(
  55614. $core.method({
  55615. selector: "testCopy",
  55616. protocol: "tests",
  55617. fn: function (){
  55618. var self=this,$self=this;
  55619. return $core.withContext(function($ctx1) {
  55620. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  55621. $3=$self._collectionClass();
  55622. $ctx1.sendIdx["collectionClass"]=1;
  55623. $2=$recv($3)._new();
  55624. $ctx1.sendIdx["new"]=1;
  55625. $1=$recv($2)._copy();
  55626. $ctx1.sendIdx["copy"]=1;
  55627. $5=$self._collectionClass();
  55628. $ctx1.sendIdx["collectionClass"]=2;
  55629. $4=$recv($5)._new();
  55630. $ctx1.sendIdx["new"]=2;
  55631. $self._assert_equals_($1,$4);
  55632. $ctx1.sendIdx["assert:equals:"]=1;
  55633. $7=$self._collection();
  55634. $ctx1.sendIdx["collection"]=1;
  55635. $6=$recv($7)._copy();
  55636. $ctx1.sendIdx["copy"]=2;
  55637. $8=$self._collection();
  55638. $ctx1.sendIdx["collection"]=2;
  55639. $self._assert_equals_($6,$8);
  55640. $ctx1.sendIdx["assert:equals:"]=2;
  55641. $10=$self._collectionWithNewValue();
  55642. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55643. $9=$recv($10)._copy();
  55644. $ctx1.sendIdx["copy"]=3;
  55645. $11=$self._collectionWithNewValue();
  55646. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55647. $self._assert_equals_($9,$11);
  55648. $15=$self._collectionClass();
  55649. $ctx1.sendIdx["collectionClass"]=3;
  55650. $14=$recv($15)._new();
  55651. $ctx1.sendIdx["new"]=3;
  55652. $13=$recv($14)._copy();
  55653. $ctx1.sendIdx["copy"]=4;
  55654. $16=$self._collection();
  55655. $ctx1.sendIdx["collection"]=3;
  55656. $12=$recv($13).__eq($16);
  55657. $ctx1.sendIdx["="]=1;
  55658. $self._deny_($12);
  55659. $ctx1.sendIdx["deny:"]=1;
  55660. $19=$self._collection();
  55661. $ctx1.sendIdx["collection"]=4;
  55662. $18=$recv($19)._copy();
  55663. $ctx1.sendIdx["copy"]=5;
  55664. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  55665. $ctx1.sendIdx["="]=2;
  55666. $self._deny_($17);
  55667. $ctx1.sendIdx["deny:"]=2;
  55668. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  55669. return self;
  55670. }, function($ctx1) {$ctx1.fill(self,"testCopy",{})});
  55671. },
  55672. args: [],
  55673. 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",
  55674. referencedClasses: [],
  55675. pragmas: [],
  55676. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  55677. }),
  55678. $globals.CollectionTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "testCopySeparates",
  55682. protocol: "tests",
  55683. fn: function (){
  55684. var self=this,$self=this;
  55685. var original,copy;
  55686. return $core.withContext(function($ctx1) {
  55687. original=$self._collection();
  55688. $ctx1.sendIdx["collection"]=1;
  55689. copy=$recv(original)._copy();
  55690. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  55691. $self._assert_($recv(original).__eq($self._collection()));
  55692. return self;
  55693. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy})});
  55694. },
  55695. args: [],
  55696. 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",
  55697. referencedClasses: [],
  55698. pragmas: [],
  55699. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  55700. }),
  55701. $globals.CollectionTest);
  55702. $core.addMethod(
  55703. $core.method({
  55704. selector: "testDetect",
  55705. protocol: "tests",
  55706. fn: function (){
  55707. var self=this,$self=this;
  55708. return $core.withContext(function($ctx1) {
  55709. var $1,$2,$3,$4,$6,$5,$7;
  55710. $self._shouldnt_raise_((function(){
  55711. return $core.withContext(function($ctx2) {
  55712. $1=$self._collection();
  55713. $ctx2.sendIdx["collection"]=1;
  55714. return $recv($1)._detect_((function(){
  55715. return true;
  55716. }));
  55717. $ctx2.sendIdx["detect:"]=1;
  55718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55719. }),$globals.Error);
  55720. $self._should_raise_((function(){
  55721. return $core.withContext(function($ctx2) {
  55722. $2=$self._collection();
  55723. $ctx2.sendIdx["collection"]=2;
  55724. return $recv($2)._detect_((function(){
  55725. return false;
  55726. }));
  55727. $ctx2.sendIdx["detect:"]=2;
  55728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55729. }),$globals.Error);
  55730. $ctx1.sendIdx["should:raise:"]=1;
  55731. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  55732. return true;
  55733. }));
  55734. $ctx1.sendIdx["detect:"]=3;
  55735. $4=$self._sampleNewValue();
  55736. $ctx1.sendIdx["sampleNewValue"]=1;
  55737. $self._assert_equals_($3,$4);
  55738. $ctx1.sendIdx["assert:equals:"]=1;
  55739. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  55740. return $core.withContext(function($ctx2) {
  55741. $6=$self._sampleNewValue();
  55742. $ctx2.sendIdx["sampleNewValue"]=2;
  55743. return $recv(each).__eq($6);
  55744. $ctx2.sendIdx["="]=1;
  55745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  55746. }));
  55747. $ctx1.sendIdx["detect:"]=4;
  55748. $7=$self._sampleNewValue();
  55749. $ctx1.sendIdx["sampleNewValue"]=3;
  55750. $self._assert_equals_($5,$7);
  55751. $self._should_raise_((function(){
  55752. return $core.withContext(function($ctx2) {
  55753. return $recv($self._collection())._detect_((function(each){
  55754. return $core.withContext(function($ctx3) {
  55755. return $recv(each).__eq($self._sampleNewValue());
  55756. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  55757. }));
  55758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55759. }),$globals.Error);
  55760. return self;
  55761. }, function($ctx1) {$ctx1.fill(self,"testDetect",{})});
  55762. },
  55763. args: [],
  55764. 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",
  55765. referencedClasses: ["Error"],
  55766. pragmas: [],
  55767. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  55768. }),
  55769. $globals.CollectionTest);
  55770. $core.addMethod(
  55771. $core.method({
  55772. selector: "testDetectIfNone",
  55773. protocol: "tests",
  55774. fn: function (){
  55775. var self=this,$self=this;
  55776. var sentinel;
  55777. return $core.withContext(function($ctx1) {
  55778. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  55779. sentinel=$recv($globals.Object)._new();
  55780. $3=$self._collection();
  55781. $ctx1.sendIdx["collection"]=1;
  55782. $2=$recv($3)._detect_ifNone_((function(){
  55783. return true;
  55784. }),(function(){
  55785. return sentinel;
  55786. }));
  55787. $ctx1.sendIdx["detect:ifNone:"]=1;
  55788. $1=$recv($2).__tild_eq(sentinel);
  55789. $self._assert_($1);
  55790. $5=$self._collection();
  55791. $ctx1.sendIdx["collection"]=2;
  55792. $4=$recv($5)._detect_ifNone_((function(){
  55793. return false;
  55794. }),(function(){
  55795. return sentinel;
  55796. }));
  55797. $ctx1.sendIdx["detect:ifNone:"]=2;
  55798. $self._assert_equals_($4,sentinel);
  55799. $ctx1.sendIdx["assert:equals:"]=1;
  55800. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  55801. return true;
  55802. }),(function(){
  55803. return sentinel;
  55804. }));
  55805. $ctx1.sendIdx["detect:ifNone:"]=3;
  55806. $7=$self._sampleNewValue();
  55807. $ctx1.sendIdx["sampleNewValue"]=1;
  55808. $self._assert_equals_($6,$7);
  55809. $ctx1.sendIdx["assert:equals:"]=2;
  55810. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  55811. return $core.withContext(function($ctx2) {
  55812. $9=$self._sampleNewValue();
  55813. $ctx2.sendIdx["sampleNewValue"]=2;
  55814. return $recv(each).__eq($9);
  55815. $ctx2.sendIdx["="]=1;
  55816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  55817. }),(function(){
  55818. return sentinel;
  55819. }));
  55820. $ctx1.sendIdx["detect:ifNone:"]=4;
  55821. $10=$self._sampleNewValue();
  55822. $ctx1.sendIdx["sampleNewValue"]=3;
  55823. $self._assert_equals_($8,$10);
  55824. $ctx1.sendIdx["assert:equals:"]=3;
  55825. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  55826. return $core.withContext(function($ctx2) {
  55827. return $recv(each).__eq($self._sampleNewValue());
  55828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  55829. }),(function(){
  55830. return sentinel;
  55831. })),sentinel);
  55832. return self;
  55833. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel})});
  55834. },
  55835. args: [],
  55836. 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",
  55837. referencedClasses: ["Object"],
  55838. pragmas: [],
  55839. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  55840. }),
  55841. $globals.CollectionTest);
  55842. $core.addMethod(
  55843. $core.method({
  55844. selector: "testDo",
  55845. protocol: "tests",
  55846. fn: function (){
  55847. var self=this,$self=this;
  55848. var newCollection;
  55849. return $core.withContext(function($ctx1) {
  55850. var $1,$2;
  55851. newCollection=$recv($globals.OrderedCollection)._new();
  55852. $ctx1.sendIdx["new"]=1;
  55853. $1=$self._collection();
  55854. $ctx1.sendIdx["collection"]=1;
  55855. $recv($1)._do_((function(each){
  55856. return $core.withContext(function($ctx2) {
  55857. return $recv(newCollection)._add_(each);
  55858. $ctx2.sendIdx["add:"]=1;
  55859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55860. }));
  55861. $ctx1.sendIdx["do:"]=1;
  55862. $self._assertSameContents_as_($self._collection(),newCollection);
  55863. $ctx1.sendIdx["assertSameContents:as:"]=1;
  55864. newCollection=$recv($globals.OrderedCollection)._new();
  55865. $2=$self._collectionWithDuplicates();
  55866. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  55867. $recv($2)._do_((function(each){
  55868. return $core.withContext(function($ctx2) {
  55869. return $recv(newCollection)._add_(each);
  55870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55871. }));
  55872. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  55873. return self;
  55874. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection})});
  55875. },
  55876. args: [],
  55877. 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",
  55878. referencedClasses: ["OrderedCollection"],
  55879. pragmas: [],
  55880. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  55881. }),
  55882. $globals.CollectionTest);
  55883. $core.addMethod(
  55884. $core.method({
  55885. selector: "testEquality",
  55886. protocol: "tests",
  55887. fn: function (){
  55888. var self=this,$self=this;
  55889. return $core.withContext(function($ctx1) {
  55890. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  55891. $2=$self._collectionClass();
  55892. $ctx1.sendIdx["collectionClass"]=1;
  55893. $1=$recv($2)._new();
  55894. $ctx1.sendIdx["new"]=1;
  55895. $4=$self._collectionClass();
  55896. $ctx1.sendIdx["collectionClass"]=2;
  55897. $3=$recv($4)._new();
  55898. $ctx1.sendIdx["new"]=2;
  55899. $self._assert_equals_($1,$3);
  55900. $ctx1.sendIdx["assert:equals:"]=1;
  55901. $5=$self._collection();
  55902. $ctx1.sendIdx["collection"]=1;
  55903. $6=$self._collection();
  55904. $ctx1.sendIdx["collection"]=2;
  55905. $self._assert_equals_($5,$6);
  55906. $ctx1.sendIdx["assert:equals:"]=2;
  55907. $7=$self._collectionWithNewValue();
  55908. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55909. $8=$self._collectionWithNewValue();
  55910. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55911. $self._assert_equals_($7,$8);
  55912. $11=$self._collectionClass();
  55913. $ctx1.sendIdx["collectionClass"]=3;
  55914. $10=$recv($11)._new();
  55915. $ctx1.sendIdx["new"]=3;
  55916. $12=$self._collection();
  55917. $ctx1.sendIdx["collection"]=3;
  55918. $9=$recv($10).__eq($12);
  55919. $ctx1.sendIdx["="]=1;
  55920. $self._deny_($9);
  55921. $ctx1.sendIdx["deny:"]=1;
  55922. $14=$self._collection();
  55923. $ctx1.sendIdx["collection"]=4;
  55924. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  55925. $ctx1.sendIdx["="]=2;
  55926. $self._deny_($13);
  55927. $ctx1.sendIdx["deny:"]=2;
  55928. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  55929. return self;
  55930. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  55931. },
  55932. args: [],
  55933. 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",
  55934. referencedClasses: [],
  55935. pragmas: [],
  55936. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  55937. }),
  55938. $globals.CollectionTest);
  55939. $core.addMethod(
  55940. $core.method({
  55941. selector: "testIfEmptyFamily",
  55942. protocol: "tests",
  55943. fn: function (){
  55944. var self=this,$self=this;
  55945. return $core.withContext(function($ctx1) {
  55946. 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;
  55947. $3=$self._collectionClass();
  55948. $ctx1.sendIdx["collectionClass"]=1;
  55949. $2=$recv($3)._new();
  55950. $ctx1.sendIdx["new"]=1;
  55951. $1=$recv($2)._ifEmpty_((function(){
  55952. return (42);
  55953. }));
  55954. $ctx1.sendIdx["ifEmpty:"]=1;
  55955. $self._assert_equals_($1,(42));
  55956. $ctx1.sendIdx["assert:equals:"]=1;
  55957. $5=$self._collection();
  55958. $ctx1.sendIdx["collection"]=1;
  55959. $4=$recv($5)._ifEmpty_((function(){
  55960. return (42);
  55961. }));
  55962. $6=$self._collection();
  55963. $ctx1.sendIdx["collection"]=2;
  55964. $self._assert_equals_($4,$6);
  55965. $ctx1.sendIdx["assert:equals:"]=2;
  55966. $9=$self._collectionClass();
  55967. $ctx1.sendIdx["collectionClass"]=2;
  55968. $8=$recv($9)._new();
  55969. $ctx1.sendIdx["new"]=2;
  55970. $7=$recv($8)._ifNotEmpty_((function(){
  55971. return (42);
  55972. }));
  55973. $ctx1.sendIdx["ifNotEmpty:"]=1;
  55974. $11=$self._collectionClass();
  55975. $ctx1.sendIdx["collectionClass"]=3;
  55976. $10=$recv($11)._new();
  55977. $ctx1.sendIdx["new"]=3;
  55978. $self._assert_equals_($7,$10);
  55979. $ctx1.sendIdx["assert:equals:"]=3;
  55980. $13=$self._collection();
  55981. $ctx1.sendIdx["collection"]=3;
  55982. $12=$recv($13)._ifNotEmpty_((function(){
  55983. return (42);
  55984. }));
  55985. $ctx1.sendIdx["ifNotEmpty:"]=2;
  55986. $self._assert_equals_($12,(42));
  55987. $ctx1.sendIdx["assert:equals:"]=4;
  55988. $15=$self._collection();
  55989. $ctx1.sendIdx["collection"]=4;
  55990. $14=$recv($15)._ifNotEmpty_((function(col){
  55991. return col;
  55992. }));
  55993. $16=$self._collection();
  55994. $ctx1.sendIdx["collection"]=5;
  55995. $self._assert_equals_($14,$16);
  55996. $ctx1.sendIdx["assert:equals:"]=5;
  55997. $19=$self._collectionClass();
  55998. $ctx1.sendIdx["collectionClass"]=4;
  55999. $18=$recv($19)._new();
  56000. $ctx1.sendIdx["new"]=4;
  56001. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  56002. return (42);
  56003. }),(function(){
  56004. return (999);
  56005. }));
  56006. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  56007. $self._assert_equals_($17,(42));
  56008. $ctx1.sendIdx["assert:equals:"]=6;
  56009. $21=$self._collection();
  56010. $ctx1.sendIdx["collection"]=6;
  56011. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  56012. return (42);
  56013. }),(function(){
  56014. return (999);
  56015. }));
  56016. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  56017. $self._assert_equals_($20,(999));
  56018. $ctx1.sendIdx["assert:equals:"]=7;
  56019. $23=$self._collection();
  56020. $ctx1.sendIdx["collection"]=7;
  56021. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  56022. return (42);
  56023. }),(function(col){
  56024. return col;
  56025. }));
  56026. $24=$self._collection();
  56027. $ctx1.sendIdx["collection"]=8;
  56028. $self._assert_equals_($22,$24);
  56029. $ctx1.sendIdx["assert:equals:"]=8;
  56030. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  56031. return (42);
  56032. }),(function(){
  56033. return (999);
  56034. }));
  56035. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  56036. $self._assert_equals_($25,(999));
  56037. $ctx1.sendIdx["assert:equals:"]=9;
  56038. $27=$self._collection();
  56039. $ctx1.sendIdx["collection"]=9;
  56040. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  56041. return (42);
  56042. }),(function(){
  56043. return (999);
  56044. }));
  56045. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  56046. $self._assert_equals_($26,(42));
  56047. $ctx1.sendIdx["assert:equals:"]=10;
  56048. $29=$self._collection();
  56049. $ctx1.sendIdx["collection"]=10;
  56050. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  56051. return col;
  56052. }),(function(){
  56053. return (999);
  56054. }));
  56055. $self._assert_equals_($28,$self._collection());
  56056. return self;
  56057. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{})});
  56058. },
  56059. args: [],
  56060. 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.",
  56061. referencedClasses: [],
  56062. pragmas: [],
  56063. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  56064. }),
  56065. $globals.CollectionTest);
  56066. $core.addMethod(
  56067. $core.method({
  56068. selector: "testIsEmpty",
  56069. protocol: "tests",
  56070. fn: function (){
  56071. var self=this,$self=this;
  56072. return $core.withContext(function($ctx1) {
  56073. var $1;
  56074. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  56075. $ctx1.sendIdx["isEmpty"]=1;
  56076. $self._assert_($1);
  56077. $self._deny_($recv($self._collection())._isEmpty());
  56078. return self;
  56079. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{})});
  56080. },
  56081. args: [],
  56082. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  56083. referencedClasses: [],
  56084. pragmas: [],
  56085. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  56086. }),
  56087. $globals.CollectionTest);
  56088. $core.addMethod(
  56089. $core.method({
  56090. selector: "testNoneSatisfy",
  56091. protocol: "tests",
  56092. fn: function (){
  56093. var self=this,$self=this;
  56094. var anyOne;
  56095. return $core.withContext(function($ctx1) {
  56096. var $1,$3,$2;
  56097. $1=$self._collection();
  56098. $ctx1.sendIdx["collection"]=1;
  56099. anyOne=$recv($1)._anyOne();
  56100. $3=$self._collection();
  56101. $ctx1.sendIdx["collection"]=2;
  56102. $2=$recv($3)._noneSatisfy_((function(each){
  56103. return $core.withContext(function($ctx2) {
  56104. return $recv(each).__eq(anyOne);
  56105. $ctx2.sendIdx["="]=1;
  56106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56107. }));
  56108. $ctx1.sendIdx["noneSatisfy:"]=1;
  56109. $self._deny_($2);
  56110. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  56111. return $core.withContext(function($ctx2) {
  56112. return $recv(each).__eq($recv($globals.Object)._new());
  56113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56114. })));
  56115. return self;
  56116. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne})});
  56117. },
  56118. args: [],
  56119. 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 ])",
  56120. referencedClasses: ["Object"],
  56121. pragmas: [],
  56122. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  56123. }),
  56124. $globals.CollectionTest);
  56125. $core.addMethod(
  56126. $core.method({
  56127. selector: "testRegression1224",
  56128. protocol: "tests",
  56129. fn: function (){
  56130. var self=this,$self=this;
  56131. return $core.withContext(function($ctx1) {
  56132. var $3,$2,$1;
  56133. $3=$recv($self._collectionClass())._new();
  56134. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56135. }));
  56136. $2=$recv($3)._yourself();
  56137. $1=$recv($2)._size();
  56138. $self._assert_equals_($1,(0));
  56139. return self;
  56140. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  56141. },
  56142. args: [],
  56143. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  56144. referencedClasses: [],
  56145. pragmas: [],
  56146. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56147. }),
  56148. $globals.CollectionTest);
  56149. $core.addMethod(
  56150. $core.method({
  56151. selector: "testRemoveAll",
  56152. protocol: "tests",
  56153. fn: function (){
  56154. var self=this,$self=this;
  56155. return $core.withContext(function($ctx1) {
  56156. var $2,$1;
  56157. $2=$self._collection();
  56158. $recv($2)._removeAll();
  56159. $1=$recv($2)._yourself();
  56160. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  56161. return self;
  56162. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  56163. },
  56164. args: [],
  56165. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  56166. referencedClasses: [],
  56167. pragmas: [],
  56168. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  56169. }),
  56170. $globals.CollectionTest);
  56171. $core.addMethod(
  56172. $core.method({
  56173. selector: "testSelect",
  56174. protocol: "tests",
  56175. fn: function (){
  56176. var self=this,$self=this;
  56177. return $core.withContext(function($ctx1) {
  56178. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  56179. $2=$self._collection();
  56180. $ctx1.sendIdx["collection"]=1;
  56181. $1=$recv($2)._select_((function(){
  56182. return false;
  56183. }));
  56184. $ctx1.sendIdx["select:"]=1;
  56185. $4=$self._collectionClass();
  56186. $ctx1.sendIdx["collectionClass"]=1;
  56187. $3=$recv($4)._new();
  56188. $ctx1.sendIdx["new"]=1;
  56189. $self._assert_equals_($1,$3);
  56190. $ctx1.sendIdx["assert:equals:"]=1;
  56191. $6=$self._collection();
  56192. $ctx1.sendIdx["collection"]=2;
  56193. $5=$recv($6)._select_((function(){
  56194. return true;
  56195. }));
  56196. $ctx1.sendIdx["select:"]=2;
  56197. $7=$self._collection();
  56198. $ctx1.sendIdx["collection"]=3;
  56199. $self._assert_equals_($5,$7);
  56200. $ctx1.sendIdx["assert:equals:"]=2;
  56201. $9=$self._collectionWithNewValue();
  56202. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56203. $8=$recv($9)._select_((function(each){
  56204. return $core.withContext(function($ctx2) {
  56205. $10=$self._sampleNewValue();
  56206. $ctx2.sendIdx["sampleNewValue"]=1;
  56207. return $recv(each).__eq($10);
  56208. $ctx2.sendIdx["="]=1;
  56209. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  56210. }));
  56211. $ctx1.sendIdx["select:"]=3;
  56212. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  56213. $ctx1.sendIdx["assert:equals:"]=3;
  56214. $12=$self._collectionWithNewValue();
  56215. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56216. $11=$recv($12)._select_((function(each){
  56217. return $core.withContext(function($ctx2) {
  56218. $13=$self._sampleNewValue();
  56219. $ctx2.sendIdx["sampleNewValue"]=2;
  56220. return $recv(each).__tild_eq($13);
  56221. $ctx2.sendIdx["~="]=1;
  56222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56223. }));
  56224. $ctx1.sendIdx["select:"]=4;
  56225. $14=$self._collection();
  56226. $ctx1.sendIdx["collection"]=4;
  56227. $self._assert_equals_($11,$14);
  56228. $ctx1.sendIdx["assert:equals:"]=4;
  56229. $16=$self._collection();
  56230. $ctx1.sendIdx["collection"]=5;
  56231. $15=$recv($16)._select_((function(each){
  56232. return $core.withContext(function($ctx2) {
  56233. $17=$self._sampleNewValue();
  56234. $ctx2.sendIdx["sampleNewValue"]=3;
  56235. return $recv(each).__eq($17);
  56236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  56237. }));
  56238. $ctx1.sendIdx["select:"]=5;
  56239. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  56240. $ctx1.sendIdx["assert:equals:"]=5;
  56241. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  56242. return $core.withContext(function($ctx2) {
  56243. return $recv(each).__tild_eq($self._sampleNewValue());
  56244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  56245. })),$self._collection());
  56246. return self;
  56247. }, function($ctx1) {$ctx1.fill(self,"testSelect",{})});
  56248. },
  56249. args: [],
  56250. 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",
  56251. referencedClasses: [],
  56252. pragmas: [],
  56253. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  56254. }),
  56255. $globals.CollectionTest);
  56256. $core.addMethod(
  56257. $core.method({
  56258. selector: "testSelectThenCollect",
  56259. protocol: "tests",
  56260. fn: function (){
  56261. var self=this,$self=this;
  56262. return $core.withContext(function($ctx1) {
  56263. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  56264. $2=$self._collection();
  56265. $ctx1.sendIdx["collection"]=1;
  56266. $1=$recv($2)._select_thenCollect_((function(){
  56267. return false;
  56268. }),"isString");
  56269. $ctx1.sendIdx["select:thenCollect:"]=1;
  56270. $4=$self._collectionClass();
  56271. $ctx1.sendIdx["collectionClass"]=1;
  56272. $3=$recv($4)._new();
  56273. $ctx1.sendIdx["new"]=1;
  56274. $self._assert_equals_($1,$3);
  56275. $ctx1.sendIdx["assert:equals:"]=1;
  56276. $6=$self._collection();
  56277. $ctx1.sendIdx["collection"]=2;
  56278. $5=$recv($6)._select_thenCollect_((function(){
  56279. return true;
  56280. }),(function(x){
  56281. return x;
  56282. }));
  56283. $ctx1.sendIdx["select:thenCollect:"]=2;
  56284. $7=$self._collection();
  56285. $ctx1.sendIdx["collection"]=3;
  56286. $self._assert_equals_($5,$7);
  56287. $ctx1.sendIdx["assert:equals:"]=2;
  56288. $8=$recv($self._collection())._select_thenCollect_((function(each){
  56289. return $core.withContext(function($ctx2) {
  56290. $9=$self._sampleNewValue();
  56291. $ctx2.sendIdx["sampleNewValue"]=1;
  56292. return $recv(each).__eq($9);
  56293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56294. }),(function(x){
  56295. return x;
  56296. }));
  56297. $ctx1.sendIdx["select:thenCollect:"]=3;
  56298. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  56299. $ctx1.sendIdx["assert:equals:"]=3;
  56300. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  56301. return $core.withContext(function($ctx2) {
  56302. return $recv(each).__tild_eq($self._sampleNewValue());
  56303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  56304. }),"printString"),$self._collectionOfPrintStrings());
  56305. return self;
  56306. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{})});
  56307. },
  56308. args: [],
  56309. 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",
  56310. referencedClasses: [],
  56311. pragmas: [],
  56312. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  56313. }),
  56314. $globals.CollectionTest);
  56315. $core.addMethod(
  56316. $core.method({
  56317. selector: "testSingle",
  56318. protocol: "tests",
  56319. fn: function (){
  56320. var self=this,$self=this;
  56321. return $core.withContext(function($ctx1) {
  56322. $self._should_raise_((function(){
  56323. return $core.withContext(function($ctx2) {
  56324. return $recv($recv($self._collectionClass())._new())._single();
  56325. $ctx2.sendIdx["single"]=1;
  56326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56327. }),$globals.Error);
  56328. $ctx1.sendIdx["should:raise:"]=1;
  56329. $self._should_raise_((function(){
  56330. return $core.withContext(function($ctx2) {
  56331. return $recv($self._collection())._single();
  56332. $ctx2.sendIdx["single"]=2;
  56333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56334. }),$globals.Error);
  56335. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  56336. return self;
  56337. }, function($ctx1) {$ctx1.fill(self,"testSingle",{})});
  56338. },
  56339. args: [],
  56340. 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",
  56341. referencedClasses: ["Error"],
  56342. pragmas: [],
  56343. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  56344. }),
  56345. $globals.CollectionTest);
  56346. $core.addMethod(
  56347. $core.method({
  56348. selector: "testSize",
  56349. protocol: "tests",
  56350. fn: function (){
  56351. var self=this,$self=this;
  56352. return $core.withContext(function($ctx1) {
  56353. var $1,$2;
  56354. $1=$recv($recv($self._collectionClass())._new())._size();
  56355. $ctx1.sendIdx["size"]=1;
  56356. $self._assert_equals_($1,(0));
  56357. $ctx1.sendIdx["assert:equals:"]=1;
  56358. $2=$recv($self._sampleNewValueAsCollection())._size();
  56359. $ctx1.sendIdx["size"]=2;
  56360. $self._assert_equals_($2,(1));
  56361. $ctx1.sendIdx["assert:equals:"]=2;
  56362. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  56363. return self;
  56364. }, function($ctx1) {$ctx1.fill(self,"testSize",{})});
  56365. },
  56366. args: [],
  56367. 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",
  56368. referencedClasses: [],
  56369. pragmas: [],
  56370. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  56371. }),
  56372. $globals.CollectionTest);
  56373. $core.addMethod(
  56374. $core.method({
  56375. selector: "collectionClass",
  56376. protocol: "fixture",
  56377. fn: function (){
  56378. var self=this,$self=this;
  56379. return nil;
  56380. },
  56381. args: [],
  56382. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  56383. referencedClasses: [],
  56384. pragmas: [],
  56385. messageSends: []
  56386. }),
  56387. $globals.CollectionTest.a$cls);
  56388. $core.addMethod(
  56389. $core.method({
  56390. selector: "isAbstract",
  56391. protocol: "testing",
  56392. fn: function (){
  56393. var self=this,$self=this;
  56394. return $core.withContext(function($ctx1) {
  56395. return $recv($self._collectionClass())._isNil();
  56396. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  56397. },
  56398. args: [],
  56399. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56400. referencedClasses: [],
  56401. pragmas: [],
  56402. messageSends: ["isNil", "collectionClass"]
  56403. }),
  56404. $globals.CollectionTest.a$cls);
  56405. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  56406. $core.addMethod(
  56407. $core.method({
  56408. selector: "collectionWithNewValue",
  56409. protocol: "fixture",
  56410. fn: function (){
  56411. var self=this,$self=this;
  56412. return $core.withContext(function($ctx1) {
  56413. $self._subclassResponsibility();
  56414. return self;
  56415. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  56416. },
  56417. args: [],
  56418. 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",
  56419. referencedClasses: [],
  56420. pragmas: [],
  56421. messageSends: ["subclassResponsibility"]
  56422. }),
  56423. $globals.IndexableCollectionTest);
  56424. $core.addMethod(
  56425. $core.method({
  56426. selector: "nonIndexesDo:",
  56427. protocol: "fixture",
  56428. fn: function (aBlock){
  56429. var self=this,$self=this;
  56430. return $core.withContext(function($ctx1) {
  56431. $self._subclassResponsibility();
  56432. return self;
  56433. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  56434. },
  56435. args: ["aBlock"],
  56436. 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",
  56437. referencedClasses: [],
  56438. pragmas: [],
  56439. messageSends: ["subclassResponsibility"]
  56440. }),
  56441. $globals.IndexableCollectionTest);
  56442. $core.addMethod(
  56443. $core.method({
  56444. selector: "sampleNewIndex",
  56445. protocol: "fixture",
  56446. fn: function (){
  56447. var self=this,$self=this;
  56448. return $core.withContext(function($ctx1) {
  56449. $self._subclassResponsibility();
  56450. return self;
  56451. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{})});
  56452. },
  56453. args: [],
  56454. 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",
  56455. referencedClasses: [],
  56456. pragmas: [],
  56457. messageSends: ["subclassResponsibility"]
  56458. }),
  56459. $globals.IndexableCollectionTest);
  56460. $core.addMethod(
  56461. $core.method({
  56462. selector: "samplesDo:",
  56463. protocol: "fixture",
  56464. fn: function (aBlock){
  56465. var self=this,$self=this;
  56466. return $core.withContext(function($ctx1) {
  56467. $self._subclassResponsibility();
  56468. return self;
  56469. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  56470. },
  56471. args: ["aBlock"],
  56472. 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",
  56473. referencedClasses: [],
  56474. pragmas: [],
  56475. messageSends: ["subclassResponsibility"]
  56476. }),
  56477. $globals.IndexableCollectionTest);
  56478. $core.addMethod(
  56479. $core.method({
  56480. selector: "testAt",
  56481. protocol: "tests",
  56482. fn: function (){
  56483. var self=this,$self=this;
  56484. return $core.withContext(function($ctx1) {
  56485. var $1;
  56486. $self._nonIndexesDo_((function(each){
  56487. return $core.withContext(function($ctx2) {
  56488. return $self._should_raise_((function(){
  56489. return $core.withContext(function($ctx3) {
  56490. $1=$self._collection();
  56491. $ctx3.sendIdx["collection"]=1;
  56492. return $recv($1)._at_(each);
  56493. $ctx3.sendIdx["at:"]=1;
  56494. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56495. }),$globals.Error);
  56496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56497. }));
  56498. $self._samplesDo_((function(index,value){
  56499. return $core.withContext(function($ctx2) {
  56500. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  56501. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56502. }));
  56503. return self;
  56504. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  56505. },
  56506. args: [],
  56507. 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 ]",
  56508. referencedClasses: ["Error"],
  56509. pragmas: [],
  56510. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  56511. }),
  56512. $globals.IndexableCollectionTest);
  56513. $core.addMethod(
  56514. $core.method({
  56515. selector: "testAtIfAbsent",
  56516. protocol: "tests",
  56517. fn: function (){
  56518. var self=this,$self=this;
  56519. return $core.withContext(function($ctx1) {
  56520. var $2,$1,$3;
  56521. $self._nonIndexesDo_((function(each){
  56522. return $core.withContext(function($ctx2) {
  56523. $2=$self._collection();
  56524. $ctx2.sendIdx["collection"]=1;
  56525. $1=$recv($2)._at_ifAbsent_(each,(function(){
  56526. return $core.withContext(function($ctx3) {
  56527. return $self._sampleNewValue();
  56528. $ctx3.sendIdx["sampleNewValue"]=1;
  56529. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56530. }));
  56531. $ctx2.sendIdx["at:ifAbsent:"]=1;
  56532. $3=$self._sampleNewValue();
  56533. $ctx2.sendIdx["sampleNewValue"]=2;
  56534. return $self._assert_equals_($1,$3);
  56535. $ctx2.sendIdx["assert:equals:"]=1;
  56536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56537. }));
  56538. $self._samplesDo_((function(index,value){
  56539. return $core.withContext(function($ctx2) {
  56540. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  56541. return $core.withContext(function($ctx3) {
  56542. return $self._sampleNewValue();
  56543. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  56544. })),value);
  56545. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56546. }));
  56547. return self;
  56548. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{})});
  56549. },
  56550. args: [],
  56551. 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 ].",
  56552. referencedClasses: [],
  56553. pragmas: [],
  56554. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  56555. }),
  56556. $globals.IndexableCollectionTest);
  56557. $core.addMethod(
  56558. $core.method({
  56559. selector: "testAtIfAbsentPut",
  56560. protocol: "tests",
  56561. fn: function (){
  56562. var self=this,$self=this;
  56563. var newCollection;
  56564. return $core.withContext(function($ctx1) {
  56565. var $1;
  56566. newCollection=$self._collection();
  56567. $ctx1.sendIdx["collection"]=1;
  56568. $self._samplesDo_((function(index,value){
  56569. return $core.withContext(function($ctx2) {
  56570. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  56571. return $core.withContext(function($ctx3) {
  56572. return $self._sampleNewValue();
  56573. $ctx3.sendIdx["sampleNewValue"]=1;
  56574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56575. }));
  56576. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  56577. return $self._assert_equals_($1,value);
  56578. $ctx2.sendIdx["assert:equals:"]=1;
  56579. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56580. }));
  56581. $self._assert_equals_(newCollection,$self._collection());
  56582. $ctx1.sendIdx["assert:equals:"]=2;
  56583. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  56584. return $core.withContext(function($ctx2) {
  56585. return $self._sampleNewValue();
  56586. $ctx2.sendIdx["sampleNewValue"]=2;
  56587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56588. })),$self._sampleNewValue());
  56589. $ctx1.sendIdx["assert:equals:"]=3;
  56590. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  56591. return self;
  56592. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection})});
  56593. },
  56594. args: [],
  56595. 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",
  56596. referencedClasses: [],
  56597. pragmas: [],
  56598. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  56599. }),
  56600. $globals.IndexableCollectionTest);
  56601. $core.addMethod(
  56602. $core.method({
  56603. selector: "testAtIfPresent",
  56604. protocol: "tests",
  56605. fn: function (){
  56606. var self=this,$self=this;
  56607. var visited,sentinel;
  56608. return $core.withContext(function($ctx1) {
  56609. var $2,$1,$4,$3;
  56610. sentinel=$recv($globals.Object)._new();
  56611. $self._nonIndexesDo_((function(each){
  56612. return $core.withContext(function($ctx2) {
  56613. visited=nil;
  56614. $2=$self._collection();
  56615. $ctx2.sendIdx["collection"]=1;
  56616. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  56617. visited=value1;
  56618. return sentinel;
  56619. }));
  56620. $ctx2.sendIdx["at:ifPresent:"]=1;
  56621. $self._assert_equals_($1,nil);
  56622. $ctx2.sendIdx["assert:equals:"]=1;
  56623. return $self._assert_($recv(visited)._isNil());
  56624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56625. }));
  56626. $self._samplesDo_((function(index,value){
  56627. return $core.withContext(function($ctx2) {
  56628. visited=nil;
  56629. $4=$self._collection();
  56630. $ctx2.sendIdx["collection"]=2;
  56631. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  56632. visited=value2;
  56633. return sentinel;
  56634. }));
  56635. $self._assert_equals_($3,sentinel);
  56636. $ctx2.sendIdx["assert:equals:"]=2;
  56637. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  56638. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  56639. }));
  56640. return self;
  56641. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel})});
  56642. },
  56643. args: [],
  56644. 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) ]",
  56645. referencedClasses: ["Object"],
  56646. pragmas: [],
  56647. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  56648. }),
  56649. $globals.IndexableCollectionTest);
  56650. $core.addMethod(
  56651. $core.method({
  56652. selector: "testAtIfPresentIfAbsent",
  56653. protocol: "tests",
  56654. fn: function (){
  56655. var self=this,$self=this;
  56656. var visited,sentinel;
  56657. return $core.withContext(function($ctx1) {
  56658. var $2,$1,$3,$5,$4;
  56659. sentinel=$recv($globals.Object)._new();
  56660. $self._nonIndexesDo_((function(each){
  56661. return $core.withContext(function($ctx2) {
  56662. visited=nil;
  56663. $2=$self._collection();
  56664. $ctx2.sendIdx["collection"]=1;
  56665. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  56666. visited=value1;
  56667. return sentinel;
  56668. }),(function(){
  56669. return $core.withContext(function($ctx3) {
  56670. return $self._sampleNewValue();
  56671. $ctx3.sendIdx["sampleNewValue"]=1;
  56672. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  56673. }));
  56674. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  56675. $3=$self._sampleNewValue();
  56676. $ctx2.sendIdx["sampleNewValue"]=2;
  56677. $self._assert_equals_($1,$3);
  56678. $ctx2.sendIdx["assert:equals:"]=1;
  56679. return $self._assert_($recv(visited)._isNil());
  56680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56681. }));
  56682. $self._samplesDo_((function(index,value){
  56683. return $core.withContext(function($ctx2) {
  56684. visited=nil;
  56685. $5=$self._collection();
  56686. $ctx2.sendIdx["collection"]=2;
  56687. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  56688. visited=value2;
  56689. return sentinel;
  56690. }),(function(){
  56691. return $core.withContext(function($ctx3) {
  56692. return $self._sampleNewValue();
  56693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  56694. }));
  56695. $self._assert_equals_($4,sentinel);
  56696. $ctx2.sendIdx["assert:equals:"]=2;
  56697. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  56698. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  56699. }));
  56700. return self;
  56701. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel})});
  56702. },
  56703. args: [],
  56704. 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) ]",
  56705. referencedClasses: ["Object"],
  56706. pragmas: [],
  56707. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  56708. }),
  56709. $globals.IndexableCollectionTest);
  56710. $core.addMethod(
  56711. $core.method({
  56712. selector: "testAtPut",
  56713. protocol: "tests",
  56714. fn: function (){
  56715. var self=this,$self=this;
  56716. var newCollection;
  56717. return $core.withContext(function($ctx1) {
  56718. newCollection=$self._collection();
  56719. $ctx1.sendIdx["collection"]=1;
  56720. $self._samplesDo_((function(index,value){
  56721. return $core.withContext(function($ctx2) {
  56722. return $recv(newCollection)._at_put_(index,value);
  56723. $ctx2.sendIdx["at:put:"]=1;
  56724. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56725. }));
  56726. $self._assert_equals_(newCollection,$self._collection());
  56727. $ctx1.sendIdx["assert:equals:"]=1;
  56728. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  56729. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  56730. return self;
  56731. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection})});
  56732. },
  56733. args: [],
  56734. 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",
  56735. referencedClasses: [],
  56736. pragmas: [],
  56737. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  56738. }),
  56739. $globals.IndexableCollectionTest);
  56740. $core.addMethod(
  56741. $core.method({
  56742. selector: "testIndexOf",
  56743. protocol: "tests",
  56744. fn: function (){
  56745. var self=this,$self=this;
  56746. return $core.withContext(function($ctx1) {
  56747. var $1;
  56748. $self._should_raise_((function(){
  56749. return $core.withContext(function($ctx2) {
  56750. $1=$self._collection();
  56751. $ctx2.sendIdx["collection"]=1;
  56752. return $recv($1)._indexOf_($self._sampleNewValue());
  56753. $ctx2.sendIdx["indexOf:"]=1;
  56754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56755. }),$globals.Error);
  56756. $self._samplesDo_((function(index,value){
  56757. return $core.withContext(function($ctx2) {
  56758. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  56759. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  56760. }));
  56761. return self;
  56762. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{})});
  56763. },
  56764. args: [],
  56765. 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 ]",
  56766. referencedClasses: ["Error"],
  56767. pragmas: [],
  56768. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  56769. }),
  56770. $globals.IndexableCollectionTest);
  56771. $core.addMethod(
  56772. $core.method({
  56773. selector: "testIndexOfWithNull",
  56774. protocol: "tests",
  56775. fn: function (){
  56776. var self=this,$self=this;
  56777. var jsNull;
  56778. return $core.withContext(function($ctx1) {
  56779. var $2,$1;
  56780. jsNull=$recv($globals.JSON)._parse_("null");
  56781. $self._samplesDo_((function(index,value){
  56782. return $core.withContext(function($ctx2) {
  56783. $2=$self._collection();
  56784. $recv($2)._at_put_(index,jsNull);
  56785. $1=$recv($2)._indexOf_(jsNull);
  56786. return $self._assert_equals_($1,index);
  56787. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  56788. }));
  56789. return self;
  56790. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull})});
  56791. },
  56792. args: [],
  56793. 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 ]",
  56794. referencedClasses: ["JSON"],
  56795. pragmas: [],
  56796. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  56797. }),
  56798. $globals.IndexableCollectionTest);
  56799. $core.addMethod(
  56800. $core.method({
  56801. selector: "testWithIndexDo",
  56802. protocol: "tests",
  56803. fn: function (){
  56804. var self=this,$self=this;
  56805. var collection;
  56806. return $core.withContext(function($ctx1) {
  56807. collection=$self._collection();
  56808. $ctx1.sendIdx["collection"]=1;
  56809. $recv($self._collection())._withIndexDo_((function(each,index){
  56810. return $core.withContext(function($ctx2) {
  56811. return $self._assert_equals_($recv(collection)._at_(index),each);
  56812. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  56813. }));
  56814. return self;
  56815. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection})});
  56816. },
  56817. args: [],
  56818. 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 ]",
  56819. referencedClasses: [],
  56820. pragmas: [],
  56821. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  56822. }),
  56823. $globals.IndexableCollectionTest);
  56824. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  56825. $core.addMethod(
  56826. $core.method({
  56827. selector: "collectionKeys",
  56828. protocol: "fixture",
  56829. fn: function (){
  56830. var self=this,$self=this;
  56831. return $core.withContext(function($ctx1) {
  56832. $self._subclassResponsibility();
  56833. return self;
  56834. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  56835. },
  56836. args: [],
  56837. source: "collectionKeys\x0a\x09self subclassResponsibility",
  56838. referencedClasses: [],
  56839. pragmas: [],
  56840. messageSends: ["subclassResponsibility"]
  56841. }),
  56842. $globals.AssociativeCollectionTest);
  56843. $core.addMethod(
  56844. $core.method({
  56845. selector: "collectionValues",
  56846. protocol: "fixture",
  56847. fn: function (){
  56848. var self=this,$self=this;
  56849. return $core.withContext(function($ctx1) {
  56850. $self._subclassResponsibility();
  56851. return self;
  56852. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{})});
  56853. },
  56854. args: [],
  56855. source: "collectionValues\x0a\x09self subclassResponsibility",
  56856. referencedClasses: [],
  56857. pragmas: [],
  56858. messageSends: ["subclassResponsibility"]
  56859. }),
  56860. $globals.AssociativeCollectionTest);
  56861. $core.addMethod(
  56862. $core.method({
  56863. selector: "nonIndexesDo:",
  56864. protocol: "fixture",
  56865. fn: function (aBlock){
  56866. var self=this,$self=this;
  56867. return $core.withContext(function($ctx1) {
  56868. $recv(aBlock)._value_((5));
  56869. $ctx1.sendIdx["value:"]=1;
  56870. $recv(aBlock)._value_((function(){
  56871. }));
  56872. $ctx1.sendIdx["value:"]=2;
  56873. $recv(aBlock)._value_($recv($globals.Object)._new());
  56874. $ctx1.sendIdx["value:"]=3;
  56875. $recv(aBlock)._value_("z");
  56876. return self;
  56877. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  56878. },
  56879. args: ["aBlock"],
  56880. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  56881. referencedClasses: ["Object"],
  56882. pragmas: [],
  56883. messageSends: ["value:", "new"]
  56884. }),
  56885. $globals.AssociativeCollectionTest);
  56886. $core.addMethod(
  56887. $core.method({
  56888. selector: "sampleNewIndex",
  56889. protocol: "fixture",
  56890. fn: function (){
  56891. var self=this,$self=this;
  56892. return "new";
  56893. },
  56894. args: [],
  56895. source: "sampleNewIndex\x0a\x09^ 'new'",
  56896. referencedClasses: [],
  56897. pragmas: [],
  56898. messageSends: []
  56899. }),
  56900. $globals.AssociativeCollectionTest);
  56901. $core.addMethod(
  56902. $core.method({
  56903. selector: "samplesDo:",
  56904. protocol: "fixture",
  56905. fn: function (aBlock){
  56906. var self=this,$self=this;
  56907. return $core.withContext(function($ctx1) {
  56908. $recv(aBlock)._value_value_("a",(2));
  56909. return self;
  56910. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  56911. },
  56912. args: ["aBlock"],
  56913. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  56914. referencedClasses: [],
  56915. pragmas: [],
  56916. messageSends: ["value:value:"]
  56917. }),
  56918. $globals.AssociativeCollectionTest);
  56919. $core.addMethod(
  56920. $core.method({
  56921. selector: "testAddAll",
  56922. protocol: "tests",
  56923. fn: function (){
  56924. var self=this,$self=this;
  56925. return $core.withContext(function($ctx1) {
  56926. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56927. (
  56928. $ctx1.supercall = true,
  56929. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56930. $ctx1.supercall = false;
  56931. $2=$self._collection();
  56932. $ctx1.sendIdx["collection"]=1;
  56933. $3=$self._collection();
  56934. $ctx1.sendIdx["collection"]=2;
  56935. $recv($2)._addAll_($3);
  56936. $ctx1.sendIdx["addAll:"]=1;
  56937. $4=$recv($2)._yourself();
  56938. $ctx1.sendIdx["yourself"]=1;
  56939. $1=$4;
  56940. $5=$self._collection();
  56941. $ctx1.sendIdx["collection"]=3;
  56942. $self._assert_equals_($1,$5);
  56943. $ctx1.sendIdx["assert:equals:"]=1;
  56944. $7=$self._collection();
  56945. $ctx1.sendIdx["collection"]=4;
  56946. $8=$self._collectionWithNewValue();
  56947. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56948. $recv($7)._addAll_($8);
  56949. $ctx1.sendIdx["addAll:"]=2;
  56950. $9=$recv($7)._yourself();
  56951. $ctx1.sendIdx["yourself"]=2;
  56952. $6=$9;
  56953. $10=$self._collectionWithNewValue();
  56954. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56955. $self._assert_equals_($6,$10);
  56956. $ctx1.sendIdx["assert:equals:"]=2;
  56957. $12=$self._collectionWithNewValue();
  56958. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56959. $recv($12)._addAll_($self._collection());
  56960. $11=$recv($12)._yourself();
  56961. $self._assert_equals_($11,$self._collectionWithNewValue());
  56962. return self;
  56963. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  56964. },
  56965. args: [],
  56966. 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",
  56967. referencedClasses: [],
  56968. pragmas: [],
  56969. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56970. }),
  56971. $globals.AssociativeCollectionTest);
  56972. $core.addMethod(
  56973. $core.method({
  56974. selector: "testAsDictionary",
  56975. protocol: "tests",
  56976. fn: function (){
  56977. var self=this,$self=this;
  56978. return $core.withContext(function($ctx1) {
  56979. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  56980. return self;
  56981. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{})});
  56982. },
  56983. args: [],
  56984. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  56985. referencedClasses: ["Dictionary"],
  56986. pragmas: [],
  56987. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  56988. }),
  56989. $globals.AssociativeCollectionTest);
  56990. $core.addMethod(
  56991. $core.method({
  56992. selector: "testAsHashedCollection",
  56993. protocol: "tests",
  56994. fn: function (){
  56995. var self=this,$self=this;
  56996. return $core.withContext(function($ctx1) {
  56997. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  56998. return self;
  56999. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{})});
  57000. },
  57001. args: [],
  57002. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  57003. referencedClasses: ["HashedCollection"],
  57004. pragmas: [],
  57005. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  57006. }),
  57007. $globals.AssociativeCollectionTest);
  57008. $core.addMethod(
  57009. $core.method({
  57010. selector: "testComma",
  57011. protocol: "tests",
  57012. fn: function (){
  57013. var self=this,$self=this;
  57014. return $core.withContext(function($ctx1) {
  57015. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  57016. (
  57017. $ctx1.supercall = true,
  57018. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  57019. $ctx1.supercall = false;
  57020. $2=$self._collection();
  57021. $ctx1.sendIdx["collection"]=1;
  57022. $3=$self._collection();
  57023. $ctx1.sendIdx["collection"]=2;
  57024. $1=$recv($2).__comma($3);
  57025. $ctx1.sendIdx[","]=1;
  57026. $4=$self._collection();
  57027. $ctx1.sendIdx["collection"]=3;
  57028. $self._assert_equals_($1,$4);
  57029. $ctx1.sendIdx["assert:equals:"]=1;
  57030. $6=$self._collection();
  57031. $ctx1.sendIdx["collection"]=4;
  57032. $7=$self._collectionWithNewValue();
  57033. $ctx1.sendIdx["collectionWithNewValue"]=1;
  57034. $5=$recv($6).__comma($7);
  57035. $ctx1.sendIdx[","]=2;
  57036. $8=$self._collectionWithNewValue();
  57037. $ctx1.sendIdx["collectionWithNewValue"]=2;
  57038. $self._assert_equals_($5,$8);
  57039. $ctx1.sendIdx["assert:equals:"]=2;
  57040. $10=$self._collectionWithNewValue();
  57041. $ctx1.sendIdx["collectionWithNewValue"]=3;
  57042. $9=$recv($10).__comma($self._collection());
  57043. $self._assert_equals_($9,$self._collectionWithNewValue());
  57044. return self;
  57045. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  57046. },
  57047. args: [],
  57048. 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",
  57049. referencedClasses: [],
  57050. pragmas: [],
  57051. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  57052. }),
  57053. $globals.AssociativeCollectionTest);
  57054. $core.addMethod(
  57055. $core.method({
  57056. selector: "testFrom",
  57057. protocol: "tests",
  57058. fn: function (){
  57059. var self=this,$self=this;
  57060. var associations;
  57061. return $core.withContext(function($ctx1) {
  57062. var $1;
  57063. $1="a".__minus_gt((1));
  57064. $ctx1.sendIdx["->"]=1;
  57065. associations=[$1,"b".__minus_gt((2))];
  57066. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  57067. return self;
  57068. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations})});
  57069. },
  57070. args: [],
  57071. 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 }.",
  57072. referencedClasses: [],
  57073. pragmas: [],
  57074. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  57075. }),
  57076. $globals.AssociativeCollectionTest);
  57077. $core.addMethod(
  57078. $core.method({
  57079. selector: "testKeys",
  57080. protocol: "tests",
  57081. fn: function (){
  57082. var self=this,$self=this;
  57083. return $core.withContext(function($ctx1) {
  57084. var $2,$1,$3,$4;
  57085. $2=$recv($recv($self._collectionClass())._new())._keys();
  57086. $ctx1.sendIdx["keys"]=1;
  57087. $1=$recv($2)._isEmpty();
  57088. $self._assert_($1);
  57089. $3=$recv($self._collection())._keys();
  57090. $ctx1.sendIdx["keys"]=2;
  57091. $4=$self._collectionKeys();
  57092. $ctx1.sendIdx["collectionKeys"]=1;
  57093. $self._assertSameContents_as_($3,$4);
  57094. $ctx1.sendIdx["assertSameContents:as:"]=1;
  57095. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  57096. return self;
  57097. }, function($ctx1) {$ctx1.fill(self,"testKeys",{})});
  57098. },
  57099. args: [],
  57100. 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 }",
  57101. referencedClasses: [],
  57102. pragmas: [],
  57103. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  57104. }),
  57105. $globals.AssociativeCollectionTest);
  57106. $core.addMethod(
  57107. $core.method({
  57108. selector: "testNewFromPairs",
  57109. protocol: "tests",
  57110. fn: function (){
  57111. var self=this,$self=this;
  57112. var flattenedAssociations;
  57113. return $core.withContext(function($ctx1) {
  57114. flattenedAssociations=["a",(1),"b",(2)];
  57115. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  57116. return self;
  57117. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations})});
  57118. },
  57119. args: [],
  57120. 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 }.",
  57121. referencedClasses: [],
  57122. pragmas: [],
  57123. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  57124. }),
  57125. $globals.AssociativeCollectionTest);
  57126. $core.addMethod(
  57127. $core.method({
  57128. selector: "testPrintString",
  57129. protocol: "tests",
  57130. fn: function (){
  57131. var self=this,$self=this;
  57132. return $core.withContext(function($ctx1) {
  57133. var $3,$2,$1,$4;
  57134. $3=$self._collectionClass();
  57135. $ctx1.sendIdx["collectionClass"]=1;
  57136. $2=$recv($3)._new();
  57137. $recv($2)._at_put_("firstname","James");
  57138. $ctx1.sendIdx["at:put:"]=1;
  57139. $recv($2)._at_put_("lastname","Bond");
  57140. $1=$recv($2)._printString();
  57141. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  57142. $ctx1.sendIdx[","]=1;
  57143. $self._assert_equals_($1,$4);
  57144. return self;
  57145. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{})});
  57146. },
  57147. args: [],
  57148. 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'')'",
  57149. referencedClasses: [],
  57150. pragmas: [],
  57151. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  57152. }),
  57153. $globals.AssociativeCollectionTest);
  57154. $core.addMethod(
  57155. $core.method({
  57156. selector: "testRemoveKey",
  57157. protocol: "tests",
  57158. fn: function (){
  57159. var self=this,$self=this;
  57160. return $core.withContext(function($ctx1) {
  57161. var $1,$2,$3,$5,$6,$4,$8,$7;
  57162. $self._nonIndexesDo_((function(each){
  57163. var collection;
  57164. return $core.withContext(function($ctx2) {
  57165. collection=$self._collection();
  57166. $ctx2.sendIdx["collection"]=1;
  57167. $self._should_raise_((function(){
  57168. return $core.withContext(function($ctx3) {
  57169. return $recv(collection)._removeKey_(each);
  57170. $ctx3.sendIdx["removeKey:"]=1;
  57171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57172. }),$globals.Error);
  57173. $1=collection;
  57174. $2=$self._collection();
  57175. $ctx2.sendIdx["collection"]=2;
  57176. return $self._assert_equals_($1,$2);
  57177. $ctx2.sendIdx["assert:equals:"]=1;
  57178. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  57179. }));
  57180. $self._samplesDo_((function(index,value){
  57181. var collection;
  57182. return $core.withContext(function($ctx2) {
  57183. collection=$self._collection();
  57184. $ctx2.sendIdx["collection"]=3;
  57185. $3=$recv(collection)._removeKey_(index);
  57186. $ctx2.sendIdx["removeKey:"]=2;
  57187. $self._assert_equals_($3,value);
  57188. $ctx2.sendIdx["assert:equals:"]=2;
  57189. $5=collection;
  57190. $6=$self._collection();
  57191. $ctx2.sendIdx["collection"]=4;
  57192. $4=$recv($5).__eq($6);
  57193. return $self._deny_($4);
  57194. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  57195. }));
  57196. $8=$self._collectionWithNewValue();
  57197. $recv($8)._removeKey_($self._sampleNewIndex());
  57198. $7=$recv($8)._yourself();
  57199. $self._assert_equals_($7,$self._collection());
  57200. return self;
  57201. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{})});
  57202. },
  57203. args: [],
  57204. 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",
  57205. referencedClasses: ["Error"],
  57206. pragmas: [],
  57207. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  57208. }),
  57209. $globals.AssociativeCollectionTest);
  57210. $core.addMethod(
  57211. $core.method({
  57212. selector: "testRemoveKeyIfAbsent",
  57213. protocol: "tests",
  57214. fn: function (){
  57215. var self=this,$self=this;
  57216. return $core.withContext(function($ctx1) {
  57217. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  57218. $self._nonIndexesDo_((function(each){
  57219. var collection;
  57220. return $core.withContext(function($ctx2) {
  57221. collection=$self._collection();
  57222. $ctx2.sendIdx["collection"]=1;
  57223. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  57224. return $core.withContext(function($ctx3) {
  57225. return $self._sampleNewValue();
  57226. $ctx3.sendIdx["sampleNewValue"]=1;
  57227. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57228. }));
  57229. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  57230. $2=$self._sampleNewValue();
  57231. $ctx2.sendIdx["sampleNewValue"]=2;
  57232. $self._assert_equals_($1,$2);
  57233. $ctx2.sendIdx["assert:equals:"]=1;
  57234. $3=collection;
  57235. $4=$self._collection();
  57236. $ctx2.sendIdx["collection"]=2;
  57237. return $self._assert_equals_($3,$4);
  57238. $ctx2.sendIdx["assert:equals:"]=2;
  57239. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  57240. }));
  57241. $self._samplesDo_((function(index,value){
  57242. var collection;
  57243. return $core.withContext(function($ctx2) {
  57244. collection=$self._collection();
  57245. $ctx2.sendIdx["collection"]=3;
  57246. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  57247. return $core.withContext(function($ctx3) {
  57248. return $self._sampleNewValue();
  57249. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  57250. }));
  57251. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  57252. $self._assert_equals_($5,value);
  57253. $ctx2.sendIdx["assert:equals:"]=3;
  57254. $7=collection;
  57255. $8=$self._collection();
  57256. $ctx2.sendIdx["collection"]=4;
  57257. $6=$recv($7).__eq($8);
  57258. return $self._deny_($6);
  57259. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  57260. }));
  57261. $10=$self._collectionWithNewValue();
  57262. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  57263. return $core.withContext(function($ctx2) {
  57264. return $self._assert_(false);
  57265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57266. }));
  57267. $9=$recv($10)._yourself();
  57268. $self._assert_equals_($9,$self._collection());
  57269. return self;
  57270. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{})});
  57271. },
  57272. args: [],
  57273. 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",
  57274. referencedClasses: [],
  57275. pragmas: [],
  57276. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  57277. }),
  57278. $globals.AssociativeCollectionTest);
  57279. $core.addMethod(
  57280. $core.method({
  57281. selector: "testValues",
  57282. protocol: "tests",
  57283. fn: function (){
  57284. var self=this,$self=this;
  57285. return $core.withContext(function($ctx1) {
  57286. var $2,$1,$3,$4;
  57287. $2=$recv($recv($self._collectionClass())._new())._values();
  57288. $ctx1.sendIdx["values"]=1;
  57289. $1=$recv($2)._isEmpty();
  57290. $self._assert_($1);
  57291. $3=$recv($self._collection())._values();
  57292. $ctx1.sendIdx["values"]=2;
  57293. $4=$self._collectionValues();
  57294. $ctx1.sendIdx["collectionValues"]=1;
  57295. $self._assertSameContents_as_($3,$4);
  57296. $ctx1.sendIdx["assertSameContents:as:"]=1;
  57297. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  57298. return self;
  57299. }, function($ctx1) {$ctx1.fill(self,"testValues",{})});
  57300. },
  57301. args: [],
  57302. 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 }",
  57303. referencedClasses: [],
  57304. pragmas: [],
  57305. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  57306. }),
  57307. $globals.AssociativeCollectionTest);
  57308. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  57309. $core.addMethod(
  57310. $core.method({
  57311. selector: "collection",
  57312. protocol: "fixture",
  57313. fn: function (){
  57314. var self=this,$self=this;
  57315. return $core.withContext(function($ctx1) {
  57316. var $1;
  57317. $1=$recv($globals.Dictionary)._new();
  57318. $recv($1)._at_put_((1),(1));
  57319. $ctx1.sendIdx["at:put:"]=1;
  57320. $recv($1)._at_put_("a",(2));
  57321. $ctx1.sendIdx["at:put:"]=2;
  57322. $recv($1)._at_put_(true,(3));
  57323. $ctx1.sendIdx["at:put:"]=3;
  57324. $recv($1)._at_put_((1).__at((3)),(-4));
  57325. $ctx1.sendIdx["at:put:"]=4;
  57326. $recv($1)._at_put_($self.sampleBlock,(9));
  57327. return $recv($1)._yourself();
  57328. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  57329. },
  57330. args: [],
  57331. 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",
  57332. referencedClasses: ["Dictionary"],
  57333. pragmas: [],
  57334. messageSends: ["at:put:", "new", "@", "yourself"]
  57335. }),
  57336. $globals.DictionaryTest);
  57337. $core.addMethod(
  57338. $core.method({
  57339. selector: "collectionKeys",
  57340. protocol: "fixture",
  57341. fn: function (){
  57342. var self=this,$self=this;
  57343. return $core.withContext(function($ctx1) {
  57344. return [(1),"a",true,(1).__at((3)),$self.sampleBlock];
  57345. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  57346. },
  57347. args: [],
  57348. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  57349. referencedClasses: [],
  57350. pragmas: [],
  57351. messageSends: ["@"]
  57352. }),
  57353. $globals.DictionaryTest);
  57354. $core.addMethod(
  57355. $core.method({
  57356. selector: "collectionOfPrintStrings",
  57357. protocol: "fixture",
  57358. fn: function (){
  57359. var self=this,$self=this;
  57360. return $core.withContext(function($ctx1) {
  57361. var $1;
  57362. $1=$recv($globals.Dictionary)._new();
  57363. $recv($1)._at_put_((1),"1");
  57364. $ctx1.sendIdx["at:put:"]=1;
  57365. $recv($1)._at_put_("a","2");
  57366. $ctx1.sendIdx["at:put:"]=2;
  57367. $recv($1)._at_put_(true,"3");
  57368. $ctx1.sendIdx["at:put:"]=3;
  57369. $recv($1)._at_put_((1).__at((3)),"-4");
  57370. $ctx1.sendIdx["at:put:"]=4;
  57371. $recv($1)._at_put_($self.sampleBlock,"9");
  57372. return $recv($1)._yourself();
  57373. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  57374. },
  57375. args: [],
  57376. 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",
  57377. referencedClasses: ["Dictionary"],
  57378. pragmas: [],
  57379. messageSends: ["at:put:", "new", "@", "yourself"]
  57380. }),
  57381. $globals.DictionaryTest);
  57382. $core.addMethod(
  57383. $core.method({
  57384. selector: "collectionSize",
  57385. protocol: "fixture",
  57386. fn: function (){
  57387. var self=this,$self=this;
  57388. return (5);
  57389. },
  57390. args: [],
  57391. source: "collectionSize\x0a\x09^ 5",
  57392. referencedClasses: [],
  57393. pragmas: [],
  57394. messageSends: []
  57395. }),
  57396. $globals.DictionaryTest);
  57397. $core.addMethod(
  57398. $core.method({
  57399. selector: "collectionValues",
  57400. protocol: "fixture",
  57401. fn: function (){
  57402. var self=this,$self=this;
  57403. return [(1),(2),(3),(-4),(9)];
  57404. },
  57405. args: [],
  57406. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  57407. referencedClasses: [],
  57408. pragmas: [],
  57409. messageSends: []
  57410. }),
  57411. $globals.DictionaryTest);
  57412. $core.addMethod(
  57413. $core.method({
  57414. selector: "collectionWithDuplicates",
  57415. protocol: "fixture",
  57416. fn: function (){
  57417. var self=this,$self=this;
  57418. return $core.withContext(function($ctx1) {
  57419. var $1;
  57420. $1=$recv($globals.Dictionary)._new();
  57421. $recv($1)._at_put_((1),(1));
  57422. $ctx1.sendIdx["at:put:"]=1;
  57423. $recv($1)._at_put_("a",(2));
  57424. $ctx1.sendIdx["at:put:"]=2;
  57425. $recv($1)._at_put_(true,(3));
  57426. $ctx1.sendIdx["at:put:"]=3;
  57427. $recv($1)._at_put_((4),(-4));
  57428. $ctx1.sendIdx["at:put:"]=4;
  57429. $recv($1)._at_put_($self.sampleBlock,(9));
  57430. $ctx1.sendIdx["at:put:"]=5;
  57431. $recv($1)._at_put_("b",(1));
  57432. $ctx1.sendIdx["at:put:"]=6;
  57433. $recv($1)._at_put_((3),(3));
  57434. $ctx1.sendIdx["at:put:"]=7;
  57435. $recv($1)._at_put_(false,(12));
  57436. return $recv($1)._yourself();
  57437. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  57438. },
  57439. args: [],
  57440. 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",
  57441. referencedClasses: ["Dictionary"],
  57442. pragmas: [],
  57443. messageSends: ["at:put:", "new", "yourself"]
  57444. }),
  57445. $globals.DictionaryTest);
  57446. $core.addMethod(
  57447. $core.method({
  57448. selector: "collectionWithNewValue",
  57449. protocol: "fixture",
  57450. fn: function (){
  57451. var self=this,$self=this;
  57452. return $core.withContext(function($ctx1) {
  57453. var $1;
  57454. $1=$recv($globals.Dictionary)._new();
  57455. $recv($1)._at_put_((1),(1));
  57456. $ctx1.sendIdx["at:put:"]=1;
  57457. $recv($1)._at_put_("a",(2));
  57458. $ctx1.sendIdx["at:put:"]=2;
  57459. $recv($1)._at_put_(true,(3));
  57460. $ctx1.sendIdx["at:put:"]=3;
  57461. $recv($1)._at_put_((1).__at((3)),(-4));
  57462. $ctx1.sendIdx["at:put:"]=4;
  57463. $recv($1)._at_put_($self.sampleBlock,(9));
  57464. $ctx1.sendIdx["at:put:"]=5;
  57465. $recv($1)._at_put_("new","N");
  57466. return $recv($1)._yourself();
  57467. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  57468. },
  57469. args: [],
  57470. 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",
  57471. referencedClasses: ["Dictionary"],
  57472. pragmas: [],
  57473. messageSends: ["at:put:", "new", "@", "yourself"]
  57474. }),
  57475. $globals.DictionaryTest);
  57476. $core.addMethod(
  57477. $core.method({
  57478. selector: "sampleNewValueAsCollection",
  57479. protocol: "fixture",
  57480. fn: function (){
  57481. var self=this,$self=this;
  57482. return $core.withContext(function($ctx1) {
  57483. var $1;
  57484. $1=$recv($globals.Dictionary)._new();
  57485. $recv($1)._at_put_("new","N");
  57486. return $recv($1)._yourself();
  57487. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  57488. },
  57489. args: [],
  57490. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  57491. referencedClasses: ["Dictionary"],
  57492. pragmas: [],
  57493. messageSends: ["at:put:", "new", "yourself"]
  57494. }),
  57495. $globals.DictionaryTest);
  57496. $core.addMethod(
  57497. $core.method({
  57498. selector: "samplesDo:",
  57499. protocol: "fixture",
  57500. fn: function (aBlock){
  57501. var self=this,$self=this;
  57502. return $core.withContext(function($ctx1) {
  57503. (
  57504. $ctx1.supercall = true,
  57505. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  57506. $ctx1.supercall = false;
  57507. $recv(aBlock)._value_value_(true,(3));
  57508. $ctx1.sendIdx["value:value:"]=1;
  57509. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  57510. $ctx1.sendIdx["value:value:"]=2;
  57511. $recv(aBlock)._value_value_($self.sampleBlock,(9));
  57512. return self;
  57513. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  57514. },
  57515. args: ["aBlock"],
  57516. 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",
  57517. referencedClasses: [],
  57518. pragmas: [],
  57519. messageSends: ["samplesDo:", "value:value:", "@"]
  57520. }),
  57521. $globals.DictionaryTest);
  57522. $core.addMethod(
  57523. $core.method({
  57524. selector: "testAccessing",
  57525. protocol: "tests",
  57526. fn: function (){
  57527. var self=this,$self=this;
  57528. var d;
  57529. return $core.withContext(function($ctx1) {
  57530. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  57531. d=$recv($globals.Dictionary)._new();
  57532. $recv(d)._at_put_("hello","world");
  57533. $ctx1.sendIdx["at:put:"]=1;
  57534. $1=$recv(d)._at_("hello");
  57535. $ctx1.sendIdx["at:"]=1;
  57536. $self._assert_equals_($1,"world");
  57537. $ctx1.sendIdx["assert:equals:"]=1;
  57538. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  57539. return nil;
  57540. }));
  57541. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57542. $self._assert_equals_($2,"world");
  57543. $ctx1.sendIdx["assert:equals:"]=2;
  57544. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  57545. return nil;
  57546. }))).__eq("world"));
  57547. $ctx1.sendIdx["deny:"]=1;
  57548. $3=$recv(d)._includesKey_("hello");
  57549. $ctx1.sendIdx["includesKey:"]=1;
  57550. $self._assert_($3);
  57551. $ctx1.sendIdx["assert:"]=1;
  57552. $4=$recv(d)._includesKey_("foo");
  57553. $ctx1.sendIdx["includesKey:"]=2;
  57554. $self._deny_($4);
  57555. $ctx1.sendIdx["deny:"]=2;
  57556. $recv(d)._at_put_((1),(2));
  57557. $ctx1.sendIdx["at:put:"]=2;
  57558. $5=$recv(d)._at_((1));
  57559. $ctx1.sendIdx["at:"]=2;
  57560. $self._assert_equals_($5,(2));
  57561. $ctx1.sendIdx["assert:equals:"]=3;
  57562. $6=d;
  57563. $7=(1).__at((3));
  57564. $ctx1.sendIdx["@"]=1;
  57565. $recv($6)._at_put_($7,(3));
  57566. $9=d;
  57567. $10=(1).__at((3));
  57568. $ctx1.sendIdx["@"]=2;
  57569. $8=$recv($9)._at_($10);
  57570. $self._assert_equals_($8,(3));
  57571. $12=d;
  57572. $13=(1).__at((3));
  57573. $ctx1.sendIdx["@"]=3;
  57574. $11=$recv($12)._includesKey_($13);
  57575. $ctx1.sendIdx["includesKey:"]=3;
  57576. $self._assert_($11);
  57577. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  57578. return self;
  57579. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d})});
  57580. },
  57581. args: [],
  57582. 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)",
  57583. referencedClasses: ["Dictionary"],
  57584. pragmas: [],
  57585. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  57586. }),
  57587. $globals.DictionaryTest);
  57588. $core.addMethod(
  57589. $core.method({
  57590. selector: "testDynamicDictionaries",
  57591. protocol: "tests",
  57592. fn: function (){
  57593. var self=this,$self=this;
  57594. return $core.withContext(function($ctx1) {
  57595. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  57596. return self;
  57597. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  57598. },
  57599. args: [],
  57600. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  57601. referencedClasses: ["Dictionary"],
  57602. pragmas: [],
  57603. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  57604. }),
  57605. $globals.DictionaryTest);
  57606. $core.addMethod(
  57607. $core.method({
  57608. selector: "collectionClass",
  57609. protocol: "fixture",
  57610. fn: function (){
  57611. var self=this,$self=this;
  57612. return $globals.Dictionary;
  57613. },
  57614. args: [],
  57615. source: "collectionClass\x0a\x09^ Dictionary",
  57616. referencedClasses: ["Dictionary"],
  57617. pragmas: [],
  57618. messageSends: []
  57619. }),
  57620. $globals.DictionaryTest.a$cls);
  57621. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  57622. $core.addMethod(
  57623. $core.method({
  57624. selector: "collection",
  57625. protocol: "fixture",
  57626. fn: function (){
  57627. var self=this,$self=this;
  57628. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  57629. },
  57630. args: [],
  57631. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  57632. referencedClasses: [],
  57633. pragmas: [],
  57634. messageSends: []
  57635. }),
  57636. $globals.HashedCollectionTest);
  57637. $core.addMethod(
  57638. $core.method({
  57639. selector: "collectionKeys",
  57640. protocol: "fixture",
  57641. fn: function (){
  57642. var self=this,$self=this;
  57643. return ["b","a","c","d"];
  57644. },
  57645. args: [],
  57646. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  57647. referencedClasses: [],
  57648. pragmas: [],
  57649. messageSends: []
  57650. }),
  57651. $globals.HashedCollectionTest);
  57652. $core.addMethod(
  57653. $core.method({
  57654. selector: "collectionOfPrintStrings",
  57655. protocol: "fixture",
  57656. fn: function (){
  57657. var self=this,$self=this;
  57658. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  57659. },
  57660. args: [],
  57661. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  57662. referencedClasses: [],
  57663. pragmas: [],
  57664. messageSends: []
  57665. }),
  57666. $globals.HashedCollectionTest);
  57667. $core.addMethod(
  57668. $core.method({
  57669. selector: "collectionSize",
  57670. protocol: "fixture",
  57671. fn: function (){
  57672. var self=this,$self=this;
  57673. return (4);
  57674. },
  57675. args: [],
  57676. source: "collectionSize\x0a\x09^ 4",
  57677. referencedClasses: [],
  57678. pragmas: [],
  57679. messageSends: []
  57680. }),
  57681. $globals.HashedCollectionTest);
  57682. $core.addMethod(
  57683. $core.method({
  57684. selector: "collectionValues",
  57685. protocol: "fixture",
  57686. fn: function (){
  57687. var self=this,$self=this;
  57688. return [(1),(2),(3),(-4)];
  57689. },
  57690. args: [],
  57691. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  57692. referencedClasses: [],
  57693. pragmas: [],
  57694. messageSends: []
  57695. }),
  57696. $globals.HashedCollectionTest);
  57697. $core.addMethod(
  57698. $core.method({
  57699. selector: "collectionWithDuplicates",
  57700. protocol: "fixture",
  57701. fn: function (){
  57702. var self=this,$self=this;
  57703. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  57704. },
  57705. args: [],
  57706. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  57707. referencedClasses: [],
  57708. pragmas: [],
  57709. messageSends: []
  57710. }),
  57711. $globals.HashedCollectionTest);
  57712. $core.addMethod(
  57713. $core.method({
  57714. selector: "collectionWithNewValue",
  57715. protocol: "fixture",
  57716. fn: function (){
  57717. var self=this,$self=this;
  57718. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  57719. },
  57720. args: [],
  57721. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  57722. referencedClasses: [],
  57723. pragmas: [],
  57724. messageSends: []
  57725. }),
  57726. $globals.HashedCollectionTest);
  57727. $core.addMethod(
  57728. $core.method({
  57729. selector: "sampleNewValueAsCollection",
  57730. protocol: "fixture",
  57731. fn: function (){
  57732. var self=this,$self=this;
  57733. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  57734. },
  57735. args: [],
  57736. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  57737. referencedClasses: [],
  57738. pragmas: [],
  57739. messageSends: []
  57740. }),
  57741. $globals.HashedCollectionTest);
  57742. $core.addMethod(
  57743. $core.method({
  57744. selector: "testDynamicDictionaries",
  57745. protocol: "tests",
  57746. fn: function (){
  57747. var self=this,$self=this;
  57748. return $core.withContext(function($ctx1) {
  57749. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  57750. return self;
  57751. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  57752. },
  57753. args: [],
  57754. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  57755. referencedClasses: ["HashedCollection"],
  57756. pragmas: [],
  57757. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  57758. }),
  57759. $globals.HashedCollectionTest);
  57760. $core.addMethod(
  57761. $core.method({
  57762. selector: "collectionClass",
  57763. protocol: "fixture",
  57764. fn: function (){
  57765. var self=this,$self=this;
  57766. return $globals.HashedCollection;
  57767. },
  57768. args: [],
  57769. source: "collectionClass\x0a\x09^ HashedCollection",
  57770. referencedClasses: ["HashedCollection"],
  57771. pragmas: [],
  57772. messageSends: []
  57773. }),
  57774. $globals.HashedCollectionTest.a$cls);
  57775. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  57776. $core.addMethod(
  57777. $core.method({
  57778. selector: "collectionFirst",
  57779. protocol: "fixture",
  57780. fn: function (){
  57781. var self=this,$self=this;
  57782. return $core.withContext(function($ctx1) {
  57783. $self._subclassResponsibility();
  57784. return self;
  57785. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{})});
  57786. },
  57787. args: [],
  57788. source: "collectionFirst\x0a\x09self subclassResponsibility",
  57789. referencedClasses: [],
  57790. pragmas: [],
  57791. messageSends: ["subclassResponsibility"]
  57792. }),
  57793. $globals.SequenceableCollectionTest);
  57794. $core.addMethod(
  57795. $core.method({
  57796. selector: "collectionFirstTwo",
  57797. protocol: "fixture",
  57798. fn: function (){
  57799. var self=this,$self=this;
  57800. return $core.withContext(function($ctx1) {
  57801. $self._subclassResponsibility();
  57802. return self;
  57803. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{})});
  57804. },
  57805. args: [],
  57806. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  57807. referencedClasses: [],
  57808. pragmas: [],
  57809. messageSends: ["subclassResponsibility"]
  57810. }),
  57811. $globals.SequenceableCollectionTest);
  57812. $core.addMethod(
  57813. $core.method({
  57814. selector: "collectionLast",
  57815. protocol: "fixture",
  57816. fn: function (){
  57817. var self=this,$self=this;
  57818. return $core.withContext(function($ctx1) {
  57819. $self._subclassResponsibility();
  57820. return self;
  57821. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{})});
  57822. },
  57823. args: [],
  57824. source: "collectionLast\x0a\x09self subclassResponsibility",
  57825. referencedClasses: [],
  57826. pragmas: [],
  57827. messageSends: ["subclassResponsibility"]
  57828. }),
  57829. $globals.SequenceableCollectionTest);
  57830. $core.addMethod(
  57831. $core.method({
  57832. selector: "collectionLastTwo",
  57833. protocol: "fixture",
  57834. fn: function (){
  57835. var self=this,$self=this;
  57836. return $core.withContext(function($ctx1) {
  57837. $self._subclassResponsibility();
  57838. return self;
  57839. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{})});
  57840. },
  57841. args: [],
  57842. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  57843. referencedClasses: [],
  57844. pragmas: [],
  57845. messageSends: ["subclassResponsibility"]
  57846. }),
  57847. $globals.SequenceableCollectionTest);
  57848. $core.addMethod(
  57849. $core.method({
  57850. selector: "nonIndexesDo:",
  57851. protocol: "fixture",
  57852. fn: function (aBlock){
  57853. var self=this,$self=this;
  57854. return $core.withContext(function($ctx1) {
  57855. $recv(aBlock)._value_((0));
  57856. $ctx1.sendIdx["value:"]=1;
  57857. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  57858. $ctx1.sendIdx["value:"]=2;
  57859. $recv(aBlock)._value_("z");
  57860. return self;
  57861. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  57862. },
  57863. args: ["aBlock"],
  57864. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  57865. referencedClasses: [],
  57866. pragmas: [],
  57867. messageSends: ["value:", "+", "collectionSize"]
  57868. }),
  57869. $globals.SequenceableCollectionTest);
  57870. $core.addMethod(
  57871. $core.method({
  57872. selector: "samplesDo:",
  57873. protocol: "fixture",
  57874. fn: function (aBlock){
  57875. var self=this,$self=this;
  57876. return $core.withContext(function($ctx1) {
  57877. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  57878. $ctx1.sendIdx["value:value:"]=1;
  57879. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  57880. return self;
  57881. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  57882. },
  57883. args: ["aBlock"],
  57884. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  57885. referencedClasses: [],
  57886. pragmas: [],
  57887. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  57888. }),
  57889. $globals.SequenceableCollectionTest);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "testBeginsWith",
  57893. protocol: "tests",
  57894. fn: function (){
  57895. var self=this,$self=this;
  57896. return $core.withContext(function($ctx1) {
  57897. var $2,$1,$4,$5,$3,$7,$6;
  57898. $2=$self._collection();
  57899. $ctx1.sendIdx["collection"]=1;
  57900. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  57901. $ctx1.sendIdx["beginsWith:"]=1;
  57902. $self._assert_($1);
  57903. $ctx1.sendIdx["assert:"]=1;
  57904. $4=$self._collection();
  57905. $ctx1.sendIdx["collection"]=2;
  57906. $5=$self._collection();
  57907. $ctx1.sendIdx["collection"]=3;
  57908. $3=$recv($4)._beginsWith_($5);
  57909. $ctx1.sendIdx["beginsWith:"]=2;
  57910. $self._assert_($3);
  57911. $ctx1.sendIdx["assert:"]=2;
  57912. $7=$self._collection();
  57913. $ctx1.sendIdx["collection"]=4;
  57914. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  57915. $ctx1.sendIdx["beginsWith:"]=3;
  57916. $self._assert_($6);
  57917. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  57918. return self;
  57919. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{})});
  57920. },
  57921. args: [],
  57922. 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)",
  57923. referencedClasses: [],
  57924. pragmas: [],
  57925. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  57926. }),
  57927. $globals.SequenceableCollectionTest);
  57928. $core.addMethod(
  57929. $core.method({
  57930. selector: "testEndsWith",
  57931. protocol: "tests",
  57932. fn: function (){
  57933. var self=this,$self=this;
  57934. return $core.withContext(function($ctx1) {
  57935. var $2,$1,$4,$5,$3,$7,$6;
  57936. $2=$self._collection();
  57937. $ctx1.sendIdx["collection"]=1;
  57938. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  57939. $ctx1.sendIdx["endsWith:"]=1;
  57940. $self._assert_($1);
  57941. $ctx1.sendIdx["assert:"]=1;
  57942. $4=$self._collection();
  57943. $ctx1.sendIdx["collection"]=2;
  57944. $5=$self._collection();
  57945. $ctx1.sendIdx["collection"]=3;
  57946. $3=$recv($4)._endsWith_($5);
  57947. $ctx1.sendIdx["endsWith:"]=2;
  57948. $self._assert_($3);
  57949. $ctx1.sendIdx["assert:"]=2;
  57950. $7=$self._collection();
  57951. $ctx1.sendIdx["collection"]=4;
  57952. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  57953. $ctx1.sendIdx["endsWith:"]=3;
  57954. $self._assert_($6);
  57955. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  57956. return self;
  57957. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{})});
  57958. },
  57959. args: [],
  57960. 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)",
  57961. referencedClasses: [],
  57962. pragmas: [],
  57963. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  57964. }),
  57965. $globals.SequenceableCollectionTest);
  57966. $core.addMethod(
  57967. $core.method({
  57968. selector: "testFirst",
  57969. protocol: "tests",
  57970. fn: function (){
  57971. var self=this,$self=this;
  57972. return $core.withContext(function($ctx1) {
  57973. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  57974. return self;
  57975. }, function($ctx1) {$ctx1.fill(self,"testFirst",{})});
  57976. },
  57977. args: [],
  57978. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  57979. referencedClasses: [],
  57980. pragmas: [],
  57981. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  57982. }),
  57983. $globals.SequenceableCollectionTest);
  57984. $core.addMethod(
  57985. $core.method({
  57986. selector: "testFirstN",
  57987. protocol: "tests",
  57988. fn: function (){
  57989. var self=this,$self=this;
  57990. return $core.withContext(function($ctx1) {
  57991. var $2,$1,$4,$3,$6,$5,$7;
  57992. $2=$self._collection();
  57993. $ctx1.sendIdx["collection"]=1;
  57994. $1=$recv($2)._first_((2));
  57995. $ctx1.sendIdx["first:"]=1;
  57996. $self._assert_equals_($1,$self._collectionFirstTwo());
  57997. $ctx1.sendIdx["assert:equals:"]=1;
  57998. $4=$self._collection();
  57999. $ctx1.sendIdx["collection"]=2;
  58000. $3=$recv($4)._first_((0));
  58001. $ctx1.sendIdx["first:"]=2;
  58002. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  58003. $ctx1.sendIdx["assert:equals:"]=2;
  58004. $6=$self._collection();
  58005. $ctx1.sendIdx["collection"]=3;
  58006. $5=$recv($6)._first_($self._collectionSize());
  58007. $ctx1.sendIdx["first:"]=3;
  58008. $7=$self._collection();
  58009. $ctx1.sendIdx["collection"]=4;
  58010. $self._assert_equals_($5,$7);
  58011. $self._should_raise_((function(){
  58012. return $core.withContext(function($ctx2) {
  58013. return $recv($self._collection())._first_((33));
  58014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58015. }),$globals.Error);
  58016. return self;
  58017. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{})});
  58018. },
  58019. args: [],
  58020. 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",
  58021. referencedClasses: ["Error"],
  58022. pragmas: [],
  58023. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  58024. }),
  58025. $globals.SequenceableCollectionTest);
  58026. $core.addMethod(
  58027. $core.method({
  58028. selector: "testFourth",
  58029. protocol: "tests",
  58030. fn: function (){
  58031. var self=this,$self=this;
  58032. return $core.withContext(function($ctx1) {
  58033. var $2,$1;
  58034. $2=$self._collection();
  58035. $ctx1.sendIdx["collection"]=1;
  58036. $1=$recv($2)._fourth();
  58037. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  58038. return self;
  58039. }, function($ctx1) {$ctx1.fill(self,"testFourth",{})});
  58040. },
  58041. args: [],
  58042. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  58043. referencedClasses: [],
  58044. pragmas: [],
  58045. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  58046. }),
  58047. $globals.SequenceableCollectionTest);
  58048. $core.addMethod(
  58049. $core.method({
  58050. selector: "testIndexOfStartingAt",
  58051. protocol: "tests",
  58052. fn: function (){
  58053. var self=this,$self=this;
  58054. var jsNull;
  58055. return $core.withContext(function($ctx1) {
  58056. var $2,$1,$4,$3;
  58057. jsNull=$recv($globals.JSON)._parse_("null");
  58058. $self._samplesDo_((function(index,value){
  58059. return $core.withContext(function($ctx2) {
  58060. $2=$self._collection();
  58061. $ctx2.sendIdx["collection"]=1;
  58062. $1=$recv($2)._indexOf_startingAt_(value,(1));
  58063. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  58064. $self._assert_equals_($1,index);
  58065. $ctx2.sendIdx["assert:equals:"]=1;
  58066. $4=$self._collection();
  58067. $ctx2.sendIdx["collection"]=2;
  58068. $3=$recv($4)._indexOf_startingAt_(value,index);
  58069. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  58070. $self._assert_equals_($3,index);
  58071. $ctx2.sendIdx["assert:equals:"]=2;
  58072. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  58073. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  58074. }));
  58075. return self;
  58076. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull})});
  58077. },
  58078. args: [],
  58079. 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 ]",
  58080. referencedClasses: ["JSON"],
  58081. pragmas: [],
  58082. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  58083. }),
  58084. $globals.SequenceableCollectionTest);
  58085. $core.addMethod(
  58086. $core.method({
  58087. selector: "testIndexOfStartingAtWithNull",
  58088. protocol: "tests",
  58089. fn: function (){
  58090. var self=this,$self=this;
  58091. var jsNull;
  58092. return $core.withContext(function($ctx1) {
  58093. var $1,$2;
  58094. jsNull=$recv($globals.JSON)._parse_("null");
  58095. $self._samplesDo_((function(index,value){
  58096. var collection;
  58097. return $core.withContext(function($ctx2) {
  58098. collection=$self._collection();
  58099. $recv(collection)._at_put_(index,jsNull);
  58100. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  58101. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  58102. $self._assert_equals_($1,index);
  58103. $ctx2.sendIdx["assert:equals:"]=1;
  58104. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  58105. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  58106. $self._assert_equals_($2,index);
  58107. $ctx2.sendIdx["assert:equals:"]=2;
  58108. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  58109. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  58110. }));
  58111. return self;
  58112. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull})});
  58113. },
  58114. args: [],
  58115. 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 ]",
  58116. referencedClasses: ["JSON"],
  58117. pragmas: [],
  58118. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  58119. }),
  58120. $globals.SequenceableCollectionTest);
  58121. $core.addMethod(
  58122. $core.method({
  58123. selector: "testLast",
  58124. protocol: "tests",
  58125. fn: function (){
  58126. var self=this,$self=this;
  58127. return $core.withContext(function($ctx1) {
  58128. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  58129. return self;
  58130. }, function($ctx1) {$ctx1.fill(self,"testLast",{})});
  58131. },
  58132. args: [],
  58133. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  58134. referencedClasses: [],
  58135. pragmas: [],
  58136. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  58137. }),
  58138. $globals.SequenceableCollectionTest);
  58139. $core.addMethod(
  58140. $core.method({
  58141. selector: "testLastN",
  58142. protocol: "tests",
  58143. fn: function (){
  58144. var self=this,$self=this;
  58145. return $core.withContext(function($ctx1) {
  58146. var $2,$1,$4,$3,$6,$5,$7;
  58147. $2=$self._collection();
  58148. $ctx1.sendIdx["collection"]=1;
  58149. $1=$recv($2)._last_((2));
  58150. $ctx1.sendIdx["last:"]=1;
  58151. $self._assert_equals_($1,$self._collectionLastTwo());
  58152. $ctx1.sendIdx["assert:equals:"]=1;
  58153. $4=$self._collection();
  58154. $ctx1.sendIdx["collection"]=2;
  58155. $3=$recv($4)._last_((0));
  58156. $ctx1.sendIdx["last:"]=2;
  58157. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  58158. $ctx1.sendIdx["assert:equals:"]=2;
  58159. $6=$self._collection();
  58160. $ctx1.sendIdx["collection"]=3;
  58161. $5=$recv($6)._last_($self._collectionSize());
  58162. $ctx1.sendIdx["last:"]=3;
  58163. $7=$self._collection();
  58164. $ctx1.sendIdx["collection"]=4;
  58165. $self._assert_equals_($5,$7);
  58166. $self._should_raise_((function(){
  58167. return $core.withContext(function($ctx2) {
  58168. return $recv($self._collection())._last_((33));
  58169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58170. }),$globals.Error);
  58171. return self;
  58172. }, function($ctx1) {$ctx1.fill(self,"testLastN",{})});
  58173. },
  58174. args: [],
  58175. 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",
  58176. referencedClasses: ["Error"],
  58177. pragmas: [],
  58178. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  58179. }),
  58180. $globals.SequenceableCollectionTest);
  58181. $core.addMethod(
  58182. $core.method({
  58183. selector: "testSecond",
  58184. protocol: "tests",
  58185. fn: function (){
  58186. var self=this,$self=this;
  58187. return $core.withContext(function($ctx1) {
  58188. var $2,$1;
  58189. $2=$self._collection();
  58190. $ctx1.sendIdx["collection"]=1;
  58191. $1=$recv($2)._second();
  58192. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  58193. return self;
  58194. }, function($ctx1) {$ctx1.fill(self,"testSecond",{})});
  58195. },
  58196. args: [],
  58197. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  58198. referencedClasses: [],
  58199. pragmas: [],
  58200. messageSends: ["assert:equals:", "second", "collection", "at:"]
  58201. }),
  58202. $globals.SequenceableCollectionTest);
  58203. $core.addMethod(
  58204. $core.method({
  58205. selector: "testThird",
  58206. protocol: "tests",
  58207. fn: function (){
  58208. var self=this,$self=this;
  58209. return $core.withContext(function($ctx1) {
  58210. var $2,$1;
  58211. $2=$self._collection();
  58212. $ctx1.sendIdx["collection"]=1;
  58213. $1=$recv($2)._third();
  58214. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  58215. return self;
  58216. }, function($ctx1) {$ctx1.fill(self,"testThird",{})});
  58217. },
  58218. args: [],
  58219. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  58220. referencedClasses: [],
  58221. pragmas: [],
  58222. messageSends: ["assert:equals:", "third", "collection", "at:"]
  58223. }),
  58224. $globals.SequenceableCollectionTest);
  58225. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  58226. $core.addMethod(
  58227. $core.method({
  58228. selector: "collection",
  58229. protocol: "fixture",
  58230. fn: function (){
  58231. var self=this,$self=this;
  58232. return [(1), (2), (3), (-4)];
  58233. },
  58234. args: [],
  58235. source: "collection\x0a\x09^ #(1 2 3 -4)",
  58236. referencedClasses: [],
  58237. pragmas: [],
  58238. messageSends: []
  58239. }),
  58240. $globals.ArrayTest);
  58241. $core.addMethod(
  58242. $core.method({
  58243. selector: "collectionFirst",
  58244. protocol: "fixture",
  58245. fn: function (){
  58246. var self=this,$self=this;
  58247. return (1);
  58248. },
  58249. args: [],
  58250. source: "collectionFirst\x0a\x09^ 1",
  58251. referencedClasses: [],
  58252. pragmas: [],
  58253. messageSends: []
  58254. }),
  58255. $globals.ArrayTest);
  58256. $core.addMethod(
  58257. $core.method({
  58258. selector: "collectionFirstTwo",
  58259. protocol: "fixture",
  58260. fn: function (){
  58261. var self=this,$self=this;
  58262. return [(1), (2)];
  58263. },
  58264. args: [],
  58265. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  58266. referencedClasses: [],
  58267. pragmas: [],
  58268. messageSends: []
  58269. }),
  58270. $globals.ArrayTest);
  58271. $core.addMethod(
  58272. $core.method({
  58273. selector: "collectionLast",
  58274. protocol: "fixture",
  58275. fn: function (){
  58276. var self=this,$self=this;
  58277. return (-4);
  58278. },
  58279. args: [],
  58280. source: "collectionLast\x0a\x09^ -4",
  58281. referencedClasses: [],
  58282. pragmas: [],
  58283. messageSends: []
  58284. }),
  58285. $globals.ArrayTest);
  58286. $core.addMethod(
  58287. $core.method({
  58288. selector: "collectionLastTwo",
  58289. protocol: "fixture",
  58290. fn: function (){
  58291. var self=this,$self=this;
  58292. return [(3), (-4)];
  58293. },
  58294. args: [],
  58295. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  58296. referencedClasses: [],
  58297. pragmas: [],
  58298. messageSends: []
  58299. }),
  58300. $globals.ArrayTest);
  58301. $core.addMethod(
  58302. $core.method({
  58303. selector: "collectionOfPrintStrings",
  58304. protocol: "fixture",
  58305. fn: function (){
  58306. var self=this,$self=this;
  58307. return ["1", "2", "3", "-4"];
  58308. },
  58309. args: [],
  58310. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  58311. referencedClasses: [],
  58312. pragmas: [],
  58313. messageSends: []
  58314. }),
  58315. $globals.ArrayTest);
  58316. $core.addMethod(
  58317. $core.method({
  58318. selector: "collectionSize",
  58319. protocol: "fixture",
  58320. fn: function (){
  58321. var self=this,$self=this;
  58322. return (4);
  58323. },
  58324. args: [],
  58325. source: "collectionSize\x0a\x09^ 4",
  58326. referencedClasses: [],
  58327. pragmas: [],
  58328. messageSends: []
  58329. }),
  58330. $globals.ArrayTest);
  58331. $core.addMethod(
  58332. $core.method({
  58333. selector: "collectionWithDuplicates",
  58334. protocol: "fixture",
  58335. fn: function (){
  58336. var self=this,$self=this;
  58337. return ["a", "b", "c", (1), (2), (1), "a", []];
  58338. },
  58339. args: [],
  58340. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  58341. referencedClasses: [],
  58342. pragmas: [],
  58343. messageSends: []
  58344. }),
  58345. $globals.ArrayTest);
  58346. $core.addMethod(
  58347. $core.method({
  58348. selector: "collectionWithNewValue",
  58349. protocol: "fixture",
  58350. fn: function (){
  58351. var self=this,$self=this;
  58352. return [(1), (2), (3), (-4), "N"];
  58353. },
  58354. args: [],
  58355. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  58356. referencedClasses: [],
  58357. pragmas: [],
  58358. messageSends: []
  58359. }),
  58360. $globals.ArrayTest);
  58361. $core.addMethod(
  58362. $core.method({
  58363. selector: "sampleNewIndex",
  58364. protocol: "fixture",
  58365. fn: function (){
  58366. var self=this,$self=this;
  58367. return (5);
  58368. },
  58369. args: [],
  58370. source: "sampleNewIndex\x0a\x09^ 5",
  58371. referencedClasses: [],
  58372. pragmas: [],
  58373. messageSends: []
  58374. }),
  58375. $globals.ArrayTest);
  58376. $core.addMethod(
  58377. $core.method({
  58378. selector: "samplesDo:",
  58379. protocol: "fixture",
  58380. fn: function (aBlock){
  58381. var self=this,$self=this;
  58382. return $core.withContext(function($ctx1) {
  58383. (
  58384. $ctx1.supercall = true,
  58385. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  58386. $ctx1.supercall = false;
  58387. $recv(aBlock)._value_value_((3),(3));
  58388. return self;
  58389. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  58390. },
  58391. args: ["aBlock"],
  58392. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  58393. referencedClasses: [],
  58394. pragmas: [],
  58395. messageSends: ["samplesDo:", "value:value:"]
  58396. }),
  58397. $globals.ArrayTest);
  58398. $core.addMethod(
  58399. $core.method({
  58400. selector: "testAdd",
  58401. protocol: "tests",
  58402. fn: function (){
  58403. var self=this,$self=this;
  58404. var array;
  58405. return $core.withContext(function($ctx1) {
  58406. array=$self._collection();
  58407. $recv(array)._add_((6));
  58408. $self._assert_equals_($recv(array)._last(),(6));
  58409. return self;
  58410. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array})});
  58411. },
  58412. args: [],
  58413. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  58414. referencedClasses: [],
  58415. pragmas: [],
  58416. messageSends: ["collection", "add:", "assert:equals:", "last"]
  58417. }),
  58418. $globals.ArrayTest);
  58419. $core.addMethod(
  58420. $core.method({
  58421. selector: "testAddFirst",
  58422. protocol: "tests",
  58423. fn: function (){
  58424. var self=this,$self=this;
  58425. return $core.withContext(function($ctx1) {
  58426. var $3,$2,$1;
  58427. $3=$self._collection();
  58428. $recv($3)._addFirst_((0));
  58429. $2=$recv($3)._yourself();
  58430. $1=$recv($2)._first();
  58431. $self._assert_equals_($1,(0));
  58432. return self;
  58433. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{})});
  58434. },
  58435. args: [],
  58436. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  58437. referencedClasses: [],
  58438. pragmas: [],
  58439. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  58440. }),
  58441. $globals.ArrayTest);
  58442. $core.addMethod(
  58443. $core.method({
  58444. selector: "testPrintString",
  58445. protocol: "tests",
  58446. fn: function (){
  58447. var self=this,$self=this;
  58448. var array;
  58449. return $core.withContext(function($ctx1) {
  58450. var $1,$2,$3,$4,$5,$6,$7;
  58451. array=$recv($globals.Array)._new();
  58452. $1=$recv(array)._printString();
  58453. $ctx1.sendIdx["printString"]=1;
  58454. $self._assert_equals_($1,"an Array ()");
  58455. $ctx1.sendIdx["assert:equals:"]=1;
  58456. $2=array;
  58457. $recv($2)._add_((1));
  58458. $ctx1.sendIdx["add:"]=1;
  58459. $recv($2)._add_((3));
  58460. $ctx1.sendIdx["add:"]=2;
  58461. $3=$recv(array)._printString();
  58462. $ctx1.sendIdx["printString"]=2;
  58463. $self._assert_equals_($3,"an Array (1 3)");
  58464. $ctx1.sendIdx["assert:equals:"]=2;
  58465. $recv(array)._add_("foo");
  58466. $4=$recv(array)._printString();
  58467. $ctx1.sendIdx["printString"]=3;
  58468. $self._assert_equals_($4,"an Array (1 3 'foo')");
  58469. $ctx1.sendIdx["assert:equals:"]=3;
  58470. $5=array;
  58471. $recv($5)._remove_((1));
  58472. $ctx1.sendIdx["remove:"]=1;
  58473. $recv($5)._remove_((3));
  58474. $6=$recv(array)._printString();
  58475. $ctx1.sendIdx["printString"]=4;
  58476. $self._assert_equals_($6,"an Array ('foo')");
  58477. $ctx1.sendIdx["assert:equals:"]=4;
  58478. $recv(array)._addLast_((3));
  58479. $ctx1.sendIdx["addLast:"]=1;
  58480. $7=$recv(array)._printString();
  58481. $ctx1.sendIdx["printString"]=5;
  58482. $self._assert_equals_($7,"an Array ('foo' 3)");
  58483. $ctx1.sendIdx["assert:equals:"]=5;
  58484. $recv(array)._addLast_((3));
  58485. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  58486. return self;
  58487. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array})});
  58488. },
  58489. args: [],
  58490. 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)'.",
  58491. referencedClasses: ["Array"],
  58492. pragmas: [],
  58493. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  58494. }),
  58495. $globals.ArrayTest);
  58496. $core.addMethod(
  58497. $core.method({
  58498. selector: "testRemove",
  58499. protocol: "tests",
  58500. fn: function (){
  58501. var self=this,$self=this;
  58502. var array;
  58503. return $core.withContext(function($ctx1) {
  58504. array=[(1), (2), (3), (4), (5)];
  58505. $recv(array)._remove_((3));
  58506. $ctx1.sendIdx["remove:"]=1;
  58507. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  58508. $self._should_raise_((function(){
  58509. return $core.withContext(function($ctx2) {
  58510. return $recv(array)._remove_((3));
  58511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58512. }),$globals.Error);
  58513. return self;
  58514. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array})});
  58515. },
  58516. args: [],
  58517. 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",
  58518. referencedClasses: ["Error"],
  58519. pragmas: [],
  58520. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  58521. }),
  58522. $globals.ArrayTest);
  58523. $core.addMethod(
  58524. $core.method({
  58525. selector: "testRemoveFromTo",
  58526. protocol: "tests",
  58527. fn: function (){
  58528. var self=this,$self=this;
  58529. return $core.withContext(function($ctx1) {
  58530. var $1,$2;
  58531. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  58532. $ctx1.sendIdx["removeFrom:to:"]=1;
  58533. $self._assert_equals_($1,[(4)]);
  58534. $ctx1.sendIdx["assert:equals:"]=1;
  58535. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  58536. $ctx1.sendIdx["removeFrom:to:"]=2;
  58537. $self._assert_equals_($2,[(1), (4)]);
  58538. $ctx1.sendIdx["assert:equals:"]=2;
  58539. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  58540. return self;
  58541. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{})});
  58542. },
  58543. args: [],
  58544. 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)",
  58545. referencedClasses: [],
  58546. pragmas: [],
  58547. messageSends: ["assert:equals:", "removeFrom:to:"]
  58548. }),
  58549. $globals.ArrayTest);
  58550. $core.addMethod(
  58551. $core.method({
  58552. selector: "testRemoveIndex",
  58553. protocol: "tests",
  58554. fn: function (){
  58555. var self=this,$self=this;
  58556. return $core.withContext(function($ctx1) {
  58557. var $1,$2;
  58558. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  58559. $ctx1.sendIdx["removeIndex:"]=1;
  58560. $self._assert_equals_($1,[(1), (3), (4)]);
  58561. $ctx1.sendIdx["assert:equals:"]=1;
  58562. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  58563. $ctx1.sendIdx["removeIndex:"]=2;
  58564. $self._assert_equals_($2,[(2), (3), (4)]);
  58565. $ctx1.sendIdx["assert:equals:"]=2;
  58566. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  58567. return self;
  58568. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{})});
  58569. },
  58570. args: [],
  58571. 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: #()",
  58572. referencedClasses: [],
  58573. pragmas: [],
  58574. messageSends: ["assert:equals:", "removeIndex:"]
  58575. }),
  58576. $globals.ArrayTest);
  58577. $core.addMethod(
  58578. $core.method({
  58579. selector: "testRemoveLast",
  58580. protocol: "tests",
  58581. fn: function (){
  58582. var self=this,$self=this;
  58583. var array;
  58584. return $core.withContext(function($ctx1) {
  58585. array=[(1), (2)];
  58586. $recv(array)._removeLast();
  58587. $self._assert_equals_($recv(array)._last(),(1));
  58588. return self;
  58589. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array})});
  58590. },
  58591. args: [],
  58592. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  58593. referencedClasses: [],
  58594. pragmas: [],
  58595. messageSends: ["removeLast", "assert:equals:", "last"]
  58596. }),
  58597. $globals.ArrayTest);
  58598. $core.addMethod(
  58599. $core.method({
  58600. selector: "testReversed",
  58601. protocol: "tests",
  58602. fn: function (){
  58603. var self=this,$self=this;
  58604. var array;
  58605. return $core.withContext(function($ctx1) {
  58606. array=[(5), (4), (3), (2), (1)];
  58607. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  58608. return self;
  58609. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array})});
  58610. },
  58611. args: [],
  58612. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  58613. referencedClasses: [],
  58614. pragmas: [],
  58615. messageSends: ["assert:equals:", "reversed"]
  58616. }),
  58617. $globals.ArrayTest);
  58618. $core.addMethod(
  58619. $core.method({
  58620. selector: "testSort",
  58621. protocol: "tests",
  58622. fn: function (){
  58623. var self=this,$self=this;
  58624. var array;
  58625. return $core.withContext(function($ctx1) {
  58626. array=[(10), (1), (5)];
  58627. $recv(array)._sort();
  58628. $self._assert_equals_(array,[(1), (5), (10)]);
  58629. return self;
  58630. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array})});
  58631. },
  58632. args: [],
  58633. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  58634. referencedClasses: [],
  58635. pragmas: [],
  58636. messageSends: ["sort", "assert:equals:"]
  58637. }),
  58638. $globals.ArrayTest);
  58639. $core.addMethod(
  58640. $core.method({
  58641. selector: "collectionClass",
  58642. protocol: "fixture",
  58643. fn: function (){
  58644. var self=this,$self=this;
  58645. return $globals.Array;
  58646. },
  58647. args: [],
  58648. source: "collectionClass\x0a\x09^ Array",
  58649. referencedClasses: ["Array"],
  58650. pragmas: [],
  58651. messageSends: []
  58652. }),
  58653. $globals.ArrayTest.a$cls);
  58654. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  58655. $core.addMethod(
  58656. $core.method({
  58657. selector: "collection",
  58658. protocol: "fixture",
  58659. fn: function (){
  58660. var self=this,$self=this;
  58661. return "helLo";
  58662. },
  58663. args: [],
  58664. source: "collection\x0a\x09^ 'helLo'",
  58665. referencedClasses: [],
  58666. pragmas: [],
  58667. messageSends: []
  58668. }),
  58669. $globals.StringTest);
  58670. $core.addMethod(
  58671. $core.method({
  58672. selector: "collectionFirst",
  58673. protocol: "fixture",
  58674. fn: function (){
  58675. var self=this,$self=this;
  58676. return "h";
  58677. },
  58678. args: [],
  58679. source: "collectionFirst\x0a\x09^ 'h'",
  58680. referencedClasses: [],
  58681. pragmas: [],
  58682. messageSends: []
  58683. }),
  58684. $globals.StringTest);
  58685. $core.addMethod(
  58686. $core.method({
  58687. selector: "collectionFirstTwo",
  58688. protocol: "fixture",
  58689. fn: function (){
  58690. var self=this,$self=this;
  58691. return "he";
  58692. },
  58693. args: [],
  58694. source: "collectionFirstTwo\x0a\x09^ 'he'",
  58695. referencedClasses: [],
  58696. pragmas: [],
  58697. messageSends: []
  58698. }),
  58699. $globals.StringTest);
  58700. $core.addMethod(
  58701. $core.method({
  58702. selector: "collectionLast",
  58703. protocol: "fixture",
  58704. fn: function (){
  58705. var self=this,$self=this;
  58706. return "o";
  58707. },
  58708. args: [],
  58709. source: "collectionLast\x0a\x09^ 'o'",
  58710. referencedClasses: [],
  58711. pragmas: [],
  58712. messageSends: []
  58713. }),
  58714. $globals.StringTest);
  58715. $core.addMethod(
  58716. $core.method({
  58717. selector: "collectionLastTwo",
  58718. protocol: "fixture",
  58719. fn: function (){
  58720. var self=this,$self=this;
  58721. return "Lo";
  58722. },
  58723. args: [],
  58724. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  58725. referencedClasses: [],
  58726. pragmas: [],
  58727. messageSends: []
  58728. }),
  58729. $globals.StringTest);
  58730. $core.addMethod(
  58731. $core.method({
  58732. selector: "collectionOfPrintStrings",
  58733. protocol: "fixture",
  58734. fn: function (){
  58735. var self=this,$self=this;
  58736. return "'h''e''l''L''o'";
  58737. },
  58738. args: [],
  58739. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  58740. referencedClasses: [],
  58741. pragmas: [],
  58742. messageSends: []
  58743. }),
  58744. $globals.StringTest);
  58745. $core.addMethod(
  58746. $core.method({
  58747. selector: "collectionSize",
  58748. protocol: "fixture",
  58749. fn: function (){
  58750. var self=this,$self=this;
  58751. return (5);
  58752. },
  58753. args: [],
  58754. source: "collectionSize\x0a\x09^ 5",
  58755. referencedClasses: [],
  58756. pragmas: [],
  58757. messageSends: []
  58758. }),
  58759. $globals.StringTest);
  58760. $core.addMethod(
  58761. $core.method({
  58762. selector: "collectionWithDuplicates",
  58763. protocol: "fixture",
  58764. fn: function (){
  58765. var self=this,$self=this;
  58766. return "abbaerten";
  58767. },
  58768. args: [],
  58769. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  58770. referencedClasses: [],
  58771. pragmas: [],
  58772. messageSends: []
  58773. }),
  58774. $globals.StringTest);
  58775. $core.addMethod(
  58776. $core.method({
  58777. selector: "collectionWithNewValue",
  58778. protocol: "fixture",
  58779. fn: function (){
  58780. var self=this,$self=this;
  58781. return "helLoN";
  58782. },
  58783. args: [],
  58784. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  58785. referencedClasses: [],
  58786. pragmas: [],
  58787. messageSends: []
  58788. }),
  58789. $globals.StringTest);
  58790. $core.addMethod(
  58791. $core.method({
  58792. selector: "sampleNewValueAsCollection",
  58793. protocol: "fixture",
  58794. fn: function (){
  58795. var self=this,$self=this;
  58796. return "N";
  58797. },
  58798. args: [],
  58799. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  58800. referencedClasses: [],
  58801. pragmas: [],
  58802. messageSends: []
  58803. }),
  58804. $globals.StringTest);
  58805. $core.addMethod(
  58806. $core.method({
  58807. selector: "samplesDo:",
  58808. protocol: "fixture",
  58809. fn: function (aBlock){
  58810. var self=this,$self=this;
  58811. return $core.withContext(function($ctx1) {
  58812. (
  58813. $ctx1.supercall = true,
  58814. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  58815. $ctx1.supercall = false;
  58816. $recv(aBlock)._value_value_((3),"l");
  58817. return self;
  58818. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  58819. },
  58820. args: ["aBlock"],
  58821. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  58822. referencedClasses: [],
  58823. pragmas: [],
  58824. messageSends: ["samplesDo:", "value:value:"]
  58825. }),
  58826. $globals.StringTest);
  58827. $core.addMethod(
  58828. $core.method({
  58829. selector: "testAddAll",
  58830. protocol: "tests",
  58831. fn: function (){
  58832. var self=this,$self=this;
  58833. return $core.withContext(function($ctx1) {
  58834. var $1;
  58835. $self._should_raise_((function(){
  58836. return $core.withContext(function($ctx2) {
  58837. $1=$self._collection();
  58838. $ctx2.sendIdx["collection"]=1;
  58839. return $recv($1)._addAll_($self._collection());
  58840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58841. }),$globals.Error);
  58842. return self;
  58843. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  58844. },
  58845. args: [],
  58846. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  58847. referencedClasses: ["Error"],
  58848. pragmas: [],
  58849. messageSends: ["should:raise:", "addAll:", "collection"]
  58850. }),
  58851. $globals.StringTest);
  58852. $core.addMethod(
  58853. $core.method({
  58854. selector: "testAddRemove",
  58855. protocol: "tests",
  58856. fn: function (){
  58857. var self=this,$self=this;
  58858. return $core.withContext(function($ctx1) {
  58859. $self._should_raise_((function(){
  58860. return $core.withContext(function($ctx2) {
  58861. return "hello"._add_("a");
  58862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58863. }),$globals.Error);
  58864. $ctx1.sendIdx["should:raise:"]=1;
  58865. $self._should_raise_((function(){
  58866. return $core.withContext(function($ctx2) {
  58867. return "hello"._remove_("h");
  58868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58869. }),$globals.Error);
  58870. return self;
  58871. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{})});
  58872. },
  58873. args: [],
  58874. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  58875. referencedClasses: ["Error"],
  58876. pragmas: [],
  58877. messageSends: ["should:raise:", "add:", "remove:"]
  58878. }),
  58879. $globals.StringTest);
  58880. $core.addMethod(
  58881. $core.method({
  58882. selector: "testAsArray",
  58883. protocol: "tests",
  58884. fn: function (){
  58885. var self=this,$self=this;
  58886. return $core.withContext(function($ctx1) {
  58887. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  58888. return self;
  58889. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  58890. },
  58891. args: [],
  58892. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  58893. referencedClasses: [],
  58894. pragmas: [],
  58895. messageSends: ["assert:equals:", "asArray"]
  58896. }),
  58897. $globals.StringTest);
  58898. $core.addMethod(
  58899. $core.method({
  58900. selector: "testAsLowerCase",
  58901. protocol: "tests",
  58902. fn: function (){
  58903. var self=this,$self=this;
  58904. return $core.withContext(function($ctx1) {
  58905. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  58906. return self;
  58907. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{})});
  58908. },
  58909. args: [],
  58910. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  58911. referencedClasses: [],
  58912. pragmas: [],
  58913. messageSends: ["assert:equals:", "asLowercase"]
  58914. }),
  58915. $globals.StringTest);
  58916. $core.addMethod(
  58917. $core.method({
  58918. selector: "testAsNumber",
  58919. protocol: "tests",
  58920. fn: function (){
  58921. var self=this,$self=this;
  58922. return $core.withContext(function($ctx1) {
  58923. var $1,$2;
  58924. $1="3"._asNumber();
  58925. $ctx1.sendIdx["asNumber"]=1;
  58926. $self._assert_equals_($1,(3));
  58927. $ctx1.sendIdx["assert:equals:"]=1;
  58928. $2="-3"._asNumber();
  58929. $ctx1.sendIdx["asNumber"]=2;
  58930. $self._assert_equals_($2,(-3));
  58931. $ctx1.sendIdx["assert:equals:"]=2;
  58932. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  58933. return self;
  58934. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  58935. },
  58936. args: [],
  58937. 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.",
  58938. referencedClasses: [],
  58939. pragmas: [],
  58940. messageSends: ["assert:equals:", "asNumber"]
  58941. }),
  58942. $globals.StringTest);
  58943. $core.addMethod(
  58944. $core.method({
  58945. selector: "testAsUpperCase",
  58946. protocol: "tests",
  58947. fn: function (){
  58948. var self=this,$self=this;
  58949. return $core.withContext(function($ctx1) {
  58950. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  58951. return self;
  58952. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{})});
  58953. },
  58954. args: [],
  58955. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  58956. referencedClasses: [],
  58957. pragmas: [],
  58958. messageSends: ["assert:equals:", "asUppercase"]
  58959. }),
  58960. $globals.StringTest);
  58961. $core.addMethod(
  58962. $core.method({
  58963. selector: "testAsciiValue",
  58964. protocol: "tests",
  58965. fn: function (){
  58966. var self=this,$self=this;
  58967. var characterA,characterU;
  58968. return $core.withContext(function($ctx1) {
  58969. var $1;
  58970. characterA="A";
  58971. characterU="U";
  58972. $1=$recv(characterA)._asciiValue();
  58973. $ctx1.sendIdx["asciiValue"]=1;
  58974. $self._assert_equals_($1,(65));
  58975. $ctx1.sendIdx["assert:equals:"]=1;
  58976. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  58977. return self;
  58978. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU})});
  58979. },
  58980. args: [],
  58981. 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",
  58982. referencedClasses: [],
  58983. pragmas: [],
  58984. messageSends: ["assert:equals:", "asciiValue"]
  58985. }),
  58986. $globals.StringTest);
  58987. $core.addMethod(
  58988. $core.method({
  58989. selector: "testAtIfAbsentPut",
  58990. protocol: "tests",
  58991. fn: function (){
  58992. var self=this,$self=this;
  58993. return $core.withContext(function($ctx1) {
  58994. $self._should_raise_((function(){
  58995. return $core.withContext(function($ctx2) {
  58996. return "hello"._at_ifAbsentPut_((6),(function(){
  58997. return "a";
  58998. }));
  58999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59000. }),$globals.Error);
  59001. return self;
  59002. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{})});
  59003. },
  59004. args: [],
  59005. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  59006. referencedClasses: ["Error"],
  59007. pragmas: [],
  59008. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  59009. }),
  59010. $globals.StringTest);
  59011. $core.addMethod(
  59012. $core.method({
  59013. selector: "testAtPut",
  59014. protocol: "tests",
  59015. fn: function (){
  59016. var self=this,$self=this;
  59017. return $core.withContext(function($ctx1) {
  59018. $self._should_raise_((function(){
  59019. return $core.withContext(function($ctx2) {
  59020. return "hello"._at_put_((1),"a");
  59021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59022. }),$globals.Error);
  59023. return self;
  59024. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{})});
  59025. },
  59026. args: [],
  59027. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  59028. referencedClasses: ["Error"],
  59029. pragmas: [],
  59030. messageSends: ["should:raise:", "at:put:"]
  59031. }),
  59032. $globals.StringTest);
  59033. $core.addMethod(
  59034. $core.method({
  59035. selector: "testCapitalized",
  59036. protocol: "tests",
  59037. fn: function (){
  59038. var self=this,$self=this;
  59039. return $core.withContext(function($ctx1) {
  59040. var $1,$2,$3;
  59041. $1="test"._capitalized();
  59042. $ctx1.sendIdx["capitalized"]=1;
  59043. $self._assert_equals_($1,"Test");
  59044. $ctx1.sendIdx["assert:equals:"]=1;
  59045. $2="Test"._capitalized();
  59046. $ctx1.sendIdx["capitalized"]=2;
  59047. $self._assert_equals_($2,"Test");
  59048. $ctx1.sendIdx["assert:equals:"]=2;
  59049. $self._assert_equals_(""._capitalized(),"");
  59050. $ctx1.sendIdx["assert:equals:"]=3;
  59051. $3="Test"._isCapitalized();
  59052. $ctx1.sendIdx["isCapitalized"]=1;
  59053. $self._assert_equals_($3,true);
  59054. $ctx1.sendIdx["assert:equals:"]=4;
  59055. $self._assert_equals_("test"._isCapitalized(),false);
  59056. return self;
  59057. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{})});
  59058. },
  59059. args: [],
  59060. 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.",
  59061. referencedClasses: [],
  59062. pragmas: [],
  59063. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  59064. }),
  59065. $globals.StringTest);
  59066. $core.addMethod(
  59067. $core.method({
  59068. selector: "testCharCodeAt",
  59069. protocol: "tests",
  59070. fn: function (){
  59071. var self=this,$self=this;
  59072. return $core.withContext(function($ctx1) {
  59073. var $1,$2,$3,$4,$5;
  59074. $1="jackie"._charCodeAt_((1));
  59075. $ctx1.sendIdx["charCodeAt:"]=1;
  59076. $self._assert_equals_($1,(106));
  59077. $ctx1.sendIdx["assert:equals:"]=1;
  59078. $2="jackie"._charCodeAt_((2));
  59079. $ctx1.sendIdx["charCodeAt:"]=2;
  59080. $self._assert_equals_($2,(97));
  59081. $ctx1.sendIdx["assert:equals:"]=2;
  59082. $3="jackie"._charCodeAt_((3));
  59083. $ctx1.sendIdx["charCodeAt:"]=3;
  59084. $self._assert_equals_($3,(99));
  59085. $ctx1.sendIdx["assert:equals:"]=3;
  59086. $4="jackie"._charCodeAt_((4));
  59087. $ctx1.sendIdx["charCodeAt:"]=4;
  59088. $self._assert_equals_($4,(107));
  59089. $ctx1.sendIdx["assert:equals:"]=4;
  59090. $5="jackie"._charCodeAt_((5));
  59091. $ctx1.sendIdx["charCodeAt:"]=5;
  59092. $self._assert_equals_($5,(105));
  59093. $ctx1.sendIdx["assert:equals:"]=5;
  59094. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  59095. return self;
  59096. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{})});
  59097. },
  59098. args: [],
  59099. 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",
  59100. referencedClasses: [],
  59101. pragmas: [],
  59102. messageSends: ["assert:equals:", "charCodeAt:"]
  59103. }),
  59104. $globals.StringTest);
  59105. $core.addMethod(
  59106. $core.method({
  59107. selector: "testCopyFromTo",
  59108. protocol: "tests",
  59109. fn: function (){
  59110. var self=this,$self=this;
  59111. return $core.withContext(function($ctx1) {
  59112. var $1;
  59113. $1="jackie"._copyFrom_to_((1),(3));
  59114. $ctx1.sendIdx["copyFrom:to:"]=1;
  59115. $self._assert_equals_($1,"jac");
  59116. $ctx1.sendIdx["assert:equals:"]=1;
  59117. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  59118. return self;
  59119. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{})});
  59120. },
  59121. args: [],
  59122. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  59123. referencedClasses: [],
  59124. pragmas: [],
  59125. messageSends: ["assert:equals:", "copyFrom:to:"]
  59126. }),
  59127. $globals.StringTest);
  59128. $core.addMethod(
  59129. $core.method({
  59130. selector: "testCopySeparates",
  59131. protocol: "tests",
  59132. fn: function (){
  59133. var self=this,$self=this;
  59134. return $core.withContext(function($ctx1) {
  59135. var $3,$2,$1;
  59136. $3=$self._collection();
  59137. $ctx1.sendIdx["collection"]=1;
  59138. $2=$recv($3)._copy();
  59139. $1=$recv($2).__eq_eq($self._collection());
  59140. $self._assert_($1);
  59141. return self;
  59142. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{})});
  59143. },
  59144. args: [],
  59145. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  59146. referencedClasses: [],
  59147. pragmas: [],
  59148. messageSends: ["assert:", "==", "copy", "collection"]
  59149. }),
  59150. $globals.StringTest);
  59151. $core.addMethod(
  59152. $core.method({
  59153. selector: "testCopyWithoutAll",
  59154. protocol: "tests",
  59155. fn: function (){
  59156. var self=this,$self=this;
  59157. return $core.withContext(function($ctx1) {
  59158. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  59159. return self;
  59160. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{})});
  59161. },
  59162. args: [],
  59163. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  59164. referencedClasses: [],
  59165. pragmas: [],
  59166. messageSends: ["assert:equals:", "copyWithoutAll:"]
  59167. }),
  59168. $globals.StringTest);
  59169. $core.addMethod(
  59170. $core.method({
  59171. selector: "testEquality",
  59172. protocol: "tests",
  59173. fn: function (){
  59174. var self=this,$self=this;
  59175. return $core.withContext(function($ctx1) {
  59176. var $1,$2,$3;
  59177. $self._assert_equals_("hello","hello");
  59178. $ctx1.sendIdx["assert:equals:"]=1;
  59179. $1="hello".__eq("world");
  59180. $ctx1.sendIdx["="]=1;
  59181. $self._deny_($1);
  59182. $ctx1.sendIdx["deny:"]=1;
  59183. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  59184. })));
  59185. $ctx1.sendIdx["="]=2;
  59186. $self._deny_($2);
  59187. $ctx1.sendIdx["deny:"]=2;
  59188. $3="hello"._yourself();
  59189. $ctx1.sendIdx["yourself"]=1;
  59190. $self._assert_equals_("hello",$3);
  59191. $ctx1.sendIdx["assert:equals:"]=2;
  59192. $self._assert_equals_("hello"._yourself(),"hello");
  59193. $self._deny_("".__eq((0)));
  59194. return self;
  59195. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  59196. },
  59197. args: [],
  59198. 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",
  59199. referencedClasses: [],
  59200. pragmas: [],
  59201. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  59202. }),
  59203. $globals.StringTest);
  59204. $core.addMethod(
  59205. $core.method({
  59206. selector: "testIdentity",
  59207. protocol: "tests",
  59208. fn: function (){
  59209. var self=this,$self=this;
  59210. return $core.withContext(function($ctx1) {
  59211. var $1,$2,$4,$3,$5;
  59212. $1="hello".__eq_eq("hello");
  59213. $ctx1.sendIdx["=="]=1;
  59214. $self._assert_($1);
  59215. $ctx1.sendIdx["assert:"]=1;
  59216. $2="hello".__eq_eq("world");
  59217. $ctx1.sendIdx["=="]=2;
  59218. $self._deny_($2);
  59219. $ctx1.sendIdx["deny:"]=1;
  59220. $4="hello"._yourself();
  59221. $ctx1.sendIdx["yourself"]=1;
  59222. $3="hello".__eq_eq($4);
  59223. $ctx1.sendIdx["=="]=3;
  59224. $self._assert_($3);
  59225. $ctx1.sendIdx["assert:"]=2;
  59226. $5=$recv("hello"._yourself()).__eq_eq("hello");
  59227. $ctx1.sendIdx["=="]=4;
  59228. $self._assert_($5);
  59229. $self._deny_("".__eq_eq((0)));
  59230. return self;
  59231. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  59232. },
  59233. args: [],
  59234. 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",
  59235. referencedClasses: [],
  59236. pragmas: [],
  59237. messageSends: ["assert:", "==", "deny:", "yourself"]
  59238. }),
  59239. $globals.StringTest);
  59240. $core.addMethod(
  59241. $core.method({
  59242. selector: "testIncludesSubString",
  59243. protocol: "tests",
  59244. fn: function (){
  59245. var self=this,$self=this;
  59246. return $core.withContext(function($ctx1) {
  59247. var $1;
  59248. $1="amber"._includesSubString_("ber");
  59249. $ctx1.sendIdx["includesSubString:"]=1;
  59250. $self._assert_($1);
  59251. $self._deny_("amber"._includesSubString_("zork"));
  59252. return self;
  59253. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{})});
  59254. },
  59255. args: [],
  59256. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  59257. referencedClasses: [],
  59258. pragmas: [],
  59259. messageSends: ["assert:", "includesSubString:", "deny:"]
  59260. }),
  59261. $globals.StringTest);
  59262. $core.addMethod(
  59263. $core.method({
  59264. selector: "testIndexOfStartingAtWithNull",
  59265. protocol: "tests",
  59266. fn: function (){
  59267. var self=this,$self=this;
  59268. return self;
  59269. },
  59270. args: [],
  59271. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  59272. referencedClasses: [],
  59273. pragmas: [],
  59274. messageSends: []
  59275. }),
  59276. $globals.StringTest);
  59277. $core.addMethod(
  59278. $core.method({
  59279. selector: "testIndexOfWithNull",
  59280. protocol: "tests",
  59281. fn: function (){
  59282. var self=this,$self=this;
  59283. return self;
  59284. },
  59285. args: [],
  59286. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  59287. referencedClasses: [],
  59288. pragmas: [],
  59289. messageSends: []
  59290. }),
  59291. $globals.StringTest);
  59292. $core.addMethod(
  59293. $core.method({
  59294. selector: "testIsVowel",
  59295. protocol: "tests",
  59296. fn: function (){
  59297. var self=this,$self=this;
  59298. var vowel,consonant;
  59299. return $core.withContext(function($ctx1) {
  59300. var $1;
  59301. vowel="u";
  59302. consonant="z";
  59303. $1=$recv(vowel)._isVowel();
  59304. $ctx1.sendIdx["isVowel"]=1;
  59305. $self._assert_equals_($1,true);
  59306. $ctx1.sendIdx["assert:equals:"]=1;
  59307. $self._assert_equals_($recv(consonant)._isVowel(),false);
  59308. return self;
  59309. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant})});
  59310. },
  59311. args: [],
  59312. 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",
  59313. referencedClasses: [],
  59314. pragmas: [],
  59315. messageSends: ["assert:equals:", "isVowel"]
  59316. }),
  59317. $globals.StringTest);
  59318. $core.addMethod(
  59319. $core.method({
  59320. selector: "testJoin",
  59321. protocol: "tests",
  59322. fn: function (){
  59323. var self=this,$self=this;
  59324. return $core.withContext(function($ctx1) {
  59325. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  59326. return self;
  59327. }, function($ctx1) {$ctx1.fill(self,"testJoin",{})});
  59328. },
  59329. args: [],
  59330. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  59331. referencedClasses: [],
  59332. pragmas: [],
  59333. messageSends: ["assert:equals:", "join:"]
  59334. }),
  59335. $globals.StringTest);
  59336. $core.addMethod(
  59337. $core.method({
  59338. selector: "testRegression1224",
  59339. protocol: "tests",
  59340. fn: function (){
  59341. var self=this,$self=this;
  59342. return $core.withContext(function($ctx1) {
  59343. var $2,$1;
  59344. $self._should_raise_((function(){
  59345. return $core.withContext(function($ctx2) {
  59346. $2=$recv($self._collectionClass())._new();
  59347. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  59348. }));
  59349. $1=$recv($2)._yourself();
  59350. return $recv($1)._size();
  59351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59352. }),$globals.Error);
  59353. return self;
  59354. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  59355. },
  59356. args: [],
  59357. 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",
  59358. referencedClasses: ["Error"],
  59359. pragmas: [],
  59360. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  59361. }),
  59362. $globals.StringTest);
  59363. $core.addMethod(
  59364. $core.method({
  59365. selector: "testRemoveAll",
  59366. protocol: "tests",
  59367. fn: function (){
  59368. var self=this,$self=this;
  59369. return $core.withContext(function($ctx1) {
  59370. $self._should_raise_((function(){
  59371. return $core.withContext(function($ctx2) {
  59372. return $recv($self._collection())._removeAll();
  59373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59374. }),$globals.Error);
  59375. return self;
  59376. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  59377. },
  59378. args: [],
  59379. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  59380. referencedClasses: ["Error"],
  59381. pragmas: [],
  59382. messageSends: ["should:raise:", "removeAll", "collection"]
  59383. }),
  59384. $globals.StringTest);
  59385. $core.addMethod(
  59386. $core.method({
  59387. selector: "testReversed",
  59388. protocol: "tests",
  59389. fn: function (){
  59390. var self=this,$self=this;
  59391. return $core.withContext(function($ctx1) {
  59392. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  59393. return self;
  59394. }, function($ctx1) {$ctx1.fill(self,"testReversed",{})});
  59395. },
  59396. args: [],
  59397. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  59398. referencedClasses: [],
  59399. pragmas: [],
  59400. messageSends: ["assert:equals:", "reversed"]
  59401. }),
  59402. $globals.StringTest);
  59403. $core.addMethod(
  59404. $core.method({
  59405. selector: "testStreamContents",
  59406. protocol: "tests",
  59407. fn: function (){
  59408. var self=this,$self=this;
  59409. return $core.withContext(function($ctx1) {
  59410. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  59411. return $core.withContext(function($ctx2) {
  59412. $recv(aStream)._nextPutAll_("hello");
  59413. $ctx2.sendIdx["nextPutAll:"]=1;
  59414. $recv(aStream)._space();
  59415. return $recv(aStream)._nextPutAll_("world");
  59416. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  59417. })),"hello world");
  59418. return self;
  59419. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{})});
  59420. },
  59421. args: [],
  59422. 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'",
  59423. referencedClasses: ["String"],
  59424. pragmas: [],
  59425. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  59426. }),
  59427. $globals.StringTest);
  59428. $core.addMethod(
  59429. $core.method({
  59430. selector: "testSubStrings",
  59431. protocol: "tests",
  59432. fn: function (){
  59433. var self=this,$self=this;
  59434. return $core.withContext(function($ctx1) {
  59435. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  59436. return self;
  59437. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{})});
  59438. },
  59439. args: [],
  59440. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  59441. referencedClasses: [],
  59442. pragmas: [],
  59443. messageSends: ["assert:equals:", "subStrings:"]
  59444. }),
  59445. $globals.StringTest);
  59446. $core.addMethod(
  59447. $core.method({
  59448. selector: "testTrim",
  59449. protocol: "tests",
  59450. fn: function (){
  59451. var self=this,$self=this;
  59452. return $core.withContext(function($ctx1) {
  59453. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  59454. $ctx1.sendIdx["assert:equals:"]=1;
  59455. $self._assert_equals_("jackie "._trimRight(),"jackie");
  59456. return self;
  59457. }, function($ctx1) {$ctx1.fill(self,"testTrim",{})});
  59458. },
  59459. args: [],
  59460. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  59461. referencedClasses: [],
  59462. pragmas: [],
  59463. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  59464. }),
  59465. $globals.StringTest);
  59466. $core.addMethod(
  59467. $core.method({
  59468. selector: "testValue",
  59469. protocol: "tests",
  59470. fn: function (){
  59471. var self=this,$self=this;
  59472. return $core.withContext(function($ctx1) {
  59473. $self._assert_equals_("asString"._value_((1)),"1");
  59474. $ctx1.sendIdx["assert:equals:"]=1;
  59475. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  59476. return self;
  59477. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  59478. },
  59479. args: [],
  59480. 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')",
  59481. referencedClasses: [],
  59482. pragmas: [],
  59483. messageSends: ["assert:equals:", "value:", "collect:"]
  59484. }),
  59485. $globals.StringTest);
  59486. $core.addMethod(
  59487. $core.method({
  59488. selector: "collectionClass",
  59489. protocol: "fixture",
  59490. fn: function (){
  59491. var self=this,$self=this;
  59492. return $globals.String;
  59493. },
  59494. args: [],
  59495. source: "collectionClass\x0a\x09^ String",
  59496. referencedClasses: ["String"],
  59497. pragmas: [],
  59498. messageSends: []
  59499. }),
  59500. $globals.StringTest.a$cls);
  59501. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  59502. $core.addMethod(
  59503. $core.method({
  59504. selector: "collection",
  59505. protocol: "fixture",
  59506. fn: function (){
  59507. var self=this,$self=this;
  59508. return $core.withContext(function($ctx1) {
  59509. var $1;
  59510. $1=$recv($globals.Set)._new();
  59511. $recv($1)._add_($globals.Smalltalk);
  59512. $ctx1.sendIdx["add:"]=1;
  59513. $recv($1)._add_(nil);
  59514. $ctx1.sendIdx["add:"]=2;
  59515. $recv($1)._add_((3).__at((3)));
  59516. $ctx1.sendIdx["add:"]=3;
  59517. $recv($1)._add_(false);
  59518. $ctx1.sendIdx["add:"]=4;
  59519. $recv($1)._add_($self.sampleBlock);
  59520. return $recv($1)._yourself();
  59521. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  59522. },
  59523. args: [],
  59524. 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",
  59525. referencedClasses: ["Set", "Smalltalk"],
  59526. pragmas: [],
  59527. messageSends: ["add:", "new", "@", "yourself"]
  59528. }),
  59529. $globals.SetTest);
  59530. $core.addMethod(
  59531. $core.method({
  59532. selector: "collectionOfPrintStrings",
  59533. protocol: "fixture",
  59534. fn: function (){
  59535. var self=this,$self=this;
  59536. return $core.withContext(function($ctx1) {
  59537. var $1;
  59538. $1=$recv($globals.Set)._new();
  59539. $recv($1)._add_("a SmalltalkImage");
  59540. $ctx1.sendIdx["add:"]=1;
  59541. $recv($1)._add_("nil");
  59542. $ctx1.sendIdx["add:"]=2;
  59543. $recv($1)._add_("3@3");
  59544. $ctx1.sendIdx["add:"]=3;
  59545. $recv($1)._add_("false");
  59546. $ctx1.sendIdx["add:"]=4;
  59547. $recv($1)._add_("a BlockClosure");
  59548. return $recv($1)._yourself();
  59549. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  59550. },
  59551. args: [],
  59552. 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",
  59553. referencedClasses: ["Set"],
  59554. pragmas: [],
  59555. messageSends: ["add:", "new", "yourself"]
  59556. }),
  59557. $globals.SetTest);
  59558. $core.addMethod(
  59559. $core.method({
  59560. selector: "collectionSize",
  59561. protocol: "fixture",
  59562. fn: function (){
  59563. var self=this,$self=this;
  59564. return (5);
  59565. },
  59566. args: [],
  59567. source: "collectionSize\x0a\x09^ 5",
  59568. referencedClasses: [],
  59569. pragmas: [],
  59570. messageSends: []
  59571. }),
  59572. $globals.SetTest);
  59573. $core.addMethod(
  59574. $core.method({
  59575. selector: "collectionWithDuplicates",
  59576. protocol: "fixture",
  59577. fn: function (){
  59578. var self=this,$self=this;
  59579. return $core.withContext(function($ctx1) {
  59580. var $1;
  59581. $1=$self._collection();
  59582. $recv($1)._add_((0));
  59583. return $recv($1)._yourself();
  59584. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  59585. },
  59586. args: [],
  59587. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  59588. referencedClasses: [],
  59589. pragmas: [],
  59590. messageSends: ["add:", "collection", "yourself"]
  59591. }),
  59592. $globals.SetTest);
  59593. $core.addMethod(
  59594. $core.method({
  59595. selector: "collectionWithNewValue",
  59596. protocol: "fixture",
  59597. fn: function (){
  59598. var self=this,$self=this;
  59599. return $core.withContext(function($ctx1) {
  59600. var $1;
  59601. $1=$recv($globals.Set)._new();
  59602. $recv($1)._add_($globals.Smalltalk);
  59603. $ctx1.sendIdx["add:"]=1;
  59604. $recv($1)._add_(nil);
  59605. $ctx1.sendIdx["add:"]=2;
  59606. $recv($1)._add_((3).__at((3)));
  59607. $ctx1.sendIdx["add:"]=3;
  59608. $recv($1)._add_("N");
  59609. $ctx1.sendIdx["add:"]=4;
  59610. $recv($1)._add_(false);
  59611. $ctx1.sendIdx["add:"]=5;
  59612. $recv($1)._add_($self.sampleBlock);
  59613. return $recv($1)._yourself();
  59614. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  59615. },
  59616. args: [],
  59617. 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",
  59618. referencedClasses: ["Set", "Smalltalk"],
  59619. pragmas: [],
  59620. messageSends: ["add:", "new", "@", "yourself"]
  59621. }),
  59622. $globals.SetTest);
  59623. $core.addMethod(
  59624. $core.method({
  59625. selector: "testAddAll",
  59626. protocol: "tests",
  59627. fn: function (){
  59628. var self=this,$self=this;
  59629. return $core.withContext(function($ctx1) {
  59630. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  59631. (
  59632. $ctx1.supercall = true,
  59633. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  59634. $ctx1.supercall = false;
  59635. $2=$self._collection();
  59636. $ctx1.sendIdx["collection"]=1;
  59637. $3=$self._collection();
  59638. $ctx1.sendIdx["collection"]=2;
  59639. $recv($2)._addAll_($3);
  59640. $ctx1.sendIdx["addAll:"]=1;
  59641. $4=$recv($2)._yourself();
  59642. $ctx1.sendIdx["yourself"]=1;
  59643. $1=$4;
  59644. $5=$self._collection();
  59645. $ctx1.sendIdx["collection"]=3;
  59646. $self._assert_equals_($1,$5);
  59647. $ctx1.sendIdx["assert:equals:"]=1;
  59648. $7=$self._collection();
  59649. $ctx1.sendIdx["collection"]=4;
  59650. $8=$self._collectionWithNewValue();
  59651. $ctx1.sendIdx["collectionWithNewValue"]=1;
  59652. $recv($7)._addAll_($8);
  59653. $ctx1.sendIdx["addAll:"]=2;
  59654. $9=$recv($7)._yourself();
  59655. $ctx1.sendIdx["yourself"]=2;
  59656. $6=$9;
  59657. $10=$self._collectionWithNewValue();
  59658. $ctx1.sendIdx["collectionWithNewValue"]=2;
  59659. $self._assert_equals_($6,$10);
  59660. $ctx1.sendIdx["assert:equals:"]=2;
  59661. $12=$self._collectionWithNewValue();
  59662. $ctx1.sendIdx["collectionWithNewValue"]=3;
  59663. $recv($12)._addAll_($self._collection());
  59664. $11=$recv($12)._yourself();
  59665. $self._assert_equals_($11,$self._collectionWithNewValue());
  59666. return self;
  59667. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  59668. },
  59669. args: [],
  59670. 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",
  59671. referencedClasses: [],
  59672. pragmas: [],
  59673. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  59674. }),
  59675. $globals.SetTest);
  59676. $core.addMethod(
  59677. $core.method({
  59678. selector: "testAddRemove",
  59679. protocol: "tests",
  59680. fn: function (){
  59681. var self=this,$self=this;
  59682. var set;
  59683. return $core.withContext(function($ctx1) {
  59684. var $1,$2;
  59685. set=$recv($globals.Set)._new();
  59686. $self._assert_($recv(set)._isEmpty());
  59687. $ctx1.sendIdx["assert:"]=1;
  59688. $recv(set)._add_((3));
  59689. $ctx1.sendIdx["add:"]=1;
  59690. $1=$recv(set)._includes_((3));
  59691. $ctx1.sendIdx["includes:"]=1;
  59692. $self._assert_($1);
  59693. $ctx1.sendIdx["assert:"]=2;
  59694. $recv(set)._add_((5));
  59695. $2=$recv(set)._includes_((5));
  59696. $ctx1.sendIdx["includes:"]=2;
  59697. $self._assert_($2);
  59698. $recv(set)._remove_((3));
  59699. $self._deny_($recv(set)._includes_((3)));
  59700. return self;
  59701. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set})});
  59702. },
  59703. args: [],
  59704. 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)",
  59705. referencedClasses: ["Set"],
  59706. pragmas: [],
  59707. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  59708. }),
  59709. $globals.SetTest);
  59710. $core.addMethod(
  59711. $core.method({
  59712. selector: "testAt",
  59713. protocol: "tests",
  59714. fn: function (){
  59715. var self=this,$self=this;
  59716. return $core.withContext(function($ctx1) {
  59717. $self._should_raise_((function(){
  59718. return $core.withContext(function($ctx2) {
  59719. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  59720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59721. }),$globals.Error);
  59722. return self;
  59723. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  59724. },
  59725. args: [],
  59726. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  59727. referencedClasses: ["Set", "Error"],
  59728. pragmas: [],
  59729. messageSends: ["should:raise:", "at:put:", "new"]
  59730. }),
  59731. $globals.SetTest);
  59732. $core.addMethod(
  59733. $core.method({
  59734. selector: "testCollect",
  59735. protocol: "tests",
  59736. fn: function (){
  59737. var self=this,$self=this;
  59738. return $core.withContext(function($ctx1) {
  59739. var $2,$1;
  59740. (
  59741. $ctx1.supercall = true,
  59742. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  59743. $ctx1.supercall = false;
  59744. $2=[(5), (6), (8)]._asSet();
  59745. $ctx1.sendIdx["asSet"]=1;
  59746. $1=$recv($2)._collect_((function(x){
  59747. return $core.withContext(function($ctx2) {
  59748. return $recv(x).__backslash_backslash((3));
  59749. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  59750. }));
  59751. $self._assert_equals_($1,[(0), (2)]._asSet());
  59752. return self;
  59753. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  59754. },
  59755. args: [],
  59756. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  59757. referencedClasses: [],
  59758. pragmas: [],
  59759. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  59760. }),
  59761. $globals.SetTest);
  59762. $core.addMethod(
  59763. $core.method({
  59764. selector: "testComma",
  59765. protocol: "tests",
  59766. fn: function (){
  59767. var self=this,$self=this;
  59768. return $core.withContext(function($ctx1) {
  59769. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  59770. (
  59771. $ctx1.supercall = true,
  59772. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  59773. $ctx1.supercall = false;
  59774. $2=$self._collection();
  59775. $ctx1.sendIdx["collection"]=1;
  59776. $3=$self._collection();
  59777. $ctx1.sendIdx["collection"]=2;
  59778. $1=$recv($2).__comma($3);
  59779. $ctx1.sendIdx[","]=1;
  59780. $4=$self._collection();
  59781. $ctx1.sendIdx["collection"]=3;
  59782. $self._assert_equals_($1,$4);
  59783. $ctx1.sendIdx["assert:equals:"]=1;
  59784. $6=$self._collection();
  59785. $ctx1.sendIdx["collection"]=4;
  59786. $7=$self._collectionWithNewValue();
  59787. $ctx1.sendIdx["collectionWithNewValue"]=1;
  59788. $5=$recv($6).__comma($7);
  59789. $ctx1.sendIdx[","]=2;
  59790. $8=$self._collectionWithNewValue();
  59791. $ctx1.sendIdx["collectionWithNewValue"]=2;
  59792. $self._assert_equals_($5,$8);
  59793. $ctx1.sendIdx["assert:equals:"]=2;
  59794. $10=$self._collectionWithNewValue();
  59795. $ctx1.sendIdx["collectionWithNewValue"]=3;
  59796. $9=$recv($10).__comma($self._collection());
  59797. $self._assert_equals_($9,$self._collectionWithNewValue());
  59798. return self;
  59799. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  59800. },
  59801. args: [],
  59802. 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",
  59803. referencedClasses: [],
  59804. pragmas: [],
  59805. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  59806. }),
  59807. $globals.SetTest);
  59808. $core.addMethod(
  59809. $core.method({
  59810. selector: "testComparing",
  59811. protocol: "tests",
  59812. fn: function (){
  59813. var self=this,$self=this;
  59814. return $core.withContext(function($ctx1) {
  59815. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  59816. $1=[(0), (2)]._asSet();
  59817. $ctx1.sendIdx["asSet"]=1;
  59818. $2=[(0), (2)]._asSet();
  59819. $ctx1.sendIdx["asSet"]=2;
  59820. $self._assert_equals_($1,$2);
  59821. $ctx1.sendIdx["assert:equals:"]=1;
  59822. $3=[(2), (0)]._asSet();
  59823. $ctx1.sendIdx["asSet"]=3;
  59824. $4=[(0), (2)]._asSet();
  59825. $ctx1.sendIdx["asSet"]=4;
  59826. $self._assert_equals_($3,$4);
  59827. $6=[(0), (2), (3)]._asSet();
  59828. $ctx1.sendIdx["asSet"]=5;
  59829. $7=[(0), (2)]._asSet();
  59830. $ctx1.sendIdx["asSet"]=6;
  59831. $5=$recv($6).__eq($7);
  59832. $ctx1.sendIdx["="]=1;
  59833. $self._deny_($5);
  59834. $ctx1.sendIdx["deny:"]=1;
  59835. $9=[(1), (2)]._asSet();
  59836. $ctx1.sendIdx["asSet"]=7;
  59837. $8=$recv($9).__eq([(0), (2)]._asSet());
  59838. $self._deny_($8);
  59839. return self;
  59840. }, function($ctx1) {$ctx1.fill(self,"testComparing",{})});
  59841. },
  59842. args: [],
  59843. 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",
  59844. referencedClasses: [],
  59845. pragmas: [],
  59846. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  59847. }),
  59848. $globals.SetTest);
  59849. $core.addMethod(
  59850. $core.method({
  59851. selector: "testPrintString",
  59852. protocol: "tests",
  59853. fn: function (){
  59854. var self=this,$self=this;
  59855. var set;
  59856. return $core.withContext(function($ctx1) {
  59857. var $1,$2,$3,$4,$5,$6,$7;
  59858. set=$recv($globals.Set)._new();
  59859. $1=$recv(set)._printString();
  59860. $ctx1.sendIdx["printString"]=1;
  59861. $self._assert_equals_($1,"a Set ()");
  59862. $ctx1.sendIdx["assert:equals:"]=1;
  59863. $2=set;
  59864. $recv($2)._add_((1));
  59865. $ctx1.sendIdx["add:"]=1;
  59866. $recv($2)._add_((3));
  59867. $ctx1.sendIdx["add:"]=2;
  59868. $3=$recv(set)._printString();
  59869. $ctx1.sendIdx["printString"]=2;
  59870. $self._assert_equals_($3,"a Set (1 3)");
  59871. $ctx1.sendIdx["assert:equals:"]=2;
  59872. $recv(set)._add_("foo");
  59873. $ctx1.sendIdx["add:"]=3;
  59874. $4=$recv(set)._printString();
  59875. $ctx1.sendIdx["printString"]=3;
  59876. $self._assert_equals_($4,"a Set (1 3 'foo')");
  59877. $ctx1.sendIdx["assert:equals:"]=3;
  59878. $5=set;
  59879. $recv($5)._remove_((1));
  59880. $ctx1.sendIdx["remove:"]=1;
  59881. $recv($5)._remove_((3));
  59882. $6=$recv(set)._printString();
  59883. $ctx1.sendIdx["printString"]=4;
  59884. $self._assert_equals_($6,"a Set ('foo')");
  59885. $ctx1.sendIdx["assert:equals:"]=4;
  59886. $recv(set)._add_((3));
  59887. $ctx1.sendIdx["add:"]=4;
  59888. $7=$recv(set)._printString();
  59889. $ctx1.sendIdx["printString"]=5;
  59890. $self._assert_equals_($7,"a Set (3 'foo')");
  59891. $ctx1.sendIdx["assert:equals:"]=5;
  59892. $recv(set)._add_((3));
  59893. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  59894. return self;
  59895. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set})});
  59896. },
  59897. args: [],
  59898. 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'')'",
  59899. referencedClasses: ["Set"],
  59900. pragmas: [],
  59901. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  59902. }),
  59903. $globals.SetTest);
  59904. $core.addMethod(
  59905. $core.method({
  59906. selector: "testRegression1225",
  59907. protocol: "tests",
  59908. fn: function (){
  59909. var self=this,$self=this;
  59910. return $core.withContext(function($ctx1) {
  59911. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  59912. return self;
  59913. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{})});
  59914. },
  59915. args: [],
  59916. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  59917. referencedClasses: [],
  59918. pragmas: [],
  59919. messageSends: ["assert:equals:", "add:", "asSet"]
  59920. }),
  59921. $globals.SetTest);
  59922. $core.addMethod(
  59923. $core.method({
  59924. selector: "testRegression1226",
  59925. protocol: "tests",
  59926. fn: function (){
  59927. var self=this,$self=this;
  59928. return $core.withContext(function($ctx1) {
  59929. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  59930. return self;
  59931. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{})});
  59932. },
  59933. args: [],
  59934. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  59935. referencedClasses: [],
  59936. pragmas: [],
  59937. messageSends: ["assert:equals:", "remove:", "asSet"]
  59938. }),
  59939. $globals.SetTest);
  59940. $core.addMethod(
  59941. $core.method({
  59942. selector: "testRegression1227",
  59943. protocol: "tests",
  59944. fn: function (){
  59945. var self=this,$self=this;
  59946. return $core.withContext(function($ctx1) {
  59947. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  59948. return (5);
  59949. })),(5));
  59950. return self;
  59951. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{})});
  59952. },
  59953. args: [],
  59954. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  59955. referencedClasses: [],
  59956. pragmas: [],
  59957. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  59958. }),
  59959. $globals.SetTest);
  59960. $core.addMethod(
  59961. $core.method({
  59962. selector: "testRegression1228",
  59963. protocol: "tests",
  59964. fn: function (){
  59965. var self=this,$self=this;
  59966. return $core.withContext(function($ctx1) {
  59967. $self._should_raise_((function(){
  59968. return $core.withContext(function($ctx2) {
  59969. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  59970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59971. }),$globals.Error);
  59972. return self;
  59973. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{})});
  59974. },
  59975. args: [],
  59976. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  59977. referencedClasses: ["Error"],
  59978. pragmas: [],
  59979. messageSends: ["should:raise:", "remove:", "asSet"]
  59980. }),
  59981. $globals.SetTest);
  59982. $core.addMethod(
  59983. $core.method({
  59984. selector: "testUnboxedObjects",
  59985. protocol: "tests",
  59986. fn: function (){
  59987. var self=this,$self=this;
  59988. return $core.withContext(function($ctx1) {
  59989. var $4,$3,$2,$1;
  59990. $4="foo"._yourself();
  59991. $ctx1.sendIdx["yourself"]=1;
  59992. $3=[$4,"foo"._yourself()];
  59993. $2=$recv($3)._asSet();
  59994. $1=$recv($2)._asArray();
  59995. $self._assert_equals_($1,["foo"]);
  59996. return self;
  59997. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{})});
  59998. },
  59999. args: [],
  60000. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  60001. referencedClasses: [],
  60002. pragmas: [],
  60003. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  60004. }),
  60005. $globals.SetTest);
  60006. $core.addMethod(
  60007. $core.method({
  60008. selector: "testUnicity",
  60009. protocol: "tests",
  60010. fn: function (){
  60011. var self=this,$self=this;
  60012. var set;
  60013. return $core.withContext(function($ctx1) {
  60014. var $1;
  60015. set=$recv($globals.Set)._new();
  60016. $recv(set)._add_((21));
  60017. $ctx1.sendIdx["add:"]=1;
  60018. $recv(set)._add_("hello");
  60019. $ctx1.sendIdx["add:"]=2;
  60020. $recv(set)._add_((21));
  60021. $ctx1.sendIdx["add:"]=3;
  60022. $1=$recv(set)._size();
  60023. $ctx1.sendIdx["size"]=1;
  60024. $self._assert_equals_($1,(2));
  60025. $ctx1.sendIdx["assert:equals:"]=1;
  60026. $recv(set)._add_("hello");
  60027. $self._assert_equals_($recv(set)._size(),(2));
  60028. $ctx1.sendIdx["assert:equals:"]=2;
  60029. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  60030. return self;
  60031. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set})});
  60032. },
  60033. args: [],
  60034. 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')",
  60035. referencedClasses: ["Set"],
  60036. pragmas: [],
  60037. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  60038. }),
  60039. $globals.SetTest);
  60040. $core.addMethod(
  60041. $core.method({
  60042. selector: "collectionClass",
  60043. protocol: "fixture",
  60044. fn: function (){
  60045. var self=this,$self=this;
  60046. return $globals.Set;
  60047. },
  60048. args: [],
  60049. source: "collectionClass\x0a\x09^ Set",
  60050. referencedClasses: ["Set"],
  60051. pragmas: [],
  60052. messageSends: []
  60053. }),
  60054. $globals.SetTest.a$cls);
  60055. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  60056. $core.addMethod(
  60057. $core.method({
  60058. selector: "testShow",
  60059. protocol: "tests",
  60060. fn: function (){
  60061. var self=this,$self=this;
  60062. var originalTranscript;
  60063. return $core.withContext(function($ctx1) {
  60064. originalTranscript=$recv($globals.Transcript)._current();
  60065. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  60066. $ctx1.sendIdx["register:"]=1;
  60067. $self._shouldnt_raise_((function(){
  60068. return $core.withContext(function($ctx2) {
  60069. return $recv($globals.Transcript)._show_("Hello console!");
  60070. $ctx2.sendIdx["show:"]=1;
  60071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60072. }),$globals.Error);
  60073. $ctx1.sendIdx["shouldnt:raise:"]=1;
  60074. $self._shouldnt_raise_((function(){
  60075. return $core.withContext(function($ctx2) {
  60076. return $recv($globals.Transcript)._show_(console);
  60077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60078. }),$globals.Error);
  60079. $recv($globals.Transcript)._register_(originalTranscript);
  60080. return self;
  60081. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript})});
  60082. },
  60083. args: [],
  60084. 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.",
  60085. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  60086. pragmas: [],
  60087. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  60088. }),
  60089. $globals.ConsoleTranscriptTest);
  60090. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  60091. $core.addMethod(
  60092. $core.method({
  60093. selector: "testEquality",
  60094. protocol: "tests",
  60095. fn: function (){
  60096. var self=this,$self=this;
  60097. var now;
  60098. return $core.withContext(function($ctx1) {
  60099. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  60100. now=$recv($globals.Date)._new();
  60101. $1=$recv(now).__eq(now);
  60102. $ctx1.sendIdx["="]=1;
  60103. $self._assert_($1);
  60104. $ctx1.sendIdx["assert:"]=1;
  60105. $3=now;
  60106. $4=$recv($globals.Date)._fromMilliseconds_((0));
  60107. $ctx1.sendIdx["fromMilliseconds:"]=1;
  60108. $2=$recv($3).__eq($4);
  60109. $ctx1.sendIdx["="]=2;
  60110. $self._deny_($2);
  60111. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  60112. $ctx1.sendIdx["fromMilliseconds:"]=2;
  60113. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  60114. $ctx1.sendIdx["fromMilliseconds:"]=3;
  60115. $5=$recv($6).__eq($7);
  60116. $ctx1.sendIdx["="]=3;
  60117. $self._assert_($5);
  60118. $ctx1.sendIdx["assert:"]=2;
  60119. $9=now;
  60120. $11=$recv(now)._asMilliseconds();
  60121. $ctx1.sendIdx["asMilliseconds"]=1;
  60122. $10=$recv($globals.Date)._fromMilliseconds_($11);
  60123. $ctx1.sendIdx["fromMilliseconds:"]=4;
  60124. $8=$recv($9).__eq($10);
  60125. $ctx1.sendIdx["="]=4;
  60126. $self._assert_($8);
  60127. $ctx1.sendIdx["assert:"]=3;
  60128. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  60129. return self;
  60130. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now})});
  60131. },
  60132. args: [],
  60133. 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",
  60134. referencedClasses: ["Date"],
  60135. pragmas: [],
  60136. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  60137. }),
  60138. $globals.DateTest);
  60139. $core.addMethod(
  60140. $core.method({
  60141. selector: "testIdentity",
  60142. protocol: "tests",
  60143. fn: function (){
  60144. var self=this,$self=this;
  60145. var now;
  60146. return $core.withContext(function($ctx1) {
  60147. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  60148. now=$recv($globals.Date)._new();
  60149. $1=$recv(now).__eq_eq(now);
  60150. $ctx1.sendIdx["=="]=1;
  60151. $self._assert_($1);
  60152. $3=now;
  60153. $4=$recv($globals.Date)._fromMilliseconds_((0));
  60154. $ctx1.sendIdx["fromMilliseconds:"]=1;
  60155. $2=$recv($3).__eq_eq($4);
  60156. $ctx1.sendIdx["=="]=2;
  60157. $self._deny_($2);
  60158. $ctx1.sendIdx["deny:"]=1;
  60159. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  60160. $ctx1.sendIdx["fromMilliseconds:"]=2;
  60161. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  60162. $ctx1.sendIdx["fromMilliseconds:"]=3;
  60163. $5=$recv($6).__eq_eq($7);
  60164. $ctx1.sendIdx["=="]=3;
  60165. $self._deny_($5);
  60166. $ctx1.sendIdx["deny:"]=2;
  60167. $9=now;
  60168. $11=$recv(now)._asMilliseconds();
  60169. $ctx1.sendIdx["asMilliseconds"]=1;
  60170. $10=$recv($globals.Date)._fromMilliseconds_($11);
  60171. $ctx1.sendIdx["fromMilliseconds:"]=4;
  60172. $8=$recv($9).__eq_eq($10);
  60173. $ctx1.sendIdx["=="]=4;
  60174. $self._deny_($8);
  60175. $ctx1.sendIdx["deny:"]=3;
  60176. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  60177. return self;
  60178. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now})});
  60179. },
  60180. args: [],
  60181. 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",
  60182. referencedClasses: ["Date"],
  60183. pragmas: [],
  60184. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  60185. }),
  60186. $globals.DateTest);
  60187. $core.addMethod(
  60188. $core.method({
  60189. selector: "testPlusAndMinus",
  60190. protocol: "tests",
  60191. fn: function (){
  60192. var self=this,$self=this;
  60193. var a,b,now,zeroDuration;
  60194. return $core.withContext(function($ctx1) {
  60195. var $3,$4,$5,$2,$1,$7,$8,$6,$10,$11,$9,$13,$14,$12,$16,$18,$17,$15;
  60196. a=$recv($globals.Date)._fromString_("1974-07-12 14:30");
  60197. $ctx1.sendIdx["fromString:"]=1;
  60198. now=$recv($globals.Date)._now();
  60199. b=$recv($globals.Date)._fromString_("2616-03-06");
  60200. zeroDuration=(0);
  60201. $3=$recv(a).__minus(a);
  60202. $ctx1.sendIdx["-"]=1;
  60203. $4=$recv(now).__minus(now);
  60204. $ctx1.sendIdx["-"]=2;
  60205. $5=$recv(b).__minus(b);
  60206. $ctx1.sendIdx["-"]=3;
  60207. $2=[$3,$4,$5];
  60208. $1=$recv($2)._asSet();
  60209. $self._assert_equals_($1,$recv($globals.Set)._with_(zeroDuration));
  60210. $ctx1.sendIdx["assert:equals:"]=1;
  60211. $7=now;
  60212. $8=$recv(b).__minus(now);
  60213. $ctx1.sendIdx["-"]=4;
  60214. $6=$recv($7).__plus($8);
  60215. $ctx1.sendIdx["+"]=1;
  60216. $self._assert_equals_($6,b);
  60217. $ctx1.sendIdx["assert:equals:"]=2;
  60218. $10=a;
  60219. $11=$recv(b).__minus(a);
  60220. $ctx1.sendIdx["-"]=5;
  60221. $9=$recv($10).__plus($11);
  60222. $ctx1.sendIdx["+"]=2;
  60223. $self._assert_equals_($9,b);
  60224. $ctx1.sendIdx["assert:equals:"]=3;
  60225. $13=now;
  60226. $14=$recv(a).__minus(now);
  60227. $ctx1.sendIdx["-"]=6;
  60228. $12=$recv($13).__plus($14);
  60229. $ctx1.sendIdx["+"]=3;
  60230. $self._assert_equals_($12,a);
  60231. $ctx1.sendIdx["assert:equals:"]=4;
  60232. $16=a;
  60233. $18=$recv(now).__minus(a);
  60234. $ctx1.sendIdx["-"]=7;
  60235. $17=$recv($18).__plus($recv(b).__minus(now));
  60236. $15=$recv($16).__plus($17);
  60237. $ctx1.sendIdx["+"]=4;
  60238. $self._assert_equals_($15,b);
  60239. return self;
  60240. }, function($ctx1) {$ctx1.fill(self,"testPlusAndMinus",{a:a,b:b,now:now,zeroDuration:zeroDuration})});
  60241. },
  60242. args: [],
  60243. source: "testPlusAndMinus\x0a\x09| a b now zeroDuration |\x0a\x09a := Date fromString: '1974-07-12 14:30'.\x0a\x09now := Date now.\x0a\x09b := Date fromString: '2616-03-06'.\x0a\x09zeroDuration := 0.\x0a\x0a\x09self assert: {a-a. now-now. b-b} asSet equals: (Set with: zeroDuration).\x0a\x09self assert: now + (b - now) equals: b.\x0a\x09self assert: a + (b - a) equals: b.\x0a\x09self assert: now + (a - now) equals: a.\x0a\x09self assert: a + ((now - a) + (b - now)) equals: b",
  60244. referencedClasses: ["Date", "Set"],
  60245. pragmas: [],
  60246. messageSends: ["fromString:", "now", "assert:equals:", "asSet", "-", "with:", "+"]
  60247. }),
  60248. $globals.DateTest);
  60249. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  60250. $core.addMethod(
  60251. $core.method({
  60252. selector: "jsObject",
  60253. protocol: "accessing",
  60254. fn: function (){
  60255. var self=this,$self=this;
  60256. return $core.withContext(function($ctx1) {
  60257. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  60258. return self;
  60259. }, function($ctx1) {$ctx1.fill(self,"jsObject",{})});
  60260. },
  60261. args: [],
  60262. 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}'>",
  60263. referencedClasses: [],
  60264. pragmas: [["inlineJS:", ["return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}"]]],
  60265. messageSends: []
  60266. }),
  60267. $globals.JSObjectProxyTest);
  60268. $core.addMethod(
  60269. $core.method({
  60270. selector: "jsUndefined",
  60271. protocol: "accessing",
  60272. fn: function (){
  60273. var self=this,$self=this;
  60274. return $core.withContext(function($ctx1) {
  60275. return;
  60276. return self;
  60277. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{})});
  60278. },
  60279. args: [],
  60280. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  60281. referencedClasses: [],
  60282. pragmas: [["inlineJS:", ["return"]]],
  60283. messageSends: []
  60284. }),
  60285. $globals.JSObjectProxyTest);
  60286. $core.addMethod(
  60287. $core.method({
  60288. selector: "testAtIfAbsent",
  60289. protocol: "tests",
  60290. fn: function (){
  60291. var self=this,$self=this;
  60292. var testObject;
  60293. return $core.withContext(function($ctx1) {
  60294. var $1,$2,$3;
  60295. testObject=$self._jsObject();
  60296. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  60297. return "Property does not exist";
  60298. }));
  60299. $ctx1.sendIdx["at:ifAbsent:"]=1;
  60300. $self._assert_equals_($1,"Property does not exist");
  60301. $ctx1.sendIdx["assert:equals:"]=1;
  60302. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  60303. return "Property does not exist";
  60304. }));
  60305. $ctx1.sendIdx["at:ifAbsent:"]=2;
  60306. $self._assert_equals_($2,nil);
  60307. $ctx1.sendIdx["assert:equals:"]=2;
  60308. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  60309. return "Property does not exist";
  60310. }));
  60311. $ctx1.sendIdx["at:ifAbsent:"]=3;
  60312. $self._assert_equals_($3,(1));
  60313. $ctx1.sendIdx["assert:equals:"]=3;
  60314. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  60315. return "Property does not exist";
  60316. })),nil);
  60317. return self;
  60318. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject})});
  60319. },
  60320. args: [],
  60321. 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.",
  60322. referencedClasses: [],
  60323. pragmas: [],
  60324. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  60325. }),
  60326. $globals.JSObjectProxyTest);
  60327. $core.addMethod(
  60328. $core.method({
  60329. selector: "testAtIfPresent",
  60330. protocol: "tests",
  60331. fn: function (){
  60332. var self=this,$self=this;
  60333. var testObject;
  60334. return $core.withContext(function($ctx1) {
  60335. var $2,$1,$4,$3,$6,$5;
  60336. testObject=$self._jsObject();
  60337. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  60338. return $core.withContext(function($ctx2) {
  60339. $2=$recv(x)._asString();
  60340. $ctx2.sendIdx["asString"]=1;
  60341. return "hello ".__comma($2);
  60342. $ctx2.sendIdx[","]=1;
  60343. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  60344. }));
  60345. $ctx1.sendIdx["at:ifPresent:"]=1;
  60346. $self._assert_equals_($1,nil);
  60347. $ctx1.sendIdx["assert:equals:"]=1;
  60348. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  60349. return $core.withContext(function($ctx2) {
  60350. $4=$recv(x)._asString();
  60351. $ctx2.sendIdx["asString"]=2;
  60352. return "hello ".__comma($4);
  60353. $ctx2.sendIdx[","]=2;
  60354. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  60355. }));
  60356. $ctx1.sendIdx["at:ifPresent:"]=2;
  60357. $self._assert_equals_($3,"hello nil");
  60358. $ctx1.sendIdx["assert:equals:"]=2;
  60359. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  60360. return $core.withContext(function($ctx2) {
  60361. $6=$recv(x)._asString();
  60362. $ctx2.sendIdx["asString"]=3;
  60363. return "hello ".__comma($6);
  60364. $ctx2.sendIdx[","]=3;
  60365. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  60366. }));
  60367. $ctx1.sendIdx["at:ifPresent:"]=3;
  60368. $self._assert_equals_($5,"hello 1");
  60369. $ctx1.sendIdx["assert:equals:"]=3;
  60370. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  60371. return $core.withContext(function($ctx2) {
  60372. return "hello ".__comma($recv(x)._asString());
  60373. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  60374. })),"hello nil");
  60375. return self;
  60376. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject})});
  60377. },
  60378. args: [],
  60379. 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'.",
  60380. referencedClasses: [],
  60381. pragmas: [],
  60382. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  60383. }),
  60384. $globals.JSObjectProxyTest);
  60385. $core.addMethod(
  60386. $core.method({
  60387. selector: "testAtIfPresentIfAbsent",
  60388. protocol: "tests",
  60389. fn: function (){
  60390. var self=this,$self=this;
  60391. var testObject;
  60392. return $core.withContext(function($ctx1) {
  60393. var $2,$1,$4,$3,$6,$5;
  60394. testObject=$self._jsObject();
  60395. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  60396. return $core.withContext(function($ctx2) {
  60397. $2=$recv(x)._asString();
  60398. $ctx2.sendIdx["asString"]=1;
  60399. return "hello ".__comma($2);
  60400. $ctx2.sendIdx[","]=1;
  60401. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  60402. }),(function(){
  60403. return "not present";
  60404. }));
  60405. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  60406. $self._assert_equals_($1,"not present");
  60407. $ctx1.sendIdx["assert:equals:"]=1;
  60408. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  60409. return $core.withContext(function($ctx2) {
  60410. $4=$recv(x)._asString();
  60411. $ctx2.sendIdx["asString"]=2;
  60412. return "hello ".__comma($4);
  60413. $ctx2.sendIdx[","]=2;
  60414. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  60415. }),(function(){
  60416. return "not present";
  60417. }));
  60418. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  60419. $self._assert_equals_($3,"hello nil");
  60420. $ctx1.sendIdx["assert:equals:"]=2;
  60421. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  60422. return $core.withContext(function($ctx2) {
  60423. $6=$recv(x)._asString();
  60424. $ctx2.sendIdx["asString"]=3;
  60425. return "hello ".__comma($6);
  60426. $ctx2.sendIdx[","]=3;
  60427. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  60428. }),(function(){
  60429. return "not present";
  60430. }));
  60431. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  60432. $self._assert_equals_($5,"hello 1");
  60433. $ctx1.sendIdx["assert:equals:"]=3;
  60434. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  60435. return $core.withContext(function($ctx2) {
  60436. return "hello ".__comma($recv(x)._asString());
  60437. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  60438. }),(function(){
  60439. return "not present";
  60440. })),"hello nil");
  60441. return self;
  60442. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject})});
  60443. },
  60444. args: [],
  60445. 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'.",
  60446. referencedClasses: [],
  60447. pragmas: [],
  60448. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  60449. }),
  60450. $globals.JSObjectProxyTest);
  60451. $core.addMethod(
  60452. $core.method({
  60453. selector: "testAtPut",
  60454. protocol: "tests",
  60455. fn: function (){
  60456. var self=this,$self=this;
  60457. var testObject;
  60458. return $core.withContext(function($ctx1) {
  60459. var $2,$1;
  60460. testObject=$self._jsObject();
  60461. $2=$recv(testObject)._at_("abc");
  60462. $ctx1.sendIdx["at:"]=1;
  60463. $1=$recv($2).__tild_eq("xyz");
  60464. $self._assert_($1);
  60465. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  60466. $ctx1.sendIdx["assert:equals:"]=1;
  60467. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  60468. return self;
  60469. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject})});
  60470. },
  60471. args: [],
  60472. 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'",
  60473. referencedClasses: [],
  60474. pragmas: [],
  60475. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  60476. }),
  60477. $globals.JSObjectProxyTest);
  60478. $core.addMethod(
  60479. $core.method({
  60480. selector: "testComparison",
  60481. protocol: "tests",
  60482. fn: function (){
  60483. var self=this,$self=this;
  60484. return $core.withContext(function($ctx1) {
  60485. var $1,$2;
  60486. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  60487. $1=$recv(console).__eq(console);
  60488. $ctx1.sendIdx["="]=1;
  60489. $self._assert_($1);
  60490. $2=$recv(console).__eq($recv($globals.Object)._new());
  60491. $ctx1.sendIdx["="]=2;
  60492. $self._deny_($2);
  60493. $ctx1.sendIdx["deny:"]=1;
  60494. $self._deny_($recv(console).__eq($self._jsObject()));
  60495. return self;
  60496. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  60497. },
  60498. args: [],
  60499. 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",
  60500. referencedClasses: ["Object"],
  60501. pragmas: [],
  60502. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  60503. }),
  60504. $globals.JSObjectProxyTest);
  60505. $core.addMethod(
  60506. $core.method({
  60507. selector: "testDNU",
  60508. protocol: "tests",
  60509. fn: function (){
  60510. var self=this,$self=this;
  60511. return $core.withContext(function($ctx1) {
  60512. $self._should_raise_((function(){
  60513. return $core.withContext(function($ctx2) {
  60514. return $recv($self._jsObject())._foo();
  60515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60516. }),$globals.MessageNotUnderstood);
  60517. return self;
  60518. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  60519. },
  60520. args: [],
  60521. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  60522. referencedClasses: ["MessageNotUnderstood"],
  60523. pragmas: [],
  60524. messageSends: ["should:raise:", "foo", "jsObject"]
  60525. }),
  60526. $globals.JSObjectProxyTest);
  60527. $core.addMethod(
  60528. $core.method({
  60529. selector: "testDNUWithAllowJavaScriptCalls",
  60530. protocol: "tests",
  60531. fn: function (){
  60532. var self=this,$self=this;
  60533. var jsObject;
  60534. return $core.withContext(function($ctx1) {
  60535. jsObject=[];
  60536. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  60537. $self._should_raise_((function(){
  60538. return $core.withContext(function($ctx2) {
  60539. return $recv(jsObject)._foo();
  60540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60541. }),$globals.MessageNotUnderstood);
  60542. return self;
  60543. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject})});
  60544. },
  60545. args: [],
  60546. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  60547. referencedClasses: ["MessageNotUnderstood"],
  60548. pragmas: [],
  60549. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  60550. }),
  60551. $globals.JSObjectProxyTest);
  60552. $core.addMethod(
  60553. $core.method({
  60554. selector: "testMessageSend",
  60555. protocol: "tests",
  60556. fn: function (){
  60557. var self=this,$self=this;
  60558. return $core.withContext(function($ctx1) {
  60559. var $2,$1,$4,$3;
  60560. $2=$self._jsObject();
  60561. $ctx1.sendIdx["jsObject"]=1;
  60562. $1=$recv($2)._a();
  60563. $self._assert_equals_($1,(1));
  60564. $ctx1.sendIdx["assert:equals:"]=1;
  60565. $4=$self._jsObject();
  60566. $ctx1.sendIdx["jsObject"]=2;
  60567. $3=$recv($4)._b();
  60568. $self._assert_equals_($3,(2));
  60569. $ctx1.sendIdx["assert:equals:"]=2;
  60570. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  60571. return self;
  60572. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{})});
  60573. },
  60574. args: [],
  60575. 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",
  60576. referencedClasses: [],
  60577. pragmas: [],
  60578. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  60579. }),
  60580. $globals.JSObjectProxyTest);
  60581. $core.addMethod(
  60582. $core.method({
  60583. selector: "testMethodWithArguments",
  60584. protocol: "tests",
  60585. fn: function (){
  60586. var self=this,$self=this;
  60587. return $core.withContext(function($ctx1) {
  60588. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  60589. return self;
  60590. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{})});
  60591. },
  60592. args: [],
  60593. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  60594. referencedClasses: [],
  60595. pragmas: [],
  60596. messageSends: ["assert:equals:", "c:", "jsObject"]
  60597. }),
  60598. $globals.JSObjectProxyTest);
  60599. $core.addMethod(
  60600. $core.method({
  60601. selector: "testNull",
  60602. protocol: "tests",
  60603. fn: function (){
  60604. var self=this,$self=this;
  60605. return $core.withContext(function($ctx1) {
  60606. var $2,$1;
  60607. $2=$recv($globals.JSObjectProxy)._null();
  60608. $ctx1.sendIdx["null"]=1;
  60609. $1=$recv($2)._isNil();
  60610. $self._assert_($1);
  60611. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  60612. return self;
  60613. }, function($ctx1) {$ctx1.fill(self,"testNull",{})});
  60614. },
  60615. args: [],
  60616. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  60617. referencedClasses: ["JSObjectProxy", "JSON"],
  60618. pragmas: [],
  60619. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  60620. }),
  60621. $globals.JSObjectProxyTest);
  60622. $core.addMethod(
  60623. $core.method({
  60624. selector: "testPrinting",
  60625. protocol: "tests",
  60626. fn: function (){
  60627. var self=this,$self=this;
  60628. return $core.withContext(function($ctx1) {
  60629. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  60630. return self;
  60631. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{})});
  60632. },
  60633. args: [],
  60634. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  60635. referencedClasses: [],
  60636. pragmas: [],
  60637. messageSends: ["assert:equals:", "printString", "jsObject"]
  60638. }),
  60639. $globals.JSObjectProxyTest);
  60640. $core.addMethod(
  60641. $core.method({
  60642. selector: "testPropertyThatReturnsEmptyString",
  60643. protocol: "tests",
  60644. fn: function (){
  60645. var self=this,$self=this;
  60646. var object;
  60647. return $core.withContext(function($ctx1) {
  60648. var $1;
  60649. object=$self._jsObject();
  60650. $1=$recv(object)._d();
  60651. $ctx1.sendIdx["d"]=1;
  60652. $self._assert_equals_($1,"");
  60653. $ctx1.sendIdx["assert:equals:"]=1;
  60654. $recv(object)._d_("hello");
  60655. $self._assert_equals_($recv(object)._d(),"hello");
  60656. return self;
  60657. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object})});
  60658. },
  60659. args: [],
  60660. 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'",
  60661. referencedClasses: [],
  60662. pragmas: [],
  60663. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  60664. }),
  60665. $globals.JSObjectProxyTest);
  60666. $core.addMethod(
  60667. $core.method({
  60668. selector: "testPropertyThatReturnsUndefined",
  60669. protocol: "tests",
  60670. fn: function (){
  60671. var self=this,$self=this;
  60672. var object;
  60673. return $core.withContext(function($ctx1) {
  60674. object=$self._jsObject();
  60675. $self._shouldnt_raise_((function(){
  60676. return $core.withContext(function($ctx2) {
  60677. return $recv(object)._e();
  60678. $ctx2.sendIdx["e"]=1;
  60679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60680. }),$globals.MessageNotUnderstood);
  60681. $self._assert_($recv($recv(object)._e())._isNil());
  60682. return self;
  60683. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object})});
  60684. },
  60685. args: [],
  60686. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  60687. referencedClasses: ["MessageNotUnderstood"],
  60688. pragmas: [],
  60689. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  60690. }),
  60691. $globals.JSObjectProxyTest);
  60692. $core.addMethod(
  60693. $core.method({
  60694. selector: "testSetPropertyWithFalsyValue",
  60695. protocol: "tests",
  60696. fn: function (){
  60697. var self=this,$self=this;
  60698. var jsObject;
  60699. return $core.withContext(function($ctx1) {
  60700. var $1,$2,$3,$4,$5;
  60701. jsObject=$self._jsObject();
  60702. $1=$recv(jsObject)._a();
  60703. $ctx1.sendIdx["a"]=1;
  60704. $self._assert_equals_($1,(1));
  60705. $ctx1.sendIdx["assert:equals:"]=1;
  60706. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  60707. $ctx1.sendIdx["a:"]=1;
  60708. $2=$recv(jsObject)._a();
  60709. $ctx1.sendIdx["a"]=2;
  60710. $self._assert_equals_($2,nil);
  60711. $ctx1.sendIdx["assert:equals:"]=2;
  60712. $recv(jsObject)._a_((0));
  60713. $ctx1.sendIdx["a:"]=2;
  60714. $3=$recv(jsObject)._a();
  60715. $ctx1.sendIdx["a"]=3;
  60716. $self._assert_equals_($3,(0));
  60717. $ctx1.sendIdx["assert:equals:"]=3;
  60718. $recv(jsObject)._a_($self._jsUndefined());
  60719. $ctx1.sendIdx["a:"]=3;
  60720. $4=$recv(jsObject)._a();
  60721. $ctx1.sendIdx["a"]=4;
  60722. $self._assert_equals_($4,nil);
  60723. $ctx1.sendIdx["assert:equals:"]=4;
  60724. $recv(jsObject)._a_("");
  60725. $ctx1.sendIdx["a:"]=4;
  60726. $5=$recv(jsObject)._a();
  60727. $ctx1.sendIdx["a"]=5;
  60728. $self._assert_equals_($5,"");
  60729. $ctx1.sendIdx["assert:equals:"]=5;
  60730. $recv(jsObject)._a_(false);
  60731. $self._assert_equals_($recv(jsObject)._a(),false);
  60732. return self;
  60733. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject})});
  60734. },
  60735. args: [],
  60736. 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",
  60737. referencedClasses: ["JSObjectProxy"],
  60738. pragmas: [],
  60739. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  60740. }),
  60741. $globals.JSObjectProxyTest);
  60742. $core.addMethod(
  60743. $core.method({
  60744. selector: "testUndefined",
  60745. protocol: "tests",
  60746. fn: function (){
  60747. var self=this,$self=this;
  60748. return $core.withContext(function($ctx1) {
  60749. var $2,$1;
  60750. $2=$recv($globals.JSObjectProxy)._undefined();
  60751. $ctx1.sendIdx["undefined"]=1;
  60752. $1=$recv($2)._isNil();
  60753. $self._assert_($1);
  60754. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  60755. return self;
  60756. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{})});
  60757. },
  60758. args: [],
  60759. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  60760. referencedClasses: ["JSObjectProxy", "JSON"],
  60761. pragmas: [],
  60762. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  60763. }),
  60764. $globals.JSObjectProxyTest);
  60765. $core.addMethod(
  60766. $core.method({
  60767. selector: "testValue",
  60768. protocol: "tests",
  60769. fn: function (){
  60770. var self=this,$self=this;
  60771. var testObject;
  60772. return $core.withContext(function($ctx1) {
  60773. testObject=$self._jsObject();
  60774. $recv(testObject)._at_put_("value","aValue");
  60775. $self._assert_equals_($recv(testObject)._value(),"aValue");
  60776. return self;
  60777. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject})});
  60778. },
  60779. args: [],
  60780. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  60781. referencedClasses: [],
  60782. pragmas: [],
  60783. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  60784. }),
  60785. $globals.JSObjectProxyTest);
  60786. $core.addMethod(
  60787. $core.method({
  60788. selector: "testYourself",
  60789. protocol: "tests",
  60790. fn: function (){
  60791. var self=this,$self=this;
  60792. var object;
  60793. return $core.withContext(function($ctx1) {
  60794. var $1;
  60795. $1=$self._jsObject();
  60796. $recv($1)._d_("test");
  60797. object=$recv($1)._yourself();
  60798. $self._assert_equals_($recv(object)._d(),"test");
  60799. return self;
  60800. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object})});
  60801. },
  60802. args: [],
  60803. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  60804. referencedClasses: [],
  60805. pragmas: [],
  60806. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  60807. }),
  60808. $globals.JSObjectProxyTest);
  60809. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  60810. $core.addMethod(
  60811. $core.method({
  60812. selector: "testCatchingException",
  60813. protocol: "tests",
  60814. fn: function (){
  60815. var self=this,$self=this;
  60816. return $core.withContext(function($ctx1) {
  60817. $recv((function(){
  60818. return $core.withContext(function($ctx2) {
  60819. return $self._throwException();
  60820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60821. }))._on_do_($globals.Error,(function(error){
  60822. return $core.withContext(function($ctx2) {
  60823. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  60824. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60825. }));
  60826. return self;
  60827. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{})});
  60828. },
  60829. args: [],
  60830. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  60831. referencedClasses: ["Error"],
  60832. pragmas: [],
  60833. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  60834. }),
  60835. $globals.JavaScriptExceptionTest);
  60836. $core.addMethod(
  60837. $core.method({
  60838. selector: "testRaisingException",
  60839. protocol: "tests",
  60840. fn: function (){
  60841. var self=this,$self=this;
  60842. return $core.withContext(function($ctx1) {
  60843. $self._should_raise_((function(){
  60844. return $core.withContext(function($ctx2) {
  60845. return $self._throwException();
  60846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60847. }),$globals.JavaScriptException);
  60848. return self;
  60849. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{})});
  60850. },
  60851. args: [],
  60852. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  60853. referencedClasses: ["JavaScriptException"],
  60854. pragmas: [],
  60855. messageSends: ["should:raise:", "throwException"]
  60856. }),
  60857. $globals.JavaScriptExceptionTest);
  60858. $core.addMethod(
  60859. $core.method({
  60860. selector: "throwException",
  60861. protocol: "helpers",
  60862. fn: function (){
  60863. var self=this,$self=this;
  60864. return $core.withContext(function($ctx1) {
  60865. throw "test";
  60866. return self;
  60867. }, function($ctx1) {$ctx1.fill(self,"throwException",{})});
  60868. },
  60869. args: [],
  60870. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  60871. referencedClasses: [],
  60872. pragmas: [["inlineJS:", ["throw \x22test\x22"]]],
  60873. messageSends: []
  60874. }),
  60875. $globals.JavaScriptExceptionTest);
  60876. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  60877. $core.addMethod(
  60878. $core.method({
  60879. selector: "testValue",
  60880. protocol: "tests",
  60881. fn: function (){
  60882. var self=this,$self=this;
  60883. var messageSend;
  60884. return $core.withContext(function($ctx1) {
  60885. var $1;
  60886. $1=$recv($globals.MessageSend)._new();
  60887. $ctx1.sendIdx["new"]=1;
  60888. $recv($1)._receiver_($recv($globals.Object)._new());
  60889. $recv($1)._selector_("asString");
  60890. messageSend=$recv($1)._yourself();
  60891. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  60892. return self;
  60893. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend})});
  60894. },
  60895. args: [],
  60896. 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'",
  60897. referencedClasses: ["MessageSend", "Object"],
  60898. pragmas: [],
  60899. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  60900. }),
  60901. $globals.MessageSendTest);
  60902. $core.addMethod(
  60903. $core.method({
  60904. selector: "testValueWithArguments",
  60905. protocol: "tests",
  60906. fn: function (){
  60907. var self=this,$self=this;
  60908. var messageSend;
  60909. return $core.withContext(function($ctx1) {
  60910. var $1;
  60911. $1=$recv($globals.MessageSend)._new();
  60912. $recv($1)._receiver_((2));
  60913. $recv($1)._selector_("+");
  60914. messageSend=$recv($1)._yourself();
  60915. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  60916. $ctx1.sendIdx["assert:equals:"]=1;
  60917. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  60918. return self;
  60919. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend})});
  60920. },
  60921. args: [],
  60922. 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",
  60923. referencedClasses: ["MessageSend"],
  60924. pragmas: [],
  60925. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  60926. }),
  60927. $globals.MessageSendTest);
  60928. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  60929. $core.addMethod(
  60930. $core.method({
  60931. selector: "codeGeneratorClass",
  60932. protocol: "accessing",
  60933. fn: function (){
  60934. var self=this,$self=this;
  60935. return $globals.CodeGenerator;
  60936. },
  60937. args: [],
  60938. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  60939. referencedClasses: ["CodeGenerator"],
  60940. pragmas: [],
  60941. messageSends: []
  60942. }),
  60943. $globals.MethodInheritanceTest);
  60944. $core.addMethod(
  60945. $core.method({
  60946. selector: "compiler",
  60947. protocol: "factory",
  60948. fn: function (){
  60949. var self=this,$self=this;
  60950. return $core.withContext(function($ctx1) {
  60951. var $1;
  60952. $1=$recv($globals.Compiler)._new();
  60953. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  60954. return $recv($1)._yourself();
  60955. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  60956. },
  60957. args: [],
  60958. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  60959. referencedClasses: ["Compiler"],
  60960. pragmas: [],
  60961. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  60962. }),
  60963. $globals.MethodInheritanceTest);
  60964. $core.addMethod(
  60965. $core.method({
  60966. selector: "deinstallBottom",
  60967. protocol: "testing",
  60968. fn: function (){
  60969. var self=this,$self=this;
  60970. return $core.withContext(function($ctx1) {
  60971. $recv($self._targetClassBottom())._removeCompiledMethod_($self.method);
  60972. return self;
  60973. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{})});
  60974. },
  60975. args: [],
  60976. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  60977. referencedClasses: [],
  60978. pragmas: [],
  60979. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  60980. }),
  60981. $globals.MethodInheritanceTest);
  60982. $core.addMethod(
  60983. $core.method({
  60984. selector: "deinstallMiddle",
  60985. protocol: "testing",
  60986. fn: function (){
  60987. var self=this,$self=this;
  60988. return $core.withContext(function($ctx1) {
  60989. $recv($self._targetClassMiddle())._removeCompiledMethod_($self.method);
  60990. return self;
  60991. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{})});
  60992. },
  60993. args: [],
  60994. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  60995. referencedClasses: [],
  60996. pragmas: [],
  60997. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  60998. }),
  60999. $globals.MethodInheritanceTest);
  61000. $core.addMethod(
  61001. $core.method({
  61002. selector: "deinstallTop",
  61003. protocol: "testing",
  61004. fn: function (){
  61005. var self=this,$self=this;
  61006. return $core.withContext(function($ctx1) {
  61007. $recv($self._targetClassTop())._removeCompiledMethod_($self.method);
  61008. return self;
  61009. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{})});
  61010. },
  61011. args: [],
  61012. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  61013. referencedClasses: [],
  61014. pragmas: [],
  61015. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  61016. }),
  61017. $globals.MethodInheritanceTest);
  61018. $core.addMethod(
  61019. $core.method({
  61020. selector: "installBottom:",
  61021. protocol: "testing",
  61022. fn: function (aString){
  61023. var self=this,$self=this;
  61024. return $core.withContext(function($ctx1) {
  61025. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  61026. return self;
  61027. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString})});
  61028. },
  61029. args: ["aString"],
  61030. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  61031. referencedClasses: [],
  61032. pragmas: [],
  61033. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  61034. }),
  61035. $globals.MethodInheritanceTest);
  61036. $core.addMethod(
  61037. $core.method({
  61038. selector: "installMiddle:",
  61039. protocol: "testing",
  61040. fn: function (aString){
  61041. var self=this,$self=this;
  61042. return $core.withContext(function($ctx1) {
  61043. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  61044. return self;
  61045. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString})});
  61046. },
  61047. args: ["aString"],
  61048. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  61049. referencedClasses: [],
  61050. pragmas: [],
  61051. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  61052. }),
  61053. $globals.MethodInheritanceTest);
  61054. $core.addMethod(
  61055. $core.method({
  61056. selector: "installTop:",
  61057. protocol: "testing",
  61058. fn: function (aString){
  61059. var self=this,$self=this;
  61060. return $core.withContext(function($ctx1) {
  61061. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  61062. return self;
  61063. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString})});
  61064. },
  61065. args: ["aString"],
  61066. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  61067. referencedClasses: [],
  61068. pragmas: [],
  61069. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  61070. }),
  61071. $globals.MethodInheritanceTest);
  61072. $core.addMethod(
  61073. $core.method({
  61074. selector: "setUp",
  61075. protocol: "initialization",
  61076. fn: function (){
  61077. var self=this,$self=this;
  61078. return $core.withContext(function($ctx1) {
  61079. $self.receiverTop=$recv($self._targetClassTop())._new();
  61080. $ctx1.sendIdx["new"]=1;
  61081. $self.receiverMiddle=$recv($self._targetClassMiddle())._new();
  61082. $ctx1.sendIdx["new"]=2;
  61083. $self.receiverBottom=$recv($self._targetClassBottom())._new();
  61084. $self.method=nil;
  61085. $self.performBlock=(function(){
  61086. return $core.withContext(function($ctx2) {
  61087. return $self._error_("performBlock not initialized");
  61088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61089. });
  61090. return self;
  61091. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  61092. },
  61093. args: [],
  61094. 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' ]",
  61095. referencedClasses: [],
  61096. pragmas: [],
  61097. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  61098. }),
  61099. $globals.MethodInheritanceTest);
  61100. $core.addMethod(
  61101. $core.method({
  61102. selector: "shouldMNU",
  61103. protocol: "testing",
  61104. fn: function (){
  61105. var self=this,$self=this;
  61106. return $core.withContext(function($ctx1) {
  61107. $self._shouldMNUTop();
  61108. $self._shouldMNUMiddle();
  61109. $self._shouldMNUBottom();
  61110. return self;
  61111. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{})});
  61112. },
  61113. args: [],
  61114. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  61115. referencedClasses: [],
  61116. pragmas: [],
  61117. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  61118. }),
  61119. $globals.MethodInheritanceTest);
  61120. $core.addMethod(
  61121. $core.method({
  61122. selector: "shouldMNUBottom",
  61123. protocol: "testing",
  61124. fn: function (){
  61125. var self=this,$self=this;
  61126. return $core.withContext(function($ctx1) {
  61127. $self._should_raise_((function(){
  61128. return $core.withContext(function($ctx2) {
  61129. return $recv($self.performBlock)._value_($self.receiverBottom);
  61130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61131. }),$globals.MessageNotUnderstood);
  61132. return self;
  61133. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{})});
  61134. },
  61135. args: [],
  61136. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  61137. referencedClasses: ["MessageNotUnderstood"],
  61138. pragmas: [],
  61139. messageSends: ["should:raise:", "value:"]
  61140. }),
  61141. $globals.MethodInheritanceTest);
  61142. $core.addMethod(
  61143. $core.method({
  61144. selector: "shouldMNUMiddle",
  61145. protocol: "testing",
  61146. fn: function (){
  61147. var self=this,$self=this;
  61148. return $core.withContext(function($ctx1) {
  61149. $self._should_raise_((function(){
  61150. return $core.withContext(function($ctx2) {
  61151. return $recv($self.performBlock)._value_($self.receiverMiddle);
  61152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61153. }),$globals.MessageNotUnderstood);
  61154. return self;
  61155. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{})});
  61156. },
  61157. args: [],
  61158. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  61159. referencedClasses: ["MessageNotUnderstood"],
  61160. pragmas: [],
  61161. messageSends: ["should:raise:", "value:"]
  61162. }),
  61163. $globals.MethodInheritanceTest);
  61164. $core.addMethod(
  61165. $core.method({
  61166. selector: "shouldMNUTop",
  61167. protocol: "testing",
  61168. fn: function (){
  61169. var self=this,$self=this;
  61170. return $core.withContext(function($ctx1) {
  61171. $self._should_raise_((function(){
  61172. return $core.withContext(function($ctx2) {
  61173. return $recv($self.performBlock)._value_($self.receiverTop);
  61174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61175. }),$globals.MessageNotUnderstood);
  61176. return self;
  61177. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{})});
  61178. },
  61179. args: [],
  61180. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  61181. referencedClasses: ["MessageNotUnderstood"],
  61182. pragmas: [],
  61183. messageSends: ["should:raise:", "value:"]
  61184. }),
  61185. $globals.MethodInheritanceTest);
  61186. $core.addMethod(
  61187. $core.method({
  61188. selector: "shouldReturn:",
  61189. protocol: "testing",
  61190. fn: function (anObject){
  61191. var self=this,$self=this;
  61192. var result;
  61193. return $core.withContext(function($ctx1) {
  61194. result=$recv($self.performBlock)._value_($self.receiverTop);
  61195. $ctx1.sendIdx["value:"]=1;
  61196. $self._assert_equals_(["top",anObject],["top",result]);
  61197. $ctx1.sendIdx["assert:equals:"]=1;
  61198. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  61199. $ctx1.sendIdx["value:"]=2;
  61200. $self._assert_equals_(["middle",anObject],["middle",result]);
  61201. $ctx1.sendIdx["assert:equals:"]=2;
  61202. result=$recv($self.performBlock)._value_($self.receiverBottom);
  61203. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  61204. return self;
  61205. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result})});
  61206. },
  61207. args: ["anObject"],
  61208. 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 }",
  61209. referencedClasses: [],
  61210. pragmas: [],
  61211. messageSends: ["value:", "assert:equals:"]
  61212. }),
  61213. $globals.MethodInheritanceTest);
  61214. $core.addMethod(
  61215. $core.method({
  61216. selector: "shouldReturn:and:and:",
  61217. protocol: "testing",
  61218. fn: function (anObject,anObject2,anObject3){
  61219. var self=this,$self=this;
  61220. var result;
  61221. return $core.withContext(function($ctx1) {
  61222. result=$recv($self.performBlock)._value_($self.receiverTop);
  61223. $ctx1.sendIdx["value:"]=1;
  61224. $self._assert_equals_(["top",anObject],["top",result]);
  61225. $ctx1.sendIdx["assert:equals:"]=1;
  61226. result=$recv($self.performBlock)._value_($self.receiverMiddle);
  61227. $ctx1.sendIdx["value:"]=2;
  61228. $self._assert_equals_(["middle",anObject2],["middle",result]);
  61229. $ctx1.sendIdx["assert:equals:"]=2;
  61230. result=$recv($self.performBlock)._value_($self.receiverBottom);
  61231. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  61232. return self;
  61233. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result})});
  61234. },
  61235. args: ["anObject", "anObject2", "anObject3"],
  61236. 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 }",
  61237. referencedClasses: [],
  61238. pragmas: [],
  61239. messageSends: ["value:", "assert:equals:"]
  61240. }),
  61241. $globals.MethodInheritanceTest);
  61242. $core.addMethod(
  61243. $core.method({
  61244. selector: "targetClassBottom",
  61245. protocol: "accessing",
  61246. fn: function (){
  61247. var self=this,$self=this;
  61248. return $globals.JavaScriptException;
  61249. },
  61250. args: [],
  61251. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  61252. referencedClasses: ["JavaScriptException"],
  61253. pragmas: [],
  61254. messageSends: []
  61255. }),
  61256. $globals.MethodInheritanceTest);
  61257. $core.addMethod(
  61258. $core.method({
  61259. selector: "targetClassMiddle",
  61260. protocol: "accessing",
  61261. fn: function (){
  61262. var self=this,$self=this;
  61263. return $globals.Error;
  61264. },
  61265. args: [],
  61266. source: "targetClassMiddle\x0a\x09^ Error",
  61267. referencedClasses: ["Error"],
  61268. pragmas: [],
  61269. messageSends: []
  61270. }),
  61271. $globals.MethodInheritanceTest);
  61272. $core.addMethod(
  61273. $core.method({
  61274. selector: "targetClassTop",
  61275. protocol: "accessing",
  61276. fn: function (){
  61277. var self=this,$self=this;
  61278. return $globals.Object;
  61279. },
  61280. args: [],
  61281. source: "targetClassTop\x0a\x09^ Object",
  61282. referencedClasses: ["Object"],
  61283. pragmas: [],
  61284. messageSends: []
  61285. }),
  61286. $globals.MethodInheritanceTest);
  61287. $core.addMethod(
  61288. $core.method({
  61289. selector: "tearDown",
  61290. protocol: "initialization",
  61291. fn: function (){
  61292. var self=this,$self=this;
  61293. return $core.withContext(function($ctx1) {
  61294. $recv((function(){
  61295. return $core.withContext(function($ctx2) {
  61296. return $self._deinstallTop();
  61297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61298. }))._on_do_($globals.Error,(function(){
  61299. }));
  61300. $ctx1.sendIdx["on:do:"]=1;
  61301. $recv((function(){
  61302. return $core.withContext(function($ctx2) {
  61303. return $self._deinstallMiddle();
  61304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61305. }))._on_do_($globals.Error,(function(){
  61306. }));
  61307. $ctx1.sendIdx["on:do:"]=2;
  61308. $recv((function(){
  61309. return $core.withContext(function($ctx2) {
  61310. return $self._deinstallBottom();
  61311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61312. }))._on_do_($globals.Error,(function(){
  61313. }));
  61314. return self;
  61315. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  61316. },
  61317. args: [],
  61318. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  61319. referencedClasses: ["Error"],
  61320. pragmas: [],
  61321. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  61322. }),
  61323. $globals.MethodInheritanceTest);
  61324. $core.addMethod(
  61325. $core.method({
  61326. selector: "testMNU11",
  61327. protocol: "tests",
  61328. fn: function (){
  61329. var self=this,$self=this;
  61330. return $core.withContext(function($ctx1) {
  61331. $self.performBlock=(function(x){
  61332. return $core.withContext(function($ctx2) {
  61333. return $recv(x)._foo();
  61334. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61335. });
  61336. $self._shouldMNU();
  61337. $ctx1.sendIdx["shouldMNU"]=1;
  61338. $self._installTop_("foo ^ false");
  61339. $ctx1.sendIdx["installTop:"]=1;
  61340. $self._installTop_("foo ^ true");
  61341. $self._deinstallTop();
  61342. $self._shouldMNU();
  61343. return self;
  61344. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{})});
  61345. },
  61346. args: [],
  61347. 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",
  61348. referencedClasses: [],
  61349. pragmas: [],
  61350. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  61351. }),
  61352. $globals.MethodInheritanceTest);
  61353. $core.addMethod(
  61354. $core.method({
  61355. selector: "testMNU22",
  61356. protocol: "tests",
  61357. fn: function (){
  61358. var self=this,$self=this;
  61359. return $core.withContext(function($ctx1) {
  61360. $self.performBlock=(function(x){
  61361. return $core.withContext(function($ctx2) {
  61362. return $recv(x)._foo();
  61363. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61364. });
  61365. $self._shouldMNU();
  61366. $ctx1.sendIdx["shouldMNU"]=1;
  61367. $self._installMiddle_("foo ^ false");
  61368. $ctx1.sendIdx["installMiddle:"]=1;
  61369. $self._installMiddle_("foo ^ true");
  61370. $self._deinstallMiddle();
  61371. $self._shouldMNU();
  61372. return self;
  61373. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{})});
  61374. },
  61375. args: [],
  61376. 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",
  61377. referencedClasses: [],
  61378. pragmas: [],
  61379. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  61380. }),
  61381. $globals.MethodInheritanceTest);
  61382. $core.addMethod(
  61383. $core.method({
  61384. selector: "testReturns1",
  61385. protocol: "tests",
  61386. fn: function (){
  61387. var self=this,$self=this;
  61388. return $core.withContext(function($ctx1) {
  61389. $self.performBlock=(function(x){
  61390. return $core.withContext(function($ctx2) {
  61391. return $recv(x)._foo();
  61392. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  61393. });
  61394. $self._installTop_("foo ^ false");
  61395. $ctx1.sendIdx["installTop:"]=1;
  61396. $self._shouldReturn_(false);
  61397. $ctx1.sendIdx["shouldReturn:"]=1;
  61398. $self._installTop_("foo ^ true");
  61399. $self._shouldReturn_(true);
  61400. return self;
  61401. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{})});
  61402. },
  61403. args: [],
  61404. 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",
  61405. referencedClasses: [],
  61406. pragmas: [],
  61407. messageSends: ["foo", "installTop:", "shouldReturn:"]
  61408. }),
  61409. $globals.MethodInheritanceTest);
  61410. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  61411. $core.addMethod(
  61412. $core.method({
  61413. selector: "testAbs",
  61414. protocol: "tests",
  61415. fn: function (){
  61416. var self=this,$self=this;
  61417. return $core.withContext(function($ctx1) {
  61418. var $1;
  61419. $1=(4)._abs();
  61420. $ctx1.sendIdx["abs"]=1;
  61421. $self._assert_equals_($1,(4));
  61422. $ctx1.sendIdx["assert:equals:"]=1;
  61423. $self._assert_equals_((-4)._abs(),(4));
  61424. return self;
  61425. }, function($ctx1) {$ctx1.fill(self,"testAbs",{})});
  61426. },
  61427. args: [],
  61428. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  61429. referencedClasses: [],
  61430. pragmas: [],
  61431. messageSends: ["assert:equals:", "abs"]
  61432. }),
  61433. $globals.NumberTest);
  61434. $core.addMethod(
  61435. $core.method({
  61436. selector: "testArithmetic",
  61437. protocol: "tests",
  61438. fn: function (){
  61439. var self=this,$self=this;
  61440. return $core.withContext(function($ctx1) {
  61441. var $1,$2,$3,$5,$4;
  61442. $1=(1.5).__plus((1));
  61443. $ctx1.sendIdx["+"]=1;
  61444. $self._assert_equals_($1,(2.5));
  61445. $ctx1.sendIdx["assert:equals:"]=1;
  61446. $2=(2).__minus((1));
  61447. $ctx1.sendIdx["-"]=1;
  61448. $self._assert_equals_($2,(1));
  61449. $ctx1.sendIdx["assert:equals:"]=2;
  61450. $self._assert_equals_((-2).__minus((1)),(-3));
  61451. $ctx1.sendIdx["assert:equals:"]=3;
  61452. $self._assert_equals_((12).__slash((2)),(6));
  61453. $ctx1.sendIdx["assert:equals:"]=4;
  61454. $3=(3).__star((4));
  61455. $ctx1.sendIdx["*"]=1;
  61456. $self._assert_equals_($3,(12));
  61457. $ctx1.sendIdx["assert:equals:"]=5;
  61458. $self._assert_equals_((7).__slash_slash((2)),(3));
  61459. $ctx1.sendIdx["assert:equals:"]=6;
  61460. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  61461. $ctx1.sendIdx["assert:equals:"]=7;
  61462. $5=(1).__plus((2));
  61463. $ctx1.sendIdx["+"]=2;
  61464. $4=$recv($5).__star((3));
  61465. $ctx1.sendIdx["*"]=2;
  61466. $self._assert_equals_($4,(9));
  61467. $ctx1.sendIdx["assert:equals:"]=8;
  61468. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  61469. return self;
  61470. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  61471. },
  61472. args: [],
  61473. 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",
  61474. referencedClasses: [],
  61475. pragmas: [],
  61476. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  61477. }),
  61478. $globals.NumberTest);
  61479. $core.addMethod(
  61480. $core.method({
  61481. selector: "testAsNumber",
  61482. protocol: "tests",
  61483. fn: function (){
  61484. var self=this,$self=this;
  61485. return $core.withContext(function($ctx1) {
  61486. $self._assert_equals_((3)._asNumber(),(3));
  61487. return self;
  61488. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  61489. },
  61490. args: [],
  61491. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  61492. referencedClasses: [],
  61493. pragmas: [],
  61494. messageSends: ["assert:equals:", "asNumber"]
  61495. }),
  61496. $globals.NumberTest);
  61497. $core.addMethod(
  61498. $core.method({
  61499. selector: "testBetweenAnd",
  61500. protocol: "tests",
  61501. fn: function (){
  61502. var self=this,$self=this;
  61503. return $core.withContext(function($ctx1) {
  61504. var $1,$3,$2,$5,$4;
  61505. $1=(4)._between_and_((3),(5));
  61506. $ctx1.sendIdx["between:and:"]=1;
  61507. $self._assert_($1);
  61508. $ctx1.sendIdx["assert:"]=1;
  61509. $3=(1)._between_and_((5),(6));
  61510. $ctx1.sendIdx["between:and:"]=2;
  61511. $2=$recv($3)._not();
  61512. $ctx1.sendIdx["not"]=1;
  61513. $self._assert_($2);
  61514. $ctx1.sendIdx["assert:"]=2;
  61515. $5=(90)._between_and_((67),(87));
  61516. $ctx1.sendIdx["between:and:"]=3;
  61517. $4=$recv($5)._not();
  61518. $self._assert_($4);
  61519. $ctx1.sendIdx["assert:"]=3;
  61520. $self._assert_((1)._between_and_((1),(1)));
  61521. return self;
  61522. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{})});
  61523. },
  61524. args: [],
  61525. 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).",
  61526. referencedClasses: [],
  61527. pragmas: [],
  61528. messageSends: ["assert:", "between:and:", "not"]
  61529. }),
  61530. $globals.NumberTest);
  61531. $core.addMethod(
  61532. $core.method({
  61533. selector: "testBitAnd",
  61534. protocol: "tests",
  61535. fn: function (){
  61536. var self=this,$self=this;
  61537. return $core.withContext(function($ctx1) {
  61538. var $1,$2;
  61539. $1=(15)._bitAnd_((2));
  61540. $ctx1.sendIdx["bitAnd:"]=1;
  61541. $self._assert_equals_($1,(2));
  61542. $ctx1.sendIdx["assert:equals:"]=1;
  61543. $2=(15)._bitAnd_((15));
  61544. $ctx1.sendIdx["bitAnd:"]=2;
  61545. $self._assert_equals_($2,(15));
  61546. $ctx1.sendIdx["assert:equals:"]=2;
  61547. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  61548. return self;
  61549. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{})});
  61550. },
  61551. args: [],
  61552. 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",
  61553. referencedClasses: [],
  61554. pragmas: [],
  61555. messageSends: ["assert:equals:", "bitAnd:"]
  61556. }),
  61557. $globals.NumberTest);
  61558. $core.addMethod(
  61559. $core.method({
  61560. selector: "testBitNot",
  61561. protocol: "tests",
  61562. fn: function (){
  61563. var self=this,$self=this;
  61564. return $core.withContext(function($ctx1) {
  61565. var $1,$2;
  61566. $1=(2)._bitNot();
  61567. $ctx1.sendIdx["bitNot"]=1;
  61568. $self._assert_equals_($1,(-3));
  61569. $ctx1.sendIdx["assert:equals:"]=1;
  61570. $2=(-1)._bitNot();
  61571. $ctx1.sendIdx["bitNot"]=2;
  61572. $self._assert_equals_($2,(0));
  61573. $ctx1.sendIdx["assert:equals:"]=2;
  61574. $self._assert_equals_((-1022)._bitNot(),(1021));
  61575. return self;
  61576. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{})});
  61577. },
  61578. args: [],
  61579. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  61580. referencedClasses: [],
  61581. pragmas: [],
  61582. messageSends: ["assert:equals:", "bitNot"]
  61583. }),
  61584. $globals.NumberTest);
  61585. $core.addMethod(
  61586. $core.method({
  61587. selector: "testBitOr",
  61588. protocol: "tests",
  61589. fn: function (){
  61590. var self=this,$self=this;
  61591. return $core.withContext(function($ctx1) {
  61592. var $1,$2;
  61593. $1=(2)._bitOr_((4));
  61594. $ctx1.sendIdx["bitOr:"]=1;
  61595. $self._assert_equals_($1,(6));
  61596. $ctx1.sendIdx["assert:equals:"]=1;
  61597. $2=(7)._bitOr_((2));
  61598. $ctx1.sendIdx["bitOr:"]=2;
  61599. $self._assert_equals_($2,(7));
  61600. $ctx1.sendIdx["assert:equals:"]=2;
  61601. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  61602. return self;
  61603. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{})});
  61604. },
  61605. args: [],
  61606. 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",
  61607. referencedClasses: [],
  61608. pragmas: [],
  61609. messageSends: ["assert:equals:", "bitOr:"]
  61610. }),
  61611. $globals.NumberTest);
  61612. $core.addMethod(
  61613. $core.method({
  61614. selector: "testBitXor",
  61615. protocol: "tests",
  61616. fn: function (){
  61617. var self=this,$self=this;
  61618. return $core.withContext(function($ctx1) {
  61619. var $1,$2,$3;
  61620. $1=(2)._bitXor_((4));
  61621. $ctx1.sendIdx["bitXor:"]=1;
  61622. $self._assert_equals_($1,(6));
  61623. $ctx1.sendIdx["assert:equals:"]=1;
  61624. $2=(7)._bitXor_((2));
  61625. $ctx1.sendIdx["bitXor:"]=2;
  61626. $self._assert_equals_($2,(5));
  61627. $ctx1.sendIdx["assert:equals:"]=2;
  61628. $3=(-1)._bitXor_((1021));
  61629. $ctx1.sendIdx["bitXor:"]=3;
  61630. $self._assert_equals_($3,(-1022));
  61631. $ctx1.sendIdx["assert:equals:"]=3;
  61632. $self._assert_equals_((91)._bitXor_((91)),(0));
  61633. return self;
  61634. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{})});
  61635. },
  61636. args: [],
  61637. 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",
  61638. referencedClasses: [],
  61639. pragmas: [],
  61640. messageSends: ["assert:equals:", "bitXor:"]
  61641. }),
  61642. $globals.NumberTest);
  61643. $core.addMethod(
  61644. $core.method({
  61645. selector: "testCeiling",
  61646. protocol: "tests",
  61647. fn: function (){
  61648. var self=this,$self=this;
  61649. return $core.withContext(function($ctx1) {
  61650. var $1,$2;
  61651. $1=(1.2)._ceiling();
  61652. $ctx1.sendIdx["ceiling"]=1;
  61653. $self._assert_equals_($1,(2));
  61654. $ctx1.sendIdx["assert:equals:"]=1;
  61655. $2=(-1.2)._ceiling();
  61656. $ctx1.sendIdx["ceiling"]=2;
  61657. $self._assert_equals_($2,(-1));
  61658. $ctx1.sendIdx["assert:equals:"]=2;
  61659. $self._assert_equals_((1)._ceiling(),(1));
  61660. return self;
  61661. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{})});
  61662. },
  61663. args: [],
  61664. 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.",
  61665. referencedClasses: [],
  61666. pragmas: [],
  61667. messageSends: ["assert:equals:", "ceiling"]
  61668. }),
  61669. $globals.NumberTest);
  61670. $core.addMethod(
  61671. $core.method({
  61672. selector: "testComparison",
  61673. protocol: "tests",
  61674. fn: function (){
  61675. var self=this,$self=this;
  61676. return $core.withContext(function($ctx1) {
  61677. var $1,$2,$3,$4;
  61678. $1=(3).__gt((2));
  61679. $ctx1.sendIdx[">"]=1;
  61680. $self._assert_($1);
  61681. $ctx1.sendIdx["assert:"]=1;
  61682. $2=(2).__lt((3));
  61683. $ctx1.sendIdx["<"]=1;
  61684. $self._assert_($2);
  61685. $ctx1.sendIdx["assert:"]=2;
  61686. $self._deny_((3).__lt((2)));
  61687. $ctx1.sendIdx["deny:"]=1;
  61688. $self._deny_((2).__gt((3)));
  61689. $3=(3).__gt_eq((3));
  61690. $ctx1.sendIdx[">="]=1;
  61691. $self._assert_($3);
  61692. $ctx1.sendIdx["assert:"]=3;
  61693. $self._assert_((3.1).__gt_eq((3)));
  61694. $ctx1.sendIdx["assert:"]=4;
  61695. $4=(3).__lt_eq((3));
  61696. $ctx1.sendIdx["<="]=1;
  61697. $self._assert_($4);
  61698. $ctx1.sendIdx["assert:"]=5;
  61699. $self._assert_((3).__lt_eq((3.1)));
  61700. return self;
  61701. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  61702. },
  61703. args: [],
  61704. 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",
  61705. referencedClasses: [],
  61706. pragmas: [],
  61707. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  61708. }),
  61709. $globals.NumberTest);
  61710. $core.addMethod(
  61711. $core.method({
  61712. selector: "testCopying",
  61713. protocol: "tests",
  61714. fn: function (){
  61715. var self=this,$self=this;
  61716. return $core.withContext(function($ctx1) {
  61717. var $1;
  61718. $1=$recv((1)._copy()).__eq_eq((1));
  61719. $ctx1.sendIdx["=="]=1;
  61720. $self._assert_($1);
  61721. $ctx1.sendIdx["assert:"]=1;
  61722. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  61723. return self;
  61724. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  61725. },
  61726. args: [],
  61727. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  61728. referencedClasses: [],
  61729. pragmas: [],
  61730. messageSends: ["assert:", "==", "copy", "deepCopy"]
  61731. }),
  61732. $globals.NumberTest);
  61733. $core.addMethod(
  61734. $core.method({
  61735. selector: "testDegreesToRadians",
  61736. protocol: "tests",
  61737. fn: function (){
  61738. var self=this,$self=this;
  61739. return $core.withContext(function($ctx1) {
  61740. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  61741. return self;
  61742. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{})});
  61743. },
  61744. args: [],
  61745. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  61746. referencedClasses: ["Number"],
  61747. pragmas: [],
  61748. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  61749. }),
  61750. $globals.NumberTest);
  61751. $core.addMethod(
  61752. $core.method({
  61753. selector: "testEquality",
  61754. protocol: "tests",
  61755. fn: function (){
  61756. var self=this,$self=this;
  61757. return $core.withContext(function($ctx1) {
  61758. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  61759. $1=(1).__eq((1));
  61760. $ctx1.sendIdx["="]=1;
  61761. $self._assert_($1);
  61762. $ctx1.sendIdx["assert:"]=1;
  61763. $2=(0).__eq((0));
  61764. $ctx1.sendIdx["="]=2;
  61765. $self._assert_($2);
  61766. $ctx1.sendIdx["assert:"]=2;
  61767. $3=(1).__eq((0));
  61768. $ctx1.sendIdx["="]=3;
  61769. $self._deny_($3);
  61770. $ctx1.sendIdx["deny:"]=1;
  61771. $5=(1)._yourself();
  61772. $ctx1.sendIdx["yourself"]=1;
  61773. $4=$recv($5).__eq((1));
  61774. $ctx1.sendIdx["="]=4;
  61775. $self._assert_($4);
  61776. $ctx1.sendIdx["assert:"]=3;
  61777. $7=(1)._yourself();
  61778. $ctx1.sendIdx["yourself"]=2;
  61779. $6=(1).__eq($7);
  61780. $ctx1.sendIdx["="]=5;
  61781. $self._assert_($6);
  61782. $ctx1.sendIdx["assert:"]=4;
  61783. $9=(1)._yourself();
  61784. $ctx1.sendIdx["yourself"]=3;
  61785. $8=$recv($9).__eq((1)._yourself());
  61786. $ctx1.sendIdx["="]=6;
  61787. $self._assert_($8);
  61788. $10=(0).__eq(false);
  61789. $ctx1.sendIdx["="]=7;
  61790. $self._deny_($10);
  61791. $ctx1.sendIdx["deny:"]=2;
  61792. $11=false.__eq((0));
  61793. $ctx1.sendIdx["="]=8;
  61794. $self._deny_($11);
  61795. $ctx1.sendIdx["deny:"]=3;
  61796. $12="".__eq((0));
  61797. $ctx1.sendIdx["="]=9;
  61798. $self._deny_($12);
  61799. $ctx1.sendIdx["deny:"]=4;
  61800. $self._deny_((0).__eq(""));
  61801. return self;
  61802. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  61803. },
  61804. args: [],
  61805. 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 = ''",
  61806. referencedClasses: [],
  61807. pragmas: [],
  61808. messageSends: ["assert:", "=", "deny:", "yourself"]
  61809. }),
  61810. $globals.NumberTest);
  61811. $core.addMethod(
  61812. $core.method({
  61813. selector: "testFloor",
  61814. protocol: "tests",
  61815. fn: function (){
  61816. var self=this,$self=this;
  61817. return $core.withContext(function($ctx1) {
  61818. var $1,$2;
  61819. $1=(1.2)._floor();
  61820. $ctx1.sendIdx["floor"]=1;
  61821. $self._assert_equals_($1,(1));
  61822. $ctx1.sendIdx["assert:equals:"]=1;
  61823. $2=(-1.2)._floor();
  61824. $ctx1.sendIdx["floor"]=2;
  61825. $self._assert_equals_($2,(-2));
  61826. $ctx1.sendIdx["assert:equals:"]=2;
  61827. $self._assert_equals_((1)._floor(),(1));
  61828. return self;
  61829. }, function($ctx1) {$ctx1.fill(self,"testFloor",{})});
  61830. },
  61831. args: [],
  61832. 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.",
  61833. referencedClasses: [],
  61834. pragmas: [],
  61835. messageSends: ["assert:equals:", "floor"]
  61836. }),
  61837. $globals.NumberTest);
  61838. $core.addMethod(
  61839. $core.method({
  61840. selector: "testHexNumbers",
  61841. protocol: "tests",
  61842. fn: function (){
  61843. var self=this,$self=this;
  61844. return $core.withContext(function($ctx1) {
  61845. var $1,$2,$3,$4,$5;
  61846. $self._assert_equals_((9),(9));
  61847. $ctx1.sendIdx["assert:equals:"]=1;
  61848. $1=(10)._truncated();
  61849. $ctx1.sendIdx["truncated"]=1;
  61850. $self._assert_equals_($1,(10));
  61851. $ctx1.sendIdx["assert:equals:"]=2;
  61852. $2=(11)._truncated();
  61853. $ctx1.sendIdx["truncated"]=2;
  61854. $self._assert_equals_($2,(11));
  61855. $ctx1.sendIdx["assert:equals:"]=3;
  61856. $3=(12)._truncated();
  61857. $ctx1.sendIdx["truncated"]=3;
  61858. $self._assert_equals_($3,(12));
  61859. $ctx1.sendIdx["assert:equals:"]=4;
  61860. $4=(13)._truncated();
  61861. $ctx1.sendIdx["truncated"]=4;
  61862. $self._assert_equals_($4,(13));
  61863. $ctx1.sendIdx["assert:equals:"]=5;
  61864. $5=(14)._truncated();
  61865. $ctx1.sendIdx["truncated"]=5;
  61866. $self._assert_equals_($5,(14));
  61867. $ctx1.sendIdx["assert:equals:"]=6;
  61868. $self._assert_equals_((15)._truncated(),(15));
  61869. return self;
  61870. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{})});
  61871. },
  61872. args: [],
  61873. 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",
  61874. referencedClasses: [],
  61875. pragmas: [],
  61876. messageSends: ["assert:equals:", "truncated"]
  61877. }),
  61878. $globals.NumberTest);
  61879. $core.addMethod(
  61880. $core.method({
  61881. selector: "testIdentity",
  61882. protocol: "tests",
  61883. fn: function (){
  61884. var self=this,$self=this;
  61885. return $core.withContext(function($ctx1) {
  61886. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  61887. $1=(1).__eq_eq((1));
  61888. $ctx1.sendIdx["=="]=1;
  61889. $self._assert_($1);
  61890. $ctx1.sendIdx["assert:"]=1;
  61891. $2=(0).__eq_eq((0));
  61892. $ctx1.sendIdx["=="]=2;
  61893. $self._assert_($2);
  61894. $ctx1.sendIdx["assert:"]=2;
  61895. $3=(1).__eq_eq((0));
  61896. $ctx1.sendIdx["=="]=3;
  61897. $self._deny_($3);
  61898. $ctx1.sendIdx["deny:"]=1;
  61899. $5=(1)._yourself();
  61900. $ctx1.sendIdx["yourself"]=1;
  61901. $4=$recv($5).__eq_eq((1));
  61902. $ctx1.sendIdx["=="]=4;
  61903. $self._assert_($4);
  61904. $ctx1.sendIdx["assert:"]=3;
  61905. $7=(1)._yourself();
  61906. $ctx1.sendIdx["yourself"]=2;
  61907. $6=(1).__eq_eq($7);
  61908. $ctx1.sendIdx["=="]=5;
  61909. $self._assert_($6);
  61910. $ctx1.sendIdx["assert:"]=4;
  61911. $9=(1)._yourself();
  61912. $ctx1.sendIdx["yourself"]=3;
  61913. $8=$recv($9).__eq_eq((1)._yourself());
  61914. $ctx1.sendIdx["=="]=6;
  61915. $self._assert_($8);
  61916. $self._deny_((1).__eq_eq((2)));
  61917. return self;
  61918. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  61919. },
  61920. args: [],
  61921. 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",
  61922. referencedClasses: [],
  61923. pragmas: [],
  61924. messageSends: ["assert:", "==", "deny:", "yourself"]
  61925. }),
  61926. $globals.NumberTest);
  61927. $core.addMethod(
  61928. $core.method({
  61929. selector: "testInvalidHexNumbers",
  61930. protocol: "tests",
  61931. fn: function (){
  61932. var self=this,$self=this;
  61933. return $core.withContext(function($ctx1) {
  61934. $self._should_raise_((function(){
  61935. return $core.withContext(function($ctx2) {
  61936. return (16)._rG();
  61937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61938. }),$globals.MessageNotUnderstood);
  61939. $ctx1.sendIdx["should:raise:"]=1;
  61940. $self._should_raise_((function(){
  61941. return $core.withContext(function($ctx2) {
  61942. return (16)._rg();
  61943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61944. }),$globals.MessageNotUnderstood);
  61945. $ctx1.sendIdx["should:raise:"]=2;
  61946. $self._should_raise_((function(){
  61947. return $core.withContext(function($ctx2) {
  61948. return (16)._rH();
  61949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61950. }),$globals.MessageNotUnderstood);
  61951. $ctx1.sendIdx["should:raise:"]=3;
  61952. $self._should_raise_((function(){
  61953. return $core.withContext(function($ctx2) {
  61954. return (16)._rh();
  61955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  61956. }),$globals.MessageNotUnderstood);
  61957. $ctx1.sendIdx["should:raise:"]=4;
  61958. $self._should_raise_((function(){
  61959. return $core.withContext(function($ctx2) {
  61960. return (16)._rI();
  61961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61962. }),$globals.MessageNotUnderstood);
  61963. $ctx1.sendIdx["should:raise:"]=5;
  61964. $self._should_raise_((function(){
  61965. return $core.withContext(function($ctx2) {
  61966. return (16)._ri();
  61967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  61968. }),$globals.MessageNotUnderstood);
  61969. $ctx1.sendIdx["should:raise:"]=6;
  61970. $self._should_raise_((function(){
  61971. return $core.withContext(function($ctx2) {
  61972. return (16)._rJ();
  61973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  61974. }),$globals.MessageNotUnderstood);
  61975. $ctx1.sendIdx["should:raise:"]=7;
  61976. $self._should_raise_((function(){
  61977. return $core.withContext(function($ctx2) {
  61978. return (16)._rj();
  61979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  61980. }),$globals.MessageNotUnderstood);
  61981. $ctx1.sendIdx["should:raise:"]=8;
  61982. $self._should_raise_((function(){
  61983. return $core.withContext(function($ctx2) {
  61984. return (16)._rK();
  61985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  61986. }),$globals.MessageNotUnderstood);
  61987. $ctx1.sendIdx["should:raise:"]=9;
  61988. $self._should_raise_((function(){
  61989. return $core.withContext(function($ctx2) {
  61990. return (16)._rk();
  61991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  61992. }),$globals.MessageNotUnderstood);
  61993. $ctx1.sendIdx["should:raise:"]=10;
  61994. $self._should_raise_((function(){
  61995. return $core.withContext(function($ctx2) {
  61996. return (16)._rL();
  61997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  61998. }),$globals.MessageNotUnderstood);
  61999. $ctx1.sendIdx["should:raise:"]=11;
  62000. $self._should_raise_((function(){
  62001. return $core.withContext(function($ctx2) {
  62002. return (16)._rl();
  62003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  62004. }),$globals.MessageNotUnderstood);
  62005. $ctx1.sendIdx["should:raise:"]=12;
  62006. $self._should_raise_((function(){
  62007. return $core.withContext(function($ctx2) {
  62008. return (16)._rM();
  62009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  62010. }),$globals.MessageNotUnderstood);
  62011. $ctx1.sendIdx["should:raise:"]=13;
  62012. $self._should_raise_((function(){
  62013. return $core.withContext(function($ctx2) {
  62014. return (16)._rm();
  62015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  62016. }),$globals.MessageNotUnderstood);
  62017. $ctx1.sendIdx["should:raise:"]=14;
  62018. $self._should_raise_((function(){
  62019. return $core.withContext(function($ctx2) {
  62020. return (16)._rN();
  62021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  62022. }),$globals.MessageNotUnderstood);
  62023. $ctx1.sendIdx["should:raise:"]=15;
  62024. $self._should_raise_((function(){
  62025. return $core.withContext(function($ctx2) {
  62026. return (16)._rn();
  62027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  62028. }),$globals.MessageNotUnderstood);
  62029. $ctx1.sendIdx["should:raise:"]=16;
  62030. $self._should_raise_((function(){
  62031. return $core.withContext(function($ctx2) {
  62032. return (16)._rO();
  62033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  62034. }),$globals.MessageNotUnderstood);
  62035. $ctx1.sendIdx["should:raise:"]=17;
  62036. $self._should_raise_((function(){
  62037. return $core.withContext(function($ctx2) {
  62038. return (16)._ro();
  62039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  62040. }),$globals.MessageNotUnderstood);
  62041. $ctx1.sendIdx["should:raise:"]=18;
  62042. $self._should_raise_((function(){
  62043. return $core.withContext(function($ctx2) {
  62044. return (16)._rP();
  62045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  62046. }),$globals.MessageNotUnderstood);
  62047. $ctx1.sendIdx["should:raise:"]=19;
  62048. $self._should_raise_((function(){
  62049. return $core.withContext(function($ctx2) {
  62050. return (16)._rp();
  62051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  62052. }),$globals.MessageNotUnderstood);
  62053. $ctx1.sendIdx["should:raise:"]=20;
  62054. $self._should_raise_((function(){
  62055. return $core.withContext(function($ctx2) {
  62056. return (16)._rQ();
  62057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  62058. }),$globals.MessageNotUnderstood);
  62059. $ctx1.sendIdx["should:raise:"]=21;
  62060. $self._should_raise_((function(){
  62061. return $core.withContext(function($ctx2) {
  62062. return (16)._rq();
  62063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  62064. }),$globals.MessageNotUnderstood);
  62065. $ctx1.sendIdx["should:raise:"]=22;
  62066. $self._should_raise_((function(){
  62067. return $core.withContext(function($ctx2) {
  62068. return (16)._rR();
  62069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  62070. }),$globals.MessageNotUnderstood);
  62071. $ctx1.sendIdx["should:raise:"]=23;
  62072. $self._should_raise_((function(){
  62073. return $core.withContext(function($ctx2) {
  62074. return (16)._rr();
  62075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  62076. }),$globals.MessageNotUnderstood);
  62077. $ctx1.sendIdx["should:raise:"]=24;
  62078. $self._should_raise_((function(){
  62079. return $core.withContext(function($ctx2) {
  62080. return (16)._rS();
  62081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  62082. }),$globals.MessageNotUnderstood);
  62083. $ctx1.sendIdx["should:raise:"]=25;
  62084. $self._should_raise_((function(){
  62085. return $core.withContext(function($ctx2) {
  62086. return (16)._rs();
  62087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  62088. }),$globals.MessageNotUnderstood);
  62089. $ctx1.sendIdx["should:raise:"]=26;
  62090. $self._should_raise_((function(){
  62091. return $core.withContext(function($ctx2) {
  62092. return (16)._rT();
  62093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  62094. }),$globals.MessageNotUnderstood);
  62095. $ctx1.sendIdx["should:raise:"]=27;
  62096. $self._should_raise_((function(){
  62097. return $core.withContext(function($ctx2) {
  62098. return (16)._rt();
  62099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  62100. }),$globals.MessageNotUnderstood);
  62101. $ctx1.sendIdx["should:raise:"]=28;
  62102. $self._should_raise_((function(){
  62103. return $core.withContext(function($ctx2) {
  62104. return (16)._rU();
  62105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  62106. }),$globals.MessageNotUnderstood);
  62107. $ctx1.sendIdx["should:raise:"]=29;
  62108. $self._should_raise_((function(){
  62109. return $core.withContext(function($ctx2) {
  62110. return (16)._ru();
  62111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  62112. }),$globals.MessageNotUnderstood);
  62113. $ctx1.sendIdx["should:raise:"]=30;
  62114. $self._should_raise_((function(){
  62115. return $core.withContext(function($ctx2) {
  62116. return (16)._rV();
  62117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  62118. }),$globals.MessageNotUnderstood);
  62119. $ctx1.sendIdx["should:raise:"]=31;
  62120. $self._should_raise_((function(){
  62121. return $core.withContext(function($ctx2) {
  62122. return (16)._rv();
  62123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  62124. }),$globals.MessageNotUnderstood);
  62125. $ctx1.sendIdx["should:raise:"]=32;
  62126. $self._should_raise_((function(){
  62127. return $core.withContext(function($ctx2) {
  62128. return (16)._rW();
  62129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  62130. }),$globals.MessageNotUnderstood);
  62131. $ctx1.sendIdx["should:raise:"]=33;
  62132. $self._should_raise_((function(){
  62133. return $core.withContext(function($ctx2) {
  62134. return (16)._rw();
  62135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  62136. }),$globals.MessageNotUnderstood);
  62137. $ctx1.sendIdx["should:raise:"]=34;
  62138. $self._should_raise_((function(){
  62139. return $core.withContext(function($ctx2) {
  62140. return (16)._rX();
  62141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  62142. }),$globals.MessageNotUnderstood);
  62143. $ctx1.sendIdx["should:raise:"]=35;
  62144. $self._should_raise_((function(){
  62145. return $core.withContext(function($ctx2) {
  62146. return (16)._rx();
  62147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  62148. }),$globals.MessageNotUnderstood);
  62149. $ctx1.sendIdx["should:raise:"]=36;
  62150. $self._should_raise_((function(){
  62151. return $core.withContext(function($ctx2) {
  62152. return (16)._rY();
  62153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  62154. }),$globals.MessageNotUnderstood);
  62155. $ctx1.sendIdx["should:raise:"]=37;
  62156. $self._should_raise_((function(){
  62157. return $core.withContext(function($ctx2) {
  62158. return (16)._ry();
  62159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  62160. }),$globals.MessageNotUnderstood);
  62161. $ctx1.sendIdx["should:raise:"]=38;
  62162. $self._should_raise_((function(){
  62163. return $core.withContext(function($ctx2) {
  62164. return (16)._rZ();
  62165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  62166. }),$globals.MessageNotUnderstood);
  62167. $ctx1.sendIdx["should:raise:"]=39;
  62168. $self._should_raise_((function(){
  62169. return $core.withContext(function($ctx2) {
  62170. return (16)._rz();
  62171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  62172. }),$globals.MessageNotUnderstood);
  62173. $ctx1.sendIdx["should:raise:"]=40;
  62174. $self._should_raise_((function(){
  62175. return $core.withContext(function($ctx2) {
  62176. return (11259375)._Z();
  62177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  62178. }),$globals.MessageNotUnderstood);
  62179. return self;
  62180. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{})});
  62181. },
  62182. args: [],
  62183. 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.",
  62184. referencedClasses: ["MessageNotUnderstood"],
  62185. pragmas: [],
  62186. 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"]
  62187. }),
  62188. $globals.NumberTest);
  62189. $core.addMethod(
  62190. $core.method({
  62191. selector: "testLog",
  62192. protocol: "tests",
  62193. fn: function (){
  62194. var self=this,$self=this;
  62195. return $core.withContext(function($ctx1) {
  62196. $self._assert_equals_((10000)._log(),(4));
  62197. $ctx1.sendIdx["assert:equals:"]=1;
  62198. $self._assert_equals_((512)._log_((2)),(9));
  62199. $ctx1.sendIdx["assert:equals:"]=2;
  62200. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  62201. return self;
  62202. }, function($ctx1) {$ctx1.fill(self,"testLog",{})});
  62203. },
  62204. args: [],
  62205. 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.",
  62206. referencedClasses: ["Number"],
  62207. pragmas: [],
  62208. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  62209. }),
  62210. $globals.NumberTest);
  62211. $core.addMethod(
  62212. $core.method({
  62213. selector: "testMinMax",
  62214. protocol: "tests",
  62215. fn: function (){
  62216. var self=this,$self=this;
  62217. return $core.withContext(function($ctx1) {
  62218. var $1,$2;
  62219. $self._assert_equals_((2)._max_((5)),(5));
  62220. $ctx1.sendIdx["assert:equals:"]=1;
  62221. $self._assert_equals_((2)._min_((5)),(2));
  62222. $ctx1.sendIdx["assert:equals:"]=2;
  62223. $1=(2)._min_max_((5),(3));
  62224. $ctx1.sendIdx["min:max:"]=1;
  62225. $self._assert_equals_($1,(3));
  62226. $ctx1.sendIdx["assert:equals:"]=3;
  62227. $2=(7)._min_max_((5),(3));
  62228. $ctx1.sendIdx["min:max:"]=2;
  62229. $self._assert_equals_($2,(5));
  62230. $ctx1.sendIdx["assert:equals:"]=4;
  62231. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  62232. return self;
  62233. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{})});
  62234. },
  62235. args: [],
  62236. 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.",
  62237. referencedClasses: [],
  62238. pragmas: [],
  62239. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  62240. }),
  62241. $globals.NumberTest);
  62242. $core.addMethod(
  62243. $core.method({
  62244. selector: "testNegated",
  62245. protocol: "tests",
  62246. fn: function (){
  62247. var self=this,$self=this;
  62248. return $core.withContext(function($ctx1) {
  62249. var $1;
  62250. $1=(3)._negated();
  62251. $ctx1.sendIdx["negated"]=1;
  62252. $self._assert_equals_($1,(-3));
  62253. $ctx1.sendIdx["assert:equals:"]=1;
  62254. $self._assert_equals_((-3)._negated(),(3));
  62255. return self;
  62256. }, function($ctx1) {$ctx1.fill(self,"testNegated",{})});
  62257. },
  62258. args: [],
  62259. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  62260. referencedClasses: [],
  62261. pragmas: [],
  62262. messageSends: ["assert:equals:", "negated"]
  62263. }),
  62264. $globals.NumberTest);
  62265. $core.addMethod(
  62266. $core.method({
  62267. selector: "testPrintShowingDecimalPlaces",
  62268. protocol: "tests",
  62269. fn: function (){
  62270. var self=this,$self=this;
  62271. return $core.withContext(function($ctx1) {
  62272. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  62273. $1=(23)._printShowingDecimalPlaces_((2));
  62274. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  62275. $self._assert_equals_($1,"23.00");
  62276. $ctx1.sendIdx["assert:equals:"]=1;
  62277. $2=(23.5698)._printShowingDecimalPlaces_((2));
  62278. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  62279. $self._assert_equals_($2,"23.57");
  62280. $ctx1.sendIdx["assert:equals:"]=2;
  62281. $4=(234.567)._negated();
  62282. $ctx1.sendIdx["negated"]=1;
  62283. $3=$recv($4)._printShowingDecimalPlaces_((5));
  62284. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  62285. $self._assert_equals_($3,"-234.56700");
  62286. $ctx1.sendIdx["assert:equals:"]=3;
  62287. $5=(23.4567)._printShowingDecimalPlaces_((0));
  62288. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  62289. $self._assert_equals_($5,"23");
  62290. $ctx1.sendIdx["assert:equals:"]=4;
  62291. $6=(23.5567)._printShowingDecimalPlaces_((0));
  62292. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  62293. $self._assert_equals_($6,"24");
  62294. $ctx1.sendIdx["assert:equals:"]=5;
  62295. $8=(23.4567)._negated();
  62296. $ctx1.sendIdx["negated"]=2;
  62297. $7=$recv($8)._printShowingDecimalPlaces_((0));
  62298. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  62299. $self._assert_equals_($7,"-23");
  62300. $ctx1.sendIdx["assert:equals:"]=6;
  62301. $10=(23.5567)._negated();
  62302. $ctx1.sendIdx["negated"]=3;
  62303. $9=$recv($10)._printShowingDecimalPlaces_((0));
  62304. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  62305. $self._assert_equals_($9,"-24");
  62306. $ctx1.sendIdx["assert:equals:"]=7;
  62307. $11=(100000000)._printShowingDecimalPlaces_((1));
  62308. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  62309. $self._assert_equals_($11,"100000000.0");
  62310. $ctx1.sendIdx["assert:equals:"]=8;
  62311. $12=(0.98)._printShowingDecimalPlaces_((5));
  62312. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  62313. $self._assert_equals_($12,"0.98000");
  62314. $ctx1.sendIdx["assert:equals:"]=9;
  62315. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  62316. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  62317. $self._assert_equals_($13,"-0.98");
  62318. $ctx1.sendIdx["assert:equals:"]=10;
  62319. $14=(2.567)._printShowingDecimalPlaces_((2));
  62320. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  62321. $self._assert_equals_($14,"2.57");
  62322. $ctx1.sendIdx["assert:equals:"]=11;
  62323. $15=(-2.567)._printShowingDecimalPlaces_((2));
  62324. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  62325. $self._assert_equals_($15,"-2.57");
  62326. $ctx1.sendIdx["assert:equals:"]=12;
  62327. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  62328. return self;
  62329. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{})});
  62330. },
  62331. args: [],
  62332. 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'.",
  62333. referencedClasses: [],
  62334. pragmas: [],
  62335. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  62336. }),
  62337. $globals.NumberTest);
  62338. $core.addMethod(
  62339. $core.method({
  62340. selector: "testPrintStringBase",
  62341. protocol: "tests",
  62342. fn: function (){
  62343. var self=this,$self=this;
  62344. return $core.withContext(function($ctx1) {
  62345. var $1,$2,$3;
  62346. $1=(15)._printStringBase_((2));
  62347. $ctx1.sendIdx["printStringBase:"]=1;
  62348. $self._assert_equals_($1,"1111");
  62349. $ctx1.sendIdx["assert:equals:"]=1;
  62350. $2=(15)._printStringBase_((16));
  62351. $ctx1.sendIdx["printStringBase:"]=2;
  62352. $self._assert_equals_($2,"f");
  62353. $ctx1.sendIdx["assert:equals:"]=2;
  62354. $3=(256)._printStringBase_((16));
  62355. $ctx1.sendIdx["printStringBase:"]=3;
  62356. $self._assert_equals_($3,"100");
  62357. $ctx1.sendIdx["assert:equals:"]=3;
  62358. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  62359. return self;
  62360. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{})});
  62361. },
  62362. args: [],
  62363. 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'",
  62364. referencedClasses: [],
  62365. pragmas: [],
  62366. messageSends: ["assert:equals:", "printStringBase:"]
  62367. }),
  62368. $globals.NumberTest);
  62369. $core.addMethod(
  62370. $core.method({
  62371. selector: "testRadiansToDegrees",
  62372. protocol: "tests",
  62373. fn: function (){
  62374. var self=this,$self=this;
  62375. return $core.withContext(function($ctx1) {
  62376. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  62377. return self;
  62378. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{})});
  62379. },
  62380. args: [],
  62381. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  62382. referencedClasses: ["Number"],
  62383. pragmas: [],
  62384. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  62385. }),
  62386. $globals.NumberTest);
  62387. $core.addMethod(
  62388. $core.method({
  62389. selector: "testRaisedTo",
  62390. protocol: "tests",
  62391. fn: function (){
  62392. var self=this,$self=this;
  62393. return $core.withContext(function($ctx1) {
  62394. var $1,$2,$3;
  62395. $1=(2)._raisedTo_((4));
  62396. $ctx1.sendIdx["raisedTo:"]=1;
  62397. $self._assert_equals_($1,(16));
  62398. $ctx1.sendIdx["assert:equals:"]=1;
  62399. $2=(2)._raisedTo_((0));
  62400. $ctx1.sendIdx["raisedTo:"]=2;
  62401. $self._assert_equals_($2,(1));
  62402. $ctx1.sendIdx["assert:equals:"]=2;
  62403. $3=(2)._raisedTo_((-3));
  62404. $ctx1.sendIdx["raisedTo:"]=3;
  62405. $self._assert_equals_($3,(0.125));
  62406. $ctx1.sendIdx["assert:equals:"]=3;
  62407. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  62408. $ctx1.sendIdx["assert:equals:"]=4;
  62409. $self._assert_equals_((2).__star_star((4)),(16));
  62410. return self;
  62411. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{})});
  62412. },
  62413. args: [],
  62414. 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.",
  62415. referencedClasses: [],
  62416. pragmas: [],
  62417. messageSends: ["assert:equals:", "raisedTo:", "**"]
  62418. }),
  62419. $globals.NumberTest);
  62420. $core.addMethod(
  62421. $core.method({
  62422. selector: "testRounded",
  62423. protocol: "tests",
  62424. fn: function (){
  62425. var self=this,$self=this;
  62426. return $core.withContext(function($ctx1) {
  62427. var $1,$2;
  62428. $1=(3)._rounded();
  62429. $ctx1.sendIdx["rounded"]=1;
  62430. $self._assert_equals_($1,(3));
  62431. $ctx1.sendIdx["assert:equals:"]=1;
  62432. $2=(3.212)._rounded();
  62433. $ctx1.sendIdx["rounded"]=2;
  62434. $self._assert_equals_($2,(3));
  62435. $ctx1.sendIdx["assert:equals:"]=2;
  62436. $self._assert_equals_((3.51)._rounded(),(4));
  62437. return self;
  62438. }, function($ctx1) {$ctx1.fill(self,"testRounded",{})});
  62439. },
  62440. args: [],
  62441. 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",
  62442. referencedClasses: [],
  62443. pragmas: [],
  62444. messageSends: ["assert:equals:", "rounded"]
  62445. }),
  62446. $globals.NumberTest);
  62447. $core.addMethod(
  62448. $core.method({
  62449. selector: "testSign",
  62450. protocol: "tests",
  62451. fn: function (){
  62452. var self=this,$self=this;
  62453. return $core.withContext(function($ctx1) {
  62454. var $1,$2;
  62455. $1=(5)._sign();
  62456. $ctx1.sendIdx["sign"]=1;
  62457. $self._assert_equals_($1,(1));
  62458. $ctx1.sendIdx["assert:equals:"]=1;
  62459. $2=(0)._sign();
  62460. $ctx1.sendIdx["sign"]=2;
  62461. $self._assert_equals_($2,(0));
  62462. $ctx1.sendIdx["assert:equals:"]=2;
  62463. $self._assert_equals_((-1.4)._sign(),(-1));
  62464. return self;
  62465. }, function($ctx1) {$ctx1.fill(self,"testSign",{})});
  62466. },
  62467. args: [],
  62468. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  62469. referencedClasses: [],
  62470. pragmas: [],
  62471. messageSends: ["assert:equals:", "sign"]
  62472. }),
  62473. $globals.NumberTest);
  62474. $core.addMethod(
  62475. $core.method({
  62476. selector: "testSqrt",
  62477. protocol: "tests",
  62478. fn: function (){
  62479. var self=this,$self=this;
  62480. return $core.withContext(function($ctx1) {
  62481. var $1;
  62482. $1=(4)._sqrt();
  62483. $ctx1.sendIdx["sqrt"]=1;
  62484. $self._assert_equals_($1,(2));
  62485. $ctx1.sendIdx["assert:equals:"]=1;
  62486. $self._assert_equals_((16)._sqrt(),(4));
  62487. return self;
  62488. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{})});
  62489. },
  62490. args: [],
  62491. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  62492. referencedClasses: [],
  62493. pragmas: [],
  62494. messageSends: ["assert:equals:", "sqrt"]
  62495. }),
  62496. $globals.NumberTest);
  62497. $core.addMethod(
  62498. $core.method({
  62499. selector: "testSquared",
  62500. protocol: "tests",
  62501. fn: function (){
  62502. var self=this,$self=this;
  62503. return $core.withContext(function($ctx1) {
  62504. $self._assert_equals_((4)._squared(),(16));
  62505. return self;
  62506. }, function($ctx1) {$ctx1.fill(self,"testSquared",{})});
  62507. },
  62508. args: [],
  62509. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  62510. referencedClasses: [],
  62511. pragmas: [],
  62512. messageSends: ["assert:equals:", "squared"]
  62513. }),
  62514. $globals.NumberTest);
  62515. $core.addMethod(
  62516. $core.method({
  62517. selector: "testTimesRepeat",
  62518. protocol: "tests",
  62519. fn: function (){
  62520. var self=this,$self=this;
  62521. var i;
  62522. return $core.withContext(function($ctx1) {
  62523. i=(0);
  62524. (0)._timesRepeat_((function(){
  62525. return $core.withContext(function($ctx2) {
  62526. i=$recv(i).__plus((1));
  62527. $ctx2.sendIdx["+"]=1;
  62528. return i;
  62529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62530. }));
  62531. $ctx1.sendIdx["timesRepeat:"]=1;
  62532. $self._assert_equals_(i,(0));
  62533. $ctx1.sendIdx["assert:equals:"]=1;
  62534. (5)._timesRepeat_((function(){
  62535. return $core.withContext(function($ctx2) {
  62536. i=$recv(i).__plus((1));
  62537. return i;
  62538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62539. }));
  62540. $self._assert_equals_(i,(5));
  62541. return self;
  62542. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i})});
  62543. },
  62544. args: [],
  62545. 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",
  62546. referencedClasses: [],
  62547. pragmas: [],
  62548. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  62549. }),
  62550. $globals.NumberTest);
  62551. $core.addMethod(
  62552. $core.method({
  62553. selector: "testTo",
  62554. protocol: "tests",
  62555. fn: function (){
  62556. var self=this,$self=this;
  62557. return $core.withContext(function($ctx1) {
  62558. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  62559. return self;
  62560. }, function($ctx1) {$ctx1.fill(self,"testTo",{})});
  62561. },
  62562. args: [],
  62563. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  62564. referencedClasses: [],
  62565. pragmas: [],
  62566. messageSends: ["assert:equals:", "to:"]
  62567. }),
  62568. $globals.NumberTest);
  62569. $core.addMethod(
  62570. $core.method({
  62571. selector: "testToBy",
  62572. protocol: "tests",
  62573. fn: function (){
  62574. var self=this,$self=this;
  62575. return $core.withContext(function($ctx1) {
  62576. var $1;
  62577. $1=(0)._to_by_((6),(2));
  62578. $ctx1.sendIdx["to:by:"]=1;
  62579. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  62580. $self._should_raise_((function(){
  62581. return $core.withContext(function($ctx2) {
  62582. return (1)._to_by_((4),(0));
  62583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62584. }),$globals.Error);
  62585. return self;
  62586. }, function($ctx1) {$ctx1.fill(self,"testToBy",{})});
  62587. },
  62588. args: [],
  62589. 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",
  62590. referencedClasses: ["Error"],
  62591. pragmas: [],
  62592. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  62593. }),
  62594. $globals.NumberTest);
  62595. $core.addMethod(
  62596. $core.method({
  62597. selector: "testTrigonometry",
  62598. protocol: "tests",
  62599. fn: function (){
  62600. var self=this,$self=this;
  62601. return $core.withContext(function($ctx1) {
  62602. var $1;
  62603. $self._assert_equals_((0)._cos(),(1));
  62604. $ctx1.sendIdx["assert:equals:"]=1;
  62605. $self._assert_equals_((0)._sin(),(0));
  62606. $ctx1.sendIdx["assert:equals:"]=2;
  62607. $self._assert_equals_((0)._tan(),(0));
  62608. $ctx1.sendIdx["assert:equals:"]=3;
  62609. $self._assert_equals_((1)._arcCos(),(0));
  62610. $ctx1.sendIdx["assert:equals:"]=4;
  62611. $self._assert_equals_((0)._arcSin(),(0));
  62612. $ctx1.sendIdx["assert:equals:"]=5;
  62613. $self._assert_equals_((0)._arcTan(),(0));
  62614. $ctx1.sendIdx["assert:equals:"]=6;
  62615. $1=(0)._arcTan_((1));
  62616. $ctx1.sendIdx["arcTan:"]=1;
  62617. $self._assert_equals_($1,(0));
  62618. $ctx1.sendIdx["assert:equals:"]=7;
  62619. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  62620. return self;
  62621. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{})});
  62622. },
  62623. args: [],
  62624. 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)",
  62625. referencedClasses: ["Number"],
  62626. pragmas: [],
  62627. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  62628. }),
  62629. $globals.NumberTest);
  62630. $core.addMethod(
  62631. $core.method({
  62632. selector: "testTruncated",
  62633. protocol: "tests",
  62634. fn: function (){
  62635. var self=this,$self=this;
  62636. return $core.withContext(function($ctx1) {
  62637. var $1,$2;
  62638. $1=(3)._truncated();
  62639. $ctx1.sendIdx["truncated"]=1;
  62640. $self._assert_equals_($1,(3));
  62641. $ctx1.sendIdx["assert:equals:"]=1;
  62642. $2=(3.212)._truncated();
  62643. $ctx1.sendIdx["truncated"]=2;
  62644. $self._assert_equals_($2,(3));
  62645. $ctx1.sendIdx["assert:equals:"]=2;
  62646. $self._assert_equals_((3.51)._truncated(),(3));
  62647. return self;
  62648. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{})});
  62649. },
  62650. args: [],
  62651. 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",
  62652. referencedClasses: [],
  62653. pragmas: [],
  62654. messageSends: ["assert:equals:", "truncated"]
  62655. }),
  62656. $globals.NumberTest);
  62657. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  62658. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  62659. $core.addMethod(
  62660. $core.method({
  62661. selector: "foo",
  62662. protocol: "not yet classified",
  62663. fn: function (){
  62664. var self=this,$self=this;
  62665. return $self.foo;
  62666. },
  62667. args: [],
  62668. source: "foo\x0a\x09^ foo",
  62669. referencedClasses: [],
  62670. pragmas: [],
  62671. messageSends: []
  62672. }),
  62673. $globals.ObjectMock);
  62674. $core.addMethod(
  62675. $core.method({
  62676. selector: "foo:",
  62677. protocol: "not yet classified",
  62678. fn: function (anObject){
  62679. var self=this,$self=this;
  62680. $self.foo=anObject;
  62681. return self;
  62682. },
  62683. args: ["anObject"],
  62684. source: "foo: anObject\x0a\x09foo := anObject",
  62685. referencedClasses: [],
  62686. pragmas: [],
  62687. messageSends: []
  62688. }),
  62689. $globals.ObjectMock);
  62690. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  62691. $core.addMethod(
  62692. $core.method({
  62693. selector: "notDefined",
  62694. protocol: "tests",
  62695. fn: function (){
  62696. var self=this,$self=this;
  62697. return $core.withContext(function($ctx1) {
  62698. return void 0;;
  62699. return self;
  62700. }, function($ctx1) {$ctx1.fill(self,"notDefined",{})});
  62701. },
  62702. args: [],
  62703. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  62704. referencedClasses: [],
  62705. pragmas: [["inlineJS:", ["return void 0;"]]],
  62706. messageSends: []
  62707. }),
  62708. $globals.ObjectTest);
  62709. $core.addMethod(
  62710. $core.method({
  62711. selector: "testBasicAccess",
  62712. protocol: "tests",
  62713. fn: function (){
  62714. var self=this,$self=this;
  62715. var o;
  62716. return $core.withContext(function($ctx1) {
  62717. var $1;
  62718. o=$recv($globals.Object)._new();
  62719. $recv(o)._basicAt_put_("a",(1));
  62720. $1=$recv(o)._basicAt_("a");
  62721. $ctx1.sendIdx["basicAt:"]=1;
  62722. $self._assert_equals_($1,(1));
  62723. $ctx1.sendIdx["assert:equals:"]=1;
  62724. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  62725. return self;
  62726. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o})});
  62727. },
  62728. args: [],
  62729. 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",
  62730. referencedClasses: ["Object"],
  62731. pragmas: [],
  62732. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  62733. }),
  62734. $globals.ObjectTest);
  62735. $core.addMethod(
  62736. $core.method({
  62737. selector: "testBasicPerform",
  62738. protocol: "tests",
  62739. fn: function (){
  62740. var self=this,$self=this;
  62741. var o;
  62742. return $core.withContext(function($ctx1) {
  62743. o=$recv($globals.Object)._new();
  62744. $recv(o)._basicAt_put_("func",(function(){
  62745. return "hello";
  62746. }));
  62747. $ctx1.sendIdx["basicAt:put:"]=1;
  62748. $recv(o)._basicAt_put_("func2",(function(a){
  62749. return $core.withContext(function($ctx2) {
  62750. return $recv(a).__plus((1));
  62751. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  62752. }));
  62753. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  62754. $ctx1.sendIdx["assert:equals:"]=1;
  62755. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  62756. return self;
  62757. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o})});
  62758. },
  62759. args: [],
  62760. 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",
  62761. referencedClasses: ["Object"],
  62762. pragmas: [],
  62763. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  62764. }),
  62765. $globals.ObjectTest);
  62766. $core.addMethod(
  62767. $core.method({
  62768. selector: "testDNU",
  62769. protocol: "tests",
  62770. fn: function (){
  62771. var self=this,$self=this;
  62772. return $core.withContext(function($ctx1) {
  62773. $self._should_raise_((function(){
  62774. return $core.withContext(function($ctx2) {
  62775. return $recv($recv($globals.Object)._new())._foo();
  62776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62777. }),$globals.MessageNotUnderstood);
  62778. return self;
  62779. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  62780. },
  62781. args: [],
  62782. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  62783. referencedClasses: ["Object", "MessageNotUnderstood"],
  62784. pragmas: [],
  62785. messageSends: ["should:raise:", "foo", "new"]
  62786. }),
  62787. $globals.ObjectTest);
  62788. $core.addMethod(
  62789. $core.method({
  62790. selector: "testEquality",
  62791. protocol: "tests",
  62792. fn: function (){
  62793. var self=this,$self=this;
  62794. var o;
  62795. return $core.withContext(function($ctx1) {
  62796. var $1,$2,$4,$3;
  62797. o=$recv($globals.Object)._new();
  62798. $ctx1.sendIdx["new"]=1;
  62799. $1=$recv(o).__eq($recv($globals.Object)._new());
  62800. $ctx1.sendIdx["="]=1;
  62801. $self._deny_($1);
  62802. $2=$recv(o).__eq(o);
  62803. $ctx1.sendIdx["="]=2;
  62804. $self._assert_($2);
  62805. $ctx1.sendIdx["assert:"]=1;
  62806. $4=$recv(o)._yourself();
  62807. $ctx1.sendIdx["yourself"]=1;
  62808. $3=$recv($4).__eq(o);
  62809. $ctx1.sendIdx["="]=3;
  62810. $self._assert_($3);
  62811. $ctx1.sendIdx["assert:"]=2;
  62812. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  62813. return self;
  62814. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o})});
  62815. },
  62816. args: [],
  62817. 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)",
  62818. referencedClasses: ["Object"],
  62819. pragmas: [],
  62820. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  62821. }),
  62822. $globals.ObjectTest);
  62823. $core.addMethod(
  62824. $core.method({
  62825. selector: "testHalt",
  62826. protocol: "tests",
  62827. fn: function (){
  62828. var self=this,$self=this;
  62829. return $core.withContext(function($ctx1) {
  62830. $self._should_raise_((function(){
  62831. return $core.withContext(function($ctx2) {
  62832. return $recv($recv($globals.Object)._new())._halt();
  62833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62834. }),$globals.Error);
  62835. return self;
  62836. }, function($ctx1) {$ctx1.fill(self,"testHalt",{})});
  62837. },
  62838. args: [],
  62839. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  62840. referencedClasses: ["Object", "Error"],
  62841. pragmas: [],
  62842. messageSends: ["should:raise:", "halt", "new"]
  62843. }),
  62844. $globals.ObjectTest);
  62845. $core.addMethod(
  62846. $core.method({
  62847. selector: "testIdentity",
  62848. protocol: "tests",
  62849. fn: function (){
  62850. var self=this,$self=this;
  62851. var o;
  62852. return $core.withContext(function($ctx1) {
  62853. var $1,$2,$4,$3;
  62854. o=$recv($globals.Object)._new();
  62855. $ctx1.sendIdx["new"]=1;
  62856. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  62857. $ctx1.sendIdx["=="]=1;
  62858. $self._deny_($1);
  62859. $2=$recv(o).__eq_eq(o);
  62860. $ctx1.sendIdx["=="]=2;
  62861. $self._assert_($2);
  62862. $ctx1.sendIdx["assert:"]=1;
  62863. $4=$recv(o)._yourself();
  62864. $ctx1.sendIdx["yourself"]=1;
  62865. $3=$recv($4).__eq_eq(o);
  62866. $ctx1.sendIdx["=="]=3;
  62867. $self._assert_($3);
  62868. $ctx1.sendIdx["assert:"]=2;
  62869. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  62870. return self;
  62871. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o})});
  62872. },
  62873. args: [],
  62874. 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",
  62875. referencedClasses: ["Object"],
  62876. pragmas: [],
  62877. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  62878. }),
  62879. $globals.ObjectTest);
  62880. $core.addMethod(
  62881. $core.method({
  62882. selector: "testIfNil",
  62883. protocol: "tests",
  62884. fn: function (){
  62885. var self=this,$self=this;
  62886. return $core.withContext(function($ctx1) {
  62887. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  62888. $2=$recv($globals.Object)._new();
  62889. $ctx1.sendIdx["new"]=1;
  62890. $1=$recv($2)._isNil();
  62891. $self._deny_($1);
  62892. $ctx1.sendIdx["deny:"]=1;
  62893. $5=$recv($globals.Object)._new();
  62894. $ctx1.sendIdx["new"]=2;
  62895. if(($receiver = $5) == null || $receiver.a$nil){
  62896. $4=true;
  62897. } else {
  62898. $4=$5;
  62899. }
  62900. $3=$recv($4).__eq(true);
  62901. $self._deny_($3);
  62902. $7=$recv($globals.Object)._new();
  62903. $ctx1.sendIdx["new"]=3;
  62904. if(($receiver = $7) == null || $receiver.a$nil){
  62905. $6=$7;
  62906. } else {
  62907. $6=true;
  62908. }
  62909. $self._assert_equals_($6,true);
  62910. $ctx1.sendIdx["assert:equals:"]=1;
  62911. $9=$recv($globals.Object)._new();
  62912. $ctx1.sendIdx["new"]=4;
  62913. if(($receiver = $9) == null || $receiver.a$nil){
  62914. $8=false;
  62915. } else {
  62916. $8=true;
  62917. }
  62918. $self._assert_equals_($8,true);
  62919. $ctx1.sendIdx["assert:equals:"]=2;
  62920. $11=$recv($globals.Object)._new();
  62921. if(($receiver = $11) == null || $receiver.a$nil){
  62922. $10=false;
  62923. } else {
  62924. $10=true;
  62925. }
  62926. $self._assert_equals_($10,true);
  62927. return self;
  62928. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  62929. },
  62930. args: [],
  62931. 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",
  62932. referencedClasses: ["Object"],
  62933. pragmas: [],
  62934. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  62935. }),
  62936. $globals.ObjectTest);
  62937. $core.addMethod(
  62938. $core.method({
  62939. selector: "testInstVars",
  62940. protocol: "tests",
  62941. fn: function (){
  62942. var self=this,$self=this;
  62943. var o;
  62944. return $core.withContext(function($ctx1) {
  62945. var $1,$2;
  62946. o=$recv($globals.ObjectMock)._new();
  62947. $1=$recv(o)._instVarAt_("foo");
  62948. $ctx1.sendIdx["instVarAt:"]=1;
  62949. $self._assert_equals_($1,nil);
  62950. $ctx1.sendIdx["assert:equals:"]=1;
  62951. $recv(o)._instVarAt_put_("foo",(1));
  62952. $2=$recv(o)._instVarAt_("foo");
  62953. $ctx1.sendIdx["instVarAt:"]=2;
  62954. $self._assert_equals_($2,(1));
  62955. $ctx1.sendIdx["assert:equals:"]=2;
  62956. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  62957. return self;
  62958. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o})});
  62959. },
  62960. args: [],
  62961. 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",
  62962. referencedClasses: ["ObjectMock"],
  62963. pragmas: [],
  62964. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  62965. }),
  62966. $globals.ObjectTest);
  62967. $core.addMethod(
  62968. $core.method({
  62969. selector: "testNilUndefined",
  62970. protocol: "tests",
  62971. fn: function (){
  62972. var self=this,$self=this;
  62973. return $core.withContext(function($ctx1) {
  62974. $self._assert_equals_($self._notDefined(),nil);
  62975. return self;
  62976. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{})});
  62977. },
  62978. args: [],
  62979. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  62980. referencedClasses: [],
  62981. pragmas: [],
  62982. messageSends: ["assert:equals:", "notDefined"]
  62983. }),
  62984. $globals.ObjectTest);
  62985. $core.addMethod(
  62986. $core.method({
  62987. selector: "testYourself",
  62988. protocol: "tests",
  62989. fn: function (){
  62990. var self=this,$self=this;
  62991. var o;
  62992. return $core.withContext(function($ctx1) {
  62993. o=$recv($globals.ObjectMock)._new();
  62994. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  62995. return self;
  62996. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o})});
  62997. },
  62998. args: [],
  62999. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  63000. referencedClasses: ["ObjectMock"],
  63001. pragmas: [],
  63002. messageSends: ["new", "assert:", "==", "yourself"]
  63003. }),
  63004. $globals.ObjectTest);
  63005. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  63006. $core.addMethod(
  63007. $core.method({
  63008. selector: "testAccessing",
  63009. protocol: "tests",
  63010. fn: function (){
  63011. var self=this,$self=this;
  63012. return $core.withContext(function($ctx1) {
  63013. var $2,$1,$3,$6,$5,$4;
  63014. $2=$recv($globals.Point)._x_y_((3),(4));
  63015. $ctx1.sendIdx["x:y:"]=1;
  63016. $1=$recv($2)._x();
  63017. $ctx1.sendIdx["x"]=1;
  63018. $self._assert_equals_($1,(3));
  63019. $ctx1.sendIdx["assert:equals:"]=1;
  63020. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  63021. $ctx1.sendIdx["y"]=1;
  63022. $self._assert_equals_($3,(4));
  63023. $ctx1.sendIdx["assert:equals:"]=2;
  63024. $6=$recv($globals.Point)._new();
  63025. $ctx1.sendIdx["new"]=1;
  63026. $5=$recv($6)._x_((3));
  63027. $4=$recv($5)._x();
  63028. $self._assert_equals_($4,(3));
  63029. $ctx1.sendIdx["assert:equals:"]=3;
  63030. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  63031. return self;
  63032. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{})});
  63033. },
  63034. args: [],
  63035. 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",
  63036. referencedClasses: ["Point"],
  63037. pragmas: [],
  63038. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  63039. }),
  63040. $globals.PointTest);
  63041. $core.addMethod(
  63042. $core.method({
  63043. selector: "testAngle",
  63044. protocol: "tests",
  63045. fn: function (){
  63046. var self=this,$self=this;
  63047. return $core.withContext(function($ctx1) {
  63048. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  63049. return self;
  63050. }, function($ctx1) {$ctx1.fill(self,"testAngle",{})});
  63051. },
  63052. args: [],
  63053. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  63054. referencedClasses: ["Number"],
  63055. pragmas: [],
  63056. messageSends: ["assert:equals:", "angle", "@", "pi"]
  63057. }),
  63058. $globals.PointTest);
  63059. $core.addMethod(
  63060. $core.method({
  63061. selector: "testArithmetic",
  63062. protocol: "tests",
  63063. fn: function (){
  63064. var self=this,$self=this;
  63065. return $core.withContext(function($ctx1) {
  63066. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  63067. $2=(3).__at((4));
  63068. $ctx1.sendIdx["@"]=1;
  63069. $3=(3).__at((4));
  63070. $ctx1.sendIdx["@"]=2;
  63071. $1=$recv($2).__star($3);
  63072. $4=$recv($globals.Point)._x_y_((9),(16));
  63073. $ctx1.sendIdx["x:y:"]=1;
  63074. $self._assert_equals_($1,$4);
  63075. $ctx1.sendIdx["assert:equals:"]=1;
  63076. $6=(3).__at((4));
  63077. $ctx1.sendIdx["@"]=3;
  63078. $7=(3).__at((4));
  63079. $ctx1.sendIdx["@"]=4;
  63080. $5=$recv($6).__plus($7);
  63081. $8=$recv($globals.Point)._x_y_((6),(8));
  63082. $ctx1.sendIdx["x:y:"]=2;
  63083. $self._assert_equals_($5,$8);
  63084. $ctx1.sendIdx["assert:equals:"]=2;
  63085. $10=(3).__at((4));
  63086. $ctx1.sendIdx["@"]=5;
  63087. $11=(3).__at((4));
  63088. $ctx1.sendIdx["@"]=6;
  63089. $9=$recv($10).__minus($11);
  63090. $12=$recv($globals.Point)._x_y_((0),(0));
  63091. $ctx1.sendIdx["x:y:"]=3;
  63092. $self._assert_equals_($9,$12);
  63093. $ctx1.sendIdx["assert:equals:"]=3;
  63094. $14=(6).__at((8));
  63095. $ctx1.sendIdx["@"]=7;
  63096. $13=$recv($14).__slash((3).__at((4)));
  63097. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  63098. return self;
  63099. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  63100. },
  63101. args: [],
  63102. 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)",
  63103. referencedClasses: ["Point"],
  63104. pragmas: [],
  63105. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  63106. }),
  63107. $globals.PointTest);
  63108. $core.addMethod(
  63109. $core.method({
  63110. selector: "testAt",
  63111. protocol: "tests",
  63112. fn: function (){
  63113. var self=this,$self=this;
  63114. return $core.withContext(function($ctx1) {
  63115. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  63116. return self;
  63117. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  63118. },
  63119. args: [],
  63120. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  63121. referencedClasses: ["Point"],
  63122. pragmas: [],
  63123. messageSends: ["assert:equals:", "@", "x:y:"]
  63124. }),
  63125. $globals.PointTest);
  63126. $core.addMethod(
  63127. $core.method({
  63128. selector: "testComparison",
  63129. protocol: "tests",
  63130. fn: function (){
  63131. var self=this,$self=this;
  63132. return $core.withContext(function($ctx1) {
  63133. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  63134. $2=(3).__at((4));
  63135. $ctx1.sendIdx["@"]=1;
  63136. $3=(4).__at((5));
  63137. $ctx1.sendIdx["@"]=2;
  63138. $1=$recv($2).__lt($3);
  63139. $ctx1.sendIdx["<"]=1;
  63140. $self._assert_($1);
  63141. $ctx1.sendIdx["assert:"]=1;
  63142. $5=(3).__at((4));
  63143. $ctx1.sendIdx["@"]=3;
  63144. $6=(4).__at((4));
  63145. $ctx1.sendIdx["@"]=4;
  63146. $4=$recv($5).__lt($6);
  63147. $self._deny_($4);
  63148. $ctx1.sendIdx["deny:"]=1;
  63149. $8=(4).__at((5));
  63150. $ctx1.sendIdx["@"]=5;
  63151. $9=(4).__at((5));
  63152. $ctx1.sendIdx["@"]=6;
  63153. $7=$recv($8).__lt_eq($9);
  63154. $ctx1.sendIdx["<="]=1;
  63155. $self._assert_($7);
  63156. $ctx1.sendIdx["assert:"]=2;
  63157. $11=(4).__at((5));
  63158. $ctx1.sendIdx["@"]=7;
  63159. $12=(3).__at((5));
  63160. $ctx1.sendIdx["@"]=8;
  63161. $10=$recv($11).__lt_eq($12);
  63162. $self._deny_($10);
  63163. $ctx1.sendIdx["deny:"]=2;
  63164. $14=(5).__at((6));
  63165. $ctx1.sendIdx["@"]=9;
  63166. $15=(4).__at((5));
  63167. $ctx1.sendIdx["@"]=10;
  63168. $13=$recv($14).__gt($15);
  63169. $ctx1.sendIdx[">"]=1;
  63170. $self._assert_($13);
  63171. $ctx1.sendIdx["assert:"]=3;
  63172. $17=(5).__at((6));
  63173. $ctx1.sendIdx["@"]=11;
  63174. $18=(6).__at((6));
  63175. $ctx1.sendIdx["@"]=12;
  63176. $16=$recv($17).__gt($18);
  63177. $self._deny_($16);
  63178. $ctx1.sendIdx["deny:"]=3;
  63179. $20=(4).__at((5));
  63180. $ctx1.sendIdx["@"]=13;
  63181. $21=(4).__at((5));
  63182. $ctx1.sendIdx["@"]=14;
  63183. $19=$recv($20).__gt_eq($21);
  63184. $ctx1.sendIdx[">="]=1;
  63185. $self._assert_($19);
  63186. $23=(4).__at((5));
  63187. $ctx1.sendIdx["@"]=15;
  63188. $22=$recv($23).__gt_eq((5).__at((5)));
  63189. $self._deny_($22);
  63190. return self;
  63191. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  63192. },
  63193. args: [],
  63194. 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)",
  63195. referencedClasses: [],
  63196. pragmas: [],
  63197. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  63198. }),
  63199. $globals.PointTest);
  63200. $core.addMethod(
  63201. $core.method({
  63202. selector: "testDotProduct",
  63203. protocol: "tests",
  63204. fn: function (){
  63205. var self=this,$self=this;
  63206. return $core.withContext(function($ctx1) {
  63207. var $2,$1;
  63208. $2=(2).__at((3));
  63209. $ctx1.sendIdx["@"]=1;
  63210. $1=$recv($2)._dotProduct_((3).__at((7)));
  63211. $self._assert_equals_($1,(27));
  63212. return self;
  63213. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{})});
  63214. },
  63215. args: [],
  63216. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  63217. referencedClasses: [],
  63218. pragmas: [],
  63219. messageSends: ["assert:equals:", "dotProduct:", "@"]
  63220. }),
  63221. $globals.PointTest);
  63222. $core.addMethod(
  63223. $core.method({
  63224. selector: "testEgality",
  63225. protocol: "tests",
  63226. fn: function (){
  63227. var self=this,$self=this;
  63228. return $core.withContext(function($ctx1) {
  63229. var $2,$3,$1,$5,$4;
  63230. $2=(3).__at((4));
  63231. $ctx1.sendIdx["@"]=1;
  63232. $3=(3).__at((4));
  63233. $ctx1.sendIdx["@"]=2;
  63234. $1=$recv($2).__eq($3);
  63235. $ctx1.sendIdx["="]=1;
  63236. $self._assert_($1);
  63237. $5=(3).__at((5));
  63238. $ctx1.sendIdx["@"]=3;
  63239. $4=$recv($5).__eq((3).__at((6)));
  63240. $self._deny_($4);
  63241. return self;
  63242. }, function($ctx1) {$ctx1.fill(self,"testEgality",{})});
  63243. },
  63244. args: [],
  63245. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  63246. referencedClasses: [],
  63247. pragmas: [],
  63248. messageSends: ["assert:", "=", "@", "deny:"]
  63249. }),
  63250. $globals.PointTest);
  63251. $core.addMethod(
  63252. $core.method({
  63253. selector: "testNew",
  63254. protocol: "tests",
  63255. fn: function (){
  63256. var self=this,$self=this;
  63257. return $core.withContext(function($ctx1) {
  63258. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  63259. $3=$recv($globals.Point)._new();
  63260. $ctx1.sendIdx["new"]=1;
  63261. $2=$recv($3)._x_((3));
  63262. $ctx1.sendIdx["x:"]=1;
  63263. $1=$recv($2)._y();
  63264. $ctx1.sendIdx["y"]=1;
  63265. $self._assert_equals_($1,nil);
  63266. $ctx1.sendIdx["assert:equals:"]=1;
  63267. $7=$recv($globals.Point)._new();
  63268. $ctx1.sendIdx["new"]=2;
  63269. $6=$recv($7)._x_((3));
  63270. $5=$recv($6)._x();
  63271. $ctx1.sendIdx["x"]=1;
  63272. $4=$recv($5).__eq((0));
  63273. $ctx1.sendIdx["="]=1;
  63274. $self._deny_($4);
  63275. $ctx1.sendIdx["deny:"]=1;
  63276. $10=$recv($globals.Point)._new();
  63277. $ctx1.sendIdx["new"]=3;
  63278. $9=$recv($10)._y_((4));
  63279. $ctx1.sendIdx["y:"]=1;
  63280. $8=$recv($9)._x();
  63281. $self._assert_equals_($8,nil);
  63282. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  63283. return self;
  63284. }, function($ctx1) {$ctx1.fill(self,"testNew",{})});
  63285. },
  63286. args: [],
  63287. 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",
  63288. referencedClasses: ["Point"],
  63289. pragmas: [],
  63290. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  63291. }),
  63292. $globals.PointTest);
  63293. $core.addMethod(
  63294. $core.method({
  63295. selector: "testNormal",
  63296. protocol: "tests",
  63297. fn: function (){
  63298. var self=this,$self=this;
  63299. return $core.withContext(function($ctx1) {
  63300. var $2,$1;
  63301. $2=(1).__at((0));
  63302. $ctx1.sendIdx["@"]=1;
  63303. $1=$recv($2)._normal();
  63304. $self._assert_equals_($1,(0).__at((1)));
  63305. return self;
  63306. }, function($ctx1) {$ctx1.fill(self,"testNormal",{})});
  63307. },
  63308. args: [],
  63309. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  63310. referencedClasses: [],
  63311. pragmas: [],
  63312. messageSends: ["assert:equals:", "normal", "@"]
  63313. }),
  63314. $globals.PointTest);
  63315. $core.addMethod(
  63316. $core.method({
  63317. selector: "testNormalized",
  63318. protocol: "tests",
  63319. fn: function (){
  63320. var self=this,$self=this;
  63321. return $core.withContext(function($ctx1) {
  63322. var $2,$1,$3,$5,$4;
  63323. $2=(0).__at((2));
  63324. $ctx1.sendIdx["@"]=1;
  63325. $1=$recv($2)._normalized();
  63326. $ctx1.sendIdx["normalized"]=1;
  63327. $3=(0).__at((1));
  63328. $ctx1.sendIdx["@"]=2;
  63329. $self._assert_equals_($1,$3);
  63330. $ctx1.sendIdx["assert:equals:"]=1;
  63331. $5=(0).__at((0));
  63332. $ctx1.sendIdx["@"]=3;
  63333. $4=$recv($5)._normalized();
  63334. $self._assert_equals_($4,(0).__at((0)));
  63335. return self;
  63336. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{})});
  63337. },
  63338. args: [],
  63339. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  63340. referencedClasses: [],
  63341. pragmas: [],
  63342. messageSends: ["assert:equals:", "normalized", "@"]
  63343. }),
  63344. $globals.PointTest);
  63345. $core.addMethod(
  63346. $core.method({
  63347. selector: "testPolarCoordinates",
  63348. protocol: "tests",
  63349. fn: function (){
  63350. var self=this,$self=this;
  63351. return $core.withContext(function($ctx1) {
  63352. var $2,$1;
  63353. $2=(1).__at((0));
  63354. $ctx1.sendIdx["@"]=1;
  63355. $1=$recv($2)._r();
  63356. $ctx1.sendIdx["r"]=1;
  63357. $self._assert_equals_($1,(1));
  63358. $ctx1.sendIdx["assert:equals:"]=1;
  63359. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  63360. return self;
  63361. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{})});
  63362. },
  63363. args: [],
  63364. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  63365. referencedClasses: [],
  63366. pragmas: [],
  63367. messageSends: ["assert:equals:", "r", "@"]
  63368. }),
  63369. $globals.PointTest);
  63370. $core.addMethod(
  63371. $core.method({
  63372. selector: "testRectangleCreation",
  63373. protocol: "tests",
  63374. fn: function (){
  63375. var self=this,$self=this;
  63376. return $core.withContext(function($ctx1) {
  63377. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  63378. $2=(1).__at((1));
  63379. $ctx1.sendIdx["@"]=1;
  63380. $3=(2).__at((2));
  63381. $ctx1.sendIdx["@"]=2;
  63382. $1=$recv($2)._corner_($3);
  63383. $5=(1).__at((1));
  63384. $ctx1.sendIdx["@"]=3;
  63385. $6=(2).__at((2));
  63386. $ctx1.sendIdx["@"]=4;
  63387. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  63388. $self._assert_equals_($1,$4);
  63389. $ctx1.sendIdx["assert:equals:"]=1;
  63390. $8=(1).__at((1));
  63391. $ctx1.sendIdx["@"]=5;
  63392. $9=(2).__at((2));
  63393. $ctx1.sendIdx["@"]=6;
  63394. $7=$recv($8)._rectangle_($9);
  63395. $11=(1).__at((1));
  63396. $ctx1.sendIdx["@"]=7;
  63397. $12=(2).__at((2));
  63398. $ctx1.sendIdx["@"]=8;
  63399. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  63400. $self._assert_equals_($7,$10);
  63401. $ctx1.sendIdx["assert:equals:"]=2;
  63402. $14=(1).__at((1));
  63403. $ctx1.sendIdx["@"]=9;
  63404. $15=(2).__at((2));
  63405. $ctx1.sendIdx["@"]=10;
  63406. $13=$recv($14)._extent_($15);
  63407. $17=(1).__at((1));
  63408. $ctx1.sendIdx["@"]=11;
  63409. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  63410. $self._assert_equals_($13,$16);
  63411. return self;
  63412. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{})});
  63413. },
  63414. args: [],
  63415. 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)",
  63416. referencedClasses: ["Rectangle"],
  63417. pragmas: [],
  63418. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  63419. }),
  63420. $globals.PointTest);
  63421. $core.addMethod(
  63422. $core.method({
  63423. selector: "testTranslateBy",
  63424. protocol: "tests",
  63425. fn: function (){
  63426. var self=this,$self=this;
  63427. return $core.withContext(function($ctx1) {
  63428. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  63429. $2=(3).__at((3));
  63430. $ctx1.sendIdx["@"]=1;
  63431. $3=(0).__at((1));
  63432. $ctx1.sendIdx["@"]=2;
  63433. $1=$recv($2)._translateBy_($3);
  63434. $ctx1.sendIdx["translateBy:"]=1;
  63435. $4=(3).__at((4));
  63436. $ctx1.sendIdx["@"]=3;
  63437. $self._assert_equals_($1,$4);
  63438. $ctx1.sendIdx["assert:equals:"]=1;
  63439. $6=(3).__at((3));
  63440. $ctx1.sendIdx["@"]=4;
  63441. $8=(1)._negated();
  63442. $ctx1.sendIdx["negated"]=1;
  63443. $7=(0).__at($8);
  63444. $ctx1.sendIdx["@"]=5;
  63445. $5=$recv($6)._translateBy_($7);
  63446. $ctx1.sendIdx["translateBy:"]=2;
  63447. $9=(3).__at((2));
  63448. $ctx1.sendIdx["@"]=6;
  63449. $self._assert_equals_($5,$9);
  63450. $ctx1.sendIdx["assert:equals:"]=2;
  63451. $11=(3).__at((3));
  63452. $ctx1.sendIdx["@"]=7;
  63453. $12=(2).__at((3));
  63454. $ctx1.sendIdx["@"]=8;
  63455. $10=$recv($11)._translateBy_($12);
  63456. $ctx1.sendIdx["translateBy:"]=3;
  63457. $13=(5).__at((6));
  63458. $ctx1.sendIdx["@"]=9;
  63459. $self._assert_equals_($10,$13);
  63460. $ctx1.sendIdx["assert:equals:"]=3;
  63461. $15=(3).__at((3));
  63462. $ctx1.sendIdx["@"]=10;
  63463. $16=$recv((3)._negated()).__at((0));
  63464. $ctx1.sendIdx["@"]=11;
  63465. $14=$recv($15)._translateBy_($16);
  63466. $self._assert_equals_($14,(0).__at((3)));
  63467. return self;
  63468. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{})});
  63469. },
  63470. args: [],
  63471. 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.",
  63472. referencedClasses: [],
  63473. pragmas: [],
  63474. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  63475. }),
  63476. $globals.PointTest);
  63477. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  63478. $core.addMethod(
  63479. $core.method({
  63480. selector: "testNextIfAbsent",
  63481. protocol: "tests",
  63482. fn: function (){
  63483. var self=this,$self=this;
  63484. var queue;
  63485. return $core.withContext(function($ctx1) {
  63486. var $2,$1;
  63487. queue=$recv($globals.Queue)._new();
  63488. $recv(queue)._nextPut_("index1");
  63489. $2=$recv(queue)._nextIfAbsent_("empty");
  63490. $ctx1.sendIdx["nextIfAbsent:"]=1;
  63491. $1=$recv($2).__eq("index1");
  63492. $ctx1.sendIdx["="]=1;
  63493. $self._assert_($1);
  63494. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  63495. return self;
  63496. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue})});
  63497. },
  63498. args: [],
  63499. 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'",
  63500. referencedClasses: ["Queue"],
  63501. pragmas: [],
  63502. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  63503. }),
  63504. $globals.QueueTest);
  63505. $core.addMethod(
  63506. $core.method({
  63507. selector: "testQueueNext",
  63508. protocol: "tests",
  63509. fn: function (){
  63510. var self=this,$self=this;
  63511. var queue;
  63512. return $core.withContext(function($ctx1) {
  63513. var $1,$3,$2,$5,$4;
  63514. queue=$recv($globals.Queue)._new();
  63515. $1=queue;
  63516. $recv($1)._nextPut_("index1");
  63517. $ctx1.sendIdx["nextPut:"]=1;
  63518. $recv($1)._nextPut_("index2");
  63519. $3=$recv(queue)._next();
  63520. $ctx1.sendIdx["next"]=1;
  63521. $2=$recv($3).__eq("index1");
  63522. $ctx1.sendIdx["="]=1;
  63523. $self._assert_($2);
  63524. $5=$recv(queue)._next();
  63525. $ctx1.sendIdx["next"]=2;
  63526. $4=$recv($5).__eq("index");
  63527. $self._deny_($4);
  63528. $self._should_raise_((function(){
  63529. return $core.withContext(function($ctx2) {
  63530. return $recv(queue)._next();
  63531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63532. }),$globals.Error);
  63533. return self;
  63534. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue})});
  63535. },
  63536. args: [],
  63537. 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",
  63538. referencedClasses: ["Queue", "Error"],
  63539. pragmas: [],
  63540. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  63541. }),
  63542. $globals.QueueTest);
  63543. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  63544. $core.addMethod(
  63545. $core.method({
  63546. selector: "testAtRandomNumber",
  63547. protocol: "tests",
  63548. fn: function (){
  63549. var self=this,$self=this;
  63550. var val;
  63551. return $core.withContext(function($ctx1) {
  63552. (100)._timesRepeat_((function(){
  63553. return $core.withContext(function($ctx2) {
  63554. val=(10)._atRandom();
  63555. $self._assert_($recv(val).__gt((0)));
  63556. $ctx2.sendIdx["assert:"]=1;
  63557. return $self._assert_($recv(val).__lt((11)));
  63558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63559. }));
  63560. return self;
  63561. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val})});
  63562. },
  63563. args: [],
  63564. 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]",
  63565. referencedClasses: [],
  63566. pragmas: [],
  63567. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  63568. }),
  63569. $globals.RandomTest);
  63570. $core.addMethod(
  63571. $core.method({
  63572. selector: "testAtRandomSequenceableCollection",
  63573. protocol: "tests",
  63574. fn: function (){
  63575. var self=this,$self=this;
  63576. var val;
  63577. return $core.withContext(function($ctx1) {
  63578. var $3,$4,$2,$1;
  63579. (100)._timesRepeat_((function(){
  63580. return $core.withContext(function($ctx2) {
  63581. val="abc"._atRandom();
  63582. $3=$recv(val).__eq("a");
  63583. $ctx2.sendIdx["="]=1;
  63584. $4=$recv(val).__eq("b");
  63585. $ctx2.sendIdx["="]=2;
  63586. $2=$recv($3).__or($4);
  63587. $1=$recv($2).__or($recv(val).__eq("c"));
  63588. $ctx2.sendIdx["|"]=1;
  63589. return $self._assert_($1);
  63590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63591. }));
  63592. return self;
  63593. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val})});
  63594. },
  63595. args: [],
  63596. 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].",
  63597. referencedClasses: [],
  63598. pragmas: [],
  63599. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  63600. }),
  63601. $globals.RandomTest);
  63602. $core.addMethod(
  63603. $core.method({
  63604. selector: "textNext",
  63605. protocol: "tests",
  63606. fn: function (){
  63607. var self=this,$self=this;
  63608. return $core.withContext(function($ctx1) {
  63609. var $1;
  63610. (10000)._timesRepeat_((function(){
  63611. var current,next;
  63612. return $core.withContext(function($ctx2) {
  63613. next=$recv($recv($globals.Random)._new())._next();
  63614. $self._assert_($recv(next).__gt_eq((0)));
  63615. $ctx2.sendIdx["assert:"]=1;
  63616. $self._assert_($recv(next).__lt((1)));
  63617. $1=$recv(current).__eq(next);
  63618. $ctx2.sendIdx["="]=1;
  63619. $self._deny_($1);
  63620. return $recv(next).__eq(current);
  63621. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  63622. }));
  63623. return self;
  63624. }, function($ctx1) {$ctx1.fill(self,"textNext",{})});
  63625. },
  63626. args: [],
  63627. 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 ]",
  63628. referencedClasses: ["Random"],
  63629. pragmas: [],
  63630. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  63631. }),
  63632. $globals.RandomTest);
  63633. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  63634. $core.addMethod(
  63635. $core.method({
  63636. selector: "testContainsPoint",
  63637. protocol: "tests",
  63638. fn: function (){
  63639. var self=this,$self=this;
  63640. var rect;
  63641. return $core.withContext(function($ctx1) {
  63642. var $1,$2,$4,$5,$3;
  63643. $1=(0).__at((0));
  63644. $ctx1.sendIdx["@"]=1;
  63645. $2=(4).__at((4));
  63646. $ctx1.sendIdx["@"]=2;
  63647. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  63648. $4=rect;
  63649. $5=(1).__at((2));
  63650. $ctx1.sendIdx["@"]=3;
  63651. $3=$recv($4)._containsPoint_($5);
  63652. $ctx1.sendIdx["containsPoint:"]=1;
  63653. $self._assert_($3);
  63654. $ctx1.sendIdx["assert:"]=1;
  63655. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  63656. return self;
  63657. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect})});
  63658. },
  63659. args: [],
  63660. 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.",
  63661. referencedClasses: ["Rectangle"],
  63662. pragmas: [],
  63663. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  63664. }),
  63665. $globals.RectangleTest);
  63666. $core.addMethod(
  63667. $core.method({
  63668. selector: "testContainsRect",
  63669. protocol: "tests",
  63670. fn: function (){
  63671. var self=this,$self=this;
  63672. return $core.withContext(function($ctx1) {
  63673. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  63674. $3=(0).__at((0));
  63675. $ctx1.sendIdx["@"]=1;
  63676. $4=(6).__at((6));
  63677. $ctx1.sendIdx["@"]=2;
  63678. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  63679. $ctx1.sendIdx["origin:corner:"]=1;
  63680. $6=(1).__at((1));
  63681. $ctx1.sendIdx["@"]=3;
  63682. $7=(5).__at((5));
  63683. $ctx1.sendIdx["@"]=4;
  63684. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  63685. $ctx1.sendIdx["origin:corner:"]=2;
  63686. $1=$recv($2)._containsRect_($5);
  63687. $ctx1.sendIdx["containsRect:"]=1;
  63688. $self._assert_($1);
  63689. $ctx1.sendIdx["assert:"]=1;
  63690. $11=(0).__at((0));
  63691. $ctx1.sendIdx["@"]=5;
  63692. $12=(6).__at((6));
  63693. $ctx1.sendIdx["@"]=6;
  63694. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  63695. $ctx1.sendIdx["origin:corner:"]=3;
  63696. $14=(1).__at((-1));
  63697. $ctx1.sendIdx["@"]=7;
  63698. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  63699. $9=$recv($10)._containsRect_($13);
  63700. $8=$recv($9)._not();
  63701. $self._assert_($8);
  63702. return self;
  63703. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{})});
  63704. },
  63705. args: [],
  63706. 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.",
  63707. referencedClasses: ["Rectangle"],
  63708. pragmas: [],
  63709. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  63710. }),
  63711. $globals.RectangleTest);
  63712. $core.addMethod(
  63713. $core.method({
  63714. selector: "testOriginExtent",
  63715. protocol: "tests",
  63716. fn: function (){
  63717. var self=this,$self=this;
  63718. var rectangle;
  63719. return $core.withContext(function($ctx1) {
  63720. var $1,$2,$3,$4;
  63721. $1=(3).__at((4));
  63722. $ctx1.sendIdx["@"]=1;
  63723. $2=(7).__at((8));
  63724. $ctx1.sendIdx["@"]=2;
  63725. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  63726. $3=$recv(rectangle)._origin();
  63727. $4=(3).__at((4));
  63728. $ctx1.sendIdx["@"]=3;
  63729. $self._assert_equals_($3,$4);
  63730. $ctx1.sendIdx["assert:equals:"]=1;
  63731. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  63732. return self;
  63733. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle})});
  63734. },
  63735. args: [],
  63736. 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.",
  63737. referencedClasses: ["Rectangle"],
  63738. pragmas: [],
  63739. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  63740. }),
  63741. $globals.RectangleTest);
  63742. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  63743. $core.addMethod(
  63744. $core.method({
  63745. selector: "collectionClass",
  63746. protocol: "accessing",
  63747. fn: function (){
  63748. var self=this,$self=this;
  63749. return $core.withContext(function($ctx1) {
  63750. return $recv($self._class())._collectionClass();
  63751. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  63752. },
  63753. args: [],
  63754. source: "collectionClass\x0a\x09^ self class collectionClass",
  63755. referencedClasses: [],
  63756. pragmas: [],
  63757. messageSends: ["collectionClass", "class"]
  63758. }),
  63759. $globals.StreamTest);
  63760. $core.addMethod(
  63761. $core.method({
  63762. selector: "newCollection",
  63763. protocol: "accessing",
  63764. fn: function (){
  63765. var self=this,$self=this;
  63766. return $core.withContext(function($ctx1) {
  63767. return $recv($self._collectionClass())._new();
  63768. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  63769. },
  63770. args: [],
  63771. source: "newCollection\x0a\x09^ self collectionClass new",
  63772. referencedClasses: [],
  63773. pragmas: [],
  63774. messageSends: ["new", "collectionClass"]
  63775. }),
  63776. $globals.StreamTest);
  63777. $core.addMethod(
  63778. $core.method({
  63779. selector: "newStream",
  63780. protocol: "accessing",
  63781. fn: function (){
  63782. var self=this,$self=this;
  63783. return $core.withContext(function($ctx1) {
  63784. return $recv($recv($self._collectionClass())._new())._stream();
  63785. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  63786. },
  63787. args: [],
  63788. source: "newStream\x0a\x09^ self collectionClass new stream",
  63789. referencedClasses: [],
  63790. pragmas: [],
  63791. messageSends: ["stream", "new", "collectionClass"]
  63792. }),
  63793. $globals.StreamTest);
  63794. $core.addMethod(
  63795. $core.method({
  63796. selector: "testAtStartAtEnd",
  63797. protocol: "tests",
  63798. fn: function (){
  63799. var self=this,$self=this;
  63800. var stream;
  63801. return $core.withContext(function($ctx1) {
  63802. var $1,$2,$3,$4;
  63803. stream=$self._newStream();
  63804. $1=$recv(stream)._atStart();
  63805. $ctx1.sendIdx["atStart"]=1;
  63806. $self._assert_($1);
  63807. $ctx1.sendIdx["assert:"]=1;
  63808. $2=$recv(stream)._atEnd();
  63809. $ctx1.sendIdx["atEnd"]=1;
  63810. $self._assert_($2);
  63811. $ctx1.sendIdx["assert:"]=2;
  63812. $recv(stream)._nextPutAll_($self._newCollection());
  63813. $3=$recv(stream)._atEnd();
  63814. $ctx1.sendIdx["atEnd"]=2;
  63815. $self._assert_($3);
  63816. $4=$recv(stream)._atStart();
  63817. $ctx1.sendIdx["atStart"]=2;
  63818. $self._deny_($4);
  63819. $ctx1.sendIdx["deny:"]=1;
  63820. $recv(stream)._position_((1));
  63821. $self._deny_($recv(stream)._atEnd());
  63822. $ctx1.sendIdx["deny:"]=2;
  63823. $self._deny_($recv(stream)._atStart());
  63824. return self;
  63825. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream})});
  63826. },
  63827. args: [],
  63828. 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",
  63829. referencedClasses: [],
  63830. pragmas: [],
  63831. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  63832. }),
  63833. $globals.StreamTest);
  63834. $core.addMethod(
  63835. $core.method({
  63836. selector: "testContents",
  63837. protocol: "tests",
  63838. fn: function (){
  63839. var self=this,$self=this;
  63840. var stream;
  63841. return $core.withContext(function($ctx1) {
  63842. var $1,$2;
  63843. stream=$self._newStream();
  63844. $1=stream;
  63845. $2=$self._newCollection();
  63846. $ctx1.sendIdx["newCollection"]=1;
  63847. $recv($1)._nextPutAll_($2);
  63848. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  63849. return self;
  63850. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream})});
  63851. },
  63852. args: [],
  63853. 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",
  63854. referencedClasses: [],
  63855. pragmas: [],
  63856. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  63857. }),
  63858. $globals.StreamTest);
  63859. $core.addMethod(
  63860. $core.method({
  63861. selector: "testIsEmpty",
  63862. protocol: "tests",
  63863. fn: function (){
  63864. var self=this,$self=this;
  63865. var stream;
  63866. return $core.withContext(function($ctx1) {
  63867. var $1;
  63868. stream=$self._newStream();
  63869. $1=$recv(stream)._isEmpty();
  63870. $ctx1.sendIdx["isEmpty"]=1;
  63871. $self._assert_($1);
  63872. $recv(stream)._nextPutAll_($self._newCollection());
  63873. $self._deny_($recv(stream)._isEmpty());
  63874. return self;
  63875. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream})});
  63876. },
  63877. args: [],
  63878. 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",
  63879. referencedClasses: [],
  63880. pragmas: [],
  63881. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  63882. }),
  63883. $globals.StreamTest);
  63884. $core.addMethod(
  63885. $core.method({
  63886. selector: "testPosition",
  63887. protocol: "tests",
  63888. fn: function (){
  63889. var self=this,$self=this;
  63890. var collection,stream;
  63891. return $core.withContext(function($ctx1) {
  63892. var $1,$2,$3;
  63893. collection=$self._newCollection();
  63894. stream=$self._newStream();
  63895. $recv(stream)._nextPutAll_(collection);
  63896. $1=$recv(stream)._position();
  63897. $ctx1.sendIdx["position"]=1;
  63898. $self._assert_equals_($1,$recv(collection)._size());
  63899. $ctx1.sendIdx["assert:equals:"]=1;
  63900. $recv(stream)._position_((0));
  63901. $2=$recv(stream)._position();
  63902. $ctx1.sendIdx["position"]=2;
  63903. $self._assert_equals_($2,(0));
  63904. $ctx1.sendIdx["assert:equals:"]=2;
  63905. $recv(stream)._next();
  63906. $ctx1.sendIdx["next"]=1;
  63907. $3=$recv(stream)._position();
  63908. $ctx1.sendIdx["position"]=3;
  63909. $self._assert_equals_($3,(1));
  63910. $ctx1.sendIdx["assert:equals:"]=3;
  63911. $recv(stream)._next();
  63912. $self._assert_equals_($recv(stream)._position(),(2));
  63913. return self;
  63914. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream})});
  63915. },
  63916. args: [],
  63917. 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",
  63918. referencedClasses: [],
  63919. pragmas: [],
  63920. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  63921. }),
  63922. $globals.StreamTest);
  63923. $core.addMethod(
  63924. $core.method({
  63925. selector: "testReading",
  63926. protocol: "tests",
  63927. fn: function (){
  63928. var self=this,$self=this;
  63929. var stream,collection;
  63930. return $core.withContext(function($ctx1) {
  63931. var $1,$2;
  63932. collection=$self._newCollection();
  63933. stream=$self._newStream();
  63934. $1=stream;
  63935. $recv($1)._nextPutAll_(collection);
  63936. $recv($1)._position_((0));
  63937. $recv(collection)._do_((function(each){
  63938. return $core.withContext(function($ctx2) {
  63939. $2=$recv(stream)._next();
  63940. $ctx2.sendIdx["next"]=1;
  63941. return $self._assert_equals_($2,each);
  63942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63943. }));
  63944. $self._assert_($recv($recv(stream)._next())._isNil());
  63945. return self;
  63946. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection})});
  63947. },
  63948. args: [],
  63949. 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",
  63950. referencedClasses: [],
  63951. pragmas: [],
  63952. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  63953. }),
  63954. $globals.StreamTest);
  63955. $core.addMethod(
  63956. $core.method({
  63957. selector: "testStreamContents",
  63958. protocol: "tests",
  63959. fn: function (){
  63960. var self=this,$self=this;
  63961. return self;
  63962. },
  63963. args: [],
  63964. source: "testStreamContents",
  63965. referencedClasses: [],
  63966. pragmas: [],
  63967. messageSends: []
  63968. }),
  63969. $globals.StreamTest);
  63970. $core.addMethod(
  63971. $core.method({
  63972. selector: "testWrite",
  63973. protocol: "tests",
  63974. fn: function (){
  63975. var self=this,$self=this;
  63976. var stream,collection;
  63977. return $core.withContext(function($ctx1) {
  63978. collection=$self._newCollection();
  63979. stream=$self._newStream();
  63980. $recv(collection)._do_((function(each){
  63981. return $core.withContext(function($ctx2) {
  63982. return $recv(stream).__lt_lt(each);
  63983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63984. }));
  63985. $self._assert_equals_($recv(stream)._contents(),collection);
  63986. return self;
  63987. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection})});
  63988. },
  63989. args: [],
  63990. 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",
  63991. referencedClasses: [],
  63992. pragmas: [],
  63993. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  63994. }),
  63995. $globals.StreamTest);
  63996. $core.addMethod(
  63997. $core.method({
  63998. selector: "testWriting",
  63999. protocol: "tests",
  64000. fn: function (){
  64001. var self=this,$self=this;
  64002. var stream,collection;
  64003. return $core.withContext(function($ctx1) {
  64004. var $1;
  64005. collection=$self._newCollection();
  64006. stream=$self._newStream();
  64007. $ctx1.sendIdx["newStream"]=1;
  64008. $recv(collection)._do_((function(each){
  64009. return $core.withContext(function($ctx2) {
  64010. return $recv(stream)._nextPut_(each);
  64011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64012. }));
  64013. $1=$recv(stream)._contents();
  64014. $ctx1.sendIdx["contents"]=1;
  64015. $self._assert_equals_($1,collection);
  64016. $ctx1.sendIdx["assert:equals:"]=1;
  64017. stream=$self._newStream();
  64018. $recv(stream)._nextPutAll_(collection);
  64019. $self._assert_equals_($recv(stream)._contents(),collection);
  64020. return self;
  64021. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection})});
  64022. },
  64023. args: [],
  64024. 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",
  64025. referencedClasses: [],
  64026. pragmas: [],
  64027. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  64028. }),
  64029. $globals.StreamTest);
  64030. $core.addMethod(
  64031. $core.method({
  64032. selector: "collectionClass",
  64033. protocol: "accessing",
  64034. fn: function (){
  64035. var self=this,$self=this;
  64036. return nil;
  64037. },
  64038. args: [],
  64039. source: "collectionClass\x0a\x09^ nil",
  64040. referencedClasses: [],
  64041. pragmas: [],
  64042. messageSends: []
  64043. }),
  64044. $globals.StreamTest.a$cls);
  64045. $core.addMethod(
  64046. $core.method({
  64047. selector: "isAbstract",
  64048. protocol: "testing",
  64049. fn: function (){
  64050. var self=this,$self=this;
  64051. return $core.withContext(function($ctx1) {
  64052. return $recv($self._collectionClass())._isNil();
  64053. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  64054. },
  64055. args: [],
  64056. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  64057. referencedClasses: [],
  64058. pragmas: [],
  64059. messageSends: ["isNil", "collectionClass"]
  64060. }),
  64061. $globals.StreamTest.a$cls);
  64062. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  64063. $core.addMethod(
  64064. $core.method({
  64065. selector: "newCollection",
  64066. protocol: "accessing",
  64067. fn: function (){
  64068. var self=this,$self=this;
  64069. return $core.withContext(function($ctx1) {
  64070. return [true,(1),(3).__at((4)),"foo"];
  64071. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  64072. },
  64073. args: [],
  64074. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  64075. referencedClasses: [],
  64076. pragmas: [],
  64077. messageSends: ["@"]
  64078. }),
  64079. $globals.ArrayStreamTest);
  64080. $core.addMethod(
  64081. $core.method({
  64082. selector: "collectionClass",
  64083. protocol: "accessing",
  64084. fn: function (){
  64085. var self=this,$self=this;
  64086. return $globals.Array;
  64087. },
  64088. args: [],
  64089. source: "collectionClass\x0a\x09^ Array",
  64090. referencedClasses: ["Array"],
  64091. pragmas: [],
  64092. messageSends: []
  64093. }),
  64094. $globals.ArrayStreamTest.a$cls);
  64095. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  64096. $core.addMethod(
  64097. $core.method({
  64098. selector: "newCollection",
  64099. protocol: "accessing",
  64100. fn: function (){
  64101. var self=this,$self=this;
  64102. return "hello world";
  64103. },
  64104. args: [],
  64105. source: "newCollection\x0a\x09^ 'hello world'",
  64106. referencedClasses: [],
  64107. pragmas: [],
  64108. messageSends: []
  64109. }),
  64110. $globals.StringStreamTest);
  64111. $core.addMethod(
  64112. $core.method({
  64113. selector: "collectionClass",
  64114. protocol: "accessing",
  64115. fn: function (){
  64116. var self=this,$self=this;
  64117. return $globals.String;
  64118. },
  64119. args: [],
  64120. source: "collectionClass\x0a\x09^ String",
  64121. referencedClasses: ["String"],
  64122. pragmas: [],
  64123. messageSends: []
  64124. }),
  64125. $globals.StringStreamTest.a$cls);
  64126. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  64127. $core.addMethod(
  64128. $core.method({
  64129. selector: "testCopying",
  64130. protocol: "tests",
  64131. fn: function (){
  64132. var self=this,$self=this;
  64133. return $core.withContext(function($ctx1) {
  64134. $self._assert_equals_(nil._copy(),nil);
  64135. return self;
  64136. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  64137. },
  64138. args: [],
  64139. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  64140. referencedClasses: [],
  64141. pragmas: [],
  64142. messageSends: ["assert:equals:", "copy"]
  64143. }),
  64144. $globals.UndefinedTest);
  64145. $core.addMethod(
  64146. $core.method({
  64147. selector: "testDeepCopy",
  64148. protocol: "tests",
  64149. fn: function (){
  64150. var self=this,$self=this;
  64151. return $core.withContext(function($ctx1) {
  64152. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  64153. return self;
  64154. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{})});
  64155. },
  64156. args: [],
  64157. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  64158. referencedClasses: [],
  64159. pragmas: [],
  64160. messageSends: ["assert:", "=", "deepCopy"]
  64161. }),
  64162. $globals.UndefinedTest);
  64163. $core.addMethod(
  64164. $core.method({
  64165. selector: "testIfNil",
  64166. protocol: "tests",
  64167. fn: function (){
  64168. var self=this,$self=this;
  64169. return $core.withContext(function($ctx1) {
  64170. var $1,$3,$2,$4,$6,$5,$receiver;
  64171. if(($receiver = nil) == null || $receiver.a$nil){
  64172. $1=true;
  64173. } else {
  64174. $1=nil;
  64175. }
  64176. $self._assert_equals_($1,true);
  64177. $ctx1.sendIdx["assert:equals:"]=1;
  64178. if(($receiver = nil) == null || $receiver.a$nil){
  64179. $3=nil;
  64180. } else {
  64181. $3=true;
  64182. }
  64183. $2=$recv($3).__eq(true);
  64184. $ctx1.sendIdx["="]=1;
  64185. $self._deny_($2);
  64186. $ctx1.sendIdx["deny:"]=1;
  64187. if(($receiver = nil) == null || $receiver.a$nil){
  64188. $4=true;
  64189. } else {
  64190. $4=false;
  64191. }
  64192. $self._assert_equals_($4,true);
  64193. if(($receiver = nil) == null || $receiver.a$nil){
  64194. $6=false;
  64195. } else {
  64196. $6=true;
  64197. }
  64198. $5=$recv($6).__eq(true);
  64199. $self._deny_($5);
  64200. return self;
  64201. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  64202. },
  64203. args: [],
  64204. 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",
  64205. referencedClasses: [],
  64206. pragmas: [],
  64207. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  64208. }),
  64209. $globals.UndefinedTest);
  64210. $core.addMethod(
  64211. $core.method({
  64212. selector: "testIsNil",
  64213. protocol: "tests",
  64214. fn: function (){
  64215. var self=this,$self=this;
  64216. return $core.withContext(function($ctx1) {
  64217. $self._assert_(nil._isNil());
  64218. $self._deny_(nil._notNil());
  64219. return self;
  64220. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{})});
  64221. },
  64222. args: [],
  64223. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  64224. referencedClasses: [],
  64225. pragmas: [],
  64226. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  64227. }),
  64228. $globals.UndefinedTest);
  64229. });
  64230. define('amber/core/Platform-DOM-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64231. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64232. var $pkg = $core.addPackage("Platform-DOM-Tests");
  64233. $pkg.innerEval = function (expr) { return eval(expr); };
  64234. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64235. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  64236. $core.addMethod(
  64237. $core.method({
  64238. selector: "testEntityConversion",
  64239. protocol: "testing",
  64240. fn: function (){
  64241. var self=this,$self=this;
  64242. return $core.withContext(function($ctx1) {
  64243. var $1;
  64244. $1=$recv($globals.PlatformDom)._isFeasible();
  64245. if($core.assert($1)){
  64246. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  64247. }
  64248. return self;
  64249. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{})});
  64250. },
  64251. args: [],
  64252. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  64253. referencedClasses: ["PlatformDom"],
  64254. pragmas: [],
  64255. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  64256. }),
  64257. $globals.PlatformDomTest);
  64258. $core.addMethod(
  64259. $core.method({
  64260. selector: "testTextContentDoesNotRunScript",
  64261. protocol: "testing",
  64262. fn: function (){
  64263. var self=this,$self=this;
  64264. return $core.withContext(function($ctx1) {
  64265. var $1;
  64266. $1=$recv($globals.PlatformDom)._isFeasible();
  64267. if($core.assert($1)){
  64268. $self._shouldnt_raise_((function(){
  64269. return $core.withContext(function($ctx2) {
  64270. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  64271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64272. }),$globals.Error);
  64273. }
  64274. return self;
  64275. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{})});
  64276. },
  64277. args: [],
  64278. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  64279. referencedClasses: ["PlatformDom", "Error"],
  64280. pragmas: [],
  64281. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  64282. }),
  64283. $globals.PlatformDomTest);
  64284. });
  64285. define('amber/core/SUnit-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64286. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64287. var $pkg = $core.addPackage("SUnit-Tests");
  64288. $pkg.innerEval = function (expr) { return eval(expr); };
  64289. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64290. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  64291. $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.";
  64292. $core.addMethod(
  64293. $core.method({
  64294. selector: "setUp",
  64295. protocol: "running",
  64296. fn: function (){
  64297. var self=this,$self=this;
  64298. return $core.withContext(function($ctx1) {
  64299. $self.empty=$recv($globals.Set)._new();
  64300. $self.full=$recv($globals.Set)._with_with_((5),"abc");
  64301. return self;
  64302. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  64303. },
  64304. args: [],
  64305. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  64306. referencedClasses: ["Set"],
  64307. pragmas: [],
  64308. messageSends: ["new", "with:with:"]
  64309. }),
  64310. $globals.ExampleSetTest);
  64311. $core.addMethod(
  64312. $core.method({
  64313. selector: "testAdd",
  64314. protocol: "tests",
  64315. fn: function (){
  64316. var self=this,$self=this;
  64317. return $core.withContext(function($ctx1) {
  64318. $recv($self.empty)._add_((5));
  64319. $self._assert_($recv($self.empty)._includes_((5)));
  64320. return self;
  64321. }, function($ctx1) {$ctx1.fill(self,"testAdd",{})});
  64322. },
  64323. args: [],
  64324. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  64325. referencedClasses: [],
  64326. pragmas: [],
  64327. messageSends: ["add:", "assert:", "includes:"]
  64328. }),
  64329. $globals.ExampleSetTest);
  64330. $core.addMethod(
  64331. $core.method({
  64332. selector: "testGrow",
  64333. protocol: "tests",
  64334. fn: function (){
  64335. var self=this,$self=this;
  64336. return $core.withContext(function($ctx1) {
  64337. $recv($self.empty)._addAll_((1)._to_((100)));
  64338. $self._assert_equals_($recv($self.empty)._size(),(100));
  64339. return self;
  64340. }, function($ctx1) {$ctx1.fill(self,"testGrow",{})});
  64341. },
  64342. args: [],
  64343. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  64344. referencedClasses: [],
  64345. pragmas: [],
  64346. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  64347. }),
  64348. $globals.ExampleSetTest);
  64349. $core.addMethod(
  64350. $core.method({
  64351. selector: "testIllegal",
  64352. protocol: "tests",
  64353. fn: function (){
  64354. var self=this,$self=this;
  64355. return $core.withContext(function($ctx1) {
  64356. $self._should_raise_((function(){
  64357. return $core.withContext(function($ctx2) {
  64358. return $recv($self.empty)._at_((5));
  64359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64360. }),$globals.Error);
  64361. $ctx1.sendIdx["should:raise:"]=1;
  64362. $self._should_raise_((function(){
  64363. return $core.withContext(function($ctx2) {
  64364. return $recv($self.empty)._at_put_((5),"abc");
  64365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64366. }),$globals.Error);
  64367. return self;
  64368. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{})});
  64369. },
  64370. args: [],
  64371. 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",
  64372. referencedClasses: ["Error"],
  64373. pragmas: [],
  64374. messageSends: ["should:raise:", "at:", "at:put:"]
  64375. }),
  64376. $globals.ExampleSetTest);
  64377. $core.addMethod(
  64378. $core.method({
  64379. selector: "testIncludes",
  64380. protocol: "tests",
  64381. fn: function (){
  64382. var self=this,$self=this;
  64383. return $core.withContext(function($ctx1) {
  64384. var $1;
  64385. $1=$recv($self.full)._includes_((5));
  64386. $ctx1.sendIdx["includes:"]=1;
  64387. $self._assert_($1);
  64388. $ctx1.sendIdx["assert:"]=1;
  64389. $self._assert_($recv($self.full)._includes_("abc"));
  64390. return self;
  64391. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{})});
  64392. },
  64393. args: [],
  64394. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  64395. referencedClasses: [],
  64396. pragmas: [],
  64397. messageSends: ["assert:", "includes:"]
  64398. }),
  64399. $globals.ExampleSetTest);
  64400. $core.addMethod(
  64401. $core.method({
  64402. selector: "testOccurrences",
  64403. protocol: "tests",
  64404. fn: function (){
  64405. var self=this,$self=this;
  64406. return $core.withContext(function($ctx1) {
  64407. var $1,$2;
  64408. $1=$recv($self.empty)._occurrencesOf_((0));
  64409. $ctx1.sendIdx["occurrencesOf:"]=1;
  64410. $self._assert_equals_($1,(0));
  64411. $ctx1.sendIdx["assert:equals:"]=1;
  64412. $2=$recv($self.full)._occurrencesOf_((5));
  64413. $ctx1.sendIdx["occurrencesOf:"]=2;
  64414. $self._assert_equals_($2,(1));
  64415. $ctx1.sendIdx["assert:equals:"]=2;
  64416. $recv($self.full)._add_((5));
  64417. $self._assert_equals_($recv($self.full)._occurrencesOf_((5)),(1));
  64418. return self;
  64419. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{})});
  64420. },
  64421. args: [],
  64422. 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",
  64423. referencedClasses: [],
  64424. pragmas: [],
  64425. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  64426. }),
  64427. $globals.ExampleSetTest);
  64428. $core.addMethod(
  64429. $core.method({
  64430. selector: "testRemove",
  64431. protocol: "tests",
  64432. fn: function (){
  64433. var self=this,$self=this;
  64434. return $core.withContext(function($ctx1) {
  64435. var $1;
  64436. $recv($self.full)._remove_((5));
  64437. $1=$recv($self.full)._includes_("abc");
  64438. $ctx1.sendIdx["includes:"]=1;
  64439. $self._assert_($1);
  64440. $self._deny_($recv($self.full)._includes_((5)));
  64441. return self;
  64442. }, function($ctx1) {$ctx1.fill(self,"testRemove",{})});
  64443. },
  64444. args: [],
  64445. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  64446. referencedClasses: [],
  64447. pragmas: [],
  64448. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  64449. }),
  64450. $globals.ExampleSetTest);
  64451. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  64452. $core.addMethod(
  64453. $core.method({
  64454. selector: "fakeError",
  64455. protocol: "helpers",
  64456. fn: function (){
  64457. var self=this,$self=this;
  64458. return $core.withContext(function($ctx1) {
  64459. $self.flag="bad";
  64460. $self._timeout_((30));
  64461. $self.flag=$recv($self._async_((function(){
  64462. return $core.withContext(function($ctx2) {
  64463. $self.flag="ok";
  64464. return $self._error_("Intentional");
  64465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64466. })))._valueWithTimeout_((20));
  64467. return self;
  64468. }, function($ctx1) {$ctx1.fill(self,"fakeError",{})});
  64469. },
  64470. args: [],
  64471. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  64472. referencedClasses: [],
  64473. pragmas: [],
  64474. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64475. }),
  64476. $globals.SUnitAsyncTest);
  64477. $core.addMethod(
  64478. $core.method({
  64479. selector: "fakeErrorFailingInTearDown",
  64480. protocol: "helpers",
  64481. fn: function (){
  64482. var self=this,$self=this;
  64483. return $core.withContext(function($ctx1) {
  64484. $self.flag="bad";
  64485. $self._timeout_((30));
  64486. $self.flag=$recv($self._async_((function(){
  64487. return $core.withContext(function($ctx2) {
  64488. return $self._error_("Intentional");
  64489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64490. })))._valueWithTimeout_((20));
  64491. return self;
  64492. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{})});
  64493. },
  64494. args: [],
  64495. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  64496. referencedClasses: [],
  64497. pragmas: [],
  64498. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64499. }),
  64500. $globals.SUnitAsyncTest);
  64501. $core.addMethod(
  64502. $core.method({
  64503. selector: "fakeFailure",
  64504. protocol: "helpers",
  64505. fn: function (){
  64506. var self=this,$self=this;
  64507. return $core.withContext(function($ctx1) {
  64508. $self.flag="bad";
  64509. $self._timeout_((30));
  64510. $self.flag=$recv($self._async_((function(){
  64511. return $core.withContext(function($ctx2) {
  64512. $self.flag="ok";
  64513. return $self._assert_(false);
  64514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64515. })))._valueWithTimeout_((20));
  64516. return self;
  64517. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{})});
  64518. },
  64519. args: [],
  64520. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  64521. referencedClasses: [],
  64522. pragmas: [],
  64523. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  64524. }),
  64525. $globals.SUnitAsyncTest);
  64526. $core.addMethod(
  64527. $core.method({
  64528. selector: "fakeMultipleTimeoutFailing",
  64529. protocol: "helpers",
  64530. fn: function (){
  64531. var self=this,$self=this;
  64532. return $core.withContext(function($ctx1) {
  64533. var $1;
  64534. $self._timeout_((100));
  64535. $ctx1.sendIdx["timeout:"]=1;
  64536. $1=$self._async_((function(){
  64537. return $core.withContext(function($ctx2) {
  64538. $self._timeout_((20));
  64539. return $recv($self._async_((function(){
  64540. return $core.withContext(function($ctx3) {
  64541. return $self._finished();
  64542. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64543. })))._valueWithTimeout_((30));
  64544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64545. }));
  64546. $ctx1.sendIdx["async:"]=1;
  64547. $recv($1)._valueWithTimeout_((20));
  64548. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64549. return self;
  64550. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{})});
  64551. },
  64552. args: [],
  64553. 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",
  64554. referencedClasses: [],
  64555. pragmas: [],
  64556. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64557. }),
  64558. $globals.SUnitAsyncTest);
  64559. $core.addMethod(
  64560. $core.method({
  64561. selector: "fakeMultipleTimeoutPassing",
  64562. protocol: "helpers",
  64563. fn: function (){
  64564. var self=this,$self=this;
  64565. return $core.withContext(function($ctx1) {
  64566. var $1;
  64567. $self._timeout_((20));
  64568. $ctx1.sendIdx["timeout:"]=1;
  64569. $1=$self._async_((function(){
  64570. return $core.withContext(function($ctx2) {
  64571. $self._timeout_((40));
  64572. return $recv($self._async_((function(){
  64573. return $core.withContext(function($ctx3) {
  64574. return $self._finished();
  64575. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64576. })))._valueWithTimeout_((20));
  64577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64578. }));
  64579. $ctx1.sendIdx["async:"]=1;
  64580. $recv($1)._valueWithTimeout_((10));
  64581. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64582. return self;
  64583. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{})});
  64584. },
  64585. args: [],
  64586. 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",
  64587. referencedClasses: [],
  64588. pragmas: [],
  64589. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64590. }),
  64591. $globals.SUnitAsyncTest);
  64592. $core.addMethod(
  64593. $core.method({
  64594. selector: "fakeTimeout",
  64595. protocol: "helpers",
  64596. fn: function (){
  64597. var self=this,$self=this;
  64598. return $core.withContext(function($ctx1) {
  64599. $self._timeout_((10));
  64600. $recv($self._async_((function(){
  64601. return $core.withContext(function($ctx2) {
  64602. return $self._finished();
  64603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64604. })))._valueWithTimeout_((20));
  64605. return self;
  64606. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{})});
  64607. },
  64608. args: [],
  64609. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  64610. referencedClasses: [],
  64611. pragmas: [],
  64612. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  64613. }),
  64614. $globals.SUnitAsyncTest);
  64615. $core.addMethod(
  64616. $core.method({
  64617. selector: "selectorSetOf:",
  64618. protocol: "private",
  64619. fn: function (aCollection){
  64620. var self=this,$self=this;
  64621. return $core.withContext(function($ctx1) {
  64622. return $recv($recv(aCollection)._collect_((function(each){
  64623. return $core.withContext(function($ctx2) {
  64624. return $recv(each)._selector();
  64625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64626. })))._asSet();
  64627. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection})});
  64628. },
  64629. args: ["aCollection"],
  64630. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  64631. referencedClasses: [],
  64632. pragmas: [],
  64633. messageSends: ["asSet", "collect:", "selector"]
  64634. }),
  64635. $globals.SUnitAsyncTest);
  64636. $core.addMethod(
  64637. $core.method({
  64638. selector: "setUp",
  64639. protocol: "running",
  64640. fn: function (){
  64641. var self=this,$self=this;
  64642. $self.flag="ok";
  64643. return self;
  64644. },
  64645. args: [],
  64646. source: "setUp\x0a\x09flag := 'ok'",
  64647. referencedClasses: [],
  64648. pragmas: [],
  64649. messageSends: []
  64650. }),
  64651. $globals.SUnitAsyncTest);
  64652. $core.addMethod(
  64653. $core.method({
  64654. selector: "tearDown",
  64655. protocol: "running",
  64656. fn: function (){
  64657. var self=this,$self=this;
  64658. return $core.withContext(function($ctx1) {
  64659. $self._assert_equals_("ok",$self.flag);
  64660. return self;
  64661. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  64662. },
  64663. args: [],
  64664. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  64665. referencedClasses: [],
  64666. pragmas: [],
  64667. messageSends: ["assert:equals:"]
  64668. }),
  64669. $globals.SUnitAsyncTest);
  64670. $core.addMethod(
  64671. $core.method({
  64672. selector: "testAsyncErrorsAndFailures",
  64673. protocol: "tests",
  64674. fn: function (){
  64675. var self=this,$self=this;
  64676. var suite,runner,result,assertBlock;
  64677. return $core.withContext(function($ctx1) {
  64678. var $1,$2,$3,$4;
  64679. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  64680. return $core.withContext(function($ctx2) {
  64681. return $recv($self._class())._selector_(each);
  64682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64683. }));
  64684. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  64685. $self._timeout_((200));
  64686. result=$recv(runner)._result();
  64687. $ctx1.sendIdx["result"]=1;
  64688. assertBlock=$self._async_((function(){
  64689. return $core.withContext(function($ctx2) {
  64690. $1=$self._selectorSetOf_($recv(result)._errors());
  64691. $ctx2.sendIdx["selectorSetOf:"]=1;
  64692. $2=["fakeError"]._asSet();
  64693. $ctx2.sendIdx["asSet"]=1;
  64694. $self._assert_equals_($1,$2);
  64695. $ctx2.sendIdx["assert:equals:"]=1;
  64696. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  64697. return $self._finished();
  64698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64699. }));
  64700. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  64701. return $core.withContext(function($ctx2) {
  64702. $3=$recv($recv(ann)._result()).__eq_eq(result);
  64703. if($core.assert($3)){
  64704. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  64705. return $recv($4)._ifTrue_(assertBlock);
  64706. }
  64707. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  64708. }));
  64709. $recv(runner)._run();
  64710. return self;
  64711. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  64712. },
  64713. args: [],
  64714. 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",
  64715. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  64716. pragmas: [],
  64717. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  64718. }),
  64719. $globals.SUnitAsyncTest);
  64720. $core.addMethod(
  64721. $core.method({
  64722. selector: "testAsyncNeedsTimeout",
  64723. protocol: "tests",
  64724. fn: function (){
  64725. var self=this,$self=this;
  64726. return $core.withContext(function($ctx1) {
  64727. $self._should_raise_((function(){
  64728. return $core.withContext(function($ctx2) {
  64729. return $self._async_((function(){
  64730. }));
  64731. $ctx2.sendIdx["async:"]=1;
  64732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64733. }),$globals.Error);
  64734. $self._timeout_((0));
  64735. $self._shouldnt_raise_((function(){
  64736. return $core.withContext(function($ctx2) {
  64737. return $self._async_((function(){
  64738. }));
  64739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  64740. }),$globals.Error);
  64741. $self._finished();
  64742. return self;
  64743. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{})});
  64744. },
  64745. args: [],
  64746. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  64747. referencedClasses: ["Error"],
  64748. pragmas: [],
  64749. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  64750. }),
  64751. $globals.SUnitAsyncTest);
  64752. $core.addMethod(
  64753. $core.method({
  64754. selector: "testFinishedNeedsTimeout",
  64755. protocol: "tests",
  64756. fn: function (){
  64757. var self=this,$self=this;
  64758. return $core.withContext(function($ctx1) {
  64759. $self._should_raise_((function(){
  64760. return $core.withContext(function($ctx2) {
  64761. return $self._finished();
  64762. $ctx2.sendIdx["finished"]=1;
  64763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64764. }),$globals.Error);
  64765. $self._timeout_((0));
  64766. $self._shouldnt_raise_((function(){
  64767. return $core.withContext(function($ctx2) {
  64768. return $self._finished();
  64769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64770. }),$globals.Error);
  64771. return self;
  64772. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{})});
  64773. },
  64774. args: [],
  64775. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  64776. referencedClasses: ["Error"],
  64777. pragmas: [],
  64778. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  64779. }),
  64780. $globals.SUnitAsyncTest);
  64781. $core.addMethod(
  64782. $core.method({
  64783. selector: "testIsAsyncReturnsCorrectValues",
  64784. protocol: "tests",
  64785. fn: function (){
  64786. var self=this,$self=this;
  64787. return $core.withContext(function($ctx1) {
  64788. var $1,$2;
  64789. $1=$self._isAsync();
  64790. $ctx1.sendIdx["isAsync"]=1;
  64791. $self._deny_($1);
  64792. $ctx1.sendIdx["deny:"]=1;
  64793. $self._timeout_((0));
  64794. $2=$self._isAsync();
  64795. $ctx1.sendIdx["isAsync"]=2;
  64796. $self._assert_($2);
  64797. $self._finished();
  64798. $self._deny_($self._isAsync());
  64799. return self;
  64800. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{})});
  64801. },
  64802. args: [],
  64803. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  64804. referencedClasses: [],
  64805. pragmas: [],
  64806. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  64807. }),
  64808. $globals.SUnitAsyncTest);
  64809. $core.addMethod(
  64810. $core.method({
  64811. selector: "testPass",
  64812. protocol: "tests",
  64813. fn: function (){
  64814. var self=this,$self=this;
  64815. return $core.withContext(function($ctx1) {
  64816. $self.flag="bad";
  64817. $self._timeout_((10));
  64818. $self.flag=$recv($self._async_((function(){
  64819. return $core.withContext(function($ctx2) {
  64820. $self._assert_(true);
  64821. $self._finished();
  64822. $self.flag="ok";
  64823. return $self.flag;
  64824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64825. })))._valueWithTimeout_((5));
  64826. return self;
  64827. }, function($ctx1) {$ctx1.fill(self,"testPass",{})});
  64828. },
  64829. args: [],
  64830. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  64831. referencedClasses: [],
  64832. pragmas: [],
  64833. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  64834. }),
  64835. $globals.SUnitAsyncTest);
  64836. $core.addMethod(
  64837. $core.method({
  64838. selector: "testTimeouts",
  64839. protocol: "tests",
  64840. fn: function (){
  64841. var self=this,$self=this;
  64842. var suite,runner,result,assertBlock;
  64843. return $core.withContext(function($ctx1) {
  64844. var $1,$2,$3;
  64845. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  64846. return $core.withContext(function($ctx2) {
  64847. return $recv($self._class())._selector_(each);
  64848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64849. }));
  64850. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  64851. $self._timeout_((200));
  64852. result=$recv(runner)._result();
  64853. $ctx1.sendIdx["result"]=1;
  64854. assertBlock=$self._async_((function(){
  64855. return $core.withContext(function($ctx2) {
  64856. $1=$self._selectorSetOf_($recv(result)._errors());
  64857. $ctx2.sendIdx["selectorSetOf:"]=1;
  64858. $self._assert_equals_($1,$recv($globals.Set)._new());
  64859. $ctx2.sendIdx["assert:equals:"]=1;
  64860. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  64861. return $self._finished();
  64862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64863. }));
  64864. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  64865. return $core.withContext(function($ctx2) {
  64866. $2=$recv($recv(ann)._result()).__eq_eq(result);
  64867. if($core.assert($2)){
  64868. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  64869. return $recv($3)._ifTrue_(assertBlock);
  64870. }
  64871. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  64872. }));
  64873. $recv(runner)._run();
  64874. return self;
  64875. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  64876. },
  64877. args: [],
  64878. 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",
  64879. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  64880. pragmas: [],
  64881. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  64882. }),
  64883. $globals.SUnitAsyncTest);
  64884. $core.addMethod(
  64885. $core.method({
  64886. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  64887. protocol: "tests",
  64888. fn: function (){
  64889. var self=this,$self=this;
  64890. var x;
  64891. return $core.withContext(function($ctx1) {
  64892. var $1;
  64893. $self.flag="bad";
  64894. $self._timeout_((10));
  64895. x=(0);
  64896. $1=$self._async_((function(){
  64897. return $core.withContext(function($ctx2) {
  64898. $self._finished();
  64899. $ctx2.sendIdx["finished"]=1;
  64900. $self.flag="ok";
  64901. x=$recv(x).__plus((1));
  64902. $ctx2.sendIdx["+"]=1;
  64903. return $self._assert_equals_(x,(1));
  64904. $ctx2.sendIdx["assert:equals:"]=1;
  64905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64906. }));
  64907. $ctx1.sendIdx["async:"]=1;
  64908. $self.flag=$recv($1)._valueWithTimeout_((0));
  64909. $ctx1.sendIdx["valueWithTimeout:"]=1;
  64910. $self.flag=$recv($self._async_((function(){
  64911. return $core.withContext(function($ctx2) {
  64912. $self._finished();
  64913. $self.flag="ok";
  64914. x=$recv(x).__plus((1));
  64915. return $self._assert_equals_(x,(1));
  64916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64917. })))._valueWithTimeout_((0));
  64918. return self;
  64919. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x})});
  64920. },
  64921. args: [],
  64922. 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.",
  64923. referencedClasses: [],
  64924. pragmas: [],
  64925. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  64926. }),
  64927. $globals.SUnitAsyncTest);
  64928. });
  64929. define('amber/devel',[
  64930. './lang',
  64931. './brikz', // pre-fetch, dep of ./boot
  64932. './kernel-checks', // pre-fetch, dep of ./boot
  64933. './kernel-fundamentals', // pre-fetch, dep of ./boot
  64934. './kernel-language', // pre-fetch, dep of ./boot
  64935. './boot', // pre-fetch, class loader
  64936. './deploy', // pre-fetch, dep of ./lang
  64937. // --- packages of the development only Amber begin here ---
  64938. 'amber/core/Platform-DOM',
  64939. 'amber/core/SUnit',
  64940. 'amber/core/Compiler-Tests',
  64941. 'amber/core/Kernel-Tests',
  64942. 'amber/core/Platform-DOM-Tests',
  64943. 'amber/core/SUnit-Tests'
  64944. // --- packages of the development only Amber end here ---
  64945. ], function (amber) {
  64946. return amber;
  64947. });
  64948. define('amber/core/Platform-Node',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  64949. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64950. var $pkg = $core.addPackage("Platform-Node");
  64951. $pkg.innerEval = function (expr) { return eval(expr); };
  64952. $pkg.imports = ["amber/core/Platform-Services"];
  64953. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/core/Platform-Services"], function () {resolve();}, reject); });
  64954. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64955. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  64956. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  64957. $core.addMethod(
  64958. $core.method({
  64959. selector: "fetch:",
  64960. protocol: "public API",
  64961. fn: function (aStringOrObject){
  64962. var self=this,$self=this;
  64963. return $core.withContext(function($ctx1) {
  64964. return $recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
  64965. return $core.withContext(function($ctx2) {
  64966. return $recv(fetch)._value_(aStringOrObject);
  64967. }, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
  64968. }),(function(){
  64969. return $core.withContext(function($ctx2) {
  64970. return $recv($globals.Promise)._signal_("fetch not available.");
  64971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64972. }));
  64973. }, function($ctx1) {$ctx1.fill(self,"fetch:",{aStringOrObject:aStringOrObject})});
  64974. },
  64975. args: ["aStringOrObject"],
  64976. source: "fetch: aStringOrObject\x0a\x09^ self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | fetch value: aStringOrObject ]\x0a\x09\x09ifAbsent: [ Promise signal: 'fetch not available.' ]",
  64977. referencedClasses: ["Promise"],
  64978. pragmas: [],
  64979. messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:", "signal:"]
  64980. }),
  64981. $globals.NodePlatform);
  64982. $core.addMethod(
  64983. $core.method({
  64984. selector: "fetchUrl:options:",
  64985. protocol: "public API",
  64986. fn: function (aString,anObject){
  64987. var self=this,$self=this;
  64988. return $core.withContext(function($ctx1) {
  64989. return $recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
  64990. return $core.withContext(function($ctx2) {
  64991. return $recv(fetch)._value_value_(aString,anObject);
  64992. }, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
  64993. }),(function(){
  64994. return $core.withContext(function($ctx2) {
  64995. return $recv($globals.Promise)._signal_("fetch not available.");
  64996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64997. }));
  64998. }, function($ctx1) {$ctx1.fill(self,"fetchUrl:options:",{aString:aString,anObject:anObject})});
  64999. },
  65000. args: ["aString", "anObject"],
  65001. source: "fetchUrl: aString options: anObject\x0a\x09^ self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | fetch value: aString value: anObject ]\x0a\x09\x09ifAbsent: [ Promise signal: 'fetch not available.' ]",
  65002. referencedClasses: ["Promise"],
  65003. pragmas: [],
  65004. messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:value:", "signal:"]
  65005. }),
  65006. $globals.NodePlatform);
  65007. $core.addMethod(
  65008. $core.method({
  65009. selector: "globals",
  65010. protocol: "accessing",
  65011. fn: function (){
  65012. var self=this,$self=this;
  65013. return global;
  65014. },
  65015. args: [],
  65016. source: "globals\x0a\x09^ global",
  65017. referencedClasses: [],
  65018. pragmas: [],
  65019. messageSends: []
  65020. }),
  65021. $globals.NodePlatform);
  65022. $core.addMethod(
  65023. $core.method({
  65024. selector: "newXhr",
  65025. protocol: "public API",
  65026. fn: function (){
  65027. var self=this,$self=this;
  65028. return $core.withContext(function($ctx1) {
  65029. var $receiver;
  65030. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  65031. $self._error_("XMLHttpRequest not available.");
  65032. } else {
  65033. return $recv($globals.XMLHttpRequest)._new();
  65034. }
  65035. return self;
  65036. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  65037. },
  65038. args: [],
  65039. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  65040. referencedClasses: ["XMLHttpRequest"],
  65041. pragmas: [],
  65042. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  65043. }),
  65044. $globals.NodePlatform);
  65045. $core.addMethod(
  65046. $core.method({
  65047. selector: "initialize",
  65048. protocol: "testing",
  65049. fn: function (){
  65050. var self=this,$self=this;
  65051. return $core.withContext(function($ctx1) {
  65052. var $1;
  65053. $1=$self._isFeasible();
  65054. if($core.assert($1)){
  65055. $recv($globals.Platform)._registerIfNone_($self._new());
  65056. }
  65057. return self;
  65058. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65059. },
  65060. args: [],
  65061. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  65062. referencedClasses: ["Platform"],
  65063. pragmas: [],
  65064. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  65065. }),
  65066. $globals.NodePlatform.a$cls);
  65067. $core.addMethod(
  65068. $core.method({
  65069. selector: "isFeasible",
  65070. protocol: "testing",
  65071. fn: function (){
  65072. var self=this,$self=this;
  65073. return $core.withContext(function($ctx1) {
  65074. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  65075. return self;
  65076. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  65077. },
  65078. args: [],
  65079. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  65080. referencedClasses: [],
  65081. pragmas: [["inlineJS:", ["return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null"]]],
  65082. messageSends: []
  65083. }),
  65084. $globals.NodePlatform.a$cls);
  65085. });
  65086. define('amber_cli/AmberCli',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  65087. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  65088. var $pkg = $core.addPackage("AmberCli");
  65089. $pkg.innerEval = function (expr) { return eval(expr); };
  65090. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  65091. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  65092. $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.";
  65093. $core.addMethod(
  65094. $core.method({
  65095. selector: "commandLineSwitches",
  65096. protocol: "commandline",
  65097. fn: function (){
  65098. var self=this,$self=this;
  65099. var switches;
  65100. return $core.withContext(function($ctx1) {
  65101. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  65102. return $core.withContext(function($ctx2) {
  65103. return $recv(each)._selector();
  65104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65105. }));
  65106. $ctx1.sendIdx["collect:"]=1;
  65107. switches=$recv(switches)._select_((function(each){
  65108. return $core.withContext(function($ctx2) {
  65109. return $recv(each)._match_("^[^:]*:$");
  65110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  65111. }));
  65112. switches=$recv(switches)._collect_((function(each){
  65113. return $core.withContext(function($ctx2) {
  65114. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  65115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  65116. }));
  65117. return switches;
  65118. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  65119. },
  65120. args: [],
  65121. 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",
  65122. referencedClasses: [],
  65123. pragmas: [],
  65124. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  65125. }),
  65126. $globals.AmberCli.a$cls);
  65127. $core.addMethod(
  65128. $core.method({
  65129. selector: "config:",
  65130. protocol: "commands",
  65131. fn: function (args){
  65132. var self=this,$self=this;
  65133. return $core.withContext(function($ctx1) {
  65134. $recv($recv($globals.Configurator)._new())._start();
  65135. return self;
  65136. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args})});
  65137. },
  65138. args: ["args"],
  65139. source: "config: args\x0a\x09Configurator new start",
  65140. referencedClasses: ["Configurator"],
  65141. pragmas: [],
  65142. messageSends: ["start", "new"]
  65143. }),
  65144. $globals.AmberCli.a$cls);
  65145. $core.addMethod(
  65146. $core.method({
  65147. selector: "handleArguments:",
  65148. protocol: "commandline",
  65149. fn: function (args){
  65150. var self=this,$self=this;
  65151. var selector;
  65152. return $core.withContext(function($ctx1) {
  65153. var $1;
  65154. $1=$recv(args)._first();
  65155. $ctx1.sendIdx["first"]=1;
  65156. selector=$self._selectorForCommandLineSwitch_($1);
  65157. $recv(args)._remove_($recv(args)._first());
  65158. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  65159. return self;
  65160. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector})});
  65161. },
  65162. args: ["args"],
  65163. 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)",
  65164. referencedClasses: ["Array"],
  65165. pragmas: [],
  65166. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  65167. }),
  65168. $globals.AmberCli.a$cls);
  65169. $core.addMethod(
  65170. $core.method({
  65171. selector: "help:",
  65172. protocol: "commands",
  65173. fn: function (args){
  65174. var self=this,$self=this;
  65175. return $core.withContext(function($ctx1) {
  65176. $recv($globals.Transcript)._show_("Available commands");
  65177. $recv($self._commandLineSwitches())._do_((function(each){
  65178. return $core.withContext(function($ctx2) {
  65179. return $recv(console)._log_(each);
  65180. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65181. }));
  65182. return self;
  65183. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args})});
  65184. },
  65185. args: ["args"],
  65186. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  65187. referencedClasses: ["Transcript"],
  65188. pragmas: [],
  65189. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  65190. }),
  65191. $globals.AmberCli.a$cls);
  65192. $core.addMethod(
  65193. $core.method({
  65194. selector: "init:",
  65195. protocol: "commands",
  65196. fn: function (args){
  65197. var self=this,$self=this;
  65198. return $core.withContext(function($ctx1) {
  65199. $recv($recv($globals.Initer)._new())._start();
  65200. return self;
  65201. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args})});
  65202. },
  65203. args: ["args"],
  65204. source: "init: args\x0a\x09Initer new start",
  65205. referencedClasses: ["Initer"],
  65206. pragmas: [],
  65207. messageSends: ["start", "new"]
  65208. }),
  65209. $globals.AmberCli.a$cls);
  65210. $core.addMethod(
  65211. $core.method({
  65212. selector: "main",
  65213. protocol: "startup",
  65214. fn: function (){
  65215. var self=this,$self=this;
  65216. var args,packageJSON;
  65217. return $core.withContext(function($ctx1) {
  65218. var $7,$6,$5,$4,$3,$2,$1;
  65219. var $early={};
  65220. try {
  65221. packageJSON=$recv(require)._value_("../package.json");
  65222. $7=$recv(packageJSON)._version();
  65223. $ctx1.sendIdx["version"]=1;
  65224. $6="Welcome to Amber CLI version ".__comma($7);
  65225. $5=$recv($6).__comma(" (Amber ");
  65226. $ctx1.sendIdx[","]=5;
  65227. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  65228. $ctx1.sendIdx[","]=4;
  65229. $3=$recv($4).__comma(", NodeJS ");
  65230. $ctx1.sendIdx[","]=3;
  65231. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  65232. $ctx1.sendIdx[","]=2;
  65233. $1=$recv($2).__comma(").");
  65234. $ctx1.sendIdx[","]=1;
  65235. $recv($globals.Transcript)._show_($1);
  65236. args=$recv(process)._argv();
  65237. $recv(args)._removeFrom_to_((1),(2));
  65238. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  65239. return $core.withContext(function($ctx2) {
  65240. return $self._help_(nil);
  65241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65242. }),(function(){
  65243. return $core.withContext(function($ctx2) {
  65244. throw $early=[$self._handleArguments_(args)];
  65245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65246. }));
  65247. return self;
  65248. }
  65249. catch(e) {if(e===$early)return e[0]; throw e}
  65250. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON})});
  65251. },
  65252. args: [],
  65253. 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]",
  65254. referencedClasses: ["Transcript", "Smalltalk"],
  65255. pragmas: [],
  65256. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  65257. }),
  65258. $globals.AmberCli.a$cls);
  65259. $core.addMethod(
  65260. $core.method({
  65261. selector: "repl:",
  65262. protocol: "commands",
  65263. fn: function (args){
  65264. var self=this,$self=this;
  65265. return $core.withContext(function($ctx1) {
  65266. return $recv($recv($globals.Repl)._new())._createInterface();
  65267. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args})});
  65268. },
  65269. args: ["args"],
  65270. source: "repl: args\x0a\x09^ Repl new createInterface",
  65271. referencedClasses: ["Repl"],
  65272. pragmas: [],
  65273. messageSends: ["createInterface", "new"]
  65274. }),
  65275. $globals.AmberCli.a$cls);
  65276. $core.addMethod(
  65277. $core.method({
  65278. selector: "selectorForCommandLineSwitch:",
  65279. protocol: "commandline",
  65280. fn: function (aSwitch){
  65281. var self=this,$self=this;
  65282. var command,selector;
  65283. return $core.withContext(function($ctx1) {
  65284. var $1;
  65285. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  65286. if($core.assert($1)){
  65287. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  65288. return $core.withContext(function($ctx2) {
  65289. return $recv($recv(each)._second())._asUppercase();
  65290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  65291. }))).__comma(":");
  65292. selector;
  65293. } else {
  65294. selector="help:";
  65295. selector;
  65296. }
  65297. return selector;
  65298. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector})});
  65299. },
  65300. args: ["aSwitch"],
  65301. 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",
  65302. referencedClasses: [],
  65303. pragmas: [],
  65304. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  65305. }),
  65306. $globals.AmberCli.a$cls);
  65307. $core.addMethod(
  65308. $core.method({
  65309. selector: "serve:",
  65310. protocol: "commands",
  65311. fn: function (args){
  65312. var self=this,$self=this;
  65313. return $core.withContext(function($ctx1) {
  65314. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  65315. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args})});
  65316. },
  65317. args: ["args"],
  65318. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  65319. referencedClasses: ["FileServer"],
  65320. pragmas: [],
  65321. messageSends: ["start", "createServerWithArguments:"]
  65322. }),
  65323. $globals.AmberCli.a$cls);
  65324. $core.addMethod(
  65325. $core.method({
  65326. selector: "version:",
  65327. protocol: "commands",
  65328. fn: function (arguments_){
  65329. var self=this,$self=this;
  65330. return self;
  65331. },
  65332. args: ["arguments"],
  65333. source: "version: arguments",
  65334. referencedClasses: [],
  65335. pragmas: [],
  65336. messageSends: []
  65337. }),
  65338. $globals.AmberCli.a$cls);
  65339. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  65340. $core.addMethod(
  65341. $core.method({
  65342. selector: "dirname",
  65343. protocol: "private",
  65344. fn: function (){
  65345. var self=this,$self=this;
  65346. return $core.withContext(function($ctx1) {
  65347. return __dirname;
  65348. return self;
  65349. }, function($ctx1) {$ctx1.fill(self,"dirname",{})});
  65350. },
  65351. args: [],
  65352. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  65353. referencedClasses: [],
  65354. pragmas: [["inlineJS:", ["return __dirname"]]],
  65355. messageSends: []
  65356. }),
  65357. $globals.BaseFileManipulator);
  65358. $core.addMethod(
  65359. $core.method({
  65360. selector: "initialize",
  65361. protocol: "initialization",
  65362. fn: function (){
  65363. var self=this,$self=this;
  65364. return $core.withContext(function($ctx1) {
  65365. (
  65366. $ctx1.supercall = true,
  65367. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65368. $ctx1.supercall = false;
  65369. $self.path=$recv(require)._value_("path");
  65370. $ctx1.sendIdx["value:"]=1;
  65371. $self.fs=$recv(require)._value_("fs");
  65372. return self;
  65373. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65374. },
  65375. args: [],
  65376. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  65377. referencedClasses: [],
  65378. pragmas: [],
  65379. messageSends: ["initialize", "value:"]
  65380. }),
  65381. $globals.BaseFileManipulator);
  65382. $core.addMethod(
  65383. $core.method({
  65384. selector: "rootDirname",
  65385. protocol: "private",
  65386. fn: function (){
  65387. var self=this,$self=this;
  65388. return $core.withContext(function($ctx1) {
  65389. return $recv($self.path)._join_with_($self._dirname(),"..");
  65390. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{})});
  65391. },
  65392. args: [],
  65393. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  65394. referencedClasses: [],
  65395. pragmas: [],
  65396. messageSends: ["join:with:", "dirname"]
  65397. }),
  65398. $globals.BaseFileManipulator);
  65399. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  65400. $core.addMethod(
  65401. $core.method({
  65402. selector: "initialize",
  65403. protocol: "initialization",
  65404. fn: function (){
  65405. var self=this,$self=this;
  65406. return $core.withContext(function($ctx1) {
  65407. (
  65408. $ctx1.supercall = true,
  65409. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65410. $ctx1.supercall = false;
  65411. return self;
  65412. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65413. },
  65414. args: [],
  65415. source: "initialize\x0a\x09super initialize",
  65416. referencedClasses: [],
  65417. pragmas: [],
  65418. messageSends: ["initialize"]
  65419. }),
  65420. $globals.Configurator);
  65421. $core.addMethod(
  65422. $core.method({
  65423. selector: "start",
  65424. protocol: "action",
  65425. fn: function (){
  65426. var self=this,$self=this;
  65427. return $core.withContext(function($ctx1) {
  65428. var $receiver;
  65429. $self._writeConfigThenDo_((function(err){
  65430. return $core.withContext(function($ctx2) {
  65431. if(($receiver = err) == null || $receiver.a$nil){
  65432. return $recv(process)._exit();
  65433. } else {
  65434. return $recv(process)._exit_((111));
  65435. }
  65436. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  65437. }));
  65438. return self;
  65439. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  65440. },
  65441. args: [],
  65442. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  65443. referencedClasses: [],
  65444. pragmas: [],
  65445. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  65446. }),
  65447. $globals.Configurator);
  65448. $core.addMethod(
  65449. $core.method({
  65450. selector: "writeConfigThenDo:",
  65451. protocol: "action",
  65452. fn: function (aBlock){
  65453. var self=this,$self=this;
  65454. return $core.withContext(function($ctx1) {
  65455. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  65456. return self;
  65457. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock})});
  65458. },
  65459. args: ["aBlock"],
  65460. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  65461. referencedClasses: [],
  65462. pragmas: [],
  65463. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  65464. }),
  65465. $globals.Configurator);
  65466. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  65467. $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.";
  65468. $core.addMethod(
  65469. $core.method({
  65470. selector: "base64Decode:",
  65471. protocol: "private",
  65472. fn: function (aString){
  65473. var self=this,$self=this;
  65474. return $core.withContext(function($ctx1) {
  65475. return (new Buffer(aString, "base64").toString());
  65476. return self;
  65477. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString})});
  65478. },
  65479. args: ["aString"],
  65480. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  65481. referencedClasses: [],
  65482. pragmas: [["inlineJS:", ["return (new Buffer(aString, \x22base64\x22).toString())"]]],
  65483. messageSends: []
  65484. }),
  65485. $globals.FileServer);
  65486. $core.addMethod(
  65487. $core.method({
  65488. selector: "basePath",
  65489. protocol: "accessing",
  65490. fn: function (){
  65491. var self=this,$self=this;
  65492. return $core.withContext(function($ctx1) {
  65493. var $1,$receiver;
  65494. $1=$self.basePath;
  65495. if(($receiver = $1) == null || $receiver.a$nil){
  65496. return $recv($self._class())._defaultBasePath();
  65497. } else {
  65498. return $1;
  65499. }
  65500. }, function($ctx1) {$ctx1.fill(self,"basePath",{})});
  65501. },
  65502. args: [],
  65503. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  65504. referencedClasses: [],
  65505. pragmas: [],
  65506. messageSends: ["ifNil:", "defaultBasePath", "class"]
  65507. }),
  65508. $globals.FileServer);
  65509. $core.addMethod(
  65510. $core.method({
  65511. selector: "basePath:",
  65512. protocol: "accessing",
  65513. fn: function (aString){
  65514. var self=this,$self=this;
  65515. return $core.withContext(function($ctx1) {
  65516. $self.basePath=aString;
  65517. $self._validateBasePath();
  65518. return self;
  65519. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString})});
  65520. },
  65521. args: ["aString"],
  65522. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  65523. referencedClasses: [],
  65524. pragmas: [],
  65525. messageSends: ["validateBasePath"]
  65526. }),
  65527. $globals.FileServer);
  65528. $core.addMethod(
  65529. $core.method({
  65530. selector: "checkDirectoryLayout",
  65531. protocol: "initialization",
  65532. fn: function (){
  65533. var self=this,$self=this;
  65534. return $core.withContext(function($ctx1) {
  65535. var $1;
  65536. $1=$recv($self.fs)._existsSync_($self._withBasePath_("index.html"));
  65537. if(!$core.assert($1)){
  65538. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  65539. $ctx1.sendIdx["warn:"]=1;
  65540. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  65541. $ctx1.sendIdx["warn:"]=2;
  65542. $recv(console)._warn_(" You can also specify a page to be served by default,");
  65543. $ctx1.sendIdx["warn:"]=3;
  65544. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  65545. }
  65546. return self;
  65547. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{})});
  65548. },
  65549. args: [],
  65550. 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.'].",
  65551. referencedClasses: [],
  65552. pragmas: [],
  65553. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  65554. }),
  65555. $globals.FileServer);
  65556. $core.addMethod(
  65557. $core.method({
  65558. selector: "fallbackPage",
  65559. protocol: "accessing",
  65560. fn: function (){
  65561. var self=this,$self=this;
  65562. return $self.fallbackPage;
  65563. },
  65564. args: [],
  65565. source: "fallbackPage\x0a\x09^ fallbackPage",
  65566. referencedClasses: [],
  65567. pragmas: [],
  65568. messageSends: []
  65569. }),
  65570. $globals.FileServer);
  65571. $core.addMethod(
  65572. $core.method({
  65573. selector: "fallbackPage:",
  65574. protocol: "accessing",
  65575. fn: function (aString){
  65576. var self=this,$self=this;
  65577. $self.fallbackPage=aString;
  65578. return self;
  65579. },
  65580. args: ["aString"],
  65581. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  65582. referencedClasses: [],
  65583. pragmas: [],
  65584. messageSends: []
  65585. }),
  65586. $globals.FileServer);
  65587. $core.addMethod(
  65588. $core.method({
  65589. selector: "handleGETRequest:respondTo:",
  65590. protocol: "request handling",
  65591. fn: function (aRequest,aResponse){
  65592. var self=this,$self=this;
  65593. var uri,filename;
  65594. return $core.withContext(function($ctx1) {
  65595. var $1;
  65596. uri=$recv($self.url)._parse_($recv(aRequest)._url());
  65597. filename=$recv($self.path)._join_with_($self._basePath(),$recv(uri)._pathname());
  65598. $recv($self.fs)._exists_do_(filename,(function(aBoolean){
  65599. return $core.withContext(function($ctx2) {
  65600. if($core.assert(aBoolean)){
  65601. $1=$recv($recv($self.fs)._statSync_(filename))._isDirectory();
  65602. if($core.assert($1)){
  65603. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  65604. } else {
  65605. return $self._respondFileNamed_to_(filename,aResponse);
  65606. }
  65607. } else {
  65608. return $self._respondNotFoundTo_(aResponse);
  65609. }
  65610. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  65611. }));
  65612. return self;
  65613. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename})});
  65614. },
  65615. args: ["aRequest", "aResponse"],
  65616. 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]]]",
  65617. referencedClasses: [],
  65618. pragmas: [],
  65619. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  65620. }),
  65621. $globals.FileServer);
  65622. $core.addMethod(
  65623. $core.method({
  65624. selector: "handleOPTIONSRequest:respondTo:",
  65625. protocol: "request handling",
  65626. fn: function (aRequest,aResponse){
  65627. var self=this,$self=this;
  65628. return $core.withContext(function($ctx1) {
  65629. $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)]));
  65630. $recv(aResponse)._end();
  65631. return self;
  65632. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  65633. },
  65634. args: ["aRequest", "aResponse"],
  65635. 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",
  65636. referencedClasses: [],
  65637. pragmas: [],
  65638. messageSends: ["writeHead:options:", "end"]
  65639. }),
  65640. $globals.FileServer);
  65641. $core.addMethod(
  65642. $core.method({
  65643. selector: "handlePUTRequest:respondTo:",
  65644. protocol: "request handling",
  65645. fn: function (aRequest,aResponse){
  65646. var self=this,$self=this;
  65647. var file,stream;
  65648. return $core.withContext(function($ctx1) {
  65649. var $1,$2,$3,$4;
  65650. $1=$self._isAuthenticated_(aRequest);
  65651. if(!$core.assert($1)){
  65652. $self._respondAuthenticationRequiredTo_(aResponse);
  65653. return nil;
  65654. }
  65655. file=".".__comma($recv(aRequest)._url());
  65656. $ctx1.sendIdx[","]=1;
  65657. stream=$recv($self.fs)._createWriteStream_(file);
  65658. $recv(stream)._on_do_("error",(function(error){
  65659. return $core.withContext(function($ctx2) {
  65660. $2=console;
  65661. $3="Error creating WriteStream for file ".__comma(file);
  65662. $ctx2.sendIdx[","]=2;
  65663. $recv($2)._warn_($3);
  65664. $ctx2.sendIdx["warn:"]=1;
  65665. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  65666. $ctx2.sendIdx["warn:"]=2;
  65667. $recv(console)._warn_(" The exact error is: ".__comma(error));
  65668. return $self._respondNotCreatedTo_(aResponse);
  65669. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  65670. }));
  65671. $ctx1.sendIdx["on:do:"]=1;
  65672. $recv(stream)._on_do_("close",(function(){
  65673. return $core.withContext(function($ctx2) {
  65674. return $self._respondCreatedTo_(aResponse);
  65675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  65676. }));
  65677. $ctx1.sendIdx["on:do:"]=2;
  65678. $recv(aRequest)._setEncoding_("utf8");
  65679. $recv(aRequest)._on_do_("data",(function(data){
  65680. return $core.withContext(function($ctx2) {
  65681. return $recv(stream)._write_(data);
  65682. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  65683. }));
  65684. $ctx1.sendIdx["on:do:"]=3;
  65685. $recv(aRequest)._on_do_("end",(function(){
  65686. return $core.withContext(function($ctx2) {
  65687. $4=$recv(stream)._writable();
  65688. if($core.assert($4)){
  65689. return $recv(stream)._end();
  65690. }
  65691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  65692. }));
  65693. return self;
  65694. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream})});
  65695. },
  65696. args: ["aRequest", "aResponse"],
  65697. 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]]",
  65698. referencedClasses: [],
  65699. pragmas: [],
  65700. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  65701. }),
  65702. $globals.FileServer);
  65703. $core.addMethod(
  65704. $core.method({
  65705. selector: "handleRequest:respondTo:",
  65706. protocol: "request handling",
  65707. fn: function (aRequest,aResponse){
  65708. var self=this,$self=this;
  65709. return $core.withContext(function($ctx1) {
  65710. var $2,$1,$4,$3,$5;
  65711. $2=$recv(aRequest)._method();
  65712. $ctx1.sendIdx["method"]=1;
  65713. $1=$recv($2).__eq("PUT");
  65714. $ctx1.sendIdx["="]=1;
  65715. if($core.assert($1)){
  65716. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  65717. }
  65718. $4=$recv(aRequest)._method();
  65719. $ctx1.sendIdx["method"]=2;
  65720. $3=$recv($4).__eq("GET");
  65721. $ctx1.sendIdx["="]=2;
  65722. if($core.assert($3)){
  65723. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  65724. }
  65725. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  65726. if($core.assert($5)){
  65727. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  65728. }
  65729. return self;
  65730. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  65731. },
  65732. args: ["aRequest", "aResponse"],
  65733. 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]",
  65734. referencedClasses: [],
  65735. pragmas: [],
  65736. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  65737. }),
  65738. $globals.FileServer);
  65739. $core.addMethod(
  65740. $core.method({
  65741. selector: "host",
  65742. protocol: "accessing",
  65743. fn: function (){
  65744. var self=this,$self=this;
  65745. return $self.host;
  65746. },
  65747. args: [],
  65748. source: "host\x0a\x09^ host",
  65749. referencedClasses: [],
  65750. pragmas: [],
  65751. messageSends: []
  65752. }),
  65753. $globals.FileServer);
  65754. $core.addMethod(
  65755. $core.method({
  65756. selector: "host:",
  65757. protocol: "accessing",
  65758. fn: function (hostname){
  65759. var self=this,$self=this;
  65760. $self.host=hostname;
  65761. return self;
  65762. },
  65763. args: ["hostname"],
  65764. source: "host: hostname\x0a\x09host := hostname",
  65765. referencedClasses: [],
  65766. pragmas: [],
  65767. messageSends: []
  65768. }),
  65769. $globals.FileServer);
  65770. $core.addMethod(
  65771. $core.method({
  65772. selector: "initialize",
  65773. protocol: "initialization",
  65774. fn: function (){
  65775. var self=this,$self=this;
  65776. return $core.withContext(function($ctx1) {
  65777. var $1;
  65778. (
  65779. $ctx1.supercall = true,
  65780. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  65781. $ctx1.supercall = false;
  65782. $self.http=$self._require_("http");
  65783. $ctx1.sendIdx["require:"]=1;
  65784. $self.util=$self._require_("util");
  65785. $ctx1.sendIdx["require:"]=2;
  65786. $self.url=$self._require_("url");
  65787. $1=$self._class();
  65788. $ctx1.sendIdx["class"]=1;
  65789. $self.host=$recv($1)._defaultHost();
  65790. $self.port=$recv($self._class())._defaultPort();
  65791. $self.username=nil;
  65792. $self.password=nil;
  65793. $self.fallbackPage=nil;
  65794. return self;
  65795. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65796. },
  65797. args: [],
  65798. 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.",
  65799. referencedClasses: [],
  65800. pragmas: [],
  65801. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  65802. }),
  65803. $globals.FileServer);
  65804. $core.addMethod(
  65805. $core.method({
  65806. selector: "isAuthenticated:",
  65807. protocol: "private",
  65808. fn: function (aRequest){
  65809. var self=this,$self=this;
  65810. var header,token,auth,parts;
  65811. return $core.withContext(function($ctx1) {
  65812. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  65813. var $early={};
  65814. try {
  65815. $2=$recv($self.username)._isNil();
  65816. $ctx1.sendIdx["isNil"]=1;
  65817. $1=$recv($2)._and_((function(){
  65818. return $core.withContext(function($ctx2) {
  65819. return $recv($self.password)._isNil();
  65820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65821. }));
  65822. $ctx1.sendIdx["and:"]=1;
  65823. if($core.assert($1)){
  65824. return true;
  65825. }
  65826. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  65827. $ctx1.sendIdx["at:"]=1;
  65828. if(($receiver = $3) == null || $receiver.a$nil){
  65829. header="";
  65830. } else {
  65831. header=$3;
  65832. }
  65833. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  65834. throw $early=[false];
  65835. }),(function(){
  65836. return $core.withContext(function($ctx2) {
  65837. $4=$recv(header)._tokenize_(" ");
  65838. $ctx2.sendIdx["tokenize:"]=1;
  65839. if(($receiver = $4) == null || $receiver.a$nil){
  65840. token="";
  65841. } else {
  65842. token=$4;
  65843. }
  65844. $5=$recv(token)._at_((2));
  65845. $ctx2.sendIdx["at:"]=2;
  65846. auth=$self._base64Decode_($5);
  65847. parts=$recv(auth)._tokenize_(":");
  65848. $8=$self.username;
  65849. $9=$recv(parts)._at_((1));
  65850. $ctx2.sendIdx["at:"]=3;
  65851. $7=$recv($8).__eq($9);
  65852. $ctx2.sendIdx["="]=1;
  65853. $6=$recv($7)._and_((function(){
  65854. return $core.withContext(function($ctx3) {
  65855. return $recv($self.password).__eq($recv(parts)._at_((2)));
  65856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  65857. }));
  65858. if($core.assert($6)){
  65859. throw $early=[true];
  65860. } else {
  65861. throw $early=[false];
  65862. }
  65863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  65864. }));
  65865. return self;
  65866. }
  65867. catch(e) {if(e===$early)return e[0]; throw e}
  65868. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts})});
  65869. },
  65870. args: ["aRequest"],
  65871. 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].",
  65872. referencedClasses: [],
  65873. pragmas: [],
  65874. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  65875. }),
  65876. $globals.FileServer);
  65877. $core.addMethod(
  65878. $core.method({
  65879. selector: "password:",
  65880. protocol: "accessing",
  65881. fn: function (aPassword){
  65882. var self=this,$self=this;
  65883. $self.password=aPassword;
  65884. return self;
  65885. },
  65886. args: ["aPassword"],
  65887. source: "password: aPassword\x0a\x09password := aPassword.",
  65888. referencedClasses: [],
  65889. pragmas: [],
  65890. messageSends: []
  65891. }),
  65892. $globals.FileServer);
  65893. $core.addMethod(
  65894. $core.method({
  65895. selector: "port",
  65896. protocol: "accessing",
  65897. fn: function (){
  65898. var self=this,$self=this;
  65899. return $self.port;
  65900. },
  65901. args: [],
  65902. source: "port\x0a\x09^ port",
  65903. referencedClasses: [],
  65904. pragmas: [],
  65905. messageSends: []
  65906. }),
  65907. $globals.FileServer);
  65908. $core.addMethod(
  65909. $core.method({
  65910. selector: "port:",
  65911. protocol: "accessing",
  65912. fn: function (aNumber){
  65913. var self=this,$self=this;
  65914. $self.port=aNumber;
  65915. return self;
  65916. },
  65917. args: ["aNumber"],
  65918. source: "port: aNumber\x0a\x09port := aNumber",
  65919. referencedClasses: [],
  65920. pragmas: [],
  65921. messageSends: []
  65922. }),
  65923. $globals.FileServer);
  65924. $core.addMethod(
  65925. $core.method({
  65926. selector: "require:",
  65927. protocol: "private",
  65928. fn: function (aModuleString){
  65929. var self=this,$self=this;
  65930. return $core.withContext(function($ctx1) {
  65931. return $recv(require)._value_(aModuleString);
  65932. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString})});
  65933. },
  65934. args: ["aModuleString"],
  65935. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  65936. referencedClasses: [],
  65937. pragmas: [],
  65938. messageSends: ["value:"]
  65939. }),
  65940. $globals.FileServer);
  65941. $core.addMethod(
  65942. $core.method({
  65943. selector: "respondAuthenticationRequiredTo:",
  65944. protocol: "request handling",
  65945. fn: function (aResponse){
  65946. var self=this,$self=this;
  65947. return $core.withContext(function($ctx1) {
  65948. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  65949. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  65950. $recv(aResponse)._end();
  65951. return self;
  65952. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse})});
  65953. },
  65954. args: ["aResponse"],
  65955. 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.",
  65956. referencedClasses: [],
  65957. pragmas: [],
  65958. messageSends: ["writeHead:options:", "write:", "end"]
  65959. }),
  65960. $globals.FileServer);
  65961. $core.addMethod(
  65962. $core.method({
  65963. selector: "respondCreatedTo:",
  65964. protocol: "request handling",
  65965. fn: function (aResponse){
  65966. var self=this,$self=this;
  65967. return $core.withContext(function($ctx1) {
  65968. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  65969. $recv(aResponse)._end();
  65970. return self;
  65971. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse})});
  65972. },
  65973. args: ["aResponse"],
  65974. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  65975. referencedClasses: [],
  65976. pragmas: [],
  65977. messageSends: ["writeHead:options:", "end"]
  65978. }),
  65979. $globals.FileServer);
  65980. $core.addMethod(
  65981. $core.method({
  65982. selector: "respondDirectoryNamed:from:to:",
  65983. protocol: "request handling",
  65984. fn: function (aDirname,aUrl,aResponse){
  65985. var self=this,$self=this;
  65986. return $core.withContext(function($ctx1) {
  65987. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  65988. $2=$recv(aUrl)._pathname();
  65989. $ctx1.sendIdx["pathname"]=1;
  65990. $1=$recv($2)._endsWith_("/");
  65991. if($core.assert($1)){
  65992. $3=$recv(aDirname).__comma("index.html");
  65993. $ctx1.sendIdx[","]=1;
  65994. $self._respondFileNamed_to_($3,aResponse);
  65995. } else {
  65996. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  65997. $7=$recv(aUrl)._search();
  65998. if(($receiver = $7) == null || $receiver.a$nil){
  65999. $6="";
  66000. } else {
  66001. $6=$7;
  66002. }
  66003. $4=$recv($5).__comma($6);
  66004. $ctx1.sendIdx[","]=2;
  66005. $self._respondRedirect_to_($4,aResponse);
  66006. }
  66007. return self;
  66008. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse})});
  66009. },
  66010. args: ["aDirname", "aUrl", "aResponse"],
  66011. 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]",
  66012. referencedClasses: [],
  66013. pragmas: [],
  66014. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  66015. }),
  66016. $globals.FileServer);
  66017. $core.addMethod(
  66018. $core.method({
  66019. selector: "respondFileNamed:to:",
  66020. protocol: "request handling",
  66021. fn: function (aFilename,aResponse){
  66022. var self=this,$self=this;
  66023. var type,filename;
  66024. return $core.withContext(function($ctx1) {
  66025. var $1,$2,$3,$4;
  66026. filename=aFilename;
  66027. $recv($self.fs)._readFile_do_(filename,(function(ex,file){
  66028. return $core.withContext(function($ctx2) {
  66029. $1=$recv(ex)._notNil();
  66030. if($core.assert($1)){
  66031. $2=console;
  66032. $3=$recv(filename).__comma(" does not exist");
  66033. $ctx2.sendIdx[","]=1;
  66034. $recv($2)._log_($3);
  66035. return $self._respondNotFoundTo_(aResponse);
  66036. } else {
  66037. type=$recv($self._class())._mimeTypeFor_(filename);
  66038. $4=$recv(type).__eq("application/javascript");
  66039. if($core.assert($4)){
  66040. type=$recv(type).__comma(";charset=utf-8");
  66041. type;
  66042. }
  66043. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  66044. $recv(aResponse)._write_encoding_(file,"binary");
  66045. return $recv(aResponse)._end();
  66046. }
  66047. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  66048. }));
  66049. return self;
  66050. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename})});
  66051. },
  66052. args: ["aFilename", "aResponse"],
  66053. 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]]",
  66054. referencedClasses: [],
  66055. pragmas: [],
  66056. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  66057. }),
  66058. $globals.FileServer);
  66059. $core.addMethod(
  66060. $core.method({
  66061. selector: "respondInternalErrorTo:",
  66062. protocol: "request handling",
  66063. fn: function (aResponse){
  66064. var self=this,$self=this;
  66065. return $core.withContext(function($ctx1) {
  66066. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  66067. $recv(aResponse)._write_("500 Internal server error");
  66068. $recv(aResponse)._end();
  66069. return self;
  66070. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse})});
  66071. },
  66072. args: ["aResponse"],
  66073. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  66074. referencedClasses: [],
  66075. pragmas: [],
  66076. messageSends: ["writeHead:options:", "write:", "end"]
  66077. }),
  66078. $globals.FileServer);
  66079. $core.addMethod(
  66080. $core.method({
  66081. selector: "respondNotCreatedTo:",
  66082. protocol: "request handling",
  66083. fn: function (aResponse){
  66084. var self=this,$self=this;
  66085. return $core.withContext(function($ctx1) {
  66086. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  66087. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  66088. $recv(aResponse)._end();
  66089. return self;
  66090. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse})});
  66091. },
  66092. args: ["aResponse"],
  66093. 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.",
  66094. referencedClasses: [],
  66095. pragmas: [],
  66096. messageSends: ["writeHead:options:", "write:", "end"]
  66097. }),
  66098. $globals.FileServer);
  66099. $core.addMethod(
  66100. $core.method({
  66101. selector: "respondNotFoundTo:",
  66102. protocol: "request handling",
  66103. fn: function (aResponse){
  66104. var self=this,$self=this;
  66105. return $core.withContext(function($ctx1) {
  66106. var $2,$1;
  66107. $2=$self._fallbackPage();
  66108. $ctx1.sendIdx["fallbackPage"]=1;
  66109. $1=$recv($2)._isNil();
  66110. if(!$core.assert($1)){
  66111. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  66112. }
  66113. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  66114. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  66115. $ctx1.sendIdx["write:"]=1;
  66116. $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>");
  66117. $ctx1.sendIdx["write:"]=2;
  66118. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  66119. $ctx1.sendIdx["write:"]=3;
  66120. $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>");
  66121. $ctx1.sendIdx["write:"]=4;
  66122. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  66123. $ctx1.sendIdx["write:"]=5;
  66124. $recv(aResponse)._write_("</ul></p></body></html>");
  66125. $recv(aResponse)._end();
  66126. return self;
  66127. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse})});
  66128. },
  66129. args: ["aResponse"],
  66130. 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",
  66131. referencedClasses: [],
  66132. pragmas: [],
  66133. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  66134. }),
  66135. $globals.FileServer);
  66136. $core.addMethod(
  66137. $core.method({
  66138. selector: "respondOKTo:",
  66139. protocol: "request handling",
  66140. fn: function (aResponse){
  66141. var self=this,$self=this;
  66142. return $core.withContext(function($ctx1) {
  66143. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  66144. $recv(aResponse)._end();
  66145. return self;
  66146. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse})});
  66147. },
  66148. args: ["aResponse"],
  66149. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  66150. referencedClasses: [],
  66151. pragmas: [],
  66152. messageSends: ["writeHead:options:", "end"]
  66153. }),
  66154. $globals.FileServer);
  66155. $core.addMethod(
  66156. $core.method({
  66157. selector: "respondRedirect:to:",
  66158. protocol: "request handling",
  66159. fn: function (aString,aResponse){
  66160. var self=this,$self=this;
  66161. return $core.withContext(function($ctx1) {
  66162. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  66163. $recv(aResponse)._end();
  66164. return self;
  66165. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse})});
  66166. },
  66167. args: ["aString", "aResponse"],
  66168. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  66169. referencedClasses: [],
  66170. pragmas: [],
  66171. messageSends: ["writeHead:options:", "end"]
  66172. }),
  66173. $globals.FileServer);
  66174. $core.addMethod(
  66175. $core.method({
  66176. selector: "start",
  66177. protocol: "starting",
  66178. fn: function (){
  66179. var self=this,$self=this;
  66180. return $core.withContext(function($ctx1) {
  66181. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  66182. $self._checkDirectoryLayout();
  66183. $1=$recv($self.http)._createServer_((function(request,response){
  66184. return $core.withContext(function($ctx2) {
  66185. return $self._handleRequest_respondTo_(request,response);
  66186. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  66187. }));
  66188. $recv($1)._on_do_("error",(function(error){
  66189. return $core.withContext(function($ctx2) {
  66190. $2=console;
  66191. $3="Error starting server: ".__comma(error);
  66192. $ctx2.sendIdx[","]=1;
  66193. return $recv($2)._log_($3);
  66194. $ctx2.sendIdx["log:"]=1;
  66195. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  66196. }));
  66197. $ctx1.sendIdx["on:do:"]=1;
  66198. $recv($1)._on_do_("listening",(function(){
  66199. return $core.withContext(function($ctx2) {
  66200. $4=console;
  66201. $8=$self._host();
  66202. $ctx2.sendIdx["host"]=1;
  66203. $7="Starting file server on http://".__comma($8);
  66204. $6=$recv($7).__comma(":");
  66205. $ctx2.sendIdx[","]=3;
  66206. $10=$self._port();
  66207. $ctx2.sendIdx["port"]=1;
  66208. $9=$recv($10)._asString();
  66209. $5=$recv($6).__comma($9);
  66210. $ctx2.sendIdx[","]=2;
  66211. return $recv($4)._log_($5);
  66212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66213. }));
  66214. $recv($1)._listen_host_($self._port(),$self._host());
  66215. return self;
  66216. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  66217. },
  66218. args: [],
  66219. 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.",
  66220. referencedClasses: [],
  66221. pragmas: [],
  66222. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  66223. }),
  66224. $globals.FileServer);
  66225. $core.addMethod(
  66226. $core.method({
  66227. selector: "startOn:",
  66228. protocol: "starting",
  66229. fn: function (aPort){
  66230. var self=this,$self=this;
  66231. return $core.withContext(function($ctx1) {
  66232. $self._port_(aPort);
  66233. $self._start();
  66234. return self;
  66235. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort})});
  66236. },
  66237. args: ["aPort"],
  66238. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  66239. referencedClasses: [],
  66240. pragmas: [],
  66241. messageSends: ["port:", "start"]
  66242. }),
  66243. $globals.FileServer);
  66244. $core.addMethod(
  66245. $core.method({
  66246. selector: "username:",
  66247. protocol: "accessing",
  66248. fn: function (aUsername){
  66249. var self=this,$self=this;
  66250. $self.username=aUsername;
  66251. return self;
  66252. },
  66253. args: ["aUsername"],
  66254. source: "username: aUsername\x0a\x09username := aUsername.",
  66255. referencedClasses: [],
  66256. pragmas: [],
  66257. messageSends: []
  66258. }),
  66259. $globals.FileServer);
  66260. $core.addMethod(
  66261. $core.method({
  66262. selector: "validateBasePath",
  66263. protocol: "private",
  66264. fn: function (){
  66265. var self=this,$self=this;
  66266. return $core.withContext(function($ctx1) {
  66267. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  66268. $1=$self.fs;
  66269. $2=$self._basePath();
  66270. $ctx1.sendIdx["basePath"]=1;
  66271. $recv($1)._stat_then_($2,(function(err,stat){
  66272. return $core.withContext(function($ctx2) {
  66273. if(($receiver = err) == null || $receiver.a$nil){
  66274. $3=$recv(stat)._isDirectory();
  66275. if(!$core.assert($3)){
  66276. $4=console;
  66277. $7=$self._basePath();
  66278. $ctx2.sendIdx["basePath"]=2;
  66279. $6="Warning: --base-path parameter ".__comma($7);
  66280. $ctx2.sendIdx[","]=2;
  66281. $5=$recv($6).__comma(" is not a directory.");
  66282. $ctx2.sendIdx[","]=1;
  66283. return $recv($4)._warn_($5);
  66284. $ctx2.sendIdx["warn:"]=1;
  66285. }
  66286. } else {
  66287. $8=console;
  66288. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  66289. $ctx2.sendIdx[","]=3;
  66290. return $recv($8)._warn_($9);
  66291. }
  66292. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  66293. }));
  66294. return self;
  66295. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{})});
  66296. },
  66297. args: [],
  66298. 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.' ]].",
  66299. referencedClasses: [],
  66300. pragmas: [],
  66301. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  66302. }),
  66303. $globals.FileServer);
  66304. $core.addMethod(
  66305. $core.method({
  66306. selector: "withBasePath:",
  66307. protocol: "private",
  66308. fn: function (aBaseRelativePath){
  66309. var self=this,$self=this;
  66310. return $core.withContext(function($ctx1) {
  66311. return $recv($self.path)._join_with_($self._basePath(),aBaseRelativePath);
  66312. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath})});
  66313. },
  66314. args: ["aBaseRelativePath"],
  66315. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  66316. referencedClasses: [],
  66317. pragmas: [],
  66318. messageSends: ["join:with:", "basePath"]
  66319. }),
  66320. $globals.FileServer);
  66321. $core.addMethod(
  66322. $core.method({
  66323. selector: "writeData:toFileNamed:",
  66324. protocol: "private",
  66325. fn: function (data,aFilename){
  66326. var self=this,$self=this;
  66327. return $core.withContext(function($ctx1) {
  66328. $recv(console)._log_(aFilename);
  66329. return self;
  66330. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename})});
  66331. },
  66332. args: ["data", "aFilename"],
  66333. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  66334. referencedClasses: [],
  66335. pragmas: [],
  66336. messageSends: ["log:"]
  66337. }),
  66338. $globals.FileServer);
  66339. $core.setSlots($globals.FileServer.a$cls, ["mimeTypes"]);
  66340. $core.addMethod(
  66341. $core.method({
  66342. selector: "commandLineSwitches",
  66343. protocol: "accessing",
  66344. fn: function (){
  66345. var self=this,$self=this;
  66346. var switches;
  66347. return $core.withContext(function($ctx1) {
  66348. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  66349. return $core.withContext(function($ctx2) {
  66350. return $recv(each)._selector();
  66351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66352. }));
  66353. $ctx1.sendIdx["collect:"]=1;
  66354. switches=$recv(switches)._select_((function(each){
  66355. return $core.withContext(function($ctx2) {
  66356. return $recv(each)._match_("^[^:]*:$");
  66357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  66358. }));
  66359. switches=$recv(switches)._collect_((function(each){
  66360. return $core.withContext(function($ctx2) {
  66361. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  66362. $ctx2.sendIdx["replace:with:"]=1;
  66363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  66364. }));
  66365. return switches;
  66366. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  66367. },
  66368. args: [],
  66369. 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",
  66370. referencedClasses: [],
  66371. pragmas: [],
  66372. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  66373. }),
  66374. $globals.FileServer.a$cls);
  66375. $core.addMethod(
  66376. $core.method({
  66377. selector: "createServerWithArguments:",
  66378. protocol: "initialization",
  66379. fn: function (options){
  66380. var self=this,$self=this;
  66381. var server,popFront,front,optionName,optionValue,switches;
  66382. return $core.withContext(function($ctx1) {
  66383. var $1,$2,$3,$4,$5,$6,$7,$8;
  66384. var $early={};
  66385. try {
  66386. switches=$self._commandLineSwitches();
  66387. server=$self._new();
  66388. $recv(options)._ifEmpty_((function(){
  66389. throw $early=[server];
  66390. }));
  66391. $1=$recv($recv(options)._size())._even();
  66392. if(!$core.assert($1)){
  66393. $recv(console)._log_("Using default parameters.");
  66394. $ctx1.sendIdx["log:"]=1;
  66395. $2=console;
  66396. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  66397. $ctx1.sendIdx[","]=1;
  66398. $recv($2)._log_($3);
  66399. $ctx1.sendIdx["log:"]=2;
  66400. $4=console;
  66401. $5="Use any of the following ones: ".__comma(switches);
  66402. $ctx1.sendIdx[","]=2;
  66403. $recv($4)._log_($5);
  66404. $ctx1.sendIdx["log:"]=3;
  66405. return server;
  66406. }
  66407. popFront=(function(args){
  66408. return $core.withContext(function($ctx2) {
  66409. front=$recv(args)._first();
  66410. $recv(args)._remove_(front);
  66411. return front;
  66412. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  66413. });
  66414. $recv((function(){
  66415. return $core.withContext(function($ctx2) {
  66416. return $recv(options)._notEmpty();
  66417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  66418. }))._whileTrue_((function(){
  66419. return $core.withContext(function($ctx2) {
  66420. optionName=$recv(popFront)._value_(options);
  66421. $ctx2.sendIdx["value:"]=1;
  66422. optionValue=$recv(popFront)._value_(options);
  66423. $6=$recv(switches)._includes_(optionName);
  66424. if($core.assert($6)){
  66425. optionName=$self._selectorForCommandLineSwitch_(optionName);
  66426. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  66427. } else {
  66428. $7=console;
  66429. $8=$recv(optionName).__comma(" is not a valid commandline option");
  66430. $ctx2.sendIdx[","]=3;
  66431. $recv($7)._log_($8);
  66432. $ctx2.sendIdx["log:"]=4;
  66433. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  66434. }
  66435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  66436. }));
  66437. return server;
  66438. }
  66439. catch(e) {if(e===$early)return e[0]; throw e}
  66440. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches})});
  66441. },
  66442. args: ["options"],
  66443. 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.",
  66444. referencedClasses: ["Array"],
  66445. pragmas: [],
  66446. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  66447. }),
  66448. $globals.FileServer.a$cls);
  66449. $core.addMethod(
  66450. $core.method({
  66451. selector: "defaultBasePath",
  66452. protocol: "accessing",
  66453. fn: function (){
  66454. var self=this,$self=this;
  66455. return "./";
  66456. },
  66457. args: [],
  66458. source: "defaultBasePath\x0a\x09^ './'",
  66459. referencedClasses: [],
  66460. pragmas: [],
  66461. messageSends: []
  66462. }),
  66463. $globals.FileServer.a$cls);
  66464. $core.addMethod(
  66465. $core.method({
  66466. selector: "defaultHost",
  66467. protocol: "accessing",
  66468. fn: function (){
  66469. var self=this,$self=this;
  66470. return "127.0.0.1";
  66471. },
  66472. args: [],
  66473. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  66474. referencedClasses: [],
  66475. pragmas: [],
  66476. messageSends: []
  66477. }),
  66478. $globals.FileServer.a$cls);
  66479. $core.addMethod(
  66480. $core.method({
  66481. selector: "defaultMimeTypes",
  66482. protocol: "accessing",
  66483. fn: function (){
  66484. var self=this,$self=this;
  66485. 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"]);
  66486. },
  66487. args: [],
  66488. 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}",
  66489. referencedClasses: [],
  66490. pragmas: [],
  66491. messageSends: []
  66492. }),
  66493. $globals.FileServer.a$cls);
  66494. $core.addMethod(
  66495. $core.method({
  66496. selector: "defaultPort",
  66497. protocol: "accessing",
  66498. fn: function (){
  66499. var self=this,$self=this;
  66500. return (4000);
  66501. },
  66502. args: [],
  66503. source: "defaultPort\x0a\x09^ 4000",
  66504. referencedClasses: [],
  66505. pragmas: [],
  66506. messageSends: []
  66507. }),
  66508. $globals.FileServer.a$cls);
  66509. $core.addMethod(
  66510. $core.method({
  66511. selector: "main",
  66512. protocol: "initialization",
  66513. fn: function (){
  66514. var self=this,$self=this;
  66515. var fileServer,args;
  66516. return $core.withContext(function($ctx1) {
  66517. var $1;
  66518. var $early={};
  66519. try {
  66520. args=$recv(process)._argv();
  66521. $recv(args)._removeFrom_to_((1),(3));
  66522. $recv(args)._detect_ifNone_((function(each){
  66523. return $core.withContext(function($ctx2) {
  66524. $1=$recv(each).__eq("--help");
  66525. if($core.assert($1)){
  66526. return $recv($globals.FileServer)._printHelp();
  66527. }
  66528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66529. }),(function(){
  66530. return $core.withContext(function($ctx2) {
  66531. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  66532. throw $early=[$recv(fileServer)._start()];
  66533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66534. }));
  66535. return self;
  66536. }
  66537. catch(e) {if(e===$early)return e[0]; throw e}
  66538. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args})});
  66539. },
  66540. args: [],
  66541. 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]",
  66542. referencedClasses: ["FileServer"],
  66543. pragmas: [],
  66544. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  66545. }),
  66546. $globals.FileServer.a$cls);
  66547. $core.addMethod(
  66548. $core.method({
  66549. selector: "mimeTypeFor:",
  66550. protocol: "accessing",
  66551. fn: function (aString){
  66552. var self=this,$self=this;
  66553. return $core.withContext(function($ctx1) {
  66554. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  66555. return "text/plain";
  66556. }));
  66557. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString})});
  66558. },
  66559. args: ["aString"],
  66560. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  66561. referencedClasses: [],
  66562. pragmas: [],
  66563. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  66564. }),
  66565. $globals.FileServer.a$cls);
  66566. $core.addMethod(
  66567. $core.method({
  66568. selector: "mimeTypes",
  66569. protocol: "accessing",
  66570. fn: function (){
  66571. var self=this,$self=this;
  66572. return $core.withContext(function($ctx1) {
  66573. var $1,$receiver;
  66574. $1=$self.mimeTypes;
  66575. if(($receiver = $1) == null || $receiver.a$nil){
  66576. $self.mimeTypes=$self._defaultMimeTypes();
  66577. return $self.mimeTypes;
  66578. } else {
  66579. return $1;
  66580. }
  66581. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{})});
  66582. },
  66583. args: [],
  66584. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  66585. referencedClasses: [],
  66586. pragmas: [],
  66587. messageSends: ["ifNil:", "defaultMimeTypes"]
  66588. }),
  66589. $globals.FileServer.a$cls);
  66590. $core.addMethod(
  66591. $core.method({
  66592. selector: "printHelp",
  66593. protocol: "accessing",
  66594. fn: function (){
  66595. var self=this,$self=this;
  66596. return $core.withContext(function($ctx1) {
  66597. $recv(console)._log_("Available commandline options are:");
  66598. $ctx1.sendIdx["log:"]=1;
  66599. $recv(console)._log_("--help");
  66600. $ctx1.sendIdx["log:"]=2;
  66601. $recv($self._commandLineSwitches())._do_((function(each){
  66602. return $core.withContext(function($ctx2) {
  66603. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  66604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66605. }));
  66606. return self;
  66607. }, function($ctx1) {$ctx1.fill(self,"printHelp",{})});
  66608. },
  66609. args: [],
  66610. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  66611. referencedClasses: [],
  66612. pragmas: [],
  66613. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  66614. }),
  66615. $globals.FileServer.a$cls);
  66616. $core.addMethod(
  66617. $core.method({
  66618. selector: "selectorForCommandLineSwitch:",
  66619. protocol: "accessing",
  66620. fn: function (aSwitch){
  66621. var self=this,$self=this;
  66622. return $core.withContext(function($ctx1) {
  66623. var $1;
  66624. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  66625. return $core.withContext(function($ctx2) {
  66626. return $recv($recv(each)._second())._asUppercase();
  66627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66628. }));
  66629. $ctx1.sendIdx["replace:with:"]=1;
  66630. return $recv($1).__comma(":");
  66631. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch})});
  66632. },
  66633. args: ["aSwitch"],
  66634. 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 ]), ':'",
  66635. referencedClasses: [],
  66636. pragmas: [],
  66637. messageSends: [",", "replace:with:", "asUppercase", "second"]
  66638. }),
  66639. $globals.FileServer.a$cls);
  66640. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  66641. $core.addMethod(
  66642. $core.method({
  66643. selector: "finishMessage",
  66644. protocol: "action",
  66645. fn: function (){
  66646. var self=this,$self=this;
  66647. return $core.withContext(function($ctx1) {
  66648. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  66649. $recv((function(){
  66650. }))._valueWithTimeout_((600));
  66651. return self;
  66652. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{})});
  66653. },
  66654. args: [],
  66655. 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",
  66656. referencedClasses: ["String"],
  66657. pragmas: [],
  66658. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  66659. }),
  66660. $globals.Initer);
  66661. $core.addMethod(
  66662. $core.method({
  66663. selector: "gruntInitThenDo:",
  66664. protocol: "action",
  66665. fn: function (aBlock){
  66666. var self=this,$self=this;
  66667. var child,sanitizedTemplatePath;
  66668. return $core.withContext(function($ctx1) {
  66669. var $1,$3,$2;
  66670. sanitizedTemplatePath=$recv($recv($recv($self.path)._join_with_($self.nmPath,"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  66671. $ctx1.sendIdx["replace:with:"]=1;
  66672. child=$recv($self.childProcess)._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  66673. $1=child;
  66674. $recv($1)._on_do_("error",aBlock);
  66675. $ctx1.sendIdx["on:do:"]=1;
  66676. $recv($1)._on_do_("close",(function(code){
  66677. return $core.withContext(function($ctx2) {
  66678. $3=$recv(code).__eq((0));
  66679. if($core.assert($3)){
  66680. $2=nil;
  66681. } else {
  66682. $2=code;
  66683. }
  66684. return $recv(aBlock)._value_($2);
  66685. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  66686. }));
  66687. return self;
  66688. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath})});
  66689. },
  66690. args: ["aBlock"],
  66691. 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 ]) ]",
  66692. referencedClasses: [],
  66693. pragmas: [],
  66694. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  66695. }),
  66696. $globals.Initer);
  66697. $core.addMethod(
  66698. $core.method({
  66699. selector: "initProjectThenDo:",
  66700. protocol: "action",
  66701. fn: function (aBlock){
  66702. var self=this,$self=this;
  66703. var child;
  66704. return $core.withContext(function($ctx1) {
  66705. var $1;
  66706. child=$recv($self.childProcess)._exec_thenDo_("npm run init",aBlock);
  66707. $1=$recv(child)._stdout();
  66708. $ctx1.sendIdx["stdout"]=1;
  66709. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  66710. return self;
  66711. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child})});
  66712. },
  66713. args: ["aBlock"],
  66714. 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 }",
  66715. referencedClasses: [],
  66716. pragmas: [],
  66717. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  66718. }),
  66719. $globals.Initer);
  66720. $core.addMethod(
  66721. $core.method({
  66722. selector: "initialize",
  66723. protocol: "initialization",
  66724. fn: function (){
  66725. var self=this,$self=this;
  66726. return $core.withContext(function($ctx1) {
  66727. (
  66728. $ctx1.supercall = true,
  66729. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  66730. $ctx1.supercall = false;
  66731. $self.childProcess=$recv(require)._value_("child_process");
  66732. $self.nmPath=$recv($self.path)._join_with_($self._rootDirname(),"node_modules");
  66733. return self;
  66734. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  66735. },
  66736. args: [],
  66737. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  66738. referencedClasses: [],
  66739. pragmas: [],
  66740. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  66741. }),
  66742. $globals.Initer);
  66743. $core.addMethod(
  66744. $core.method({
  66745. selector: "npmScriptForModule:named:",
  66746. protocol: "npm",
  66747. fn: function (aString,anotherString){
  66748. var self=this,$self=this;
  66749. var modulePath,packageJson,binSection,scriptPath;
  66750. return $core.withContext(function($ctx1) {
  66751. var $1,$3,$4,$2,$5;
  66752. $1=$self.path;
  66753. $3=$recv(require)._provided();
  66754. $4=$recv(aString).__comma("/package.json");
  66755. $ctx1.sendIdx[","]=1;
  66756. $2=$recv($3)._resolve_($4);
  66757. modulePath=$recv($1)._dirname_($2);
  66758. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  66759. binSection=$recv(packageJson)._at_("bin");
  66760. $ctx1.sendIdx["at:"]=1;
  66761. $5=$recv(binSection)._isString();
  66762. if($core.assert($5)){
  66763. scriptPath=binSection;
  66764. } else {
  66765. scriptPath=$recv(binSection)._at_(anotherString);
  66766. }
  66767. return $recv($self.path)._join_with_(modulePath,scriptPath);
  66768. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath})});
  66769. },
  66770. args: ["aString", "anotherString"],
  66771. 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",
  66772. referencedClasses: ["Smalltalk"],
  66773. pragmas: [],
  66774. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  66775. }),
  66776. $globals.Initer);
  66777. $core.addMethod(
  66778. $core.method({
  66779. selector: "start",
  66780. protocol: "action",
  66781. fn: function (){
  66782. var self=this,$self=this;
  66783. return $core.withContext(function($ctx1) {
  66784. var $1,$2,$receiver;
  66785. $self._gruntInitThenDo_((function(error){
  66786. return $core.withContext(function($ctx2) {
  66787. if(($receiver = error) == null || $receiver.a$nil){
  66788. return $self._initProjectThenDo_((function(error2){
  66789. return $core.withContext(function($ctx3) {
  66790. if(($receiver = error2) == null || $receiver.a$nil){
  66791. $self._finishMessage();
  66792. return $recv(process)._exit();
  66793. } else {
  66794. $2=console;
  66795. $recv($2)._log_("npm run init exec error:");
  66796. $ctx3.sendIdx["log:"]=3;
  66797. $recv($2)._log_(error2);
  66798. return $recv(process)._exit_((105));
  66799. }
  66800. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  66801. }));
  66802. } else {
  66803. $1=console;
  66804. $recv($1)._log_("grunt-init exec error:");
  66805. $ctx2.sendIdx["log:"]=1;
  66806. $recv($1)._log_(error);
  66807. $ctx2.sendIdx["log:"]=2;
  66808. return $recv(process)._exit_((101));
  66809. $ctx2.sendIdx["exit:"]=1;
  66810. }
  66811. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  66812. }));
  66813. return self;
  66814. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  66815. },
  66816. args: [],
  66817. 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 ]]]]",
  66818. referencedClasses: [],
  66819. pragmas: [],
  66820. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  66821. }),
  66822. $globals.Initer);
  66823. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  66824. $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.";
  66825. $core.addMethod(
  66826. $core.method({
  66827. selector: "addVariableNamed:to:",
  66828. protocol: "private",
  66829. fn: function (aString,anObject){
  66830. var self=this,$self=this;
  66831. var newClass,newObject;
  66832. return $core.withContext(function($ctx1) {
  66833. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  66834. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  66835. newObject=$recv(newClass)._new();
  66836. $self._setPreviousVariablesFor_from_(newObject,anObject);
  66837. return newObject;
  66838. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject})});
  66839. },
  66840. args: ["aString", "anObject"],
  66841. 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",
  66842. referencedClasses: [],
  66843. pragmas: [],
  66844. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  66845. }),
  66846. $globals.Repl);
  66847. $core.addMethod(
  66848. $core.method({
  66849. selector: "assignNewVariable:do:",
  66850. protocol: "private",
  66851. fn: function (buffer,aBlock){
  66852. var self=this,$self=this;
  66853. return $core.withContext(function($ctx1) {
  66854. var $2,$3,$1,$receiver;
  66855. return $self._parseAssignment_do_(buffer,(function(name,expr){
  66856. var varName,value;
  66857. return $core.withContext(function($ctx2) {
  66858. if(($receiver = name) == null || $receiver.a$nil){
  66859. varName=$self._nextResultName();
  66860. } else {
  66861. varName=name;
  66862. }
  66863. $self.session=$self._addVariableNamed_to_(varName,$self.session);
  66864. $recv((function(){
  66865. return $core.withContext(function($ctx3) {
  66866. $2=$recv(varName).__comma(" := ");
  66867. if(($receiver = expr) == null || $receiver.a$nil){
  66868. $3=buffer;
  66869. } else {
  66870. $3=expr;
  66871. }
  66872. $1=$recv($2).__comma($3);
  66873. $ctx3.sendIdx[","]=1;
  66874. value=$self._eval_on_($1,$self.session);
  66875. return value;
  66876. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  66877. }))._on_do_($globals.Error,(function(e){
  66878. return $core.withContext(function($ctx3) {
  66879. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  66880. value=nil;
  66881. return value;
  66882. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  66883. }));
  66884. return $recv(aBlock)._value_value_(varName,value);
  66885. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  66886. }));
  66887. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock})});
  66888. },
  66889. args: ["buffer", "aBlock"],
  66890. 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]",
  66891. referencedClasses: ["Error", "ConsoleErrorHandler"],
  66892. pragmas: [],
  66893. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  66894. }),
  66895. $globals.Repl);
  66896. $core.addMethod(
  66897. $core.method({
  66898. selector: "clearScreen",
  66899. protocol: "actions",
  66900. fn: function (){
  66901. var self=this,$self=this;
  66902. var esc,cls;
  66903. return $core.withContext(function($ctx1) {
  66904. var $1;
  66905. esc=$recv($globals.String)._fromCharCode_((27));
  66906. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  66907. $ctx1.sendIdx[","]=2;
  66908. cls=$recv($1).__comma("[0;0f");
  66909. $ctx1.sendIdx[","]=1;
  66910. $recv($recv(process)._stdout())._write_(cls);
  66911. $recv($self.interface)._prompt();
  66912. return self;
  66913. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls})});
  66914. },
  66915. args: [],
  66916. 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",
  66917. referencedClasses: ["String"],
  66918. pragmas: [],
  66919. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  66920. }),
  66921. $globals.Repl);
  66922. $core.addMethod(
  66923. $core.method({
  66924. selector: "close",
  66925. protocol: "actions",
  66926. fn: function (){
  66927. var self=this,$self=this;
  66928. return $core.withContext(function($ctx1) {
  66929. $recv($recv(process)._stdin())._destroy();
  66930. return self;
  66931. }, function($ctx1) {$ctx1.fill(self,"close",{})});
  66932. },
  66933. args: [],
  66934. source: "close\x0a\x09process stdin destroy",
  66935. referencedClasses: [],
  66936. pragmas: [],
  66937. messageSends: ["destroy", "stdin"]
  66938. }),
  66939. $globals.Repl);
  66940. $core.addMethod(
  66941. $core.method({
  66942. selector: "commands",
  66943. protocol: "accessing",
  66944. fn: function (){
  66945. var self=this,$self=this;
  66946. return $self.commands;
  66947. },
  66948. args: [],
  66949. source: "commands\x0a\x09^ commands",
  66950. referencedClasses: [],
  66951. pragmas: [],
  66952. messageSends: []
  66953. }),
  66954. $globals.Repl);
  66955. $core.addMethod(
  66956. $core.method({
  66957. selector: "createInterface",
  66958. protocol: "actions",
  66959. fn: function (){
  66960. var self=this,$self=this;
  66961. return $core.withContext(function($ctx1) {
  66962. $self.interface=$recv($self.readline)._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  66963. $recv($self.interface)._on_do_("line",(function(buffer){
  66964. return $core.withContext(function($ctx2) {
  66965. return $self._processLine_(buffer);
  66966. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  66967. }));
  66968. $ctx1.sendIdx["on:do:"]=1;
  66969. $recv($self.interface)._on_do_("close",(function(){
  66970. return $core.withContext(function($ctx2) {
  66971. return $self._close();
  66972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  66973. }));
  66974. $self._printWelcome();
  66975. $self._setupHotkeys();
  66976. $self._setPrompt();
  66977. $recv($self.interface)._prompt();
  66978. return self;
  66979. }, function($ctx1) {$ctx1.fill(self,"createInterface",{})});
  66980. },
  66981. args: [],
  66982. 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",
  66983. referencedClasses: [],
  66984. pragmas: [],
  66985. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  66986. }),
  66987. $globals.Repl);
  66988. $core.addMethod(
  66989. $core.method({
  66990. selector: "encapsulateVariable:withValue:in:",
  66991. protocol: "private",
  66992. fn: function (aString,anObject,aClass){
  66993. var self=this,$self=this;
  66994. var compiler;
  66995. return $core.withContext(function($ctx1) {
  66996. var $1,$4,$3,$2,$5,$6;
  66997. compiler=$recv($globals.Compiler)._new();
  66998. $1=compiler;
  66999. $4=$recv(aString).__comma(": anObject ^ ");
  67000. $ctx1.sendIdx[","]=3;
  67001. $3=$recv($4).__comma(aString);
  67002. $ctx1.sendIdx[","]=2;
  67003. $2=$recv($3).__comma(" := anObject");
  67004. $ctx1.sendIdx[","]=1;
  67005. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  67006. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  67007. $5=compiler;
  67008. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  67009. $ctx1.sendIdx[","]=4;
  67010. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  67011. return self;
  67012. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler})});
  67013. },
  67014. args: ["aString", "anObject", "aClass"],
  67015. 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'.",
  67016. referencedClasses: ["Compiler"],
  67017. pragmas: [],
  67018. messageSends: ["new", "install:forClass:protocol:", ","]
  67019. }),
  67020. $globals.Repl);
  67021. $core.addMethod(
  67022. $core.method({
  67023. selector: "eval:",
  67024. protocol: "actions",
  67025. fn: function (buffer){
  67026. var self=this,$self=this;
  67027. return $core.withContext(function($ctx1) {
  67028. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  67029. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer})});
  67030. },
  67031. args: ["buffer"],
  67032. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  67033. referencedClasses: ["DoIt"],
  67034. pragmas: [],
  67035. messageSends: ["eval:on:", "new"]
  67036. }),
  67037. $globals.Repl);
  67038. $core.addMethod(
  67039. $core.method({
  67040. selector: "eval:on:",
  67041. protocol: "actions",
  67042. fn: function (buffer,anObject){
  67043. var self=this,$self=this;
  67044. var result;
  67045. return $core.withContext(function($ctx1) {
  67046. var $1;
  67047. $recv(buffer)._ifNotEmpty_((function(){
  67048. return $core.withContext(function($ctx2) {
  67049. return $recv((function(){
  67050. return $core.withContext(function($ctx3) {
  67051. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  67052. return result;
  67053. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  67054. }))._tryCatch_((function(e){
  67055. return $core.withContext(function($ctx3) {
  67056. $1=$recv(e)._isSmalltalkError();
  67057. if($core.assert($1)){
  67058. return $recv(e)._pass();
  67059. } else {
  67060. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  67061. }
  67062. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  67063. }));
  67064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67065. }));
  67066. return result;
  67067. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result})});
  67068. },
  67069. args: ["buffer", "anObject"],
  67070. 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",
  67071. referencedClasses: ["Compiler"],
  67072. pragmas: [],
  67073. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  67074. }),
  67075. $globals.Repl);
  67076. $core.addMethod(
  67077. $core.method({
  67078. selector: "executeCommand:",
  67079. protocol: "private",
  67080. fn: function (aString){
  67081. var self=this,$self=this;
  67082. return $core.withContext(function($ctx1) {
  67083. var $1;
  67084. var $early={};
  67085. try {
  67086. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  67087. return $core.withContext(function($ctx2) {
  67088. $1=$recv(names)._includes_(aString);
  67089. if($core.assert($1)){
  67090. $recv(cmd)._value();
  67091. throw $early=[true];
  67092. }
  67093. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  67094. }));
  67095. return false;
  67096. }
  67097. catch(e) {if(e===$early)return e[0]; throw e}
  67098. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString})});
  67099. },
  67100. args: ["aString"],
  67101. 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",
  67102. referencedClasses: [],
  67103. pragmas: [],
  67104. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  67105. }),
  67106. $globals.Repl);
  67107. $core.addMethod(
  67108. $core.method({
  67109. selector: "initialize",
  67110. protocol: "initialization",
  67111. fn: function (){
  67112. var self=this,$self=this;
  67113. return $core.withContext(function($ctx1) {
  67114. (
  67115. $ctx1.supercall = true,
  67116. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  67117. $ctx1.supercall = false;
  67118. $self.session=$recv($globals.DoIt)._new();
  67119. $self.readline=$recv(require)._value_("readline");
  67120. $ctx1.sendIdx["value:"]=1;
  67121. $self.util=$recv(require)._value_("util");
  67122. $self._setupCommands();
  67123. return self;
  67124. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  67125. },
  67126. args: [],
  67127. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  67128. referencedClasses: ["DoIt"],
  67129. pragmas: [],
  67130. messageSends: ["initialize", "new", "value:", "setupCommands"]
  67131. }),
  67132. $globals.Repl);
  67133. $core.addMethod(
  67134. $core.method({
  67135. selector: "instanceVariableNamesFor:",
  67136. protocol: "private",
  67137. fn: function (aClass){
  67138. var self=this,$self=this;
  67139. return $core.withContext(function($ctx1) {
  67140. var $1,$2,$receiver;
  67141. $1=$recv(aClass)._superclass();
  67142. $ctx1.sendIdx["superclass"]=1;
  67143. if(($receiver = $1) == null || $receiver.a$nil){
  67144. return $recv(aClass)._instanceVariableNames();
  67145. } else {
  67146. $2=$recv(aClass)._instanceVariableNames();
  67147. $ctx1.sendIdx["instanceVariableNames"]=1;
  67148. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  67149. }
  67150. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass})});
  67151. },
  67152. args: ["aClass"],
  67153. 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]",
  67154. referencedClasses: [],
  67155. pragmas: [],
  67156. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  67157. }),
  67158. $globals.Repl);
  67159. $core.addMethod(
  67160. $core.method({
  67161. selector: "isIdentifier:",
  67162. protocol: "private",
  67163. fn: function (aString){
  67164. var self=this,$self=this;
  67165. return $core.withContext(function($ctx1) {
  67166. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  67167. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString})});
  67168. },
  67169. args: ["aString"],
  67170. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  67171. referencedClasses: [],
  67172. pragmas: [],
  67173. messageSends: ["match:", "asRegexp"]
  67174. }),
  67175. $globals.Repl);
  67176. $core.addMethod(
  67177. $core.method({
  67178. selector: "isVariableDefined:",
  67179. protocol: "private",
  67180. fn: function (aString){
  67181. var self=this,$self=this;
  67182. return $core.withContext(function($ctx1) {
  67183. return $recv($self._instanceVariableNamesFor_($recv($self.session)._class()))._includes_(aString);
  67184. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString})});
  67185. },
  67186. args: ["aString"],
  67187. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  67188. referencedClasses: [],
  67189. pragmas: [],
  67190. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  67191. }),
  67192. $globals.Repl);
  67193. $core.addMethod(
  67194. $core.method({
  67195. selector: "nextResultName",
  67196. protocol: "private",
  67197. fn: function (){
  67198. var self=this,$self=this;
  67199. return $core.withContext(function($ctx1) {
  67200. var $1,$receiver;
  67201. $1=$self.resultCount;
  67202. if(($receiver = $1) == null || $receiver.a$nil){
  67203. $self.resultCount=(1);
  67204. } else {
  67205. $self.resultCount=$recv($self.resultCount).__plus((1));
  67206. }
  67207. return "res".__comma($recv($self.resultCount)._asString());
  67208. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{})});
  67209. },
  67210. args: [],
  67211. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  67212. referencedClasses: [],
  67213. pragmas: [],
  67214. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  67215. }),
  67216. $globals.Repl);
  67217. $core.addMethod(
  67218. $core.method({
  67219. selector: "onKeyPress:",
  67220. protocol: "private",
  67221. fn: function (key){
  67222. var self=this,$self=this;
  67223. return $core.withContext(function($ctx1) {
  67224. var $1;
  67225. $1=$recv($recv(key)._ctrl())._and_((function(){
  67226. return $core.withContext(function($ctx2) {
  67227. return $recv($recv(key)._name()).__eq("l");
  67228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67229. }));
  67230. if($core.assert($1)){
  67231. $self._clearScreen();
  67232. }
  67233. return self;
  67234. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key})});
  67235. },
  67236. args: ["key"],
  67237. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  67238. referencedClasses: [],
  67239. pragmas: [],
  67240. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  67241. }),
  67242. $globals.Repl);
  67243. $core.addMethod(
  67244. $core.method({
  67245. selector: "parseAssignment:do:",
  67246. protocol: "private",
  67247. fn: function (aString,aBlock){
  67248. var self=this,$self=this;
  67249. var assignment;
  67250. return $core.withContext(function($ctx1) {
  67251. var $2,$1;
  67252. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  67253. return $core.withContext(function($ctx2) {
  67254. return $recv(s)._trimBoth();
  67255. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  67256. }));
  67257. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  67258. return $core.withContext(function($ctx2) {
  67259. $2=$recv(assignment)._first();
  67260. $ctx2.sendIdx["first"]=1;
  67261. return $self._isIdentifier_($2);
  67262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67263. }));
  67264. if($core.assert($1)){
  67265. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  67266. $ctx1.sendIdx["value:value:"]=1;
  67267. } else {
  67268. return $recv(aBlock)._value_value_(nil,nil);
  67269. }
  67270. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment})});
  67271. },
  67272. args: ["aString", "aBlock"],
  67273. 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 ]",
  67274. referencedClasses: [],
  67275. pragmas: [],
  67276. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  67277. }),
  67278. $globals.Repl);
  67279. $core.addMethod(
  67280. $core.method({
  67281. selector: "presentResultNamed:withValue:",
  67282. protocol: "private",
  67283. fn: function (varName,value){
  67284. var self=this,$self=this;
  67285. return $core.withContext(function($ctx1) {
  67286. var $3,$2,$1;
  67287. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  67288. $ctx1.sendIdx[","]=3;
  67289. $2=$recv($3).__comma(" = ");
  67290. $ctx1.sendIdx[","]=2;
  67291. $1=$recv($2).__comma($recv(value)._asString());
  67292. $ctx1.sendIdx[","]=1;
  67293. $recv($globals.Transcript)._show_($1);
  67294. $recv($globals.Transcript)._cr();
  67295. $recv($self.interface)._prompt();
  67296. return self;
  67297. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value})});
  67298. },
  67299. args: ["varName", "value"],
  67300. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  67301. referencedClasses: ["Transcript"],
  67302. pragmas: [],
  67303. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  67304. }),
  67305. $globals.Repl);
  67306. $core.addMethod(
  67307. $core.method({
  67308. selector: "printWelcome",
  67309. protocol: "actions",
  67310. fn: function (){
  67311. var self=this,$self=this;
  67312. return $core.withContext(function($ctx1) {
  67313. $recv($globals.Transcript)._show_("Type :q to exit.");
  67314. $recv($globals.Transcript)._cr();
  67315. return self;
  67316. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{})});
  67317. },
  67318. args: [],
  67319. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  67320. referencedClasses: ["Transcript"],
  67321. pragmas: [],
  67322. messageSends: ["show:", "cr"]
  67323. }),
  67324. $globals.Repl);
  67325. $core.addMethod(
  67326. $core.method({
  67327. selector: "processLine:",
  67328. protocol: "private",
  67329. fn: function (buffer){
  67330. var self=this,$self=this;
  67331. var show;
  67332. return $core.withContext(function($ctx1) {
  67333. var $1,$2;
  67334. show=(function(varName,value){
  67335. return $core.withContext(function($ctx2) {
  67336. return $self._presentResultNamed_withValue_(varName,value);
  67337. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  67338. });
  67339. $1=$self._executeCommand_(buffer);
  67340. if(!$core.assert($1)){
  67341. $2=$self._isVariableDefined_(buffer);
  67342. if($core.assert($2)){
  67343. $recv(show)._value_value_(buffer,$recv($self.session)._perform_(buffer));
  67344. } else {
  67345. $self._assignNewVariable_do_(buffer,show);
  67346. }
  67347. }
  67348. return self;
  67349. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show})});
  67350. },
  67351. args: ["buffer"],
  67352. 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]]",
  67353. referencedClasses: [],
  67354. pragmas: [],
  67355. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  67356. }),
  67357. $globals.Repl);
  67358. $core.addMethod(
  67359. $core.method({
  67360. selector: "prompt",
  67361. protocol: "accessing",
  67362. fn: function (){
  67363. var self=this,$self=this;
  67364. return "amber >> ";
  67365. },
  67366. args: [],
  67367. source: "prompt\x0a\x09^ 'amber >> '",
  67368. referencedClasses: [],
  67369. pragmas: [],
  67370. messageSends: []
  67371. }),
  67372. $globals.Repl);
  67373. $core.addMethod(
  67374. $core.method({
  67375. selector: "setPreviousVariablesFor:from:",
  67376. protocol: "private",
  67377. fn: function (newObject,oldObject){
  67378. var self=this,$self=this;
  67379. return $core.withContext(function($ctx1) {
  67380. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  67381. return $core.withContext(function($ctx2) {
  67382. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  67383. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  67384. }));
  67385. return self;
  67386. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject})});
  67387. },
  67388. args: ["newObject", "oldObject"],
  67389. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  67390. referencedClasses: [],
  67391. pragmas: [],
  67392. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  67393. }),
  67394. $globals.Repl);
  67395. $core.addMethod(
  67396. $core.method({
  67397. selector: "setPrompt",
  67398. protocol: "actions",
  67399. fn: function (){
  67400. var self=this,$self=this;
  67401. return $core.withContext(function($ctx1) {
  67402. $recv($self.interface)._setPrompt_($self._prompt());
  67403. return self;
  67404. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{})});
  67405. },
  67406. args: [],
  67407. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  67408. referencedClasses: [],
  67409. pragmas: [],
  67410. messageSends: ["setPrompt:", "prompt"]
  67411. }),
  67412. $globals.Repl);
  67413. $core.addMethod(
  67414. $core.method({
  67415. selector: "setupCommands",
  67416. protocol: "initialization",
  67417. fn: function (){
  67418. var self=this,$self=this;
  67419. return $core.withContext(function($ctx1) {
  67420. var $2,$1;
  67421. $2=$recv([":q"]).__minus_gt((function(){
  67422. return $core.withContext(function($ctx2) {
  67423. return $recv(process)._exit();
  67424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67425. }));
  67426. $ctx1.sendIdx["->"]=1;
  67427. $1=[$2,$recv([""]).__minus_gt((function(){
  67428. return $core.withContext(function($ctx2) {
  67429. return $recv($self.interface)._prompt();
  67430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67431. }))];
  67432. $self.commands=$recv($globals.Dictionary)._from_($1);
  67433. return self;
  67434. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{})});
  67435. },
  67436. args: [],
  67437. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  67438. referencedClasses: ["Dictionary"],
  67439. pragmas: [],
  67440. messageSends: ["from:", "->", "exit", "prompt"]
  67441. }),
  67442. $globals.Repl);
  67443. $core.addMethod(
  67444. $core.method({
  67445. selector: "setupHotkeys",
  67446. protocol: "initialization",
  67447. fn: function (){
  67448. var self=this,$self=this;
  67449. return $core.withContext(function($ctx1) {
  67450. var $receiver;
  67451. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  67452. return $core.withContext(function($ctx2) {
  67453. if(($receiver = key) == null || $receiver.a$nil){
  67454. return key;
  67455. } else {
  67456. return $self._onKeyPress_(key);
  67457. }
  67458. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  67459. }));
  67460. return self;
  67461. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{})});
  67462. },
  67463. args: [],
  67464. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  67465. referencedClasses: [],
  67466. pragmas: [],
  67467. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  67468. }),
  67469. $globals.Repl);
  67470. $core.addMethod(
  67471. $core.method({
  67472. selector: "subclass:withVariable:",
  67473. protocol: "private",
  67474. fn: function (aClass,varName){
  67475. var self=this,$self=this;
  67476. return $core.withContext(function($ctx1) {
  67477. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  67478. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName})});
  67479. },
  67480. args: ["aClass", "varName"],
  67481. 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'",
  67482. referencedClasses: ["ClassBuilder"],
  67483. pragmas: [],
  67484. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  67485. }),
  67486. $globals.Repl);
  67487. $core.addMethod(
  67488. $core.method({
  67489. selector: "subclassNameFor:",
  67490. protocol: "private",
  67491. fn: function (aClass){
  67492. var self=this,$self=this;
  67493. return $core.withContext(function($ctx1) {
  67494. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  67495. $2=$recv(aClass)._name();
  67496. $ctx1.sendIdx["name"]=1;
  67497. $1=$recv($2)._matchesOf_("\x5cd+$");
  67498. $ctx1.sendIdx["matchesOf:"]=1;
  67499. if(($receiver = $1) == null || $receiver.a$nil){
  67500. return $recv($recv(aClass)._name()).__comma("2");
  67501. } else {
  67502. var counter;
  67503. $6=$recv(aClass)._name();
  67504. $ctx1.sendIdx["name"]=2;
  67505. $5=$recv($6)._matchesOf_("\x5cd+$");
  67506. $4=$recv($5)._first();
  67507. $3=$recv($4)._asNumber();
  67508. counter=$recv($3).__plus((1));
  67509. $7=$recv(aClass)._name();
  67510. $ctx1.sendIdx["name"]=3;
  67511. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  67512. }
  67513. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass})});
  67514. },
  67515. args: ["aClass"],
  67516. 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'].",
  67517. referencedClasses: [],
  67518. pragmas: [],
  67519. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  67520. }),
  67521. $globals.Repl);
  67522. $core.addMethod(
  67523. $core.method({
  67524. selector: "main",
  67525. protocol: "initialization",
  67526. fn: function (){
  67527. var self=this,$self=this;
  67528. return $core.withContext(function($ctx1) {
  67529. $recv($self._new())._createInterface();
  67530. return self;
  67531. }, function($ctx1) {$ctx1.fill(self,"main",{})});
  67532. },
  67533. args: [],
  67534. source: "main\x0a\x09self new createInterface",
  67535. referencedClasses: [],
  67536. pragmas: [],
  67537. messageSends: ["createInterface", "new"]
  67538. }),
  67539. $globals.Repl.a$cls);
  67540. });
  67541. (function () {
  67542. define('__app__',["amber/devel", "amber/core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  67543. amber.initialize().then(function () {
  67544. amber.globals.AmberCli._main();
  67545. });
  67546. });
  67547. }());
  67548. (function () {
  67549. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  67550. promiseLib.polyfill();
  67551. return new Promise(function (resolve, reject) {
  67552. require(["__app__"], resolve, reject);
  67553. });
  67554. });
  67555. }());
  67556. require(["app"]);
  67557. });
  67558. }((function amdefine(module, requireFn) {
  67559. 'use strict';
  67560. var defineCache = {},
  67561. loaderCache = {},
  67562. alreadyCalled = false,
  67563. path = require('path'),
  67564. makeRequire, stringRequire;
  67565. /**
  67566. * Trims the . and .. from an array of path segments.
  67567. * It will keep a leading path segment if a .. will become
  67568. * the first path segment, to help with module name lookups,
  67569. * which act like paths, but can be remapped. But the end result,
  67570. * all paths that use this function should look normalized.
  67571. * NOTE: this method MODIFIES the input array.
  67572. * @param {Array} ary the array of path segments.
  67573. */
  67574. function trimDots(ary) {
  67575. var i, part;
  67576. for (i = 0; ary[i]; i+= 1) {
  67577. part = ary[i];
  67578. if (part === '.') {
  67579. ary.splice(i, 1);
  67580. i -= 1;
  67581. } else if (part === '..') {
  67582. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  67583. //End of the line. Keep at least one non-dot
  67584. //path segment at the front so it can be mapped
  67585. //correctly to disk. Otherwise, there is likely
  67586. //no path mapping for a path starting with '..'.
  67587. //This can still fail, but catches the most reasonable
  67588. //uses of ..
  67589. break;
  67590. } else if (i > 0) {
  67591. ary.splice(i - 1, 2);
  67592. i -= 2;
  67593. }
  67594. }
  67595. }
  67596. }
  67597. function normalize(name, baseName) {
  67598. var baseParts;
  67599. //Adjust any relative paths.
  67600. if (name && name.charAt(0) === '.') {
  67601. //If have a base name, try to normalize against it,
  67602. //otherwise, assume it is a top-level require that will
  67603. //be relative to baseUrl in the end.
  67604. if (baseName) {
  67605. baseParts = baseName.split('/');
  67606. baseParts = baseParts.slice(0, baseParts.length - 1);
  67607. baseParts = baseParts.concat(name.split('/'));
  67608. trimDots(baseParts);
  67609. name = baseParts.join('/');
  67610. }
  67611. }
  67612. return name;
  67613. }
  67614. /**
  67615. * Create the normalize() function passed to a loader plugin's
  67616. * normalize method.
  67617. */
  67618. function makeNormalize(relName) {
  67619. return function (name) {
  67620. return normalize(name, relName);
  67621. };
  67622. }
  67623. function makeLoad(id) {
  67624. function load(value) {
  67625. loaderCache[id] = value;
  67626. }
  67627. load.fromText = function (id, text) {
  67628. //This one is difficult because the text can/probably uses
  67629. //define, and any relative paths and requires should be relative
  67630. //to that id was it would be found on disk. But this would require
  67631. //bootstrapping a module/require fairly deeply from node core.
  67632. //Not sure how best to go about that yet.
  67633. throw new Error('amdefine does not implement load.fromText');
  67634. };
  67635. return load;
  67636. }
  67637. makeRequire = function (systemRequire, exports, module, relId) {
  67638. function amdRequire(deps, callback) {
  67639. if (typeof deps === 'string') {
  67640. //Synchronous, single module require('')
  67641. return stringRequire(systemRequire, exports, module, deps, relId);
  67642. } else {
  67643. //Array of dependencies with a callback.
  67644. //Convert the dependencies to modules.
  67645. deps = deps.map(function (depName) {
  67646. return stringRequire(systemRequire, exports, module, depName, relId);
  67647. });
  67648. //Wait for next tick to call back the require call.
  67649. if (callback) {
  67650. process.nextTick(function () {
  67651. callback.apply(null, deps);
  67652. });
  67653. }
  67654. }
  67655. }
  67656. amdRequire.toUrl = function (filePath) {
  67657. if (filePath.indexOf('.') === 0) {
  67658. return normalize(filePath, path.dirname(module.filename));
  67659. } else {
  67660. return filePath;
  67661. }
  67662. };
  67663. return amdRequire;
  67664. };
  67665. //Favor explicit value, passed in if the module wants to support Node 0.4.
  67666. requireFn = requireFn || function req() {
  67667. return module.require.apply(module, arguments);
  67668. };
  67669. function runFactory(id, deps, factory) {
  67670. var r, e, m, result;
  67671. if (id) {
  67672. e = loaderCache[id] = {};
  67673. m = {
  67674. id: id,
  67675. uri: __filename,
  67676. exports: e
  67677. };
  67678. r = makeRequire(requireFn, e, m, id);
  67679. } else {
  67680. //Only support one define call per file
  67681. if (alreadyCalled) {
  67682. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  67683. }
  67684. alreadyCalled = true;
  67685. //Use the real variables from node
  67686. //Use module.exports for exports, since
  67687. //the exports in here is amdefine exports.
  67688. e = module.exports;
  67689. m = module;
  67690. r = makeRequire(requireFn, e, m, module.id);
  67691. }
  67692. //If there are dependencies, they are strings, so need
  67693. //to convert them to dependency values.
  67694. if (deps) {
  67695. deps = deps.map(function (depName) {
  67696. return r(depName);
  67697. });
  67698. }
  67699. //Call the factory with the right dependencies.
  67700. if (typeof factory === 'function') {
  67701. result = factory.apply(m.exports, deps);
  67702. } else {
  67703. result = factory;
  67704. }
  67705. if (result !== undefined) {
  67706. m.exports = result;
  67707. if (id) {
  67708. loaderCache[id] = m.exports;
  67709. }
  67710. }
  67711. }
  67712. stringRequire = function (systemRequire, exports, module, id, relId) {
  67713. //Split the ID by a ! so that
  67714. var index = id.indexOf('!'),
  67715. originalId = id,
  67716. prefix, plugin;
  67717. if (index === -1) {
  67718. id = normalize(id, relId);
  67719. //Straight module lookup. If it is one of the special dependencies,
  67720. //deal with it, otherwise, delegate to node.
  67721. if (id === 'require') {
  67722. return makeRequire(systemRequire, exports, module, relId);
  67723. } else if (id === 'exports') {
  67724. return exports;
  67725. } else if (id === 'module') {
  67726. return module;
  67727. } else if (loaderCache.hasOwnProperty(id)) {
  67728. return loaderCache[id];
  67729. } else if (defineCache[id]) {
  67730. runFactory.apply(null, defineCache[id]);
  67731. return loaderCache[id];
  67732. } else {
  67733. if(systemRequire) {
  67734. return systemRequire(originalId);
  67735. } else {
  67736. throw new Error('No module with ID: ' + id);
  67737. }
  67738. }
  67739. } else {
  67740. //There is a plugin in play.
  67741. prefix = id.substring(0, index);
  67742. id = id.substring(index + 1, id.length);
  67743. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  67744. if (plugin.normalize) {
  67745. id = plugin.normalize(id, makeNormalize(relId));
  67746. } else {
  67747. //Normalize the ID normally.
  67748. id = normalize(id, relId);
  67749. }
  67750. if (loaderCache[id]) {
  67751. return loaderCache[id];
  67752. } else {
  67753. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  67754. return loaderCache[id];
  67755. }
  67756. }
  67757. };
  67758. //Create a define function specific to the module asking for amdefine.
  67759. function define(id, deps, factory) {
  67760. if (Array.isArray(id)) {
  67761. factory = deps;
  67762. deps = id;
  67763. id = undefined;
  67764. } else if (typeof id !== 'string') {
  67765. factory = id;
  67766. id = deps = undefined;
  67767. }
  67768. if (deps && !Array.isArray(deps)) {
  67769. factory = deps;
  67770. deps = undefined;
  67771. }
  67772. if (!deps) {
  67773. deps = ['require', 'exports', 'module'];
  67774. }
  67775. //Set up properties for this module. If an ID, then use
  67776. //internal cache. If no ID, then use the external variables
  67777. //for this node module.
  67778. if (id) {
  67779. //Put the module in deep freeze until there is a
  67780. //require call for it.
  67781. defineCache[id] = [id, deps, factory];
  67782. } else {
  67783. runFactory(id, deps, factory);
  67784. }
  67785. }
  67786. //define.require, which has access to all the values in the
  67787. //cache. Useful for AMD modules that all have IDs in the file,
  67788. //but need to finally export a value to node based on one of those
  67789. //IDs.
  67790. define.require = function (id) {
  67791. if (loaderCache[id]) {
  67792. return loaderCache[id];
  67793. }
  67794. if (defineCache[id]) {
  67795. runFactory.apply(null, defineCache[id]);
  67796. return loaderCache[id];
  67797. }
  67798. };
  67799. define.amd = {};
  67800. return define;
  67801. }(module)), require));