amber-cli.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. // This file is used to make additional changes
  8. // when building an app to run in node.js.
  9. // Free to edit. You can break tests (cli test runner uses
  10. // this to build itself - it is a node executable).
  11. define("amber/Platform", ["amber_core/Platform-Node"], {});
  12. define("amber/compatibility", ["amber/node-compatibility"], {});
  13. define("jquery", {});
  14. define("config-node", function(){});
  15. define('amber/brikz',[], function () {
  16. return function Brikz(api, apiKey, initKey) {
  17. "use strict";
  18. //jshint eqnull:true
  19. var brikz = this,
  20. backup = {};
  21. apiKey = apiKey || 'exports';
  22. initKey = initKey || '__init__';
  23. function mixin(src, target, what) {
  24. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  25. if (src == null) {
  26. target[keys[i]] = undefined;
  27. } else {
  28. var value = src[keys[i]];
  29. if (typeof value !== "undefined") {
  30. target[keys[i]] = value;
  31. }
  32. }
  33. }
  34. return target;
  35. }
  36. Object.defineProperties(this, {
  37. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  38. });
  39. var exclude = mixin(this, {});
  40. this.rebuild = function () {
  41. Object.keys(backup).forEach(function (key) {
  42. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  43. });
  44. var oapi = mixin(api, {}),
  45. order = [],
  46. chk = {};
  47. function ensure(key) {
  48. if (key in exclude) {
  49. return null;
  50. }
  51. var b = brikz[key],
  52. bak = backup[key];
  53. mixin(null, api, api);
  54. while (typeof b === "function") {
  55. (b.deps || []).forEach(ensure);
  56. b = new b(brikz, api, bak);
  57. }
  58. brikz[key] = b;
  59. if (b && !chk[key]) {
  60. chk[key] = true;
  61. order.push(b);
  62. }
  63. if (b && !b[apiKey]) {
  64. b[apiKey] = mixin(api, {});
  65. }
  66. }
  67. Object.keys(brikz).forEach(ensure);
  68. mixin(oapi, mixin(null, api, api));
  69. order.forEach(function (brik) {
  70. mixin(brik[apiKey] || {}, api);
  71. });
  72. order.forEach(function (brik) {
  73. if (brik[initKey]) {
  74. brik[initKey]();
  75. if (brik[initKey].once) {
  76. delete brik[initKey];
  77. }
  78. }
  79. });
  80. backup = mixin(brikz, {});
  81. };
  82. };
  83. });
  84. /*!
  85. * @overview es6-promise - a tiny implementation of Promises/A+.
  86. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  87. * @license Licensed under MIT license
  88. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  89. * @version 3.3.1
  90. */
  91. (function (global, factory) {
  92. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  93. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  94. (global.ES6Promise = factory());
  95. }(this, (function () { 'use strict';
  96. function objectOrFunction(x) {
  97. return typeof x === 'function' || typeof x === 'object' && x !== null;
  98. }
  99. function isFunction(x) {
  100. return typeof x === 'function';
  101. }
  102. var _isArray = undefined;
  103. if (!Array.isArray) {
  104. _isArray = function (x) {
  105. return Object.prototype.toString.call(x) === '[object Array]';
  106. };
  107. } else {
  108. _isArray = Array.isArray;
  109. }
  110. var isArray = _isArray;
  111. var len = 0;
  112. var vertxNext = undefined;
  113. var customSchedulerFn = undefined;
  114. var asap = function asap(callback, arg) {
  115. queue[len] = callback;
  116. queue[len + 1] = arg;
  117. len += 2;
  118. if (len === 2) {
  119. // If len is 2, that means that we need to schedule an async flush.
  120. // If additional callbacks are queued before the queue is flushed, they
  121. // will be processed by this flush that we are scheduling.
  122. if (customSchedulerFn) {
  123. customSchedulerFn(flush);
  124. } else {
  125. scheduleFlush();
  126. }
  127. }
  128. };
  129. function setScheduler(scheduleFn) {
  130. customSchedulerFn = scheduleFn;
  131. }
  132. function setAsap(asapFn) {
  133. asap = asapFn;
  134. }
  135. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  136. var browserGlobal = browserWindow || {};
  137. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  138. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  139. // test for web worker but not in IE10
  140. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  141. // node
  142. function useNextTick() {
  143. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  144. // see https://github.com/cujojs/when/issues/410 for details
  145. return function () {
  146. return process.nextTick(flush);
  147. };
  148. }
  149. // vertx
  150. function useVertxTimer() {
  151. return function () {
  152. vertxNext(flush);
  153. };
  154. }
  155. function useMutationObserver() {
  156. var iterations = 0;
  157. var observer = new BrowserMutationObserver(flush);
  158. var node = document.createTextNode('');
  159. observer.observe(node, { characterData: true });
  160. return function () {
  161. node.data = iterations = ++iterations % 2;
  162. };
  163. }
  164. // web worker
  165. function useMessageChannel() {
  166. var channel = new MessageChannel();
  167. channel.port1.onmessage = flush;
  168. return function () {
  169. return channel.port2.postMessage(0);
  170. };
  171. }
  172. function useSetTimeout() {
  173. // Store setTimeout reference so es6-promise will be unaffected by
  174. // other code modifying setTimeout (like sinon.useFakeTimers())
  175. var globalSetTimeout = setTimeout;
  176. return function () {
  177. return globalSetTimeout(flush, 1);
  178. };
  179. }
  180. var queue = new Array(1000);
  181. function flush() {
  182. for (var i = 0; i < len; i += 2) {
  183. var callback = queue[i];
  184. var arg = queue[i + 1];
  185. callback(arg);
  186. queue[i] = undefined;
  187. queue[i + 1] = undefined;
  188. }
  189. len = 0;
  190. }
  191. function attemptVertx() {
  192. try {
  193. var r = require;
  194. var vertx = r('vertx');
  195. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  196. return useVertxTimer();
  197. } catch (e) {
  198. return useSetTimeout();
  199. }
  200. }
  201. var scheduleFlush = undefined;
  202. // Decide what async method to use to triggering processing of queued callbacks:
  203. if (isNode) {
  204. scheduleFlush = useNextTick();
  205. } else if (BrowserMutationObserver) {
  206. scheduleFlush = useMutationObserver();
  207. } else if (isWorker) {
  208. scheduleFlush = useMessageChannel();
  209. } else if (browserWindow === undefined && typeof require === 'function') {
  210. scheduleFlush = attemptVertx();
  211. } else {
  212. scheduleFlush = useSetTimeout();
  213. }
  214. function then(onFulfillment, onRejection) {
  215. var _arguments = arguments;
  216. var parent = this;
  217. var child = new this.constructor(noop);
  218. if (child[PROMISE_ID] === undefined) {
  219. makePromise(child);
  220. }
  221. var _state = parent._state;
  222. if (_state) {
  223. (function () {
  224. var callback = _arguments[_state - 1];
  225. asap(function () {
  226. return invokeCallback(_state, child, callback, parent._result);
  227. });
  228. })();
  229. } else {
  230. subscribe(parent, child, onFulfillment, onRejection);
  231. }
  232. return child;
  233. }
  234. /**
  235. `Promise.resolve` returns a promise that will become resolved with the
  236. passed `value`. It is shorthand for the following:
  237. ```javascript
  238. let promise = new Promise(function(resolve, reject){
  239. resolve(1);
  240. });
  241. promise.then(function(value){
  242. // value === 1
  243. });
  244. ```
  245. Instead of writing the above, your code now simply becomes the following:
  246. ```javascript
  247. let promise = Promise.resolve(1);
  248. promise.then(function(value){
  249. // value === 1
  250. });
  251. ```
  252. @method resolve
  253. @static
  254. @param {Any} value value that the returned promise will be resolved with
  255. Useful for tooling.
  256. @return {Promise} a promise that will become fulfilled with the given
  257. `value`
  258. */
  259. function resolve(object) {
  260. /*jshint validthis:true */
  261. var Constructor = this;
  262. if (object && typeof object === 'object' && object.constructor === Constructor) {
  263. return object;
  264. }
  265. var promise = new Constructor(noop);
  266. _resolve(promise, object);
  267. return promise;
  268. }
  269. var PROMISE_ID = Math.random().toString(36).substring(16);
  270. function noop() {}
  271. var PENDING = void 0;
  272. var FULFILLED = 1;
  273. var REJECTED = 2;
  274. var GET_THEN_ERROR = new ErrorObject();
  275. function selfFulfillment() {
  276. return new TypeError("You cannot resolve a promise with itself");
  277. }
  278. function cannotReturnOwn() {
  279. return new TypeError('A promises callback cannot return that same promise.');
  280. }
  281. function getThen(promise) {
  282. try {
  283. return promise.then;
  284. } catch (error) {
  285. GET_THEN_ERROR.error = error;
  286. return GET_THEN_ERROR;
  287. }
  288. }
  289. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  290. try {
  291. then.call(value, fulfillmentHandler, rejectionHandler);
  292. } catch (e) {
  293. return e;
  294. }
  295. }
  296. function handleForeignThenable(promise, thenable, then) {
  297. asap(function (promise) {
  298. var sealed = false;
  299. var error = tryThen(then, thenable, function (value) {
  300. if (sealed) {
  301. return;
  302. }
  303. sealed = true;
  304. if (thenable !== value) {
  305. _resolve(promise, value);
  306. } else {
  307. fulfill(promise, value);
  308. }
  309. }, function (reason) {
  310. if (sealed) {
  311. return;
  312. }
  313. sealed = true;
  314. _reject(promise, reason);
  315. }, 'Settle: ' + (promise._label || ' unknown promise'));
  316. if (!sealed && error) {
  317. sealed = true;
  318. _reject(promise, error);
  319. }
  320. }, promise);
  321. }
  322. function handleOwnThenable(promise, thenable) {
  323. if (thenable._state === FULFILLED) {
  324. fulfill(promise, thenable._result);
  325. } else if (thenable._state === REJECTED) {
  326. _reject(promise, thenable._result);
  327. } else {
  328. subscribe(thenable, undefined, function (value) {
  329. return _resolve(promise, value);
  330. }, function (reason) {
  331. return _reject(promise, reason);
  332. });
  333. }
  334. }
  335. function handleMaybeThenable(promise, maybeThenable, then$$) {
  336. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  337. handleOwnThenable(promise, maybeThenable);
  338. } else {
  339. if (then$$ === GET_THEN_ERROR) {
  340. _reject(promise, GET_THEN_ERROR.error);
  341. } else if (then$$ === undefined) {
  342. fulfill(promise, maybeThenable);
  343. } else if (isFunction(then$$)) {
  344. handleForeignThenable(promise, maybeThenable, then$$);
  345. } else {
  346. fulfill(promise, maybeThenable);
  347. }
  348. }
  349. }
  350. function _resolve(promise, value) {
  351. if (promise === value) {
  352. _reject(promise, selfFulfillment());
  353. } else if (objectOrFunction(value)) {
  354. handleMaybeThenable(promise, value, getThen(value));
  355. } else {
  356. fulfill(promise, value);
  357. }
  358. }
  359. function publishRejection(promise) {
  360. if (promise._onerror) {
  361. promise._onerror(promise._result);
  362. }
  363. publish(promise);
  364. }
  365. function fulfill(promise, value) {
  366. if (promise._state !== PENDING) {
  367. return;
  368. }
  369. promise._result = value;
  370. promise._state = FULFILLED;
  371. if (promise._subscribers.length !== 0) {
  372. asap(publish, promise);
  373. }
  374. }
  375. function _reject(promise, reason) {
  376. if (promise._state !== PENDING) {
  377. return;
  378. }
  379. promise._state = REJECTED;
  380. promise._result = reason;
  381. asap(publishRejection, promise);
  382. }
  383. function subscribe(parent, child, onFulfillment, onRejection) {
  384. var _subscribers = parent._subscribers;
  385. var length = _subscribers.length;
  386. parent._onerror = null;
  387. _subscribers[length] = child;
  388. _subscribers[length + FULFILLED] = onFulfillment;
  389. _subscribers[length + REJECTED] = onRejection;
  390. if (length === 0 && parent._state) {
  391. asap(publish, parent);
  392. }
  393. }
  394. function publish(promise) {
  395. var subscribers = promise._subscribers;
  396. var settled = promise._state;
  397. if (subscribers.length === 0) {
  398. return;
  399. }
  400. var child = undefined,
  401. callback = undefined,
  402. detail = promise._result;
  403. for (var i = 0; i < subscribers.length; i += 3) {
  404. child = subscribers[i];
  405. callback = subscribers[i + settled];
  406. if (child) {
  407. invokeCallback(settled, child, callback, detail);
  408. } else {
  409. callback(detail);
  410. }
  411. }
  412. promise._subscribers.length = 0;
  413. }
  414. function ErrorObject() {
  415. this.error = null;
  416. }
  417. var TRY_CATCH_ERROR = new ErrorObject();
  418. function tryCatch(callback, detail) {
  419. try {
  420. return callback(detail);
  421. } catch (e) {
  422. TRY_CATCH_ERROR.error = e;
  423. return TRY_CATCH_ERROR;
  424. }
  425. }
  426. function invokeCallback(settled, promise, callback, detail) {
  427. var hasCallback = isFunction(callback),
  428. value = undefined,
  429. error = undefined,
  430. succeeded = undefined,
  431. failed = undefined;
  432. if (hasCallback) {
  433. value = tryCatch(callback, detail);
  434. if (value === TRY_CATCH_ERROR) {
  435. failed = true;
  436. error = value.error;
  437. value = null;
  438. } else {
  439. succeeded = true;
  440. }
  441. if (promise === value) {
  442. _reject(promise, cannotReturnOwn());
  443. return;
  444. }
  445. } else {
  446. value = detail;
  447. succeeded = true;
  448. }
  449. if (promise._state !== PENDING) {
  450. // noop
  451. } else if (hasCallback && succeeded) {
  452. _resolve(promise, value);
  453. } else if (failed) {
  454. _reject(promise, error);
  455. } else if (settled === FULFILLED) {
  456. fulfill(promise, value);
  457. } else if (settled === REJECTED) {
  458. _reject(promise, value);
  459. }
  460. }
  461. function initializePromise(promise, resolver) {
  462. try {
  463. resolver(function resolvePromise(value) {
  464. _resolve(promise, value);
  465. }, function rejectPromise(reason) {
  466. _reject(promise, reason);
  467. });
  468. } catch (e) {
  469. _reject(promise, e);
  470. }
  471. }
  472. var id = 0;
  473. function nextId() {
  474. return id++;
  475. }
  476. function makePromise(promise) {
  477. promise[PROMISE_ID] = id++;
  478. promise._state = undefined;
  479. promise._result = undefined;
  480. promise._subscribers = [];
  481. }
  482. function Enumerator(Constructor, input) {
  483. this._instanceConstructor = Constructor;
  484. this.promise = new Constructor(noop);
  485. if (!this.promise[PROMISE_ID]) {
  486. makePromise(this.promise);
  487. }
  488. if (isArray(input)) {
  489. this._input = input;
  490. this.length = input.length;
  491. this._remaining = input.length;
  492. this._result = new Array(this.length);
  493. if (this.length === 0) {
  494. fulfill(this.promise, this._result);
  495. } else {
  496. this.length = this.length || 0;
  497. this._enumerate();
  498. if (this._remaining === 0) {
  499. fulfill(this.promise, this._result);
  500. }
  501. }
  502. } else {
  503. _reject(this.promise, validationError());
  504. }
  505. }
  506. function validationError() {
  507. return new Error('Array Methods must be provided an Array');
  508. };
  509. Enumerator.prototype._enumerate = function () {
  510. var length = this.length;
  511. var _input = this._input;
  512. for (var i = 0; this._state === PENDING && i < length; i++) {
  513. this._eachEntry(_input[i], i);
  514. }
  515. };
  516. Enumerator.prototype._eachEntry = function (entry, i) {
  517. var c = this._instanceConstructor;
  518. var resolve$$ = c.resolve;
  519. if (resolve$$ === resolve) {
  520. var _then = getThen(entry);
  521. if (_then === then && entry._state !== PENDING) {
  522. this._settledAt(entry._state, i, entry._result);
  523. } else if (typeof _then !== 'function') {
  524. this._remaining--;
  525. this._result[i] = entry;
  526. } else if (c === Promise) {
  527. var promise = new c(noop);
  528. handleMaybeThenable(promise, entry, _then);
  529. this._willSettleAt(promise, i);
  530. } else {
  531. this._willSettleAt(new c(function (resolve$$) {
  532. return resolve$$(entry);
  533. }), i);
  534. }
  535. } else {
  536. this._willSettleAt(resolve$$(entry), i);
  537. }
  538. };
  539. Enumerator.prototype._settledAt = function (state, i, value) {
  540. var promise = this.promise;
  541. if (promise._state === PENDING) {
  542. this._remaining--;
  543. if (state === REJECTED) {
  544. _reject(promise, value);
  545. } else {
  546. this._result[i] = value;
  547. }
  548. }
  549. if (this._remaining === 0) {
  550. fulfill(promise, this._result);
  551. }
  552. };
  553. Enumerator.prototype._willSettleAt = function (promise, i) {
  554. var enumerator = this;
  555. subscribe(promise, undefined, function (value) {
  556. return enumerator._settledAt(FULFILLED, i, value);
  557. }, function (reason) {
  558. return enumerator._settledAt(REJECTED, i, reason);
  559. });
  560. };
  561. /**
  562. `Promise.all` accepts an array of promises, and returns a new promise which
  563. is fulfilled with an array of fulfillment values for the passed promises, or
  564. rejected with the reason of the first passed promise to be rejected. It casts all
  565. elements of the passed iterable to promises as it runs this algorithm.
  566. Example:
  567. ```javascript
  568. let promise1 = resolve(1);
  569. let promise2 = resolve(2);
  570. let promise3 = resolve(3);
  571. let promises = [ promise1, promise2, promise3 ];
  572. Promise.all(promises).then(function(array){
  573. // The array here would be [ 1, 2, 3 ];
  574. });
  575. ```
  576. If any of the `promises` given to `all` are rejected, the first promise
  577. that is rejected will be given as an argument to the returned promises's
  578. rejection handler. For example:
  579. Example:
  580. ```javascript
  581. let promise1 = resolve(1);
  582. let promise2 = reject(new Error("2"));
  583. let promise3 = reject(new Error("3"));
  584. let promises = [ promise1, promise2, promise3 ];
  585. Promise.all(promises).then(function(array){
  586. // Code here never runs because there are rejected promises!
  587. }, function(error) {
  588. // error.message === "2"
  589. });
  590. ```
  591. @method all
  592. @static
  593. @param {Array} entries array of promises
  594. @param {String} label optional string for labeling the promise.
  595. Useful for tooling.
  596. @return {Promise} promise that is fulfilled when all `promises` have been
  597. fulfilled, or rejected if any of them become rejected.
  598. @static
  599. */
  600. function all(entries) {
  601. return new Enumerator(this, entries).promise;
  602. }
  603. /**
  604. `Promise.race` returns a new promise which is settled in the same way as the
  605. first passed promise to settle.
  606. Example:
  607. ```javascript
  608. let promise1 = new Promise(function(resolve, reject){
  609. setTimeout(function(){
  610. resolve('promise 1');
  611. }, 200);
  612. });
  613. let promise2 = new Promise(function(resolve, reject){
  614. setTimeout(function(){
  615. resolve('promise 2');
  616. }, 100);
  617. });
  618. Promise.race([promise1, promise2]).then(function(result){
  619. // result === 'promise 2' because it was resolved before promise1
  620. // was resolved.
  621. });
  622. ```
  623. `Promise.race` is deterministic in that only the state of the first
  624. settled promise matters. For example, even if other promises given to the
  625. `promises` array argument are resolved, but the first settled promise has
  626. become rejected before the other promises became fulfilled, the returned
  627. promise will become rejected:
  628. ```javascript
  629. let promise1 = new Promise(function(resolve, reject){
  630. setTimeout(function(){
  631. resolve('promise 1');
  632. }, 200);
  633. });
  634. let promise2 = new Promise(function(resolve, reject){
  635. setTimeout(function(){
  636. reject(new Error('promise 2'));
  637. }, 100);
  638. });
  639. Promise.race([promise1, promise2]).then(function(result){
  640. // Code here never runs
  641. }, function(reason){
  642. // reason.message === 'promise 2' because promise 2 became rejected before
  643. // promise 1 became fulfilled
  644. });
  645. ```
  646. An example real-world use case is implementing timeouts:
  647. ```javascript
  648. Promise.race([ajax('foo.json'), timeout(5000)])
  649. ```
  650. @method race
  651. @static
  652. @param {Array} promises array of promises to observe
  653. Useful for tooling.
  654. @return {Promise} a promise which settles in the same way as the first passed
  655. promise to settle.
  656. */
  657. function race(entries) {
  658. /*jshint validthis:true */
  659. var Constructor = this;
  660. if (!isArray(entries)) {
  661. return new Constructor(function (_, reject) {
  662. return reject(new TypeError('You must pass an array to race.'));
  663. });
  664. } else {
  665. return new Constructor(function (resolve, reject) {
  666. var length = entries.length;
  667. for (var i = 0; i < length; i++) {
  668. Constructor.resolve(entries[i]).then(resolve, reject);
  669. }
  670. });
  671. }
  672. }
  673. /**
  674. `Promise.reject` returns a promise rejected with the passed `reason`.
  675. It is shorthand for the following:
  676. ```javascript
  677. let promise = new Promise(function(resolve, reject){
  678. reject(new Error('WHOOPS'));
  679. });
  680. promise.then(function(value){
  681. // Code here doesn't run because the promise is rejected!
  682. }, function(reason){
  683. // reason.message === 'WHOOPS'
  684. });
  685. ```
  686. Instead of writing the above, your code now simply becomes the following:
  687. ```javascript
  688. let promise = Promise.reject(new Error('WHOOPS'));
  689. promise.then(function(value){
  690. // Code here doesn't run because the promise is rejected!
  691. }, function(reason){
  692. // reason.message === 'WHOOPS'
  693. });
  694. ```
  695. @method reject
  696. @static
  697. @param {Any} reason value that the returned promise will be rejected with.
  698. Useful for tooling.
  699. @return {Promise} a promise rejected with the given `reason`.
  700. */
  701. function reject(reason) {
  702. /*jshint validthis:true */
  703. var Constructor = this;
  704. var promise = new Constructor(noop);
  705. _reject(promise, reason);
  706. return promise;
  707. }
  708. function needsResolver() {
  709. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  710. }
  711. function needsNew() {
  712. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  713. }
  714. /**
  715. Promise objects represent the eventual result of an asynchronous operation. The
  716. primary way of interacting with a promise is through its `then` method, which
  717. registers callbacks to receive either a promise's eventual value or the reason
  718. why the promise cannot be fulfilled.
  719. Terminology
  720. -----------
  721. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  722. - `thenable` is an object or function that defines a `then` method.
  723. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  724. - `exception` is a value that is thrown using the throw statement.
  725. - `reason` is a value that indicates why a promise was rejected.
  726. - `settled` the final resting state of a promise, fulfilled or rejected.
  727. A promise can be in one of three states: pending, fulfilled, or rejected.
  728. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  729. state. Promises that are rejected have a rejection reason and are in the
  730. rejected state. A fulfillment value is never a thenable.
  731. Promises can also be said to *resolve* a value. If this value is also a
  732. promise, then the original promise's settled state will match the value's
  733. settled state. So a promise that *resolves* a promise that rejects will
  734. itself reject, and a promise that *resolves* a promise that fulfills will
  735. itself fulfill.
  736. Basic Usage:
  737. ------------
  738. ```js
  739. let promise = new Promise(function(resolve, reject) {
  740. // on success
  741. resolve(value);
  742. // on failure
  743. reject(reason);
  744. });
  745. promise.then(function(value) {
  746. // on fulfillment
  747. }, function(reason) {
  748. // on rejection
  749. });
  750. ```
  751. Advanced Usage:
  752. ---------------
  753. Promises shine when abstracting away asynchronous interactions such as
  754. `XMLHttpRequest`s.
  755. ```js
  756. function getJSON(url) {
  757. return new Promise(function(resolve, reject){
  758. let xhr = new XMLHttpRequest();
  759. xhr.open('GET', url);
  760. xhr.onreadystatechange = handler;
  761. xhr.responseType = 'json';
  762. xhr.setRequestHeader('Accept', 'application/json');
  763. xhr.send();
  764. function handler() {
  765. if (this.readyState === this.DONE) {
  766. if (this.status === 200) {
  767. resolve(this.response);
  768. } else {
  769. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  770. }
  771. }
  772. };
  773. });
  774. }
  775. getJSON('/posts.json').then(function(json) {
  776. // on fulfillment
  777. }, function(reason) {
  778. // on rejection
  779. });
  780. ```
  781. Unlike callbacks, promises are great composable primitives.
  782. ```js
  783. Promise.all([
  784. getJSON('/posts'),
  785. getJSON('/comments')
  786. ]).then(function(values){
  787. values[0] // => postsJSON
  788. values[1] // => commentsJSON
  789. return values;
  790. });
  791. ```
  792. @class Promise
  793. @param {function} resolver
  794. Useful for tooling.
  795. @constructor
  796. */
  797. function Promise(resolver) {
  798. this[PROMISE_ID] = nextId();
  799. this._result = this._state = undefined;
  800. this._subscribers = [];
  801. if (noop !== resolver) {
  802. typeof resolver !== 'function' && needsResolver();
  803. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  804. }
  805. }
  806. Promise.all = all;
  807. Promise.race = race;
  808. Promise.resolve = resolve;
  809. Promise.reject = reject;
  810. Promise._setScheduler = setScheduler;
  811. Promise._setAsap = setAsap;
  812. Promise._asap = asap;
  813. Promise.prototype = {
  814. constructor: Promise,
  815. /**
  816. The primary way of interacting with a promise is through its `then` method,
  817. which registers callbacks to receive either a promise's eventual value or the
  818. reason why the promise cannot be fulfilled.
  819. ```js
  820. findUser().then(function(user){
  821. // user is available
  822. }, function(reason){
  823. // user is unavailable, and you are given the reason why
  824. });
  825. ```
  826. Chaining
  827. --------
  828. The return value of `then` is itself a promise. This second, 'downstream'
  829. promise is resolved with the return value of the first promise's fulfillment
  830. or rejection handler, or rejected if the handler throws an exception.
  831. ```js
  832. findUser().then(function (user) {
  833. return user.name;
  834. }, function (reason) {
  835. return 'default name';
  836. }).then(function (userName) {
  837. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  838. // will be `'default name'`
  839. });
  840. findUser().then(function (user) {
  841. throw new Error('Found user, but still unhappy');
  842. }, function (reason) {
  843. throw new Error('`findUser` rejected and we're unhappy');
  844. }).then(function (value) {
  845. // never reached
  846. }, function (reason) {
  847. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  848. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  849. });
  850. ```
  851. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  852. ```js
  853. findUser().then(function (user) {
  854. throw new PedagogicalException('Upstream error');
  855. }).then(function (value) {
  856. // never reached
  857. }).then(function (value) {
  858. // never reached
  859. }, function (reason) {
  860. // The `PedgagocialException` is propagated all the way down to here
  861. });
  862. ```
  863. Assimilation
  864. ------------
  865. Sometimes the value you want to propagate to a downstream promise can only be
  866. retrieved asynchronously. This can be achieved by returning a promise in the
  867. fulfillment or rejection handler. The downstream promise will then be pending
  868. until the returned promise is settled. This is called *assimilation*.
  869. ```js
  870. findUser().then(function (user) {
  871. return findCommentsByAuthor(user);
  872. }).then(function (comments) {
  873. // The user's comments are now available
  874. });
  875. ```
  876. If the assimliated promise rejects, then the downstream promise will also reject.
  877. ```js
  878. findUser().then(function (user) {
  879. return findCommentsByAuthor(user);
  880. }).then(function (comments) {
  881. // If `findCommentsByAuthor` fulfills, we'll have the value here
  882. }, function (reason) {
  883. // If `findCommentsByAuthor` rejects, we'll have the reason here
  884. });
  885. ```
  886. Simple Example
  887. --------------
  888. Synchronous Example
  889. ```javascript
  890. let result;
  891. try {
  892. result = findResult();
  893. // success
  894. } catch(reason) {
  895. // failure
  896. }
  897. ```
  898. Errback Example
  899. ```js
  900. findResult(function(result, err){
  901. if (err) {
  902. // failure
  903. } else {
  904. // success
  905. }
  906. });
  907. ```
  908. Promise Example;
  909. ```javascript
  910. findResult().then(function(result){
  911. // success
  912. }, function(reason){
  913. // failure
  914. });
  915. ```
  916. Advanced Example
  917. --------------
  918. Synchronous Example
  919. ```javascript
  920. let author, books;
  921. try {
  922. author = findAuthor();
  923. books = findBooksByAuthor(author);
  924. // success
  925. } catch(reason) {
  926. // failure
  927. }
  928. ```
  929. Errback Example
  930. ```js
  931. function foundBooks(books) {
  932. }
  933. function failure(reason) {
  934. }
  935. findAuthor(function(author, err){
  936. if (err) {
  937. failure(err);
  938. // failure
  939. } else {
  940. try {
  941. findBoooksByAuthor(author, function(books, err) {
  942. if (err) {
  943. failure(err);
  944. } else {
  945. try {
  946. foundBooks(books);
  947. } catch(reason) {
  948. failure(reason);
  949. }
  950. }
  951. });
  952. } catch(error) {
  953. failure(err);
  954. }
  955. // success
  956. }
  957. });
  958. ```
  959. Promise Example;
  960. ```javascript
  961. findAuthor().
  962. then(findBooksByAuthor).
  963. then(function(books){
  964. // found books
  965. }).catch(function(reason){
  966. // something went wrong
  967. });
  968. ```
  969. @method then
  970. @param {Function} onFulfilled
  971. @param {Function} onRejected
  972. Useful for tooling.
  973. @return {Promise}
  974. */
  975. then: then,
  976. /**
  977. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  978. as the catch block of a try/catch statement.
  979. ```js
  980. function findAuthor(){
  981. throw new Error('couldn't find that author');
  982. }
  983. // synchronous
  984. try {
  985. findAuthor();
  986. } catch(reason) {
  987. // something went wrong
  988. }
  989. // async with promises
  990. findAuthor().catch(function(reason){
  991. // something went wrong
  992. });
  993. ```
  994. @method catch
  995. @param {Function} onRejection
  996. Useful for tooling.
  997. @return {Promise}
  998. */
  999. 'catch': function _catch(onRejection) {
  1000. return this.then(null, onRejection);
  1001. }
  1002. };
  1003. function polyfill() {
  1004. var local = undefined;
  1005. if (typeof global !== 'undefined') {
  1006. local = global;
  1007. } else if (typeof self !== 'undefined') {
  1008. local = self;
  1009. } else {
  1010. try {
  1011. local = Function('return this')();
  1012. } catch (e) {
  1013. throw new Error('polyfill failed because global object is unavailable in this environment');
  1014. }
  1015. }
  1016. var P = local.Promise;
  1017. if (P) {
  1018. var promiseToString = null;
  1019. try {
  1020. promiseToString = Object.prototype.toString.call(P.resolve());
  1021. } catch (e) {
  1022. // silently ignored
  1023. }
  1024. if (promiseToString === '[object Promise]' && !P.cast) {
  1025. return;
  1026. }
  1027. }
  1028. local.Promise = Promise;
  1029. }
  1030. polyfill();
  1031. // Strange compat..
  1032. Promise.polyfill = polyfill;
  1033. Promise.Promise = Promise;
  1034. return Promise;
  1035. })));
  1036. //# sourceMappingURL=es6-promise.map;
  1037. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1038. promiseLib.polyfill();
  1039. });
  1040. // This file is injected dependencies by amber-compat-xxx modules.
  1041. // Therefore it is important that it _does_not_have_ define call.
  1042. ;
  1043. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1044. /* ====================================================================
  1045. |
  1046. | Amber Smalltalk
  1047. | http://amber-lang.net
  1048. |
  1049. ======================================================================
  1050. ======================================================================
  1051. |
  1052. | Copyright (c) 2010-2014
  1053. | Nicolas Petton <petton.nicolas@gmail.com>
  1054. |
  1055. | Copyright (c) 2012-2016
  1056. | The Amber team https://lolg.it/org/amber/members
  1057. | Amber contributors (see /CONTRIBUTORS)
  1058. |
  1059. | Amber is released under the MIT license
  1060. |
  1061. | Permission is hereby granted, free of charge, to any person obtaining
  1062. | a copy of this software and associated documentation files (the
  1063. | 'Software'), to deal in the Software without restriction, including
  1064. | without limitation the rights to use, copy, modify, merge, publish,
  1065. | distribute, sublicense, and/or sell copies of the Software, and to
  1066. | permit persons to whom the Software is furnished to do so, subject to
  1067. | the following conditions:
  1068. |
  1069. | The above copyright notice and this permission notice shall be
  1070. | included in all copies or substantial portions of the Software.
  1071. |
  1072. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1073. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1074. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1075. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1076. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1077. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1078. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1079. |
  1080. ==================================================================== */
  1081. //jshint eqnull:true
  1082. define('amber/boot',['require', './brikz', './compatibility'], function (require, Brikz) {
  1083. "use strict";
  1084. function inherits(child, parent) {
  1085. child.prototype = Object.create(parent.prototype, {
  1086. constructor: {
  1087. value: child,
  1088. enumerable: false, configurable: true, writable: true
  1089. }
  1090. });
  1091. return child;
  1092. }
  1093. function SmalltalkGlobalsBrik(brikz, st) {
  1094. // jshint evil:true
  1095. var jsGlobals = new Function("return this")();
  1096. var globals = Object.create(jsGlobals);
  1097. globals.SmalltalkSettings = {};
  1098. this.globals = globals;
  1099. }
  1100. function RootBrik(brikz, st) {
  1101. /* Smalltalk foundational objects */
  1102. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  1103. All objects including `Object` inherit from SmalltalkRoot */
  1104. function SmalltalkRoot() {
  1105. }
  1106. function SmalltalkProtoObject() {
  1107. }
  1108. function SmalltalkObject() {
  1109. }
  1110. function SmalltalkNil() {
  1111. }
  1112. inherits(SmalltalkProtoObject, SmalltalkRoot);
  1113. inherits(SmalltalkObject, SmalltalkProtoObject);
  1114. inherits(SmalltalkNil, SmalltalkObject);
  1115. this.Object = SmalltalkObject;
  1116. this.nil = new SmalltalkNil();
  1117. // Adds an `isNil` property to the `nil` object. When sending
  1118. // nil objects from one environment to another, doing
  1119. // `anObject == nil` (in JavaScript) does not always answer
  1120. // true as the referenced nil object might come from the other
  1121. // environment.
  1122. Object.defineProperty(this.nil, 'isNil', {
  1123. value: true,
  1124. enumerable: false, configurable: false, writable: false
  1125. });
  1126. // Hidden root class of the system.
  1127. // Effective superclass of all classes created with `nil subclass: ...`.
  1128. this.nilAsClass = {fn: SmalltalkRoot};
  1129. this.__init__ = function () {
  1130. var globals = brikz.smalltalkGlobals.globals;
  1131. var addCoupledClass = brikz.classes.addCoupledClass;
  1132. st.addPackage("Kernel-Objects");
  1133. addCoupledClass("ProtoObject", undefined, "Kernel-Objects", SmalltalkProtoObject);
  1134. addCoupledClass("Object", globals.ProtoObject, "Kernel-Objects", SmalltalkObject);
  1135. addCoupledClass("UndefinedObject", globals.Object, "Kernel-Objects", SmalltalkNil);
  1136. };
  1137. this.__init__.once = true;
  1138. }
  1139. OrganizeBrik.deps = ["augments", "root"];
  1140. function OrganizeBrik(brikz, st) {
  1141. var SmalltalkObject = brikz.root.Object;
  1142. function SmalltalkOrganizer() {
  1143. }
  1144. function SmalltalkPackageOrganizer() {
  1145. this.elements = [];
  1146. }
  1147. function SmalltalkClassOrganizer() {
  1148. this.elements = [];
  1149. }
  1150. inherits(SmalltalkOrganizer, SmalltalkObject);
  1151. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1152. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1153. this.__init__ = function () {
  1154. var globals = brikz.smalltalkGlobals.globals;
  1155. var addCoupledClass = brikz.classes.addCoupledClass;
  1156. st.addPackage("Kernel-Infrastructure");
  1157. addCoupledClass("Organizer", globals.Object, "Kernel-Infrastructure", SmalltalkOrganizer);
  1158. addCoupledClass("PackageOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkPackageOrganizer);
  1159. addCoupledClass("ClassOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkClassOrganizer);
  1160. };
  1161. this.__init__.once = true;
  1162. this.setupClassOrganization = function (klass) {
  1163. klass.organization = new SmalltalkClassOrganizer();
  1164. klass.organization.theClass = klass;
  1165. };
  1166. this.setupPackageOrganization = function (pkg) {
  1167. pkg.organization = new SmalltalkPackageOrganizer();
  1168. };
  1169. this.addOrganizationElement = function (owner, element) {
  1170. owner.organization.elements.addElement(element);
  1171. };
  1172. this.removeOrganizationElement = function (owner, element) {
  1173. owner.organization.elements.removeElement(element);
  1174. };
  1175. }
  1176. SelectorsBrik.deps = ["selectorConversion"];
  1177. function SelectorsBrik(brikz, st) {
  1178. var selectorSet = Object.create(null);
  1179. var selectors = this.selectors = [];
  1180. var selectorPairs = this.selectorPairs = [];
  1181. this.registerSelector = function (stSelector) {
  1182. if (selectorSet[stSelector]) return null;
  1183. var jsSelector = st.st2js(stSelector);
  1184. selectorSet[stSelector] = true;
  1185. selectors.push(stSelector);
  1186. var pair = {st: stSelector, js: jsSelector};
  1187. selectorPairs.push(pair);
  1188. return pair;
  1189. };
  1190. /* Answer all method selectors based on dnu handlers */
  1191. st.allSelectors = function () {
  1192. return selectors;
  1193. };
  1194. }
  1195. PackagesBrik.deps = ["organize", "root"];
  1196. function PackagesBrik(brikz, st) {
  1197. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1198. var SmalltalkObject = brikz.root.Object;
  1199. function SmalltalkPackage() {
  1200. }
  1201. inherits(SmalltalkPackage, SmalltalkObject);
  1202. this.__init__ = function () {
  1203. var globals = brikz.smalltalkGlobals.globals;
  1204. var addCoupledClass = brikz.classes.addCoupledClass;
  1205. st.addPackage("Kernel-Infrastructure");
  1206. addCoupledClass("Package", globals.Object, "Kernel-Infrastructure", SmalltalkPackage);
  1207. };
  1208. this.__init__.once = true;
  1209. st.packages = {};
  1210. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1211. function pkg(spec) {
  1212. var that = new SmalltalkPackage();
  1213. that.pkgName = spec.pkgName;
  1214. setupPackageOrganization(that);
  1215. that.properties = spec.properties || {};
  1216. return that;
  1217. }
  1218. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  1219. If pkgName is null or empty we return nil, which is an allowed package for a class.
  1220. If package already exists we still update the properties of it. */
  1221. st.addPackage = function (pkgName, properties) {
  1222. if (!pkgName) {
  1223. return null;
  1224. }
  1225. if (!(st.packages[pkgName])) {
  1226. st.packages[pkgName] = pkg({
  1227. pkgName: pkgName,
  1228. properties: properties
  1229. });
  1230. } else {
  1231. if (properties) {
  1232. st.packages[pkgName].properties = properties;
  1233. }
  1234. }
  1235. return st.packages[pkgName];
  1236. };
  1237. }
  1238. ClassesBrik.deps = ["organize", "root", "smalltalkGlobals"];
  1239. function ClassesBrik(brikz, st) {
  1240. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1241. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1242. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1243. var globals = brikz.smalltalkGlobals.globals;
  1244. var nilAsClass = brikz.root.nilAsClass;
  1245. var SmalltalkObject = brikz.root.Object;
  1246. nilAsClass.klass = {fn: SmalltalkClass};
  1247. function SmalltalkBehavior() {
  1248. }
  1249. function SmalltalkClass() {
  1250. }
  1251. function SmalltalkMetaclass() {
  1252. }
  1253. inherits(SmalltalkBehavior, SmalltalkObject);
  1254. inherits(SmalltalkClass, SmalltalkBehavior);
  1255. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1256. SmalltalkBehavior.prototype.toString = function () {
  1257. return 'Smalltalk ' + this.className;
  1258. };
  1259. SmalltalkMetaclass.prototype.meta = true;
  1260. this.__init__ = function () {
  1261. var globals = brikz.smalltalkGlobals.globals;
  1262. var addCoupledClass = brikz.classes.addCoupledClass;
  1263. st.addPackage("Kernel-Classes");
  1264. addCoupledClass("Behavior", globals.Object, "Kernel-Classes", SmalltalkBehavior);
  1265. addCoupledClass("Metaclass", globals.Behavior, "Kernel-Classes", SmalltalkMetaclass);
  1266. addCoupledClass("Class", globals.Behavior, "Kernel-Classes", SmalltalkClass);
  1267. // Manually bootstrap the metaclass hierarchy
  1268. globals.ProtoObject.klass.superclass = nilAsClass.klass = globals.Class;
  1269. addSubclass(globals.ProtoObject.klass);
  1270. };
  1271. this.__init__.once = true;
  1272. /* Smalltalk classes */
  1273. var classes = [];
  1274. /* Smalltalk class creation. A class is an instance of an automatically
  1275. created metaclass object. Newly created classes (not their metaclass)
  1276. should be added to the smalltalk object, see smalltalk.addClass().
  1277. Superclass linking is *not* handled here, see smalltalk.init() */
  1278. function klass(spec) {
  1279. var setSuperClass = spec.superclass;
  1280. if (!spec.superclass) {
  1281. spec.superclass = nilAsClass;
  1282. }
  1283. var meta = metaclass(spec);
  1284. var that = meta.instanceClass;
  1285. that.superclass = setSuperClass;
  1286. that.fn = spec.fn || inherits(function () {
  1287. }, spec.superclass.fn);
  1288. that.subclasses = [];
  1289. setupClass(that, spec);
  1290. that.className = spec.className;
  1291. meta.className = spec.className + ' class';
  1292. meta.superclass = spec.superclass.klass;
  1293. return that;
  1294. }
  1295. function metaclass(spec) {
  1296. var that = new SmalltalkMetaclass();
  1297. that.fn = inherits(function () {
  1298. }, spec.superclass.klass.fn);
  1299. wireKlass(that);
  1300. that.instanceClass = new that.fn();
  1301. setupClass(that, {});
  1302. return that;
  1303. }
  1304. function setupClass(klass, spec) {
  1305. klass.iVarNames = spec.iVarNames || [];
  1306. if (spec.pkg) {
  1307. klass.pkg = spec.pkg;
  1308. }
  1309. setupClassOrganization(klass);
  1310. Object.defineProperty(klass, "methods", {
  1311. value: Object.create(null),
  1312. enumerable: false, configurable: true, writable: true
  1313. });
  1314. }
  1315. function wireKlass(klass) {
  1316. Object.defineProperty(klass.fn.prototype, "klass", {
  1317. value: klass,
  1318. enumerable: false, configurable: true, writable: true
  1319. });
  1320. }
  1321. this.wireKlass = wireKlass;
  1322. /* Add a class to the smalltalk object, creating a new one if needed.
  1323. A Package is lazily created if it does not exist with given name. */
  1324. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1325. // While subclassing nil is allowed, it might be an error, so
  1326. // warn about it.
  1327. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1328. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1329. }
  1330. return rawAddClass(pkgName, className, superclass, iVarNames, null);
  1331. };
  1332. function rawAddClass(pkgName, className, superclass, iVarNames, fn) {
  1333. var pkg = st.packages[pkgName];
  1334. if (!pkg) {
  1335. throw new Error("Missing package " + pkgName);
  1336. }
  1337. if (superclass == null || superclass.isNil) {
  1338. superclass = null;
  1339. }
  1340. var theClass = globals.hasOwnProperty(className) && globals[className];
  1341. if (theClass && theClass.superclass == superclass && !fn) {
  1342. if (iVarNames) theClass.iVarNames = iVarNames;
  1343. if (pkg) theClass.pkg = pkg;
  1344. } else {
  1345. if (theClass) {
  1346. iVarNames = iVarNames || theClass.iVarNames;
  1347. st.removeClass(theClass);
  1348. }
  1349. theClass = globals[className] = klass({
  1350. className: className,
  1351. superclass: superclass,
  1352. pkg: pkg,
  1353. iVarNames: iVarNames,
  1354. fn: fn
  1355. });
  1356. addSubclass(theClass);
  1357. }
  1358. classes.addElement(theClass);
  1359. addOrganizationElement(pkg, theClass);
  1360. if (st._classAdded) st._classAdded(theClass);
  1361. return theClass;
  1362. }
  1363. st.removeClass = function (klass) {
  1364. removeOrganizationElement(klass.pkg, klass);
  1365. classes.removeElement(klass);
  1366. removeSubclass(klass);
  1367. delete globals[klass.className];
  1368. };
  1369. function addSubclass(klass) {
  1370. if (klass.superclass) {
  1371. klass.superclass.subclasses.addElement(klass);
  1372. }
  1373. }
  1374. function removeSubclass(klass) {
  1375. if (klass.superclass) {
  1376. klass.superclass.subclasses.removeElement(klass);
  1377. }
  1378. }
  1379. /* Create a new class coupling with a JavaScript constructor,
  1380. and add it to the global smalltalk object.*/
  1381. this.addCoupledClass = function (className, superclass, pkgName, fn) {
  1382. return rawAddClass(pkgName, className, superclass, null, fn);
  1383. };
  1384. /* Create an alias for an existing class */
  1385. st.alias = function (klass, alias) {
  1386. globals[alias] = klass;
  1387. };
  1388. /* Answer all registered Smalltalk classes */
  1389. //TODO: remove the function and make smalltalk.classes an array
  1390. st.classes = this.classes = function () {
  1391. return classes;
  1392. };
  1393. function metaSubclasses(metaclass) {
  1394. return metaclass.instanceClass.subclasses
  1395. .filter(function (each) {
  1396. return !each.meta;
  1397. })
  1398. .map(function (each) {
  1399. return each.klass;
  1400. });
  1401. }
  1402. st.metaSubclasses = metaSubclasses;
  1403. st.traverseClassTree = function (klass, fn) {
  1404. var queue = [klass];
  1405. for (var i = 0; i < queue.length; ++i) {
  1406. var item = queue[i];
  1407. fn(item);
  1408. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1409. queue.push.apply(queue, subclasses);
  1410. }
  1411. };
  1412. }
  1413. MethodsBrik.deps = ["organize", "selectors", "root", "selectorConversion"];
  1414. function MethodsBrik(brikz, st) {
  1415. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1416. var registerSelector = brikz.selectors.registerSelector;
  1417. var SmalltalkObject = brikz.root.Object;
  1418. function SmalltalkMethod() {
  1419. }
  1420. inherits(SmalltalkMethod, SmalltalkObject);
  1421. this.__init__ = function () {
  1422. var globals = brikz.smalltalkGlobals.globals;
  1423. var addCoupledClass = brikz.classes.addCoupledClass;
  1424. st.addPackage("Kernel-Methods");
  1425. addCoupledClass("CompiledMethod", globals.Object, "Kernel-Methods", SmalltalkMethod);
  1426. };
  1427. this.__init__.once = true;
  1428. /* Smalltalk method object. To add a method to a class,
  1429. use smalltalk.addMethod() */
  1430. st.method = function (spec) {
  1431. var that = new SmalltalkMethod();
  1432. var selector = spec.selector;
  1433. that.selector = selector;
  1434. that.jsSelector = st.st2js(selector);
  1435. that.args = spec.args || {};
  1436. that.protocol = spec.protocol;
  1437. that.source = spec.source;
  1438. that.messageSends = spec.messageSends || [];
  1439. that.referencedClasses = spec.referencedClasses || [];
  1440. that.fn = spec.fn;
  1441. return that;
  1442. };
  1443. /* Add/remove a method to/from a class */
  1444. st.addMethod = function (method, klass) {
  1445. klass.methods[method.selector] = method;
  1446. method.methodClass = klass;
  1447. // During the bootstrap, #addCompiledMethod is not used.
  1448. // Therefore we populate the organizer here too
  1449. addOrganizationElement(klass, method.protocol);
  1450. var newSelectors = [];
  1451. function selectorInUse(stSelector) {
  1452. var pair = registerSelector(stSelector);
  1453. if (pair) {
  1454. newSelectors.push(pair);
  1455. }
  1456. }
  1457. selectorInUse(method.selector);
  1458. method.messageSends.forEach(selectorInUse);
  1459. if (st._methodAdded) st._methodAdded(method, klass);
  1460. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1461. };
  1462. st.removeMethod = function (method, klass) {
  1463. if (klass !== method.methodClass) {
  1464. throw new Error(
  1465. "Refusing to remove method " +
  1466. method.methodClass.className + ">>" + method.selector +
  1467. " from different class " +
  1468. klass.className);
  1469. }
  1470. delete klass.methods[method.selector];
  1471. if (st._methodRemoved) st._methodRemoved(method, klass);
  1472. // Do *not* delete protocols from here.
  1473. // This is handled by #removeCompiledMethod
  1474. };
  1475. }
  1476. function AugmentsBrik(brikz, st) {
  1477. /* Array extensions */
  1478. Array.prototype.addElement = function (el) {
  1479. if (typeof el === 'undefined') {
  1480. return;
  1481. }
  1482. if (this.indexOf(el) == -1) {
  1483. this.push(el);
  1484. }
  1485. };
  1486. Array.prototype.removeElement = function (el) {
  1487. var i = this.indexOf(el);
  1488. if (i !== -1) {
  1489. this.splice(i, 1);
  1490. }
  1491. };
  1492. }
  1493. SmalltalkInitBrik.deps = ["globals", "classes"];
  1494. function SmalltalkInitBrik(brikz, st) {
  1495. var globals = brikz.smalltalkGlobals.globals;
  1496. var initialized = false;
  1497. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1498. require(['./kernel-runtime'], resolve, reject);
  1499. });
  1500. /* Smalltalk initialization. Called on page load */
  1501. st.initialize = function () {
  1502. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1503. if (initialized) {
  1504. return;
  1505. }
  1506. configureWithRuntime(brikz);
  1507. /* Alias definitions */
  1508. st.alias(globals.Array, "OrderedCollection");
  1509. st.alias(globals.Date, "Time");
  1510. st.classes().forEach(function (klass) {
  1511. klass._initialize();
  1512. });
  1513. initialized = true;
  1514. });
  1515. };
  1516. }
  1517. function SelectorConversionBrik(brikz, st) {
  1518. /* Convert a Smalltalk selector into a JS selector */
  1519. st.st2js = function (string) {
  1520. return '_' + string
  1521. .replace(/:/g, '_')
  1522. .replace(/[\&]/g, '_and')
  1523. .replace(/[\|]/g, '_or')
  1524. .replace(/[+]/g, '_plus')
  1525. .replace(/-/g, '_minus')
  1526. .replace(/[*]/g, '_star')
  1527. .replace(/[\/]/g, '_slash')
  1528. .replace(/[\\]/g, '_backslash')
  1529. .replace(/[\~]/g, '_tild')
  1530. .replace(/>/g, '_gt')
  1531. .replace(/</g, '_lt')
  1532. .replace(/=/g, '_eq')
  1533. .replace(/,/g, '_comma')
  1534. .replace(/[@]/g, '_at');
  1535. };
  1536. /* Convert a string to a valid smalltalk selector.
  1537. if you modify the following functions, also change st2js
  1538. accordingly */
  1539. st.js2st = function (selector) {
  1540. if (selector.match(/^__/)) {
  1541. return binaryJsToSt(selector);
  1542. } else {
  1543. return keywordJsToSt(selector);
  1544. }
  1545. };
  1546. function keywordJsToSt(selector) {
  1547. return selector.replace(/^_/, '').replace(/_/g, ':');
  1548. }
  1549. function binaryJsToSt(selector) {
  1550. return selector
  1551. .replace(/^_/, '')
  1552. .replace(/_and/g, '&')
  1553. .replace(/_or/g, '|')
  1554. .replace(/_plus/g, '+')
  1555. .replace(/_minus/g, '-')
  1556. .replace(/_star/g, '*')
  1557. .replace(/_slash/g, '/')
  1558. .replace(/_backslash/g, '\\')
  1559. .replace(/_tild/g, '~')
  1560. .replace(/_gt/g, '>')
  1561. .replace(/_lt/g, '<')
  1562. .replace(/_eq/g, '=')
  1563. .replace(/_comma/g, ',')
  1564. .replace(/_at/g, '@');
  1565. }
  1566. st.st2prop = function (stSelector) {
  1567. var colonPosition = stSelector.indexOf(':');
  1568. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1569. };
  1570. }
  1571. /* Adds AMD and requirejs related methods to the smalltalk object */
  1572. function AMDBrik(brikz, st) {
  1573. st.amdRequire = require;
  1574. st.defaultTransportType = st.defaultTransportType || "amd";
  1575. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1576. }
  1577. /* Defines asReceiver to be present at load time */
  1578. /* (logically it belongs more to PrimitiveBrik) */
  1579. AsReceiverBrik.deps = ["smalltalkGlobals", "root"];
  1580. function AsReceiverBrik(brikz, st) {
  1581. var globals = brikz.smalltalkGlobals.globals;
  1582. var nil = brikz.root.nil;
  1583. /**
  1584. * This function is used all over the compiled amber code.
  1585. * It takes any value (JavaScript or Smalltalk)
  1586. * and returns a proper Amber Smalltalk receiver.
  1587. *
  1588. * null or undefined -> nil,
  1589. * plain JS object -> wrapped JS object,
  1590. * otherwise unchanged
  1591. */
  1592. this.asReceiver = function (o) {
  1593. if (o == null) return nil;
  1594. if (typeof o === "object" || typeof o === "function") {
  1595. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  1596. }
  1597. // IMPORTANT: This optimization (return o if typeof !== "object")
  1598. // assumes all primitive types are coupled with some
  1599. // (detached root) Smalltalk class so they can be returned as-is,
  1600. // without boxing and looking for .klass.
  1601. // KEEP THE primitives-are-coupled INVARIANT!
  1602. return o;
  1603. };
  1604. }
  1605. var api = {};
  1606. var brikz = new Brikz(api);
  1607. /* Making smalltalk that can load */
  1608. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1609. brikz.root = RootBrik;
  1610. brikz.selectors = SelectorsBrik;
  1611. brikz.organize = OrganizeBrik;
  1612. brikz.selectorConversion = SelectorConversionBrik;
  1613. brikz.packages = PackagesBrik;
  1614. brikz.classes = ClassesBrik;
  1615. brikz.methods = MethodsBrik;
  1616. brikz.stInit = SmalltalkInitBrik;
  1617. brikz.augments = AugmentsBrik;
  1618. brikz.asReceiver = AsReceiverBrik;
  1619. brikz.amd = AMDBrik;
  1620. brikz.rebuild();
  1621. return {
  1622. api: api,
  1623. nil: brikz.root.nil,
  1624. dnu/* TODO deprecate */: brikz.root.nilAsClass,
  1625. nilAsClass: brikz.root.nilAsClass,
  1626. globals: brikz.smalltalkGlobals.globals,
  1627. asReceiver: brikz.asReceiver.asReceiver
  1628. };
  1629. });
  1630. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1631. var globals = boot.globals,
  1632. exports = {},
  1633. api = boot.api,
  1634. nil = boot.nil;
  1635. // API
  1636. exports.popupHelios = function () {
  1637. require(['helios/index'], function (helios) {
  1638. helios.popup();
  1639. }, function (err) {
  1640. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1641. });
  1642. };
  1643. Object.defineProperty(exports, "api", {
  1644. value: api,
  1645. enumerable: true, configurable: true, writable: false
  1646. });
  1647. Object.defineProperty(exports, "globals", {
  1648. value: globals,
  1649. enumerable: true, configurable: true, writable: false
  1650. });
  1651. Object.defineProperty(exports, "nil", {
  1652. value: nil,
  1653. enumerable: true, configurable: true, writable: false
  1654. });
  1655. function mixinToSettings(source) {
  1656. var settings = globals.SmalltalkSettings;
  1657. Object.keys(source).forEach(function (key) {
  1658. settings[key] = source[key];
  1659. });
  1660. }
  1661. function settingsInLocalStorage() {
  1662. //jshint evil:true
  1663. var global = new Function('return this')(),
  1664. storage = 'localStorage' in global && global.localStorage;
  1665. if (storage) {
  1666. var fromStorage;
  1667. try {
  1668. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1669. } catch (ex) {
  1670. // pass
  1671. }
  1672. mixinToSettings(fromStorage || {});
  1673. if (typeof window !== "undefined") {
  1674. requirejs(['jquery'], function ($) {
  1675. $(window).on('beforeunload', function () {
  1676. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1677. });
  1678. });
  1679. }
  1680. }
  1681. }
  1682. exports.initialize = function (options) {
  1683. return Promise.resolve()
  1684. .then(function () {
  1685. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1686. })
  1687. .then(settingsInLocalStorage)
  1688. .then(function () {
  1689. return options || {};
  1690. })
  1691. .then(mixinToSettings)
  1692. .then(function () {
  1693. return api.initialize();
  1694. });
  1695. };
  1696. // Exports
  1697. return exports;
  1698. });
  1699. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1700. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1701. $core.addPackage('Kernel-Objects');
  1702. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1703. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1704. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1705. $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.";
  1706. $core.addMethod(
  1707. $core.method({
  1708. selector: "=",
  1709. protocol: 'comparing',
  1710. fn: function (anObject){
  1711. var self=this;
  1712. return $core.withContext(function($ctx1) {
  1713. return self.__eq_eq(anObject);
  1714. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1715. },
  1716. args: ["anObject"],
  1717. source: "= anObject\x0a\x09^ self == anObject",
  1718. referencedClasses: [],
  1719. messageSends: ["=="]
  1720. }),
  1721. $globals.ProtoObject);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "==",
  1725. protocol: 'comparing',
  1726. fn: function (anObject){
  1727. var self=this;
  1728. return $core.withContext(function($ctx1) {
  1729. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1730. return self;
  1731. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1732. },
  1733. args: ["anObject"],
  1734. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1735. referencedClasses: [],
  1736. messageSends: []
  1737. }),
  1738. $globals.ProtoObject);
  1739. $core.addMethod(
  1740. $core.method({
  1741. selector: "asString",
  1742. protocol: 'converting',
  1743. fn: function (){
  1744. var self=this;
  1745. return $core.withContext(function($ctx1) {
  1746. return self._printString();
  1747. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1748. },
  1749. args: [],
  1750. source: "asString\x0a\x09^ self printString",
  1751. referencedClasses: [],
  1752. messageSends: ["printString"]
  1753. }),
  1754. $globals.ProtoObject);
  1755. $core.addMethod(
  1756. $core.method({
  1757. selector: "class",
  1758. protocol: 'accessing',
  1759. fn: function (){
  1760. var self=this;
  1761. return $core.withContext(function($ctx1) {
  1762. return self.klass;
  1763. return self;
  1764. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1765. },
  1766. args: [],
  1767. source: "class\x0a\x09<return self.klass>",
  1768. referencedClasses: [],
  1769. messageSends: []
  1770. }),
  1771. $globals.ProtoObject);
  1772. $core.addMethod(
  1773. $core.method({
  1774. selector: "doesNotUnderstand:",
  1775. protocol: 'error handling',
  1776. fn: function (aMessage){
  1777. var self=this;
  1778. return $core.withContext(function($ctx1) {
  1779. var $1;
  1780. $1=$recv($globals.MessageNotUnderstood)._new();
  1781. $recv($1)._receiver_(self);
  1782. $recv($1)._message_(aMessage);
  1783. $recv($1)._signal();
  1784. return self;
  1785. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1786. },
  1787. args: ["aMessage"],
  1788. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1789. referencedClasses: ["MessageNotUnderstood"],
  1790. messageSends: ["receiver:", "new", "message:", "signal"]
  1791. }),
  1792. $globals.ProtoObject);
  1793. $core.addMethod(
  1794. $core.method({
  1795. selector: "evaluate:on:",
  1796. protocol: 'evaluating',
  1797. fn: function (aString,anEvaluator){
  1798. var self=this;
  1799. return $core.withContext(function($ctx1) {
  1800. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1801. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1802. },
  1803. args: ["aString", "anEvaluator"],
  1804. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1805. referencedClasses: [],
  1806. messageSends: ["evaluate:receiver:"]
  1807. }),
  1808. $globals.ProtoObject);
  1809. $core.addMethod(
  1810. $core.method({
  1811. selector: "identityHash",
  1812. protocol: 'accessing',
  1813. fn: function (){
  1814. var self=this;
  1815. return $core.withContext(function($ctx1) {
  1816. var hash=self.identityHash;
  1817. if (hash) return hash;
  1818. hash=$core.nextId();
  1819. Object.defineProperty(self, 'identityHash', {value:hash});
  1820. return hash;
  1821. ;
  1822. return self;
  1823. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1824. },
  1825. args: [],
  1826. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1827. referencedClasses: [],
  1828. messageSends: []
  1829. }),
  1830. $globals.ProtoObject);
  1831. $core.addMethod(
  1832. $core.method({
  1833. selector: "ifNil:",
  1834. protocol: 'testing',
  1835. fn: function (aBlock){
  1836. var self=this;
  1837. return self;
  1838. },
  1839. args: ["aBlock"],
  1840. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1841. referencedClasses: [],
  1842. messageSends: []
  1843. }),
  1844. $globals.ProtoObject);
  1845. $core.addMethod(
  1846. $core.method({
  1847. selector: "ifNil:ifNotNil:",
  1848. protocol: 'testing',
  1849. fn: function (aBlock,anotherBlock){
  1850. var self=this;
  1851. return $core.withContext(function($ctx1) {
  1852. return $recv(anotherBlock)._value_(self);
  1853. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1854. },
  1855. args: ["aBlock", "anotherBlock"],
  1856. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1857. referencedClasses: [],
  1858. messageSends: ["value:"]
  1859. }),
  1860. $globals.ProtoObject);
  1861. $core.addMethod(
  1862. $core.method({
  1863. selector: "ifNotNil:",
  1864. protocol: 'testing',
  1865. fn: function (aBlock){
  1866. var self=this;
  1867. return $core.withContext(function($ctx1) {
  1868. return $recv(aBlock)._value_(self);
  1869. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1870. },
  1871. args: ["aBlock"],
  1872. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1873. referencedClasses: [],
  1874. messageSends: ["value:"]
  1875. }),
  1876. $globals.ProtoObject);
  1877. $core.addMethod(
  1878. $core.method({
  1879. selector: "ifNotNil:ifNil:",
  1880. protocol: 'testing',
  1881. fn: function (aBlock,anotherBlock){
  1882. var self=this;
  1883. return $core.withContext(function($ctx1) {
  1884. return $recv(aBlock)._value_(self);
  1885. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1886. },
  1887. args: ["aBlock", "anotherBlock"],
  1888. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1889. referencedClasses: [],
  1890. messageSends: ["value:"]
  1891. }),
  1892. $globals.ProtoObject);
  1893. $core.addMethod(
  1894. $core.method({
  1895. selector: "initialize",
  1896. protocol: 'initialization',
  1897. fn: function (){
  1898. var self=this;
  1899. return self;
  1900. },
  1901. args: [],
  1902. source: "initialize",
  1903. referencedClasses: [],
  1904. messageSends: []
  1905. }),
  1906. $globals.ProtoObject);
  1907. $core.addMethod(
  1908. $core.method({
  1909. selector: "inspect",
  1910. protocol: 'inspecting',
  1911. fn: function (){
  1912. var self=this;
  1913. return $core.withContext(function($ctx1) {
  1914. $recv($globals.Inspector)._inspect_(self);
  1915. return self;
  1916. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1917. },
  1918. args: [],
  1919. source: "inspect\x0a\x09Inspector inspect: self",
  1920. referencedClasses: ["Inspector"],
  1921. messageSends: ["inspect:"]
  1922. }),
  1923. $globals.ProtoObject);
  1924. $core.addMethod(
  1925. $core.method({
  1926. selector: "inspectOn:",
  1927. protocol: 'inspecting',
  1928. fn: function (anInspector){
  1929. var self=this;
  1930. return self;
  1931. },
  1932. args: ["anInspector"],
  1933. source: "inspectOn: anInspector",
  1934. referencedClasses: [],
  1935. messageSends: []
  1936. }),
  1937. $globals.ProtoObject);
  1938. $core.addMethod(
  1939. $core.method({
  1940. selector: "instVarAt:",
  1941. protocol: 'accessing',
  1942. fn: function (aString){
  1943. var self=this;
  1944. return $core.withContext(function($ctx1) {
  1945. return self['@'+aString] ;
  1946. return self;
  1947. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1948. },
  1949. args: ["aString"],
  1950. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1951. referencedClasses: [],
  1952. messageSends: []
  1953. }),
  1954. $globals.ProtoObject);
  1955. $core.addMethod(
  1956. $core.method({
  1957. selector: "instVarAt:put:",
  1958. protocol: 'accessing',
  1959. fn: function (aString,anObject){
  1960. var self=this;
  1961. return $core.withContext(function($ctx1) {
  1962. self['@' + aString] = anObject ;
  1963. return self;
  1964. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1965. },
  1966. args: ["aString", "anObject"],
  1967. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1968. referencedClasses: [],
  1969. messageSends: []
  1970. }),
  1971. $globals.ProtoObject);
  1972. $core.addMethod(
  1973. $core.method({
  1974. selector: "isKindOf:",
  1975. protocol: 'testing',
  1976. fn: function (aClass){
  1977. var self=this;
  1978. return $core.withContext(function($ctx1) {
  1979. var $1;
  1980. $1=self._isMemberOf_(aClass);
  1981. if($core.assert($1)){
  1982. return true;
  1983. } else {
  1984. return $recv(self._class())._inheritsFrom_(aClass);
  1985. };
  1986. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1987. },
  1988. args: ["aClass"],
  1989. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1990. referencedClasses: [],
  1991. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1992. }),
  1993. $globals.ProtoObject);
  1994. $core.addMethod(
  1995. $core.method({
  1996. selector: "isNil",
  1997. protocol: 'testing',
  1998. fn: function (){
  1999. var self=this;
  2000. return false;
  2001. },
  2002. args: [],
  2003. source: "isNil\x0a\x09^ false",
  2004. referencedClasses: [],
  2005. messageSends: []
  2006. }),
  2007. $globals.ProtoObject);
  2008. $core.addMethod(
  2009. $core.method({
  2010. selector: "isSameInstanceAs:",
  2011. protocol: 'comparing',
  2012. fn: function (anObject){
  2013. var self=this;
  2014. return $core.withContext(function($ctx1) {
  2015. var $1;
  2016. $1=self._identityHash();
  2017. $ctx1.sendIdx["identityHash"]=1;
  2018. return $recv($1).__eq($recv(anObject)._identityHash());
  2019. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2020. },
  2021. args: ["anObject"],
  2022. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2023. referencedClasses: [],
  2024. messageSends: ["=", "identityHash"]
  2025. }),
  2026. $globals.ProtoObject);
  2027. $core.addMethod(
  2028. $core.method({
  2029. selector: "notNil",
  2030. protocol: 'testing',
  2031. fn: function (){
  2032. var self=this;
  2033. return $core.withContext(function($ctx1) {
  2034. return $recv(self._isNil())._not();
  2035. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2036. },
  2037. args: [],
  2038. source: "notNil\x0a\x09^ self isNil not",
  2039. referencedClasses: [],
  2040. messageSends: ["not", "isNil"]
  2041. }),
  2042. $globals.ProtoObject);
  2043. $core.addMethod(
  2044. $core.method({
  2045. selector: "perform:",
  2046. protocol: 'message handling',
  2047. fn: function (aString){
  2048. var self=this;
  2049. return $core.withContext(function($ctx1) {
  2050. return self._perform_withArguments_(aString,[]);
  2051. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2052. },
  2053. args: ["aString"],
  2054. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2055. referencedClasses: [],
  2056. messageSends: ["perform:withArguments:"]
  2057. }),
  2058. $globals.ProtoObject);
  2059. $core.addMethod(
  2060. $core.method({
  2061. selector: "perform:withArguments:",
  2062. protocol: 'message handling',
  2063. fn: function (aString,aCollection){
  2064. var self=this;
  2065. return $core.withContext(function($ctx1) {
  2066. return $core.send2(self, aString, aCollection);
  2067. return self;
  2068. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2069. },
  2070. args: ["aString", "aCollection"],
  2071. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send2(self, aString, aCollection)>",
  2072. referencedClasses: [],
  2073. messageSends: []
  2074. }),
  2075. $globals.ProtoObject);
  2076. $core.addMethod(
  2077. $core.method({
  2078. selector: "printOn:",
  2079. protocol: 'printing',
  2080. fn: function (aStream){
  2081. var self=this;
  2082. return $core.withContext(function($ctx1) {
  2083. var $5,$4,$3,$2,$1;
  2084. $5=self._class();
  2085. $ctx1.sendIdx["class"]=1;
  2086. $4=$recv($5)._name();
  2087. $ctx1.sendIdx["name"]=1;
  2088. $3=$recv($4)._first();
  2089. $2=$recv($3)._isVowel();
  2090. if($core.assert($2)){
  2091. $1="an ";
  2092. } else {
  2093. $1="a ";
  2094. };
  2095. $recv(aStream)._nextPutAll_($1);
  2096. $ctx1.sendIdx["nextPutAll:"]=1;
  2097. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2098. return self;
  2099. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2100. },
  2101. args: ["aStream"],
  2102. 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",
  2103. referencedClasses: [],
  2104. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2105. }),
  2106. $globals.ProtoObject);
  2107. $core.addMethod(
  2108. $core.method({
  2109. selector: "printString",
  2110. protocol: 'printing',
  2111. fn: function (){
  2112. var self=this;
  2113. return $core.withContext(function($ctx1) {
  2114. return $recv($globals.String)._streamContents_((function(str){
  2115. return $core.withContext(function($ctx2) {
  2116. return self._printOn_(str);
  2117. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2118. }));
  2119. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2120. },
  2121. args: [],
  2122. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2123. referencedClasses: ["String"],
  2124. messageSends: ["streamContents:", "printOn:"]
  2125. }),
  2126. $globals.ProtoObject);
  2127. $core.addMethod(
  2128. $core.method({
  2129. selector: "yourself",
  2130. protocol: 'accessing',
  2131. fn: function (){
  2132. var self=this;
  2133. return self;
  2134. },
  2135. args: [],
  2136. source: "yourself\x0a\x09^ self",
  2137. referencedClasses: [],
  2138. messageSends: []
  2139. }),
  2140. $globals.ProtoObject);
  2141. $core.addMethod(
  2142. $core.method({
  2143. selector: "~=",
  2144. protocol: 'comparing',
  2145. fn: function (anObject){
  2146. var self=this;
  2147. return $core.withContext(function($ctx1) {
  2148. var $1;
  2149. $1=$recv(self.__eq(anObject)).__eq(false);
  2150. $ctx1.sendIdx["="]=1;
  2151. return $1;
  2152. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2153. },
  2154. args: ["anObject"],
  2155. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2156. referencedClasses: [],
  2157. messageSends: ["="]
  2158. }),
  2159. $globals.ProtoObject);
  2160. $core.addMethod(
  2161. $core.method({
  2162. selector: "~~",
  2163. protocol: 'comparing',
  2164. fn: function (anObject){
  2165. var self=this;
  2166. return $core.withContext(function($ctx1) {
  2167. return $recv(self.__eq_eq(anObject)).__eq(false);
  2168. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2169. },
  2170. args: ["anObject"],
  2171. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2172. referencedClasses: [],
  2173. messageSends: ["=", "=="]
  2174. }),
  2175. $globals.ProtoObject);
  2176. $core.addMethod(
  2177. $core.method({
  2178. selector: "initialize",
  2179. protocol: 'initialization',
  2180. fn: function (){
  2181. var self=this;
  2182. return self;
  2183. },
  2184. args: [],
  2185. source: "initialize",
  2186. referencedClasses: [],
  2187. messageSends: []
  2188. }),
  2189. $globals.ProtoObject.klass);
  2190. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  2191. $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.";
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "->",
  2195. protocol: 'converting',
  2196. fn: function (anObject){
  2197. var self=this;
  2198. return $core.withContext(function($ctx1) {
  2199. return $recv($globals.Association)._key_value_(self,anObject);
  2200. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2201. },
  2202. args: ["anObject"],
  2203. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2204. referencedClasses: ["Association"],
  2205. messageSends: ["key:value:"]
  2206. }),
  2207. $globals.Object);
  2208. $core.addMethod(
  2209. $core.method({
  2210. selector: "asJSON",
  2211. protocol: 'converting',
  2212. fn: function (){
  2213. var self=this;
  2214. var variables;
  2215. return $core.withContext(function($ctx1) {
  2216. variables=$recv($globals.HashedCollection)._new();
  2217. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2218. return $core.withContext(function($ctx2) {
  2219. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  2220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2221. }));
  2222. return variables;
  2223. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  2224. },
  2225. args: [],
  2226. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
  2227. referencedClasses: ["HashedCollection"],
  2228. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  2229. }),
  2230. $globals.Object);
  2231. $core.addMethod(
  2232. $core.method({
  2233. selector: "asJSONString",
  2234. protocol: 'converting',
  2235. fn: function (){
  2236. var self=this;
  2237. return $core.withContext(function($ctx1) {
  2238. return $recv($globals.JSON)._stringify_(self._asJSON());
  2239. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2240. },
  2241. args: [],
  2242. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  2243. referencedClasses: ["JSON"],
  2244. messageSends: ["stringify:", "asJSON"]
  2245. }),
  2246. $globals.Object);
  2247. $core.addMethod(
  2248. $core.method({
  2249. selector: "asJavascript",
  2250. protocol: 'converting',
  2251. fn: function (){
  2252. var self=this;
  2253. return $core.withContext(function($ctx1) {
  2254. return self._asString();
  2255. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  2256. },
  2257. args: [],
  2258. source: "asJavascript\x0a\x09^ self asString",
  2259. referencedClasses: [],
  2260. messageSends: ["asString"]
  2261. }),
  2262. $globals.Object);
  2263. $core.addMethod(
  2264. $core.method({
  2265. selector: "basicAt:",
  2266. protocol: 'accessing',
  2267. fn: function (aString){
  2268. var self=this;
  2269. return $core.withContext(function($ctx1) {
  2270. return self[aString];
  2271. return self;
  2272. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2273. },
  2274. args: ["aString"],
  2275. source: "basicAt: aString\x0a\x09<return self[aString]>",
  2276. referencedClasses: [],
  2277. messageSends: []
  2278. }),
  2279. $globals.Object);
  2280. $core.addMethod(
  2281. $core.method({
  2282. selector: "basicAt:put:",
  2283. protocol: 'accessing',
  2284. fn: function (aString,anObject){
  2285. var self=this;
  2286. return $core.withContext(function($ctx1) {
  2287. return self[aString] = anObject;
  2288. return self;
  2289. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2290. },
  2291. args: ["aString", "anObject"],
  2292. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  2293. referencedClasses: [],
  2294. messageSends: []
  2295. }),
  2296. $globals.Object);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "basicDelete:",
  2300. protocol: 'accessing',
  2301. fn: function (aString){
  2302. var self=this;
  2303. return $core.withContext(function($ctx1) {
  2304. delete self[aString]; return aString;
  2305. return self;
  2306. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2307. },
  2308. args: ["aString"],
  2309. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  2310. referencedClasses: [],
  2311. messageSends: []
  2312. }),
  2313. $globals.Object);
  2314. $core.addMethod(
  2315. $core.method({
  2316. selector: "basicPerform:",
  2317. protocol: 'message handling',
  2318. fn: function (aString){
  2319. var self=this;
  2320. return $core.withContext(function($ctx1) {
  2321. return self._basicPerform_withArguments_(aString,[]);
  2322. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2323. },
  2324. args: ["aString"],
  2325. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2326. referencedClasses: [],
  2327. messageSends: ["basicPerform:withArguments:"]
  2328. }),
  2329. $globals.Object);
  2330. $core.addMethod(
  2331. $core.method({
  2332. selector: "basicPerform:withArguments:",
  2333. protocol: 'message handling',
  2334. fn: function (aString,aCollection){
  2335. var self=this;
  2336. return $core.withContext(function($ctx1) {
  2337. return self[aString].apply(self, aCollection);;
  2338. return self;
  2339. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2340. },
  2341. args: ["aString", "aCollection"],
  2342. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  2343. referencedClasses: [],
  2344. messageSends: []
  2345. }),
  2346. $globals.Object);
  2347. $core.addMethod(
  2348. $core.method({
  2349. selector: "browse",
  2350. protocol: 'browsing',
  2351. fn: function (){
  2352. var self=this;
  2353. return $core.withContext(function($ctx1) {
  2354. $recv($globals.Finder)._findClass_(self._class());
  2355. return self;
  2356. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2357. },
  2358. args: [],
  2359. source: "browse\x0a\x09Finder findClass: self class",
  2360. referencedClasses: ["Finder"],
  2361. messageSends: ["findClass:", "class"]
  2362. }),
  2363. $globals.Object);
  2364. $core.addMethod(
  2365. $core.method({
  2366. selector: "copy",
  2367. protocol: 'copying',
  2368. fn: function (){
  2369. var self=this;
  2370. return $core.withContext(function($ctx1) {
  2371. return $recv(self._shallowCopy())._postCopy();
  2372. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2373. },
  2374. args: [],
  2375. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2376. referencedClasses: [],
  2377. messageSends: ["postCopy", "shallowCopy"]
  2378. }),
  2379. $globals.Object);
  2380. $core.addMethod(
  2381. $core.method({
  2382. selector: "deepCopy",
  2383. protocol: 'copying',
  2384. fn: function (){
  2385. var self=this;
  2386. return $core.withContext(function($ctx1) {
  2387. var copy = self.klass._new();
  2388. Object.keys(self).forEach(function (i) {
  2389. if(/^@.+/.test(i)) {
  2390. copy[i] = self[i]._deepCopy();
  2391. }
  2392. });
  2393. return copy;
  2394. ;
  2395. return self;
  2396. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2397. },
  2398. args: [],
  2399. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2400. referencedClasses: [],
  2401. messageSends: []
  2402. }),
  2403. $globals.Object);
  2404. $core.addMethod(
  2405. $core.method({
  2406. selector: "deprecatedAPI",
  2407. protocol: 'error handling',
  2408. fn: function (){
  2409. var self=this;
  2410. return $core.withContext(function($ctx1) {
  2411. var $1,$6,$5,$4,$8,$7,$3,$2;
  2412. $1=console;
  2413. $6=$core.getThisContext()._home();
  2414. $ctx1.sendIdx["home"]=1;
  2415. $5=$recv($6)._asString();
  2416. $ctx1.sendIdx["asString"]=1;
  2417. $4=$recv($5).__comma(" is deprecated! (in ");
  2418. $8=$recv($core.getThisContext()._home())._home();
  2419. $ctx1.sendIdx["home"]=2;
  2420. $7=$recv($8)._asString();
  2421. $3=$recv($4).__comma($7);
  2422. $ctx1.sendIdx[","]=2;
  2423. $2=$recv($3).__comma(")");
  2424. $ctx1.sendIdx[","]=1;
  2425. $recv($1)._warn_($2);
  2426. return self;
  2427. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2428. },
  2429. args: [],
  2430. 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, ')'.",
  2431. referencedClasses: [],
  2432. messageSends: ["warn:", ",", "asString", "home"]
  2433. }),
  2434. $globals.Object);
  2435. $core.addMethod(
  2436. $core.method({
  2437. selector: "deprecatedAPI:",
  2438. protocol: 'error handling',
  2439. fn: function (aString){
  2440. var self=this;
  2441. return $core.withContext(function($ctx1) {
  2442. var $1,$6,$5,$4,$8,$7,$3,$2;
  2443. $1=console;
  2444. $6=$core.getThisContext()._home();
  2445. $ctx1.sendIdx["home"]=1;
  2446. $5=$recv($6)._asString();
  2447. $ctx1.sendIdx["asString"]=1;
  2448. $4=$recv($5).__comma(" is deprecated! (in ");
  2449. $8=$recv($core.getThisContext()._home())._home();
  2450. $ctx1.sendIdx["home"]=2;
  2451. $7=$recv($8)._asString();
  2452. $3=$recv($4).__comma($7);
  2453. $ctx1.sendIdx[","]=2;
  2454. $2=$recv($3).__comma(")");
  2455. $ctx1.sendIdx[","]=1;
  2456. $recv($1)._warn_($2);
  2457. $ctx1.sendIdx["warn:"]=1;
  2458. $recv(console)._warn_(aString);
  2459. return self;
  2460. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2461. },
  2462. args: ["aString"],
  2463. 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",
  2464. referencedClasses: [],
  2465. messageSends: ["warn:", ",", "asString", "home"]
  2466. }),
  2467. $globals.Object);
  2468. $core.addMethod(
  2469. $core.method({
  2470. selector: "error:",
  2471. protocol: 'error handling',
  2472. fn: function (aString){
  2473. var self=this;
  2474. return $core.withContext(function($ctx1) {
  2475. $recv($globals.Error)._signal_(aString);
  2476. return self;
  2477. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2478. },
  2479. args: ["aString"],
  2480. source: "error: aString\x0a\x09Error signal: aString",
  2481. referencedClasses: ["Error"],
  2482. messageSends: ["signal:"]
  2483. }),
  2484. $globals.Object);
  2485. $core.addMethod(
  2486. $core.method({
  2487. selector: "halt",
  2488. protocol: 'error handling',
  2489. fn: function (){
  2490. var self=this;
  2491. return $core.withContext(function($ctx1) {
  2492. $recv($globals.Halt)._signal();
  2493. return self;
  2494. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2495. },
  2496. args: [],
  2497. source: "halt\x0a\x09Halt signal",
  2498. referencedClasses: ["Halt"],
  2499. messageSends: ["signal"]
  2500. }),
  2501. $globals.Object);
  2502. $core.addMethod(
  2503. $core.method({
  2504. selector: "in:",
  2505. protocol: 'evaluating',
  2506. fn: function (aValuable){
  2507. var self=this;
  2508. return $core.withContext(function($ctx1) {
  2509. return $recv(aValuable)._value_(self);
  2510. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2511. },
  2512. args: ["aValuable"],
  2513. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2514. referencedClasses: [],
  2515. messageSends: ["value:"]
  2516. }),
  2517. $globals.Object);
  2518. $core.addMethod(
  2519. $core.method({
  2520. selector: "isBehavior",
  2521. protocol: 'testing',
  2522. fn: function (){
  2523. var self=this;
  2524. return false;
  2525. },
  2526. args: [],
  2527. source: "isBehavior\x0a\x09^ false",
  2528. referencedClasses: [],
  2529. messageSends: []
  2530. }),
  2531. $globals.Object);
  2532. $core.addMethod(
  2533. $core.method({
  2534. selector: "isBoolean",
  2535. protocol: 'testing',
  2536. fn: function (){
  2537. var self=this;
  2538. return false;
  2539. },
  2540. args: [],
  2541. source: "isBoolean\x0a\x09^ false",
  2542. referencedClasses: [],
  2543. messageSends: []
  2544. }),
  2545. $globals.Object);
  2546. $core.addMethod(
  2547. $core.method({
  2548. selector: "isClass",
  2549. protocol: 'testing',
  2550. fn: function (){
  2551. var self=this;
  2552. return false;
  2553. },
  2554. args: [],
  2555. source: "isClass\x0a\x09^ false",
  2556. referencedClasses: [],
  2557. messageSends: []
  2558. }),
  2559. $globals.Object);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "isCompiledMethod",
  2563. protocol: 'testing',
  2564. fn: function (){
  2565. var self=this;
  2566. return false;
  2567. },
  2568. args: [],
  2569. source: "isCompiledMethod\x0a\x09^ false",
  2570. referencedClasses: [],
  2571. messageSends: []
  2572. }),
  2573. $globals.Object);
  2574. $core.addMethod(
  2575. $core.method({
  2576. selector: "isImmutable",
  2577. protocol: 'testing',
  2578. fn: function (){
  2579. var self=this;
  2580. return false;
  2581. },
  2582. args: [],
  2583. source: "isImmutable\x0a\x09^ false",
  2584. referencedClasses: [],
  2585. messageSends: []
  2586. }),
  2587. $globals.Object);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "isMemberOf:",
  2591. protocol: 'testing',
  2592. fn: function (aClass){
  2593. var self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. return $recv(self._class()).__eq(aClass);
  2596. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2597. },
  2598. args: ["aClass"],
  2599. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2600. referencedClasses: [],
  2601. messageSends: ["=", "class"]
  2602. }),
  2603. $globals.Object);
  2604. $core.addMethod(
  2605. $core.method({
  2606. selector: "isMetaclass",
  2607. protocol: 'testing',
  2608. fn: function (){
  2609. var self=this;
  2610. return false;
  2611. },
  2612. args: [],
  2613. source: "isMetaclass\x0a\x09^ false",
  2614. referencedClasses: [],
  2615. messageSends: []
  2616. }),
  2617. $globals.Object);
  2618. $core.addMethod(
  2619. $core.method({
  2620. selector: "isNumber",
  2621. protocol: 'testing',
  2622. fn: function (){
  2623. var self=this;
  2624. return false;
  2625. },
  2626. args: [],
  2627. source: "isNumber\x0a\x09^ false",
  2628. referencedClasses: [],
  2629. messageSends: []
  2630. }),
  2631. $globals.Object);
  2632. $core.addMethod(
  2633. $core.method({
  2634. selector: "isPackage",
  2635. protocol: 'testing',
  2636. fn: function (){
  2637. var self=this;
  2638. return false;
  2639. },
  2640. args: [],
  2641. source: "isPackage\x0a\x09^ false",
  2642. referencedClasses: [],
  2643. messageSends: []
  2644. }),
  2645. $globals.Object);
  2646. $core.addMethod(
  2647. $core.method({
  2648. selector: "isParseFailure",
  2649. protocol: 'testing',
  2650. fn: function (){
  2651. var self=this;
  2652. return false;
  2653. },
  2654. args: [],
  2655. source: "isParseFailure\x0a\x09^ false",
  2656. referencedClasses: [],
  2657. messageSends: []
  2658. }),
  2659. $globals.Object);
  2660. $core.addMethod(
  2661. $core.method({
  2662. selector: "isString",
  2663. protocol: 'testing',
  2664. fn: function (){
  2665. var self=this;
  2666. return false;
  2667. },
  2668. args: [],
  2669. source: "isString\x0a\x09^ false",
  2670. referencedClasses: [],
  2671. messageSends: []
  2672. }),
  2673. $globals.Object);
  2674. $core.addMethod(
  2675. $core.method({
  2676. selector: "isSymbol",
  2677. protocol: 'testing',
  2678. fn: function (){
  2679. var self=this;
  2680. return false;
  2681. },
  2682. args: [],
  2683. source: "isSymbol\x0a\x09^ false",
  2684. referencedClasses: [],
  2685. messageSends: []
  2686. }),
  2687. $globals.Object);
  2688. $core.addMethod(
  2689. $core.method({
  2690. selector: "postCopy",
  2691. protocol: 'copying',
  2692. fn: function (){
  2693. var self=this;
  2694. return self;
  2695. },
  2696. args: [],
  2697. source: "postCopy",
  2698. referencedClasses: [],
  2699. messageSends: []
  2700. }),
  2701. $globals.Object);
  2702. $core.addMethod(
  2703. $core.method({
  2704. selector: "putOn:",
  2705. protocol: 'streaming',
  2706. fn: function (aStream){
  2707. var self=this;
  2708. return $core.withContext(function($ctx1) {
  2709. $recv(aStream)._nextPut_(self);
  2710. return self;
  2711. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2712. },
  2713. args: ["aStream"],
  2714. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2715. referencedClasses: [],
  2716. messageSends: ["nextPut:"]
  2717. }),
  2718. $globals.Object);
  2719. $core.addMethod(
  2720. $core.method({
  2721. selector: "respondsTo:",
  2722. protocol: 'testing',
  2723. fn: function (aSelector){
  2724. var self=this;
  2725. return $core.withContext(function($ctx1) {
  2726. return $recv(self._class())._canUnderstand_(aSelector);
  2727. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2728. },
  2729. args: ["aSelector"],
  2730. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2731. referencedClasses: [],
  2732. messageSends: ["canUnderstand:", "class"]
  2733. }),
  2734. $globals.Object);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "shallowCopy",
  2738. protocol: 'copying',
  2739. fn: function (){
  2740. var self=this;
  2741. return $core.withContext(function($ctx1) {
  2742. var copy = self.klass._new();
  2743. Object.keys(self).forEach(function(i) {
  2744. if(/^@.+/.test(i)) {
  2745. copy[i] = self[i];
  2746. }
  2747. });
  2748. return copy;
  2749. ;
  2750. return self;
  2751. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2752. },
  2753. args: [],
  2754. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2755. referencedClasses: [],
  2756. messageSends: []
  2757. }),
  2758. $globals.Object);
  2759. $core.addMethod(
  2760. $core.method({
  2761. selector: "shouldNotImplement",
  2762. protocol: 'error handling',
  2763. fn: function (){
  2764. var self=this;
  2765. return $core.withContext(function($ctx1) {
  2766. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2767. return self;
  2768. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2769. },
  2770. args: [],
  2771. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2772. referencedClasses: [],
  2773. messageSends: ["error:", ",", "name", "class"]
  2774. }),
  2775. $globals.Object);
  2776. $core.addMethod(
  2777. $core.method({
  2778. selector: "size",
  2779. protocol: 'accessing',
  2780. fn: function (){
  2781. var self=this;
  2782. return $core.withContext(function($ctx1) {
  2783. self._error_("Object not indexable");
  2784. return self;
  2785. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2786. },
  2787. args: [],
  2788. source: "size\x0a\x09self error: 'Object not indexable'",
  2789. referencedClasses: [],
  2790. messageSends: ["error:"]
  2791. }),
  2792. $globals.Object);
  2793. $core.addMethod(
  2794. $core.method({
  2795. selector: "subclassResponsibility",
  2796. protocol: 'error handling',
  2797. fn: function (){
  2798. var self=this;
  2799. return $core.withContext(function($ctx1) {
  2800. self._error_("This method is a responsibility of a subclass");
  2801. return self;
  2802. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2803. },
  2804. args: [],
  2805. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2806. referencedClasses: [],
  2807. messageSends: ["error:"]
  2808. }),
  2809. $globals.Object);
  2810. $core.addMethod(
  2811. $core.method({
  2812. selector: "throw:",
  2813. protocol: 'error handling',
  2814. fn: function (anObject){
  2815. var self=this;
  2816. return $core.withContext(function($ctx1) {
  2817. throw anObject ;
  2818. return self;
  2819. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2820. },
  2821. args: ["anObject"],
  2822. source: "throw: anObject\x0a\x09< throw anObject >",
  2823. referencedClasses: [],
  2824. messageSends: []
  2825. }),
  2826. $globals.Object);
  2827. $core.addMethod(
  2828. $core.method({
  2829. selector: "value",
  2830. protocol: 'evaluating',
  2831. fn: function (){
  2832. var self=this;
  2833. return $core.withContext(function($ctx1) {
  2834. return self.valueOf();
  2835. return self;
  2836. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2837. },
  2838. args: [],
  2839. source: "value\x0a\x09<return self.valueOf()>",
  2840. referencedClasses: [],
  2841. messageSends: []
  2842. }),
  2843. $globals.Object);
  2844. $core.addMethod(
  2845. $core.method({
  2846. selector: "accessorProtocolWith:",
  2847. protocol: 'helios',
  2848. fn: function (aGenerator){
  2849. var self=this;
  2850. return $core.withContext(function($ctx1) {
  2851. $recv(aGenerator)._accessorProtocolForObject();
  2852. return self;
  2853. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2854. },
  2855. args: ["aGenerator"],
  2856. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2857. referencedClasses: [],
  2858. messageSends: ["accessorProtocolForObject"]
  2859. }),
  2860. $globals.Object.klass);
  2861. $core.addMethod(
  2862. $core.method({
  2863. selector: "accessorsSourceCodesWith:",
  2864. protocol: 'helios',
  2865. fn: function (aGenerator){
  2866. var self=this;
  2867. return $core.withContext(function($ctx1) {
  2868. $recv(aGenerator)._accessorsForObject();
  2869. return self;
  2870. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2871. },
  2872. args: ["aGenerator"],
  2873. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2874. referencedClasses: [],
  2875. messageSends: ["accessorsForObject"]
  2876. }),
  2877. $globals.Object.klass);
  2878. $core.addMethod(
  2879. $core.method({
  2880. selector: "initialize",
  2881. protocol: 'initialization',
  2882. fn: function (){
  2883. var self=this;
  2884. return self;
  2885. },
  2886. args: [],
  2887. source: "initialize\x0a\x09\x22no op\x22",
  2888. referencedClasses: [],
  2889. messageSends: []
  2890. }),
  2891. $globals.Object.klass);
  2892. $core.addMethod(
  2893. $core.method({
  2894. selector: "initializeProtocolWith:",
  2895. protocol: 'helios',
  2896. fn: function (aGenerator){
  2897. var self=this;
  2898. return $core.withContext(function($ctx1) {
  2899. $recv(aGenerator)._initializeProtocolForObject();
  2900. return self;
  2901. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2902. },
  2903. args: ["aGenerator"],
  2904. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2905. referencedClasses: [],
  2906. messageSends: ["initializeProtocolForObject"]
  2907. }),
  2908. $globals.Object.klass);
  2909. $core.addMethod(
  2910. $core.method({
  2911. selector: "initializeSourceCodesWith:",
  2912. protocol: 'helios',
  2913. fn: function (aGenerator){
  2914. var self=this;
  2915. return $core.withContext(function($ctx1) {
  2916. $recv(aGenerator)._initializeForObject();
  2917. return self;
  2918. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2919. },
  2920. args: ["aGenerator"],
  2921. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2922. referencedClasses: [],
  2923. messageSends: ["initializeForObject"]
  2924. }),
  2925. $globals.Object.klass);
  2926. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2927. $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: [ ... ]";
  2928. $core.addMethod(
  2929. $core.method({
  2930. selector: "&",
  2931. protocol: 'controlling',
  2932. fn: function (aBoolean){
  2933. var self=this;
  2934. return $core.withContext(function($ctx1) {
  2935. if(self == true) {
  2936. return aBoolean;
  2937. } else {
  2938. return false;
  2939. }
  2940. ;
  2941. return self;
  2942. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2943. },
  2944. args: ["aBoolean"],
  2945. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2946. referencedClasses: [],
  2947. messageSends: []
  2948. }),
  2949. $globals.Boolean);
  2950. $core.addMethod(
  2951. $core.method({
  2952. selector: "==",
  2953. protocol: 'comparing',
  2954. fn: function (aBoolean){
  2955. var self=this;
  2956. return $core.withContext(function($ctx1) {
  2957. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2958. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2959. else return false;;
  2960. return self;
  2961. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2962. },
  2963. args: ["aBoolean"],
  2964. source: "== aBoolean\x0a<\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a>",
  2965. referencedClasses: [],
  2966. messageSends: []
  2967. }),
  2968. $globals.Boolean);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "and:",
  2972. protocol: 'controlling',
  2973. fn: function (aBlock){
  2974. var self=this;
  2975. return $core.withContext(function($ctx1) {
  2976. var $1;
  2977. $1=self.__eq(true);
  2978. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  2979. return false;
  2980. }));
  2981. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2982. },
  2983. args: ["aBlock"],
  2984. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2985. referencedClasses: [],
  2986. messageSends: ["ifTrue:ifFalse:", "="]
  2987. }),
  2988. $globals.Boolean);
  2989. $core.addMethod(
  2990. $core.method({
  2991. selector: "asBit",
  2992. protocol: 'converting',
  2993. fn: function (){
  2994. var self=this;
  2995. return $core.withContext(function($ctx1) {
  2996. if($core.assert(self)){
  2997. return (1);
  2998. } else {
  2999. return (0);
  3000. };
  3001. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3002. },
  3003. args: [],
  3004. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3005. referencedClasses: [],
  3006. messageSends: ["ifTrue:ifFalse:"]
  3007. }),
  3008. $globals.Boolean);
  3009. $core.addMethod(
  3010. $core.method({
  3011. selector: "asJSON",
  3012. protocol: 'converting',
  3013. fn: function (){
  3014. var self=this;
  3015. return self;
  3016. },
  3017. args: [],
  3018. source: "asJSON\x0a\x09^ self",
  3019. referencedClasses: [],
  3020. messageSends: []
  3021. }),
  3022. $globals.Boolean);
  3023. $core.addMethod(
  3024. $core.method({
  3025. selector: "asString",
  3026. protocol: 'converting',
  3027. fn: function (){
  3028. var self=this;
  3029. return $core.withContext(function($ctx1) {
  3030. return self.toString() ;
  3031. return self;
  3032. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3033. },
  3034. args: [],
  3035. source: "asString\x0a\x09< return self.toString() >",
  3036. referencedClasses: [],
  3037. messageSends: []
  3038. }),
  3039. $globals.Boolean);
  3040. $core.addMethod(
  3041. $core.method({
  3042. selector: "deepCopy",
  3043. protocol: 'copying',
  3044. fn: function (){
  3045. var self=this;
  3046. return self;
  3047. },
  3048. args: [],
  3049. source: "deepCopy\x0a\x09^ self",
  3050. referencedClasses: [],
  3051. messageSends: []
  3052. }),
  3053. $globals.Boolean);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "ifFalse:",
  3057. protocol: 'controlling',
  3058. fn: function (aBlock){
  3059. var self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. return self._ifTrue_ifFalse_((function(){
  3062. }),aBlock);
  3063. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3064. },
  3065. args: ["aBlock"],
  3066. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3067. referencedClasses: [],
  3068. messageSends: ["ifTrue:ifFalse:"]
  3069. }),
  3070. $globals.Boolean);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "ifFalse:ifTrue:",
  3074. protocol: 'controlling',
  3075. fn: function (aBlock,anotherBlock){
  3076. var self=this;
  3077. return $core.withContext(function($ctx1) {
  3078. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3079. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3080. },
  3081. args: ["aBlock", "anotherBlock"],
  3082. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3083. referencedClasses: [],
  3084. messageSends: ["ifTrue:ifFalse:"]
  3085. }),
  3086. $globals.Boolean);
  3087. $core.addMethod(
  3088. $core.method({
  3089. selector: "ifTrue:",
  3090. protocol: 'controlling',
  3091. fn: function (aBlock){
  3092. var self=this;
  3093. return $core.withContext(function($ctx1) {
  3094. return self._ifTrue_ifFalse_(aBlock,(function(){
  3095. }));
  3096. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3097. },
  3098. args: ["aBlock"],
  3099. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3100. referencedClasses: [],
  3101. messageSends: ["ifTrue:ifFalse:"]
  3102. }),
  3103. $globals.Boolean);
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "ifTrue:ifFalse:",
  3107. protocol: 'controlling',
  3108. fn: function (aBlock,anotherBlock){
  3109. var self=this;
  3110. return $core.withContext(function($ctx1) {
  3111. if(self == true) {
  3112. return aBlock._value();
  3113. } else {
  3114. return anotherBlock._value();
  3115. }
  3116. ;
  3117. return self;
  3118. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3119. },
  3120. args: ["aBlock", "anotherBlock"],
  3121. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  3122. referencedClasses: [],
  3123. messageSends: []
  3124. }),
  3125. $globals.Boolean);
  3126. $core.addMethod(
  3127. $core.method({
  3128. selector: "isBoolean",
  3129. protocol: 'testing',
  3130. fn: function (){
  3131. var self=this;
  3132. return true;
  3133. },
  3134. args: [],
  3135. source: "isBoolean\x0a\x09^ true",
  3136. referencedClasses: [],
  3137. messageSends: []
  3138. }),
  3139. $globals.Boolean);
  3140. $core.addMethod(
  3141. $core.method({
  3142. selector: "isImmutable",
  3143. protocol: 'testing',
  3144. fn: function (){
  3145. var self=this;
  3146. return true;
  3147. },
  3148. args: [],
  3149. source: "isImmutable\x0a\x09^ true",
  3150. referencedClasses: [],
  3151. messageSends: []
  3152. }),
  3153. $globals.Boolean);
  3154. $core.addMethod(
  3155. $core.method({
  3156. selector: "not",
  3157. protocol: 'controlling',
  3158. fn: function (){
  3159. var self=this;
  3160. return $core.withContext(function($ctx1) {
  3161. return self.__eq(false);
  3162. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3163. },
  3164. args: [],
  3165. source: "not\x0a\x09^ self = false",
  3166. referencedClasses: [],
  3167. messageSends: ["="]
  3168. }),
  3169. $globals.Boolean);
  3170. $core.addMethod(
  3171. $core.method({
  3172. selector: "or:",
  3173. protocol: 'controlling',
  3174. fn: function (aBlock){
  3175. var self=this;
  3176. return $core.withContext(function($ctx1) {
  3177. var $1;
  3178. $1=self.__eq(true);
  3179. return $recv($1)._ifTrue_ifFalse_((function(){
  3180. return true;
  3181. }),aBlock);
  3182. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3183. },
  3184. args: ["aBlock"],
  3185. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3186. referencedClasses: [],
  3187. messageSends: ["ifTrue:ifFalse:", "="]
  3188. }),
  3189. $globals.Boolean);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "printOn:",
  3193. protocol: 'printing',
  3194. fn: function (aStream){
  3195. var self=this;
  3196. return $core.withContext(function($ctx1) {
  3197. $recv(aStream)._nextPutAll_(self._asString());
  3198. return self;
  3199. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3200. },
  3201. args: ["aStream"],
  3202. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3203. referencedClasses: [],
  3204. messageSends: ["nextPutAll:", "asString"]
  3205. }),
  3206. $globals.Boolean);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "shallowCopy",
  3210. protocol: 'copying',
  3211. fn: function (){
  3212. var self=this;
  3213. return self;
  3214. },
  3215. args: [],
  3216. source: "shallowCopy\x0a\x09^ self",
  3217. referencedClasses: [],
  3218. messageSends: []
  3219. }),
  3220. $globals.Boolean);
  3221. $core.addMethod(
  3222. $core.method({
  3223. selector: "|",
  3224. protocol: 'controlling',
  3225. fn: function (aBoolean){
  3226. var self=this;
  3227. return $core.withContext(function($ctx1) {
  3228. if(self == true) {
  3229. return true;
  3230. } else {
  3231. return aBoolean;
  3232. }
  3233. ;
  3234. return self;
  3235. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3236. },
  3237. args: ["aBoolean"],
  3238. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  3239. referencedClasses: [],
  3240. messageSends: []
  3241. }),
  3242. $globals.Boolean);
  3243. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3244. $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.).";
  3245. $core.addMethod(
  3246. $core.method({
  3247. selector: "+",
  3248. protocol: 'arithmetic',
  3249. fn: function (aDate){
  3250. var self=this;
  3251. return $core.withContext(function($ctx1) {
  3252. return self + aDate;
  3253. return self;
  3254. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3255. },
  3256. args: ["aDate"],
  3257. source: "+ aDate\x0a\x09<return self + aDate>",
  3258. referencedClasses: [],
  3259. messageSends: []
  3260. }),
  3261. $globals.Date);
  3262. $core.addMethod(
  3263. $core.method({
  3264. selector: "-",
  3265. protocol: 'arithmetic',
  3266. fn: function (aDate){
  3267. var self=this;
  3268. return $core.withContext(function($ctx1) {
  3269. return self - aDate;
  3270. return self;
  3271. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3272. },
  3273. args: ["aDate"],
  3274. source: "- aDate\x0a\x09<return self - aDate>",
  3275. referencedClasses: [],
  3276. messageSends: []
  3277. }),
  3278. $globals.Date);
  3279. $core.addMethod(
  3280. $core.method({
  3281. selector: "<",
  3282. protocol: 'comparing',
  3283. fn: function (aDate){
  3284. var self=this;
  3285. return $core.withContext(function($ctx1) {
  3286. return self < aDate;
  3287. return self;
  3288. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3289. },
  3290. args: ["aDate"],
  3291. source: "< aDate\x0a\x09<return self < aDate>",
  3292. referencedClasses: [],
  3293. messageSends: []
  3294. }),
  3295. $globals.Date);
  3296. $core.addMethod(
  3297. $core.method({
  3298. selector: "<=",
  3299. protocol: 'comparing',
  3300. fn: function (aDate){
  3301. var self=this;
  3302. return $core.withContext(function($ctx1) {
  3303. return self <= aDate;
  3304. return self;
  3305. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3306. },
  3307. args: ["aDate"],
  3308. source: "<= aDate\x0a\x09<return self <= aDate>",
  3309. referencedClasses: [],
  3310. messageSends: []
  3311. }),
  3312. $globals.Date);
  3313. $core.addMethod(
  3314. $core.method({
  3315. selector: "=",
  3316. protocol: 'comparing',
  3317. fn: function (aDate){
  3318. var self=this;
  3319. return $core.withContext(function($ctx1) {
  3320. var $2,$1,$3;
  3321. $2=$recv(aDate)._class();
  3322. $ctx1.sendIdx["class"]=1;
  3323. $1=$recv($2).__eq_eq(self._class());
  3324. $ctx1.sendIdx["=="]=1;
  3325. return $recv($1)._and_((function(){
  3326. return $core.withContext(function($ctx2) {
  3327. $3=self._asMilliseconds();
  3328. $ctx2.sendIdx["asMilliseconds"]=1;
  3329. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3331. }));
  3332. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3333. },
  3334. args: ["aDate"],
  3335. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3336. referencedClasses: [],
  3337. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3338. }),
  3339. $globals.Date);
  3340. $core.addMethod(
  3341. $core.method({
  3342. selector: ">",
  3343. protocol: 'comparing',
  3344. fn: function (aDate){
  3345. var self=this;
  3346. return $core.withContext(function($ctx1) {
  3347. return self > aDate;
  3348. return self;
  3349. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3350. },
  3351. args: ["aDate"],
  3352. source: "> aDate\x0a\x09<return self >> aDate>",
  3353. referencedClasses: [],
  3354. messageSends: []
  3355. }),
  3356. $globals.Date);
  3357. $core.addMethod(
  3358. $core.method({
  3359. selector: ">=",
  3360. protocol: 'comparing',
  3361. fn: function (aDate){
  3362. var self=this;
  3363. return $core.withContext(function($ctx1) {
  3364. return self >= aDate;
  3365. return self;
  3366. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3367. },
  3368. args: ["aDate"],
  3369. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3370. referencedClasses: [],
  3371. messageSends: []
  3372. }),
  3373. $globals.Date);
  3374. $core.addMethod(
  3375. $core.method({
  3376. selector: "asDateString",
  3377. protocol: 'converting',
  3378. fn: function (){
  3379. var self=this;
  3380. return $core.withContext(function($ctx1) {
  3381. return self.toDateString();
  3382. return self;
  3383. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3384. },
  3385. args: [],
  3386. source: "asDateString\x0a\x09<return self.toDateString()>",
  3387. referencedClasses: [],
  3388. messageSends: []
  3389. }),
  3390. $globals.Date);
  3391. $core.addMethod(
  3392. $core.method({
  3393. selector: "asLocaleString",
  3394. protocol: 'converting',
  3395. fn: function (){
  3396. var self=this;
  3397. return $core.withContext(function($ctx1) {
  3398. return self.toLocaleString();
  3399. return self;
  3400. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3401. },
  3402. args: [],
  3403. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3404. referencedClasses: [],
  3405. messageSends: []
  3406. }),
  3407. $globals.Date);
  3408. $core.addMethod(
  3409. $core.method({
  3410. selector: "asMilliseconds",
  3411. protocol: 'converting',
  3412. fn: function (){
  3413. var self=this;
  3414. return $core.withContext(function($ctx1) {
  3415. return self._time();
  3416. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3417. },
  3418. args: [],
  3419. source: "asMilliseconds\x0a\x09^ self time",
  3420. referencedClasses: [],
  3421. messageSends: ["time"]
  3422. }),
  3423. $globals.Date);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "asNumber",
  3427. protocol: 'converting',
  3428. fn: function (){
  3429. var self=this;
  3430. return $core.withContext(function($ctx1) {
  3431. return self._asMilliseconds();
  3432. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3433. },
  3434. args: [],
  3435. source: "asNumber\x0a\x09^ self asMilliseconds",
  3436. referencedClasses: [],
  3437. messageSends: ["asMilliseconds"]
  3438. }),
  3439. $globals.Date);
  3440. $core.addMethod(
  3441. $core.method({
  3442. selector: "asString",
  3443. protocol: 'converting',
  3444. fn: function (){
  3445. var self=this;
  3446. return $core.withContext(function($ctx1) {
  3447. return self.toString();
  3448. return self;
  3449. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3450. },
  3451. args: [],
  3452. source: "asString\x0a\x09<return self.toString()>",
  3453. referencedClasses: [],
  3454. messageSends: []
  3455. }),
  3456. $globals.Date);
  3457. $core.addMethod(
  3458. $core.method({
  3459. selector: "asTimeString",
  3460. protocol: 'converting',
  3461. fn: function (){
  3462. var self=this;
  3463. return $core.withContext(function($ctx1) {
  3464. return self.toTimeString();
  3465. return self;
  3466. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3467. },
  3468. args: [],
  3469. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3470. referencedClasses: [],
  3471. messageSends: []
  3472. }),
  3473. $globals.Date);
  3474. $core.addMethod(
  3475. $core.method({
  3476. selector: "day",
  3477. protocol: 'accessing',
  3478. fn: function (){
  3479. var self=this;
  3480. return $core.withContext(function($ctx1) {
  3481. return self._dayOfWeek();
  3482. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3483. },
  3484. args: [],
  3485. source: "day\x0a\x09^ self dayOfWeek",
  3486. referencedClasses: [],
  3487. messageSends: ["dayOfWeek"]
  3488. }),
  3489. $globals.Date);
  3490. $core.addMethod(
  3491. $core.method({
  3492. selector: "day:",
  3493. protocol: 'accessing',
  3494. fn: function (aNumber){
  3495. var self=this;
  3496. return $core.withContext(function($ctx1) {
  3497. self._dayOfWeek_(aNumber);
  3498. return self;
  3499. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3500. },
  3501. args: ["aNumber"],
  3502. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3503. referencedClasses: [],
  3504. messageSends: ["dayOfWeek:"]
  3505. }),
  3506. $globals.Date);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "dayOfMonth",
  3510. protocol: 'accessing',
  3511. fn: function (){
  3512. var self=this;
  3513. return $core.withContext(function($ctx1) {
  3514. return self.getDate();
  3515. return self;
  3516. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3517. },
  3518. args: [],
  3519. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3520. referencedClasses: [],
  3521. messageSends: []
  3522. }),
  3523. $globals.Date);
  3524. $core.addMethod(
  3525. $core.method({
  3526. selector: "dayOfMonth:",
  3527. protocol: 'accessing',
  3528. fn: function (aNumber){
  3529. var self=this;
  3530. return $core.withContext(function($ctx1) {
  3531. self.setDate(aNumber);
  3532. return self;
  3533. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3534. },
  3535. args: ["aNumber"],
  3536. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3537. referencedClasses: [],
  3538. messageSends: []
  3539. }),
  3540. $globals.Date);
  3541. $core.addMethod(
  3542. $core.method({
  3543. selector: "dayOfWeek",
  3544. protocol: 'accessing',
  3545. fn: function (){
  3546. var self=this;
  3547. return $core.withContext(function($ctx1) {
  3548. return self.getDay() + 1;
  3549. return self;
  3550. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3551. },
  3552. args: [],
  3553. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Date);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "dayOfWeek:",
  3561. protocol: 'accessing',
  3562. fn: function (aNumber){
  3563. var self=this;
  3564. return $core.withContext(function($ctx1) {
  3565. return self.setDay(aNumber - 1);
  3566. return self;
  3567. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3568. },
  3569. args: ["aNumber"],
  3570. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3571. referencedClasses: [],
  3572. messageSends: []
  3573. }),
  3574. $globals.Date);
  3575. $core.addMethod(
  3576. $core.method({
  3577. selector: "hours",
  3578. protocol: 'accessing',
  3579. fn: function (){
  3580. var self=this;
  3581. return $core.withContext(function($ctx1) {
  3582. return self.getHours();
  3583. return self;
  3584. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3585. },
  3586. args: [],
  3587. source: "hours\x0a\x09<return self.getHours()>",
  3588. referencedClasses: [],
  3589. messageSends: []
  3590. }),
  3591. $globals.Date);
  3592. $core.addMethod(
  3593. $core.method({
  3594. selector: "hours:",
  3595. protocol: 'accessing',
  3596. fn: function (aNumber){
  3597. var self=this;
  3598. return $core.withContext(function($ctx1) {
  3599. self.setHours(aNumber);
  3600. return self;
  3601. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3602. },
  3603. args: ["aNumber"],
  3604. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3605. referencedClasses: [],
  3606. messageSends: []
  3607. }),
  3608. $globals.Date);
  3609. $core.addMethod(
  3610. $core.method({
  3611. selector: "milliseconds",
  3612. protocol: 'accessing',
  3613. fn: function (){
  3614. var self=this;
  3615. return $core.withContext(function($ctx1) {
  3616. return self.getMilliseconds();
  3617. return self;
  3618. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3619. },
  3620. args: [],
  3621. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3622. referencedClasses: [],
  3623. messageSends: []
  3624. }),
  3625. $globals.Date);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "milliseconds:",
  3629. protocol: 'accessing',
  3630. fn: function (aNumber){
  3631. var self=this;
  3632. return $core.withContext(function($ctx1) {
  3633. self.setMilliseconds(aNumber);
  3634. return self;
  3635. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3636. },
  3637. args: ["aNumber"],
  3638. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3639. referencedClasses: [],
  3640. messageSends: []
  3641. }),
  3642. $globals.Date);
  3643. $core.addMethod(
  3644. $core.method({
  3645. selector: "minutes",
  3646. protocol: 'accessing',
  3647. fn: function (){
  3648. var self=this;
  3649. return $core.withContext(function($ctx1) {
  3650. return self.getMinutes();
  3651. return self;
  3652. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3653. },
  3654. args: [],
  3655. source: "minutes\x0a\x09<return self.getMinutes()>",
  3656. referencedClasses: [],
  3657. messageSends: []
  3658. }),
  3659. $globals.Date);
  3660. $core.addMethod(
  3661. $core.method({
  3662. selector: "minutes:",
  3663. protocol: 'accessing',
  3664. fn: function (aNumber){
  3665. var self=this;
  3666. return $core.withContext(function($ctx1) {
  3667. self.setMinutes(aNumber);
  3668. return self;
  3669. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3670. },
  3671. args: ["aNumber"],
  3672. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3673. referencedClasses: [],
  3674. messageSends: []
  3675. }),
  3676. $globals.Date);
  3677. $core.addMethod(
  3678. $core.method({
  3679. selector: "month",
  3680. protocol: 'accessing',
  3681. fn: function (){
  3682. var self=this;
  3683. return $core.withContext(function($ctx1) {
  3684. return self.getMonth() + 1;
  3685. return self;
  3686. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3687. },
  3688. args: [],
  3689. source: "month\x0a\x09<return self.getMonth() + 1>",
  3690. referencedClasses: [],
  3691. messageSends: []
  3692. }),
  3693. $globals.Date);
  3694. $core.addMethod(
  3695. $core.method({
  3696. selector: "month:",
  3697. protocol: 'accessing',
  3698. fn: function (aNumber){
  3699. var self=this;
  3700. return $core.withContext(function($ctx1) {
  3701. self.setMonth(aNumber - 1);
  3702. return self;
  3703. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3704. },
  3705. args: ["aNumber"],
  3706. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3707. referencedClasses: [],
  3708. messageSends: []
  3709. }),
  3710. $globals.Date);
  3711. $core.addMethod(
  3712. $core.method({
  3713. selector: "printOn:",
  3714. protocol: 'printing',
  3715. fn: function (aStream){
  3716. var self=this;
  3717. return $core.withContext(function($ctx1) {
  3718. $recv(aStream)._nextPutAll_(self._asString());
  3719. return self;
  3720. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3721. },
  3722. args: ["aStream"],
  3723. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3724. referencedClasses: [],
  3725. messageSends: ["nextPutAll:", "asString"]
  3726. }),
  3727. $globals.Date);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "seconds",
  3731. protocol: 'accessing',
  3732. fn: function (){
  3733. var self=this;
  3734. return $core.withContext(function($ctx1) {
  3735. return self.getSeconds();
  3736. return self;
  3737. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3738. },
  3739. args: [],
  3740. source: "seconds\x0a\x09<return self.getSeconds()>",
  3741. referencedClasses: [],
  3742. messageSends: []
  3743. }),
  3744. $globals.Date);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "seconds:",
  3748. protocol: 'accessing',
  3749. fn: function (aNumber){
  3750. var self=this;
  3751. return $core.withContext(function($ctx1) {
  3752. self.setSeconds(aNumber);
  3753. return self;
  3754. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3755. },
  3756. args: ["aNumber"],
  3757. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3758. referencedClasses: [],
  3759. messageSends: []
  3760. }),
  3761. $globals.Date);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "time",
  3765. protocol: 'accessing',
  3766. fn: function (){
  3767. var self=this;
  3768. return $core.withContext(function($ctx1) {
  3769. return self.getTime();
  3770. return self;
  3771. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3772. },
  3773. args: [],
  3774. source: "time\x0a\x09<return self.getTime()>",
  3775. referencedClasses: [],
  3776. messageSends: []
  3777. }),
  3778. $globals.Date);
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "time:",
  3782. protocol: 'accessing',
  3783. fn: function (aNumber){
  3784. var self=this;
  3785. return $core.withContext(function($ctx1) {
  3786. self.setTime(aNumber);
  3787. return self;
  3788. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3789. },
  3790. args: ["aNumber"],
  3791. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3792. referencedClasses: [],
  3793. messageSends: []
  3794. }),
  3795. $globals.Date);
  3796. $core.addMethod(
  3797. $core.method({
  3798. selector: "year",
  3799. protocol: 'accessing',
  3800. fn: function (){
  3801. var self=this;
  3802. return $core.withContext(function($ctx1) {
  3803. return self.getFullYear();
  3804. return self;
  3805. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3806. },
  3807. args: [],
  3808. source: "year\x0a\x09<return self.getFullYear()>",
  3809. referencedClasses: [],
  3810. messageSends: []
  3811. }),
  3812. $globals.Date);
  3813. $core.addMethod(
  3814. $core.method({
  3815. selector: "year:",
  3816. protocol: 'accessing',
  3817. fn: function (aNumber){
  3818. var self=this;
  3819. return $core.withContext(function($ctx1) {
  3820. self.setFullYear(aNumber);
  3821. return self;
  3822. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3823. },
  3824. args: ["aNumber"],
  3825. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3826. referencedClasses: [],
  3827. messageSends: []
  3828. }),
  3829. $globals.Date);
  3830. $core.addMethod(
  3831. $core.method({
  3832. selector: "classTag",
  3833. protocol: 'accessing',
  3834. fn: function (){
  3835. var self=this;
  3836. return "magnitude";
  3837. },
  3838. args: [],
  3839. 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'",
  3840. referencedClasses: [],
  3841. messageSends: []
  3842. }),
  3843. $globals.Date.klass);
  3844. $core.addMethod(
  3845. $core.method({
  3846. selector: "fromMilliseconds:",
  3847. protocol: 'instance creation',
  3848. fn: function (aNumber){
  3849. var self=this;
  3850. return $core.withContext(function($ctx1) {
  3851. return self._new_(aNumber);
  3852. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3853. },
  3854. args: ["aNumber"],
  3855. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3856. referencedClasses: [],
  3857. messageSends: ["new:"]
  3858. }),
  3859. $globals.Date.klass);
  3860. $core.addMethod(
  3861. $core.method({
  3862. selector: "fromSeconds:",
  3863. protocol: 'instance creation',
  3864. fn: function (aNumber){
  3865. var self=this;
  3866. return $core.withContext(function($ctx1) {
  3867. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3868. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3869. },
  3870. args: ["aNumber"],
  3871. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3872. referencedClasses: [],
  3873. messageSends: ["fromMilliseconds:", "*"]
  3874. }),
  3875. $globals.Date.klass);
  3876. $core.addMethod(
  3877. $core.method({
  3878. selector: "fromString:",
  3879. protocol: 'instance creation',
  3880. fn: function (aString){
  3881. var self=this;
  3882. return $core.withContext(function($ctx1) {
  3883. return self._new_(aString);
  3884. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3885. },
  3886. args: ["aString"],
  3887. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3888. referencedClasses: [],
  3889. messageSends: ["new:"]
  3890. }),
  3891. $globals.Date.klass);
  3892. $core.addMethod(
  3893. $core.method({
  3894. selector: "millisecondsToRun:",
  3895. protocol: 'instance creation',
  3896. fn: function (aBlock){
  3897. var self=this;
  3898. var t;
  3899. return $core.withContext(function($ctx1) {
  3900. t=$recv($globals.Date)._now();
  3901. $ctx1.sendIdx["now"]=1;
  3902. $recv(aBlock)._value();
  3903. return $recv($recv($globals.Date)._now()).__minus(t);
  3904. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3905. },
  3906. args: ["aBlock"],
  3907. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3908. referencedClasses: ["Date"],
  3909. messageSends: ["now", "value", "-"]
  3910. }),
  3911. $globals.Date.klass);
  3912. $core.addMethod(
  3913. $core.method({
  3914. selector: "new:",
  3915. protocol: 'instance creation',
  3916. fn: function (anObject){
  3917. var self=this;
  3918. return $core.withContext(function($ctx1) {
  3919. return new Date(anObject);
  3920. return self;
  3921. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3922. },
  3923. args: ["anObject"],
  3924. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3925. referencedClasses: [],
  3926. messageSends: []
  3927. }),
  3928. $globals.Date.klass);
  3929. $core.addMethod(
  3930. $core.method({
  3931. selector: "now",
  3932. protocol: 'instance creation',
  3933. fn: function (){
  3934. var self=this;
  3935. return $core.withContext(function($ctx1) {
  3936. return self._today();
  3937. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3938. },
  3939. args: [],
  3940. source: "now\x0a\x09^ self today",
  3941. referencedClasses: [],
  3942. messageSends: ["today"]
  3943. }),
  3944. $globals.Date.klass);
  3945. $core.addMethod(
  3946. $core.method({
  3947. selector: "today",
  3948. protocol: 'instance creation',
  3949. fn: function (){
  3950. var self=this;
  3951. return $core.withContext(function($ctx1) {
  3952. return self._new();
  3953. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3954. },
  3955. args: [],
  3956. source: "today\x0a\x09^ self new",
  3957. referencedClasses: [],
  3958. messageSends: ["new"]
  3959. }),
  3960. $globals.Date.klass);
  3961. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3962. $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 ].";
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "&",
  3966. protocol: 'converting',
  3967. fn: function (aNumber){
  3968. var self=this;
  3969. return $core.withContext(function($ctx1) {
  3970. return self & aNumber;
  3971. return self;
  3972. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3973. },
  3974. args: ["aNumber"],
  3975. source: "& aNumber\x0a\x09<return self & aNumber>",
  3976. referencedClasses: [],
  3977. messageSends: []
  3978. }),
  3979. $globals.Number);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "*",
  3983. protocol: 'arithmetic',
  3984. fn: function (aNumber){
  3985. var self=this;
  3986. return $core.withContext(function($ctx1) {
  3987. return self * aNumber;
  3988. return self;
  3989. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3990. },
  3991. args: ["aNumber"],
  3992. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3993. referencedClasses: [],
  3994. messageSends: []
  3995. }),
  3996. $globals.Number);
  3997. $core.addMethod(
  3998. $core.method({
  3999. selector: "**",
  4000. protocol: 'mathematical functions',
  4001. fn: function (exponent){
  4002. var self=this;
  4003. return $core.withContext(function($ctx1) {
  4004. return self._raisedTo_(exponent);
  4005. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4006. },
  4007. args: ["exponent"],
  4008. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4009. referencedClasses: [],
  4010. messageSends: ["raisedTo:"]
  4011. }),
  4012. $globals.Number);
  4013. $core.addMethod(
  4014. $core.method({
  4015. selector: "+",
  4016. protocol: 'arithmetic',
  4017. fn: function (aNumber){
  4018. var self=this;
  4019. return $core.withContext(function($ctx1) {
  4020. return self + aNumber;
  4021. return self;
  4022. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4023. },
  4024. args: ["aNumber"],
  4025. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  4026. referencedClasses: [],
  4027. messageSends: []
  4028. }),
  4029. $globals.Number);
  4030. $core.addMethod(
  4031. $core.method({
  4032. selector: "-",
  4033. protocol: 'arithmetic',
  4034. fn: function (aNumber){
  4035. var self=this;
  4036. return $core.withContext(function($ctx1) {
  4037. return self - aNumber;
  4038. return self;
  4039. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4040. },
  4041. args: ["aNumber"],
  4042. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  4043. referencedClasses: [],
  4044. messageSends: []
  4045. }),
  4046. $globals.Number);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "/",
  4050. protocol: 'arithmetic',
  4051. fn: function (aNumber){
  4052. var self=this;
  4053. return $core.withContext(function($ctx1) {
  4054. return self / aNumber;
  4055. return self;
  4056. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4057. },
  4058. args: ["aNumber"],
  4059. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4060. referencedClasses: [],
  4061. messageSends: []
  4062. }),
  4063. $globals.Number);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "//",
  4067. protocol: 'arithmetic',
  4068. fn: function (aNumber){
  4069. var self=this;
  4070. return $core.withContext(function($ctx1) {
  4071. return $recv(self.__slash(aNumber))._floor();
  4072. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4073. },
  4074. args: ["aNumber"],
  4075. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4076. referencedClasses: [],
  4077. messageSends: ["floor", "/"]
  4078. }),
  4079. $globals.Number);
  4080. $core.addMethod(
  4081. $core.method({
  4082. selector: "<",
  4083. protocol: 'comparing',
  4084. fn: function (aNumber){
  4085. var self=this;
  4086. return $core.withContext(function($ctx1) {
  4087. return self < aNumber;
  4088. return self;
  4089. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4090. },
  4091. args: ["aNumber"],
  4092. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  4093. referencedClasses: [],
  4094. messageSends: []
  4095. }),
  4096. $globals.Number);
  4097. $core.addMethod(
  4098. $core.method({
  4099. selector: "<=",
  4100. protocol: 'comparing',
  4101. fn: function (aNumber){
  4102. var self=this;
  4103. return $core.withContext(function($ctx1) {
  4104. return self <= aNumber;
  4105. return self;
  4106. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4107. },
  4108. args: ["aNumber"],
  4109. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4110. referencedClasses: [],
  4111. messageSends: []
  4112. }),
  4113. $globals.Number);
  4114. $core.addMethod(
  4115. $core.method({
  4116. selector: "==",
  4117. protocol: 'comparing',
  4118. fn: function (aNumber){
  4119. var self=this;
  4120. return $core.withContext(function($ctx1) {
  4121. if (typeof aNumber === "number") return Number(self) === aNumber;
  4122. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4123. else return false;;
  4124. return self;
  4125. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4126. },
  4127. args: ["aNumber"],
  4128. source: "== aNumber\x0a<\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a>",
  4129. referencedClasses: [],
  4130. messageSends: []
  4131. }),
  4132. $globals.Number);
  4133. $core.addMethod(
  4134. $core.method({
  4135. selector: ">",
  4136. protocol: 'comparing',
  4137. fn: function (aNumber){
  4138. var self=this;
  4139. return $core.withContext(function($ctx1) {
  4140. return self > aNumber;
  4141. return self;
  4142. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4143. },
  4144. args: ["aNumber"],
  4145. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  4146. referencedClasses: [],
  4147. messageSends: []
  4148. }),
  4149. $globals.Number);
  4150. $core.addMethod(
  4151. $core.method({
  4152. selector: ">=",
  4153. protocol: 'comparing',
  4154. fn: function (aNumber){
  4155. var self=this;
  4156. return $core.withContext(function($ctx1) {
  4157. return self >= aNumber;
  4158. return self;
  4159. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4160. },
  4161. args: ["aNumber"],
  4162. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4163. referencedClasses: [],
  4164. messageSends: []
  4165. }),
  4166. $globals.Number);
  4167. $core.addMethod(
  4168. $core.method({
  4169. selector: "@",
  4170. protocol: 'converting',
  4171. fn: function (aNumber){
  4172. var self=this;
  4173. return $core.withContext(function($ctx1) {
  4174. return $recv($globals.Point)._x_y_(self,aNumber);
  4175. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4176. },
  4177. args: ["aNumber"],
  4178. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4179. referencedClasses: ["Point"],
  4180. messageSends: ["x:y:"]
  4181. }),
  4182. $globals.Number);
  4183. $core.addMethod(
  4184. $core.method({
  4185. selector: "\x5c\x5c",
  4186. protocol: 'arithmetic',
  4187. fn: function (aNumber){
  4188. var self=this;
  4189. return $core.withContext(function($ctx1) {
  4190. return self % aNumber;
  4191. return self;
  4192. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4193. },
  4194. args: ["aNumber"],
  4195. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4196. referencedClasses: [],
  4197. messageSends: []
  4198. }),
  4199. $globals.Number);
  4200. $core.addMethod(
  4201. $core.method({
  4202. selector: "abs",
  4203. protocol: 'arithmetic',
  4204. fn: function (){
  4205. var self=this;
  4206. return $core.withContext(function($ctx1) {
  4207. return Math.abs(self);;
  4208. return self;
  4209. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4210. },
  4211. args: [],
  4212. source: "abs\x0a\x09<return Math.abs(self);>",
  4213. referencedClasses: [],
  4214. messageSends: []
  4215. }),
  4216. $globals.Number);
  4217. $core.addMethod(
  4218. $core.method({
  4219. selector: "arcCos",
  4220. protocol: 'mathematical functions',
  4221. fn: function (){
  4222. var self=this;
  4223. return $core.withContext(function($ctx1) {
  4224. return Math.acos(self);;
  4225. return self;
  4226. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4227. },
  4228. args: [],
  4229. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4230. referencedClasses: [],
  4231. messageSends: []
  4232. }),
  4233. $globals.Number);
  4234. $core.addMethod(
  4235. $core.method({
  4236. selector: "arcSin",
  4237. protocol: 'mathematical functions',
  4238. fn: function (){
  4239. var self=this;
  4240. return $core.withContext(function($ctx1) {
  4241. return Math.asin(self);;
  4242. return self;
  4243. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4244. },
  4245. args: [],
  4246. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4247. referencedClasses: [],
  4248. messageSends: []
  4249. }),
  4250. $globals.Number);
  4251. $core.addMethod(
  4252. $core.method({
  4253. selector: "arcTan",
  4254. protocol: 'mathematical functions',
  4255. fn: function (){
  4256. var self=this;
  4257. return $core.withContext(function($ctx1) {
  4258. return Math.atan(self);;
  4259. return self;
  4260. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4261. },
  4262. args: [],
  4263. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4264. referencedClasses: [],
  4265. messageSends: []
  4266. }),
  4267. $globals.Number);
  4268. $core.addMethod(
  4269. $core.method({
  4270. selector: "asJSON",
  4271. protocol: 'converting',
  4272. fn: function (){
  4273. var self=this;
  4274. return self;
  4275. },
  4276. args: [],
  4277. source: "asJSON\x0a\x09^ self",
  4278. referencedClasses: [],
  4279. messageSends: []
  4280. }),
  4281. $globals.Number);
  4282. $core.addMethod(
  4283. $core.method({
  4284. selector: "asJavascript",
  4285. protocol: 'converting',
  4286. fn: function (){
  4287. var self=this;
  4288. return $core.withContext(function($ctx1) {
  4289. var $1;
  4290. $1=$recv("(".__comma(self._printString())).__comma(")");
  4291. $ctx1.sendIdx[","]=1;
  4292. return $1;
  4293. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4294. },
  4295. args: [],
  4296. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4297. referencedClasses: [],
  4298. messageSends: [",", "printString"]
  4299. }),
  4300. $globals.Number);
  4301. $core.addMethod(
  4302. $core.method({
  4303. selector: "asNumber",
  4304. protocol: 'converting',
  4305. fn: function (){
  4306. var self=this;
  4307. return self;
  4308. },
  4309. args: [],
  4310. source: "asNumber\x0a\x09^ self",
  4311. referencedClasses: [],
  4312. messageSends: []
  4313. }),
  4314. $globals.Number);
  4315. $core.addMethod(
  4316. $core.method({
  4317. selector: "asPoint",
  4318. protocol: 'converting',
  4319. fn: function (){
  4320. var self=this;
  4321. return $core.withContext(function($ctx1) {
  4322. return $recv($globals.Point)._x_y_(self,self);
  4323. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4324. },
  4325. args: [],
  4326. source: "asPoint\x0a\x09^ Point x: self y: self",
  4327. referencedClasses: ["Point"],
  4328. messageSends: ["x:y:"]
  4329. }),
  4330. $globals.Number);
  4331. $core.addMethod(
  4332. $core.method({
  4333. selector: "asString",
  4334. protocol: 'converting',
  4335. fn: function (){
  4336. var self=this;
  4337. return $core.withContext(function($ctx1) {
  4338. return String(self) ;
  4339. return self;
  4340. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4341. },
  4342. args: [],
  4343. source: "asString\x0a\x09< return String(self) >",
  4344. referencedClasses: [],
  4345. messageSends: []
  4346. }),
  4347. $globals.Number);
  4348. $core.addMethod(
  4349. $core.method({
  4350. selector: "atRandom",
  4351. protocol: 'converting',
  4352. fn: function (){
  4353. var self=this;
  4354. return $core.withContext(function($ctx1) {
  4355. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4356. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4357. },
  4358. args: [],
  4359. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4360. referencedClasses: ["Random"],
  4361. messageSends: ["+", "truncated", "*", "next", "new"]
  4362. }),
  4363. $globals.Number);
  4364. $core.addMethod(
  4365. $core.method({
  4366. selector: "ceiling",
  4367. protocol: 'converting',
  4368. fn: function (){
  4369. var self=this;
  4370. return $core.withContext(function($ctx1) {
  4371. return Math.ceil(self);;
  4372. return self;
  4373. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4374. },
  4375. args: [],
  4376. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4377. referencedClasses: [],
  4378. messageSends: []
  4379. }),
  4380. $globals.Number);
  4381. $core.addMethod(
  4382. $core.method({
  4383. selector: "copy",
  4384. protocol: 'copying',
  4385. fn: function (){
  4386. var self=this;
  4387. return self;
  4388. },
  4389. args: [],
  4390. source: "copy\x0a\x09^ self",
  4391. referencedClasses: [],
  4392. messageSends: []
  4393. }),
  4394. $globals.Number);
  4395. $core.addMethod(
  4396. $core.method({
  4397. selector: "cos",
  4398. protocol: 'mathematical functions',
  4399. fn: function (){
  4400. var self=this;
  4401. return $core.withContext(function($ctx1) {
  4402. return Math.cos(self);;
  4403. return self;
  4404. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4405. },
  4406. args: [],
  4407. source: "cos\x0a\x09<return Math.cos(self);>",
  4408. referencedClasses: [],
  4409. messageSends: []
  4410. }),
  4411. $globals.Number);
  4412. $core.addMethod(
  4413. $core.method({
  4414. selector: "deepCopy",
  4415. protocol: 'copying',
  4416. fn: function (){
  4417. var self=this;
  4418. return $core.withContext(function($ctx1) {
  4419. return self._copy();
  4420. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4421. },
  4422. args: [],
  4423. source: "deepCopy\x0a\x09^ self copy",
  4424. referencedClasses: [],
  4425. messageSends: ["copy"]
  4426. }),
  4427. $globals.Number);
  4428. $core.addMethod(
  4429. $core.method({
  4430. selector: "even",
  4431. protocol: 'testing',
  4432. fn: function (){
  4433. var self=this;
  4434. return $core.withContext(function($ctx1) {
  4435. return (0).__eq(self.__backslash_backslash((2)));
  4436. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4437. },
  4438. args: [],
  4439. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4440. referencedClasses: [],
  4441. messageSends: ["=", "\x5c\x5c"]
  4442. }),
  4443. $globals.Number);
  4444. $core.addMethod(
  4445. $core.method({
  4446. selector: "floor",
  4447. protocol: 'converting',
  4448. fn: function (){
  4449. var self=this;
  4450. return $core.withContext(function($ctx1) {
  4451. return Math.floor(self);;
  4452. return self;
  4453. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4454. },
  4455. args: [],
  4456. source: "floor\x0a\x09<return Math.floor(self);>",
  4457. referencedClasses: [],
  4458. messageSends: []
  4459. }),
  4460. $globals.Number);
  4461. $core.addMethod(
  4462. $core.method({
  4463. selector: "isImmutable",
  4464. protocol: 'testing',
  4465. fn: function (){
  4466. var self=this;
  4467. return true;
  4468. },
  4469. args: [],
  4470. source: "isImmutable\x0a\x09^ true",
  4471. referencedClasses: [],
  4472. messageSends: []
  4473. }),
  4474. $globals.Number);
  4475. $core.addMethod(
  4476. $core.method({
  4477. selector: "isNumber",
  4478. protocol: 'testing',
  4479. fn: function (){
  4480. var self=this;
  4481. return true;
  4482. },
  4483. args: [],
  4484. source: "isNumber\x0a\x09^ true",
  4485. referencedClasses: [],
  4486. messageSends: []
  4487. }),
  4488. $globals.Number);
  4489. $core.addMethod(
  4490. $core.method({
  4491. selector: "isZero",
  4492. protocol: 'testing',
  4493. fn: function (){
  4494. var self=this;
  4495. return $core.withContext(function($ctx1) {
  4496. return self.__eq((0));
  4497. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4498. },
  4499. args: [],
  4500. source: "isZero\x0a\x09^ self = 0",
  4501. referencedClasses: [],
  4502. messageSends: ["="]
  4503. }),
  4504. $globals.Number);
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "ln",
  4508. protocol: 'mathematical functions',
  4509. fn: function (){
  4510. var self=this;
  4511. return $core.withContext(function($ctx1) {
  4512. return Math.log(self);;
  4513. return self;
  4514. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4515. },
  4516. args: [],
  4517. source: "ln\x0a\x09<return Math.log(self);>",
  4518. referencedClasses: [],
  4519. messageSends: []
  4520. }),
  4521. $globals.Number);
  4522. $core.addMethod(
  4523. $core.method({
  4524. selector: "log",
  4525. protocol: 'mathematical functions',
  4526. fn: function (){
  4527. var self=this;
  4528. return $core.withContext(function($ctx1) {
  4529. return Math.log(self) / Math.LN10;;
  4530. return self;
  4531. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4532. },
  4533. args: [],
  4534. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  4535. referencedClasses: [],
  4536. messageSends: []
  4537. }),
  4538. $globals.Number);
  4539. $core.addMethod(
  4540. $core.method({
  4541. selector: "log:",
  4542. protocol: 'mathematical functions',
  4543. fn: function (aNumber){
  4544. var self=this;
  4545. return $core.withContext(function($ctx1) {
  4546. return Math.log(self) / Math.log(aNumber);;
  4547. return self;
  4548. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4549. },
  4550. args: ["aNumber"],
  4551. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4552. referencedClasses: [],
  4553. messageSends: []
  4554. }),
  4555. $globals.Number);
  4556. $core.addMethod(
  4557. $core.method({
  4558. selector: "max:",
  4559. protocol: 'arithmetic',
  4560. fn: function (aNumber){
  4561. var self=this;
  4562. return $core.withContext(function($ctx1) {
  4563. return Math.max(self, aNumber);;
  4564. return self;
  4565. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4566. },
  4567. args: ["aNumber"],
  4568. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4569. referencedClasses: [],
  4570. messageSends: []
  4571. }),
  4572. $globals.Number);
  4573. $core.addMethod(
  4574. $core.method({
  4575. selector: "min:",
  4576. protocol: 'arithmetic',
  4577. fn: function (aNumber){
  4578. var self=this;
  4579. return $core.withContext(function($ctx1) {
  4580. return Math.min(self, aNumber);;
  4581. return self;
  4582. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4583. },
  4584. args: ["aNumber"],
  4585. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4586. referencedClasses: [],
  4587. messageSends: []
  4588. }),
  4589. $globals.Number);
  4590. $core.addMethod(
  4591. $core.method({
  4592. selector: "negated",
  4593. protocol: 'arithmetic',
  4594. fn: function (){
  4595. var self=this;
  4596. return $core.withContext(function($ctx1) {
  4597. return (0).__minus(self);
  4598. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4599. },
  4600. args: [],
  4601. source: "negated\x0a\x09^ 0 - self",
  4602. referencedClasses: [],
  4603. messageSends: ["-"]
  4604. }),
  4605. $globals.Number);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "negative",
  4609. protocol: 'testing',
  4610. fn: function (){
  4611. var self=this;
  4612. return $core.withContext(function($ctx1) {
  4613. return self.__lt((0));
  4614. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4615. },
  4616. args: [],
  4617. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4618. referencedClasses: [],
  4619. messageSends: ["<"]
  4620. }),
  4621. $globals.Number);
  4622. $core.addMethod(
  4623. $core.method({
  4624. selector: "odd",
  4625. protocol: 'testing',
  4626. fn: function (){
  4627. var self=this;
  4628. return $core.withContext(function($ctx1) {
  4629. return $recv(self._even())._not();
  4630. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4631. },
  4632. args: [],
  4633. source: "odd\x0a\x09^ self even not",
  4634. referencedClasses: [],
  4635. messageSends: ["not", "even"]
  4636. }),
  4637. $globals.Number);
  4638. $core.addMethod(
  4639. $core.method({
  4640. selector: "positive",
  4641. protocol: 'testing',
  4642. fn: function (){
  4643. var self=this;
  4644. return $core.withContext(function($ctx1) {
  4645. return self.__gt_eq((0));
  4646. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4647. },
  4648. args: [],
  4649. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4650. referencedClasses: [],
  4651. messageSends: [">="]
  4652. }),
  4653. $globals.Number);
  4654. $core.addMethod(
  4655. $core.method({
  4656. selector: "printOn:",
  4657. protocol: 'printing',
  4658. fn: function (aStream){
  4659. var self=this;
  4660. return $core.withContext(function($ctx1) {
  4661. $recv(aStream)._nextPutAll_(self._asString());
  4662. return self;
  4663. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4664. },
  4665. args: ["aStream"],
  4666. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4667. referencedClasses: [],
  4668. messageSends: ["nextPutAll:", "asString"]
  4669. }),
  4670. $globals.Number);
  4671. $core.addMethod(
  4672. $core.method({
  4673. selector: "printShowingDecimalPlaces:",
  4674. protocol: 'printing',
  4675. fn: function (placesDesired){
  4676. var self=this;
  4677. return $core.withContext(function($ctx1) {
  4678. return self.toFixed(placesDesired);
  4679. return self;
  4680. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4681. },
  4682. args: ["placesDesired"],
  4683. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4684. referencedClasses: [],
  4685. messageSends: []
  4686. }),
  4687. $globals.Number);
  4688. $core.addMethod(
  4689. $core.method({
  4690. selector: "raisedTo:",
  4691. protocol: 'mathematical functions',
  4692. fn: function (exponent){
  4693. var self=this;
  4694. return $core.withContext(function($ctx1) {
  4695. return Math.pow(self, exponent);;
  4696. return self;
  4697. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4698. },
  4699. args: ["exponent"],
  4700. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4701. referencedClasses: [],
  4702. messageSends: []
  4703. }),
  4704. $globals.Number);
  4705. $core.addMethod(
  4706. $core.method({
  4707. selector: "rounded",
  4708. protocol: 'converting',
  4709. fn: function (){
  4710. var self=this;
  4711. return $core.withContext(function($ctx1) {
  4712. return Math.round(self);;
  4713. return self;
  4714. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4715. },
  4716. args: [],
  4717. source: "rounded\x0a\x09<return Math.round(self);>",
  4718. referencedClasses: [],
  4719. messageSends: []
  4720. }),
  4721. $globals.Number);
  4722. $core.addMethod(
  4723. $core.method({
  4724. selector: "sign",
  4725. protocol: 'mathematical functions',
  4726. fn: function (){
  4727. var self=this;
  4728. return $core.withContext(function($ctx1) {
  4729. var $1,$2;
  4730. $1=self._isZero();
  4731. if($core.assert($1)){
  4732. return (0);
  4733. };
  4734. $2=self._positive();
  4735. if($core.assert($2)){
  4736. return (1);
  4737. } else {
  4738. return (-1);
  4739. };
  4740. return self;
  4741. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4742. },
  4743. args: [],
  4744. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4745. referencedClasses: [],
  4746. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4747. }),
  4748. $globals.Number);
  4749. $core.addMethod(
  4750. $core.method({
  4751. selector: "sin",
  4752. protocol: 'mathematical functions',
  4753. fn: function (){
  4754. var self=this;
  4755. return $core.withContext(function($ctx1) {
  4756. return Math.sin(self);;
  4757. return self;
  4758. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4759. },
  4760. args: [],
  4761. source: "sin\x0a\x09<return Math.sin(self);>",
  4762. referencedClasses: [],
  4763. messageSends: []
  4764. }),
  4765. $globals.Number);
  4766. $core.addMethod(
  4767. $core.method({
  4768. selector: "sqrt",
  4769. protocol: 'mathematical functions',
  4770. fn: function (){
  4771. var self=this;
  4772. return $core.withContext(function($ctx1) {
  4773. return Math.sqrt(self);
  4774. return self;
  4775. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4776. },
  4777. args: [],
  4778. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4779. referencedClasses: [],
  4780. messageSends: []
  4781. }),
  4782. $globals.Number);
  4783. $core.addMethod(
  4784. $core.method({
  4785. selector: "squared",
  4786. protocol: 'mathematical functions',
  4787. fn: function (){
  4788. var self=this;
  4789. return $core.withContext(function($ctx1) {
  4790. return self.__star(self);
  4791. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4792. },
  4793. args: [],
  4794. source: "squared\x0a\x09^ self * self",
  4795. referencedClasses: [],
  4796. messageSends: ["*"]
  4797. }),
  4798. $globals.Number);
  4799. $core.addMethod(
  4800. $core.method({
  4801. selector: "tan",
  4802. protocol: 'mathematical functions',
  4803. fn: function (){
  4804. var self=this;
  4805. return $core.withContext(function($ctx1) {
  4806. return Math.tan(self);;
  4807. return self;
  4808. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4809. },
  4810. args: [],
  4811. source: "tan\x0a\x09<return Math.tan(self);>",
  4812. referencedClasses: [],
  4813. messageSends: []
  4814. }),
  4815. $globals.Number);
  4816. $core.addMethod(
  4817. $core.method({
  4818. selector: "timesRepeat:",
  4819. protocol: 'enumerating',
  4820. fn: function (aBlock){
  4821. var self=this;
  4822. var count;
  4823. return $core.withContext(function($ctx1) {
  4824. count=(1);
  4825. $recv((function(){
  4826. return $core.withContext(function($ctx2) {
  4827. return $recv(count).__gt(self);
  4828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4829. }))._whileFalse_((function(){
  4830. return $core.withContext(function($ctx2) {
  4831. $recv(aBlock)._value();
  4832. count=$recv(count).__plus((1));
  4833. return count;
  4834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4835. }));
  4836. return self;
  4837. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4838. },
  4839. args: ["aBlock"],
  4840. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4841. referencedClasses: [],
  4842. messageSends: ["whileFalse:", ">", "value", "+"]
  4843. }),
  4844. $globals.Number);
  4845. $core.addMethod(
  4846. $core.method({
  4847. selector: "to:",
  4848. protocol: 'converting',
  4849. fn: function (aNumber){
  4850. var self=this;
  4851. var array,first,last,count;
  4852. return $core.withContext(function($ctx1) {
  4853. first=self._truncated();
  4854. $ctx1.sendIdx["truncated"]=1;
  4855. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4856. $ctx1.sendIdx["+"]=1;
  4857. count=(1);
  4858. array=$recv($globals.Array)._new();
  4859. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4860. return $core.withContext(function($ctx2) {
  4861. $recv(array)._at_put_(count,first);
  4862. count=$recv(count).__plus((1));
  4863. $ctx2.sendIdx["+"]=2;
  4864. count;
  4865. first=$recv(first).__plus((1));
  4866. return first;
  4867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4868. }));
  4869. return array;
  4870. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4871. },
  4872. args: ["aNumber"],
  4873. 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",
  4874. referencedClasses: ["Array"],
  4875. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4876. }),
  4877. $globals.Number);
  4878. $core.addMethod(
  4879. $core.method({
  4880. selector: "to:by:",
  4881. protocol: 'converting',
  4882. fn: function (stop,step){
  4883. var self=this;
  4884. var array,value,pos;
  4885. return $core.withContext(function($ctx1) {
  4886. var $1,$2;
  4887. value=self;
  4888. array=$recv($globals.Array)._new();
  4889. pos=(1);
  4890. $1=$recv(step).__eq((0));
  4891. if($core.assert($1)){
  4892. self._error_("step must be non-zero");
  4893. };
  4894. $2=$recv(step).__lt((0));
  4895. if($core.assert($2)){
  4896. $recv((function(){
  4897. return $core.withContext(function($ctx2) {
  4898. return $recv(value).__gt_eq(stop);
  4899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4900. }))._whileTrue_((function(){
  4901. return $core.withContext(function($ctx2) {
  4902. $recv(array)._at_put_(pos,value);
  4903. $ctx2.sendIdx["at:put:"]=1;
  4904. pos=$recv(pos).__plus((1));
  4905. $ctx2.sendIdx["+"]=1;
  4906. pos;
  4907. value=$recv(value).__plus(step);
  4908. $ctx2.sendIdx["+"]=2;
  4909. return value;
  4910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4911. }));
  4912. $ctx1.sendIdx["whileTrue:"]=1;
  4913. } else {
  4914. $recv((function(){
  4915. return $core.withContext(function($ctx2) {
  4916. return $recv(value).__lt_eq(stop);
  4917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4918. }))._whileTrue_((function(){
  4919. return $core.withContext(function($ctx2) {
  4920. $recv(array)._at_put_(pos,value);
  4921. pos=$recv(pos).__plus((1));
  4922. $ctx2.sendIdx["+"]=3;
  4923. pos;
  4924. value=$recv(value).__plus(step);
  4925. return value;
  4926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4927. }));
  4928. };
  4929. return array;
  4930. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4931. },
  4932. args: ["stop", "step"],
  4933. 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",
  4934. referencedClasses: ["Array"],
  4935. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4936. }),
  4937. $globals.Number);
  4938. $core.addMethod(
  4939. $core.method({
  4940. selector: "to:by:do:",
  4941. protocol: 'enumerating',
  4942. fn: function (stop,step,aBlock){
  4943. var self=this;
  4944. var value;
  4945. return $core.withContext(function($ctx1) {
  4946. var $1,$2;
  4947. value=self;
  4948. $1=$recv(step).__eq((0));
  4949. if($core.assert($1)){
  4950. self._error_("step must be non-zero");
  4951. };
  4952. $2=$recv(step).__lt((0));
  4953. if($core.assert($2)){
  4954. $recv((function(){
  4955. return $core.withContext(function($ctx2) {
  4956. return $recv(value).__gt_eq(stop);
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4958. }))._whileTrue_((function(){
  4959. return $core.withContext(function($ctx2) {
  4960. $recv(aBlock)._value_(value);
  4961. $ctx2.sendIdx["value:"]=1;
  4962. value=$recv(value).__plus(step);
  4963. $ctx2.sendIdx["+"]=1;
  4964. return value;
  4965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4966. }));
  4967. $ctx1.sendIdx["whileTrue:"]=1;
  4968. } else {
  4969. $recv((function(){
  4970. return $core.withContext(function($ctx2) {
  4971. return $recv(value).__lt_eq(stop);
  4972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4973. }))._whileTrue_((function(){
  4974. return $core.withContext(function($ctx2) {
  4975. $recv(aBlock)._value_(value);
  4976. value=$recv(value).__plus(step);
  4977. return value;
  4978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4979. }));
  4980. };
  4981. return self;
  4982. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4983. },
  4984. args: ["stop", "step", "aBlock"],
  4985. 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 ]]",
  4986. referencedClasses: [],
  4987. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4988. }),
  4989. $globals.Number);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "to:do:",
  4993. protocol: 'enumerating',
  4994. fn: function (stop,aBlock){
  4995. var self=this;
  4996. var nextValue;
  4997. return $core.withContext(function($ctx1) {
  4998. nextValue=self;
  4999. $recv((function(){
  5000. return $core.withContext(function($ctx2) {
  5001. return $recv(nextValue).__lt_eq(stop);
  5002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5003. }))._whileTrue_((function(){
  5004. return $core.withContext(function($ctx2) {
  5005. $recv(aBlock)._value_(nextValue);
  5006. nextValue=$recv(nextValue).__plus((1));
  5007. return nextValue;
  5008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5009. }));
  5010. return self;
  5011. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5012. },
  5013. args: ["stop", "aBlock"],
  5014. 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 ]",
  5015. referencedClasses: [],
  5016. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5017. }),
  5018. $globals.Number);
  5019. $core.addMethod(
  5020. $core.method({
  5021. selector: "truncated",
  5022. protocol: 'converting',
  5023. fn: function (){
  5024. var self=this;
  5025. return $core.withContext(function($ctx1) {
  5026. if(self >= 0) {
  5027. return Math.floor(self);
  5028. } else {
  5029. return Math.floor(self * (-1)) * (-1);
  5030. };
  5031. ;
  5032. return self;
  5033. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5034. },
  5035. args: [],
  5036. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  5037. referencedClasses: [],
  5038. messageSends: []
  5039. }),
  5040. $globals.Number);
  5041. $core.addMethod(
  5042. $core.method({
  5043. selector: "|",
  5044. protocol: 'converting',
  5045. fn: function (aNumber){
  5046. var self=this;
  5047. return $core.withContext(function($ctx1) {
  5048. return self | aNumber;
  5049. return self;
  5050. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5051. },
  5052. args: ["aNumber"],
  5053. source: "| aNumber\x0a\x09<return self | aNumber>",
  5054. referencedClasses: [],
  5055. messageSends: []
  5056. }),
  5057. $globals.Number);
  5058. $core.addMethod(
  5059. $core.method({
  5060. selector: "classTag",
  5061. protocol: 'accessing',
  5062. fn: function (){
  5063. var self=this;
  5064. return "magnitude";
  5065. },
  5066. args: [],
  5067. 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'",
  5068. referencedClasses: [],
  5069. messageSends: []
  5070. }),
  5071. $globals.Number.klass);
  5072. $core.addMethod(
  5073. $core.method({
  5074. selector: "e",
  5075. protocol: 'instance creation',
  5076. fn: function (){
  5077. var self=this;
  5078. return $core.withContext(function($ctx1) {
  5079. return Math.E;;
  5080. return self;
  5081. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5082. },
  5083. args: [],
  5084. source: "e\x0a\x09<return Math.E;>",
  5085. referencedClasses: [],
  5086. messageSends: []
  5087. }),
  5088. $globals.Number.klass);
  5089. $core.addMethod(
  5090. $core.method({
  5091. selector: "pi",
  5092. protocol: 'instance creation',
  5093. fn: function (){
  5094. var self=this;
  5095. return $core.withContext(function($ctx1) {
  5096. return Math.PI;
  5097. return self;
  5098. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5099. },
  5100. args: [],
  5101. source: "pi\x0a\x09<return Math.PI>",
  5102. referencedClasses: [],
  5103. messageSends: []
  5104. }),
  5105. $globals.Number.klass);
  5106. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5107. $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";
  5108. $core.addMethod(
  5109. $core.method({
  5110. selector: "*",
  5111. protocol: 'arithmetic',
  5112. fn: function (aPoint){
  5113. var self=this;
  5114. return $core.withContext(function($ctx1) {
  5115. var $2,$4,$3,$1,$6,$5;
  5116. $2=self._x();
  5117. $ctx1.sendIdx["x"]=1;
  5118. $4=$recv(aPoint)._asPoint();
  5119. $ctx1.sendIdx["asPoint"]=1;
  5120. $3=$recv($4)._x();
  5121. $1=$recv($2).__star($3);
  5122. $ctx1.sendIdx["*"]=1;
  5123. $6=self._y();
  5124. $ctx1.sendIdx["y"]=1;
  5125. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5126. return $recv($globals.Point)._x_y_($1,$5);
  5127. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5128. },
  5129. args: ["aPoint"],
  5130. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5131. referencedClasses: ["Point"],
  5132. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5133. }),
  5134. $globals.Point);
  5135. $core.addMethod(
  5136. $core.method({
  5137. selector: "+",
  5138. protocol: 'arithmetic',
  5139. fn: function (aPoint){
  5140. var self=this;
  5141. return $core.withContext(function($ctx1) {
  5142. var $2,$4,$3,$1,$6,$5;
  5143. $2=self._x();
  5144. $ctx1.sendIdx["x"]=1;
  5145. $4=$recv(aPoint)._asPoint();
  5146. $ctx1.sendIdx["asPoint"]=1;
  5147. $3=$recv($4)._x();
  5148. $1=$recv($2).__plus($3);
  5149. $ctx1.sendIdx["+"]=1;
  5150. $6=self._y();
  5151. $ctx1.sendIdx["y"]=1;
  5152. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5153. return $recv($globals.Point)._x_y_($1,$5);
  5154. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5155. },
  5156. args: ["aPoint"],
  5157. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5158. referencedClasses: ["Point"],
  5159. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5160. }),
  5161. $globals.Point);
  5162. $core.addMethod(
  5163. $core.method({
  5164. selector: "-",
  5165. protocol: 'arithmetic',
  5166. fn: function (aPoint){
  5167. var self=this;
  5168. return $core.withContext(function($ctx1) {
  5169. var $2,$4,$3,$1,$6,$5;
  5170. $2=self._x();
  5171. $ctx1.sendIdx["x"]=1;
  5172. $4=$recv(aPoint)._asPoint();
  5173. $ctx1.sendIdx["asPoint"]=1;
  5174. $3=$recv($4)._x();
  5175. $1=$recv($2).__minus($3);
  5176. $ctx1.sendIdx["-"]=1;
  5177. $6=self._y();
  5178. $ctx1.sendIdx["y"]=1;
  5179. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5180. return $recv($globals.Point)._x_y_($1,$5);
  5181. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5182. },
  5183. args: ["aPoint"],
  5184. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5185. referencedClasses: ["Point"],
  5186. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5187. }),
  5188. $globals.Point);
  5189. $core.addMethod(
  5190. $core.method({
  5191. selector: "/",
  5192. protocol: 'arithmetic',
  5193. fn: function (aPoint){
  5194. var self=this;
  5195. return $core.withContext(function($ctx1) {
  5196. var $2,$4,$3,$1,$6,$5;
  5197. $2=self._x();
  5198. $ctx1.sendIdx["x"]=1;
  5199. $4=$recv(aPoint)._asPoint();
  5200. $ctx1.sendIdx["asPoint"]=1;
  5201. $3=$recv($4)._x();
  5202. $1=$recv($2).__slash($3);
  5203. $ctx1.sendIdx["/"]=1;
  5204. $6=self._y();
  5205. $ctx1.sendIdx["y"]=1;
  5206. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5207. return $recv($globals.Point)._x_y_($1,$5);
  5208. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5209. },
  5210. args: ["aPoint"],
  5211. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5212. referencedClasses: ["Point"],
  5213. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5214. }),
  5215. $globals.Point);
  5216. $core.addMethod(
  5217. $core.method({
  5218. selector: "<",
  5219. protocol: 'comparing',
  5220. fn: function (aPoint){
  5221. var self=this;
  5222. return $core.withContext(function($ctx1) {
  5223. var $2,$1,$3;
  5224. $2=self._x();
  5225. $ctx1.sendIdx["x"]=1;
  5226. $1=$recv($2).__lt($recv(aPoint)._x());
  5227. $ctx1.sendIdx["<"]=1;
  5228. return $recv($1)._and_((function(){
  5229. return $core.withContext(function($ctx2) {
  5230. $3=self._y();
  5231. $ctx2.sendIdx["y"]=1;
  5232. return $recv($3).__lt($recv(aPoint)._y());
  5233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5234. }));
  5235. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5236. },
  5237. args: ["aPoint"],
  5238. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5239. referencedClasses: [],
  5240. messageSends: ["and:", "<", "x", "y"]
  5241. }),
  5242. $globals.Point);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "<=",
  5246. protocol: 'comparing',
  5247. fn: function (aPoint){
  5248. var self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. var $2,$1,$3;
  5251. $2=self._x();
  5252. $ctx1.sendIdx["x"]=1;
  5253. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5254. $ctx1.sendIdx["<="]=1;
  5255. return $recv($1)._and_((function(){
  5256. return $core.withContext(function($ctx2) {
  5257. $3=self._y();
  5258. $ctx2.sendIdx["y"]=1;
  5259. return $recv($3).__lt_eq($recv(aPoint)._y());
  5260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5261. }));
  5262. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5263. },
  5264. args: ["aPoint"],
  5265. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5266. referencedClasses: [],
  5267. messageSends: ["and:", "<=", "x", "y"]
  5268. }),
  5269. $globals.Point);
  5270. $core.addMethod(
  5271. $core.method({
  5272. selector: "=",
  5273. protocol: 'comparing',
  5274. fn: function (aPoint){
  5275. var self=this;
  5276. return $core.withContext(function($ctx1) {
  5277. var $2,$1,$4,$3,$6,$5;
  5278. $2=$recv(aPoint)._class();
  5279. $ctx1.sendIdx["class"]=1;
  5280. $1=$recv($2).__eq(self._class());
  5281. $ctx1.sendIdx["="]=1;
  5282. return $recv($1)._and_((function(){
  5283. return $core.withContext(function($ctx2) {
  5284. $4=$recv(aPoint)._x();
  5285. $ctx2.sendIdx["x"]=1;
  5286. $3=$recv($4).__eq(self._x());
  5287. $ctx2.sendIdx["="]=2;
  5288. $6=$recv(aPoint)._y();
  5289. $ctx2.sendIdx["y"]=1;
  5290. $5=$recv($6).__eq(self._y());
  5291. return $recv($3).__and($5);
  5292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5293. }));
  5294. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5295. },
  5296. args: ["aPoint"],
  5297. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5298. referencedClasses: [],
  5299. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5300. }),
  5301. $globals.Point);
  5302. $core.addMethod(
  5303. $core.method({
  5304. selector: ">",
  5305. protocol: 'comparing',
  5306. fn: function (aPoint){
  5307. var self=this;
  5308. return $core.withContext(function($ctx1) {
  5309. var $2,$1,$3;
  5310. $2=self._x();
  5311. $ctx1.sendIdx["x"]=1;
  5312. $1=$recv($2).__gt($recv(aPoint)._x());
  5313. $ctx1.sendIdx[">"]=1;
  5314. return $recv($1)._and_((function(){
  5315. return $core.withContext(function($ctx2) {
  5316. $3=self._y();
  5317. $ctx2.sendIdx["y"]=1;
  5318. return $recv($3).__gt($recv(aPoint)._y());
  5319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5320. }));
  5321. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5322. },
  5323. args: ["aPoint"],
  5324. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5325. referencedClasses: [],
  5326. messageSends: ["and:", ">", "x", "y"]
  5327. }),
  5328. $globals.Point);
  5329. $core.addMethod(
  5330. $core.method({
  5331. selector: ">=",
  5332. protocol: 'comparing',
  5333. fn: function (aPoint){
  5334. var self=this;
  5335. return $core.withContext(function($ctx1) {
  5336. var $2,$1,$3;
  5337. $2=self._x();
  5338. $ctx1.sendIdx["x"]=1;
  5339. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5340. $ctx1.sendIdx[">="]=1;
  5341. return $recv($1)._and_((function(){
  5342. return $core.withContext(function($ctx2) {
  5343. $3=self._y();
  5344. $ctx2.sendIdx["y"]=1;
  5345. return $recv($3).__gt_eq($recv(aPoint)._y());
  5346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5347. }));
  5348. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5349. },
  5350. args: ["aPoint"],
  5351. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5352. referencedClasses: [],
  5353. messageSends: ["and:", ">=", "x", "y"]
  5354. }),
  5355. $globals.Point);
  5356. $core.addMethod(
  5357. $core.method({
  5358. selector: "asPoint",
  5359. protocol: 'converting',
  5360. fn: function (){
  5361. var self=this;
  5362. return self;
  5363. },
  5364. args: [],
  5365. source: "asPoint\x0a\x09^ self",
  5366. referencedClasses: [],
  5367. messageSends: []
  5368. }),
  5369. $globals.Point);
  5370. $core.addMethod(
  5371. $core.method({
  5372. selector: "dist:",
  5373. protocol: 'transforming',
  5374. fn: function (aPoint){
  5375. var self=this;
  5376. var dx,dy;
  5377. return $core.withContext(function($ctx1) {
  5378. var $2,$1;
  5379. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5380. $ctx1.sendIdx["-"]=1;
  5381. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5382. $2=$recv(dx).__star(dx);
  5383. $ctx1.sendIdx["*"]=1;
  5384. $1=$recv($2).__plus($recv(dy).__star(dy));
  5385. return $recv($1)._sqrt();
  5386. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5387. },
  5388. args: ["aPoint"],
  5389. 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",
  5390. referencedClasses: [],
  5391. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5392. }),
  5393. $globals.Point);
  5394. $core.addMethod(
  5395. $core.method({
  5396. selector: "printOn:",
  5397. protocol: 'printing',
  5398. fn: function (aStream){
  5399. var self=this;
  5400. return $core.withContext(function($ctx1) {
  5401. var $1;
  5402. $recv(self["@x"])._printOn_(aStream);
  5403. $ctx1.sendIdx["printOn:"]=1;
  5404. $recv(aStream)._nextPutAll_("@");
  5405. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5406. return $core.withContext(function($ctx2) {
  5407. return $recv(self["@y"])._negative();
  5408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5409. }));
  5410. if($core.assert($1)){
  5411. $recv(aStream)._space();
  5412. };
  5413. $recv(self["@y"])._printOn_(aStream);
  5414. return self;
  5415. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5416. },
  5417. args: ["aStream"],
  5418. 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",
  5419. referencedClasses: [],
  5420. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5421. }),
  5422. $globals.Point);
  5423. $core.addMethod(
  5424. $core.method({
  5425. selector: "translateBy:",
  5426. protocol: 'transforming',
  5427. fn: function (delta){
  5428. var self=this;
  5429. return $core.withContext(function($ctx1) {
  5430. var $1;
  5431. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5432. $ctx1.sendIdx["+"]=1;
  5433. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5434. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5435. },
  5436. args: ["delta"],
  5437. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5438. referencedClasses: [],
  5439. messageSends: ["@", "+", "x", "y"]
  5440. }),
  5441. $globals.Point);
  5442. $core.addMethod(
  5443. $core.method({
  5444. selector: "x",
  5445. protocol: 'accessing',
  5446. fn: function (){
  5447. var self=this;
  5448. return self["@x"];
  5449. },
  5450. args: [],
  5451. source: "x\x0a\x09^ x",
  5452. referencedClasses: [],
  5453. messageSends: []
  5454. }),
  5455. $globals.Point);
  5456. $core.addMethod(
  5457. $core.method({
  5458. selector: "x:",
  5459. protocol: 'accessing',
  5460. fn: function (aNumber){
  5461. var self=this;
  5462. self["@x"]=aNumber;
  5463. return self;
  5464. },
  5465. args: ["aNumber"],
  5466. source: "x: aNumber\x0a\x09x := aNumber",
  5467. referencedClasses: [],
  5468. messageSends: []
  5469. }),
  5470. $globals.Point);
  5471. $core.addMethod(
  5472. $core.method({
  5473. selector: "y",
  5474. protocol: 'accessing',
  5475. fn: function (){
  5476. var self=this;
  5477. return self["@y"];
  5478. },
  5479. args: [],
  5480. source: "y\x0a\x09^ y",
  5481. referencedClasses: [],
  5482. messageSends: []
  5483. }),
  5484. $globals.Point);
  5485. $core.addMethod(
  5486. $core.method({
  5487. selector: "y:",
  5488. protocol: 'accessing',
  5489. fn: function (aNumber){
  5490. var self=this;
  5491. self["@y"]=aNumber;
  5492. return self;
  5493. },
  5494. args: ["aNumber"],
  5495. source: "y: aNumber\x0a\x09y := aNumber",
  5496. referencedClasses: [],
  5497. messageSends: []
  5498. }),
  5499. $globals.Point);
  5500. $core.addMethod(
  5501. $core.method({
  5502. selector: "classTag",
  5503. protocol: 'accessing',
  5504. fn: function (){
  5505. var self=this;
  5506. return "magnitude";
  5507. },
  5508. args: [],
  5509. 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'",
  5510. referencedClasses: [],
  5511. messageSends: []
  5512. }),
  5513. $globals.Point.klass);
  5514. $core.addMethod(
  5515. $core.method({
  5516. selector: "x:y:",
  5517. protocol: 'instance creation',
  5518. fn: function (aNumber,anotherNumber){
  5519. var self=this;
  5520. return $core.withContext(function($ctx1) {
  5521. var $1;
  5522. $1=self._new();
  5523. $recv($1)._x_(aNumber);
  5524. $recv($1)._y_(anotherNumber);
  5525. return $recv($1)._yourself();
  5526. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5527. },
  5528. args: ["aNumber", "anotherNumber"],
  5529. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5530. referencedClasses: [],
  5531. messageSends: ["x:", "new", "y:", "yourself"]
  5532. }),
  5533. $globals.Point.klass);
  5534. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5535. $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'`.";
  5536. $core.addMethod(
  5537. $core.method({
  5538. selector: "next",
  5539. protocol: 'accessing',
  5540. fn: function (){
  5541. var self=this;
  5542. return $core.withContext(function($ctx1) {
  5543. return Math.random();
  5544. return self;
  5545. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5546. },
  5547. args: [],
  5548. source: "next\x0a\x09<return Math.random()>",
  5549. referencedClasses: [],
  5550. messageSends: []
  5551. }),
  5552. $globals.Random);
  5553. $core.addMethod(
  5554. $core.method({
  5555. selector: "next:",
  5556. protocol: 'accessing',
  5557. fn: function (anInteger){
  5558. var self=this;
  5559. return $core.withContext(function($ctx1) {
  5560. return $recv((1)._to_(anInteger))._collect_((function(each){
  5561. return $core.withContext(function($ctx2) {
  5562. return self._next();
  5563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5564. }));
  5565. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5566. },
  5567. args: ["anInteger"],
  5568. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5569. referencedClasses: [],
  5570. messageSends: ["collect:", "to:", "next"]
  5571. }),
  5572. $globals.Random);
  5573. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5574. $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`.";
  5575. $core.addMethod(
  5576. $core.method({
  5577. selector: "asJSON",
  5578. protocol: 'converting',
  5579. fn: function (){
  5580. var self=this;
  5581. return null;
  5582. },
  5583. args: [],
  5584. source: "asJSON\x0a\x09^ null",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.UndefinedObject);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "deepCopy",
  5592. protocol: 'copying',
  5593. fn: function (){
  5594. var self=this;
  5595. return self;
  5596. },
  5597. args: [],
  5598. source: "deepCopy\x0a\x09^ self",
  5599. referencedClasses: [],
  5600. messageSends: []
  5601. }),
  5602. $globals.UndefinedObject);
  5603. $core.addMethod(
  5604. $core.method({
  5605. selector: "ifNil:",
  5606. protocol: 'testing',
  5607. fn: function (aBlock){
  5608. var self=this;
  5609. return $core.withContext(function($ctx1) {
  5610. return self._ifNil_ifNotNil_(aBlock,(function(){
  5611. }));
  5612. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5613. },
  5614. args: ["aBlock"],
  5615. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5616. referencedClasses: [],
  5617. messageSends: ["ifNil:ifNotNil:"]
  5618. }),
  5619. $globals.UndefinedObject);
  5620. $core.addMethod(
  5621. $core.method({
  5622. selector: "ifNil:ifNotNil:",
  5623. protocol: 'testing',
  5624. fn: function (aBlock,anotherBlock){
  5625. var self=this;
  5626. return $core.withContext(function($ctx1) {
  5627. return $recv(aBlock)._value();
  5628. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5629. },
  5630. args: ["aBlock", "anotherBlock"],
  5631. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5632. referencedClasses: [],
  5633. messageSends: ["value"]
  5634. }),
  5635. $globals.UndefinedObject);
  5636. $core.addMethod(
  5637. $core.method({
  5638. selector: "ifNotNil:",
  5639. protocol: 'testing',
  5640. fn: function (aBlock){
  5641. var self=this;
  5642. return self;
  5643. },
  5644. args: ["aBlock"],
  5645. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5646. referencedClasses: [],
  5647. messageSends: []
  5648. }),
  5649. $globals.UndefinedObject);
  5650. $core.addMethod(
  5651. $core.method({
  5652. selector: "ifNotNil:ifNil:",
  5653. protocol: 'testing',
  5654. fn: function (aBlock,anotherBlock){
  5655. var self=this;
  5656. return $core.withContext(function($ctx1) {
  5657. return $recv(anotherBlock)._value();
  5658. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5659. },
  5660. args: ["aBlock", "anotherBlock"],
  5661. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5662. referencedClasses: [],
  5663. messageSends: ["value"]
  5664. }),
  5665. $globals.UndefinedObject);
  5666. $core.addMethod(
  5667. $core.method({
  5668. selector: "isImmutable",
  5669. protocol: 'testing',
  5670. fn: function (){
  5671. var self=this;
  5672. return true;
  5673. },
  5674. args: [],
  5675. source: "isImmutable\x0a\x09^ true",
  5676. referencedClasses: [],
  5677. messageSends: []
  5678. }),
  5679. $globals.UndefinedObject);
  5680. $core.addMethod(
  5681. $core.method({
  5682. selector: "isNil",
  5683. protocol: 'testing',
  5684. fn: function (){
  5685. var self=this;
  5686. return true;
  5687. },
  5688. args: [],
  5689. source: "isNil\x0a\x09^ true",
  5690. referencedClasses: [],
  5691. messageSends: []
  5692. }),
  5693. $globals.UndefinedObject);
  5694. $core.addMethod(
  5695. $core.method({
  5696. selector: "notNil",
  5697. protocol: 'testing',
  5698. fn: function (){
  5699. var self=this;
  5700. return false;
  5701. },
  5702. args: [],
  5703. source: "notNil\x0a\x09^ false",
  5704. referencedClasses: [],
  5705. messageSends: []
  5706. }),
  5707. $globals.UndefinedObject);
  5708. $core.addMethod(
  5709. $core.method({
  5710. selector: "printOn:",
  5711. protocol: 'printing',
  5712. fn: function (aStream){
  5713. var self=this;
  5714. return $core.withContext(function($ctx1) {
  5715. $recv(aStream)._nextPutAll_("nil");
  5716. return self;
  5717. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5718. },
  5719. args: ["aStream"],
  5720. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5721. referencedClasses: [],
  5722. messageSends: ["nextPutAll:"]
  5723. }),
  5724. $globals.UndefinedObject);
  5725. $core.addMethod(
  5726. $core.method({
  5727. selector: "shallowCopy",
  5728. protocol: 'copying',
  5729. fn: function (){
  5730. var self=this;
  5731. return self;
  5732. },
  5733. args: [],
  5734. source: "shallowCopy\x0a\x09^ self",
  5735. referencedClasses: [],
  5736. messageSends: []
  5737. }),
  5738. $globals.UndefinedObject);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "subclass:instanceVariableNames:",
  5742. protocol: 'class creation',
  5743. fn: function (aString,anotherString){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5747. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5748. },
  5749. args: ["aString", "anotherString"],
  5750. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5751. referencedClasses: [],
  5752. messageSends: ["subclass:instanceVariableNames:package:"]
  5753. }),
  5754. $globals.UndefinedObject);
  5755. $core.addMethod(
  5756. $core.method({
  5757. selector: "subclass:instanceVariableNames:category:",
  5758. protocol: 'class creation',
  5759. fn: function (aString,aString2,aString3){
  5760. var self=this;
  5761. return $core.withContext(function($ctx1) {
  5762. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5763. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5764. },
  5765. args: ["aString", "aString2", "aString3"],
  5766. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5767. referencedClasses: [],
  5768. messageSends: ["subclass:instanceVariableNames:package:"]
  5769. }),
  5770. $globals.UndefinedObject);
  5771. $core.addMethod(
  5772. $core.method({
  5773. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5774. protocol: 'class creation',
  5775. fn: function (aString,aString2,classVars,pools,aString3){
  5776. var self=this;
  5777. return $core.withContext(function($ctx1) {
  5778. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5779. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5780. },
  5781. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5782. 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",
  5783. referencedClasses: [],
  5784. messageSends: ["subclass:instanceVariableNames:package:"]
  5785. }),
  5786. $globals.UndefinedObject);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "subclass:instanceVariableNames:package:",
  5790. protocol: 'class creation',
  5791. fn: function (aString,aString2,aString3){
  5792. var self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5795. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5796. },
  5797. args: ["aString", "aString2", "aString3"],
  5798. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5799. referencedClasses: ["ClassBuilder"],
  5800. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5801. }),
  5802. $globals.UndefinedObject);
  5803. $core.addMethod(
  5804. $core.method({
  5805. selector: "new",
  5806. protocol: 'instance creation',
  5807. fn: function (){
  5808. var self=this;
  5809. return $core.withContext(function($ctx1) {
  5810. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5811. return self;
  5812. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5813. },
  5814. args: [],
  5815. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5816. referencedClasses: [],
  5817. messageSends: ["error:"]
  5818. }),
  5819. $globals.UndefinedObject.klass);
  5820. });
  5821. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5822. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5823. $core.addPackage('Kernel-Classes');
  5824. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5825. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5826. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5827. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5828. $core.addMethod(
  5829. $core.method({
  5830. selector: ">>",
  5831. protocol: 'accessing',
  5832. fn: function (aString){
  5833. var self=this;
  5834. return $core.withContext(function($ctx1) {
  5835. return self._methodAt_(aString);
  5836. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5837. },
  5838. args: ["aString"],
  5839. source: ">> aString\x0a\x09^ self methodAt: aString",
  5840. referencedClasses: [],
  5841. messageSends: ["methodAt:"]
  5842. }),
  5843. $globals.Behavior);
  5844. $core.addMethod(
  5845. $core.method({
  5846. selector: "addCompiledMethod:",
  5847. protocol: 'compiling',
  5848. fn: function (aMethod){
  5849. var self=this;
  5850. var oldMethod,announcement;
  5851. return $core.withContext(function($ctx1) {
  5852. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5853. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5854. return nil;
  5855. }));
  5856. $2=self._protocols();
  5857. $3=$recv(aMethod)._protocol();
  5858. $ctx1.sendIdx["protocol"]=1;
  5859. $1=$recv($2)._includes_($3);
  5860. if(!$core.assert($1)){
  5861. $4=self._organization();
  5862. $5=$recv(aMethod)._protocol();
  5863. $ctx1.sendIdx["protocol"]=2;
  5864. $recv($4)._addElement_($5);
  5865. };
  5866. self._basicAddCompiledMethod_(aMethod);
  5867. $6=oldMethod;
  5868. if(($receiver = $6) == null || $receiver.isNil){
  5869. $6;
  5870. } else {
  5871. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5872. };
  5873. $7=oldMethod;
  5874. if(($receiver = $7) == null || $receiver.isNil){
  5875. $8=$recv($globals.MethodAdded)._new();
  5876. $ctx1.sendIdx["new"]=1;
  5877. $recv($8)._method_(aMethod);
  5878. $ctx1.sendIdx["method:"]=1;
  5879. $9=$recv($8)._yourself();
  5880. $ctx1.sendIdx["yourself"]=1;
  5881. announcement=$9;
  5882. } else {
  5883. $10=$recv($globals.MethodModified)._new();
  5884. $recv($10)._oldMethod_(oldMethod);
  5885. $recv($10)._method_(aMethod);
  5886. announcement=$recv($10)._yourself();
  5887. };
  5888. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  5889. return self;
  5890. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5891. },
  5892. args: ["aMethod"],
  5893. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  5894. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5895. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5896. }),
  5897. $globals.Behavior);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: "allInstanceVariableNames",
  5901. protocol: 'accessing',
  5902. fn: function (){
  5903. var self=this;
  5904. var result;
  5905. return $core.withContext(function($ctx1) {
  5906. var $1,$receiver;
  5907. result=$recv(self._instanceVariableNames())._copy();
  5908. $1=self._superclass();
  5909. $ctx1.sendIdx["superclass"]=1;
  5910. if(($receiver = $1) == null || $receiver.isNil){
  5911. $1;
  5912. } else {
  5913. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5914. };
  5915. return result;
  5916. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5917. },
  5918. args: [],
  5919. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5920. referencedClasses: [],
  5921. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5922. }),
  5923. $globals.Behavior);
  5924. $core.addMethod(
  5925. $core.method({
  5926. selector: "allSelectors",
  5927. protocol: 'accessing',
  5928. fn: function (){
  5929. var self=this;
  5930. return $core.withContext(function($ctx1) {
  5931. var $1,$2;
  5932. $1=self._allSuperclasses();
  5933. $2=self._selectors();
  5934. $ctx1.sendIdx["selectors"]=1;
  5935. return $recv($1)._inject_into_($2,(function(acc,each){
  5936. return $core.withContext(function($ctx2) {
  5937. $recv(acc)._addAll_($recv(each)._selectors());
  5938. return $recv(acc)._yourself();
  5939. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5940. }));
  5941. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5942. },
  5943. args: [],
  5944. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5945. referencedClasses: [],
  5946. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5947. }),
  5948. $globals.Behavior);
  5949. $core.addMethod(
  5950. $core.method({
  5951. selector: "allSubclasses",
  5952. protocol: 'accessing',
  5953. fn: function (){
  5954. var self=this;
  5955. return $core.withContext(function($ctx1) {
  5956. return $recv($globals.Array)._streamContents_((function(str){
  5957. return $core.withContext(function($ctx2) {
  5958. return self._allSubclassesDo_((function(each){
  5959. return $core.withContext(function($ctx3) {
  5960. return $recv(str)._nextPut_(each);
  5961. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5962. }));
  5963. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5964. }));
  5965. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  5966. },
  5967. args: [],
  5968. 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 ] ]",
  5969. referencedClasses: ["Array"],
  5970. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  5971. }),
  5972. $globals.Behavior);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "allSubclassesDo:",
  5976. protocol: 'enumerating',
  5977. fn: function (aBlock){
  5978. var self=this;
  5979. return $core.withContext(function($ctx1) {
  5980. $core.traverseClassTree(self, function(subclass) {
  5981. if (subclass !== self) aBlock._value_(subclass);
  5982. });
  5983. return self;
  5984. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5985. },
  5986. args: ["aBlock"],
  5987. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})>",
  5988. referencedClasses: [],
  5989. messageSends: []
  5990. }),
  5991. $globals.Behavior);
  5992. $core.addMethod(
  5993. $core.method({
  5994. selector: "allSuperclasses",
  5995. protocol: 'accessing',
  5996. fn: function (){
  5997. var self=this;
  5998. return $core.withContext(function($ctx1) {
  5999. var $1,$3,$2,$receiver;
  6000. $1=self._superclass();
  6001. $ctx1.sendIdx["superclass"]=1;
  6002. if(($receiver = $1) == null || $receiver.isNil){
  6003. return [];
  6004. } else {
  6005. $1;
  6006. };
  6007. $3=self._superclass();
  6008. $ctx1.sendIdx["superclass"]=2;
  6009. $2=$recv($globals.OrderedCollection)._with_($3);
  6010. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  6011. return $recv($2)._yourself();
  6012. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  6013. },
  6014. args: [],
  6015. 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",
  6016. referencedClasses: ["OrderedCollection"],
  6017. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  6018. }),
  6019. $globals.Behavior);
  6020. $core.addMethod(
  6021. $core.method({
  6022. selector: "basicAddCompiledMethod:",
  6023. protocol: 'private',
  6024. fn: function (aMethod){
  6025. var self=this;
  6026. return $core.withContext(function($ctx1) {
  6027. $core.addMethod(aMethod, self);
  6028. return self;
  6029. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6030. },
  6031. args: ["aMethod"],
  6032. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  6033. referencedClasses: [],
  6034. messageSends: []
  6035. }),
  6036. $globals.Behavior);
  6037. $core.addMethod(
  6038. $core.method({
  6039. selector: "basicNew",
  6040. protocol: 'instance creation',
  6041. fn: function (){
  6042. var self=this;
  6043. return $core.withContext(function($ctx1) {
  6044. return new self.fn();
  6045. return self;
  6046. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6047. },
  6048. args: [],
  6049. source: "basicNew\x0a\x09<return new self.fn()>",
  6050. referencedClasses: [],
  6051. messageSends: []
  6052. }),
  6053. $globals.Behavior);
  6054. $core.addMethod(
  6055. $core.method({
  6056. selector: "basicRemoveCompiledMethod:",
  6057. protocol: 'private',
  6058. fn: function (aMethod){
  6059. var self=this;
  6060. return $core.withContext(function($ctx1) {
  6061. $core.removeMethod(aMethod,self);
  6062. return self;
  6063. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6064. },
  6065. args: ["aMethod"],
  6066. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  6067. referencedClasses: [],
  6068. messageSends: []
  6069. }),
  6070. $globals.Behavior);
  6071. $core.addMethod(
  6072. $core.method({
  6073. selector: "canUnderstand:",
  6074. protocol: 'testing',
  6075. fn: function (aSelector){
  6076. var self=this;
  6077. return $core.withContext(function($ctx1) {
  6078. var $2,$1;
  6079. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6080. return $core.withContext(function($ctx2) {
  6081. $2=self._superclass();
  6082. $ctx2.sendIdx["superclass"]=1;
  6083. $1=$recv($2)._notNil();
  6084. return $recv($1)._and_((function(){
  6085. return $core.withContext(function($ctx3) {
  6086. return $recv(self._superclass())._canUnderstand_(aSelector);
  6087. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6088. }));
  6089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6090. }));
  6091. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6092. },
  6093. args: ["aSelector"],
  6094. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6095. referencedClasses: [],
  6096. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6097. }),
  6098. $globals.Behavior);
  6099. $core.addMethod(
  6100. $core.method({
  6101. selector: "comment",
  6102. protocol: 'accessing',
  6103. fn: function (){
  6104. var self=this;
  6105. return $core.withContext(function($ctx1) {
  6106. var $1,$receiver;
  6107. $1=self._basicAt_("comment");
  6108. if(($receiver = $1) == null || $receiver.isNil){
  6109. return "";
  6110. } else {
  6111. return $1;
  6112. };
  6113. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6114. },
  6115. args: [],
  6116. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6117. referencedClasses: [],
  6118. messageSends: ["ifNil:", "basicAt:"]
  6119. }),
  6120. $globals.Behavior);
  6121. $core.addMethod(
  6122. $core.method({
  6123. selector: "comment:",
  6124. protocol: 'accessing',
  6125. fn: function (aString){
  6126. var self=this;
  6127. return $core.withContext(function($ctx1) {
  6128. var $1,$3,$2;
  6129. self._basicAt_put_("comment",aString);
  6130. $1=$recv($globals.SystemAnnouncer)._current();
  6131. $3=$recv($globals.ClassCommentChanged)._new();
  6132. $recv($3)._theClass_(self);
  6133. $2=$recv($3)._yourself();
  6134. $recv($1)._announce_($2);
  6135. return self;
  6136. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6137. },
  6138. args: ["aString"],
  6139. 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)",
  6140. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6141. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6142. }),
  6143. $globals.Behavior);
  6144. $core.addMethod(
  6145. $core.method({
  6146. selector: "compile:protocol:",
  6147. protocol: 'compiling',
  6148. fn: function (aString,anotherString){
  6149. var self=this;
  6150. return $core.withContext(function($ctx1) {
  6151. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6152. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6153. },
  6154. args: ["aString", "anotherString"],
  6155. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6156. referencedClasses: ["Compiler"],
  6157. messageSends: ["install:forClass:protocol:", "new"]
  6158. }),
  6159. $globals.Behavior);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "definition",
  6163. protocol: 'accessing',
  6164. fn: function (){
  6165. var self=this;
  6166. return "";
  6167. },
  6168. args: [],
  6169. source: "definition\x0a\x09^ ''",
  6170. referencedClasses: [],
  6171. messageSends: []
  6172. }),
  6173. $globals.Behavior);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "includesBehavior:",
  6177. protocol: 'testing',
  6178. fn: function (aClass){
  6179. var self=this;
  6180. return $core.withContext(function($ctx1) {
  6181. return $recv(self.__eq_eq(aClass))._or_((function(){
  6182. return $core.withContext(function($ctx2) {
  6183. return self._inheritsFrom_(aClass);
  6184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6185. }));
  6186. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6187. },
  6188. args: ["aClass"],
  6189. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6190. referencedClasses: [],
  6191. messageSends: ["or:", "==", "inheritsFrom:"]
  6192. }),
  6193. $globals.Behavior);
  6194. $core.addMethod(
  6195. $core.method({
  6196. selector: "includesSelector:",
  6197. protocol: 'testing',
  6198. fn: function (aString){
  6199. var self=this;
  6200. return $core.withContext(function($ctx1) {
  6201. return $recv(self._methodDictionary())._includesKey_(aString);
  6202. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6203. },
  6204. args: ["aString"],
  6205. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6206. referencedClasses: [],
  6207. messageSends: ["includesKey:", "methodDictionary"]
  6208. }),
  6209. $globals.Behavior);
  6210. $core.addMethod(
  6211. $core.method({
  6212. selector: "inheritsFrom:",
  6213. protocol: 'testing',
  6214. fn: function (aClass){
  6215. var self=this;
  6216. return $core.withContext(function($ctx1) {
  6217. var $1,$3,$2,$receiver;
  6218. $1=self._superclass();
  6219. $ctx1.sendIdx["superclass"]=1;
  6220. if(($receiver = $1) == null || $receiver.isNil){
  6221. return false;
  6222. } else {
  6223. $1;
  6224. };
  6225. $3=self._superclass();
  6226. $ctx1.sendIdx["superclass"]=2;
  6227. $2=$recv(aClass).__eq_eq($3);
  6228. return $recv($2)._or_((function(){
  6229. return $core.withContext(function($ctx2) {
  6230. return $recv(self._superclass())._inheritsFrom_(aClass);
  6231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6232. }));
  6233. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6234. },
  6235. args: ["aClass"],
  6236. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6237. referencedClasses: [],
  6238. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6239. }),
  6240. $globals.Behavior);
  6241. $core.addMethod(
  6242. $core.method({
  6243. selector: "instanceVariableNames",
  6244. protocol: 'accessing',
  6245. fn: function (){
  6246. var self=this;
  6247. return $core.withContext(function($ctx1) {
  6248. return self.iVarNames;
  6249. return self;
  6250. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6251. },
  6252. args: [],
  6253. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6254. referencedClasses: [],
  6255. messageSends: []
  6256. }),
  6257. $globals.Behavior);
  6258. $core.addMethod(
  6259. $core.method({
  6260. selector: "isBehavior",
  6261. protocol: 'testing',
  6262. fn: function (){
  6263. var self=this;
  6264. return true;
  6265. },
  6266. args: [],
  6267. source: "isBehavior\x0a\x09^ true",
  6268. referencedClasses: [],
  6269. messageSends: []
  6270. }),
  6271. $globals.Behavior);
  6272. $core.addMethod(
  6273. $core.method({
  6274. selector: "javascriptConstructor",
  6275. protocol: 'accessing',
  6276. fn: function (){
  6277. var self=this;
  6278. return $core.withContext(function($ctx1) {
  6279. return self.fn;
  6280. return self;
  6281. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6282. },
  6283. args: [],
  6284. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  6285. referencedClasses: [],
  6286. messageSends: []
  6287. }),
  6288. $globals.Behavior);
  6289. $core.addMethod(
  6290. $core.method({
  6291. selector: "javascriptConstructor:",
  6292. protocol: 'accessing',
  6293. fn: function (aJavaScriptFunction){
  6294. var self=this;
  6295. return $core.withContext(function($ctx1) {
  6296. $core.setClassConstructor(self, aJavaScriptFunction);;
  6297. return self;
  6298. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6299. },
  6300. args: ["aJavaScriptFunction"],
  6301. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<$core.setClassConstructor(self, aJavaScriptFunction);>",
  6302. referencedClasses: [],
  6303. messageSends: []
  6304. }),
  6305. $globals.Behavior);
  6306. $core.addMethod(
  6307. $core.method({
  6308. selector: "lookupSelector:",
  6309. protocol: 'accessing',
  6310. fn: function (selector){
  6311. var self=this;
  6312. var lookupClass;
  6313. return $core.withContext(function($ctx1) {
  6314. var $1;
  6315. var $early={};
  6316. try {
  6317. lookupClass=self;
  6318. $recv((function(){
  6319. return $core.withContext(function($ctx2) {
  6320. return $recv(lookupClass).__eq(nil);
  6321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6322. }))._whileFalse_((function(){
  6323. return $core.withContext(function($ctx2) {
  6324. $1=$recv(lookupClass)._includesSelector_(selector);
  6325. if($core.assert($1)){
  6326. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6327. };
  6328. lookupClass=$recv(lookupClass)._superclass();
  6329. return lookupClass;
  6330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6331. }));
  6332. return nil;
  6333. }
  6334. catch(e) {if(e===$early)return e[0]; throw e}
  6335. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6336. },
  6337. args: ["selector"],
  6338. 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",
  6339. referencedClasses: [],
  6340. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6341. }),
  6342. $globals.Behavior);
  6343. $core.addMethod(
  6344. $core.method({
  6345. selector: "methodAt:",
  6346. protocol: 'accessing',
  6347. fn: function (aString){
  6348. var self=this;
  6349. return $core.withContext(function($ctx1) {
  6350. return $recv(self._methodDictionary())._at_(aString);
  6351. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6352. },
  6353. args: ["aString"],
  6354. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6355. referencedClasses: [],
  6356. messageSends: ["at:", "methodDictionary"]
  6357. }),
  6358. $globals.Behavior);
  6359. $core.addMethod(
  6360. $core.method({
  6361. selector: "methodDictionary",
  6362. protocol: 'accessing',
  6363. fn: function (){
  6364. var self=this;
  6365. return $core.withContext(function($ctx1) {
  6366. var dict = $globals.HashedCollection._new();
  6367. var methods = self.methods;
  6368. Object.keys(methods).forEach(function(i) {
  6369. if(methods[i].selector) {
  6370. dict._at_put_(methods[i].selector, methods[i]);
  6371. }
  6372. });
  6373. return dict;
  6374. return self;
  6375. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6376. },
  6377. args: [],
  6378. source: "methodDictionary\x0a\x09<var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
  6379. referencedClasses: [],
  6380. messageSends: []
  6381. }),
  6382. $globals.Behavior);
  6383. $core.addMethod(
  6384. $core.method({
  6385. selector: "methodTemplate",
  6386. protocol: 'accessing',
  6387. fn: function (){
  6388. var self=this;
  6389. return $core.withContext(function($ctx1) {
  6390. var $2,$3,$1,$6,$7,$5,$8,$4;
  6391. return $recv($globals.String)._streamContents_((function(stream){
  6392. return $core.withContext(function($ctx2) {
  6393. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6394. $ctx2.sendIdx["nextPutAll:"]=1;
  6395. $2=$recv($globals.String)._lf();
  6396. $ctx2.sendIdx["lf"]=1;
  6397. $3=$recv($globals.String)._tab();
  6398. $ctx2.sendIdx["tab"]=1;
  6399. $1=$recv($2).__comma($3);
  6400. $ctx2.sendIdx[","]=1;
  6401. $recv(stream)._nextPutAll_($1);
  6402. $ctx2.sendIdx["nextPutAll:"]=2;
  6403. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6404. $ctx2.sendIdx["nextPutAll:"]=3;
  6405. $6=$recv($globals.String)._lf();
  6406. $ctx2.sendIdx["lf"]=2;
  6407. $7=$recv($globals.String)._lf();
  6408. $ctx2.sendIdx["lf"]=3;
  6409. $5=$recv($6).__comma($7);
  6410. $ctx2.sendIdx[","]=3;
  6411. $8=$recv($globals.String)._tab();
  6412. $ctx2.sendIdx["tab"]=2;
  6413. $4=$recv($5).__comma($8);
  6414. $ctx2.sendIdx[","]=2;
  6415. $recv(stream)._nextPutAll_($4);
  6416. $ctx2.sendIdx["nextPutAll:"]=4;
  6417. $recv(stream)._nextPutAll_("| temporary variable names |");
  6418. $ctx2.sendIdx["nextPutAll:"]=5;
  6419. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6420. $ctx2.sendIdx["nextPutAll:"]=6;
  6421. return $recv(stream)._nextPutAll_("statements");
  6422. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6423. }));
  6424. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6425. },
  6426. args: [],
  6427. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  6428. referencedClasses: ["String"],
  6429. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6430. }),
  6431. $globals.Behavior);
  6432. $core.addMethod(
  6433. $core.method({
  6434. selector: "methods",
  6435. protocol: 'accessing',
  6436. fn: function (){
  6437. var self=this;
  6438. return $core.withContext(function($ctx1) {
  6439. return $recv(self._methodDictionary())._values();
  6440. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6441. },
  6442. args: [],
  6443. source: "methods\x0a\x09^ self methodDictionary values",
  6444. referencedClasses: [],
  6445. messageSends: ["values", "methodDictionary"]
  6446. }),
  6447. $globals.Behavior);
  6448. $core.addMethod(
  6449. $core.method({
  6450. selector: "methodsInProtocol:",
  6451. protocol: 'accessing',
  6452. fn: function (aString){
  6453. var self=this;
  6454. return $core.withContext(function($ctx1) {
  6455. return $recv(self._methods())._select_((function(each){
  6456. return $core.withContext(function($ctx2) {
  6457. return $recv($recv(each)._protocol()).__eq(aString);
  6458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6459. }));
  6460. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6461. },
  6462. args: ["aString"],
  6463. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6464. referencedClasses: [],
  6465. messageSends: ["select:", "methods", "=", "protocol"]
  6466. }),
  6467. $globals.Behavior);
  6468. $core.addMethod(
  6469. $core.method({
  6470. selector: "name",
  6471. protocol: 'accessing',
  6472. fn: function (){
  6473. var self=this;
  6474. return $core.withContext(function($ctx1) {
  6475. return self.className || nil;
  6476. return self;
  6477. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6478. },
  6479. args: [],
  6480. source: "name\x0a\x09<return self.className || nil>",
  6481. referencedClasses: [],
  6482. messageSends: []
  6483. }),
  6484. $globals.Behavior);
  6485. $core.addMethod(
  6486. $core.method({
  6487. selector: "new",
  6488. protocol: 'instance creation',
  6489. fn: function (){
  6490. var self=this;
  6491. return $core.withContext(function($ctx1) {
  6492. return $recv(self._basicNew())._initialize();
  6493. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6494. },
  6495. args: [],
  6496. source: "new\x0a\x09^ self basicNew initialize",
  6497. referencedClasses: [],
  6498. messageSends: ["initialize", "basicNew"]
  6499. }),
  6500. $globals.Behavior);
  6501. $core.addMethod(
  6502. $core.method({
  6503. selector: "organization",
  6504. protocol: 'accessing',
  6505. fn: function (){
  6506. var self=this;
  6507. return $core.withContext(function($ctx1) {
  6508. return self._basicAt_("organization");
  6509. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6510. },
  6511. args: [],
  6512. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6513. referencedClasses: [],
  6514. messageSends: ["basicAt:"]
  6515. }),
  6516. $globals.Behavior);
  6517. $core.addMethod(
  6518. $core.method({
  6519. selector: "ownMethods",
  6520. protocol: 'accessing',
  6521. fn: function (){
  6522. var self=this;
  6523. return $core.withContext(function($ctx1) {
  6524. var $1;
  6525. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6526. return $core.withContext(function($ctx2) {
  6527. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6528. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6529. })))._sorted_((function(a,b){
  6530. return $core.withContext(function($ctx2) {
  6531. $1=$recv(a)._selector();
  6532. $ctx2.sendIdx["selector"]=1;
  6533. return $recv($1).__lt_eq($recv(b)._selector());
  6534. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6535. }));
  6536. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6537. },
  6538. args: [],
  6539. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6540. referencedClasses: ["OrderedCollection"],
  6541. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6542. }),
  6543. $globals.Behavior);
  6544. $core.addMethod(
  6545. $core.method({
  6546. selector: "ownProtocols",
  6547. protocol: 'accessing',
  6548. fn: function (){
  6549. var self=this;
  6550. return $core.withContext(function($ctx1) {
  6551. return $recv(self._protocols())._reject_((function(each){
  6552. return $core.withContext(function($ctx2) {
  6553. return $recv(each)._match_("^\x5c*");
  6554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6555. }));
  6556. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6557. },
  6558. args: [],
  6559. 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*' ]",
  6560. referencedClasses: [],
  6561. messageSends: ["reject:", "protocols", "match:"]
  6562. }),
  6563. $globals.Behavior);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "packageOfProtocol:",
  6567. protocol: 'accessing',
  6568. fn: function (aString){
  6569. var self=this;
  6570. return $core.withContext(function($ctx1) {
  6571. var $1;
  6572. $1=$recv(aString)._beginsWith_("*");
  6573. if(!$core.assert($1)){
  6574. return self._package();
  6575. };
  6576. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6577. return nil;
  6578. }));
  6579. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6580. },
  6581. args: ["aString"],
  6582. 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 ]",
  6583. referencedClasses: ["Package"],
  6584. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6585. }),
  6586. $globals.Behavior);
  6587. $core.addMethod(
  6588. $core.method({
  6589. selector: "protocols",
  6590. protocol: 'accessing',
  6591. fn: function (){
  6592. var self=this;
  6593. return $core.withContext(function($ctx1) {
  6594. return $recv($recv(self._organization())._elements())._sorted();
  6595. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6596. },
  6597. args: [],
  6598. source: "protocols\x0a\x09^ self organization elements sorted",
  6599. referencedClasses: [],
  6600. messageSends: ["sorted", "elements", "organization"]
  6601. }),
  6602. $globals.Behavior);
  6603. $core.addMethod(
  6604. $core.method({
  6605. selector: "protocolsDo:",
  6606. protocol: 'enumerating',
  6607. fn: function (aBlock){
  6608. var self=this;
  6609. var methodsByProtocol;
  6610. return $core.withContext(function($ctx1) {
  6611. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6612. $ctx1.sendIdx["new"]=1;
  6613. $recv(self._methodDictionary())._valuesDo_((function(m){
  6614. return $core.withContext(function($ctx2) {
  6615. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6616. return $core.withContext(function($ctx3) {
  6617. return $recv($globals.Array)._new();
  6618. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6619. })))._add_(m);
  6620. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6621. }));
  6622. $recv(self._protocols())._do_((function(protocol){
  6623. return $core.withContext(function($ctx2) {
  6624. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6625. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6626. }));
  6627. return self;
  6628. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6629. },
  6630. args: ["aBlock"],
  6631. 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) ]",
  6632. referencedClasses: ["HashedCollection", "Array"],
  6633. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6634. }),
  6635. $globals.Behavior);
  6636. $core.addMethod(
  6637. $core.method({
  6638. selector: "prototype",
  6639. protocol: 'accessing',
  6640. fn: function (){
  6641. var self=this;
  6642. return $core.withContext(function($ctx1) {
  6643. return self.fn.prototype;
  6644. return self;
  6645. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6646. },
  6647. args: [],
  6648. source: "prototype\x0a\x09<return self.fn.prototype>",
  6649. referencedClasses: [],
  6650. messageSends: []
  6651. }),
  6652. $globals.Behavior);
  6653. $core.addMethod(
  6654. $core.method({
  6655. selector: "recompile",
  6656. protocol: 'compiling',
  6657. fn: function (){
  6658. var self=this;
  6659. return $core.withContext(function($ctx1) {
  6660. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6661. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6662. },
  6663. args: [],
  6664. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6665. referencedClasses: ["Compiler"],
  6666. messageSends: ["recompile:", "new"]
  6667. }),
  6668. $globals.Behavior);
  6669. $core.addMethod(
  6670. $core.method({
  6671. selector: "removeCompiledMethod:",
  6672. protocol: 'compiling',
  6673. fn: function (aMethod){
  6674. var self=this;
  6675. return $core.withContext(function($ctx1) {
  6676. var $1,$3,$2;
  6677. self._basicRemoveCompiledMethod_(aMethod);
  6678. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6679. $1=$recv($globals.SystemAnnouncer)._current();
  6680. $3=$recv($globals.MethodRemoved)._new();
  6681. $recv($3)._method_(aMethod);
  6682. $2=$recv($3)._yourself();
  6683. $recv($1)._announce_($2);
  6684. return self;
  6685. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6686. },
  6687. args: ["aMethod"],
  6688. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6689. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6690. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6691. }),
  6692. $globals.Behavior);
  6693. $core.addMethod(
  6694. $core.method({
  6695. selector: "removeProtocolIfEmpty:",
  6696. protocol: 'accessing',
  6697. fn: function (aString){
  6698. var self=this;
  6699. return $core.withContext(function($ctx1) {
  6700. $recv(self._methods())._detect_ifNone_((function(each){
  6701. return $core.withContext(function($ctx2) {
  6702. return $recv($recv(each)._protocol()).__eq(aString);
  6703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6704. }),(function(){
  6705. return $core.withContext(function($ctx2) {
  6706. return $recv(self._organization())._removeElement_(aString);
  6707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6708. }));
  6709. return self;
  6710. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6711. },
  6712. args: ["aString"],
  6713. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6714. referencedClasses: [],
  6715. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6716. }),
  6717. $globals.Behavior);
  6718. $core.addMethod(
  6719. $core.method({
  6720. selector: "selectors",
  6721. protocol: 'accessing',
  6722. fn: function (){
  6723. var self=this;
  6724. return $core.withContext(function($ctx1) {
  6725. return $recv(self._methodDictionary())._keys();
  6726. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6727. },
  6728. args: [],
  6729. source: "selectors\x0a\x09^ self methodDictionary keys",
  6730. referencedClasses: [],
  6731. messageSends: ["keys", "methodDictionary"]
  6732. }),
  6733. $globals.Behavior);
  6734. $core.addMethod(
  6735. $core.method({
  6736. selector: "subclasses",
  6737. protocol: 'accessing',
  6738. fn: function (){
  6739. var self=this;
  6740. return $core.withContext(function($ctx1) {
  6741. self._subclassResponsibility();
  6742. return self;
  6743. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6744. },
  6745. args: [],
  6746. source: "subclasses\x0a\x09self subclassResponsibility",
  6747. referencedClasses: [],
  6748. messageSends: ["subclassResponsibility"]
  6749. }),
  6750. $globals.Behavior);
  6751. $core.addMethod(
  6752. $core.method({
  6753. selector: "superclass",
  6754. protocol: 'accessing',
  6755. fn: function (){
  6756. var self=this;
  6757. return $core.withContext(function($ctx1) {
  6758. return self.superclass;
  6759. return self;
  6760. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6761. },
  6762. args: [],
  6763. source: "superclass\x0a\x09<return self.superclass>",
  6764. referencedClasses: [],
  6765. messageSends: []
  6766. }),
  6767. $globals.Behavior);
  6768. $core.addMethod(
  6769. $core.method({
  6770. selector: "theMetaClass",
  6771. protocol: 'accessing',
  6772. fn: function (){
  6773. var self=this;
  6774. return $core.withContext(function($ctx1) {
  6775. self._subclassResponsibility();
  6776. return self;
  6777. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6778. },
  6779. args: [],
  6780. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6781. referencedClasses: [],
  6782. messageSends: ["subclassResponsibility"]
  6783. }),
  6784. $globals.Behavior);
  6785. $core.addMethod(
  6786. $core.method({
  6787. selector: "theNonMetaClass",
  6788. protocol: 'accessing',
  6789. fn: function (){
  6790. var self=this;
  6791. return $core.withContext(function($ctx1) {
  6792. self._subclassResponsibility();
  6793. return self;
  6794. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6795. },
  6796. args: [],
  6797. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6798. referencedClasses: [],
  6799. messageSends: ["subclassResponsibility"]
  6800. }),
  6801. $globals.Behavior);
  6802. $core.addMethod(
  6803. $core.method({
  6804. selector: "withAllSubclasses",
  6805. protocol: 'accessing',
  6806. fn: function (){
  6807. var self=this;
  6808. return $core.withContext(function($ctx1) {
  6809. var $1;
  6810. $1=$recv($globals.Array)._with_(self);
  6811. $recv($1)._addAll_(self._allSubclasses());
  6812. return $recv($1)._yourself();
  6813. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6814. },
  6815. args: [],
  6816. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6817. referencedClasses: ["Array"],
  6818. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6819. }),
  6820. $globals.Behavior);
  6821. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6822. $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.";
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "asJavascript",
  6826. protocol: 'converting',
  6827. fn: function (){
  6828. var self=this;
  6829. return $core.withContext(function($ctx1) {
  6830. return "$globals.".__comma(self._name());
  6831. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6832. },
  6833. args: [],
  6834. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6835. referencedClasses: [],
  6836. messageSends: [",", "name"]
  6837. }),
  6838. $globals.Class);
  6839. $core.addMethod(
  6840. $core.method({
  6841. selector: "browse",
  6842. protocol: 'browsing',
  6843. fn: function (){
  6844. var self=this;
  6845. return $core.withContext(function($ctx1) {
  6846. $recv($globals.Finder)._findClass_(self);
  6847. return self;
  6848. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6849. },
  6850. args: [],
  6851. source: "browse\x0a\x09Finder findClass: self",
  6852. referencedClasses: ["Finder"],
  6853. messageSends: ["findClass:"]
  6854. }),
  6855. $globals.Class);
  6856. $core.addMethod(
  6857. $core.method({
  6858. selector: "category",
  6859. protocol: 'accessing',
  6860. fn: function (){
  6861. var self=this;
  6862. return $core.withContext(function($ctx1) {
  6863. var $1,$receiver;
  6864. $1=self._package();
  6865. $ctx1.sendIdx["package"]=1;
  6866. if(($receiver = $1) == null || $receiver.isNil){
  6867. return "Unclassified";
  6868. } else {
  6869. return $recv(self._package())._name();
  6870. };
  6871. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6872. },
  6873. args: [],
  6874. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6875. referencedClasses: [],
  6876. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6877. }),
  6878. $globals.Class);
  6879. $core.addMethod(
  6880. $core.method({
  6881. selector: "classTag",
  6882. protocol: 'accessing',
  6883. fn: function (){
  6884. var self=this;
  6885. return "class";
  6886. },
  6887. args: [],
  6888. 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'",
  6889. referencedClasses: [],
  6890. messageSends: []
  6891. }),
  6892. $globals.Class);
  6893. $core.addMethod(
  6894. $core.method({
  6895. selector: "definition",
  6896. protocol: 'accessing',
  6897. fn: function (){
  6898. var self=this;
  6899. return $core.withContext(function($ctx1) {
  6900. var $2,$3,$1,$4,$5;
  6901. return $recv($globals.String)._streamContents_((function(stream){
  6902. return $core.withContext(function($ctx2) {
  6903. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6904. $ctx2.sendIdx["nextPutAll:"]=1;
  6905. $recv(stream)._nextPutAll_(" subclass: #");
  6906. $ctx2.sendIdx["nextPutAll:"]=2;
  6907. $recv(stream)._nextPutAll_(self._name());
  6908. $ctx2.sendIdx["nextPutAll:"]=3;
  6909. $2=$recv($globals.String)._lf();
  6910. $ctx2.sendIdx["lf"]=1;
  6911. $3=$recv($globals.String)._tab();
  6912. $ctx2.sendIdx["tab"]=1;
  6913. $1=$recv($2).__comma($3);
  6914. $ctx2.sendIdx[","]=1;
  6915. $recv(stream)._nextPutAll_($1);
  6916. $ctx2.sendIdx["nextPutAll:"]=4;
  6917. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6918. $ctx2.sendIdx["nextPutAll:"]=5;
  6919. $4;
  6920. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6921. return $core.withContext(function($ctx3) {
  6922. return $recv(stream)._nextPutAll_(each);
  6923. $ctx3.sendIdx["nextPutAll:"]=6;
  6924. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6925. }),(function(){
  6926. return $core.withContext(function($ctx3) {
  6927. return $recv(stream)._nextPutAll_(" ");
  6928. $ctx3.sendIdx["nextPutAll:"]=7;
  6929. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6930. }));
  6931. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  6932. $ctx2.sendIdx[","]=2;
  6933. $recv(stream)._nextPutAll_($5);
  6934. $ctx2.sendIdx["nextPutAll:"]=8;
  6935. $recv(stream)._nextPutAll_("package: '");
  6936. $ctx2.sendIdx["nextPutAll:"]=9;
  6937. $recv(stream)._nextPutAll_(self._category());
  6938. $ctx2.sendIdx["nextPutAll:"]=10;
  6939. return $recv(stream)._nextPutAll_("'");
  6940. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6941. }));
  6942. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6943. },
  6944. args: [],
  6945. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6946. referencedClasses: ["String"],
  6947. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6948. }),
  6949. $globals.Class);
  6950. $core.addMethod(
  6951. $core.method({
  6952. selector: "isClass",
  6953. protocol: 'testing',
  6954. fn: function (){
  6955. var self=this;
  6956. return true;
  6957. },
  6958. args: [],
  6959. source: "isClass\x0a\x09^ true",
  6960. referencedClasses: [],
  6961. messageSends: []
  6962. }),
  6963. $globals.Class);
  6964. $core.addMethod(
  6965. $core.method({
  6966. selector: "package",
  6967. protocol: 'accessing',
  6968. fn: function (){
  6969. var self=this;
  6970. return $core.withContext(function($ctx1) {
  6971. return self._basicAt_("pkg");
  6972. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6973. },
  6974. args: [],
  6975. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6976. referencedClasses: [],
  6977. messageSends: ["basicAt:"]
  6978. }),
  6979. $globals.Class);
  6980. $core.addMethod(
  6981. $core.method({
  6982. selector: "package:",
  6983. protocol: 'accessing',
  6984. fn: function (aPackage){
  6985. var self=this;
  6986. var oldPackage;
  6987. return $core.withContext(function($ctx1) {
  6988. var $2,$1,$3,$4,$6,$5;
  6989. $2=self._package();
  6990. $ctx1.sendIdx["package"]=1;
  6991. $1=$recv($2).__eq(aPackage);
  6992. if($core.assert($1)){
  6993. return self;
  6994. };
  6995. oldPackage=self._package();
  6996. self._basicAt_put_("pkg",aPackage);
  6997. $3=$recv(oldPackage)._organization();
  6998. $ctx1.sendIdx["organization"]=1;
  6999. $recv($3)._removeElement_(self);
  7000. $recv($recv(aPackage)._organization())._addElement_(self);
  7001. $4=$recv($globals.SystemAnnouncer)._current();
  7002. $6=$recv($globals.ClassMoved)._new();
  7003. $recv($6)._theClass_(self);
  7004. $recv($6)._oldPackage_(oldPackage);
  7005. $5=$recv($6)._yourself();
  7006. $recv($4)._announce_($5);
  7007. return self;
  7008. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  7009. },
  7010. args: ["aPackage"],
  7011. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  7012. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  7013. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  7014. }),
  7015. $globals.Class);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "printOn:",
  7019. protocol: 'printing',
  7020. fn: function (aStream){
  7021. var self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. $recv(aStream)._nextPutAll_(self._name());
  7024. return self;
  7025. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7026. },
  7027. args: ["aStream"],
  7028. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7029. referencedClasses: [],
  7030. messageSends: ["nextPutAll:", "name"]
  7031. }),
  7032. $globals.Class);
  7033. $core.addMethod(
  7034. $core.method({
  7035. selector: "rename:",
  7036. protocol: 'accessing',
  7037. fn: function (aString){
  7038. var self=this;
  7039. return $core.withContext(function($ctx1) {
  7040. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7041. return self;
  7042. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7043. },
  7044. args: ["aString"],
  7045. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7046. referencedClasses: ["ClassBuilder"],
  7047. messageSends: ["renameClass:to:", "new"]
  7048. }),
  7049. $globals.Class);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "subclass:instanceVariableNames:",
  7053. protocol: 'class creation',
  7054. fn: function (aString,anotherString){
  7055. var self=this;
  7056. return $core.withContext(function($ctx1) {
  7057. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7058. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7059. },
  7060. args: ["aString", "anotherString"],
  7061. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7062. referencedClasses: [],
  7063. messageSends: ["subclass:instanceVariableNames:package:"]
  7064. }),
  7065. $globals.Class);
  7066. $core.addMethod(
  7067. $core.method({
  7068. selector: "subclass:instanceVariableNames:category:",
  7069. protocol: 'class creation',
  7070. fn: function (aString,aString2,aString3){
  7071. var self=this;
  7072. return $core.withContext(function($ctx1) {
  7073. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7074. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7075. },
  7076. args: ["aString", "aString2", "aString3"],
  7077. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7078. referencedClasses: [],
  7079. messageSends: ["subclass:instanceVariableNames:package:"]
  7080. }),
  7081. $globals.Class);
  7082. $core.addMethod(
  7083. $core.method({
  7084. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7085. protocol: 'class creation',
  7086. fn: function (aString,aString2,classVars,pools,aString3){
  7087. var self=this;
  7088. return $core.withContext(function($ctx1) {
  7089. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7090. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7091. },
  7092. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7093. 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",
  7094. referencedClasses: [],
  7095. messageSends: ["subclass:instanceVariableNames:package:"]
  7096. }),
  7097. $globals.Class);
  7098. $core.addMethod(
  7099. $core.method({
  7100. selector: "subclass:instanceVariableNames:package:",
  7101. protocol: 'class creation',
  7102. fn: function (aString,aString2,aString3){
  7103. var self=this;
  7104. return $core.withContext(function($ctx1) {
  7105. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7106. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7107. },
  7108. args: ["aString", "aString2", "aString3"],
  7109. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7110. referencedClasses: ["ClassBuilder"],
  7111. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7112. }),
  7113. $globals.Class);
  7114. $core.addMethod(
  7115. $core.method({
  7116. selector: "subclasses",
  7117. protocol: 'accessing',
  7118. fn: function (){
  7119. var self=this;
  7120. return $core.withContext(function($ctx1) {
  7121. return self.subclasses._copy();
  7122. return self;
  7123. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7124. },
  7125. args: [],
  7126. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  7127. referencedClasses: [],
  7128. messageSends: []
  7129. }),
  7130. $globals.Class);
  7131. $core.addMethod(
  7132. $core.method({
  7133. selector: "theMetaClass",
  7134. protocol: 'accessing',
  7135. fn: function (){
  7136. var self=this;
  7137. return $core.withContext(function($ctx1) {
  7138. return self._class();
  7139. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7140. },
  7141. args: [],
  7142. source: "theMetaClass\x0a\x09^ self class",
  7143. referencedClasses: [],
  7144. messageSends: ["class"]
  7145. }),
  7146. $globals.Class);
  7147. $core.addMethod(
  7148. $core.method({
  7149. selector: "theNonMetaClass",
  7150. protocol: 'accessing',
  7151. fn: function (){
  7152. var self=this;
  7153. return self;
  7154. },
  7155. args: [],
  7156. source: "theNonMetaClass\x0a\x09^ self",
  7157. referencedClasses: [],
  7158. messageSends: []
  7159. }),
  7160. $globals.Class);
  7161. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7162. $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.";
  7163. $core.addMethod(
  7164. $core.method({
  7165. selector: "asJavascript",
  7166. protocol: 'converting',
  7167. fn: function (){
  7168. var self=this;
  7169. return $core.withContext(function($ctx1) {
  7170. var $1;
  7171. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7172. $ctx1.sendIdx[","]=1;
  7173. return $1;
  7174. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7175. },
  7176. args: [],
  7177. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7178. referencedClasses: [],
  7179. messageSends: [",", "name", "instanceClass"]
  7180. }),
  7181. $globals.Metaclass);
  7182. $core.addMethod(
  7183. $core.method({
  7184. selector: "definition",
  7185. protocol: 'accessing',
  7186. fn: function (){
  7187. var self=this;
  7188. return $core.withContext(function($ctx1) {
  7189. var $1;
  7190. return $recv($globals.String)._streamContents_((function(stream){
  7191. return $core.withContext(function($ctx2) {
  7192. $recv(stream)._nextPutAll_(self._asString());
  7193. $ctx2.sendIdx["nextPutAll:"]=1;
  7194. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7195. $ctx2.sendIdx["nextPutAll:"]=2;
  7196. $1;
  7197. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7198. return $core.withContext(function($ctx3) {
  7199. return $recv(stream)._nextPutAll_(each);
  7200. $ctx3.sendIdx["nextPutAll:"]=3;
  7201. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7202. }),(function(){
  7203. return $core.withContext(function($ctx3) {
  7204. return $recv(stream)._nextPutAll_(" ");
  7205. $ctx3.sendIdx["nextPutAll:"]=4;
  7206. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7207. }));
  7208. return $recv(stream)._nextPutAll_("'");
  7209. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7210. }));
  7211. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7212. },
  7213. args: [],
  7214. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  7215. referencedClasses: ["String"],
  7216. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7217. }),
  7218. $globals.Metaclass);
  7219. $core.addMethod(
  7220. $core.method({
  7221. selector: "instanceClass",
  7222. protocol: 'accessing',
  7223. fn: function (){
  7224. var self=this;
  7225. return $core.withContext(function($ctx1) {
  7226. return self.instanceClass;
  7227. return self;
  7228. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7229. },
  7230. args: [],
  7231. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7232. referencedClasses: [],
  7233. messageSends: []
  7234. }),
  7235. $globals.Metaclass);
  7236. $core.addMethod(
  7237. $core.method({
  7238. selector: "instanceVariableNames:",
  7239. protocol: 'accessing',
  7240. fn: function (aCollection){
  7241. var self=this;
  7242. return $core.withContext(function($ctx1) {
  7243. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7244. return self;
  7245. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7246. },
  7247. args: ["aCollection"],
  7248. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7249. referencedClasses: ["ClassBuilder"],
  7250. messageSends: ["class:instanceVariableNames:", "new"]
  7251. }),
  7252. $globals.Metaclass);
  7253. $core.addMethod(
  7254. $core.method({
  7255. selector: "isMetaclass",
  7256. protocol: 'testing',
  7257. fn: function (){
  7258. var self=this;
  7259. return true;
  7260. },
  7261. args: [],
  7262. source: "isMetaclass\x0a\x09^ true",
  7263. referencedClasses: [],
  7264. messageSends: []
  7265. }),
  7266. $globals.Metaclass);
  7267. $core.addMethod(
  7268. $core.method({
  7269. selector: "package",
  7270. protocol: 'accessing',
  7271. fn: function (){
  7272. var self=this;
  7273. return $core.withContext(function($ctx1) {
  7274. return $recv(self._instanceClass())._package();
  7275. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7276. },
  7277. args: [],
  7278. source: "package\x0a\x09^ self instanceClass package",
  7279. referencedClasses: [],
  7280. messageSends: ["package", "instanceClass"]
  7281. }),
  7282. $globals.Metaclass);
  7283. $core.addMethod(
  7284. $core.method({
  7285. selector: "printOn:",
  7286. protocol: 'printing',
  7287. fn: function (aStream){
  7288. var self=this;
  7289. return $core.withContext(function($ctx1) {
  7290. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7291. $ctx1.sendIdx["nextPutAll:"]=1;
  7292. $recv(aStream)._nextPutAll_(" class");
  7293. return self;
  7294. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7295. },
  7296. args: ["aStream"],
  7297. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7298. referencedClasses: [],
  7299. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7300. }),
  7301. $globals.Metaclass);
  7302. $core.addMethod(
  7303. $core.method({
  7304. selector: "subclasses",
  7305. protocol: 'accessing',
  7306. fn: function (){
  7307. var self=this;
  7308. return $core.withContext(function($ctx1) {
  7309. return $core.metaSubclasses(self);
  7310. return self;
  7311. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7312. },
  7313. args: [],
  7314. source: "subclasses\x0a\x09<return $core.metaSubclasses(self)>",
  7315. referencedClasses: [],
  7316. messageSends: []
  7317. }),
  7318. $globals.Metaclass);
  7319. $core.addMethod(
  7320. $core.method({
  7321. selector: "theMetaClass",
  7322. protocol: 'accessing',
  7323. fn: function (){
  7324. var self=this;
  7325. return self;
  7326. },
  7327. args: [],
  7328. source: "theMetaClass\x0a\x09^ self",
  7329. referencedClasses: [],
  7330. messageSends: []
  7331. }),
  7332. $globals.Metaclass);
  7333. $core.addMethod(
  7334. $core.method({
  7335. selector: "theNonMetaClass",
  7336. protocol: 'accessing',
  7337. fn: function (){
  7338. var self=this;
  7339. return $core.withContext(function($ctx1) {
  7340. return self._instanceClass();
  7341. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7342. },
  7343. args: [],
  7344. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7345. referencedClasses: [],
  7346. messageSends: ["instanceClass"]
  7347. }),
  7348. $globals.Metaclass);
  7349. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7350. $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:`.";
  7351. $core.addMethod(
  7352. $core.method({
  7353. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7354. protocol: 'class definition',
  7355. fn: function (aClass,className,aCollection,packageName){
  7356. var self=this;
  7357. var theClass,thePackage;
  7358. return $core.withContext(function($ctx1) {
  7359. var $1,$2,$receiver;
  7360. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7361. thePackage=$recv($globals.Package)._named_(packageName);
  7362. $1=theClass;
  7363. if(($receiver = $1) == null || $receiver.isNil){
  7364. $1;
  7365. } else {
  7366. $recv(theClass)._package_(thePackage);
  7367. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7368. if(!$core.assert($2)){
  7369. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7370. };
  7371. };
  7372. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7373. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7374. },
  7375. args: ["aClass", "className", "aCollection", "packageName"],
  7376. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  7377. referencedClasses: ["Smalltalk", "Package"],
  7378. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7379. }),
  7380. $globals.ClassBuilder);
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7384. protocol: 'private',
  7385. fn: function (aClass,aString,aCollection,packageName){
  7386. var self=this;
  7387. return $core.withContext(function($ctx1) {
  7388. return $core.addClass(aString, aClass, aCollection, packageName);
  7389. ;
  7390. return self;
  7391. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7392. },
  7393. args: ["aClass", "aString", "aCollection", "packageName"],
  7394. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09>",
  7395. referencedClasses: [],
  7396. messageSends: []
  7397. }),
  7398. $globals.ClassBuilder);
  7399. $core.addMethod(
  7400. $core.method({
  7401. selector: "basicClass:instanceVariableNames:",
  7402. protocol: 'private',
  7403. fn: function (aClass,aString){
  7404. var self=this;
  7405. return $core.withContext(function($ctx1) {
  7406. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7407. return self;
  7408. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7409. },
  7410. args: ["aClass", "aString"],
  7411. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7412. referencedClasses: [],
  7413. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7414. }),
  7415. $globals.ClassBuilder);
  7416. $core.addMethod(
  7417. $core.method({
  7418. selector: "basicClass:instanceVariables:",
  7419. protocol: 'private',
  7420. fn: function (aClass,aCollection){
  7421. var self=this;
  7422. return $core.withContext(function($ctx1) {
  7423. var $1;
  7424. $1=$recv(aClass)._isMetaclass();
  7425. if(!$core.assert($1)){
  7426. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7427. };
  7428. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7429. return self;
  7430. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7431. },
  7432. args: ["aClass", "aCollection"],
  7433. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7434. referencedClasses: [],
  7435. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7436. }),
  7437. $globals.ClassBuilder);
  7438. $core.addMethod(
  7439. $core.method({
  7440. selector: "basicRemoveClass:",
  7441. protocol: 'private',
  7442. fn: function (aClass){
  7443. var self=this;
  7444. return $core.withContext(function($ctx1) {
  7445. $core.removeClass(aClass);
  7446. return self;
  7447. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7448. },
  7449. args: ["aClass"],
  7450. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7451. referencedClasses: [],
  7452. messageSends: []
  7453. }),
  7454. $globals.ClassBuilder);
  7455. $core.addMethod(
  7456. $core.method({
  7457. selector: "basicRenameClass:to:",
  7458. protocol: 'private',
  7459. fn: function (aClass,aString){
  7460. var self=this;
  7461. return $core.withContext(function($ctx1) {
  7462. $globals[aString] = aClass;
  7463. delete $globals[aClass.className];
  7464. aClass.className = aString;
  7465. ;
  7466. return self;
  7467. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7468. },
  7469. args: ["aClass", "aString"],
  7470. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7471. referencedClasses: [],
  7472. messageSends: []
  7473. }),
  7474. $globals.ClassBuilder);
  7475. $core.addMethod(
  7476. $core.method({
  7477. selector: "basicSwapClassNames:with:",
  7478. protocol: 'private',
  7479. fn: function (aClass,anotherClass){
  7480. var self=this;
  7481. return $core.withContext(function($ctx1) {
  7482. var tmp = aClass.className;
  7483. aClass.className = anotherClass.className;
  7484. anotherClass.className = tmp;
  7485. ;
  7486. return self;
  7487. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7488. },
  7489. args: ["aClass", "anotherClass"],
  7490. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7491. referencedClasses: [],
  7492. messageSends: []
  7493. }),
  7494. $globals.ClassBuilder);
  7495. $core.addMethod(
  7496. $core.method({
  7497. selector: "class:instanceVariableNames:",
  7498. protocol: 'class definition',
  7499. fn: function (aClass,ivarNames){
  7500. var self=this;
  7501. return $core.withContext(function($ctx1) {
  7502. var $1,$3,$2;
  7503. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7504. $1=$recv($globals.SystemAnnouncer)._current();
  7505. $3=$recv($globals.ClassDefinitionChanged)._new();
  7506. $recv($3)._theClass_(aClass);
  7507. $2=$recv($3)._yourself();
  7508. $recv($1)._announce_($2);
  7509. return self;
  7510. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7511. },
  7512. args: ["aClass", "ivarNames"],
  7513. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7514. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7515. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  7516. }),
  7517. $globals.ClassBuilder);
  7518. $core.addMethod(
  7519. $core.method({
  7520. selector: "copyClass:named:",
  7521. protocol: 'copying',
  7522. fn: function (aClass,className){
  7523. var self=this;
  7524. var newClass;
  7525. return $core.withContext(function($ctx1) {
  7526. var $1,$3,$2;
  7527. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7528. self._copyClass_to_(aClass,newClass);
  7529. $1=$recv($globals.SystemAnnouncer)._current();
  7530. $3=$recv($globals.ClassAdded)._new();
  7531. $recv($3)._theClass_(newClass);
  7532. $2=$recv($3)._yourself();
  7533. $recv($1)._announce_($2);
  7534. return newClass;
  7535. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7536. },
  7537. args: ["aClass", "className"],
  7538. 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",
  7539. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7540. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7541. }),
  7542. $globals.ClassBuilder);
  7543. $core.addMethod(
  7544. $core.method({
  7545. selector: "copyClass:to:",
  7546. protocol: 'copying',
  7547. fn: function (aClass,anotherClass){
  7548. var self=this;
  7549. return $core.withContext(function($ctx1) {
  7550. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7551. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7552. $1=$recv(aClass)._methodDictionary();
  7553. $ctx1.sendIdx["methodDictionary"]=1;
  7554. $recv($1)._valuesDo_((function(each){
  7555. return $core.withContext(function($ctx2) {
  7556. $2=$recv($globals.Compiler)._new();
  7557. $ctx2.sendIdx["new"]=1;
  7558. $3=$recv(each)._source();
  7559. $ctx2.sendIdx["source"]=1;
  7560. $4=$recv(each)._protocol();
  7561. $ctx2.sendIdx["protocol"]=1;
  7562. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7563. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7565. }));
  7566. $ctx1.sendIdx["valuesDo:"]=1;
  7567. $5=$recv(anotherClass)._class();
  7568. $ctx1.sendIdx["class"]=1;
  7569. $7=$recv(aClass)._class();
  7570. $ctx1.sendIdx["class"]=2;
  7571. $6=$recv($7)._instanceVariableNames();
  7572. self._basicClass_instanceVariables_($5,$6);
  7573. $9=$recv(aClass)._class();
  7574. $ctx1.sendIdx["class"]=3;
  7575. $8=$recv($9)._methodDictionary();
  7576. $recv($8)._valuesDo_((function(each){
  7577. return $core.withContext(function($ctx2) {
  7578. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7580. }));
  7581. return self;
  7582. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7583. },
  7584. args: ["aClass", "anotherClass"],
  7585. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ]",
  7586. referencedClasses: ["Compiler"],
  7587. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  7588. }),
  7589. $globals.ClassBuilder);
  7590. $core.addMethod(
  7591. $core.method({
  7592. selector: "installMethod:forClass:protocol:",
  7593. protocol: 'method definition',
  7594. fn: function (aCompiledMethod,aBehavior,aString){
  7595. var self=this;
  7596. return $core.withContext(function($ctx1) {
  7597. $recv(aCompiledMethod)._protocol_(aString);
  7598. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7599. return aCompiledMethod;
  7600. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7601. },
  7602. args: ["aCompiledMethod", "aBehavior", "aString"],
  7603. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7604. referencedClasses: [],
  7605. messageSends: ["protocol:", "addCompiledMethod:"]
  7606. }),
  7607. $globals.ClassBuilder);
  7608. $core.addMethod(
  7609. $core.method({
  7610. selector: "instanceVariableNamesFor:",
  7611. protocol: 'accessing',
  7612. fn: function (aString){
  7613. var self=this;
  7614. return $core.withContext(function($ctx1) {
  7615. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7616. return $core.withContext(function($ctx2) {
  7617. return $recv(each)._isEmpty();
  7618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7619. }));
  7620. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7621. },
  7622. args: ["aString"],
  7623. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7624. referencedClasses: [],
  7625. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7626. }),
  7627. $globals.ClassBuilder);
  7628. $core.addMethod(
  7629. $core.method({
  7630. selector: "migrateClass:superclass:",
  7631. protocol: 'class migration',
  7632. fn: function (aClass,anotherClass){
  7633. var self=this;
  7634. return $core.withContext(function($ctx1) {
  7635. var $1;
  7636. $1=$recv(aClass)._name();
  7637. $ctx1.sendIdx["name"]=1;
  7638. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7639. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7640. },
  7641. args: ["aClass", "anotherClass"],
  7642. 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",
  7643. referencedClasses: [],
  7644. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7645. }),
  7646. $globals.ClassBuilder);
  7647. $core.addMethod(
  7648. $core.method({
  7649. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7650. protocol: 'class migration',
  7651. fn: function (className,aClass,aCollection,packageName){
  7652. var self=this;
  7653. var oldClass,newClass,tmp;
  7654. return $core.withContext(function($ctx1) {
  7655. var $1,$2,$4,$3;
  7656. tmp="new*".__comma(className);
  7657. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7658. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7659. self._basicSwapClassNames_with_(oldClass,newClass);
  7660. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7661. $recv((function(){
  7662. return $core.withContext(function($ctx2) {
  7663. return self._copyClass_to_(oldClass,newClass);
  7664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7665. }))._on_do_($globals.Error,(function(exception){
  7666. return $core.withContext(function($ctx2) {
  7667. self._basicSwapClassNames_with_(oldClass,newClass);
  7668. $1=self._basicRemoveClass_(newClass);
  7669. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7670. $1;
  7671. return $recv(exception)._resignal();
  7672. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7673. }));
  7674. self._rawRenameClass_to_(oldClass,tmp);
  7675. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7676. self._rawRenameClass_to_(newClass,className);
  7677. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7678. return $core.withContext(function($ctx2) {
  7679. return self._migrateClass_superclass_(each,newClass);
  7680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7681. }));
  7682. self._basicRemoveClass_(oldClass);
  7683. $2=$recv($globals.SystemAnnouncer)._current();
  7684. $4=$recv($globals.ClassMigrated)._new();
  7685. $recv($4)._theClass_(newClass);
  7686. $recv($4)._oldClass_(oldClass);
  7687. $3=$recv($4)._yourself();
  7688. $recv($2)._announce_($3);
  7689. return newClass;
  7690. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  7691. },
  7692. args: ["className", "aClass", "aCollection", "packageName"],
  7693. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7694. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7695. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  7696. }),
  7697. $globals.ClassBuilder);
  7698. $core.addMethod(
  7699. $core.method({
  7700. selector: "rawRenameClass:to:",
  7701. protocol: 'private',
  7702. fn: function (aClass,aString){
  7703. var self=this;
  7704. return $core.withContext(function($ctx1) {
  7705. $globals[aString] = aClass;
  7706. ;
  7707. return self;
  7708. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7709. },
  7710. args: ["aClass", "aString"],
  7711. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7712. referencedClasses: [],
  7713. messageSends: []
  7714. }),
  7715. $globals.ClassBuilder);
  7716. $core.addMethod(
  7717. $core.method({
  7718. selector: "renameClass:to:",
  7719. protocol: 'class migration',
  7720. fn: function (aClass,className){
  7721. var self=this;
  7722. return $core.withContext(function($ctx1) {
  7723. var $1,$3,$2;
  7724. self._basicRenameClass_to_(aClass,className);
  7725. $recv(aClass)._recompile();
  7726. $1=$recv($globals.SystemAnnouncer)._current();
  7727. $3=$recv($globals.ClassRenamed)._new();
  7728. $recv($3)._theClass_(aClass);
  7729. $2=$recv($3)._yourself();
  7730. $recv($1)._announce_($2);
  7731. return self;
  7732. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7733. },
  7734. args: ["aClass", "className"],
  7735. 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)",
  7736. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7737. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7738. }),
  7739. $globals.ClassBuilder);
  7740. $core.addMethod(
  7741. $core.method({
  7742. selector: "setupClass:",
  7743. protocol: 'public',
  7744. fn: function (aClass){
  7745. var self=this;
  7746. return $core.withContext(function($ctx1) {
  7747. self._deprecatedAPI_("Classes are now auto-inited.");
  7748. return self;
  7749. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7750. },
  7751. args: ["aClass"],
  7752. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  7753. referencedClasses: [],
  7754. messageSends: ["deprecatedAPI:"]
  7755. }),
  7756. $globals.ClassBuilder);
  7757. $core.addMethod(
  7758. $core.method({
  7759. selector: "superclass:subclass:",
  7760. protocol: 'class definition',
  7761. fn: function (aClass,className){
  7762. var self=this;
  7763. return $core.withContext(function($ctx1) {
  7764. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7765. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7766. },
  7767. args: ["aClass", "className"],
  7768. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7769. referencedClasses: [],
  7770. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7771. }),
  7772. $globals.ClassBuilder);
  7773. $core.addMethod(
  7774. $core.method({
  7775. selector: "superclass:subclass:instanceVariableNames:package:",
  7776. protocol: 'class definition',
  7777. fn: function (aClass,className,ivarNames,packageName){
  7778. var self=this;
  7779. var newClass;
  7780. return $core.withContext(function($ctx1) {
  7781. var $1,$2,$3,$5,$4,$receiver;
  7782. $1=self._instanceVariableNamesFor_(ivarNames);
  7783. if(($receiver = packageName) == null || $receiver.isNil){
  7784. $2="unclassified";
  7785. } else {
  7786. $2=packageName;
  7787. };
  7788. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7789. $3=$recv($globals.SystemAnnouncer)._current();
  7790. $5=$recv($globals.ClassAdded)._new();
  7791. $recv($5)._theClass_(newClass);
  7792. $4=$recv($5)._yourself();
  7793. $recv($3)._announce_($4);
  7794. return newClass;
  7795. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7796. },
  7797. args: ["aClass", "className", "ivarNames", "packageName"],
  7798. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7799. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7800. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  7801. }),
  7802. $globals.ClassBuilder);
  7803. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7804. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  7805. $core.addMethod(
  7806. $core.method({
  7807. selector: "getNodesFrom:",
  7808. protocol: 'accessing',
  7809. fn: function (aCollection){
  7810. var self=this;
  7811. var children,others;
  7812. return $core.withContext(function($ctx1) {
  7813. var $1;
  7814. children=[];
  7815. others=[];
  7816. $recv(aCollection)._do_((function(each){
  7817. return $core.withContext(function($ctx2) {
  7818. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7819. if($core.assert($1)){
  7820. return $recv(children)._add_(each);
  7821. $ctx2.sendIdx["add:"]=1;
  7822. } else {
  7823. return $recv(others)._add_(each);
  7824. };
  7825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7826. }));
  7827. self["@nodes"]=$recv(children)._collect_((function(each){
  7828. return $core.withContext(function($ctx2) {
  7829. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7831. }));
  7832. return self;
  7833. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7834. },
  7835. args: ["aCollection"],
  7836. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  7837. referencedClasses: ["ClassSorterNode"],
  7838. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7839. }),
  7840. $globals.ClassSorterNode);
  7841. $core.addMethod(
  7842. $core.method({
  7843. selector: "level",
  7844. protocol: 'accessing',
  7845. fn: function (){
  7846. var self=this;
  7847. return self["@level"];
  7848. },
  7849. args: [],
  7850. source: "level\x0a\x09^ level",
  7851. referencedClasses: [],
  7852. messageSends: []
  7853. }),
  7854. $globals.ClassSorterNode);
  7855. $core.addMethod(
  7856. $core.method({
  7857. selector: "level:",
  7858. protocol: 'accessing',
  7859. fn: function (anInteger){
  7860. var self=this;
  7861. self["@level"]=anInteger;
  7862. return self;
  7863. },
  7864. args: ["anInteger"],
  7865. source: "level: anInteger\x0a\x09level := anInteger",
  7866. referencedClasses: [],
  7867. messageSends: []
  7868. }),
  7869. $globals.ClassSorterNode);
  7870. $core.addMethod(
  7871. $core.method({
  7872. selector: "nodes",
  7873. protocol: 'accessing',
  7874. fn: function (){
  7875. var self=this;
  7876. return self["@nodes"];
  7877. },
  7878. args: [],
  7879. source: "nodes\x0a\x09^ nodes",
  7880. referencedClasses: [],
  7881. messageSends: []
  7882. }),
  7883. $globals.ClassSorterNode);
  7884. $core.addMethod(
  7885. $core.method({
  7886. selector: "theClass",
  7887. protocol: 'accessing',
  7888. fn: function (){
  7889. var self=this;
  7890. return self["@theClass"];
  7891. },
  7892. args: [],
  7893. source: "theClass\x0a\x09^ theClass",
  7894. referencedClasses: [],
  7895. messageSends: []
  7896. }),
  7897. $globals.ClassSorterNode);
  7898. $core.addMethod(
  7899. $core.method({
  7900. selector: "theClass:",
  7901. protocol: 'accessing',
  7902. fn: function (aClass){
  7903. var self=this;
  7904. self["@theClass"]=aClass;
  7905. return self;
  7906. },
  7907. args: ["aClass"],
  7908. source: "theClass: aClass\x0a\x09theClass := aClass",
  7909. referencedClasses: [],
  7910. messageSends: []
  7911. }),
  7912. $globals.ClassSorterNode);
  7913. $core.addMethod(
  7914. $core.method({
  7915. selector: "traverseClassesWith:",
  7916. protocol: 'visiting',
  7917. fn: function (aCollection){
  7918. var self=this;
  7919. return $core.withContext(function($ctx1) {
  7920. var $1,$3,$2;
  7921. $1=self._theClass();
  7922. $ctx1.sendIdx["theClass"]=1;
  7923. $recv(aCollection)._add_($1);
  7924. $recv($recv(self._nodes())._sorted_((function(a,b){
  7925. return $core.withContext(function($ctx2) {
  7926. $3=$recv(a)._theClass();
  7927. $ctx2.sendIdx["theClass"]=2;
  7928. $2=$recv($3)._name();
  7929. $ctx2.sendIdx["name"]=1;
  7930. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7931. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7932. })))._do_((function(aNode){
  7933. return $core.withContext(function($ctx2) {
  7934. return $recv(aNode)._traverseClassesWith_(aCollection);
  7935. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7936. }));
  7937. return self;
  7938. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7939. },
  7940. args: ["aCollection"],
  7941. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  7942. referencedClasses: [],
  7943. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7944. }),
  7945. $globals.ClassSorterNode);
  7946. $core.addMethod(
  7947. $core.method({
  7948. selector: "on:classes:level:",
  7949. protocol: 'instance creation',
  7950. fn: function (aClass,aCollection,anInteger){
  7951. var self=this;
  7952. return $core.withContext(function($ctx1) {
  7953. var $1;
  7954. $1=self._new();
  7955. $recv($1)._theClass_(aClass);
  7956. $recv($1)._level_(anInteger);
  7957. $recv($1)._getNodesFrom_(aCollection);
  7958. return $recv($1)._yourself();
  7959. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7960. },
  7961. args: ["aClass", "aCollection", "anInteger"],
  7962. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  7963. referencedClasses: [],
  7964. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7965. }),
  7966. $globals.ClassSorterNode.klass);
  7967. });
  7968. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7969. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7970. $core.addPackage('Kernel-Methods');
  7971. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7972. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7973. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7974. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "applyTo:arguments:",
  7978. protocol: 'evaluating',
  7979. fn: function (anObject,aCollection){
  7980. var self=this;
  7981. return $core.withContext(function($ctx1) {
  7982. return self.apply(anObject, aCollection);
  7983. return self;
  7984. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7985. },
  7986. args: ["anObject", "aCollection"],
  7987. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7988. referencedClasses: [],
  7989. messageSends: []
  7990. }),
  7991. $globals.BlockClosure);
  7992. $core.addMethod(
  7993. $core.method({
  7994. selector: "asCompiledMethod:",
  7995. protocol: 'converting',
  7996. fn: function (aString){
  7997. var self=this;
  7998. return $core.withContext(function($ctx1) {
  7999. return $core.method({selector:aString, fn:self});;
  8000. return self;
  8001. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  8002. },
  8003. args: ["aString"],
  8004. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  8005. referencedClasses: [],
  8006. messageSends: []
  8007. }),
  8008. $globals.BlockClosure);
  8009. $core.addMethod(
  8010. $core.method({
  8011. selector: "compiledSource",
  8012. protocol: 'accessing',
  8013. fn: function (){
  8014. var self=this;
  8015. return $core.withContext(function($ctx1) {
  8016. return self.toString();
  8017. return self;
  8018. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8019. },
  8020. args: [],
  8021. source: "compiledSource\x0a\x09<return self.toString()>",
  8022. referencedClasses: [],
  8023. messageSends: []
  8024. }),
  8025. $globals.BlockClosure);
  8026. $core.addMethod(
  8027. $core.method({
  8028. selector: "currySelf",
  8029. protocol: 'converting',
  8030. fn: function (){
  8031. var self=this;
  8032. return $core.withContext(function($ctx1) {
  8033. return function () {
  8034. var args = [ this ];
  8035. args.push.apply(args, arguments);
  8036. return self.apply(null, args);
  8037. }
  8038. ;
  8039. return self;
  8040. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8041. },
  8042. args: [],
  8043. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  8044. referencedClasses: [],
  8045. messageSends: []
  8046. }),
  8047. $globals.BlockClosure);
  8048. $core.addMethod(
  8049. $core.method({
  8050. selector: "ensure:",
  8051. protocol: 'evaluating',
  8052. fn: function (aBlock){
  8053. var self=this;
  8054. return $core.withContext(function($ctx1) {
  8055. try{return self._value()}finally{aBlock._value()};
  8056. return self;
  8057. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8058. },
  8059. args: ["aBlock"],
  8060. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8061. referencedClasses: [],
  8062. messageSends: []
  8063. }),
  8064. $globals.BlockClosure);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "fork",
  8068. protocol: 'timeout/interval',
  8069. fn: function (){
  8070. var self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8073. return self;
  8074. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8075. },
  8076. args: [],
  8077. source: "fork\x0a\x09ForkPool default fork: self",
  8078. referencedClasses: ["ForkPool"],
  8079. messageSends: ["fork:", "default"]
  8080. }),
  8081. $globals.BlockClosure);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "new",
  8085. protocol: 'evaluating',
  8086. fn: function (){
  8087. var self=this;
  8088. return $core.withContext(function($ctx1) {
  8089. return new self();
  8090. return self;
  8091. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8092. },
  8093. args: [],
  8094. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
  8095. referencedClasses: [],
  8096. messageSends: []
  8097. }),
  8098. $globals.BlockClosure);
  8099. $core.addMethod(
  8100. $core.method({
  8101. selector: "newValue:",
  8102. protocol: 'evaluating',
  8103. fn: function (anObject){
  8104. var self=this;
  8105. return $core.withContext(function($ctx1) {
  8106. return self._newWithValues_([anObject]);
  8107. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8108. },
  8109. args: ["anObject"],
  8110. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8111. referencedClasses: [],
  8112. messageSends: ["newWithValues:"]
  8113. }),
  8114. $globals.BlockClosure);
  8115. $core.addMethod(
  8116. $core.method({
  8117. selector: "newValue:value:",
  8118. protocol: 'evaluating',
  8119. fn: function (anObject,anObject2){
  8120. var self=this;
  8121. return $core.withContext(function($ctx1) {
  8122. return self._newWithValues_([anObject,anObject2]);
  8123. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8124. },
  8125. args: ["anObject", "anObject2"],
  8126. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8127. referencedClasses: [],
  8128. messageSends: ["newWithValues:"]
  8129. }),
  8130. $globals.BlockClosure);
  8131. $core.addMethod(
  8132. $core.method({
  8133. selector: "newValue:value:value:",
  8134. protocol: 'evaluating',
  8135. fn: function (anObject,anObject2,anObject3){
  8136. var self=this;
  8137. return $core.withContext(function($ctx1) {
  8138. return self._newWithValues_([anObject,anObject2,anObject3]);
  8139. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8140. },
  8141. args: ["anObject", "anObject2", "anObject3"],
  8142. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8143. referencedClasses: [],
  8144. messageSends: ["newWithValues:"]
  8145. }),
  8146. $globals.BlockClosure);
  8147. $core.addMethod(
  8148. $core.method({
  8149. selector: "newWithValues:",
  8150. protocol: 'evaluating',
  8151. fn: function (aCollection){
  8152. var self=this;
  8153. return $core.withContext(function($ctx1) {
  8154. var object = Object.create(self.prototype);
  8155. var result = self.apply(object, aCollection);
  8156. return typeof result === "object" ? result : object;
  8157. ;
  8158. return self;
  8159. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8160. },
  8161. args: ["aCollection"],
  8162. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  8163. referencedClasses: [],
  8164. messageSends: []
  8165. }),
  8166. $globals.BlockClosure);
  8167. $core.addMethod(
  8168. $core.method({
  8169. selector: "numArgs",
  8170. protocol: 'accessing',
  8171. fn: function (){
  8172. var self=this;
  8173. return $core.withContext(function($ctx1) {
  8174. return self.length;
  8175. return self;
  8176. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8177. },
  8178. args: [],
  8179. source: "numArgs\x0a\x09<return self.length>",
  8180. referencedClasses: [],
  8181. messageSends: []
  8182. }),
  8183. $globals.BlockClosure);
  8184. $core.addMethod(
  8185. $core.method({
  8186. selector: "on:do:",
  8187. protocol: 'error handling',
  8188. fn: function (anErrorClass,aBlock){
  8189. var self=this;
  8190. return $core.withContext(function($ctx1) {
  8191. var $1;
  8192. return self._tryCatch_((function(error){
  8193. var smalltalkError;
  8194. return $core.withContext(function($ctx2) {
  8195. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8196. smalltalkError;
  8197. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8198. if($core.assert($1)){
  8199. return $recv(aBlock)._value_(smalltalkError);
  8200. } else {
  8201. return $recv(smalltalkError)._resignal();
  8202. };
  8203. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8204. }));
  8205. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8206. },
  8207. args: ["anErrorClass", "aBlock"],
  8208. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  8209. referencedClasses: ["Smalltalk"],
  8210. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8211. }),
  8212. $globals.BlockClosure);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "receiver",
  8216. protocol: 'accessing',
  8217. fn: function (){
  8218. var self=this;
  8219. return nil;
  8220. },
  8221. args: [],
  8222. source: "receiver\x0a\x09^ nil",
  8223. referencedClasses: [],
  8224. messageSends: []
  8225. }),
  8226. $globals.BlockClosure);
  8227. $core.addMethod(
  8228. $core.method({
  8229. selector: "timeToRun",
  8230. protocol: 'evaluating',
  8231. fn: function (){
  8232. var self=this;
  8233. return $core.withContext(function($ctx1) {
  8234. return $recv($globals.Date)._millisecondsToRun_(self);
  8235. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8236. },
  8237. args: [],
  8238. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8239. referencedClasses: ["Date"],
  8240. messageSends: ["millisecondsToRun:"]
  8241. }),
  8242. $globals.BlockClosure);
  8243. $core.addMethod(
  8244. $core.method({
  8245. selector: "tryCatch:",
  8246. protocol: 'error handling',
  8247. fn: function (aBlock){
  8248. var self=this;
  8249. return $core.withContext(function($ctx1) {
  8250. try {
  8251. return self._value();
  8252. } catch(error) {
  8253. // pass non-local returns undetected
  8254. if (Array.isArray(error) && error.length === 1) throw error;
  8255. return aBlock._value_(error);
  8256. }
  8257. ;
  8258. return self;
  8259. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8260. },
  8261. args: ["aBlock"],
  8262. source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
  8263. referencedClasses: [],
  8264. messageSends: []
  8265. }),
  8266. $globals.BlockClosure);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "value",
  8270. protocol: 'evaluating',
  8271. fn: function (){
  8272. var self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return self();;
  8275. return self;
  8276. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8277. },
  8278. args: [],
  8279. source: "value\x0a\x09<return self();>",
  8280. referencedClasses: [],
  8281. messageSends: []
  8282. }),
  8283. $globals.BlockClosure);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "value:",
  8287. protocol: 'evaluating',
  8288. fn: function (anArg){
  8289. var self=this;
  8290. return $core.withContext(function($ctx1) {
  8291. return self(anArg);;
  8292. return self;
  8293. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8294. },
  8295. args: ["anArg"],
  8296. source: "value: anArg\x0a\x09<return self(anArg);>",
  8297. referencedClasses: [],
  8298. messageSends: []
  8299. }),
  8300. $globals.BlockClosure);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "value:value:",
  8304. protocol: 'evaluating',
  8305. fn: function (firstArg,secondArg){
  8306. var self=this;
  8307. return $core.withContext(function($ctx1) {
  8308. return self(firstArg, secondArg);;
  8309. return self;
  8310. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8311. },
  8312. args: ["firstArg", "secondArg"],
  8313. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  8314. referencedClasses: [],
  8315. messageSends: []
  8316. }),
  8317. $globals.BlockClosure);
  8318. $core.addMethod(
  8319. $core.method({
  8320. selector: "value:value:value:",
  8321. protocol: 'evaluating',
  8322. fn: function (firstArg,secondArg,thirdArg){
  8323. var self=this;
  8324. return $core.withContext(function($ctx1) {
  8325. return self(firstArg, secondArg, thirdArg);;
  8326. return self;
  8327. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8328. },
  8329. args: ["firstArg", "secondArg", "thirdArg"],
  8330. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8331. referencedClasses: [],
  8332. messageSends: []
  8333. }),
  8334. $globals.BlockClosure);
  8335. $core.addMethod(
  8336. $core.method({
  8337. selector: "valueWithInterval:",
  8338. protocol: 'timeout/interval',
  8339. fn: function (aNumber){
  8340. var self=this;
  8341. return $core.withContext(function($ctx1) {
  8342. var interval = setInterval(self, aNumber);
  8343. return $globals.Timeout._on_(interval);
  8344. ;
  8345. return self;
  8346. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8347. },
  8348. args: ["aNumber"],
  8349. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8350. referencedClasses: [],
  8351. messageSends: []
  8352. }),
  8353. $globals.BlockClosure);
  8354. $core.addMethod(
  8355. $core.method({
  8356. selector: "valueWithPossibleArguments:",
  8357. protocol: 'evaluating',
  8358. fn: function (aCollection){
  8359. var self=this;
  8360. return $core.withContext(function($ctx1) {
  8361. return self.apply(null, aCollection);;
  8362. return self;
  8363. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8364. },
  8365. args: ["aCollection"],
  8366. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8367. referencedClasses: [],
  8368. messageSends: []
  8369. }),
  8370. $globals.BlockClosure);
  8371. $core.addMethod(
  8372. $core.method({
  8373. selector: "valueWithTimeout:",
  8374. protocol: 'timeout/interval',
  8375. fn: function (aNumber){
  8376. var self=this;
  8377. return $core.withContext(function($ctx1) {
  8378. var timeout = setTimeout(self, aNumber);
  8379. return $globals.Timeout._on_(timeout);
  8380. ;
  8381. return self;
  8382. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8383. },
  8384. args: ["aNumber"],
  8385. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8386. referencedClasses: [],
  8387. messageSends: []
  8388. }),
  8389. $globals.BlockClosure);
  8390. $core.addMethod(
  8391. $core.method({
  8392. selector: "whileFalse",
  8393. protocol: 'controlling',
  8394. fn: function (){
  8395. var self=this;
  8396. return $core.withContext(function($ctx1) {
  8397. self._whileFalse_((function(){
  8398. }));
  8399. return self;
  8400. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8401. },
  8402. args: [],
  8403. source: "whileFalse\x0a\x09self whileFalse: []",
  8404. referencedClasses: [],
  8405. messageSends: ["whileFalse:"]
  8406. }),
  8407. $globals.BlockClosure);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "whileFalse:",
  8411. protocol: 'controlling',
  8412. fn: function (aBlock){
  8413. var self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. while(!$core.assert(self._value())) {aBlock._value()};
  8416. return self;
  8417. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8418. },
  8419. args: ["aBlock"],
  8420. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8421. referencedClasses: [],
  8422. messageSends: []
  8423. }),
  8424. $globals.BlockClosure);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "whileTrue",
  8428. protocol: 'controlling',
  8429. fn: function (){
  8430. var self=this;
  8431. return $core.withContext(function($ctx1) {
  8432. self._whileTrue_((function(){
  8433. }));
  8434. return self;
  8435. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8436. },
  8437. args: [],
  8438. source: "whileTrue\x0a\x09self whileTrue: []",
  8439. referencedClasses: [],
  8440. messageSends: ["whileTrue:"]
  8441. }),
  8442. $globals.BlockClosure);
  8443. $core.addMethod(
  8444. $core.method({
  8445. selector: "whileTrue:",
  8446. protocol: 'controlling',
  8447. fn: function (aBlock){
  8448. var self=this;
  8449. return $core.withContext(function($ctx1) {
  8450. while($core.assert(self._value())) {aBlock._value()};
  8451. return self;
  8452. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8453. },
  8454. args: ["aBlock"],
  8455. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8456. referencedClasses: [],
  8457. messageSends: []
  8458. }),
  8459. $globals.BlockClosure);
  8460. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8461. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "arguments",
  8465. protocol: 'accessing',
  8466. fn: function (){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. return self.args || [];
  8470. return self;
  8471. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8472. },
  8473. args: [],
  8474. source: "arguments\x0a\x09<return self.args || []>",
  8475. referencedClasses: [],
  8476. messageSends: []
  8477. }),
  8478. $globals.CompiledMethod);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "browse",
  8482. protocol: 'browsing',
  8483. fn: function (){
  8484. var self=this;
  8485. return $core.withContext(function($ctx1) {
  8486. $recv($globals.Finder)._findMethod_(self);
  8487. return self;
  8488. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8489. },
  8490. args: [],
  8491. source: "browse\x0a\x09Finder findMethod: self",
  8492. referencedClasses: ["Finder"],
  8493. messageSends: ["findMethod:"]
  8494. }),
  8495. $globals.CompiledMethod);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "category",
  8499. protocol: 'accessing',
  8500. fn: function (){
  8501. var self=this;
  8502. return $core.withContext(function($ctx1) {
  8503. return self._protocol();
  8504. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8505. },
  8506. args: [],
  8507. source: "category\x0a\x09^ self protocol",
  8508. referencedClasses: [],
  8509. messageSends: ["protocol"]
  8510. }),
  8511. $globals.CompiledMethod);
  8512. $core.addMethod(
  8513. $core.method({
  8514. selector: "defaultProtocol",
  8515. protocol: 'defaults',
  8516. fn: function (){
  8517. var self=this;
  8518. return "as yet unclassified";
  8519. },
  8520. args: [],
  8521. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8522. referencedClasses: [],
  8523. messageSends: []
  8524. }),
  8525. $globals.CompiledMethod);
  8526. $core.addMethod(
  8527. $core.method({
  8528. selector: "fn",
  8529. protocol: 'accessing',
  8530. fn: function (){
  8531. var self=this;
  8532. return $core.withContext(function($ctx1) {
  8533. return self._basicAt_("fn");
  8534. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8535. },
  8536. args: [],
  8537. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8538. referencedClasses: [],
  8539. messageSends: ["basicAt:"]
  8540. }),
  8541. $globals.CompiledMethod);
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "fn:",
  8545. protocol: 'accessing',
  8546. fn: function (aBlock){
  8547. var self=this;
  8548. return $core.withContext(function($ctx1) {
  8549. self._basicAt_put_("fn",aBlock);
  8550. return self;
  8551. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8552. },
  8553. args: ["aBlock"],
  8554. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8555. referencedClasses: [],
  8556. messageSends: ["basicAt:put:"]
  8557. }),
  8558. $globals.CompiledMethod);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "isCompiledMethod",
  8562. protocol: 'testing',
  8563. fn: function (){
  8564. var self=this;
  8565. return true;
  8566. },
  8567. args: [],
  8568. source: "isCompiledMethod\x0a\x09^ true",
  8569. referencedClasses: [],
  8570. messageSends: []
  8571. }),
  8572. $globals.CompiledMethod);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "isOverridden",
  8576. protocol: 'testing',
  8577. fn: function (){
  8578. var self=this;
  8579. var selector;
  8580. return $core.withContext(function($ctx1) {
  8581. var $1;
  8582. var $early={};
  8583. try {
  8584. selector=self._selector();
  8585. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8586. return $core.withContext(function($ctx2) {
  8587. $1=$recv(each)._includesSelector_(selector);
  8588. if($core.assert($1)){
  8589. throw $early=[true];
  8590. };
  8591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8592. }));
  8593. return false;
  8594. }
  8595. catch(e) {if(e===$early)return e[0]; throw e}
  8596. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8597. },
  8598. args: [],
  8599. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8600. referencedClasses: [],
  8601. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8602. }),
  8603. $globals.CompiledMethod);
  8604. $core.addMethod(
  8605. $core.method({
  8606. selector: "isOverride",
  8607. protocol: 'testing',
  8608. fn: function (){
  8609. var self=this;
  8610. var superclass;
  8611. return $core.withContext(function($ctx1) {
  8612. var $1,$2,$receiver;
  8613. $1=self._methodClass();
  8614. $ctx1.sendIdx["methodClass"]=1;
  8615. superclass=$recv($1)._superclass();
  8616. $ctx1.sendIdx["superclass"]=1;
  8617. $2=superclass;
  8618. if(($receiver = $2) == null || $receiver.isNil){
  8619. return false;
  8620. } else {
  8621. $2;
  8622. };
  8623. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8624. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8625. },
  8626. args: [],
  8627. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  8628. referencedClasses: [],
  8629. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8630. }),
  8631. $globals.CompiledMethod);
  8632. $core.addMethod(
  8633. $core.method({
  8634. selector: "messageSends",
  8635. protocol: 'accessing',
  8636. fn: function (){
  8637. var self=this;
  8638. return $core.withContext(function($ctx1) {
  8639. return self._basicAt_("messageSends");
  8640. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8641. },
  8642. args: [],
  8643. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8644. referencedClasses: [],
  8645. messageSends: ["basicAt:"]
  8646. }),
  8647. $globals.CompiledMethod);
  8648. $core.addMethod(
  8649. $core.method({
  8650. selector: "methodClass",
  8651. protocol: 'accessing',
  8652. fn: function (){
  8653. var self=this;
  8654. return $core.withContext(function($ctx1) {
  8655. return self._basicAt_("methodClass");
  8656. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8657. },
  8658. args: [],
  8659. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8660. referencedClasses: [],
  8661. messageSends: ["basicAt:"]
  8662. }),
  8663. $globals.CompiledMethod);
  8664. $core.addMethod(
  8665. $core.method({
  8666. selector: "package",
  8667. protocol: 'accessing',
  8668. fn: function (){
  8669. var self=this;
  8670. return $core.withContext(function($ctx1) {
  8671. var $1,$receiver;
  8672. $1=self._methodClass();
  8673. if(($receiver = $1) == null || $receiver.isNil){
  8674. return $1;
  8675. } else {
  8676. var class_;
  8677. class_=$receiver;
  8678. return $recv(class_)._packageOfProtocol_(self._protocol());
  8679. };
  8680. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8681. },
  8682. args: [],
  8683. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  8684. referencedClasses: [],
  8685. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8686. }),
  8687. $globals.CompiledMethod);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "protocol",
  8691. protocol: 'accessing',
  8692. fn: function (){
  8693. var self=this;
  8694. return $core.withContext(function($ctx1) {
  8695. var $1,$receiver;
  8696. $1=self._basicAt_("protocol");
  8697. if(($receiver = $1) == null || $receiver.isNil){
  8698. return self._defaultProtocol();
  8699. } else {
  8700. return $1;
  8701. };
  8702. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8703. },
  8704. args: [],
  8705. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8706. referencedClasses: [],
  8707. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8708. }),
  8709. $globals.CompiledMethod);
  8710. $core.addMethod(
  8711. $core.method({
  8712. selector: "protocol:",
  8713. protocol: 'accessing',
  8714. fn: function (aString){
  8715. var self=this;
  8716. var oldProtocol;
  8717. return $core.withContext(function($ctx1) {
  8718. var $1,$3,$2,$4,$receiver;
  8719. oldProtocol=self._protocol();
  8720. self._basicAt_put_("protocol",aString);
  8721. $1=$recv($globals.SystemAnnouncer)._current();
  8722. $3=$recv($globals.MethodMoved)._new();
  8723. $recv($3)._method_(self);
  8724. $recv($3)._oldProtocol_(oldProtocol);
  8725. $2=$recv($3)._yourself();
  8726. $recv($1)._announce_($2);
  8727. $4=self._methodClass();
  8728. if(($receiver = $4) == null || $receiver.isNil){
  8729. $4;
  8730. } else {
  8731. var methodClass;
  8732. methodClass=$receiver;
  8733. $recv($recv(methodClass)._organization())._addElement_(aString);
  8734. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8735. };
  8736. return self;
  8737. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8738. },
  8739. args: ["aString"],
  8740. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  8741. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8742. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8743. }),
  8744. $globals.CompiledMethod);
  8745. $core.addMethod(
  8746. $core.method({
  8747. selector: "referencedClasses",
  8748. protocol: 'accessing',
  8749. fn: function (){
  8750. var self=this;
  8751. return $core.withContext(function($ctx1) {
  8752. return self._basicAt_("referencedClasses");
  8753. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8754. },
  8755. args: [],
  8756. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8757. referencedClasses: [],
  8758. messageSends: ["basicAt:"]
  8759. }),
  8760. $globals.CompiledMethod);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "selector",
  8764. protocol: 'accessing',
  8765. fn: function (){
  8766. var self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. return self._basicAt_("selector");
  8769. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8770. },
  8771. args: [],
  8772. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8773. referencedClasses: [],
  8774. messageSends: ["basicAt:"]
  8775. }),
  8776. $globals.CompiledMethod);
  8777. $core.addMethod(
  8778. $core.method({
  8779. selector: "selector:",
  8780. protocol: 'accessing',
  8781. fn: function (aString){
  8782. var self=this;
  8783. return $core.withContext(function($ctx1) {
  8784. self._basicAt_put_("selector",aString);
  8785. return self;
  8786. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8787. },
  8788. args: ["aString"],
  8789. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8790. referencedClasses: [],
  8791. messageSends: ["basicAt:put:"]
  8792. }),
  8793. $globals.CompiledMethod);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "sendTo:arguments:",
  8797. protocol: 'evaluating',
  8798. fn: function (anObject,aCollection){
  8799. var self=this;
  8800. return $core.withContext(function($ctx1) {
  8801. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8802. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8803. },
  8804. args: ["anObject", "aCollection"],
  8805. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8806. referencedClasses: [],
  8807. messageSends: ["applyTo:arguments:", "fn"]
  8808. }),
  8809. $globals.CompiledMethod);
  8810. $core.addMethod(
  8811. $core.method({
  8812. selector: "source",
  8813. protocol: 'accessing',
  8814. fn: function (){
  8815. var self=this;
  8816. return $core.withContext(function($ctx1) {
  8817. var $1,$receiver;
  8818. $1=self._basicAt_("source");
  8819. if(($receiver = $1) == null || $receiver.isNil){
  8820. return "";
  8821. } else {
  8822. return $1;
  8823. };
  8824. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8825. },
  8826. args: [],
  8827. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8828. referencedClasses: [],
  8829. messageSends: ["ifNil:", "basicAt:"]
  8830. }),
  8831. $globals.CompiledMethod);
  8832. $core.addMethod(
  8833. $core.method({
  8834. selector: "source:",
  8835. protocol: 'accessing',
  8836. fn: function (aString){
  8837. var self=this;
  8838. return $core.withContext(function($ctx1) {
  8839. self._basicAt_put_("source",aString);
  8840. return self;
  8841. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8842. },
  8843. args: ["aString"],
  8844. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8845. referencedClasses: [],
  8846. messageSends: ["basicAt:put:"]
  8847. }),
  8848. $globals.CompiledMethod);
  8849. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8850. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  8851. $core.addMethod(
  8852. $core.method({
  8853. selector: "addWorker",
  8854. protocol: 'private',
  8855. fn: function (){
  8856. var self=this;
  8857. return $core.withContext(function($ctx1) {
  8858. $recv(self["@worker"])._valueWithTimeout_((0));
  8859. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8860. return self;
  8861. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8862. },
  8863. args: [],
  8864. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8865. referencedClasses: [],
  8866. messageSends: ["valueWithTimeout:", "+"]
  8867. }),
  8868. $globals.ForkPool);
  8869. $core.addMethod(
  8870. $core.method({
  8871. selector: "defaultMaxPoolSize",
  8872. protocol: 'defaults',
  8873. fn: function (){
  8874. var self=this;
  8875. return $core.withContext(function($ctx1) {
  8876. return $recv(self._class())._defaultMaxPoolSize();
  8877. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8878. },
  8879. args: [],
  8880. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8881. referencedClasses: [],
  8882. messageSends: ["defaultMaxPoolSize", "class"]
  8883. }),
  8884. $globals.ForkPool);
  8885. $core.addMethod(
  8886. $core.method({
  8887. selector: "fork:",
  8888. protocol: 'actions',
  8889. fn: function (aBlock){
  8890. var self=this;
  8891. return $core.withContext(function($ctx1) {
  8892. var $1;
  8893. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8894. if($core.assert($1)){
  8895. self._addWorker();
  8896. };
  8897. $recv(self["@queue"])._nextPut_(aBlock);
  8898. return self;
  8899. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8900. },
  8901. args: ["aBlock"],
  8902. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8903. referencedClasses: [],
  8904. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8905. }),
  8906. $globals.ForkPool);
  8907. $core.addMethod(
  8908. $core.method({
  8909. selector: "initialize",
  8910. protocol: 'initialization',
  8911. fn: function (){
  8912. var self=this;
  8913. return $core.withContext(function($ctx1) {
  8914. (
  8915. $ctx1.supercall = true,
  8916. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8917. $ctx1.supercall = false;
  8918. self["@poolSize"]=(0);
  8919. self["@queue"]=$recv($globals.Queue)._new();
  8920. self["@worker"]=self._makeWorker();
  8921. return self;
  8922. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8923. },
  8924. args: [],
  8925. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8926. referencedClasses: ["Queue"],
  8927. messageSends: ["initialize", "new", "makeWorker"]
  8928. }),
  8929. $globals.ForkPool);
  8930. $core.addMethod(
  8931. $core.method({
  8932. selector: "makeWorker",
  8933. protocol: 'initialization',
  8934. fn: function (){
  8935. var self=this;
  8936. var sentinel;
  8937. return $core.withContext(function($ctx1) {
  8938. var $1;
  8939. sentinel=$recv($globals.Object)._new();
  8940. return (function(){
  8941. var block;
  8942. return $core.withContext(function($ctx2) {
  8943. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8944. self["@poolSize"];
  8945. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8946. return sentinel;
  8947. }));
  8948. block;
  8949. $1=$recv(block).__eq_eq(sentinel);
  8950. if(!$core.assert($1)){
  8951. return $recv((function(){
  8952. return $core.withContext(function($ctx3) {
  8953. return $recv(block)._value();
  8954. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8955. }))._ensure_((function(){
  8956. return $core.withContext(function($ctx3) {
  8957. return self._addWorker();
  8958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8959. }));
  8960. };
  8961. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8962. });
  8963. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8964. },
  8965. args: [],
  8966. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  8967. referencedClasses: ["Object"],
  8968. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8969. }),
  8970. $globals.ForkPool);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "maxPoolSize",
  8974. protocol: 'accessing',
  8975. fn: function (){
  8976. var self=this;
  8977. return $core.withContext(function($ctx1) {
  8978. var $1,$receiver;
  8979. $1=self["@maxPoolSize"];
  8980. if(($receiver = $1) == null || $receiver.isNil){
  8981. return self._defaultMaxPoolSize();
  8982. } else {
  8983. return $1;
  8984. };
  8985. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8986. },
  8987. args: [],
  8988. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8989. referencedClasses: [],
  8990. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8991. }),
  8992. $globals.ForkPool);
  8993. $core.addMethod(
  8994. $core.method({
  8995. selector: "maxPoolSize:",
  8996. protocol: 'accessing',
  8997. fn: function (anInteger){
  8998. var self=this;
  8999. self["@maxPoolSize"]=anInteger;
  9000. return self;
  9001. },
  9002. args: ["anInteger"],
  9003. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  9004. referencedClasses: [],
  9005. messageSends: []
  9006. }),
  9007. $globals.ForkPool);
  9008. $globals.ForkPool.klass.iVarNames = ['default'];
  9009. $core.addMethod(
  9010. $core.method({
  9011. selector: "default",
  9012. protocol: 'accessing',
  9013. fn: function (){
  9014. var self=this;
  9015. return $core.withContext(function($ctx1) {
  9016. var $1,$receiver;
  9017. $1=self["@default"];
  9018. if(($receiver = $1) == null || $receiver.isNil){
  9019. self["@default"]=self._new();
  9020. return self["@default"];
  9021. } else {
  9022. return $1;
  9023. };
  9024. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9025. },
  9026. args: [],
  9027. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9028. referencedClasses: [],
  9029. messageSends: ["ifNil:", "new"]
  9030. }),
  9031. $globals.ForkPool.klass);
  9032. $core.addMethod(
  9033. $core.method({
  9034. selector: "defaultMaxPoolSize",
  9035. protocol: 'accessing',
  9036. fn: function (){
  9037. var self=this;
  9038. return (100);
  9039. },
  9040. args: [],
  9041. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9042. referencedClasses: [],
  9043. messageSends: []
  9044. }),
  9045. $globals.ForkPool.klass);
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "resetDefault",
  9049. protocol: 'accessing',
  9050. fn: function (){
  9051. var self=this;
  9052. self["@default"]=nil;
  9053. return self;
  9054. },
  9055. args: [],
  9056. source: "resetDefault\x0a\x09default := nil",
  9057. referencedClasses: [],
  9058. messageSends: []
  9059. }),
  9060. $globals.ForkPool.klass);
  9061. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9062. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "arguments",
  9066. protocol: 'accessing',
  9067. fn: function (){
  9068. var self=this;
  9069. return self["@arguments"];
  9070. },
  9071. args: [],
  9072. source: "arguments\x0a\x09^ arguments",
  9073. referencedClasses: [],
  9074. messageSends: []
  9075. }),
  9076. $globals.Message);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "arguments:",
  9080. protocol: 'accessing',
  9081. fn: function (anArray){
  9082. var self=this;
  9083. self["@arguments"]=anArray;
  9084. return self;
  9085. },
  9086. args: ["anArray"],
  9087. source: "arguments: anArray\x0a\x09arguments := anArray",
  9088. referencedClasses: [],
  9089. messageSends: []
  9090. }),
  9091. $globals.Message);
  9092. $core.addMethod(
  9093. $core.method({
  9094. selector: "printOn:",
  9095. protocol: 'printing',
  9096. fn: function (aStream){
  9097. var self=this;
  9098. return $core.withContext(function($ctx1) {
  9099. (
  9100. $ctx1.supercall = true,
  9101. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9102. $ctx1.supercall = false;
  9103. $recv(aStream)._nextPutAll_("(");
  9104. $ctx1.sendIdx["nextPutAll:"]=1;
  9105. $recv(aStream)._nextPutAll_(self._selector());
  9106. $ctx1.sendIdx["nextPutAll:"]=2;
  9107. $recv(aStream)._nextPutAll_(")");
  9108. return self;
  9109. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9110. },
  9111. args: ["aStream"],
  9112. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9113. referencedClasses: [],
  9114. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9115. }),
  9116. $globals.Message);
  9117. $core.addMethod(
  9118. $core.method({
  9119. selector: "selector",
  9120. protocol: 'accessing',
  9121. fn: function (){
  9122. var self=this;
  9123. return self["@selector"];
  9124. },
  9125. args: [],
  9126. source: "selector\x0a\x09^ selector",
  9127. referencedClasses: [],
  9128. messageSends: []
  9129. }),
  9130. $globals.Message);
  9131. $core.addMethod(
  9132. $core.method({
  9133. selector: "selector:",
  9134. protocol: 'accessing',
  9135. fn: function (aString){
  9136. var self=this;
  9137. self["@selector"]=aString;
  9138. return self;
  9139. },
  9140. args: ["aString"],
  9141. source: "selector: aString\x0a\x09selector := aString",
  9142. referencedClasses: [],
  9143. messageSends: []
  9144. }),
  9145. $globals.Message);
  9146. $core.addMethod(
  9147. $core.method({
  9148. selector: "sendTo:",
  9149. protocol: 'actions',
  9150. fn: function (anObject){
  9151. var self=this;
  9152. return $core.withContext(function($ctx1) {
  9153. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9154. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9155. },
  9156. args: ["anObject"],
  9157. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9158. referencedClasses: [],
  9159. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9160. }),
  9161. $globals.Message);
  9162. $core.addMethod(
  9163. $core.method({
  9164. selector: "selector:arguments:",
  9165. protocol: 'instance creation',
  9166. fn: function (aString,anArray){
  9167. var self=this;
  9168. return $core.withContext(function($ctx1) {
  9169. var $1;
  9170. $1=self._new();
  9171. $recv($1)._selector_(aString);
  9172. $recv($1)._arguments_(anArray);
  9173. return $recv($1)._yourself();
  9174. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9175. },
  9176. args: ["aString", "anArray"],
  9177. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9178. referencedClasses: [],
  9179. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9180. }),
  9181. $globals.Message.klass);
  9182. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9183. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  9184. $core.addMethod(
  9185. $core.method({
  9186. selector: "arguments",
  9187. protocol: 'accessing',
  9188. fn: function (){
  9189. var self=this;
  9190. return $core.withContext(function($ctx1) {
  9191. return $recv(self["@message"])._arguments();
  9192. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9193. },
  9194. args: [],
  9195. source: "arguments\x0a\x09^ message arguments",
  9196. referencedClasses: [],
  9197. messageSends: ["arguments"]
  9198. }),
  9199. $globals.MessageSend);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "arguments:",
  9203. protocol: 'accessing',
  9204. fn: function (aCollection){
  9205. var self=this;
  9206. return $core.withContext(function($ctx1) {
  9207. $recv(self["@message"])._arguments_(aCollection);
  9208. return self;
  9209. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9210. },
  9211. args: ["aCollection"],
  9212. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9213. referencedClasses: [],
  9214. messageSends: ["arguments:"]
  9215. }),
  9216. $globals.MessageSend);
  9217. $core.addMethod(
  9218. $core.method({
  9219. selector: "initialize",
  9220. protocol: 'initialization',
  9221. fn: function (){
  9222. var self=this;
  9223. return $core.withContext(function($ctx1) {
  9224. (
  9225. $ctx1.supercall = true,
  9226. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9227. $ctx1.supercall = false;
  9228. self["@message"]=$recv($globals.Message)._new();
  9229. return self;
  9230. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9231. },
  9232. args: [],
  9233. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9234. referencedClasses: ["Message"],
  9235. messageSends: ["initialize", "new"]
  9236. }),
  9237. $globals.MessageSend);
  9238. $core.addMethod(
  9239. $core.method({
  9240. selector: "printOn:",
  9241. protocol: 'printing',
  9242. fn: function (aStream){
  9243. var self=this;
  9244. return $core.withContext(function($ctx1) {
  9245. (
  9246. $ctx1.supercall = true,
  9247. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9248. $ctx1.supercall = false;
  9249. $recv(aStream)._nextPutAll_("(");
  9250. $ctx1.sendIdx["nextPutAll:"]=1;
  9251. $recv(aStream)._nextPutAll_(self._receiver());
  9252. $ctx1.sendIdx["nextPutAll:"]=2;
  9253. $recv(aStream)._nextPutAll_(" >> ");
  9254. $ctx1.sendIdx["nextPutAll:"]=3;
  9255. $recv(aStream)._nextPutAll_(self._selector());
  9256. $ctx1.sendIdx["nextPutAll:"]=4;
  9257. $recv(aStream)._nextPutAll_(")");
  9258. return self;
  9259. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9260. },
  9261. args: ["aStream"],
  9262. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9263. referencedClasses: [],
  9264. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9265. }),
  9266. $globals.MessageSend);
  9267. $core.addMethod(
  9268. $core.method({
  9269. selector: "receiver",
  9270. protocol: 'accessing',
  9271. fn: function (){
  9272. var self=this;
  9273. return self["@receiver"];
  9274. },
  9275. args: [],
  9276. source: "receiver\x0a\x09^ receiver",
  9277. referencedClasses: [],
  9278. messageSends: []
  9279. }),
  9280. $globals.MessageSend);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "receiver:",
  9284. protocol: 'accessing',
  9285. fn: function (anObject){
  9286. var self=this;
  9287. self["@receiver"]=anObject;
  9288. return self;
  9289. },
  9290. args: ["anObject"],
  9291. source: "receiver: anObject\x0a\x09receiver := anObject",
  9292. referencedClasses: [],
  9293. messageSends: []
  9294. }),
  9295. $globals.MessageSend);
  9296. $core.addMethod(
  9297. $core.method({
  9298. selector: "selector",
  9299. protocol: 'accessing',
  9300. fn: function (){
  9301. var self=this;
  9302. return $core.withContext(function($ctx1) {
  9303. return $recv(self["@message"])._selector();
  9304. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9305. },
  9306. args: [],
  9307. source: "selector\x0a\x09^ message selector",
  9308. referencedClasses: [],
  9309. messageSends: ["selector"]
  9310. }),
  9311. $globals.MessageSend);
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "selector:",
  9315. protocol: 'accessing',
  9316. fn: function (aString){
  9317. var self=this;
  9318. return $core.withContext(function($ctx1) {
  9319. $recv(self["@message"])._selector_(aString);
  9320. return self;
  9321. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9322. },
  9323. args: ["aString"],
  9324. source: "selector: aString\x0a\x09message selector: aString",
  9325. referencedClasses: [],
  9326. messageSends: ["selector:"]
  9327. }),
  9328. $globals.MessageSend);
  9329. $core.addMethod(
  9330. $core.method({
  9331. selector: "value",
  9332. protocol: 'evaluating',
  9333. fn: function (){
  9334. var self=this;
  9335. return $core.withContext(function($ctx1) {
  9336. return $recv(self["@message"])._sendTo_(self._receiver());
  9337. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9338. },
  9339. args: [],
  9340. source: "value\x0a\x09^ message sendTo: self receiver",
  9341. referencedClasses: [],
  9342. messageSends: ["sendTo:", "receiver"]
  9343. }),
  9344. $globals.MessageSend);
  9345. $core.addMethod(
  9346. $core.method({
  9347. selector: "value:",
  9348. protocol: 'evaluating',
  9349. fn: function (anObject){
  9350. var self=this;
  9351. return $core.withContext(function($ctx1) {
  9352. var $1;
  9353. $1=self["@message"];
  9354. $recv($1)._arguments_([anObject]);
  9355. return $recv($1)._sendTo_(self._receiver());
  9356. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9357. },
  9358. args: ["anObject"],
  9359. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9360. referencedClasses: [],
  9361. messageSends: ["arguments:", "sendTo:", "receiver"]
  9362. }),
  9363. $globals.MessageSend);
  9364. $core.addMethod(
  9365. $core.method({
  9366. selector: "value:value:",
  9367. protocol: 'evaluating',
  9368. fn: function (firstArgument,secondArgument){
  9369. var self=this;
  9370. return $core.withContext(function($ctx1) {
  9371. var $1;
  9372. $1=self["@message"];
  9373. $recv($1)._arguments_([firstArgument,secondArgument]);
  9374. return $recv($1)._sendTo_(self._receiver());
  9375. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9376. },
  9377. args: ["firstArgument", "secondArgument"],
  9378. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9379. referencedClasses: [],
  9380. messageSends: ["arguments:", "sendTo:", "receiver"]
  9381. }),
  9382. $globals.MessageSend);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "value:value:value:",
  9386. protocol: 'evaluating',
  9387. fn: function (firstArgument,secondArgument,thirdArgument){
  9388. var self=this;
  9389. return $core.withContext(function($ctx1) {
  9390. var $1;
  9391. $1=self["@message"];
  9392. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9393. return $recv($1)._sendTo_(self._receiver());
  9394. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9395. },
  9396. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9397. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9398. referencedClasses: [],
  9399. messageSends: ["arguments:", "sendTo:", "receiver"]
  9400. }),
  9401. $globals.MessageSend);
  9402. $core.addMethod(
  9403. $core.method({
  9404. selector: "valueWithPossibleArguments:",
  9405. protocol: 'evaluating',
  9406. fn: function (aCollection){
  9407. var self=this;
  9408. return $core.withContext(function($ctx1) {
  9409. self._arguments_(aCollection);
  9410. return self._value();
  9411. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9412. },
  9413. args: ["aCollection"],
  9414. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9415. referencedClasses: [],
  9416. messageSends: ["arguments:", "value"]
  9417. }),
  9418. $globals.MessageSend);
  9419. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9420. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "asString",
  9424. protocol: 'converting',
  9425. fn: function (){
  9426. var self=this;
  9427. return $core.withContext(function($ctx1) {
  9428. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9429. $2=self._isBlockContext();
  9430. if($core.assert($2)){
  9431. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9432. $ctx1.sendIdx[","]=2;
  9433. $1=$recv($3).__comma(")");
  9434. $ctx1.sendIdx[","]=1;
  9435. } else {
  9436. var methodClass;
  9437. methodClass=$recv(self._method())._methodClass();
  9438. methodClass;
  9439. $5=methodClass;
  9440. $7=self._receiver();
  9441. $ctx1.sendIdx["receiver"]=1;
  9442. $6=$recv($7)._class();
  9443. $ctx1.sendIdx["class"]=1;
  9444. $4=$recv($5).__eq($6);
  9445. if($core.assert($4)){
  9446. $11=self._receiver();
  9447. $ctx1.sendIdx["receiver"]=2;
  9448. $10=$recv($11)._class();
  9449. $ctx1.sendIdx["class"]=2;
  9450. $9=$recv($10)._name();
  9451. $ctx1.sendIdx["name"]=1;
  9452. $8=$recv($9).__comma(" >> ");
  9453. $ctx1.sendIdx[","]=4;
  9454. $12=self._selector();
  9455. $ctx1.sendIdx["selector"]=1;
  9456. $1=$recv($8).__comma($12);
  9457. $ctx1.sendIdx[","]=3;
  9458. } else {
  9459. $16=$recv($recv(self._receiver())._class())._name();
  9460. $ctx1.sendIdx["name"]=2;
  9461. $15=$recv($16).__comma("(");
  9462. $14=$recv($15).__comma($recv(methodClass)._name());
  9463. $ctx1.sendIdx[","]=7;
  9464. $13=$recv($14).__comma(") >> ");
  9465. $ctx1.sendIdx[","]=6;
  9466. $1=$recv($13).__comma(self._selector());
  9467. $ctx1.sendIdx[","]=5;
  9468. };
  9469. };
  9470. return $1;
  9471. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9472. },
  9473. args: [],
  9474. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  9475. referencedClasses: [],
  9476. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9477. }),
  9478. $globals.MethodContext);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "basicReceiver",
  9482. protocol: 'accessing',
  9483. fn: function (){
  9484. var self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return self.receiver;
  9487. return self;
  9488. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9489. },
  9490. args: [],
  9491. source: "basicReceiver\x0a\x09<return self.receiver>",
  9492. referencedClasses: [],
  9493. messageSends: []
  9494. }),
  9495. $globals.MethodContext);
  9496. $core.addMethod(
  9497. $core.method({
  9498. selector: "evaluatedSelector",
  9499. protocol: 'accessing',
  9500. fn: function (){
  9501. var self=this;
  9502. return $core.withContext(function($ctx1) {
  9503. return self.evaluatedSelector;
  9504. return self;
  9505. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9506. },
  9507. args: [],
  9508. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9509. referencedClasses: [],
  9510. messageSends: []
  9511. }),
  9512. $globals.MethodContext);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "findContextSuchThat:",
  9516. protocol: 'accessing',
  9517. fn: function (testBlock){
  9518. var self=this;
  9519. var context;
  9520. return $core.withContext(function($ctx1) {
  9521. var $1;
  9522. var $early={};
  9523. try {
  9524. context=self;
  9525. $recv((function(){
  9526. return $core.withContext(function($ctx2) {
  9527. return $recv(context)._isNil();
  9528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9529. }))._whileFalse_((function(){
  9530. return $core.withContext(function($ctx2) {
  9531. $1=$recv(testBlock)._value_(context);
  9532. if($core.assert($1)){
  9533. throw $early=[context];
  9534. };
  9535. context=$recv(context)._outerContext();
  9536. return context;
  9537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9538. }));
  9539. return nil;
  9540. }
  9541. catch(e) {if(e===$early)return e[0]; throw e}
  9542. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9543. },
  9544. args: ["testBlock"],
  9545. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  9546. referencedClasses: [],
  9547. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9548. }),
  9549. $globals.MethodContext);
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "home",
  9553. protocol: 'accessing',
  9554. fn: function (){
  9555. var self=this;
  9556. return $core.withContext(function($ctx1) {
  9557. return self.homeContext;
  9558. return self;
  9559. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9560. },
  9561. args: [],
  9562. source: "home\x0a\x09<return self.homeContext>",
  9563. referencedClasses: [],
  9564. messageSends: []
  9565. }),
  9566. $globals.MethodContext);
  9567. $core.addMethod(
  9568. $core.method({
  9569. selector: "index",
  9570. protocol: 'accessing',
  9571. fn: function (){
  9572. var self=this;
  9573. return $core.withContext(function($ctx1) {
  9574. return self.index || 0;
  9575. return self;
  9576. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9577. },
  9578. args: [],
  9579. source: "index\x0a\x09<return self.index || 0>",
  9580. referencedClasses: [],
  9581. messageSends: []
  9582. }),
  9583. $globals.MethodContext);
  9584. $core.addMethod(
  9585. $core.method({
  9586. selector: "isBlockContext",
  9587. protocol: 'testing',
  9588. fn: function (){
  9589. var self=this;
  9590. return $core.withContext(function($ctx1) {
  9591. return $recv(self._selector())._isNil();
  9592. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9593. },
  9594. args: [],
  9595. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9596. referencedClasses: [],
  9597. messageSends: ["isNil", "selector"]
  9598. }),
  9599. $globals.MethodContext);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "locals",
  9603. protocol: 'accessing',
  9604. fn: function (){
  9605. var self=this;
  9606. return $core.withContext(function($ctx1) {
  9607. return self.locals || {};
  9608. return self;
  9609. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9610. },
  9611. args: [],
  9612. source: "locals\x0a\x09<return self.locals || {}>",
  9613. referencedClasses: [],
  9614. messageSends: []
  9615. }),
  9616. $globals.MethodContext);
  9617. $core.addMethod(
  9618. $core.method({
  9619. selector: "method",
  9620. protocol: 'accessing',
  9621. fn: function (){
  9622. var self=this;
  9623. var method,lookupClass,receiverClass,supercall;
  9624. return $core.withContext(function($ctx1) {
  9625. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9626. $1=self._methodContext();
  9627. $ctx1.sendIdx["methodContext"]=1;
  9628. if(($receiver = $1) == null || $receiver.isNil){
  9629. return nil;
  9630. } else {
  9631. $1;
  9632. };
  9633. $3=self._methodContext();
  9634. $ctx1.sendIdx["methodContext"]=2;
  9635. $2=$recv($3)._receiver();
  9636. receiverClass=$recv($2)._class();
  9637. $4=receiverClass;
  9638. $6=self._methodContext();
  9639. $ctx1.sendIdx["methodContext"]=3;
  9640. $5=$recv($6)._selector();
  9641. $ctx1.sendIdx["selector"]=1;
  9642. method=$recv($4)._lookupSelector_($5);
  9643. $ctx1.sendIdx["lookupSelector:"]=1;
  9644. $7=self._outerContext();
  9645. if(($receiver = $7) == null || $receiver.isNil){
  9646. supercall=false;
  9647. } else {
  9648. var outer;
  9649. outer=$receiver;
  9650. supercall=$recv(outer)._supercall();
  9651. };
  9652. $8=supercall;
  9653. if($core.assert($8)){
  9654. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9655. } else {
  9656. return method;
  9657. };
  9658. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9659. },
  9660. args: [],
  9661. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  9662. referencedClasses: [],
  9663. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9664. }),
  9665. $globals.MethodContext);
  9666. $core.addMethod(
  9667. $core.method({
  9668. selector: "methodContext",
  9669. protocol: 'accessing',
  9670. fn: function (){
  9671. var self=this;
  9672. return $core.withContext(function($ctx1) {
  9673. var $1,$2,$receiver;
  9674. $1=self._isBlockContext();
  9675. if(!$core.assert($1)){
  9676. return self;
  9677. };
  9678. $2=self._outerContext();
  9679. if(($receiver = $2) == null || $receiver.isNil){
  9680. return $2;
  9681. } else {
  9682. var outer;
  9683. outer=$receiver;
  9684. return $recv(outer)._methodContext();
  9685. };
  9686. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9687. },
  9688. args: [],
  9689. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9690. referencedClasses: [],
  9691. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9692. }),
  9693. $globals.MethodContext);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "outerContext",
  9697. protocol: 'accessing',
  9698. fn: function (){
  9699. var self=this;
  9700. return $core.withContext(function($ctx1) {
  9701. return self.outerContext || self.homeContext;
  9702. return self;
  9703. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9704. },
  9705. args: [],
  9706. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9707. referencedClasses: [],
  9708. messageSends: []
  9709. }),
  9710. $globals.MethodContext);
  9711. $core.addMethod(
  9712. $core.method({
  9713. selector: "printOn:",
  9714. protocol: 'printing',
  9715. fn: function (aStream){
  9716. var self=this;
  9717. return $core.withContext(function($ctx1) {
  9718. (
  9719. $ctx1.supercall = true,
  9720. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9721. $ctx1.supercall = false;
  9722. $recv(aStream)._nextPutAll_("(");
  9723. $ctx1.sendIdx["nextPutAll:"]=1;
  9724. $recv(aStream)._nextPutAll_(self._asString());
  9725. $ctx1.sendIdx["nextPutAll:"]=2;
  9726. $recv(aStream)._nextPutAll_(")");
  9727. return self;
  9728. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9729. },
  9730. args: ["aStream"],
  9731. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9732. referencedClasses: [],
  9733. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9734. }),
  9735. $globals.MethodContext);
  9736. $core.addMethod(
  9737. $core.method({
  9738. selector: "receiver",
  9739. protocol: 'accessing',
  9740. fn: function (){
  9741. var self=this;
  9742. return $core.withContext(function($ctx1) {
  9743. var $2,$1;
  9744. $1=$recv(self._isBlockContext())._and_((function(){
  9745. return $core.withContext(function($ctx2) {
  9746. $2=self._outerContext();
  9747. $ctx2.sendIdx["outerContext"]=1;
  9748. return $recv($2)._notNil();
  9749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9750. }));
  9751. if($core.assert($1)){
  9752. return $recv(self._outerContext())._receiver();
  9753. } else {
  9754. return self._basicReceiver();
  9755. };
  9756. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9757. },
  9758. args: [],
  9759. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9760. referencedClasses: [],
  9761. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9762. }),
  9763. $globals.MethodContext);
  9764. $core.addMethod(
  9765. $core.method({
  9766. selector: "selector",
  9767. protocol: 'accessing',
  9768. fn: function (){
  9769. var self=this;
  9770. return $core.withContext(function($ctx1) {
  9771. if(self.selector) {
  9772. return $core.js2st(self.selector);
  9773. } else {
  9774. return nil;
  9775. }
  9776. ;
  9777. return self;
  9778. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9779. },
  9780. args: [],
  9781. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  9782. referencedClasses: [],
  9783. messageSends: []
  9784. }),
  9785. $globals.MethodContext);
  9786. $core.addMethod(
  9787. $core.method({
  9788. selector: "sendIndexAt:",
  9789. protocol: 'accessing',
  9790. fn: function (aSelector){
  9791. var self=this;
  9792. return $core.withContext(function($ctx1) {
  9793. return self.sendIdx[aSelector] || 0;
  9794. return self;
  9795. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9796. },
  9797. args: ["aSelector"],
  9798. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9799. referencedClasses: [],
  9800. messageSends: []
  9801. }),
  9802. $globals.MethodContext);
  9803. $core.addMethod(
  9804. $core.method({
  9805. selector: "sendIndexes",
  9806. protocol: 'accessing',
  9807. fn: function (){
  9808. var self=this;
  9809. return $core.withContext(function($ctx1) {
  9810. return self.sendIdx;
  9811. return self;
  9812. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9813. },
  9814. args: [],
  9815. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9816. referencedClasses: [],
  9817. messageSends: []
  9818. }),
  9819. $globals.MethodContext);
  9820. $core.addMethod(
  9821. $core.method({
  9822. selector: "supercall",
  9823. protocol: 'accessing',
  9824. fn: function (){
  9825. var self=this;
  9826. return $core.withContext(function($ctx1) {
  9827. return self.supercall == true;
  9828. return self;
  9829. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9830. },
  9831. args: [],
  9832. source: "supercall\x0a\x09<return self.supercall == true>",
  9833. referencedClasses: [],
  9834. messageSends: []
  9835. }),
  9836. $globals.MethodContext);
  9837. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9838. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  9839. $core.addMethod(
  9840. $core.method({
  9841. selector: "constructor:",
  9842. protocol: 'instance creation',
  9843. fn: function (aString){
  9844. var self=this;
  9845. return $core.withContext(function($ctx1) {
  9846. self._deprecatedAPI_("Use constructorNamed:");
  9847. var nativeFunc=eval(aString);
  9848. return new nativeFunc();
  9849. ;
  9850. return self;
  9851. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9852. },
  9853. args: ["aString"],
  9854. source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9855. referencedClasses: [],
  9856. messageSends: []
  9857. }),
  9858. $globals.NativeFunction.klass);
  9859. $core.addMethod(
  9860. $core.method({
  9861. selector: "constructor:value:",
  9862. protocol: 'instance creation',
  9863. fn: function (aString,anObject){
  9864. var self=this;
  9865. return $core.withContext(function($ctx1) {
  9866. self._deprecatedAPI_("Use constructorNamed:value:");
  9867. var nativeFunc=eval(aString);
  9868. return new nativeFunc(anObject);
  9869. ;
  9870. return self;
  9871. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9872. },
  9873. args: ["aString", "anObject"],
  9874. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9875. referencedClasses: [],
  9876. messageSends: []
  9877. }),
  9878. $globals.NativeFunction.klass);
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "constructor:value:value:",
  9882. protocol: 'instance creation',
  9883. fn: function (aString,anObject,anObject2){
  9884. var self=this;
  9885. return $core.withContext(function($ctx1) {
  9886. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9887. var nativeFunc=eval(aString);
  9888. return new nativeFunc(anObject,anObject2);
  9889. ;
  9890. return self;
  9891. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9892. },
  9893. args: ["aString", "anObject", "anObject2"],
  9894. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9895. referencedClasses: [],
  9896. messageSends: []
  9897. }),
  9898. $globals.NativeFunction.klass);
  9899. $core.addMethod(
  9900. $core.method({
  9901. selector: "constructor:value:value:value:",
  9902. protocol: 'instance creation',
  9903. fn: function (aString,anObject,anObject2,anObject3){
  9904. var self=this;
  9905. return $core.withContext(function($ctx1) {
  9906. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9907. var nativeFunc=eval(aString);
  9908. return new nativeFunc(anObject,anObject2, anObject3);
  9909. ;
  9910. return self;
  9911. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9912. },
  9913. args: ["aString", "anObject", "anObject2", "anObject3"],
  9914. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9915. referencedClasses: [],
  9916. messageSends: []
  9917. }),
  9918. $globals.NativeFunction.klass);
  9919. $core.addMethod(
  9920. $core.method({
  9921. selector: "constructorNamed:",
  9922. protocol: 'instance creation',
  9923. fn: function (aString){
  9924. var self=this;
  9925. return $core.withContext(function($ctx1) {
  9926. var nativeFunc=(new Function('return this'))()[aString];
  9927. return new nativeFunc();
  9928. ;
  9929. return self;
  9930. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9931. },
  9932. args: ["aString"],
  9933. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9934. referencedClasses: [],
  9935. messageSends: []
  9936. }),
  9937. $globals.NativeFunction.klass);
  9938. $core.addMethod(
  9939. $core.method({
  9940. selector: "constructorNamed:value:",
  9941. protocol: 'instance creation',
  9942. fn: function (aString,anObject){
  9943. var self=this;
  9944. return $core.withContext(function($ctx1) {
  9945. var nativeFunc=(new Function('return this'))()[aString];
  9946. return new nativeFunc(anObject);
  9947. ;
  9948. return self;
  9949. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9950. },
  9951. args: ["aString", "anObject"],
  9952. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9953. referencedClasses: [],
  9954. messageSends: []
  9955. }),
  9956. $globals.NativeFunction.klass);
  9957. $core.addMethod(
  9958. $core.method({
  9959. selector: "constructorNamed:value:value:",
  9960. protocol: 'instance creation',
  9961. fn: function (aString,anObject,anObject2){
  9962. var self=this;
  9963. return $core.withContext(function($ctx1) {
  9964. var nativeFunc=(new Function('return this'))()[aString];
  9965. return new nativeFunc(anObject,anObject2);
  9966. ;
  9967. return self;
  9968. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9969. },
  9970. args: ["aString", "anObject", "anObject2"],
  9971. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9972. referencedClasses: [],
  9973. messageSends: []
  9974. }),
  9975. $globals.NativeFunction.klass);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "constructorNamed:value:value:value:",
  9979. protocol: 'instance creation',
  9980. fn: function (aString,anObject,anObject2,anObject3){
  9981. var self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. var nativeFunc=(new Function('return this'))()[aString];
  9984. return new nativeFunc(anObject,anObject2, anObject3);
  9985. ;
  9986. return self;
  9987. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9988. },
  9989. args: ["aString", "anObject", "anObject2", "anObject3"],
  9990. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9991. referencedClasses: [],
  9992. messageSends: []
  9993. }),
  9994. $globals.NativeFunction.klass);
  9995. $core.addMethod(
  9996. $core.method({
  9997. selector: "constructorOf:",
  9998. protocol: 'instance creation',
  9999. fn: function (nativeFunc){
  10000. var self=this;
  10001. return $core.withContext(function($ctx1) {
  10002. return new nativeFunc();
  10003. ;
  10004. return self;
  10005. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10006. },
  10007. args: ["nativeFunc"],
  10008. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  10009. referencedClasses: [],
  10010. messageSends: []
  10011. }),
  10012. $globals.NativeFunction.klass);
  10013. $core.addMethod(
  10014. $core.method({
  10015. selector: "constructorOf:value:",
  10016. protocol: 'instance creation',
  10017. fn: function (nativeFunc,anObject){
  10018. var self=this;
  10019. return $core.withContext(function($ctx1) {
  10020. return new nativeFunc(anObject);
  10021. ;
  10022. return self;
  10023. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10024. },
  10025. args: ["nativeFunc", "anObject"],
  10026. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  10027. referencedClasses: [],
  10028. messageSends: []
  10029. }),
  10030. $globals.NativeFunction.klass);
  10031. $core.addMethod(
  10032. $core.method({
  10033. selector: "constructorOf:value:value:",
  10034. protocol: 'instance creation',
  10035. fn: function (nativeFunc,anObject,anObject2){
  10036. var self=this;
  10037. return $core.withContext(function($ctx1) {
  10038. return new nativeFunc(anObject,anObject2);
  10039. ;
  10040. return self;
  10041. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10042. },
  10043. args: ["nativeFunc", "anObject", "anObject2"],
  10044. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  10045. referencedClasses: [],
  10046. messageSends: []
  10047. }),
  10048. $globals.NativeFunction.klass);
  10049. $core.addMethod(
  10050. $core.method({
  10051. selector: "constructorOf:value:value:value:",
  10052. protocol: 'instance creation',
  10053. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10054. var self=this;
  10055. return $core.withContext(function($ctx1) {
  10056. return new nativeFunc(anObject,anObject2, anObject3);
  10057. ;
  10058. return self;
  10059. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10060. },
  10061. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10062. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10063. referencedClasses: [],
  10064. messageSends: []
  10065. }),
  10066. $globals.NativeFunction.klass);
  10067. $core.addMethod(
  10068. $core.method({
  10069. selector: "exists:",
  10070. protocol: 'testing',
  10071. fn: function (aString){
  10072. var self=this;
  10073. return $core.withContext(function($ctx1) {
  10074. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  10075. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  10076. },
  10077. args: ["aString"],
  10078. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  10079. referencedClasses: ["Smalltalk"],
  10080. messageSends: ["existsJsGlobal:"]
  10081. }),
  10082. $globals.NativeFunction.klass);
  10083. $core.addMethod(
  10084. $core.method({
  10085. selector: "functionNamed:",
  10086. protocol: 'function calling',
  10087. fn: function (aString){
  10088. var self=this;
  10089. return $core.withContext(function($ctx1) {
  10090. var nativeFunc=(new Function('return this'))()[aString];
  10091. return nativeFunc();
  10092. ;
  10093. return self;
  10094. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  10095. },
  10096. args: ["aString"],
  10097. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10098. referencedClasses: [],
  10099. messageSends: []
  10100. }),
  10101. $globals.NativeFunction.klass);
  10102. $core.addMethod(
  10103. $core.method({
  10104. selector: "functionNamed:value:",
  10105. protocol: 'function calling',
  10106. fn: function (aString,anObject){
  10107. var self=this;
  10108. return $core.withContext(function($ctx1) {
  10109. var nativeFunc=(new Function('return this'))()[aString];
  10110. return nativeFunc(anObject);
  10111. ;
  10112. return self;
  10113. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10114. },
  10115. args: ["aString", "anObject"],
  10116. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10117. referencedClasses: [],
  10118. messageSends: []
  10119. }),
  10120. $globals.NativeFunction.klass);
  10121. $core.addMethod(
  10122. $core.method({
  10123. selector: "functionNamed:value:value:",
  10124. protocol: 'function calling',
  10125. fn: function (aString,anObject,anObject2){
  10126. var self=this;
  10127. return $core.withContext(function($ctx1) {
  10128. var nativeFunc=(new Function('return this'))()[aString];
  10129. return nativeFunc(anObject,anObject2);
  10130. ;
  10131. return self;
  10132. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10133. },
  10134. args: ["aString", "anObject", "anObject2"],
  10135. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10136. referencedClasses: [],
  10137. messageSends: []
  10138. }),
  10139. $globals.NativeFunction.klass);
  10140. $core.addMethod(
  10141. $core.method({
  10142. selector: "functionNamed:value:value:value:",
  10143. protocol: 'function calling',
  10144. fn: function (aString,anObject,anObject2,anObject3){
  10145. var self=this;
  10146. return $core.withContext(function($ctx1) {
  10147. var nativeFunc=(new Function('return this'))()[aString];
  10148. return nativeFunc(anObject,anObject2, anObject3);
  10149. ;
  10150. return self;
  10151. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10152. },
  10153. args: ["aString", "anObject", "anObject2", "anObject3"],
  10154. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10155. referencedClasses: [],
  10156. messageSends: []
  10157. }),
  10158. $globals.NativeFunction.klass);
  10159. $core.addMethod(
  10160. $core.method({
  10161. selector: "functionNamed:valueWithArgs:",
  10162. protocol: 'function calling',
  10163. fn: function (aString,args){
  10164. var self=this;
  10165. return $core.withContext(function($ctx1) {
  10166. var nativeFunc=(new Function('return this'))()[aString];
  10167. return Function.prototype.apply.call(nativeFunc, null, args);
  10168. ;
  10169. return self;
  10170. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10171. },
  10172. args: ["aString", "args"],
  10173. source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10174. referencedClasses: [],
  10175. messageSends: []
  10176. }),
  10177. $globals.NativeFunction.klass);
  10178. $core.addMethod(
  10179. $core.method({
  10180. selector: "functionOf:",
  10181. protocol: 'function calling',
  10182. fn: function (nativeFunc){
  10183. var self=this;
  10184. return $core.withContext(function($ctx1) {
  10185. return nativeFunc();
  10186. ;
  10187. return self;
  10188. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10189. },
  10190. args: ["nativeFunc"],
  10191. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10192. referencedClasses: [],
  10193. messageSends: []
  10194. }),
  10195. $globals.NativeFunction.klass);
  10196. $core.addMethod(
  10197. $core.method({
  10198. selector: "functionOf:value:",
  10199. protocol: 'function calling',
  10200. fn: function (nativeFunc,anObject){
  10201. var self=this;
  10202. return $core.withContext(function($ctx1) {
  10203. return nativeFunc(anObject);
  10204. ;
  10205. return self;
  10206. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10207. },
  10208. args: ["nativeFunc", "anObject"],
  10209. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10210. referencedClasses: [],
  10211. messageSends: []
  10212. }),
  10213. $globals.NativeFunction.klass);
  10214. $core.addMethod(
  10215. $core.method({
  10216. selector: "functionOf:value:value:",
  10217. protocol: 'function calling',
  10218. fn: function (nativeFunc,anObject,anObject2){
  10219. var self=this;
  10220. return $core.withContext(function($ctx1) {
  10221. return nativeFunc(anObject,anObject2);
  10222. ;
  10223. return self;
  10224. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10225. },
  10226. args: ["nativeFunc", "anObject", "anObject2"],
  10227. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10228. referencedClasses: [],
  10229. messageSends: []
  10230. }),
  10231. $globals.NativeFunction.klass);
  10232. $core.addMethod(
  10233. $core.method({
  10234. selector: "functionOf:value:value:value:",
  10235. protocol: 'function calling',
  10236. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10237. var self=this;
  10238. return $core.withContext(function($ctx1) {
  10239. return nativeFunc(anObject,anObject2, anObject3);
  10240. ;
  10241. return self;
  10242. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10243. },
  10244. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10245. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10246. referencedClasses: [],
  10247. messageSends: []
  10248. }),
  10249. $globals.NativeFunction.klass);
  10250. $core.addMethod(
  10251. $core.method({
  10252. selector: "functionOf:valueWithArgs:",
  10253. protocol: 'function calling',
  10254. fn: function (nativeFunc,args){
  10255. var self=this;
  10256. return $core.withContext(function($ctx1) {
  10257. return Function.prototype.apply.call(nativeFunc, null, args);
  10258. ;
  10259. return self;
  10260. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10261. },
  10262. args: ["nativeFunc", "args"],
  10263. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10264. referencedClasses: [],
  10265. messageSends: []
  10266. }),
  10267. $globals.NativeFunction.klass);
  10268. $core.addMethod(
  10269. $core.method({
  10270. selector: "methodOf:this:",
  10271. protocol: 'method calling',
  10272. fn: function (nativeFunc,thisObject){
  10273. var self=this;
  10274. return $core.withContext(function($ctx1) {
  10275. return Function.prototype.call.call(nativeFunc, thisObject);
  10276. ;
  10277. return self;
  10278. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10279. },
  10280. args: ["nativeFunc", "thisObject"],
  10281. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10282. referencedClasses: [],
  10283. messageSends: []
  10284. }),
  10285. $globals.NativeFunction.klass);
  10286. $core.addMethod(
  10287. $core.method({
  10288. selector: "methodOf:this:value:",
  10289. protocol: 'method calling',
  10290. fn: function (nativeFunc,thisObject,anObject){
  10291. var self=this;
  10292. return $core.withContext(function($ctx1) {
  10293. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10294. ;
  10295. return self;
  10296. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10297. },
  10298. args: ["nativeFunc", "thisObject", "anObject"],
  10299. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10300. referencedClasses: [],
  10301. messageSends: []
  10302. }),
  10303. $globals.NativeFunction.klass);
  10304. $core.addMethod(
  10305. $core.method({
  10306. selector: "methodOf:this:value:value:",
  10307. protocol: 'method calling',
  10308. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10309. var self=this;
  10310. return $core.withContext(function($ctx1) {
  10311. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10312. ;
  10313. return self;
  10314. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10315. },
  10316. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10317. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10318. referencedClasses: [],
  10319. messageSends: []
  10320. }),
  10321. $globals.NativeFunction.klass);
  10322. $core.addMethod(
  10323. $core.method({
  10324. selector: "methodOf:this:value:value:value:",
  10325. protocol: 'method calling',
  10326. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10327. var self=this;
  10328. return $core.withContext(function($ctx1) {
  10329. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10330. ;
  10331. return self;
  10332. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10333. },
  10334. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10335. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>",
  10336. referencedClasses: [],
  10337. messageSends: []
  10338. }),
  10339. $globals.NativeFunction.klass);
  10340. $core.addMethod(
  10341. $core.method({
  10342. selector: "methodOf:this:valueWithArgs:",
  10343. protocol: 'method calling',
  10344. fn: function (nativeFunc,thisObject,args){
  10345. var self=this;
  10346. return $core.withContext(function($ctx1) {
  10347. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10348. ;
  10349. return self;
  10350. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10351. },
  10352. args: ["nativeFunc", "thisObject", "args"],
  10353. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10354. referencedClasses: [],
  10355. messageSends: []
  10356. }),
  10357. $globals.NativeFunction.klass);
  10358. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10359. $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.";
  10360. $core.addMethod(
  10361. $core.method({
  10362. selector: "clearInterval",
  10363. protocol: 'timeout/interval',
  10364. fn: function (){
  10365. var self=this;
  10366. return $core.withContext(function($ctx1) {
  10367. var interval = self["@rawTimeout"];
  10368. clearInterval(interval);
  10369. ;
  10370. return self;
  10371. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10372. },
  10373. args: [],
  10374. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10375. referencedClasses: [],
  10376. messageSends: []
  10377. }),
  10378. $globals.Timeout);
  10379. $core.addMethod(
  10380. $core.method({
  10381. selector: "clearTimeout",
  10382. protocol: 'timeout/interval',
  10383. fn: function (){
  10384. var self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. var timeout = self["@rawTimeout"];
  10387. clearTimeout(timeout);
  10388. ;
  10389. return self;
  10390. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10391. },
  10392. args: [],
  10393. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10394. referencedClasses: [],
  10395. messageSends: []
  10396. }),
  10397. $globals.Timeout);
  10398. $core.addMethod(
  10399. $core.method({
  10400. selector: "rawTimeout:",
  10401. protocol: 'accessing',
  10402. fn: function (anObject){
  10403. var self=this;
  10404. self["@rawTimeout"]=anObject;
  10405. return self;
  10406. },
  10407. args: ["anObject"],
  10408. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10409. referencedClasses: [],
  10410. messageSends: []
  10411. }),
  10412. $globals.Timeout);
  10413. $core.addMethod(
  10414. $core.method({
  10415. selector: "on:",
  10416. protocol: 'instance creation',
  10417. fn: function (anObject){
  10418. var self=this;
  10419. return $core.withContext(function($ctx1) {
  10420. var $1;
  10421. $1=self._new();
  10422. $recv($1)._rawTimeout_(anObject);
  10423. return $recv($1)._yourself();
  10424. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10425. },
  10426. args: ["anObject"],
  10427. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10428. referencedClasses: [],
  10429. messageSends: ["rawTimeout:", "new", "yourself"]
  10430. }),
  10431. $globals.Timeout.klass);
  10432. });
  10433. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10434. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10435. $core.addPackage('Kernel-Collections');
  10436. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10437. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10438. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10439. $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:`";
  10440. $core.addMethod(
  10441. $core.method({
  10442. selector: "=",
  10443. protocol: 'comparing',
  10444. fn: function (anAssociation){
  10445. var self=this;
  10446. return $core.withContext(function($ctx1) {
  10447. var $3,$2,$5,$4,$6,$1;
  10448. $3=self._class();
  10449. $ctx1.sendIdx["class"]=1;
  10450. $2=$recv($3).__eq($recv(anAssociation)._class());
  10451. $ctx1.sendIdx["="]=1;
  10452. $1=$recv($2)._and_((function(){
  10453. return $core.withContext(function($ctx2) {
  10454. $5=self._key();
  10455. $ctx2.sendIdx["key"]=1;
  10456. $4=$recv($5).__eq($recv(anAssociation)._key());
  10457. $ctx2.sendIdx["="]=2;
  10458. return $recv($4)._and_((function(){
  10459. return $core.withContext(function($ctx3) {
  10460. $6=self._value();
  10461. $ctx3.sendIdx["value"]=1;
  10462. return $recv($6).__eq($recv(anAssociation)._value());
  10463. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10464. }));
  10465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10466. }));
  10467. $ctx1.sendIdx["and:"]=1;
  10468. return $1;
  10469. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10470. },
  10471. args: ["anAssociation"],
  10472. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10473. referencedClasses: [],
  10474. messageSends: ["and:", "=", "class", "key", "value"]
  10475. }),
  10476. $globals.Association);
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "key",
  10480. protocol: 'accessing',
  10481. fn: function (){
  10482. var self=this;
  10483. return self["@key"];
  10484. },
  10485. args: [],
  10486. source: "key\x0a\x09^ key",
  10487. referencedClasses: [],
  10488. messageSends: []
  10489. }),
  10490. $globals.Association);
  10491. $core.addMethod(
  10492. $core.method({
  10493. selector: "key:",
  10494. protocol: 'accessing',
  10495. fn: function (aKey){
  10496. var self=this;
  10497. self["@key"]=aKey;
  10498. return self;
  10499. },
  10500. args: ["aKey"],
  10501. source: "key: aKey\x0a\x09key := aKey",
  10502. referencedClasses: [],
  10503. messageSends: []
  10504. }),
  10505. $globals.Association);
  10506. $core.addMethod(
  10507. $core.method({
  10508. selector: "printOn:",
  10509. protocol: 'printing',
  10510. fn: function (aStream){
  10511. var self=this;
  10512. return $core.withContext(function($ctx1) {
  10513. $recv(self._key())._printOn_(aStream);
  10514. $ctx1.sendIdx["printOn:"]=1;
  10515. $recv(aStream)._nextPutAll_(" -> ");
  10516. $recv(self._value())._printOn_(aStream);
  10517. return self;
  10518. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10519. },
  10520. args: ["aStream"],
  10521. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10522. referencedClasses: [],
  10523. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10524. }),
  10525. $globals.Association);
  10526. $core.addMethod(
  10527. $core.method({
  10528. selector: "value",
  10529. protocol: 'accessing',
  10530. fn: function (){
  10531. var self=this;
  10532. return self["@value"];
  10533. },
  10534. args: [],
  10535. source: "value\x0a\x09^ value",
  10536. referencedClasses: [],
  10537. messageSends: []
  10538. }),
  10539. $globals.Association);
  10540. $core.addMethod(
  10541. $core.method({
  10542. selector: "value:",
  10543. protocol: 'accessing',
  10544. fn: function (aValue){
  10545. var self=this;
  10546. self["@value"]=aValue;
  10547. return self;
  10548. },
  10549. args: ["aValue"],
  10550. source: "value: aValue\x0a\x09value := aValue",
  10551. referencedClasses: [],
  10552. messageSends: []
  10553. }),
  10554. $globals.Association);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "key:value:",
  10558. protocol: 'instance creation',
  10559. fn: function (aKey,aValue){
  10560. var self=this;
  10561. return $core.withContext(function($ctx1) {
  10562. var $1;
  10563. $1=self._new();
  10564. $recv($1)._key_(aKey);
  10565. $recv($1)._value_(aValue);
  10566. return $recv($1)._yourself();
  10567. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10568. },
  10569. args: ["aKey", "aValue"],
  10570. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10571. referencedClasses: [],
  10572. messageSends: ["key:", "new", "value:", "yourself"]
  10573. }),
  10574. $globals.Association.klass);
  10575. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10576. $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`.";
  10577. $core.addMethod(
  10578. $core.method({
  10579. selector: "bucketOfElement:",
  10580. protocol: 'accessing',
  10581. fn: function (anObject){
  10582. var self=this;
  10583. return $core.withContext(function($ctx1) {
  10584. var hash = self['@hashBlock'](anObject);
  10585. if (!hash) return null;
  10586. var buckets = self['@buckets'],
  10587. bucket = buckets[hash];
  10588. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10589. return bucket;
  10590. ;
  10591. return self;
  10592. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10593. },
  10594. args: ["anObject"],
  10595. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  10596. referencedClasses: [],
  10597. messageSends: []
  10598. }),
  10599. $globals.BucketStore);
  10600. $core.addMethod(
  10601. $core.method({
  10602. selector: "do:",
  10603. protocol: 'enumerating',
  10604. fn: function (aBlock){
  10605. var self=this;
  10606. return $core.withContext(function($ctx1) {
  10607. var buckets = self['@buckets'];
  10608. var keys = Object.keys(buckets);
  10609. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10610. ;
  10611. return self;
  10612. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10613. },
  10614. args: ["aBlock"],
  10615. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  10616. referencedClasses: [],
  10617. messageSends: []
  10618. }),
  10619. $globals.BucketStore);
  10620. $core.addMethod(
  10621. $core.method({
  10622. selector: "hashBlock:",
  10623. protocol: 'accessing',
  10624. fn: function (aBlock){
  10625. var self=this;
  10626. self["@hashBlock"]=aBlock;
  10627. return self;
  10628. },
  10629. args: ["aBlock"],
  10630. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10631. referencedClasses: [],
  10632. messageSends: []
  10633. }),
  10634. $globals.BucketStore);
  10635. $core.addMethod(
  10636. $core.method({
  10637. selector: "initialize",
  10638. protocol: 'initialization',
  10639. fn: function (){
  10640. var self=this;
  10641. return $core.withContext(function($ctx1) {
  10642. (
  10643. $ctx1.supercall = true,
  10644. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  10645. $ctx1.supercall = false;
  10646. self._removeAll();
  10647. return self;
  10648. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10649. },
  10650. args: [],
  10651. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10652. referencedClasses: [],
  10653. messageSends: ["initialize", "removeAll"]
  10654. }),
  10655. $globals.BucketStore);
  10656. $core.addMethod(
  10657. $core.method({
  10658. selector: "newBucket",
  10659. protocol: 'private',
  10660. fn: function (){
  10661. var self=this;
  10662. return $core.withContext(function($ctx1) {
  10663. self._subclassResponsibility();
  10664. return self;
  10665. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10666. },
  10667. args: [],
  10668. source: "newBucket\x0a\x09self subclassResponsibility",
  10669. referencedClasses: [],
  10670. messageSends: ["subclassResponsibility"]
  10671. }),
  10672. $globals.BucketStore);
  10673. $core.addMethod(
  10674. $core.method({
  10675. selector: "removeAll",
  10676. protocol: 'adding/removing',
  10677. fn: function (){
  10678. var self=this;
  10679. return $core.withContext(function($ctx1) {
  10680. self['@buckets'] = Object.create(null);;
  10681. return self;
  10682. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10683. },
  10684. args: [],
  10685. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10686. referencedClasses: [],
  10687. messageSends: []
  10688. }),
  10689. $globals.BucketStore);
  10690. $core.addMethod(
  10691. $core.method({
  10692. selector: "hashBlock:",
  10693. protocol: 'instance creation',
  10694. fn: function (aBlock){
  10695. var self=this;
  10696. return $core.withContext(function($ctx1) {
  10697. var $1;
  10698. $1=self._new();
  10699. $recv($1)._hashBlock_(aBlock);
  10700. return $recv($1)._yourself();
  10701. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10702. },
  10703. args: ["aBlock"],
  10704. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10705. referencedClasses: [],
  10706. messageSends: ["hashBlock:", "new", "yourself"]
  10707. }),
  10708. $globals.BucketStore.klass);
  10709. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10710. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10711. $core.addMethod(
  10712. $core.method({
  10713. selector: "newBucket",
  10714. protocol: 'private',
  10715. fn: function (){
  10716. var self=this;
  10717. return [];
  10718. },
  10719. args: [],
  10720. source: "newBucket\x0a\x09^ #()",
  10721. referencedClasses: [],
  10722. messageSends: []
  10723. }),
  10724. $globals.ArrayBucketStore);
  10725. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10726. $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.";
  10727. $core.addMethod(
  10728. $core.method({
  10729. selector: ",",
  10730. protocol: 'copying',
  10731. fn: function (aCollection){
  10732. var self=this;
  10733. return $core.withContext(function($ctx1) {
  10734. var $1;
  10735. $1=self._copy();
  10736. $recv($1)._addAll_(aCollection);
  10737. return $recv($1)._yourself();
  10738. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10739. },
  10740. args: ["aCollection"],
  10741. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10742. referencedClasses: [],
  10743. messageSends: ["addAll:", "copy", "yourself"]
  10744. }),
  10745. $globals.Collection);
  10746. $core.addMethod(
  10747. $core.method({
  10748. selector: "add:",
  10749. protocol: 'adding/removing',
  10750. fn: function (anObject){
  10751. var self=this;
  10752. return $core.withContext(function($ctx1) {
  10753. self._subclassResponsibility();
  10754. return self;
  10755. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10756. },
  10757. args: ["anObject"],
  10758. source: "add: anObject\x0a\x09self subclassResponsibility",
  10759. referencedClasses: [],
  10760. messageSends: ["subclassResponsibility"]
  10761. }),
  10762. $globals.Collection);
  10763. $core.addMethod(
  10764. $core.method({
  10765. selector: "addAll:",
  10766. protocol: 'adding/removing',
  10767. fn: function (aCollection){
  10768. var self=this;
  10769. return $core.withContext(function($ctx1) {
  10770. $recv(aCollection)._do_((function(each){
  10771. return $core.withContext(function($ctx2) {
  10772. return self._add_(each);
  10773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10774. }));
  10775. return aCollection;
  10776. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10777. },
  10778. args: ["aCollection"],
  10779. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10780. referencedClasses: [],
  10781. messageSends: ["do:", "add:"]
  10782. }),
  10783. $globals.Collection);
  10784. $core.addMethod(
  10785. $core.method({
  10786. selector: "allSatisfy:",
  10787. protocol: 'enumerating',
  10788. fn: function (aBlock){
  10789. var self=this;
  10790. return $core.withContext(function($ctx1) {
  10791. var $1;
  10792. var $early={};
  10793. try {
  10794. self._do_((function(each){
  10795. return $core.withContext(function($ctx2) {
  10796. $1=$recv(aBlock)._value_(each);
  10797. if(!$core.assert($1)){
  10798. throw $early=[false];
  10799. };
  10800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10801. }));
  10802. return true;
  10803. }
  10804. catch(e) {if(e===$early)return e[0]; throw e}
  10805. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10806. },
  10807. args: ["aBlock"],
  10808. 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",
  10809. referencedClasses: [],
  10810. messageSends: ["do:", "ifFalse:", "value:"]
  10811. }),
  10812. $globals.Collection);
  10813. $core.addMethod(
  10814. $core.method({
  10815. selector: "anyOne",
  10816. protocol: 'adding/removing',
  10817. fn: function (){
  10818. var self=this;
  10819. return $core.withContext(function($ctx1) {
  10820. var $early={};
  10821. try {
  10822. self._ifEmpty_((function(){
  10823. return $core.withContext(function($ctx2) {
  10824. return self._error_("Collection is empty");
  10825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10826. }));
  10827. self._do_((function(each){
  10828. throw $early=[each];
  10829. }));
  10830. return self;
  10831. }
  10832. catch(e) {if(e===$early)return e[0]; throw e}
  10833. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10834. },
  10835. args: [],
  10836. 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 ]",
  10837. referencedClasses: [],
  10838. messageSends: ["ifEmpty:", "error:", "do:"]
  10839. }),
  10840. $globals.Collection);
  10841. $core.addMethod(
  10842. $core.method({
  10843. selector: "anySatisfy:",
  10844. protocol: 'enumerating',
  10845. fn: function (aBlock){
  10846. var self=this;
  10847. return $core.withContext(function($ctx1) {
  10848. var $1;
  10849. var $early={};
  10850. try {
  10851. self._do_((function(each){
  10852. return $core.withContext(function($ctx2) {
  10853. $1=$recv(aBlock)._value_(each);
  10854. if($core.assert($1)){
  10855. throw $early=[true];
  10856. };
  10857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10858. }));
  10859. return false;
  10860. }
  10861. catch(e) {if(e===$early)return e[0]; throw e}
  10862. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10863. },
  10864. args: ["aBlock"],
  10865. 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",
  10866. referencedClasses: [],
  10867. messageSends: ["do:", "ifTrue:", "value:"]
  10868. }),
  10869. $globals.Collection);
  10870. $core.addMethod(
  10871. $core.method({
  10872. selector: "asArray",
  10873. protocol: 'converting',
  10874. fn: function (){
  10875. var self=this;
  10876. return $core.withContext(function($ctx1) {
  10877. return $recv($globals.Array)._withAll_(self);
  10878. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10879. },
  10880. args: [],
  10881. source: "asArray\x0a\x09^ Array withAll: self",
  10882. referencedClasses: ["Array"],
  10883. messageSends: ["withAll:"]
  10884. }),
  10885. $globals.Collection);
  10886. $core.addMethod(
  10887. $core.method({
  10888. selector: "asJSON",
  10889. protocol: 'converting',
  10890. fn: function (){
  10891. var self=this;
  10892. return $core.withContext(function($ctx1) {
  10893. return $recv(self._asArray())._collect_((function(each){
  10894. return $core.withContext(function($ctx2) {
  10895. return $recv(each)._asJSON();
  10896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10897. }));
  10898. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10899. },
  10900. args: [],
  10901. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10902. referencedClasses: [],
  10903. messageSends: ["collect:", "asArray", "asJSON"]
  10904. }),
  10905. $globals.Collection);
  10906. $core.addMethod(
  10907. $core.method({
  10908. selector: "asOrderedCollection",
  10909. protocol: 'converting',
  10910. fn: function (){
  10911. var self=this;
  10912. return $core.withContext(function($ctx1) {
  10913. return self._asArray();
  10914. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10915. },
  10916. args: [],
  10917. source: "asOrderedCollection\x0a\x09^ self asArray",
  10918. referencedClasses: [],
  10919. messageSends: ["asArray"]
  10920. }),
  10921. $globals.Collection);
  10922. $core.addMethod(
  10923. $core.method({
  10924. selector: "asSet",
  10925. protocol: 'converting',
  10926. fn: function (){
  10927. var self=this;
  10928. return $core.withContext(function($ctx1) {
  10929. return $recv($globals.Set)._withAll_(self);
  10930. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10931. },
  10932. args: [],
  10933. source: "asSet\x0a\x09^ Set withAll: self",
  10934. referencedClasses: ["Set"],
  10935. messageSends: ["withAll:"]
  10936. }),
  10937. $globals.Collection);
  10938. $core.addMethod(
  10939. $core.method({
  10940. selector: "collect:",
  10941. protocol: 'enumerating',
  10942. fn: function (aBlock){
  10943. var self=this;
  10944. var stream;
  10945. return $core.withContext(function($ctx1) {
  10946. stream=$recv($recv(self._class())._new())._writeStream();
  10947. self._do_((function(each){
  10948. return $core.withContext(function($ctx2) {
  10949. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10951. }));
  10952. return $recv(stream)._contents();
  10953. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10954. },
  10955. args: ["aBlock"],
  10956. 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",
  10957. referencedClasses: [],
  10958. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10959. }),
  10960. $globals.Collection);
  10961. $core.addMethod(
  10962. $core.method({
  10963. selector: "copyWith:",
  10964. protocol: 'copying',
  10965. fn: function (anObject){
  10966. var self=this;
  10967. return $core.withContext(function($ctx1) {
  10968. var $1;
  10969. $1=self._copy();
  10970. $recv($1)._add_(anObject);
  10971. return $recv($1)._yourself();
  10972. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10973. },
  10974. args: ["anObject"],
  10975. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10976. referencedClasses: [],
  10977. messageSends: ["add:", "copy", "yourself"]
  10978. }),
  10979. $globals.Collection);
  10980. $core.addMethod(
  10981. $core.method({
  10982. selector: "copyWithAll:",
  10983. protocol: 'copying',
  10984. fn: function (aCollection){
  10985. var self=this;
  10986. return $core.withContext(function($ctx1) {
  10987. var $1;
  10988. $1=self._copy();
  10989. $recv($1)._addAll_(aCollection);
  10990. return $recv($1)._yourself();
  10991. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10992. },
  10993. args: ["aCollection"],
  10994. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10995. referencedClasses: [],
  10996. messageSends: ["addAll:", "copy", "yourself"]
  10997. }),
  10998. $globals.Collection);
  10999. $core.addMethod(
  11000. $core.method({
  11001. selector: "copyWithoutAll:",
  11002. protocol: 'copying',
  11003. fn: function (aCollection){
  11004. var self=this;
  11005. return $core.withContext(function($ctx1) {
  11006. return self._reject_((function(each){
  11007. return $core.withContext(function($ctx2) {
  11008. return $recv(aCollection)._includes_(each);
  11009. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11010. }));
  11011. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  11012. },
  11013. args: ["aCollection"],
  11014. 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 ]",
  11015. referencedClasses: [],
  11016. messageSends: ["reject:", "includes:"]
  11017. }),
  11018. $globals.Collection);
  11019. $core.addMethod(
  11020. $core.method({
  11021. selector: "deepCopy",
  11022. protocol: 'copying',
  11023. fn: function (){
  11024. var self=this;
  11025. return $core.withContext(function($ctx1) {
  11026. return self._collect_((function(each){
  11027. return $core.withContext(function($ctx2) {
  11028. return $recv(each)._deepCopy();
  11029. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11030. }));
  11031. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  11032. },
  11033. args: [],
  11034. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  11035. referencedClasses: [],
  11036. messageSends: ["collect:", "deepCopy"]
  11037. }),
  11038. $globals.Collection);
  11039. $core.addMethod(
  11040. $core.method({
  11041. selector: "detect:",
  11042. protocol: 'enumerating',
  11043. fn: function (aBlock){
  11044. var self=this;
  11045. return $core.withContext(function($ctx1) {
  11046. return self._detect_ifNone_(aBlock,(function(){
  11047. return $core.withContext(function($ctx2) {
  11048. return self._errorNotFound();
  11049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11050. }));
  11051. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  11052. },
  11053. args: ["aBlock"],
  11054. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  11055. referencedClasses: [],
  11056. messageSends: ["detect:ifNone:", "errorNotFound"]
  11057. }),
  11058. $globals.Collection);
  11059. $core.addMethod(
  11060. $core.method({
  11061. selector: "detect:ifNone:",
  11062. protocol: 'enumerating',
  11063. fn: function (aBlock,anotherBlock){
  11064. var self=this;
  11065. return $core.withContext(function($ctx1) {
  11066. self._subclassResponsibility();
  11067. return self;
  11068. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11069. },
  11070. args: ["aBlock", "anotherBlock"],
  11071. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  11072. referencedClasses: [],
  11073. messageSends: ["subclassResponsibility"]
  11074. }),
  11075. $globals.Collection);
  11076. $core.addMethod(
  11077. $core.method({
  11078. selector: "do:",
  11079. protocol: 'enumerating',
  11080. fn: function (aBlock){
  11081. var self=this;
  11082. return $core.withContext(function($ctx1) {
  11083. self._subclassResponsibility();
  11084. return self;
  11085. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  11086. },
  11087. args: ["aBlock"],
  11088. source: "do: aBlock\x0a\x09self subclassResponsibility",
  11089. referencedClasses: [],
  11090. messageSends: ["subclassResponsibility"]
  11091. }),
  11092. $globals.Collection);
  11093. $core.addMethod(
  11094. $core.method({
  11095. selector: "do:separatedBy:",
  11096. protocol: 'enumerating',
  11097. fn: function (aBlock,anotherBlock){
  11098. var self=this;
  11099. var actionBeforeElement;
  11100. return $core.withContext(function($ctx1) {
  11101. actionBeforeElement=(function(){
  11102. actionBeforeElement=anotherBlock;
  11103. return actionBeforeElement;
  11104. });
  11105. self._do_((function(each){
  11106. return $core.withContext(function($ctx2) {
  11107. $recv(actionBeforeElement)._value();
  11108. return $recv(aBlock)._value_(each);
  11109. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11110. }));
  11111. return self;
  11112. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11113. },
  11114. args: ["aBlock", "anotherBlock"],
  11115. 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 ]",
  11116. referencedClasses: [],
  11117. messageSends: ["do:", "value", "value:"]
  11118. }),
  11119. $globals.Collection);
  11120. $core.addMethod(
  11121. $core.method({
  11122. selector: "errorNotFound",
  11123. protocol: 'error handling',
  11124. fn: function (){
  11125. var self=this;
  11126. return $core.withContext(function($ctx1) {
  11127. self._error_("Object is not in the collection");
  11128. return self;
  11129. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11130. },
  11131. args: [],
  11132. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11133. referencedClasses: [],
  11134. messageSends: ["error:"]
  11135. }),
  11136. $globals.Collection);
  11137. $core.addMethod(
  11138. $core.method({
  11139. selector: "ifEmpty:",
  11140. protocol: 'testing',
  11141. fn: function (aBlock){
  11142. var self=this;
  11143. return $core.withContext(function($ctx1) {
  11144. var $1;
  11145. $1=self._isEmpty();
  11146. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11147. return self;
  11148. }));
  11149. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11150. },
  11151. args: ["aBlock"],
  11152. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  11153. referencedClasses: [],
  11154. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  11155. }),
  11156. $globals.Collection);
  11157. $core.addMethod(
  11158. $core.method({
  11159. selector: "ifEmpty:ifNotEmpty:",
  11160. protocol: 'testing',
  11161. fn: function (aBlock,anotherBlock){
  11162. var self=this;
  11163. return $core.withContext(function($ctx1) {
  11164. var $1;
  11165. $1=self._isEmpty();
  11166. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11167. return $core.withContext(function($ctx2) {
  11168. return $recv(anotherBlock)._value_(self);
  11169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11170. }));
  11171. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11172. },
  11173. args: ["aBlock", "anotherBlock"],
  11174. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11175. referencedClasses: [],
  11176. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  11177. }),
  11178. $globals.Collection);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "ifNotEmpty:",
  11182. protocol: 'testing',
  11183. fn: function (aBlock){
  11184. var self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. var $1;
  11187. $1=self._notEmpty();
  11188. if($core.assert($1)){
  11189. return $recv(aBlock)._value_(self);
  11190. } else {
  11191. return self;
  11192. };
  11193. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11194. },
  11195. args: ["aBlock"],
  11196. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11197. referencedClasses: [],
  11198. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11199. }),
  11200. $globals.Collection);
  11201. $core.addMethod(
  11202. $core.method({
  11203. selector: "ifNotEmpty:ifEmpty:",
  11204. protocol: 'testing',
  11205. fn: function (aBlock,anotherBlock){
  11206. var self=this;
  11207. return $core.withContext(function($ctx1) {
  11208. var $1;
  11209. $1=self._notEmpty();
  11210. return $recv($1)._ifTrue_ifFalse_((function(){
  11211. return $core.withContext(function($ctx2) {
  11212. return $recv(aBlock)._value_(self);
  11213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11214. }),anotherBlock);
  11215. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11216. },
  11217. args: ["aBlock", "anotherBlock"],
  11218. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  11219. referencedClasses: [],
  11220. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11221. }),
  11222. $globals.Collection);
  11223. $core.addMethod(
  11224. $core.method({
  11225. selector: "includes:",
  11226. protocol: 'testing',
  11227. fn: function (anObject){
  11228. var self=this;
  11229. return $core.withContext(function($ctx1) {
  11230. return self._anySatisfy_((function(each){
  11231. return $core.withContext(function($ctx2) {
  11232. return $recv(each).__eq(anObject);
  11233. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11234. }));
  11235. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11236. },
  11237. args: ["anObject"],
  11238. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11239. referencedClasses: [],
  11240. messageSends: ["anySatisfy:", "="]
  11241. }),
  11242. $globals.Collection);
  11243. $core.addMethod(
  11244. $core.method({
  11245. selector: "inject:into:",
  11246. protocol: 'enumerating',
  11247. fn: function (anObject,aBlock){
  11248. var self=this;
  11249. var result;
  11250. return $core.withContext(function($ctx1) {
  11251. result=anObject;
  11252. self._do_((function(each){
  11253. return $core.withContext(function($ctx2) {
  11254. result=$recv(aBlock)._value_value_(result,each);
  11255. return result;
  11256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11257. }));
  11258. return result;
  11259. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11260. },
  11261. args: ["anObject", "aBlock"],
  11262. 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",
  11263. referencedClasses: [],
  11264. messageSends: ["do:", "value:value:"]
  11265. }),
  11266. $globals.Collection);
  11267. $core.addMethod(
  11268. $core.method({
  11269. selector: "intersection:",
  11270. protocol: 'enumerating',
  11271. fn: function (aCollection){
  11272. var self=this;
  11273. var set,outputSet;
  11274. return $core.withContext(function($ctx1) {
  11275. var $2,$1;
  11276. set=self._asSet();
  11277. outputSet=$recv($globals.Set)._new();
  11278. $recv(aCollection)._do_((function(each){
  11279. return $core.withContext(function($ctx2) {
  11280. $2=$recv(set)._includes_(each);
  11281. $ctx2.sendIdx["includes:"]=1;
  11282. $1=$recv($2)._and_((function(){
  11283. return $core.withContext(function($ctx3) {
  11284. return $recv($recv(outputSet)._includes_(each))._not();
  11285. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11286. }));
  11287. if($core.assert($1)){
  11288. return $recv(outputSet)._add_(each);
  11289. };
  11290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11291. }));
  11292. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11293. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11294. },
  11295. args: ["aCollection"],
  11296. 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",
  11297. referencedClasses: ["Set"],
  11298. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11299. }),
  11300. $globals.Collection);
  11301. $core.addMethod(
  11302. $core.method({
  11303. selector: "isEmpty",
  11304. protocol: 'testing',
  11305. fn: function (){
  11306. var self=this;
  11307. return $core.withContext(function($ctx1) {
  11308. return $recv(self._size()).__eq((0));
  11309. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11310. },
  11311. args: [],
  11312. source: "isEmpty\x0a\x09^ self size = 0",
  11313. referencedClasses: [],
  11314. messageSends: ["=", "size"]
  11315. }),
  11316. $globals.Collection);
  11317. $core.addMethod(
  11318. $core.method({
  11319. selector: "noneSatisfy:",
  11320. protocol: 'enumerating',
  11321. fn: function (aBlock){
  11322. var self=this;
  11323. return $core.withContext(function($ctx1) {
  11324. var $1;
  11325. var $early={};
  11326. try {
  11327. self._do_((function(item){
  11328. return $core.withContext(function($ctx2) {
  11329. $1=$recv(aBlock)._value_(item);
  11330. if($core.assert($1)){
  11331. throw $early=[false];
  11332. };
  11333. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11334. }));
  11335. return true;
  11336. }
  11337. catch(e) {if(e===$early)return e[0]; throw e}
  11338. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11339. },
  11340. args: ["aBlock"],
  11341. 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",
  11342. referencedClasses: [],
  11343. messageSends: ["do:", "ifTrue:", "value:"]
  11344. }),
  11345. $globals.Collection);
  11346. $core.addMethod(
  11347. $core.method({
  11348. selector: "notEmpty",
  11349. protocol: 'testing',
  11350. fn: function (){
  11351. var self=this;
  11352. return $core.withContext(function($ctx1) {
  11353. return $recv(self._isEmpty())._not();
  11354. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11355. },
  11356. args: [],
  11357. source: "notEmpty\x0a\x09^ self isEmpty not",
  11358. referencedClasses: [],
  11359. messageSends: ["not", "isEmpty"]
  11360. }),
  11361. $globals.Collection);
  11362. $core.addMethod(
  11363. $core.method({
  11364. selector: "occurrencesOf:",
  11365. protocol: 'accessing',
  11366. fn: function (anObject){
  11367. var self=this;
  11368. var tally;
  11369. return $core.withContext(function($ctx1) {
  11370. var $1;
  11371. tally=(0);
  11372. self._do_((function(each){
  11373. return $core.withContext(function($ctx2) {
  11374. $1=$recv(anObject).__eq(each);
  11375. if($core.assert($1)){
  11376. tally=$recv(tally).__plus((1));
  11377. return tally;
  11378. };
  11379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11380. }));
  11381. return tally;
  11382. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11383. },
  11384. args: ["anObject"],
  11385. 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",
  11386. referencedClasses: [],
  11387. messageSends: ["do:", "ifTrue:", "=", "+"]
  11388. }),
  11389. $globals.Collection);
  11390. $core.addMethod(
  11391. $core.method({
  11392. selector: "putOn:",
  11393. protocol: 'streaming',
  11394. fn: function (aStream){
  11395. var self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. self._do_((function(each){
  11398. return $core.withContext(function($ctx2) {
  11399. return $recv(each)._putOn_(aStream);
  11400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11401. }));
  11402. return self;
  11403. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11404. },
  11405. args: ["aStream"],
  11406. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11407. referencedClasses: [],
  11408. messageSends: ["do:", "putOn:"]
  11409. }),
  11410. $globals.Collection);
  11411. $core.addMethod(
  11412. $core.method({
  11413. selector: "reject:",
  11414. protocol: 'enumerating',
  11415. fn: function (aBlock){
  11416. var self=this;
  11417. return $core.withContext(function($ctx1) {
  11418. return self._select_((function(each){
  11419. return $core.withContext(function($ctx2) {
  11420. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11422. }));
  11423. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11424. },
  11425. args: ["aBlock"],
  11426. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11427. referencedClasses: [],
  11428. messageSends: ["select:", "=", "value:"]
  11429. }),
  11430. $globals.Collection);
  11431. $core.addMethod(
  11432. $core.method({
  11433. selector: "remove:",
  11434. protocol: 'adding/removing',
  11435. fn: function (anObject){
  11436. var self=this;
  11437. return $core.withContext(function($ctx1) {
  11438. return self._remove_ifAbsent_(anObject,(function(){
  11439. return $core.withContext(function($ctx2) {
  11440. return self._errorNotFound();
  11441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11442. }));
  11443. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11444. },
  11445. args: ["anObject"],
  11446. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11447. referencedClasses: [],
  11448. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11449. }),
  11450. $globals.Collection);
  11451. $core.addMethod(
  11452. $core.method({
  11453. selector: "remove:ifAbsent:",
  11454. protocol: 'adding/removing',
  11455. fn: function (anObject,aBlock){
  11456. var self=this;
  11457. return $core.withContext(function($ctx1) {
  11458. self._subclassResponsibility();
  11459. return self;
  11460. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11461. },
  11462. args: ["anObject", "aBlock"],
  11463. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11464. referencedClasses: [],
  11465. messageSends: ["subclassResponsibility"]
  11466. }),
  11467. $globals.Collection);
  11468. $core.addMethod(
  11469. $core.method({
  11470. selector: "removeAll",
  11471. protocol: 'adding/removing',
  11472. fn: function (){
  11473. var self=this;
  11474. return $core.withContext(function($ctx1) {
  11475. self._subclassResponsibility();
  11476. return self;
  11477. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11478. },
  11479. args: [],
  11480. source: "removeAll\x0a\x09self subclassResponsibility",
  11481. referencedClasses: [],
  11482. messageSends: ["subclassResponsibility"]
  11483. }),
  11484. $globals.Collection);
  11485. $core.addMethod(
  11486. $core.method({
  11487. selector: "select:",
  11488. protocol: 'enumerating',
  11489. fn: function (aBlock){
  11490. var self=this;
  11491. var stream;
  11492. return $core.withContext(function($ctx1) {
  11493. var $1;
  11494. stream=$recv($recv(self._class())._new())._writeStream();
  11495. self._do_((function(each){
  11496. return $core.withContext(function($ctx2) {
  11497. $1=$recv(aBlock)._value_(each);
  11498. if($core.assert($1)){
  11499. return $recv(stream)._nextPut_(each);
  11500. };
  11501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11502. }));
  11503. return $recv(stream)._contents();
  11504. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11505. },
  11506. args: ["aBlock"],
  11507. 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",
  11508. referencedClasses: [],
  11509. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11510. }),
  11511. $globals.Collection);
  11512. $core.addMethod(
  11513. $core.method({
  11514. selector: "select:thenCollect:",
  11515. protocol: 'enumerating',
  11516. fn: function (selectBlock,collectBlock){
  11517. var self=this;
  11518. var stream;
  11519. return $core.withContext(function($ctx1) {
  11520. var $1;
  11521. stream=$recv($recv(self._class())._new())._writeStream();
  11522. self._do_((function(each){
  11523. return $core.withContext(function($ctx2) {
  11524. $1=$recv(selectBlock)._value_(each);
  11525. $ctx2.sendIdx["value:"]=1;
  11526. if($core.assert($1)){
  11527. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11528. };
  11529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11530. }));
  11531. return $recv(stream)._contents();
  11532. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11533. },
  11534. args: ["selectBlock", "collectBlock"],
  11535. 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",
  11536. referencedClasses: [],
  11537. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11538. }),
  11539. $globals.Collection);
  11540. $core.addMethod(
  11541. $core.method({
  11542. selector: "shallowCopy",
  11543. protocol: 'copying',
  11544. fn: function (){
  11545. var self=this;
  11546. return $core.withContext(function($ctx1) {
  11547. return self._collect_((function(each){
  11548. return each;
  11549. }));
  11550. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11551. },
  11552. args: [],
  11553. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11554. referencedClasses: [],
  11555. messageSends: ["collect:"]
  11556. }),
  11557. $globals.Collection);
  11558. $core.addMethod(
  11559. $core.method({
  11560. selector: "size",
  11561. protocol: 'accessing',
  11562. fn: function (){
  11563. var self=this;
  11564. return $core.withContext(function($ctx1) {
  11565. self._subclassResponsibility();
  11566. return self;
  11567. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11568. },
  11569. args: [],
  11570. source: "size\x0a\x09self subclassResponsibility",
  11571. referencedClasses: [],
  11572. messageSends: ["subclassResponsibility"]
  11573. }),
  11574. $globals.Collection);
  11575. $core.addMethod(
  11576. $core.method({
  11577. selector: "classTag",
  11578. protocol: 'accessing',
  11579. fn: function (){
  11580. var self=this;
  11581. return "collection";
  11582. },
  11583. args: [],
  11584. 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'",
  11585. referencedClasses: [],
  11586. messageSends: []
  11587. }),
  11588. $globals.Collection.klass);
  11589. $core.addMethod(
  11590. $core.method({
  11591. selector: "new:",
  11592. protocol: 'instance creation',
  11593. fn: function (anInteger){
  11594. var self=this;
  11595. return $core.withContext(function($ctx1) {
  11596. return self._new();
  11597. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11598. },
  11599. args: ["anInteger"],
  11600. source: "new: anInteger\x0a\x09^ self new",
  11601. referencedClasses: [],
  11602. messageSends: ["new"]
  11603. }),
  11604. $globals.Collection.klass);
  11605. $core.addMethod(
  11606. $core.method({
  11607. selector: "with:",
  11608. protocol: 'instance creation',
  11609. fn: function (anObject){
  11610. var self=this;
  11611. return $core.withContext(function($ctx1) {
  11612. var $1;
  11613. $1=self._new();
  11614. $recv($1)._add_(anObject);
  11615. return $recv($1)._yourself();
  11616. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11617. },
  11618. args: ["anObject"],
  11619. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11620. referencedClasses: [],
  11621. messageSends: ["add:", "new", "yourself"]
  11622. }),
  11623. $globals.Collection.klass);
  11624. $core.addMethod(
  11625. $core.method({
  11626. selector: "with:with:",
  11627. protocol: 'instance creation',
  11628. fn: function (anObject,anotherObject){
  11629. var self=this;
  11630. return $core.withContext(function($ctx1) {
  11631. var $1;
  11632. $1=self._new();
  11633. $recv($1)._add_(anObject);
  11634. $ctx1.sendIdx["add:"]=1;
  11635. $recv($1)._add_(anotherObject);
  11636. return $recv($1)._yourself();
  11637. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11638. },
  11639. args: ["anObject", "anotherObject"],
  11640. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11641. referencedClasses: [],
  11642. messageSends: ["add:", "new", "yourself"]
  11643. }),
  11644. $globals.Collection.klass);
  11645. $core.addMethod(
  11646. $core.method({
  11647. selector: "with:with:with:",
  11648. protocol: 'instance creation',
  11649. fn: function (firstObject,secondObject,thirdObject){
  11650. var self=this;
  11651. return $core.withContext(function($ctx1) {
  11652. var $1;
  11653. $1=self._new();
  11654. $recv($1)._add_(firstObject);
  11655. $ctx1.sendIdx["add:"]=1;
  11656. $recv($1)._add_(secondObject);
  11657. $ctx1.sendIdx["add:"]=2;
  11658. $recv($1)._add_(thirdObject);
  11659. return $recv($1)._yourself();
  11660. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11661. },
  11662. args: ["firstObject", "secondObject", "thirdObject"],
  11663. 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",
  11664. referencedClasses: [],
  11665. messageSends: ["add:", "new", "yourself"]
  11666. }),
  11667. $globals.Collection.klass);
  11668. $core.addMethod(
  11669. $core.method({
  11670. selector: "withAll:",
  11671. protocol: 'instance creation',
  11672. fn: function (aCollection){
  11673. var self=this;
  11674. return $core.withContext(function($ctx1) {
  11675. var $1;
  11676. $1=self._new();
  11677. $recv($1)._addAll_(aCollection);
  11678. return $recv($1)._yourself();
  11679. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11680. },
  11681. args: ["aCollection"],
  11682. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11683. referencedClasses: [],
  11684. messageSends: ["addAll:", "new", "yourself"]
  11685. }),
  11686. $globals.Collection.klass);
  11687. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11688. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  11689. $core.addMethod(
  11690. $core.method({
  11691. selector: "at:",
  11692. protocol: 'accessing',
  11693. fn: function (anIndex){
  11694. var self=this;
  11695. return $core.withContext(function($ctx1) {
  11696. return self._at_ifAbsent_(anIndex,(function(){
  11697. return $core.withContext(function($ctx2) {
  11698. return self._errorNotFound();
  11699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11700. }));
  11701. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11702. },
  11703. args: ["anIndex"],
  11704. 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 ]",
  11705. referencedClasses: [],
  11706. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11707. }),
  11708. $globals.IndexableCollection);
  11709. $core.addMethod(
  11710. $core.method({
  11711. selector: "at:ifAbsent:",
  11712. protocol: 'accessing',
  11713. fn: function (anIndex,aBlock){
  11714. var self=this;
  11715. return $core.withContext(function($ctx1) {
  11716. self._subclassResponsibility();
  11717. return self;
  11718. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11719. },
  11720. args: ["anIndex", "aBlock"],
  11721. 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",
  11722. referencedClasses: [],
  11723. messageSends: ["subclassResponsibility"]
  11724. }),
  11725. $globals.IndexableCollection);
  11726. $core.addMethod(
  11727. $core.method({
  11728. selector: "at:ifAbsentPut:",
  11729. protocol: 'accessing',
  11730. fn: function (aKey,aBlock){
  11731. var self=this;
  11732. return $core.withContext(function($ctx1) {
  11733. return self._at_ifAbsent_(aKey,(function(){
  11734. return $core.withContext(function($ctx2) {
  11735. return self._at_put_(aKey,$recv(aBlock)._value());
  11736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11737. }));
  11738. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11739. },
  11740. args: ["aKey", "aBlock"],
  11741. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11742. referencedClasses: [],
  11743. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11744. }),
  11745. $globals.IndexableCollection);
  11746. $core.addMethod(
  11747. $core.method({
  11748. selector: "at:ifPresent:",
  11749. protocol: 'accessing',
  11750. fn: function (anIndex,aBlock){
  11751. var self=this;
  11752. return $core.withContext(function($ctx1) {
  11753. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11754. return nil;
  11755. }));
  11756. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11757. },
  11758. args: ["anIndex", "aBlock"],
  11759. 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 ]",
  11760. referencedClasses: [],
  11761. messageSends: ["at:ifPresent:ifAbsent:"]
  11762. }),
  11763. $globals.IndexableCollection);
  11764. $core.addMethod(
  11765. $core.method({
  11766. selector: "at:ifPresent:ifAbsent:",
  11767. protocol: 'accessing',
  11768. fn: function (anIndex,aBlock,anotherBlock){
  11769. var self=this;
  11770. return $core.withContext(function($ctx1) {
  11771. self._subclassResponsibility();
  11772. return self;
  11773. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11774. },
  11775. args: ["anIndex", "aBlock", "anotherBlock"],
  11776. 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",
  11777. referencedClasses: [],
  11778. messageSends: ["subclassResponsibility"]
  11779. }),
  11780. $globals.IndexableCollection);
  11781. $core.addMethod(
  11782. $core.method({
  11783. selector: "at:put:",
  11784. protocol: 'accessing',
  11785. fn: function (anIndex,anObject){
  11786. var self=this;
  11787. return $core.withContext(function($ctx1) {
  11788. self._subclassResponsibility();
  11789. return self;
  11790. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11791. },
  11792. args: ["anIndex", "anObject"],
  11793. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11794. referencedClasses: [],
  11795. messageSends: ["subclassResponsibility"]
  11796. }),
  11797. $globals.IndexableCollection);
  11798. $core.addMethod(
  11799. $core.method({
  11800. selector: "indexOf:",
  11801. protocol: 'accessing',
  11802. fn: function (anObject){
  11803. var self=this;
  11804. return $core.withContext(function($ctx1) {
  11805. return self._indexOf_ifAbsent_(anObject,(function(){
  11806. return $core.withContext(function($ctx2) {
  11807. return self._errorNotFound();
  11808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11809. }));
  11810. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11811. },
  11812. args: ["anObject"],
  11813. 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 ]",
  11814. referencedClasses: [],
  11815. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11816. }),
  11817. $globals.IndexableCollection);
  11818. $core.addMethod(
  11819. $core.method({
  11820. selector: "indexOf:ifAbsent:",
  11821. protocol: 'accessing',
  11822. fn: function (anObject,aBlock){
  11823. var self=this;
  11824. return $core.withContext(function($ctx1) {
  11825. self._subclassResponsibility();
  11826. return self;
  11827. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11828. },
  11829. args: ["anObject", "aBlock"],
  11830. 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",
  11831. referencedClasses: [],
  11832. messageSends: ["subclassResponsibility"]
  11833. }),
  11834. $globals.IndexableCollection);
  11835. $core.addMethod(
  11836. $core.method({
  11837. selector: "with:do:",
  11838. protocol: 'enumerating',
  11839. fn: function (anotherCollection,aBlock){
  11840. var self=this;
  11841. return $core.withContext(function($ctx1) {
  11842. self._withIndexDo_((function(each,index){
  11843. return $core.withContext(function($ctx2) {
  11844. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11845. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11846. }));
  11847. return self;
  11848. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11849. },
  11850. args: ["anotherCollection", "aBlock"],
  11851. 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) ]",
  11852. referencedClasses: [],
  11853. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11854. }),
  11855. $globals.IndexableCollection);
  11856. $core.addMethod(
  11857. $core.method({
  11858. selector: "withIndexDo:",
  11859. protocol: 'enumerating',
  11860. fn: function (aBlock){
  11861. var self=this;
  11862. return $core.withContext(function($ctx1) {
  11863. self._subclassResponsibility();
  11864. return self;
  11865. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11866. },
  11867. args: ["aBlock"],
  11868. 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",
  11869. referencedClasses: [],
  11870. messageSends: ["subclassResponsibility"]
  11871. }),
  11872. $globals.IndexableCollection);
  11873. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11874. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11875. $core.addMethod(
  11876. $core.method({
  11877. selector: "=",
  11878. protocol: 'comparing',
  11879. fn: function (anAssocitativeCollection){
  11880. var self=this;
  11881. return $core.withContext(function($ctx1) {
  11882. var $2,$1,$4,$3,$5;
  11883. $2=self._class();
  11884. $ctx1.sendIdx["class"]=1;
  11885. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11886. $ctx1.sendIdx["="]=1;
  11887. if(!$core.assert($1)){
  11888. return false;
  11889. };
  11890. $4=self._size();
  11891. $ctx1.sendIdx["size"]=1;
  11892. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11893. $ctx1.sendIdx["="]=2;
  11894. if(!$core.assert($3)){
  11895. return false;
  11896. };
  11897. $5=self._associations();
  11898. $ctx1.sendIdx["associations"]=1;
  11899. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11900. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11901. },
  11902. args: ["anAssocitativeCollection"],
  11903. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11904. referencedClasses: [],
  11905. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11906. }),
  11907. $globals.AssociativeCollection);
  11908. $core.addMethod(
  11909. $core.method({
  11910. selector: "add:",
  11911. protocol: 'adding/removing',
  11912. fn: function (anAssociation){
  11913. var self=this;
  11914. return $core.withContext(function($ctx1) {
  11915. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11916. return self;
  11917. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11918. },
  11919. args: ["anAssociation"],
  11920. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11921. referencedClasses: [],
  11922. messageSends: ["at:put:", "key", "value"]
  11923. }),
  11924. $globals.AssociativeCollection);
  11925. $core.addMethod(
  11926. $core.method({
  11927. selector: "addAll:",
  11928. protocol: 'adding/removing',
  11929. fn: function (anAssociativeCollection){
  11930. var self=this;
  11931. return $core.withContext(function($ctx1) {
  11932. (
  11933. $ctx1.supercall = true,
  11934. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11935. $ctx1.supercall = false;
  11936. return anAssociativeCollection;
  11937. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11938. },
  11939. args: ["anAssociativeCollection"],
  11940. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11941. referencedClasses: [],
  11942. messageSends: ["addAll:", "associations"]
  11943. }),
  11944. $globals.AssociativeCollection);
  11945. $core.addMethod(
  11946. $core.method({
  11947. selector: "asDictionary",
  11948. protocol: 'converting',
  11949. fn: function (){
  11950. var self=this;
  11951. return $core.withContext(function($ctx1) {
  11952. return $recv($globals.Dictionary)._from_(self._associations());
  11953. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11954. },
  11955. args: [],
  11956. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11957. referencedClasses: ["Dictionary"],
  11958. messageSends: ["from:", "associations"]
  11959. }),
  11960. $globals.AssociativeCollection);
  11961. $core.addMethod(
  11962. $core.method({
  11963. selector: "asHashedCollection",
  11964. protocol: 'converting',
  11965. fn: function (){
  11966. var self=this;
  11967. return $core.withContext(function($ctx1) {
  11968. return $recv($globals.HashedCollection)._from_(self._associations());
  11969. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11970. },
  11971. args: [],
  11972. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11973. referencedClasses: ["HashedCollection"],
  11974. messageSends: ["from:", "associations"]
  11975. }),
  11976. $globals.AssociativeCollection);
  11977. $core.addMethod(
  11978. $core.method({
  11979. selector: "asJSON",
  11980. protocol: 'converting',
  11981. fn: function (){
  11982. var self=this;
  11983. var hash;
  11984. return $core.withContext(function($ctx1) {
  11985. hash=$recv($globals.HashedCollection)._new();
  11986. self._keysAndValuesDo_((function(key,value){
  11987. return $core.withContext(function($ctx2) {
  11988. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11989. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11990. }));
  11991. return hash;
  11992. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11993. },
  11994. args: [],
  11995. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  11996. referencedClasses: ["HashedCollection"],
  11997. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11998. }),
  11999. $globals.AssociativeCollection);
  12000. $core.addMethod(
  12001. $core.method({
  12002. selector: "associations",
  12003. protocol: 'accessing',
  12004. fn: function (){
  12005. var self=this;
  12006. var associations;
  12007. return $core.withContext(function($ctx1) {
  12008. associations=[];
  12009. self._associationsDo_((function(each){
  12010. return $core.withContext(function($ctx2) {
  12011. return $recv(associations)._add_(each);
  12012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12013. }));
  12014. return associations;
  12015. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  12016. },
  12017. args: [],
  12018. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  12019. referencedClasses: [],
  12020. messageSends: ["associationsDo:", "add:"]
  12021. }),
  12022. $globals.AssociativeCollection);
  12023. $core.addMethod(
  12024. $core.method({
  12025. selector: "associationsDo:",
  12026. protocol: 'enumerating',
  12027. fn: function (aBlock){
  12028. var self=this;
  12029. return $core.withContext(function($ctx1) {
  12030. self._keysAndValuesDo_((function(key,value){
  12031. return $core.withContext(function($ctx2) {
  12032. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  12033. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12034. }));
  12035. return self;
  12036. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12037. },
  12038. args: ["aBlock"],
  12039. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  12040. referencedClasses: ["Association"],
  12041. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  12042. }),
  12043. $globals.AssociativeCollection);
  12044. $core.addMethod(
  12045. $core.method({
  12046. selector: "at:ifPresent:ifAbsent:",
  12047. protocol: 'accessing',
  12048. fn: function (aKey,aBlock,anotherBlock){
  12049. var self=this;
  12050. return $core.withContext(function($ctx1) {
  12051. var $1;
  12052. $1=self._includesKey_(aKey);
  12053. if($core.assert($1)){
  12054. return $recv(aBlock)._value_(self._at_(aKey));
  12055. } else {
  12056. return $recv(anotherBlock)._value();
  12057. };
  12058. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12059. },
  12060. args: ["aKey", "aBlock", "anotherBlock"],
  12061. 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 ]",
  12062. referencedClasses: [],
  12063. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  12064. }),
  12065. $globals.AssociativeCollection);
  12066. $core.addMethod(
  12067. $core.method({
  12068. selector: "collect:",
  12069. protocol: 'enumerating',
  12070. fn: function (aBlock){
  12071. var self=this;
  12072. var newDict;
  12073. return $core.withContext(function($ctx1) {
  12074. newDict=$recv(self._class())._new();
  12075. self._keysAndValuesDo_((function(key,value){
  12076. return $core.withContext(function($ctx2) {
  12077. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12078. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12079. }));
  12080. return newDict;
  12081. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12082. },
  12083. args: ["aBlock"],
  12084. 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",
  12085. referencedClasses: [],
  12086. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12087. }),
  12088. $globals.AssociativeCollection);
  12089. $core.addMethod(
  12090. $core.method({
  12091. selector: "deepCopy",
  12092. protocol: 'copying',
  12093. fn: function (){
  12094. var self=this;
  12095. var copy;
  12096. return $core.withContext(function($ctx1) {
  12097. copy=$recv(self._class())._new();
  12098. self._keysAndValuesDo_((function(key,value){
  12099. return $core.withContext(function($ctx2) {
  12100. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12101. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12102. }));
  12103. return copy;
  12104. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12105. },
  12106. args: [],
  12107. 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",
  12108. referencedClasses: [],
  12109. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12110. }),
  12111. $globals.AssociativeCollection);
  12112. $core.addMethod(
  12113. $core.method({
  12114. selector: "detect:ifNone:",
  12115. protocol: 'enumerating',
  12116. fn: function (aBlock,anotherBlock){
  12117. var self=this;
  12118. return $core.withContext(function($ctx1) {
  12119. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12120. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12121. },
  12122. args: ["aBlock", "anotherBlock"],
  12123. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12124. referencedClasses: [],
  12125. messageSends: ["detect:ifNone:", "values"]
  12126. }),
  12127. $globals.AssociativeCollection);
  12128. $core.addMethod(
  12129. $core.method({
  12130. selector: "do:",
  12131. protocol: 'enumerating',
  12132. fn: function (aBlock){
  12133. var self=this;
  12134. return $core.withContext(function($ctx1) {
  12135. self._valuesDo_(aBlock);
  12136. return self;
  12137. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12138. },
  12139. args: ["aBlock"],
  12140. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12141. referencedClasses: [],
  12142. messageSends: ["valuesDo:"]
  12143. }),
  12144. $globals.AssociativeCollection);
  12145. $core.addMethod(
  12146. $core.method({
  12147. selector: "includes:",
  12148. protocol: 'enumerating',
  12149. fn: function (anObject){
  12150. var self=this;
  12151. return $core.withContext(function($ctx1) {
  12152. return $recv(self._values())._includes_(anObject);
  12153. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12154. },
  12155. args: ["anObject"],
  12156. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12157. referencedClasses: [],
  12158. messageSends: ["includes:", "values"]
  12159. }),
  12160. $globals.AssociativeCollection);
  12161. $core.addMethod(
  12162. $core.method({
  12163. selector: "includesKey:",
  12164. protocol: 'testing',
  12165. fn: function (aKey){
  12166. var self=this;
  12167. return $core.withContext(function($ctx1) {
  12168. self._subclassResponsibility();
  12169. return self;
  12170. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12171. },
  12172. args: ["aKey"],
  12173. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12174. referencedClasses: [],
  12175. messageSends: ["subclassResponsibility"]
  12176. }),
  12177. $globals.AssociativeCollection);
  12178. $core.addMethod(
  12179. $core.method({
  12180. selector: "indexOf:ifAbsent:",
  12181. protocol: 'accessing',
  12182. fn: function (anObject,aBlock){
  12183. var self=this;
  12184. return $core.withContext(function($ctx1) {
  12185. return $recv(self._keys())._detect_ifNone_((function(each){
  12186. return $core.withContext(function($ctx2) {
  12187. return $recv(self._at_(each)).__eq(anObject);
  12188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12189. }),aBlock);
  12190. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12191. },
  12192. args: ["anObject", "aBlock"],
  12193. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12194. referencedClasses: [],
  12195. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12196. }),
  12197. $globals.AssociativeCollection);
  12198. $core.addMethod(
  12199. $core.method({
  12200. selector: "keyAtValue:",
  12201. protocol: 'accessing',
  12202. fn: function (anObject){
  12203. var self=this;
  12204. return $core.withContext(function($ctx1) {
  12205. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12206. return $core.withContext(function($ctx2) {
  12207. return self._errorNotFound();
  12208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12209. }));
  12210. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12211. },
  12212. args: ["anObject"],
  12213. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12214. referencedClasses: [],
  12215. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12216. }),
  12217. $globals.AssociativeCollection);
  12218. $core.addMethod(
  12219. $core.method({
  12220. selector: "keyAtValue:ifAbsent:",
  12221. protocol: 'accessing',
  12222. fn: function (anObject,aBlock){
  12223. var self=this;
  12224. return $core.withContext(function($ctx1) {
  12225. return self._indexOf_ifAbsent_(anObject,aBlock);
  12226. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12227. },
  12228. args: ["anObject", "aBlock"],
  12229. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12230. referencedClasses: [],
  12231. messageSends: ["indexOf:ifAbsent:"]
  12232. }),
  12233. $globals.AssociativeCollection);
  12234. $core.addMethod(
  12235. $core.method({
  12236. selector: "keys",
  12237. protocol: 'accessing',
  12238. fn: function (){
  12239. var self=this;
  12240. return $core.withContext(function($ctx1) {
  12241. self._subclassResponsibility();
  12242. return self;
  12243. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12244. },
  12245. args: [],
  12246. source: "keys\x0a\x09self subclassResponsibility",
  12247. referencedClasses: [],
  12248. messageSends: ["subclassResponsibility"]
  12249. }),
  12250. $globals.AssociativeCollection);
  12251. $core.addMethod(
  12252. $core.method({
  12253. selector: "keysAndValuesDo:",
  12254. protocol: 'enumerating',
  12255. fn: function (aBlock){
  12256. var self=this;
  12257. return $core.withContext(function($ctx1) {
  12258. self._keysDo_((function(each){
  12259. return $core.withContext(function($ctx2) {
  12260. return $recv(aBlock)._value_value_(each,self._at_(each));
  12261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12262. }));
  12263. return self;
  12264. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12265. },
  12266. args: ["aBlock"],
  12267. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12268. referencedClasses: [],
  12269. messageSends: ["keysDo:", "value:value:", "at:"]
  12270. }),
  12271. $globals.AssociativeCollection);
  12272. $core.addMethod(
  12273. $core.method({
  12274. selector: "keysDo:",
  12275. protocol: 'enumerating',
  12276. fn: function (aBlock){
  12277. var self=this;
  12278. return $core.withContext(function($ctx1) {
  12279. self._subclassResponsibility();
  12280. return self;
  12281. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12282. },
  12283. args: ["aBlock"],
  12284. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12285. referencedClasses: [],
  12286. messageSends: ["subclassResponsibility"]
  12287. }),
  12288. $globals.AssociativeCollection);
  12289. $core.addMethod(
  12290. $core.method({
  12291. selector: "printOn:",
  12292. protocol: 'printing',
  12293. fn: function (aStream){
  12294. var self=this;
  12295. return $core.withContext(function($ctx1) {
  12296. (
  12297. $ctx1.supercall = true,
  12298. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12299. $ctx1.supercall = false;
  12300. $ctx1.sendIdx["printOn:"]=1;
  12301. $recv(aStream)._nextPutAll_(" (");
  12302. $ctx1.sendIdx["nextPutAll:"]=1;
  12303. $recv(self._associations())._do_separatedBy_((function(each){
  12304. return $core.withContext(function($ctx2) {
  12305. return $recv(each)._printOn_(aStream);
  12306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12307. }),(function(){
  12308. return $core.withContext(function($ctx2) {
  12309. return $recv(aStream)._nextPutAll_(" , ");
  12310. $ctx2.sendIdx["nextPutAll:"]=2;
  12311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12312. }));
  12313. $recv(aStream)._nextPutAll_(")");
  12314. return self;
  12315. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12316. },
  12317. args: ["aStream"],
  12318. 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: ')'",
  12319. referencedClasses: [],
  12320. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12321. }),
  12322. $globals.AssociativeCollection);
  12323. $core.addMethod(
  12324. $core.method({
  12325. selector: "remove:ifAbsent:",
  12326. protocol: 'adding/removing',
  12327. fn: function (aKey,aBlock){
  12328. var self=this;
  12329. return $core.withContext(function($ctx1) {
  12330. return self._removeKey_ifAbsent_(aKey,aBlock);
  12331. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12332. },
  12333. args: ["aKey", "aBlock"],
  12334. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12335. referencedClasses: [],
  12336. messageSends: ["removeKey:ifAbsent:"]
  12337. }),
  12338. $globals.AssociativeCollection);
  12339. $core.addMethod(
  12340. $core.method({
  12341. selector: "removeAll",
  12342. protocol: 'adding/removing',
  12343. fn: function (){
  12344. var self=this;
  12345. return $core.withContext(function($ctx1) {
  12346. return $recv(self._keys())._do_((function(each){
  12347. return $core.withContext(function($ctx2) {
  12348. return self._removeKey_(each);
  12349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12350. }));
  12351. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12352. },
  12353. args: [],
  12354. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12355. referencedClasses: [],
  12356. messageSends: ["do:", "keys", "removeKey:"]
  12357. }),
  12358. $globals.AssociativeCollection);
  12359. $core.addMethod(
  12360. $core.method({
  12361. selector: "removeKey:",
  12362. protocol: 'adding/removing',
  12363. fn: function (aKey){
  12364. var self=this;
  12365. return $core.withContext(function($ctx1) {
  12366. return self._remove_(aKey);
  12367. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12368. },
  12369. args: ["aKey"],
  12370. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12371. referencedClasses: [],
  12372. messageSends: ["remove:"]
  12373. }),
  12374. $globals.AssociativeCollection);
  12375. $core.addMethod(
  12376. $core.method({
  12377. selector: "removeKey:ifAbsent:",
  12378. protocol: 'adding/removing',
  12379. fn: function (aKey,aBlock){
  12380. var self=this;
  12381. return $core.withContext(function($ctx1) {
  12382. self._subclassResponsibility();
  12383. return self;
  12384. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12385. },
  12386. args: ["aKey", "aBlock"],
  12387. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12388. referencedClasses: [],
  12389. messageSends: ["subclassResponsibility"]
  12390. }),
  12391. $globals.AssociativeCollection);
  12392. $core.addMethod(
  12393. $core.method({
  12394. selector: "select:",
  12395. protocol: 'enumerating',
  12396. fn: function (aBlock){
  12397. var self=this;
  12398. var newDict;
  12399. return $core.withContext(function($ctx1) {
  12400. var $1;
  12401. newDict=$recv(self._class())._new();
  12402. self._keysAndValuesDo_((function(key,value){
  12403. return $core.withContext(function($ctx2) {
  12404. $1=$recv(aBlock)._value_(value);
  12405. if($core.assert($1)){
  12406. return $recv(newDict)._at_put_(key,value);
  12407. };
  12408. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12409. }));
  12410. return newDict;
  12411. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12412. },
  12413. args: ["aBlock"],
  12414. 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",
  12415. referencedClasses: [],
  12416. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12417. }),
  12418. $globals.AssociativeCollection);
  12419. $core.addMethod(
  12420. $core.method({
  12421. selector: "shallowCopy",
  12422. protocol: 'copying',
  12423. fn: function (){
  12424. var self=this;
  12425. var copy;
  12426. return $core.withContext(function($ctx1) {
  12427. copy=$recv(self._class())._new();
  12428. self._keysAndValuesDo_((function(key,value){
  12429. return $core.withContext(function($ctx2) {
  12430. return $recv(copy)._at_put_(key,value);
  12431. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12432. }));
  12433. return copy;
  12434. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12435. },
  12436. args: [],
  12437. 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",
  12438. referencedClasses: [],
  12439. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12440. }),
  12441. $globals.AssociativeCollection);
  12442. $core.addMethod(
  12443. $core.method({
  12444. selector: "size",
  12445. protocol: 'accessing',
  12446. fn: function (){
  12447. var self=this;
  12448. return $core.withContext(function($ctx1) {
  12449. return $recv(self._keys())._size();
  12450. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12451. },
  12452. args: [],
  12453. source: "size\x0a\x09^ self keys size",
  12454. referencedClasses: [],
  12455. messageSends: ["size", "keys"]
  12456. }),
  12457. $globals.AssociativeCollection);
  12458. $core.addMethod(
  12459. $core.method({
  12460. selector: "values",
  12461. protocol: 'accessing',
  12462. fn: function (){
  12463. var self=this;
  12464. return $core.withContext(function($ctx1) {
  12465. self._subclassResponsibility();
  12466. return self;
  12467. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12468. },
  12469. args: [],
  12470. source: "values\x0a\x09self subclassResponsibility",
  12471. referencedClasses: [],
  12472. messageSends: ["subclassResponsibility"]
  12473. }),
  12474. $globals.AssociativeCollection);
  12475. $core.addMethod(
  12476. $core.method({
  12477. selector: "valuesDo:",
  12478. protocol: 'enumerating',
  12479. fn: function (aBlock){
  12480. var self=this;
  12481. return $core.withContext(function($ctx1) {
  12482. self._subclassResponsibility();
  12483. return self;
  12484. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12485. },
  12486. args: ["aBlock"],
  12487. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12488. referencedClasses: [],
  12489. messageSends: ["subclassResponsibility"]
  12490. }),
  12491. $globals.AssociativeCollection);
  12492. $core.addMethod(
  12493. $core.method({
  12494. selector: "withIndexDo:",
  12495. protocol: 'enumerating',
  12496. fn: function (aBlock){
  12497. var self=this;
  12498. return $core.withContext(function($ctx1) {
  12499. self._keysAndValuesDo_((function(key,value){
  12500. return $core.withContext(function($ctx2) {
  12501. return $recv(aBlock)._value_value_(value,key);
  12502. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12503. }));
  12504. return self;
  12505. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12506. },
  12507. args: ["aBlock"],
  12508. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12509. referencedClasses: [],
  12510. messageSends: ["keysAndValuesDo:", "value:value:"]
  12511. }),
  12512. $globals.AssociativeCollection);
  12513. $core.addMethod(
  12514. $core.method({
  12515. selector: "from:",
  12516. protocol: 'instance creation',
  12517. fn: function (aCollection){
  12518. var self=this;
  12519. var newCollection;
  12520. return $core.withContext(function($ctx1) {
  12521. newCollection=self._new();
  12522. $recv(aCollection)._do_((function(each){
  12523. return $core.withContext(function($ctx2) {
  12524. return $recv(newCollection)._add_(each);
  12525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12526. }));
  12527. return newCollection;
  12528. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12529. },
  12530. args: ["aCollection"],
  12531. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12532. referencedClasses: [],
  12533. messageSends: ["new", "do:", "add:"]
  12534. }),
  12535. $globals.AssociativeCollection.klass);
  12536. $core.addMethod(
  12537. $core.method({
  12538. selector: "fromPairs:",
  12539. protocol: 'instance creation',
  12540. fn: function (aCollection){
  12541. var self=this;
  12542. return $core.withContext(function($ctx1) {
  12543. return self._from_(aCollection);
  12544. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12545. },
  12546. args: ["aCollection"],
  12547. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12548. referencedClasses: [],
  12549. messageSends: ["from:"]
  12550. }),
  12551. $globals.AssociativeCollection.klass);
  12552. $core.addMethod(
  12553. $core.method({
  12554. selector: "newFromPairs:",
  12555. protocol: 'instance creation',
  12556. fn: function (aCollection){
  12557. var self=this;
  12558. var newCollection;
  12559. return $core.withContext(function($ctx1) {
  12560. var $2,$1,$3,$4;
  12561. $2=$recv(aCollection)._size();
  12562. $ctx1.sendIdx["size"]=1;
  12563. $1=$recv($2)._even();
  12564. if(!$core.assert($1)){
  12565. self._error_("#newFromPairs only accepts arrays of an even length");
  12566. };
  12567. newCollection=self._new();
  12568. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12569. return $core.withContext(function($ctx2) {
  12570. $3=newCollection;
  12571. $4=$recv(aCollection)._at_(each);
  12572. $ctx2.sendIdx["at:"]=1;
  12573. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12575. }));
  12576. return newCollection;
  12577. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12578. },
  12579. args: ["aCollection"],
  12580. 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",
  12581. referencedClasses: [],
  12582. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12583. }),
  12584. $globals.AssociativeCollection.klass);
  12585. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12586. $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.";
  12587. $core.addMethod(
  12588. $core.method({
  12589. selector: "at:ifAbsent:",
  12590. protocol: 'accessing',
  12591. fn: function (aKey,aBlock){
  12592. var self=this;
  12593. return $core.withContext(function($ctx1) {
  12594. var index = self._positionOfKey_(aKey);
  12595. return index >=0 ? self['@values'][index] : aBlock._value();
  12596. ;
  12597. return self;
  12598. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12599. },
  12600. args: ["aKey", "aBlock"],
  12601. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  12602. referencedClasses: [],
  12603. messageSends: []
  12604. }),
  12605. $globals.Dictionary);
  12606. $core.addMethod(
  12607. $core.method({
  12608. selector: "at:put:",
  12609. protocol: 'accessing',
  12610. fn: function (aKey,aValue){
  12611. var self=this;
  12612. return $core.withContext(function($ctx1) {
  12613. var index = self._positionOfKey_(aKey);
  12614. if(index === -1) {
  12615. var keys = self['@keys'];
  12616. index = keys.length;
  12617. keys.push(aKey);
  12618. }
  12619. return self['@values'][index] = aValue;
  12620. ;
  12621. return self;
  12622. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12623. },
  12624. args: ["aKey", "aValue"],
  12625. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  12626. referencedClasses: [],
  12627. messageSends: []
  12628. }),
  12629. $globals.Dictionary);
  12630. $core.addMethod(
  12631. $core.method({
  12632. selector: "includesKey:",
  12633. protocol: 'testing',
  12634. fn: function (aKey){
  12635. var self=this;
  12636. return $core.withContext(function($ctx1) {
  12637. return self._positionOfKey_(aKey) >= 0; ;
  12638. return self;
  12639. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12640. },
  12641. args: ["aKey"],
  12642. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12643. referencedClasses: [],
  12644. messageSends: []
  12645. }),
  12646. $globals.Dictionary);
  12647. $core.addMethod(
  12648. $core.method({
  12649. selector: "indexOf:ifAbsent:",
  12650. protocol: 'accessing',
  12651. fn: function (anObject,aBlock){
  12652. var self=this;
  12653. var index;
  12654. return $core.withContext(function($ctx1) {
  12655. var $1;
  12656. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12657. return (0);
  12658. }));
  12659. $1=$recv(index).__eq((0));
  12660. if($core.assert($1)){
  12661. return $recv(aBlock)._value();
  12662. } else {
  12663. return $recv(self["@keys"])._at_(index);
  12664. };
  12665. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12666. },
  12667. args: ["anObject", "aBlock"],
  12668. 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 ]",
  12669. referencedClasses: [],
  12670. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12671. }),
  12672. $globals.Dictionary);
  12673. $core.addMethod(
  12674. $core.method({
  12675. selector: "initialize",
  12676. protocol: 'initialization',
  12677. fn: function (){
  12678. var self=this;
  12679. return $core.withContext(function($ctx1) {
  12680. (
  12681. $ctx1.supercall = true,
  12682. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  12683. $ctx1.supercall = false;
  12684. self["@keys"]=[];
  12685. self["@values"]=[];
  12686. return self;
  12687. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12688. },
  12689. args: [],
  12690. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12691. referencedClasses: [],
  12692. messageSends: ["initialize"]
  12693. }),
  12694. $globals.Dictionary);
  12695. $core.addMethod(
  12696. $core.method({
  12697. selector: "keys",
  12698. protocol: 'accessing',
  12699. fn: function (){
  12700. var self=this;
  12701. return $core.withContext(function($ctx1) {
  12702. return $recv(self["@keys"])._copy();
  12703. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12704. },
  12705. args: [],
  12706. source: "keys\x0a\x09^ keys copy",
  12707. referencedClasses: [],
  12708. messageSends: ["copy"]
  12709. }),
  12710. $globals.Dictionary);
  12711. $core.addMethod(
  12712. $core.method({
  12713. selector: "keysAndValuesDo:",
  12714. protocol: 'enumerating',
  12715. fn: function (aBlock){
  12716. var self=this;
  12717. return $core.withContext(function($ctx1) {
  12718. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12719. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12720. },
  12721. args: ["aBlock"],
  12722. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12723. referencedClasses: [],
  12724. messageSends: ["with:do:"]
  12725. }),
  12726. $globals.Dictionary);
  12727. $core.addMethod(
  12728. $core.method({
  12729. selector: "keysDo:",
  12730. protocol: 'enumerating',
  12731. fn: function (aBlock){
  12732. var self=this;
  12733. return $core.withContext(function($ctx1) {
  12734. return $recv(self["@keys"])._do_(aBlock);
  12735. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12736. },
  12737. args: ["aBlock"],
  12738. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12739. referencedClasses: [],
  12740. messageSends: ["do:"]
  12741. }),
  12742. $globals.Dictionary);
  12743. $core.addMethod(
  12744. $core.method({
  12745. selector: "positionOfKey:",
  12746. protocol: 'private',
  12747. fn: function (anObject){
  12748. var self=this;
  12749. return $core.withContext(function($ctx1) {
  12750. var keys = self['@keys'];
  12751. for(var i=0;i<keys.length;i++){
  12752. if(keys[i].__eq(anObject)) { return i;}
  12753. }
  12754. return -1;
  12755. ;
  12756. return self;
  12757. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12758. },
  12759. args: ["anObject"],
  12760. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  12761. referencedClasses: [],
  12762. messageSends: []
  12763. }),
  12764. $globals.Dictionary);
  12765. $core.addMethod(
  12766. $core.method({
  12767. selector: "removeAll",
  12768. protocol: 'adding/removing',
  12769. fn: function (){
  12770. var self=this;
  12771. return $core.withContext(function($ctx1) {
  12772. $recv(self["@keys"])._removeAll();
  12773. $ctx1.sendIdx["removeAll"]=1;
  12774. $recv(self["@values"])._removeAll();
  12775. return self;
  12776. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12777. },
  12778. args: [],
  12779. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12780. referencedClasses: [],
  12781. messageSends: ["removeAll"]
  12782. }),
  12783. $globals.Dictionary);
  12784. $core.addMethod(
  12785. $core.method({
  12786. selector: "removeKey:ifAbsent:",
  12787. protocol: 'adding/removing',
  12788. fn: function (aKey,aBlock){
  12789. var self=this;
  12790. return $core.withContext(function($ctx1) {
  12791. var index = self._positionOfKey_(aKey);
  12792. if(index === -1) {
  12793. return aBlock._value()
  12794. } else {
  12795. var keys = self['@keys'], values = self['@values'];
  12796. var value = values[index], l = keys.length;
  12797. keys[index] = keys[l-1];
  12798. keys.pop();
  12799. values[index] = values[l-1];
  12800. values.pop();
  12801. return value;
  12802. }
  12803. ;
  12804. return self;
  12805. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12806. },
  12807. args: ["aKey", "aBlock"],
  12808. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  12809. referencedClasses: [],
  12810. messageSends: []
  12811. }),
  12812. $globals.Dictionary);
  12813. $core.addMethod(
  12814. $core.method({
  12815. selector: "values",
  12816. protocol: 'accessing',
  12817. fn: function (){
  12818. var self=this;
  12819. return self["@values"];
  12820. },
  12821. args: [],
  12822. source: "values\x0a\x09^ values",
  12823. referencedClasses: [],
  12824. messageSends: []
  12825. }),
  12826. $globals.Dictionary);
  12827. $core.addMethod(
  12828. $core.method({
  12829. selector: "valuesDo:",
  12830. protocol: 'enumerating',
  12831. fn: function (aBlock){
  12832. var self=this;
  12833. return $core.withContext(function($ctx1) {
  12834. return $recv(self["@values"])._do_(aBlock);
  12835. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12836. },
  12837. args: ["aBlock"],
  12838. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12839. referencedClasses: [],
  12840. messageSends: ["do:"]
  12841. }),
  12842. $globals.Dictionary);
  12843. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12844. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12845. $core.addMethod(
  12846. $core.method({
  12847. selector: "at:ifAbsent:",
  12848. protocol: 'accessing',
  12849. fn: function (aKey,aBlock){
  12850. var self=this;
  12851. return $core.withContext(function($ctx1) {
  12852. var $1;
  12853. $1=self._includesKey_(aKey);
  12854. if($core.assert($1)){
  12855. return self._basicAt_(aKey);
  12856. } else {
  12857. return $recv(aBlock)._value();
  12858. };
  12859. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12860. },
  12861. args: ["aKey", "aBlock"],
  12862. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12863. referencedClasses: [],
  12864. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12865. }),
  12866. $globals.HashedCollection);
  12867. $core.addMethod(
  12868. $core.method({
  12869. selector: "at:put:",
  12870. protocol: 'accessing',
  12871. fn: function (aKey,aValue){
  12872. var self=this;
  12873. return $core.withContext(function($ctx1) {
  12874. return self._basicAt_put_(aKey,aValue);
  12875. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12876. },
  12877. args: ["aKey", "aValue"],
  12878. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12879. referencedClasses: [],
  12880. messageSends: ["basicAt:put:"]
  12881. }),
  12882. $globals.HashedCollection);
  12883. $core.addMethod(
  12884. $core.method({
  12885. selector: "includesKey:",
  12886. protocol: 'testing',
  12887. fn: function (aKey){
  12888. var self=this;
  12889. return $core.withContext(function($ctx1) {
  12890. return self.hasOwnProperty(aKey);
  12891. return self;
  12892. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12893. },
  12894. args: ["aKey"],
  12895. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12896. referencedClasses: [],
  12897. messageSends: []
  12898. }),
  12899. $globals.HashedCollection);
  12900. $core.addMethod(
  12901. $core.method({
  12902. selector: "keys",
  12903. protocol: 'accessing',
  12904. fn: function (){
  12905. var self=this;
  12906. return $core.withContext(function($ctx1) {
  12907. return Object.keys(self);
  12908. return self;
  12909. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12910. },
  12911. args: [],
  12912. source: "keys\x0a\x09<return Object.keys(self)>",
  12913. referencedClasses: [],
  12914. messageSends: []
  12915. }),
  12916. $globals.HashedCollection);
  12917. $core.addMethod(
  12918. $core.method({
  12919. selector: "keysDo:",
  12920. protocol: 'enumerating',
  12921. fn: function (aBlock){
  12922. var self=this;
  12923. return $core.withContext(function($ctx1) {
  12924. $recv(self._keys())._do_(aBlock);
  12925. return self;
  12926. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12927. },
  12928. args: ["aBlock"],
  12929. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12930. referencedClasses: [],
  12931. messageSends: ["do:", "keys"]
  12932. }),
  12933. $globals.HashedCollection);
  12934. $core.addMethod(
  12935. $core.method({
  12936. selector: "removeKey:ifAbsent:",
  12937. protocol: 'adding/removing',
  12938. fn: function (aKey,aBlock){
  12939. var self=this;
  12940. return $core.withContext(function($ctx1) {
  12941. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12942. return $core.withContext(function($ctx2) {
  12943. self._basicDelete_(aKey);
  12944. return removed;
  12945. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12946. }),(function(){
  12947. return $core.withContext(function($ctx2) {
  12948. return $recv(aBlock)._value();
  12949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12950. }));
  12951. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12952. },
  12953. args: ["aKey", "aBlock"],
  12954. 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 ]",
  12955. referencedClasses: [],
  12956. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12957. }),
  12958. $globals.HashedCollection);
  12959. $core.addMethod(
  12960. $core.method({
  12961. selector: "values",
  12962. protocol: 'accessing',
  12963. fn: function (){
  12964. var self=this;
  12965. return $core.withContext(function($ctx1) {
  12966. return self._keys().map(function(key){
  12967. return self._at_(key);
  12968. });
  12969. ;
  12970. return self;
  12971. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12972. },
  12973. args: [],
  12974. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12975. referencedClasses: [],
  12976. messageSends: []
  12977. }),
  12978. $globals.HashedCollection);
  12979. $core.addMethod(
  12980. $core.method({
  12981. selector: "valuesDo:",
  12982. protocol: 'enumerating',
  12983. fn: function (aBlock){
  12984. var self=this;
  12985. return $core.withContext(function($ctx1) {
  12986. $recv(self._values())._do_(aBlock);
  12987. return self;
  12988. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12989. },
  12990. args: ["aBlock"],
  12991. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12992. referencedClasses: [],
  12993. messageSends: ["do:", "values"]
  12994. }),
  12995. $globals.HashedCollection);
  12996. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12997. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12998. $core.addMethod(
  12999. $core.method({
  13000. selector: "=",
  13001. protocol: 'comparing',
  13002. fn: function (aCollection){
  13003. var self=this;
  13004. return $core.withContext(function($ctx1) {
  13005. var $3,$2,$4,$1,$5;
  13006. var $early={};
  13007. try {
  13008. $3=self._class();
  13009. $ctx1.sendIdx["class"]=1;
  13010. $2=$recv($3).__eq($recv(aCollection)._class());
  13011. $ctx1.sendIdx["="]=1;
  13012. $1=$recv($2)._and_((function(){
  13013. return $core.withContext(function($ctx2) {
  13014. $4=self._size();
  13015. $ctx2.sendIdx["size"]=1;
  13016. return $recv($4).__eq($recv(aCollection)._size());
  13017. $ctx2.sendIdx["="]=2;
  13018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13019. }));
  13020. if(!$core.assert($1)){
  13021. return false;
  13022. };
  13023. self._withIndexDo_((function(each,i){
  13024. return $core.withContext(function($ctx2) {
  13025. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  13026. if(!$core.assert($5)){
  13027. throw $early=[false];
  13028. };
  13029. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  13030. }));
  13031. return true;
  13032. }
  13033. catch(e) {if(e===$early)return e[0]; throw e}
  13034. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  13035. },
  13036. args: ["aCollection"],
  13037. 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",
  13038. referencedClasses: [],
  13039. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  13040. }),
  13041. $globals.SequenceableCollection);
  13042. $core.addMethod(
  13043. $core.method({
  13044. selector: "addLast:",
  13045. protocol: 'adding/removing',
  13046. fn: function (anObject){
  13047. var self=this;
  13048. return $core.withContext(function($ctx1) {
  13049. self._add_(anObject);
  13050. return self;
  13051. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  13052. },
  13053. args: ["anObject"],
  13054. source: "addLast: anObject\x0a\x09self add: anObject",
  13055. referencedClasses: [],
  13056. messageSends: ["add:"]
  13057. }),
  13058. $globals.SequenceableCollection);
  13059. $core.addMethod(
  13060. $core.method({
  13061. selector: "allButFirst",
  13062. protocol: 'accessing',
  13063. fn: function (){
  13064. var self=this;
  13065. return $core.withContext(function($ctx1) {
  13066. return self._copyFrom_to_((2),self._size());
  13067. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13068. },
  13069. args: [],
  13070. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13071. referencedClasses: [],
  13072. messageSends: ["copyFrom:to:", "size"]
  13073. }),
  13074. $globals.SequenceableCollection);
  13075. $core.addMethod(
  13076. $core.method({
  13077. selector: "allButLast",
  13078. protocol: 'accessing',
  13079. fn: function (){
  13080. var self=this;
  13081. return $core.withContext(function($ctx1) {
  13082. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13083. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13084. },
  13085. args: [],
  13086. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13087. referencedClasses: [],
  13088. messageSends: ["copyFrom:to:", "-", "size"]
  13089. }),
  13090. $globals.SequenceableCollection);
  13091. $core.addMethod(
  13092. $core.method({
  13093. selector: "atRandom",
  13094. protocol: 'accessing',
  13095. fn: function (){
  13096. var self=this;
  13097. return $core.withContext(function($ctx1) {
  13098. return self._at_($recv(self._size())._atRandom());
  13099. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13100. },
  13101. args: [],
  13102. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13103. referencedClasses: [],
  13104. messageSends: ["at:", "atRandom", "size"]
  13105. }),
  13106. $globals.SequenceableCollection);
  13107. $core.addMethod(
  13108. $core.method({
  13109. selector: "beginsWith:",
  13110. protocol: 'testing',
  13111. fn: function (prefix){
  13112. var self=this;
  13113. return $core.withContext(function($ctx1) {
  13114. var $2,$3,$1;
  13115. $2=self._size();
  13116. $ctx1.sendIdx["size"]=1;
  13117. $3=$recv(prefix)._size();
  13118. $ctx1.sendIdx["size"]=2;
  13119. $1=$recv($2).__lt($3);
  13120. if($core.assert($1)){
  13121. return false;
  13122. };
  13123. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13124. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13125. },
  13126. args: ["prefix"],
  13127. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13128. referencedClasses: [],
  13129. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13130. }),
  13131. $globals.SequenceableCollection);
  13132. $core.addMethod(
  13133. $core.method({
  13134. selector: "copyFrom:to:",
  13135. protocol: 'copying',
  13136. fn: function (anIndex,anotherIndex){
  13137. var self=this;
  13138. return $core.withContext(function($ctx1) {
  13139. self._subclassResponsibility();
  13140. return self;
  13141. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13142. },
  13143. args: ["anIndex", "anotherIndex"],
  13144. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13145. referencedClasses: [],
  13146. messageSends: ["subclassResponsibility"]
  13147. }),
  13148. $globals.SequenceableCollection);
  13149. $core.addMethod(
  13150. $core.method({
  13151. selector: "detect:ifNone:",
  13152. protocol: 'enumerating',
  13153. fn: function (aBlock,anotherBlock){
  13154. var self=this;
  13155. return $core.withContext(function($ctx1) {
  13156. self = self._numericallyIndexable();
  13157. for(var i = 0; i < self.length; i++)
  13158. if(aBlock._value_(self[i]))
  13159. return self[i];
  13160. return anotherBlock._value();
  13161. ;
  13162. return self;
  13163. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13164. },
  13165. args: ["aBlock", "anotherBlock"],
  13166. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  13167. referencedClasses: [],
  13168. messageSends: []
  13169. }),
  13170. $globals.SequenceableCollection);
  13171. $core.addMethod(
  13172. $core.method({
  13173. selector: "do:",
  13174. protocol: 'enumerating',
  13175. fn: function (aBlock){
  13176. var self=this;
  13177. return $core.withContext(function($ctx1) {
  13178. self = self._numericallyIndexable();
  13179. for(var i=0; i < self.length; i++) {
  13180. aBlock._value_(self[i]);
  13181. }
  13182. ;
  13183. return self;
  13184. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13185. },
  13186. args: ["aBlock"],
  13187. source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
  13188. referencedClasses: [],
  13189. messageSends: []
  13190. }),
  13191. $globals.SequenceableCollection);
  13192. $core.addMethod(
  13193. $core.method({
  13194. selector: "endsWith:",
  13195. protocol: 'testing',
  13196. fn: function (suffix){
  13197. var self=this;
  13198. return $core.withContext(function($ctx1) {
  13199. var $2,$3,$1;
  13200. $2=self._size();
  13201. $ctx1.sendIdx["size"]=1;
  13202. $3=$recv(suffix)._size();
  13203. $ctx1.sendIdx["size"]=2;
  13204. $1=$recv($2).__lt($3);
  13205. if($core.assert($1)){
  13206. return false;
  13207. };
  13208. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13209. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13210. },
  13211. args: ["suffix"],
  13212. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13213. referencedClasses: [],
  13214. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13215. }),
  13216. $globals.SequenceableCollection);
  13217. $core.addMethod(
  13218. $core.method({
  13219. selector: "first",
  13220. protocol: 'accessing',
  13221. fn: function (){
  13222. var self=this;
  13223. return $core.withContext(function($ctx1) {
  13224. return self._at_((1));
  13225. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13226. },
  13227. args: [],
  13228. source: "first\x0a\x09^ self at: 1",
  13229. referencedClasses: [],
  13230. messageSends: ["at:"]
  13231. }),
  13232. $globals.SequenceableCollection);
  13233. $core.addMethod(
  13234. $core.method({
  13235. selector: "first:",
  13236. protocol: 'accessing',
  13237. fn: function (aNumber){
  13238. var self=this;
  13239. return $core.withContext(function($ctx1) {
  13240. var $1;
  13241. $1=$recv(self._size()).__lt(aNumber);
  13242. if($core.assert($1)){
  13243. self._error_("Invalid number of elements");
  13244. };
  13245. return self._copyFrom_to_((1),aNumber);
  13246. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13247. },
  13248. args: ["aNumber"],
  13249. 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",
  13250. referencedClasses: [],
  13251. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13252. }),
  13253. $globals.SequenceableCollection);
  13254. $core.addMethod(
  13255. $core.method({
  13256. selector: "fourth",
  13257. protocol: 'accessing',
  13258. fn: function (){
  13259. var self=this;
  13260. return $core.withContext(function($ctx1) {
  13261. return self._at_((4));
  13262. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13263. },
  13264. args: [],
  13265. source: "fourth\x0a\x09^ self at: 4",
  13266. referencedClasses: [],
  13267. messageSends: ["at:"]
  13268. }),
  13269. $globals.SequenceableCollection);
  13270. $core.addMethod(
  13271. $core.method({
  13272. selector: "includes:",
  13273. protocol: 'testing',
  13274. fn: function (anObject){
  13275. var self=this;
  13276. return $core.withContext(function($ctx1) {
  13277. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13278. return nil;
  13279. })))._notNil();
  13280. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13281. },
  13282. args: ["anObject"],
  13283. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13284. referencedClasses: [],
  13285. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13286. }),
  13287. $globals.SequenceableCollection);
  13288. $core.addMethod(
  13289. $core.method({
  13290. selector: "indexOf:ifAbsent:",
  13291. protocol: 'accessing',
  13292. fn: function (anObject,aBlock){
  13293. var self=this;
  13294. return $core.withContext(function($ctx1) {
  13295. self = self._numericallyIndexable();
  13296. for(var i=0; i < self.length; i++) {
  13297. if($recv(self[i]).__eq(anObject)) {return i+1}
  13298. };
  13299. return aBlock._value();
  13300. ;
  13301. return self;
  13302. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13303. },
  13304. args: ["anObject", "aBlock"],
  13305. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  13306. referencedClasses: [],
  13307. messageSends: []
  13308. }),
  13309. $globals.SequenceableCollection);
  13310. $core.addMethod(
  13311. $core.method({
  13312. selector: "indexOf:startingAt:",
  13313. protocol: 'accessing',
  13314. fn: function (anObject,start){
  13315. var self=this;
  13316. return $core.withContext(function($ctx1) {
  13317. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13318. return (0);
  13319. }));
  13320. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13321. },
  13322. args: ["anObject", "start"],
  13323. 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 ]",
  13324. referencedClasses: [],
  13325. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13326. }),
  13327. $globals.SequenceableCollection);
  13328. $core.addMethod(
  13329. $core.method({
  13330. selector: "indexOf:startingAt:ifAbsent:",
  13331. protocol: 'accessing',
  13332. fn: function (anObject,start,aBlock){
  13333. var self=this;
  13334. return $core.withContext(function($ctx1) {
  13335. self = self._numericallyIndexable();
  13336. for(var i=start - 1; i < self.length; i++){
  13337. if($recv(self[i]).__eq(anObject)) {return i+1}
  13338. }
  13339. return aBlock._value();
  13340. ;
  13341. return self;
  13342. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13343. },
  13344. args: ["anObject", "start", "aBlock"],
  13345. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  13346. referencedClasses: [],
  13347. messageSends: []
  13348. }),
  13349. $globals.SequenceableCollection);
  13350. $core.addMethod(
  13351. $core.method({
  13352. selector: "last",
  13353. protocol: 'accessing',
  13354. fn: function (){
  13355. var self=this;
  13356. return $core.withContext(function($ctx1) {
  13357. return self._at_(self._size());
  13358. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13359. },
  13360. args: [],
  13361. source: "last\x0a\x09^ self at: self size",
  13362. referencedClasses: [],
  13363. messageSends: ["at:", "size"]
  13364. }),
  13365. $globals.SequenceableCollection);
  13366. $core.addMethod(
  13367. $core.method({
  13368. selector: "last:",
  13369. protocol: 'accessing',
  13370. fn: function (aNumber){
  13371. var self=this;
  13372. return $core.withContext(function($ctx1) {
  13373. var $2,$1,$5,$4,$3;
  13374. $2=self._size();
  13375. $ctx1.sendIdx["size"]=1;
  13376. $1=$recv($2).__lt(aNumber);
  13377. if($core.assert($1)){
  13378. self._error_("Invalid number of elements");
  13379. };
  13380. $5=self._size();
  13381. $ctx1.sendIdx["size"]=2;
  13382. $4=$recv($5).__minus(aNumber);
  13383. $3=$recv($4).__plus((1));
  13384. return self._copyFrom_to_($3,self._size());
  13385. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13386. },
  13387. args: ["aNumber"],
  13388. 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",
  13389. referencedClasses: [],
  13390. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13391. }),
  13392. $globals.SequenceableCollection);
  13393. $core.addMethod(
  13394. $core.method({
  13395. selector: "newStream",
  13396. protocol: 'streaming',
  13397. fn: function (){
  13398. var self=this;
  13399. return $core.withContext(function($ctx1) {
  13400. return $recv(self._streamClass())._on_(self);
  13401. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13402. },
  13403. args: [],
  13404. source: "newStream\x0a\x09^ self streamClass on: self",
  13405. referencedClasses: [],
  13406. messageSends: ["on:", "streamClass"]
  13407. }),
  13408. $globals.SequenceableCollection);
  13409. $core.addMethod(
  13410. $core.method({
  13411. selector: "numericallyIndexable",
  13412. protocol: 'private',
  13413. fn: function (){
  13414. var self=this;
  13415. return $core.withContext(function($ctx1) {
  13416. self._subclassResponsibility();
  13417. return self;
  13418. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13419. },
  13420. args: [],
  13421. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  13422. referencedClasses: [],
  13423. messageSends: ["subclassResponsibility"]
  13424. }),
  13425. $globals.SequenceableCollection);
  13426. $core.addMethod(
  13427. $core.method({
  13428. selector: "readStream",
  13429. protocol: 'streaming',
  13430. fn: function (){
  13431. var self=this;
  13432. return $core.withContext(function($ctx1) {
  13433. return self._stream();
  13434. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13435. },
  13436. args: [],
  13437. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13438. referencedClasses: [],
  13439. messageSends: ["stream"]
  13440. }),
  13441. $globals.SequenceableCollection);
  13442. $core.addMethod(
  13443. $core.method({
  13444. selector: "removeLast",
  13445. protocol: 'adding/removing',
  13446. fn: function (){
  13447. var self=this;
  13448. return $core.withContext(function($ctx1) {
  13449. return self._remove_(self._last());
  13450. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13451. },
  13452. args: [],
  13453. source: "removeLast\x0a\x09^ self remove: self last",
  13454. referencedClasses: [],
  13455. messageSends: ["remove:", "last"]
  13456. }),
  13457. $globals.SequenceableCollection);
  13458. $core.addMethod(
  13459. $core.method({
  13460. selector: "reversed",
  13461. protocol: 'converting',
  13462. fn: function (){
  13463. var self=this;
  13464. return $core.withContext(function($ctx1) {
  13465. self._subclassResponsibility();
  13466. return self;
  13467. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13468. },
  13469. args: [],
  13470. source: "reversed\x0a\x09self subclassResponsibility",
  13471. referencedClasses: [],
  13472. messageSends: ["subclassResponsibility"]
  13473. }),
  13474. $globals.SequenceableCollection);
  13475. $core.addMethod(
  13476. $core.method({
  13477. selector: "second",
  13478. protocol: 'accessing',
  13479. fn: function (){
  13480. var self=this;
  13481. return $core.withContext(function($ctx1) {
  13482. return self._at_((2));
  13483. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13484. },
  13485. args: [],
  13486. source: "second\x0a\x09^ self at: 2",
  13487. referencedClasses: [],
  13488. messageSends: ["at:"]
  13489. }),
  13490. $globals.SequenceableCollection);
  13491. $core.addMethod(
  13492. $core.method({
  13493. selector: "stream",
  13494. protocol: 'streaming',
  13495. fn: function (){
  13496. var self=this;
  13497. return $core.withContext(function($ctx1) {
  13498. return self._newStream();
  13499. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13500. },
  13501. args: [],
  13502. source: "stream\x0a\x09^ self newStream",
  13503. referencedClasses: [],
  13504. messageSends: ["newStream"]
  13505. }),
  13506. $globals.SequenceableCollection);
  13507. $core.addMethod(
  13508. $core.method({
  13509. selector: "streamClass",
  13510. protocol: 'streaming',
  13511. fn: function (){
  13512. var self=this;
  13513. return $core.withContext(function($ctx1) {
  13514. return $recv(self._class())._streamClass();
  13515. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13516. },
  13517. args: [],
  13518. source: "streamClass\x0a\x09^ self class streamClass",
  13519. referencedClasses: [],
  13520. messageSends: ["streamClass", "class"]
  13521. }),
  13522. $globals.SequenceableCollection);
  13523. $core.addMethod(
  13524. $core.method({
  13525. selector: "third",
  13526. protocol: 'accessing',
  13527. fn: function (){
  13528. var self=this;
  13529. return $core.withContext(function($ctx1) {
  13530. return self._at_((3));
  13531. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13532. },
  13533. args: [],
  13534. source: "third\x0a\x09^ self at: 3",
  13535. referencedClasses: [],
  13536. messageSends: ["at:"]
  13537. }),
  13538. $globals.SequenceableCollection);
  13539. $core.addMethod(
  13540. $core.method({
  13541. selector: "with:do:",
  13542. protocol: 'enumerating',
  13543. fn: function (anotherCollection,aBlock){
  13544. var self=this;
  13545. return $core.withContext(function($ctx1) {
  13546. self = self._numericallyIndexable();
  13547. anotherCollection = anotherCollection._numericallyIndexable();
  13548. for(var i=0; i<self.length; i++) {
  13549. aBlock._value_value_(self[i], anotherCollection[i]);
  13550. }
  13551. ;
  13552. return self;
  13553. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13554. },
  13555. args: ["anotherCollection", "aBlock"],
  13556. source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
  13557. referencedClasses: [],
  13558. messageSends: []
  13559. }),
  13560. $globals.SequenceableCollection);
  13561. $core.addMethod(
  13562. $core.method({
  13563. selector: "withIndexDo:",
  13564. protocol: 'enumerating',
  13565. fn: function (aBlock){
  13566. var self=this;
  13567. return $core.withContext(function($ctx1) {
  13568. self = self._numericallyIndexable();
  13569. for(var i=0; i < self.length; i++) {
  13570. aBlock._value_value_(self[i], i+1);
  13571. }
  13572. ;
  13573. return self;
  13574. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13575. },
  13576. args: ["aBlock"],
  13577. source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
  13578. referencedClasses: [],
  13579. messageSends: []
  13580. }),
  13581. $globals.SequenceableCollection);
  13582. $core.addMethod(
  13583. $core.method({
  13584. selector: "writeStream",
  13585. protocol: 'streaming',
  13586. fn: function (){
  13587. var self=this;
  13588. return $core.withContext(function($ctx1) {
  13589. return self._stream();
  13590. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13591. },
  13592. args: [],
  13593. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13594. referencedClasses: [],
  13595. messageSends: ["stream"]
  13596. }),
  13597. $globals.SequenceableCollection);
  13598. $core.addMethod(
  13599. $core.method({
  13600. selector: "streamClass",
  13601. protocol: 'accessing',
  13602. fn: function (){
  13603. var self=this;
  13604. return $globals.Stream;
  13605. },
  13606. args: [],
  13607. source: "streamClass\x0a\x09\x09^ Stream",
  13608. referencedClasses: ["Stream"],
  13609. messageSends: []
  13610. }),
  13611. $globals.SequenceableCollection.klass);
  13612. $core.addMethod(
  13613. $core.method({
  13614. selector: "streamContents:",
  13615. protocol: 'streaming',
  13616. fn: function (aBlock){
  13617. var self=this;
  13618. var stream;
  13619. return $core.withContext(function($ctx1) {
  13620. stream=$recv(self._streamClass())._on_(self._new());
  13621. $recv(aBlock)._value_(stream);
  13622. return $recv(stream)._contents();
  13623. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13624. },
  13625. args: ["aBlock"],
  13626. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13627. referencedClasses: [],
  13628. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13629. }),
  13630. $globals.SequenceableCollection.klass);
  13631. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13632. $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`.";
  13633. $core.addMethod(
  13634. $core.method({
  13635. selector: "add:",
  13636. protocol: 'adding/removing',
  13637. fn: function (anObject){
  13638. var self=this;
  13639. return $core.withContext(function($ctx1) {
  13640. self.push(anObject); return anObject;;
  13641. return self;
  13642. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13643. },
  13644. args: ["anObject"],
  13645. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13646. referencedClasses: [],
  13647. messageSends: []
  13648. }),
  13649. $globals.Array);
  13650. $core.addMethod(
  13651. $core.method({
  13652. selector: "addAll:",
  13653. protocol: 'adding/removing',
  13654. fn: function (aCollection){
  13655. var self=this;
  13656. return $core.withContext(function($ctx1) {
  13657. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13658. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13659. return aCollection;;
  13660. return self;
  13661. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13662. },
  13663. args: ["aCollection"],
  13664. source: "addAll: aCollection\x0a<\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);\x0a\x09return aCollection;\x0a>",
  13665. referencedClasses: [],
  13666. messageSends: []
  13667. }),
  13668. $globals.Array);
  13669. $core.addMethod(
  13670. $core.method({
  13671. selector: "addFirst:",
  13672. protocol: 'adding/removing',
  13673. fn: function (anObject){
  13674. var self=this;
  13675. return $core.withContext(function($ctx1) {
  13676. self.unshift(anObject); return anObject;;
  13677. return self;
  13678. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13679. },
  13680. args: ["anObject"],
  13681. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13682. referencedClasses: [],
  13683. messageSends: []
  13684. }),
  13685. $globals.Array);
  13686. $core.addMethod(
  13687. $core.method({
  13688. selector: "asJavascript",
  13689. protocol: 'converting',
  13690. fn: function (){
  13691. var self=this;
  13692. return $core.withContext(function($ctx1) {
  13693. var $1;
  13694. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13695. return $core.withContext(function($ctx2) {
  13696. return $recv(each)._asJavascript();
  13697. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13698. })))._join_(", "))).__comma("]");
  13699. $ctx1.sendIdx[","]=1;
  13700. return $1;
  13701. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13702. },
  13703. args: [],
  13704. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13705. referencedClasses: [],
  13706. messageSends: [",", "join:", "collect:", "asJavascript"]
  13707. }),
  13708. $globals.Array);
  13709. $core.addMethod(
  13710. $core.method({
  13711. selector: "at:ifAbsent:",
  13712. protocol: 'accessing',
  13713. fn: function (anIndex,aBlock){
  13714. var self=this;
  13715. return $core.withContext(function($ctx1) {
  13716. return anIndex >= 1 && anIndex <= self.length
  13717. ? self[anIndex - 1]
  13718. : aBlock._value()
  13719. ;
  13720. return self;
  13721. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13722. },
  13723. args: ["anIndex", "aBlock"],
  13724. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  13725. referencedClasses: [],
  13726. messageSends: []
  13727. }),
  13728. $globals.Array);
  13729. $core.addMethod(
  13730. $core.method({
  13731. selector: "at:ifPresent:ifAbsent:",
  13732. protocol: 'accessing',
  13733. fn: function (anIndex,aBlock,anotherBlock){
  13734. var self=this;
  13735. return $core.withContext(function($ctx1) {
  13736. return anIndex >= 1 && anIndex <= self.length
  13737. ? aBlock._value_(self[anIndex - 1])
  13738. : anotherBlock._value()
  13739. ;
  13740. return self;
  13741. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13742. },
  13743. args: ["anIndex", "aBlock", "anotherBlock"],
  13744. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
  13745. referencedClasses: [],
  13746. messageSends: []
  13747. }),
  13748. $globals.Array);
  13749. $core.addMethod(
  13750. $core.method({
  13751. selector: "at:put:",
  13752. protocol: 'accessing',
  13753. fn: function (anIndex,anObject){
  13754. var self=this;
  13755. return $core.withContext(function($ctx1) {
  13756. return self[anIndex - 1] = anObject;
  13757. return self;
  13758. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13759. },
  13760. args: ["anIndex", "anObject"],
  13761. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13762. referencedClasses: [],
  13763. messageSends: []
  13764. }),
  13765. $globals.Array);
  13766. $core.addMethod(
  13767. $core.method({
  13768. selector: "collect:",
  13769. protocol: 'enumerating',
  13770. fn: function (aBlock){
  13771. var self=this;
  13772. return $core.withContext(function($ctx1) {
  13773. return self.map(function(each) {return aBlock._value_(each)});
  13774. return self;
  13775. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13776. },
  13777. args: ["aBlock"],
  13778. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13779. referencedClasses: [],
  13780. messageSends: []
  13781. }),
  13782. $globals.Array);
  13783. $core.addMethod(
  13784. $core.method({
  13785. selector: "copyFrom:to:",
  13786. protocol: 'copying',
  13787. fn: function (anIndex,anotherIndex){
  13788. var self=this;
  13789. return $core.withContext(function($ctx1) {
  13790. if (anIndex >= 1 && anotherIndex <= self.length) {
  13791. return self.slice(anIndex - 1, anotherIndex);
  13792. } else {
  13793. self._at_(anIndex);
  13794. self._at_(self.length + 1);
  13795. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13796. };
  13797. return self;
  13798. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13799. },
  13800. args: ["anIndex", "anotherIndex"],
  13801. source: "copyFrom: anIndex to: anotherIndex\x0a<\x0a\x09if (anIndex >>= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a>",
  13802. referencedClasses: [],
  13803. messageSends: []
  13804. }),
  13805. $globals.Array);
  13806. $core.addMethod(
  13807. $core.method({
  13808. selector: "join:",
  13809. protocol: 'enumerating',
  13810. fn: function (aString){
  13811. var self=this;
  13812. return $core.withContext(function($ctx1) {
  13813. return self.join(aString);
  13814. return self;
  13815. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13816. },
  13817. args: ["aString"],
  13818. source: "join: aString\x0a\x09<return self.join(aString)>",
  13819. referencedClasses: [],
  13820. messageSends: []
  13821. }),
  13822. $globals.Array);
  13823. $core.addMethod(
  13824. $core.method({
  13825. selector: "numericallyIndexable",
  13826. protocol: 'private',
  13827. fn: function (){
  13828. var self=this;
  13829. return self;
  13830. },
  13831. args: [],
  13832. source: "numericallyIndexable\x0a\x09^ self",
  13833. referencedClasses: [],
  13834. messageSends: []
  13835. }),
  13836. $globals.Array);
  13837. $core.addMethod(
  13838. $core.method({
  13839. selector: "printOn:",
  13840. protocol: 'printing',
  13841. fn: function (aStream){
  13842. var self=this;
  13843. return $core.withContext(function($ctx1) {
  13844. (
  13845. $ctx1.supercall = true,
  13846. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13847. $ctx1.supercall = false;
  13848. $ctx1.sendIdx["printOn:"]=1;
  13849. $recv(aStream)._nextPutAll_(" (");
  13850. $ctx1.sendIdx["nextPutAll:"]=1;
  13851. self._do_separatedBy_((function(each){
  13852. return $core.withContext(function($ctx2) {
  13853. return $recv(each)._printOn_(aStream);
  13854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13855. }),(function(){
  13856. return $core.withContext(function($ctx2) {
  13857. return $recv(aStream)._nextPutAll_(" ");
  13858. $ctx2.sendIdx["nextPutAll:"]=2;
  13859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13860. }));
  13861. $recv(aStream)._nextPutAll_(")");
  13862. return self;
  13863. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13864. },
  13865. args: ["aStream"],
  13866. 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: ')'",
  13867. referencedClasses: [],
  13868. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13869. }),
  13870. $globals.Array);
  13871. $core.addMethod(
  13872. $core.method({
  13873. selector: "remove:ifAbsent:",
  13874. protocol: 'adding/removing',
  13875. fn: function (anObject,aBlock){
  13876. var self=this;
  13877. var index;
  13878. return $core.withContext(function($ctx1) {
  13879. var $1;
  13880. index=self._indexOf_ifAbsent_(anObject,(function(){
  13881. return (0);
  13882. }));
  13883. $1=$recv(index).__eq((0));
  13884. if($core.assert($1)){
  13885. return $recv(aBlock)._value();
  13886. } else {
  13887. self._removeIndex_(index);
  13888. return anObject;
  13889. };
  13890. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13891. },
  13892. args: ["anObject", "aBlock"],
  13893. 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 ]",
  13894. referencedClasses: [],
  13895. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13896. }),
  13897. $globals.Array);
  13898. $core.addMethod(
  13899. $core.method({
  13900. selector: "removeAll",
  13901. protocol: 'adding/removing',
  13902. fn: function (){
  13903. var self=this;
  13904. return $core.withContext(function($ctx1) {
  13905. self.length = 0;
  13906. return self;
  13907. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13908. },
  13909. args: [],
  13910. source: "removeAll\x0a\x09<self.length = 0>",
  13911. referencedClasses: [],
  13912. messageSends: []
  13913. }),
  13914. $globals.Array);
  13915. $core.addMethod(
  13916. $core.method({
  13917. selector: "removeFrom:to:",
  13918. protocol: 'adding/removing',
  13919. fn: function (aNumber,anotherNumber){
  13920. var self=this;
  13921. return $core.withContext(function($ctx1) {
  13922. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13923. return self;
  13924. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13925. },
  13926. args: ["aNumber", "anotherNumber"],
  13927. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13928. referencedClasses: [],
  13929. messageSends: []
  13930. }),
  13931. $globals.Array);
  13932. $core.addMethod(
  13933. $core.method({
  13934. selector: "removeIndex:",
  13935. protocol: 'adding/removing',
  13936. fn: function (anInteger){
  13937. var self=this;
  13938. return $core.withContext(function($ctx1) {
  13939. self.splice(anInteger - 1, 1);
  13940. return self;
  13941. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13942. },
  13943. args: ["anInteger"],
  13944. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13945. referencedClasses: [],
  13946. messageSends: []
  13947. }),
  13948. $globals.Array);
  13949. $core.addMethod(
  13950. $core.method({
  13951. selector: "removeLast",
  13952. protocol: 'adding/removing',
  13953. fn: function (){
  13954. var self=this;
  13955. return $core.withContext(function($ctx1) {
  13956. return self.pop();;
  13957. return self;
  13958. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13959. },
  13960. args: [],
  13961. source: "removeLast\x0a\x09<return self.pop();>",
  13962. referencedClasses: [],
  13963. messageSends: []
  13964. }),
  13965. $globals.Array);
  13966. $core.addMethod(
  13967. $core.method({
  13968. selector: "reversed",
  13969. protocol: 'converting',
  13970. fn: function (){
  13971. var self=this;
  13972. return $core.withContext(function($ctx1) {
  13973. return self.slice().reverse();
  13974. return self;
  13975. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13976. },
  13977. args: [],
  13978. source: "reversed\x0a\x09<return self.slice().reverse()>",
  13979. referencedClasses: [],
  13980. messageSends: []
  13981. }),
  13982. $globals.Array);
  13983. $core.addMethod(
  13984. $core.method({
  13985. selector: "select:",
  13986. protocol: 'enumerating',
  13987. fn: function (aBlock){
  13988. var self=this;
  13989. return $core.withContext(function($ctx1) {
  13990. return self.filter(function(each) {return aBlock._value_(each)});
  13991. return self;
  13992. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13993. },
  13994. args: ["aBlock"],
  13995. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  13996. referencedClasses: [],
  13997. messageSends: []
  13998. }),
  13999. $globals.Array);
  14000. $core.addMethod(
  14001. $core.method({
  14002. selector: "shallowCopy",
  14003. protocol: 'copying',
  14004. fn: function (){
  14005. var self=this;
  14006. return $core.withContext(function($ctx1) {
  14007. return self.slice();
  14008. return self;
  14009. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  14010. },
  14011. args: [],
  14012. source: "shallowCopy\x0a\x09<return self.slice()>",
  14013. referencedClasses: [],
  14014. messageSends: []
  14015. }),
  14016. $globals.Array);
  14017. $core.addMethod(
  14018. $core.method({
  14019. selector: "size",
  14020. protocol: 'accessing',
  14021. fn: function (){
  14022. var self=this;
  14023. return $core.withContext(function($ctx1) {
  14024. return self.length;
  14025. return self;
  14026. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  14027. },
  14028. args: [],
  14029. source: "size\x0a\x09<return self.length>",
  14030. referencedClasses: [],
  14031. messageSends: []
  14032. }),
  14033. $globals.Array);
  14034. $core.addMethod(
  14035. $core.method({
  14036. selector: "sort",
  14037. protocol: 'enumerating',
  14038. fn: function (){
  14039. var self=this;
  14040. return $core.withContext(function($ctx1) {
  14041. return self._sort_((function(a,b){
  14042. return $core.withContext(function($ctx2) {
  14043. return $recv(a).__lt(b);
  14044. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14045. }));
  14046. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14047. },
  14048. args: [],
  14049. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14050. referencedClasses: [],
  14051. messageSends: ["sort:", "<"]
  14052. }),
  14053. $globals.Array);
  14054. $core.addMethod(
  14055. $core.method({
  14056. selector: "sort:",
  14057. protocol: 'enumerating',
  14058. fn: function (aBlock){
  14059. var self=this;
  14060. return $core.withContext(function($ctx1) {
  14061. return self.sort(function(a, b) {
  14062. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14063. })
  14064. ;
  14065. return self;
  14066. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14067. },
  14068. args: ["aBlock"],
  14069. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  14070. referencedClasses: [],
  14071. messageSends: []
  14072. }),
  14073. $globals.Array);
  14074. $core.addMethod(
  14075. $core.method({
  14076. selector: "sorted",
  14077. protocol: 'enumerating',
  14078. fn: function (){
  14079. var self=this;
  14080. return $core.withContext(function($ctx1) {
  14081. return $recv(self._copy())._sort();
  14082. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14083. },
  14084. args: [],
  14085. source: "sorted\x0a\x09^ self copy sort",
  14086. referencedClasses: [],
  14087. messageSends: ["sort", "copy"]
  14088. }),
  14089. $globals.Array);
  14090. $core.addMethod(
  14091. $core.method({
  14092. selector: "sorted:",
  14093. protocol: 'enumerating',
  14094. fn: function (aBlock){
  14095. var self=this;
  14096. return $core.withContext(function($ctx1) {
  14097. return $recv(self._copy())._sort_(aBlock);
  14098. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14099. },
  14100. args: ["aBlock"],
  14101. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14102. referencedClasses: [],
  14103. messageSends: ["sort:", "copy"]
  14104. }),
  14105. $globals.Array);
  14106. $core.addMethod(
  14107. $core.method({
  14108. selector: "new:",
  14109. protocol: 'instance creation',
  14110. fn: function (anInteger){
  14111. var self=this;
  14112. return $core.withContext(function($ctx1) {
  14113. return new Array(anInteger);
  14114. return self;
  14115. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14116. },
  14117. args: ["anInteger"],
  14118. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  14119. referencedClasses: [],
  14120. messageSends: []
  14121. }),
  14122. $globals.Array.klass);
  14123. $core.addMethod(
  14124. $core.method({
  14125. selector: "with:",
  14126. protocol: 'instance creation',
  14127. fn: function (anObject){
  14128. var self=this;
  14129. return $core.withContext(function($ctx1) {
  14130. var $1;
  14131. $1=self._new_((1));
  14132. $recv($1)._at_put_((1),anObject);
  14133. return $recv($1)._yourself();
  14134. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14135. },
  14136. args: ["anObject"],
  14137. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14138. referencedClasses: [],
  14139. messageSends: ["at:put:", "new:", "yourself"]
  14140. }),
  14141. $globals.Array.klass);
  14142. $core.addMethod(
  14143. $core.method({
  14144. selector: "with:with:",
  14145. protocol: 'instance creation',
  14146. fn: function (anObject,anObject2){
  14147. var self=this;
  14148. return $core.withContext(function($ctx1) {
  14149. var $1;
  14150. $1=self._new_((2));
  14151. $recv($1)._at_put_((1),anObject);
  14152. $ctx1.sendIdx["at:put:"]=1;
  14153. $recv($1)._at_put_((2),anObject2);
  14154. return $recv($1)._yourself();
  14155. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14156. },
  14157. args: ["anObject", "anObject2"],
  14158. 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",
  14159. referencedClasses: [],
  14160. messageSends: ["at:put:", "new:", "yourself"]
  14161. }),
  14162. $globals.Array.klass);
  14163. $core.addMethod(
  14164. $core.method({
  14165. selector: "with:with:with:",
  14166. protocol: 'instance creation',
  14167. fn: function (anObject,anObject2,anObject3){
  14168. var self=this;
  14169. return $core.withContext(function($ctx1) {
  14170. var $1;
  14171. $1=self._new_((3));
  14172. $recv($1)._at_put_((1),anObject);
  14173. $ctx1.sendIdx["at:put:"]=1;
  14174. $recv($1)._at_put_((2),anObject2);
  14175. $ctx1.sendIdx["at:put:"]=2;
  14176. $recv($1)._at_put_((3),anObject3);
  14177. return $recv($1)._yourself();
  14178. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14179. },
  14180. args: ["anObject", "anObject2", "anObject3"],
  14181. 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",
  14182. referencedClasses: [],
  14183. messageSends: ["at:put:", "new:", "yourself"]
  14184. }),
  14185. $globals.Array.klass);
  14186. $core.addMethod(
  14187. $core.method({
  14188. selector: "withAll:",
  14189. protocol: 'instance creation',
  14190. fn: function (aCollection){
  14191. var self=this;
  14192. var instance,index;
  14193. return $core.withContext(function($ctx1) {
  14194. index=(1);
  14195. instance=self._new_($recv(aCollection)._size());
  14196. $recv(aCollection)._do_((function(each){
  14197. return $core.withContext(function($ctx2) {
  14198. $recv(instance)._at_put_(index,each);
  14199. index=$recv(index).__plus((1));
  14200. return index;
  14201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14202. }));
  14203. return instance;
  14204. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14205. },
  14206. args: ["aCollection"],
  14207. 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",
  14208. referencedClasses: [],
  14209. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14210. }),
  14211. $globals.Array.klass);
  14212. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14213. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14214. $core.addMethod(
  14215. $core.method({
  14216. selector: ",",
  14217. protocol: 'copying',
  14218. fn: function (aString){
  14219. var self=this;
  14220. return $core.withContext(function($ctx1) {
  14221. var $1;
  14222. $1=self._asString();
  14223. $ctx1.sendIdx["asString"]=1;
  14224. return $recv($1).__comma($recv(aString)._asString());
  14225. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14226. },
  14227. args: ["aString"],
  14228. source: ", aString\x0a\x09^ self asString, aString asString",
  14229. referencedClasses: [],
  14230. messageSends: [",", "asString"]
  14231. }),
  14232. $globals.CharacterArray);
  14233. $core.addMethod(
  14234. $core.method({
  14235. selector: "add:",
  14236. protocol: 'adding/removing',
  14237. fn: function (anObject){
  14238. var self=this;
  14239. return $core.withContext(function($ctx1) {
  14240. self._errorReadOnly();
  14241. return self;
  14242. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14243. },
  14244. args: ["anObject"],
  14245. source: "add: anObject\x0a\x09self errorReadOnly",
  14246. referencedClasses: [],
  14247. messageSends: ["errorReadOnly"]
  14248. }),
  14249. $globals.CharacterArray);
  14250. $core.addMethod(
  14251. $core.method({
  14252. selector: "asLowercase",
  14253. protocol: 'converting',
  14254. fn: function (){
  14255. var self=this;
  14256. return $core.withContext(function($ctx1) {
  14257. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14258. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14259. },
  14260. args: [],
  14261. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14262. referencedClasses: [],
  14263. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14264. }),
  14265. $globals.CharacterArray);
  14266. $core.addMethod(
  14267. $core.method({
  14268. selector: "asNumber",
  14269. protocol: 'converting',
  14270. fn: function (){
  14271. var self=this;
  14272. return $core.withContext(function($ctx1) {
  14273. return $recv(self._asString())._asNumber();
  14274. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14275. },
  14276. args: [],
  14277. source: "asNumber\x0a\x09^ self asString asNumber",
  14278. referencedClasses: [],
  14279. messageSends: ["asNumber", "asString"]
  14280. }),
  14281. $globals.CharacterArray);
  14282. $core.addMethod(
  14283. $core.method({
  14284. selector: "asString",
  14285. protocol: 'converting',
  14286. fn: function (){
  14287. var self=this;
  14288. return $core.withContext(function($ctx1) {
  14289. return self._subclassResponsibility();
  14290. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14291. },
  14292. args: [],
  14293. source: "asString\x0a\x09^ self subclassResponsibility",
  14294. referencedClasses: [],
  14295. messageSends: ["subclassResponsibility"]
  14296. }),
  14297. $globals.CharacterArray);
  14298. $core.addMethod(
  14299. $core.method({
  14300. selector: "asSymbol",
  14301. protocol: 'converting',
  14302. fn: function (){
  14303. var self=this;
  14304. return $core.withContext(function($ctx1) {
  14305. return self._asString();
  14306. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14307. },
  14308. args: [],
  14309. source: "asSymbol\x0a\x09^ self asString",
  14310. referencedClasses: [],
  14311. messageSends: ["asString"]
  14312. }),
  14313. $globals.CharacterArray);
  14314. $core.addMethod(
  14315. $core.method({
  14316. selector: "asUppercase",
  14317. protocol: 'converting',
  14318. fn: function (){
  14319. var self=this;
  14320. return $core.withContext(function($ctx1) {
  14321. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14322. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14323. },
  14324. args: [],
  14325. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14326. referencedClasses: [],
  14327. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14328. }),
  14329. $globals.CharacterArray);
  14330. $core.addMethod(
  14331. $core.method({
  14332. selector: "at:put:",
  14333. protocol: 'accessing',
  14334. fn: function (anIndex,anObject){
  14335. var self=this;
  14336. return $core.withContext(function($ctx1) {
  14337. self._errorReadOnly();
  14338. return self;
  14339. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14340. },
  14341. args: ["anIndex", "anObject"],
  14342. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14343. referencedClasses: [],
  14344. messageSends: ["errorReadOnly"]
  14345. }),
  14346. $globals.CharacterArray);
  14347. $core.addMethod(
  14348. $core.method({
  14349. selector: "errorReadOnly",
  14350. protocol: 'error handling',
  14351. fn: function (){
  14352. var self=this;
  14353. return $core.withContext(function($ctx1) {
  14354. self._error_("Object is read-only");
  14355. return self;
  14356. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14357. },
  14358. args: [],
  14359. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14360. referencedClasses: [],
  14361. messageSends: ["error:"]
  14362. }),
  14363. $globals.CharacterArray);
  14364. $core.addMethod(
  14365. $core.method({
  14366. selector: "printOn:",
  14367. protocol: 'printing',
  14368. fn: function (aStream){
  14369. var self=this;
  14370. return $core.withContext(function($ctx1) {
  14371. $recv(self._asString())._printOn_(aStream);
  14372. return self;
  14373. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14374. },
  14375. args: ["aStream"],
  14376. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14377. referencedClasses: [],
  14378. messageSends: ["printOn:", "asString"]
  14379. }),
  14380. $globals.CharacterArray);
  14381. $core.addMethod(
  14382. $core.method({
  14383. selector: "putOn:",
  14384. protocol: 'streaming',
  14385. fn: function (aStream){
  14386. var self=this;
  14387. return $core.withContext(function($ctx1) {
  14388. $recv(aStream)._nextPutString_(self);
  14389. return self;
  14390. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14391. },
  14392. args: ["aStream"],
  14393. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14394. referencedClasses: [],
  14395. messageSends: ["nextPutString:"]
  14396. }),
  14397. $globals.CharacterArray);
  14398. $core.addMethod(
  14399. $core.method({
  14400. selector: "remove:",
  14401. protocol: 'adding/removing',
  14402. fn: function (anObject){
  14403. var self=this;
  14404. return $core.withContext(function($ctx1) {
  14405. self._errorReadOnly();
  14406. return self;
  14407. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14408. },
  14409. args: ["anObject"],
  14410. source: "remove: anObject\x0a\x09self errorReadOnly",
  14411. referencedClasses: [],
  14412. messageSends: ["errorReadOnly"]
  14413. }),
  14414. $globals.CharacterArray);
  14415. $core.addMethod(
  14416. $core.method({
  14417. selector: "fromString:",
  14418. protocol: 'instance creation',
  14419. fn: function (aString){
  14420. var self=this;
  14421. return $core.withContext(function($ctx1) {
  14422. self._subclassResponsibility();
  14423. return self;
  14424. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14425. },
  14426. args: ["aString"],
  14427. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14428. referencedClasses: [],
  14429. messageSends: ["subclassResponsibility"]
  14430. }),
  14431. $globals.CharacterArray.klass);
  14432. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14433. $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 >> #,`";
  14434. $core.addMethod(
  14435. $core.method({
  14436. selector: ",",
  14437. protocol: 'copying',
  14438. fn: function (aString){
  14439. var self=this;
  14440. return $core.withContext(function($ctx1) {
  14441. return String(self) + aString;
  14442. return self;
  14443. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14444. },
  14445. args: ["aString"],
  14446. source: ", aString\x0a\x09<return String(self) + aString>",
  14447. referencedClasses: [],
  14448. messageSends: []
  14449. }),
  14450. $globals.String);
  14451. $core.addMethod(
  14452. $core.method({
  14453. selector: "<",
  14454. protocol: 'comparing',
  14455. fn: function (aString){
  14456. var self=this;
  14457. return $core.withContext(function($ctx1) {
  14458. return String(self) < aString._asString();
  14459. return self;
  14460. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14461. },
  14462. args: ["aString"],
  14463. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14464. referencedClasses: [],
  14465. messageSends: []
  14466. }),
  14467. $globals.String);
  14468. $core.addMethod(
  14469. $core.method({
  14470. selector: "<=",
  14471. protocol: 'comparing',
  14472. fn: function (aString){
  14473. var self=this;
  14474. return $core.withContext(function($ctx1) {
  14475. return String(self) <= aString._asString();
  14476. return self;
  14477. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14478. },
  14479. args: ["aString"],
  14480. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14481. referencedClasses: [],
  14482. messageSends: []
  14483. }),
  14484. $globals.String);
  14485. $core.addMethod(
  14486. $core.method({
  14487. selector: "=",
  14488. protocol: 'comparing',
  14489. fn: function (aString){
  14490. var self=this;
  14491. return $core.withContext(function($ctx1) {
  14492. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14493. return self;
  14494. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14495. },
  14496. args: ["aString"],
  14497. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14498. referencedClasses: [],
  14499. messageSends: []
  14500. }),
  14501. $globals.String);
  14502. $core.addMethod(
  14503. $core.method({
  14504. selector: "==",
  14505. protocol: 'comparing',
  14506. fn: function (aString){
  14507. var self=this;
  14508. return $core.withContext(function($ctx1) {
  14509. if (typeof aString === "string") return String(self) === aString;
  14510. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14511. else return false;;
  14512. return self;
  14513. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14514. },
  14515. args: ["aString"],
  14516. source: "== aString\x0a<\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a>",
  14517. referencedClasses: [],
  14518. messageSends: []
  14519. }),
  14520. $globals.String);
  14521. $core.addMethod(
  14522. $core.method({
  14523. selector: ">",
  14524. protocol: 'comparing',
  14525. fn: function (aString){
  14526. var self=this;
  14527. return $core.withContext(function($ctx1) {
  14528. return String(self) > aString._asString();
  14529. return self;
  14530. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14531. },
  14532. args: ["aString"],
  14533. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14534. referencedClasses: [],
  14535. messageSends: []
  14536. }),
  14537. $globals.String);
  14538. $core.addMethod(
  14539. $core.method({
  14540. selector: ">=",
  14541. protocol: 'comparing',
  14542. fn: function (aString){
  14543. var self=this;
  14544. return $core.withContext(function($ctx1) {
  14545. return String(self) >= aString._asString();
  14546. return self;
  14547. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14548. },
  14549. args: ["aString"],
  14550. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14551. referencedClasses: [],
  14552. messageSends: []
  14553. }),
  14554. $globals.String);
  14555. $core.addMethod(
  14556. $core.method({
  14557. selector: "asJSON",
  14558. protocol: 'converting',
  14559. fn: function (){
  14560. var self=this;
  14561. return self;
  14562. },
  14563. args: [],
  14564. source: "asJSON\x0a\x09^ self",
  14565. referencedClasses: [],
  14566. messageSends: []
  14567. }),
  14568. $globals.String);
  14569. $core.addMethod(
  14570. $core.method({
  14571. selector: "asJavaScriptMethodName",
  14572. protocol: 'converting',
  14573. fn: function (){
  14574. var self=this;
  14575. return $core.withContext(function($ctx1) {
  14576. return $core.st2js(self);
  14577. return self;
  14578. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14579. },
  14580. args: [],
  14581. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14582. referencedClasses: [],
  14583. messageSends: []
  14584. }),
  14585. $globals.String);
  14586. $core.addMethod(
  14587. $core.method({
  14588. selector: "asJavascript",
  14589. protocol: 'converting',
  14590. fn: function (){
  14591. var self=this;
  14592. return $core.withContext(function($ctx1) {
  14593. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14594. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14595. else
  14596. return "\"" + self + "\"";
  14597. ;
  14598. return self;
  14599. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14600. },
  14601. args: [],
  14602. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  14603. referencedClasses: [],
  14604. messageSends: []
  14605. }),
  14606. $globals.String);
  14607. $core.addMethod(
  14608. $core.method({
  14609. selector: "asLowercase",
  14610. protocol: 'converting',
  14611. fn: function (){
  14612. var self=this;
  14613. return $core.withContext(function($ctx1) {
  14614. return self.toLowerCase();
  14615. return self;
  14616. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14617. },
  14618. args: [],
  14619. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14620. referencedClasses: [],
  14621. messageSends: []
  14622. }),
  14623. $globals.String);
  14624. $core.addMethod(
  14625. $core.method({
  14626. selector: "asMutator",
  14627. protocol: 'converting',
  14628. fn: function (){
  14629. var self=this;
  14630. return $core.withContext(function($ctx1) {
  14631. var $1;
  14632. $1=$recv(self._last()).__eq(":");
  14633. if(!$core.assert($1)){
  14634. return self.__comma(":");
  14635. };
  14636. return self;
  14637. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14638. },
  14639. args: [],
  14640. 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",
  14641. referencedClasses: [],
  14642. messageSends: ["ifFalse:", "=", "last", ","]
  14643. }),
  14644. $globals.String);
  14645. $core.addMethod(
  14646. $core.method({
  14647. selector: "asNumber",
  14648. protocol: 'converting',
  14649. fn: function (){
  14650. var self=this;
  14651. return $core.withContext(function($ctx1) {
  14652. return Number(self);
  14653. return self;
  14654. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14655. },
  14656. args: [],
  14657. source: "asNumber\x0a\x09<return Number(self)>",
  14658. referencedClasses: [],
  14659. messageSends: []
  14660. }),
  14661. $globals.String);
  14662. $core.addMethod(
  14663. $core.method({
  14664. selector: "asRegexp",
  14665. protocol: 'converting',
  14666. fn: function (){
  14667. var self=this;
  14668. return $core.withContext(function($ctx1) {
  14669. return $recv($globals.RegularExpression)._fromString_(self);
  14670. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14671. },
  14672. args: [],
  14673. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14674. referencedClasses: ["RegularExpression"],
  14675. messageSends: ["fromString:"]
  14676. }),
  14677. $globals.String);
  14678. $core.addMethod(
  14679. $core.method({
  14680. selector: "asString",
  14681. protocol: 'converting',
  14682. fn: function (){
  14683. var self=this;
  14684. return self;
  14685. },
  14686. args: [],
  14687. source: "asString\x0a\x09^ self",
  14688. referencedClasses: [],
  14689. messageSends: []
  14690. }),
  14691. $globals.String);
  14692. $core.addMethod(
  14693. $core.method({
  14694. selector: "asSymbol",
  14695. protocol: 'converting',
  14696. fn: function (){
  14697. var self=this;
  14698. return self;
  14699. },
  14700. args: [],
  14701. source: "asSymbol\x0a\x09^ self",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.String);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "asUppercase",
  14709. protocol: 'converting',
  14710. fn: function (){
  14711. var self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. return self.toUpperCase();
  14714. return self;
  14715. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14716. },
  14717. args: [],
  14718. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14719. referencedClasses: [],
  14720. messageSends: []
  14721. }),
  14722. $globals.String);
  14723. $core.addMethod(
  14724. $core.method({
  14725. selector: "asciiValue",
  14726. protocol: 'accessing',
  14727. fn: function (){
  14728. var self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. return self.charCodeAt(0);;
  14731. return self;
  14732. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14733. },
  14734. args: [],
  14735. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14736. referencedClasses: [],
  14737. messageSends: []
  14738. }),
  14739. $globals.String);
  14740. $core.addMethod(
  14741. $core.method({
  14742. selector: "at:ifAbsent:",
  14743. protocol: 'accessing',
  14744. fn: function (anIndex,aBlock){
  14745. var self=this;
  14746. return $core.withContext(function($ctx1) {
  14747. return String(self)[anIndex - 1] || aBlock._value();
  14748. return self;
  14749. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14750. },
  14751. args: ["anIndex", "aBlock"],
  14752. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14753. referencedClasses: [],
  14754. messageSends: []
  14755. }),
  14756. $globals.String);
  14757. $core.addMethod(
  14758. $core.method({
  14759. selector: "at:ifPresent:ifAbsent:",
  14760. protocol: 'accessing',
  14761. fn: function (anIndex,aBlock,anotherBlock){
  14762. var self=this;
  14763. return $core.withContext(function($ctx1) {
  14764. var result = String(self)[anIndex - 1];
  14765. return result ? aBlock._value_(result) : anotherBlock._value();
  14766. ;
  14767. return self;
  14768. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14769. },
  14770. args: ["anIndex", "aBlock", "anotherBlock"],
  14771. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  14772. referencedClasses: [],
  14773. messageSends: []
  14774. }),
  14775. $globals.String);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "capitalized",
  14779. protocol: 'converting',
  14780. fn: function (){
  14781. var self=this;
  14782. return $core.withContext(function($ctx1) {
  14783. var $1;
  14784. $1=self._isEmpty();
  14785. if($core.assert($1)){
  14786. return self;
  14787. } else {
  14788. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14789. };
  14790. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14791. },
  14792. args: [],
  14793. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14794. referencedClasses: [],
  14795. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14796. }),
  14797. $globals.String);
  14798. $core.addMethod(
  14799. $core.method({
  14800. selector: "charCodeAt:",
  14801. protocol: 'accessing',
  14802. fn: function (anInteger){
  14803. var self=this;
  14804. return $core.withContext(function($ctx1) {
  14805. return self.charCodeAt(anInteger - 1);
  14806. return self;
  14807. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14808. },
  14809. args: ["anInteger"],
  14810. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14811. referencedClasses: [],
  14812. messageSends: []
  14813. }),
  14814. $globals.String);
  14815. $core.addMethod(
  14816. $core.method({
  14817. selector: "copyFrom:to:",
  14818. protocol: 'copying',
  14819. fn: function (anIndex,anotherIndex){
  14820. var self=this;
  14821. return $core.withContext(function($ctx1) {
  14822. return self.substring(anIndex - 1, anotherIndex);
  14823. return self;
  14824. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14825. },
  14826. args: ["anIndex", "anotherIndex"],
  14827. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14828. referencedClasses: [],
  14829. messageSends: []
  14830. }),
  14831. $globals.String);
  14832. $core.addMethod(
  14833. $core.method({
  14834. selector: "crlfSanitized",
  14835. protocol: 'converting',
  14836. fn: function (){
  14837. var self=this;
  14838. return $core.withContext(function($ctx1) {
  14839. return $recv(self._lines())._join_($recv($globals.String)._lf());
  14840. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14841. },
  14842. args: [],
  14843. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14844. referencedClasses: ["String"],
  14845. messageSends: ["join:", "lines", "lf"]
  14846. }),
  14847. $globals.String);
  14848. $core.addMethod(
  14849. $core.method({
  14850. selector: "deepCopy",
  14851. protocol: 'copying',
  14852. fn: function (){
  14853. var self=this;
  14854. return $core.withContext(function($ctx1) {
  14855. return self._shallowCopy();
  14856. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14857. },
  14858. args: [],
  14859. source: "deepCopy\x0a\x09^ self shallowCopy",
  14860. referencedClasses: [],
  14861. messageSends: ["shallowCopy"]
  14862. }),
  14863. $globals.String);
  14864. $core.addMethod(
  14865. $core.method({
  14866. selector: "escaped",
  14867. protocol: 'converting',
  14868. fn: function (){
  14869. var self=this;
  14870. return $core.withContext(function($ctx1) {
  14871. return escape(self);
  14872. return self;
  14873. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14874. },
  14875. args: [],
  14876. source: "escaped\x0a\x09<return escape(self)>",
  14877. referencedClasses: [],
  14878. messageSends: []
  14879. }),
  14880. $globals.String);
  14881. $core.addMethod(
  14882. $core.method({
  14883. selector: "includesSubString:",
  14884. protocol: 'testing',
  14885. fn: function (subString){
  14886. var self=this;
  14887. return $core.withContext(function($ctx1) {
  14888. return self.indexOf(subString) != -1;
  14889. return self;
  14890. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14891. },
  14892. args: ["subString"],
  14893. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14894. referencedClasses: [],
  14895. messageSends: []
  14896. }),
  14897. $globals.String);
  14898. $core.addMethod(
  14899. $core.method({
  14900. selector: "isCapitalized",
  14901. protocol: 'testing',
  14902. fn: function (){
  14903. var self=this;
  14904. return $core.withContext(function($ctx1) {
  14905. var $2,$1;
  14906. $2=self._first();
  14907. $ctx1.sendIdx["first"]=1;
  14908. $1=$recv($2)._asUppercase();
  14909. return $recv($1).__eq_eq(self._first());
  14910. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14911. },
  14912. args: [],
  14913. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14914. referencedClasses: [],
  14915. messageSends: ["==", "asUppercase", "first"]
  14916. }),
  14917. $globals.String);
  14918. $core.addMethod(
  14919. $core.method({
  14920. selector: "isImmutable",
  14921. protocol: 'testing',
  14922. fn: function (){
  14923. var self=this;
  14924. return true;
  14925. },
  14926. args: [],
  14927. source: "isImmutable\x0a\x09^ true",
  14928. referencedClasses: [],
  14929. messageSends: []
  14930. }),
  14931. $globals.String);
  14932. $core.addMethod(
  14933. $core.method({
  14934. selector: "isString",
  14935. protocol: 'testing',
  14936. fn: function (){
  14937. var self=this;
  14938. return true;
  14939. },
  14940. args: [],
  14941. source: "isString\x0a\x09^ true",
  14942. referencedClasses: [],
  14943. messageSends: []
  14944. }),
  14945. $globals.String);
  14946. $core.addMethod(
  14947. $core.method({
  14948. selector: "isVowel",
  14949. protocol: 'testing',
  14950. fn: function (){
  14951. var self=this;
  14952. return $core.withContext(function($ctx1) {
  14953. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14954. return $core.withContext(function($ctx2) {
  14955. return "aeiou"._includes_(self._asLowercase());
  14956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14957. }));
  14958. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14959. },
  14960. args: [],
  14961. 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 ]",
  14962. referencedClasses: [],
  14963. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14964. }),
  14965. $globals.String);
  14966. $core.addMethod(
  14967. $core.method({
  14968. selector: "join:",
  14969. protocol: 'split join',
  14970. fn: function (aCollection){
  14971. var self=this;
  14972. return $core.withContext(function($ctx1) {
  14973. return $recv($globals.String)._streamContents_((function(stream){
  14974. return $core.withContext(function($ctx2) {
  14975. return $recv(aCollection)._do_separatedBy_((function(each){
  14976. return $core.withContext(function($ctx3) {
  14977. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14978. $ctx3.sendIdx["nextPutAll:"]=1;
  14979. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14980. }),(function(){
  14981. return $core.withContext(function($ctx3) {
  14982. return $recv(stream)._nextPutAll_(self);
  14983. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14984. }));
  14985. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14986. }));
  14987. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14988. },
  14989. args: ["aCollection"],
  14990. 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 ]]",
  14991. referencedClasses: ["String"],
  14992. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14993. }),
  14994. $globals.String);
  14995. $core.addMethod(
  14996. $core.method({
  14997. selector: "lineIndicesDo:",
  14998. protocol: 'split join',
  14999. fn: function (aBlock){
  15000. var self=this;
  15001. var cr,lf,start,sz,nextLF,nextCR;
  15002. return $core.withContext(function($ctx1) {
  15003. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  15004. var $early={};
  15005. try {
  15006. start=(1);
  15007. sz=self._size();
  15008. cr=$recv($globals.String)._cr();
  15009. nextCR=self._indexOf_startingAt_(cr,(1));
  15010. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  15011. lf=$recv($globals.String)._lf();
  15012. nextLF=self._indexOf_startingAt_(lf,(1));
  15013. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  15014. $recv((function(){
  15015. return $core.withContext(function($ctx2) {
  15016. return $recv(start).__lt_eq(sz);
  15017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15018. }))._whileTrue_((function(){
  15019. return $core.withContext(function($ctx2) {
  15020. $2=$recv(nextLF).__eq((0));
  15021. $ctx2.sendIdx["="]=1;
  15022. $1=$recv($2)._and_((function(){
  15023. return $core.withContext(function($ctx3) {
  15024. return $recv(nextCR).__eq((0));
  15025. $ctx3.sendIdx["="]=2;
  15026. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  15027. }));
  15028. $ctx2.sendIdx["and:"]=1;
  15029. if($core.assert($1)){
  15030. $recv(aBlock)._value_value_value_(start,sz,sz);
  15031. $ctx2.sendIdx["value:value:value:"]=1;
  15032. throw $early=[self];
  15033. };
  15034. $4=$recv(nextCR).__eq((0));
  15035. $ctx2.sendIdx["="]=3;
  15036. $3=$recv($4)._or_((function(){
  15037. return $core.withContext(function($ctx3) {
  15038. $5=(0).__lt(nextLF);
  15039. $ctx3.sendIdx["<"]=1;
  15040. return $recv($5)._and_((function(){
  15041. return $core.withContext(function($ctx4) {
  15042. return $recv(nextLF).__lt(nextCR);
  15043. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15044. }));
  15045. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15046. }));
  15047. if($core.assert($3)){
  15048. $6=start;
  15049. $7=$recv(nextLF).__minus((1));
  15050. $ctx2.sendIdx["-"]=1;
  15051. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15052. $ctx2.sendIdx["value:value:value:"]=2;
  15053. start=(1).__plus(nextLF);
  15054. $ctx2.sendIdx["+"]=1;
  15055. start;
  15056. nextLF=self._indexOf_startingAt_(lf,start);
  15057. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15058. return nextLF;
  15059. } else {
  15060. $9=(1).__plus(nextCR);
  15061. $ctx2.sendIdx["+"]=2;
  15062. $8=$recv($9).__eq(nextLF);
  15063. if($core.assert($8)){
  15064. $10=start;
  15065. $11=$recv(nextCR).__minus((1));
  15066. $ctx2.sendIdx["-"]=2;
  15067. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15068. $ctx2.sendIdx["value:value:value:"]=3;
  15069. start=(1).__plus(nextLF);
  15070. $ctx2.sendIdx["+"]=3;
  15071. start;
  15072. nextCR=self._indexOf_startingAt_(cr,start);
  15073. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15074. nextCR;
  15075. nextLF=self._indexOf_startingAt_(lf,start);
  15076. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15077. return nextLF;
  15078. } else {
  15079. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15080. start=(1).__plus(nextCR);
  15081. start;
  15082. nextCR=self._indexOf_startingAt_(cr,start);
  15083. return nextCR;
  15084. };
  15085. };
  15086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15087. }));
  15088. return self;
  15089. }
  15090. catch(e) {if(e===$early)return e[0]; throw e}
  15091. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15092. },
  15093. args: ["aBlock"],
  15094. 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 ] ]]",
  15095. referencedClasses: ["String"],
  15096. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15097. }),
  15098. $globals.String);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "lineNumber:",
  15102. protocol: 'split join',
  15103. fn: function (anIndex){
  15104. var self=this;
  15105. var lineCount;
  15106. return $core.withContext(function($ctx1) {
  15107. var $2,$1;
  15108. var $early={};
  15109. try {
  15110. lineCount=(0);
  15111. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15112. return $core.withContext(function($ctx2) {
  15113. lineCount=$recv(lineCount).__plus((1));
  15114. $2=lineCount;
  15115. $1=$recv($2).__eq(anIndex);
  15116. if($core.assert($1)){
  15117. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15118. };
  15119. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15120. }));
  15121. return nil;
  15122. }
  15123. catch(e) {if(e===$early)return e[0]; throw e}
  15124. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15125. },
  15126. args: ["anIndex"],
  15127. 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",
  15128. referencedClasses: [],
  15129. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15130. }),
  15131. $globals.String);
  15132. $core.addMethod(
  15133. $core.method({
  15134. selector: "lines",
  15135. protocol: 'split join',
  15136. fn: function (){
  15137. var self=this;
  15138. return $core.withContext(function($ctx1) {
  15139. var result = self.split(/\r\n|\r|\n/);
  15140. if (!result[result.length-1]) result.pop();
  15141. return result;;
  15142. return self;
  15143. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15144. },
  15145. args: [],
  15146. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  15147. referencedClasses: [],
  15148. messageSends: []
  15149. }),
  15150. $globals.String);
  15151. $core.addMethod(
  15152. $core.method({
  15153. selector: "linesDo:",
  15154. protocol: 'split join',
  15155. fn: function (aBlock){
  15156. var self=this;
  15157. return $core.withContext(function($ctx1) {
  15158. $recv(self._lines())._do_(aBlock);
  15159. return self;
  15160. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15161. },
  15162. args: ["aBlock"],
  15163. 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",
  15164. referencedClasses: [],
  15165. messageSends: ["do:", "lines"]
  15166. }),
  15167. $globals.String);
  15168. $core.addMethod(
  15169. $core.method({
  15170. selector: "match:",
  15171. protocol: 'regular expressions',
  15172. fn: function (aRegexp){
  15173. var self=this;
  15174. return $core.withContext(function($ctx1) {
  15175. return self.search(aRegexp) != -1;
  15176. return self;
  15177. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15178. },
  15179. args: ["aRegexp"],
  15180. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15181. referencedClasses: [],
  15182. messageSends: []
  15183. }),
  15184. $globals.String);
  15185. $core.addMethod(
  15186. $core.method({
  15187. selector: "matchesOf:",
  15188. protocol: 'regular expressions',
  15189. fn: function (aRegularExpression){
  15190. var self=this;
  15191. return $core.withContext(function($ctx1) {
  15192. return self.match(aRegularExpression);
  15193. return self;
  15194. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15195. },
  15196. args: ["aRegularExpression"],
  15197. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15198. referencedClasses: [],
  15199. messageSends: []
  15200. }),
  15201. $globals.String);
  15202. $core.addMethod(
  15203. $core.method({
  15204. selector: "numericallyIndexable",
  15205. protocol: 'private',
  15206. fn: function (){
  15207. var self=this;
  15208. return $core.withContext(function($ctx1) {
  15209. return String(self);
  15210. return self;
  15211. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15212. },
  15213. args: [],
  15214. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15215. referencedClasses: [],
  15216. messageSends: []
  15217. }),
  15218. $globals.String);
  15219. $core.addMethod(
  15220. $core.method({
  15221. selector: "printNl",
  15222. protocol: 'printing',
  15223. fn: function (){
  15224. var self=this;
  15225. return $core.withContext(function($ctx1) {
  15226. console.log(self);
  15227. return self;
  15228. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15229. },
  15230. args: [],
  15231. source: "printNl\x0a\x09<console.log(self)>",
  15232. referencedClasses: [],
  15233. messageSends: []
  15234. }),
  15235. $globals.String);
  15236. $core.addMethod(
  15237. $core.method({
  15238. selector: "printOn:",
  15239. protocol: 'printing',
  15240. fn: function (aStream){
  15241. var self=this;
  15242. return $core.withContext(function($ctx1) {
  15243. $recv(aStream)._nextPutAll_("'");
  15244. $ctx1.sendIdx["nextPutAll:"]=1;
  15245. $recv(aStream)._nextPutAll_(self);
  15246. $ctx1.sendIdx["nextPutAll:"]=2;
  15247. $recv(aStream)._nextPutAll_("'");
  15248. return self;
  15249. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15250. },
  15251. args: ["aStream"],
  15252. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15253. referencedClasses: [],
  15254. messageSends: ["nextPutAll:"]
  15255. }),
  15256. $globals.String);
  15257. $core.addMethod(
  15258. $core.method({
  15259. selector: "replace:with:",
  15260. protocol: 'regular expressions',
  15261. fn: function (aString,anotherString){
  15262. var self=this;
  15263. return $core.withContext(function($ctx1) {
  15264. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15265. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15266. },
  15267. args: ["aString", "anotherString"],
  15268. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15269. referencedClasses: ["RegularExpression"],
  15270. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15271. }),
  15272. $globals.String);
  15273. $core.addMethod(
  15274. $core.method({
  15275. selector: "replaceRegexp:with:",
  15276. protocol: 'regular expressions',
  15277. fn: function (aRegexp,aString){
  15278. var self=this;
  15279. return $core.withContext(function($ctx1) {
  15280. return self.replace(aRegexp, aString);
  15281. return self;
  15282. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15283. },
  15284. args: ["aRegexp", "aString"],
  15285. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15286. referencedClasses: [],
  15287. messageSends: []
  15288. }),
  15289. $globals.String);
  15290. $core.addMethod(
  15291. $core.method({
  15292. selector: "reversed",
  15293. protocol: 'converting',
  15294. fn: function (){
  15295. var self=this;
  15296. return $core.withContext(function($ctx1) {
  15297. return self.split("").reverse().join("");
  15298. return self;
  15299. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15300. },
  15301. args: [],
  15302. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15303. referencedClasses: [],
  15304. messageSends: []
  15305. }),
  15306. $globals.String);
  15307. $core.addMethod(
  15308. $core.method({
  15309. selector: "shallowCopy",
  15310. protocol: 'copying',
  15311. fn: function (){
  15312. var self=this;
  15313. return self;
  15314. },
  15315. args: [],
  15316. source: "shallowCopy\x0a\x09^ self",
  15317. referencedClasses: [],
  15318. messageSends: []
  15319. }),
  15320. $globals.String);
  15321. $core.addMethod(
  15322. $core.method({
  15323. selector: "size",
  15324. protocol: 'accessing',
  15325. fn: function (){
  15326. var self=this;
  15327. return $core.withContext(function($ctx1) {
  15328. return self.length;
  15329. return self;
  15330. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15331. },
  15332. args: [],
  15333. source: "size\x0a\x09<return self.length>",
  15334. referencedClasses: [],
  15335. messageSends: []
  15336. }),
  15337. $globals.String);
  15338. $core.addMethod(
  15339. $core.method({
  15340. selector: "subStrings:",
  15341. protocol: 'split join',
  15342. fn: function (aString){
  15343. var self=this;
  15344. return $core.withContext(function($ctx1) {
  15345. return self._tokenize_(aString);
  15346. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15347. },
  15348. args: ["aString"],
  15349. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15350. referencedClasses: [],
  15351. messageSends: ["tokenize:"]
  15352. }),
  15353. $globals.String);
  15354. $core.addMethod(
  15355. $core.method({
  15356. selector: "tokenize:",
  15357. protocol: 'split join',
  15358. fn: function (aString){
  15359. var self=this;
  15360. return $core.withContext(function($ctx1) {
  15361. return self.split(aString);
  15362. return self;
  15363. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15364. },
  15365. args: ["aString"],
  15366. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15367. referencedClasses: [],
  15368. messageSends: []
  15369. }),
  15370. $globals.String);
  15371. $core.addMethod(
  15372. $core.method({
  15373. selector: "trimBoth",
  15374. protocol: 'regular expressions',
  15375. fn: function (){
  15376. var self=this;
  15377. return $core.withContext(function($ctx1) {
  15378. return self._trimBoth_("\x5cs");
  15379. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15380. },
  15381. args: [],
  15382. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15383. referencedClasses: [],
  15384. messageSends: ["trimBoth:"]
  15385. }),
  15386. $globals.String);
  15387. $core.addMethod(
  15388. $core.method({
  15389. selector: "trimBoth:",
  15390. protocol: 'regular expressions',
  15391. fn: function (separators){
  15392. var self=this;
  15393. return $core.withContext(function($ctx1) {
  15394. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15395. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15396. },
  15397. args: ["separators"],
  15398. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15399. referencedClasses: [],
  15400. messageSends: ["trimRight:", "trimLeft:"]
  15401. }),
  15402. $globals.String);
  15403. $core.addMethod(
  15404. $core.method({
  15405. selector: "trimLeft",
  15406. protocol: 'regular expressions',
  15407. fn: function (){
  15408. var self=this;
  15409. return $core.withContext(function($ctx1) {
  15410. return self._trimLeft_("\x5cs");
  15411. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15412. },
  15413. args: [],
  15414. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15415. referencedClasses: [],
  15416. messageSends: ["trimLeft:"]
  15417. }),
  15418. $globals.String);
  15419. $core.addMethod(
  15420. $core.method({
  15421. selector: "trimLeft:",
  15422. protocol: 'regular expressions',
  15423. fn: function (separators){
  15424. var self=this;
  15425. return $core.withContext(function($ctx1) {
  15426. var $2,$1;
  15427. $2=$recv("^[".__comma(separators)).__comma("]+");
  15428. $ctx1.sendIdx[","]=1;
  15429. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15430. return self._replaceRegexp_with_($1,"");
  15431. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15432. },
  15433. args: ["separators"],
  15434. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15435. referencedClasses: ["RegularExpression"],
  15436. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15437. }),
  15438. $globals.String);
  15439. $core.addMethod(
  15440. $core.method({
  15441. selector: "trimRight",
  15442. protocol: 'regular expressions',
  15443. fn: function (){
  15444. var self=this;
  15445. return $core.withContext(function($ctx1) {
  15446. return self._trimRight_("\x5cs");
  15447. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15448. },
  15449. args: [],
  15450. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15451. referencedClasses: [],
  15452. messageSends: ["trimRight:"]
  15453. }),
  15454. $globals.String);
  15455. $core.addMethod(
  15456. $core.method({
  15457. selector: "trimRight:",
  15458. protocol: 'regular expressions',
  15459. fn: function (separators){
  15460. var self=this;
  15461. return $core.withContext(function($ctx1) {
  15462. var $2,$1;
  15463. $2=$recv("[".__comma(separators)).__comma("]+$");
  15464. $ctx1.sendIdx[","]=1;
  15465. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15466. return self._replaceRegexp_with_($1,"");
  15467. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15468. },
  15469. args: ["separators"],
  15470. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15471. referencedClasses: ["RegularExpression"],
  15472. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15473. }),
  15474. $globals.String);
  15475. $core.addMethod(
  15476. $core.method({
  15477. selector: "unescaped",
  15478. protocol: 'converting',
  15479. fn: function (){
  15480. var self=this;
  15481. return $core.withContext(function($ctx1) {
  15482. return unescape(self);
  15483. return self;
  15484. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15485. },
  15486. args: [],
  15487. source: "unescaped\x0a\x09<return unescape(self)>",
  15488. referencedClasses: [],
  15489. messageSends: []
  15490. }),
  15491. $globals.String);
  15492. $core.addMethod(
  15493. $core.method({
  15494. selector: "uriComponentDecoded",
  15495. protocol: 'converting',
  15496. fn: function (){
  15497. var self=this;
  15498. return $core.withContext(function($ctx1) {
  15499. return decodeURIComponent(self);
  15500. return self;
  15501. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15502. },
  15503. args: [],
  15504. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15505. referencedClasses: [],
  15506. messageSends: []
  15507. }),
  15508. $globals.String);
  15509. $core.addMethod(
  15510. $core.method({
  15511. selector: "uriComponentEncoded",
  15512. protocol: 'converting',
  15513. fn: function (){
  15514. var self=this;
  15515. return $core.withContext(function($ctx1) {
  15516. return encodeURIComponent(self);
  15517. return self;
  15518. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15519. },
  15520. args: [],
  15521. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15522. referencedClasses: [],
  15523. messageSends: []
  15524. }),
  15525. $globals.String);
  15526. $core.addMethod(
  15527. $core.method({
  15528. selector: "uriDecoded",
  15529. protocol: 'converting',
  15530. fn: function (){
  15531. var self=this;
  15532. return $core.withContext(function($ctx1) {
  15533. return decodeURI(self);
  15534. return self;
  15535. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15536. },
  15537. args: [],
  15538. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15539. referencedClasses: [],
  15540. messageSends: []
  15541. }),
  15542. $globals.String);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "uriEncoded",
  15546. protocol: 'converting',
  15547. fn: function (){
  15548. var self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. return encodeURI(self);
  15551. return self;
  15552. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15553. },
  15554. args: [],
  15555. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15556. referencedClasses: [],
  15557. messageSends: []
  15558. }),
  15559. $globals.String);
  15560. $core.addMethod(
  15561. $core.method({
  15562. selector: "value:",
  15563. protocol: 'evaluating',
  15564. fn: function (anObject){
  15565. var self=this;
  15566. return $core.withContext(function($ctx1) {
  15567. return $recv(anObject)._perform_(self);
  15568. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15569. },
  15570. args: ["anObject"],
  15571. source: "value: anObject \x0a\x09^ anObject perform: self",
  15572. referencedClasses: [],
  15573. messageSends: ["perform:"]
  15574. }),
  15575. $globals.String);
  15576. $core.addMethod(
  15577. $core.method({
  15578. selector: "cr",
  15579. protocol: 'accessing',
  15580. fn: function (){
  15581. var self=this;
  15582. return $core.withContext(function($ctx1) {
  15583. return '\r';
  15584. return self;
  15585. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15586. },
  15587. args: [],
  15588. source: "cr\x0a\x09<return '\x5cr'>",
  15589. referencedClasses: [],
  15590. messageSends: []
  15591. }),
  15592. $globals.String.klass);
  15593. $core.addMethod(
  15594. $core.method({
  15595. selector: "crlf",
  15596. protocol: 'accessing',
  15597. fn: function (){
  15598. var self=this;
  15599. return $core.withContext(function($ctx1) {
  15600. return '\r\n';
  15601. return self;
  15602. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15603. },
  15604. args: [],
  15605. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15606. referencedClasses: [],
  15607. messageSends: []
  15608. }),
  15609. $globals.String.klass);
  15610. $core.addMethod(
  15611. $core.method({
  15612. selector: "esc",
  15613. protocol: 'accessing',
  15614. fn: function (){
  15615. var self=this;
  15616. return $core.withContext(function($ctx1) {
  15617. return self._fromCharCode_((27));
  15618. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15619. },
  15620. args: [],
  15621. source: "esc\x0a\x09^ self fromCharCode: 27",
  15622. referencedClasses: [],
  15623. messageSends: ["fromCharCode:"]
  15624. }),
  15625. $globals.String.klass);
  15626. $core.addMethod(
  15627. $core.method({
  15628. selector: "fromCharCode:",
  15629. protocol: 'instance creation',
  15630. fn: function (anInteger){
  15631. var self=this;
  15632. return $core.withContext(function($ctx1) {
  15633. return String.fromCharCode(anInteger);
  15634. return self;
  15635. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15636. },
  15637. args: ["anInteger"],
  15638. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15639. referencedClasses: [],
  15640. messageSends: []
  15641. }),
  15642. $globals.String.klass);
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "fromString:",
  15646. protocol: 'instance creation',
  15647. fn: function (aString){
  15648. var self=this;
  15649. return $core.withContext(function($ctx1) {
  15650. return String(aString);
  15651. return self;
  15652. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15653. },
  15654. args: ["aString"],
  15655. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15656. referencedClasses: [],
  15657. messageSends: []
  15658. }),
  15659. $globals.String.klass);
  15660. $core.addMethod(
  15661. $core.method({
  15662. selector: "lf",
  15663. protocol: 'accessing',
  15664. fn: function (){
  15665. var self=this;
  15666. return $core.withContext(function($ctx1) {
  15667. return '\n';
  15668. return self;
  15669. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15670. },
  15671. args: [],
  15672. source: "lf\x0a\x09<return '\x5cn'>",
  15673. referencedClasses: [],
  15674. messageSends: []
  15675. }),
  15676. $globals.String.klass);
  15677. $core.addMethod(
  15678. $core.method({
  15679. selector: "random",
  15680. protocol: 'random',
  15681. fn: function (){
  15682. var self=this;
  15683. return $core.withContext(function($ctx1) {
  15684. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15685. return self;
  15686. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15687. },
  15688. args: [],
  15689. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  15690. referencedClasses: [],
  15691. messageSends: []
  15692. }),
  15693. $globals.String.klass);
  15694. $core.addMethod(
  15695. $core.method({
  15696. selector: "randomNotIn:",
  15697. protocol: 'random',
  15698. fn: function (aString){
  15699. var self=this;
  15700. var result;
  15701. return $core.withContext(function($ctx1) {
  15702. $recv((function(){
  15703. return $core.withContext(function($ctx2) {
  15704. result=self._random();
  15705. result;
  15706. return $recv(aString)._includesSubString_(result);
  15707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15708. }))._whileTrue();
  15709. return result;
  15710. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15711. },
  15712. args: ["aString"],
  15713. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15714. referencedClasses: [],
  15715. messageSends: ["whileTrue", "random", "includesSubString:"]
  15716. }),
  15717. $globals.String.klass);
  15718. $core.addMethod(
  15719. $core.method({
  15720. selector: "space",
  15721. protocol: 'accessing',
  15722. fn: function (){
  15723. var self=this;
  15724. return $core.withContext(function($ctx1) {
  15725. return ' ';
  15726. return self;
  15727. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15728. },
  15729. args: [],
  15730. source: "space\x0a\x09<return ' '>",
  15731. referencedClasses: [],
  15732. messageSends: []
  15733. }),
  15734. $globals.String.klass);
  15735. $core.addMethod(
  15736. $core.method({
  15737. selector: "streamClass",
  15738. protocol: 'accessing',
  15739. fn: function (){
  15740. var self=this;
  15741. return $globals.StringStream;
  15742. },
  15743. args: [],
  15744. source: "streamClass\x0a\x09\x09^ StringStream",
  15745. referencedClasses: ["StringStream"],
  15746. messageSends: []
  15747. }),
  15748. $globals.String.klass);
  15749. $core.addMethod(
  15750. $core.method({
  15751. selector: "tab",
  15752. protocol: 'accessing',
  15753. fn: function (){
  15754. var self=this;
  15755. return $core.withContext(function($ctx1) {
  15756. return '\t';
  15757. return self;
  15758. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15759. },
  15760. args: [],
  15761. source: "tab\x0a\x09<return '\x5ct'>",
  15762. referencedClasses: [],
  15763. messageSends: []
  15764. }),
  15765. $globals.String.klass);
  15766. $core.addMethod(
  15767. $core.method({
  15768. selector: "value:",
  15769. protocol: 'instance creation',
  15770. fn: function (aUTFCharCode){
  15771. var self=this;
  15772. return $core.withContext(function($ctx1) {
  15773. return String.fromCharCode(aUTFCharCode);;
  15774. return self;
  15775. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15776. },
  15777. args: ["aUTFCharCode"],
  15778. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15779. referencedClasses: [],
  15780. messageSends: []
  15781. }),
  15782. $globals.String.klass);
  15783. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15784. $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`.";
  15785. $core.addMethod(
  15786. $core.method({
  15787. selector: "=",
  15788. protocol: 'comparing',
  15789. fn: function (aCollection){
  15790. var self=this;
  15791. return $core.withContext(function($ctx1) {
  15792. var $2,$1,$4,$3,$5;
  15793. var $early={};
  15794. try {
  15795. $2=self._class();
  15796. $ctx1.sendIdx["class"]=1;
  15797. $1=$recv($2).__eq($recv(aCollection)._class());
  15798. $ctx1.sendIdx["="]=1;
  15799. if(!$core.assert($1)){
  15800. return false;
  15801. };
  15802. $4=self._size();
  15803. $ctx1.sendIdx["size"]=1;
  15804. $3=$recv($4).__eq($recv(aCollection)._size());
  15805. if(!$core.assert($3)){
  15806. return false;
  15807. };
  15808. self._do_((function(each){
  15809. return $core.withContext(function($ctx2) {
  15810. $5=$recv(aCollection)._includes_(each);
  15811. if(!$core.assert($5)){
  15812. throw $early=[false];
  15813. };
  15814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15815. }));
  15816. return true;
  15817. }
  15818. catch(e) {if(e===$early)return e[0]; throw e}
  15819. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15820. },
  15821. args: ["aCollection"],
  15822. 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",
  15823. referencedClasses: [],
  15824. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15825. }),
  15826. $globals.Set);
  15827. $core.addMethod(
  15828. $core.method({
  15829. selector: "add:",
  15830. protocol: 'adding/removing',
  15831. fn: function (anObject){
  15832. var self=this;
  15833. var bucket;
  15834. return $core.withContext(function($ctx1) {
  15835. var $1,$receiver;
  15836. bucket=self._bucketsOfElement_(anObject);
  15837. $1=$recv(bucket)._second();
  15838. if(($receiver = $1) == null || $receiver.isNil){
  15839. var object,slowBucket;
  15840. object=$recv(bucket)._first();
  15841. $ctx1.sendIdx["first"]=1;
  15842. object;
  15843. slowBucket=$recv(bucket)._third();
  15844. slowBucket;
  15845. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15846. return $core.withContext(function($ctx2) {
  15847. $recv(slowBucket)._add_(object);
  15848. self["@size"]=$recv(self["@size"]).__plus((1));
  15849. return self["@size"];
  15850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15851. }));
  15852. return object;
  15853. } else {
  15854. var primitiveBucket;
  15855. primitiveBucket=$receiver;
  15856. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15857. };
  15858. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15859. },
  15860. args: ["anObject"],
  15861. 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 ]",
  15862. referencedClasses: [],
  15863. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15864. }),
  15865. $globals.Set);
  15866. $core.addMethod(
  15867. $core.method({
  15868. selector: "add:in:",
  15869. protocol: 'private',
  15870. fn: function (anObject,anotherObject){
  15871. var self=this;
  15872. return $core.withContext(function($ctx1) {
  15873. if (anObject in anotherObject.store) { return false; }
  15874. self['@size']++;
  15875. anotherObject.store[anObject] = true;
  15876. return anObject;
  15877. ;
  15878. return self;
  15879. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15880. },
  15881. args: ["anObject", "anotherObject"],
  15882. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09>",
  15883. referencedClasses: [],
  15884. messageSends: []
  15885. }),
  15886. $globals.Set);
  15887. $core.addMethod(
  15888. $core.method({
  15889. selector: "bucketsOfElement:",
  15890. protocol: 'private',
  15891. fn: function (anObject){
  15892. var self=this;
  15893. return $core.withContext(function($ctx1) {
  15894. // include nil to well-known objects under 'boolean' fastBucket
  15895. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15896. var prim = anObject.valueOf();
  15897. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15898. var bucket = null;
  15899. self['@slowBucketStores'].some(function (store) {
  15900. return bucket = store._bucketOfElement_(anObject);
  15901. });
  15902. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15903. }
  15904. return [ prim, self['@fastBuckets'][typeof prim] ];
  15905. ;
  15906. return self;
  15907. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15908. },
  15909. args: ["anObject"],
  15910. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !self['@fastBuckets'][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][typeof prim] ];\x0a\x09>",
  15911. referencedClasses: [],
  15912. messageSends: []
  15913. }),
  15914. $globals.Set);
  15915. $core.addMethod(
  15916. $core.method({
  15917. selector: "classNameOf:",
  15918. protocol: 'private',
  15919. fn: function (anObject){
  15920. var self=this;
  15921. return $core.withContext(function($ctx1) {
  15922. return anObject.klass != null && anObject.klass.className;
  15923. return self;
  15924. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15925. },
  15926. args: ["anObject"],
  15927. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass != null && anObject.klass.className>",
  15928. referencedClasses: [],
  15929. messageSends: []
  15930. }),
  15931. $globals.Set);
  15932. $core.addMethod(
  15933. $core.method({
  15934. selector: "collect:",
  15935. protocol: 'enumerating',
  15936. fn: function (aBlock){
  15937. var self=this;
  15938. var collection;
  15939. return $core.withContext(function($ctx1) {
  15940. collection=$recv(self._class())._new();
  15941. self._do_((function(each){
  15942. return $core.withContext(function($ctx2) {
  15943. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15945. }));
  15946. return collection;
  15947. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15948. },
  15949. args: ["aBlock"],
  15950. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15951. referencedClasses: [],
  15952. messageSends: ["new", "class", "do:", "add:", "value:"]
  15953. }),
  15954. $globals.Set);
  15955. $core.addMethod(
  15956. $core.method({
  15957. selector: "detect:ifNone:",
  15958. protocol: 'enumerating',
  15959. fn: function (aBlock,anotherBlock){
  15960. var self=this;
  15961. return $core.withContext(function($ctx1) {
  15962. var $1;
  15963. var $early={};
  15964. try {
  15965. self._do_((function(each){
  15966. return $core.withContext(function($ctx2) {
  15967. $1=$recv(aBlock)._value_(each);
  15968. if($core.assert($1)){
  15969. throw $early=[each];
  15970. };
  15971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15972. }));
  15973. return $recv(anotherBlock)._value();
  15974. }
  15975. catch(e) {if(e===$early)return e[0]; throw e}
  15976. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15977. },
  15978. args: ["aBlock", "anotherBlock"],
  15979. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15980. referencedClasses: [],
  15981. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15982. }),
  15983. $globals.Set);
  15984. $core.addMethod(
  15985. $core.method({
  15986. selector: "do:",
  15987. protocol: 'enumerating',
  15988. fn: function (aBlock){
  15989. var self=this;
  15990. return $core.withContext(function($ctx1) {
  15991. var el, keys, i;
  15992. el = self['@fastBuckets'];
  15993. keys = Object.keys(el);
  15994. for (i = 0; i < keys.length; ++i) {
  15995. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15996. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15997. else { store._do_(aBlock); }
  15998. }
  15999. el = self['@slowBucketStores'];
  16000. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  16001. self['@defaultBucket']._do_(aBlock);
  16002. ;
  16003. return self;
  16004. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  16005. },
  16006. args: ["aBlock"],
  16007. source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
  16008. referencedClasses: [],
  16009. messageSends: []
  16010. }),
  16011. $globals.Set);
  16012. $core.addMethod(
  16013. $core.method({
  16014. selector: "includes:",
  16015. protocol: 'testing',
  16016. fn: function (anObject){
  16017. var self=this;
  16018. var bucket;
  16019. return $core.withContext(function($ctx1) {
  16020. var $1,$2,$3,$receiver;
  16021. bucket=self._bucketsOfElement_(anObject);
  16022. $1=$recv(bucket)._second();
  16023. if(($receiver = $1) == null || $receiver.isNil){
  16024. $2=$recv(bucket)._third();
  16025. $3=$recv(bucket)._first();
  16026. $ctx1.sendIdx["first"]=1;
  16027. return $recv($2)._includes_($3);
  16028. } else {
  16029. var primitiveBucket;
  16030. primitiveBucket=$receiver;
  16031. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  16032. };
  16033. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16034. },
  16035. args: ["anObject"],
  16036. 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 ]",
  16037. referencedClasses: [],
  16038. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16039. }),
  16040. $globals.Set);
  16041. $core.addMethod(
  16042. $core.method({
  16043. selector: "includes:in:",
  16044. protocol: 'private',
  16045. fn: function (anObject,anotherObject){
  16046. var self=this;
  16047. return $core.withContext(function($ctx1) {
  16048. return anObject in anotherObject.store;
  16049. return self;
  16050. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16051. },
  16052. args: ["anObject", "anotherObject"],
  16053. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16054. referencedClasses: [],
  16055. messageSends: []
  16056. }),
  16057. $globals.Set);
  16058. $core.addMethod(
  16059. $core.method({
  16060. selector: "initialize",
  16061. protocol: 'initialization',
  16062. fn: function (){
  16063. var self=this;
  16064. return $core.withContext(function($ctx1) {
  16065. (
  16066. $ctx1.supercall = true,
  16067. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16068. $ctx1.supercall = false;
  16069. self["@defaultBucket"]=[];
  16070. self._initializeSlowBucketStores();
  16071. self._removeAll();
  16072. return self;
  16073. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16074. },
  16075. args: [],
  16076. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16077. referencedClasses: [],
  16078. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16079. }),
  16080. $globals.Set);
  16081. $core.addMethod(
  16082. $core.method({
  16083. selector: "initializeSlowBucketStores",
  16084. protocol: 'initialization',
  16085. fn: function (){
  16086. var self=this;
  16087. return $core.withContext(function($ctx1) {
  16088. var $1;
  16089. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16090. return $core.withContext(function($ctx2) {
  16091. return self._classNameOf_(x);
  16092. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16093. }));
  16094. $ctx1.sendIdx["hashBlock:"]=1;
  16095. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16096. return $core.withContext(function($ctx2) {
  16097. return self._jsConstructorNameOf_(x);
  16098. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16099. }))];
  16100. return self;
  16101. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16102. },
  16103. args: [],
  16104. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16105. referencedClasses: ["ArrayBucketStore"],
  16106. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16107. }),
  16108. $globals.Set);
  16109. $core.addMethod(
  16110. $core.method({
  16111. selector: "jsConstructorNameOf:",
  16112. protocol: 'private',
  16113. fn: function (anObject){
  16114. var self=this;
  16115. return $core.withContext(function($ctx1) {
  16116. return anObject.constructor && anObject.constructor.name;
  16117. return self;
  16118. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16119. },
  16120. args: ["anObject"],
  16121. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16122. referencedClasses: [],
  16123. messageSends: []
  16124. }),
  16125. $globals.Set);
  16126. $core.addMethod(
  16127. $core.method({
  16128. selector: "printOn:",
  16129. protocol: 'printing',
  16130. fn: function (aStream){
  16131. var self=this;
  16132. return $core.withContext(function($ctx1) {
  16133. (
  16134. $ctx1.supercall = true,
  16135. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16136. $ctx1.supercall = false;
  16137. $ctx1.sendIdx["printOn:"]=1;
  16138. $recv(aStream)._nextPutAll_(" (");
  16139. $ctx1.sendIdx["nextPutAll:"]=1;
  16140. self._do_separatedBy_((function(each){
  16141. return $core.withContext(function($ctx2) {
  16142. return $recv(each)._printOn_(aStream);
  16143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16144. }),(function(){
  16145. return $core.withContext(function($ctx2) {
  16146. return $recv(aStream)._nextPutAll_(" ");
  16147. $ctx2.sendIdx["nextPutAll:"]=2;
  16148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16149. }));
  16150. $recv(aStream)._nextPutAll_(")");
  16151. return self;
  16152. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16153. },
  16154. args: ["aStream"],
  16155. 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: ')'",
  16156. referencedClasses: [],
  16157. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16158. }),
  16159. $globals.Set);
  16160. $core.addMethod(
  16161. $core.method({
  16162. selector: "remove:ifAbsent:",
  16163. protocol: 'adding/removing',
  16164. fn: function (anObject,aBlock){
  16165. var self=this;
  16166. var bucket;
  16167. return $core.withContext(function($ctx1) {
  16168. var $1,$2,$3,$receiver;
  16169. var $early={};
  16170. try {
  16171. bucket=self._bucketsOfElement_(anObject);
  16172. $1=$recv(bucket)._second();
  16173. if(($receiver = $1) == null || $receiver.isNil){
  16174. $2=$recv(bucket)._third();
  16175. $3=$recv(bucket)._first();
  16176. $ctx1.sendIdx["first"]=1;
  16177. $recv($2)._remove_ifAbsent_($3,(function(){
  16178. return $core.withContext(function($ctx2) {
  16179. throw $early=[$recv(aBlock)._value()];
  16180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16181. }));
  16182. self["@size"]=$recv(self["@size"]).__minus((1));
  16183. return self["@size"];
  16184. } else {
  16185. var primitiveBucket;
  16186. primitiveBucket=$receiver;
  16187. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16188. };
  16189. }
  16190. catch(e) {if(e===$early)return e[0]; throw e}
  16191. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16192. },
  16193. args: ["anObject", "aBlock"],
  16194. 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 ]",
  16195. referencedClasses: [],
  16196. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16197. }),
  16198. $globals.Set);
  16199. $core.addMethod(
  16200. $core.method({
  16201. selector: "remove:in:",
  16202. protocol: 'private',
  16203. fn: function (anObject,anotherObject){
  16204. var self=this;
  16205. return $core.withContext(function($ctx1) {
  16206. if (delete anotherObject.store[anObject]) self['@size']--;
  16207. return self;
  16208. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16209. },
  16210. args: ["anObject", "anotherObject"],
  16211. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16212. referencedClasses: [],
  16213. messageSends: []
  16214. }),
  16215. $globals.Set);
  16216. $core.addMethod(
  16217. $core.method({
  16218. selector: "removeAll",
  16219. protocol: 'adding/removing',
  16220. fn: function (){
  16221. var self=this;
  16222. return $core.withContext(function($ctx1) {
  16223. self['@fastBuckets'] = {
  16224. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16225. 'number': { store: Object.create(null), fn: Number },
  16226. 'string': { store: Object.create(null) }
  16227. };
  16228. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16229. self['@defaultBucket']._removeAll();
  16230. self['@size'] = 0;
  16231. ;
  16232. return self;
  16233. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16234. },
  16235. args: [],
  16236. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
  16237. referencedClasses: [],
  16238. messageSends: []
  16239. }),
  16240. $globals.Set);
  16241. $core.addMethod(
  16242. $core.method({
  16243. selector: "select:",
  16244. protocol: 'enumerating',
  16245. fn: function (aBlock){
  16246. var self=this;
  16247. var collection;
  16248. return $core.withContext(function($ctx1) {
  16249. var $1;
  16250. collection=$recv(self._class())._new();
  16251. self._do_((function(each){
  16252. return $core.withContext(function($ctx2) {
  16253. $1=$recv(aBlock)._value_(each);
  16254. if($core.assert($1)){
  16255. return $recv(collection)._add_(each);
  16256. };
  16257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16258. }));
  16259. return collection;
  16260. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16261. },
  16262. args: ["aBlock"],
  16263. 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",
  16264. referencedClasses: [],
  16265. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16266. }),
  16267. $globals.Set);
  16268. $core.addMethod(
  16269. $core.method({
  16270. selector: "size",
  16271. protocol: 'accessing',
  16272. fn: function (){
  16273. var self=this;
  16274. return self["@size"];
  16275. },
  16276. args: [],
  16277. source: "size\x0a\x09^ size",
  16278. referencedClasses: [],
  16279. messageSends: []
  16280. }),
  16281. $globals.Set);
  16282. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16283. $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.";
  16284. $core.addMethod(
  16285. $core.method({
  16286. selector: "<<",
  16287. protocol: 'writing',
  16288. fn: function (anObject){
  16289. var self=this;
  16290. return $core.withContext(function($ctx1) {
  16291. self._write_(anObject);
  16292. return self;
  16293. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16294. },
  16295. args: ["anObject"],
  16296. source: "<< anObject\x0a\x09self write: anObject",
  16297. referencedClasses: [],
  16298. messageSends: ["write:"]
  16299. }),
  16300. $globals.ProtoStream);
  16301. $core.addMethod(
  16302. $core.method({
  16303. selector: "atEnd",
  16304. protocol: 'testing',
  16305. fn: function (){
  16306. var self=this;
  16307. return $core.withContext(function($ctx1) {
  16308. self._subclassResponsibility();
  16309. return self;
  16310. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16311. },
  16312. args: [],
  16313. source: "atEnd\x0a\x09self subclassResponsibility",
  16314. referencedClasses: [],
  16315. messageSends: ["subclassResponsibility"]
  16316. }),
  16317. $globals.ProtoStream);
  16318. $core.addMethod(
  16319. $core.method({
  16320. selector: "atStart",
  16321. protocol: 'testing',
  16322. fn: function (){
  16323. var self=this;
  16324. return $core.withContext(function($ctx1) {
  16325. self._subclassResponsibility();
  16326. return self;
  16327. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16328. },
  16329. args: [],
  16330. source: "atStart\x0a\x09self subclassResponsibility",
  16331. referencedClasses: [],
  16332. messageSends: ["subclassResponsibility"]
  16333. }),
  16334. $globals.ProtoStream);
  16335. $core.addMethod(
  16336. $core.method({
  16337. selector: "contents",
  16338. protocol: 'accessing',
  16339. fn: function (){
  16340. var self=this;
  16341. return $core.withContext(function($ctx1) {
  16342. self._subclassResponsibility();
  16343. return self;
  16344. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16345. },
  16346. args: [],
  16347. source: "contents\x0a\x09self subclassResponsibility",
  16348. referencedClasses: [],
  16349. messageSends: ["subclassResponsibility"]
  16350. }),
  16351. $globals.ProtoStream);
  16352. $core.addMethod(
  16353. $core.method({
  16354. selector: "do:",
  16355. protocol: 'enumerating',
  16356. fn: function (aBlock){
  16357. var self=this;
  16358. return $core.withContext(function($ctx1) {
  16359. $recv((function(){
  16360. return $core.withContext(function($ctx2) {
  16361. return self._atEnd();
  16362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16363. }))._whileFalse_((function(){
  16364. return $core.withContext(function($ctx2) {
  16365. return $recv(aBlock)._value_(self._next());
  16366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16367. }));
  16368. return self;
  16369. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16370. },
  16371. args: ["aBlock"],
  16372. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16373. referencedClasses: [],
  16374. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16375. }),
  16376. $globals.ProtoStream);
  16377. $core.addMethod(
  16378. $core.method({
  16379. selector: "isEmpty",
  16380. protocol: 'testing',
  16381. fn: function (){
  16382. var self=this;
  16383. return $core.withContext(function($ctx1) {
  16384. return $recv(self._atStart())._and_((function(){
  16385. return $core.withContext(function($ctx2) {
  16386. return self._atEnd();
  16387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16388. }));
  16389. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16390. },
  16391. args: [],
  16392. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16393. referencedClasses: [],
  16394. messageSends: ["and:", "atStart", "atEnd"]
  16395. }),
  16396. $globals.ProtoStream);
  16397. $core.addMethod(
  16398. $core.method({
  16399. selector: "next",
  16400. protocol: 'reading',
  16401. fn: function (){
  16402. var self=this;
  16403. return $core.withContext(function($ctx1) {
  16404. var $1;
  16405. $1=self._atEnd();
  16406. if($core.assert($1)){
  16407. return nil;
  16408. } else {
  16409. return self._subclassResponsibility();
  16410. };
  16411. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16412. },
  16413. args: [],
  16414. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16415. referencedClasses: [],
  16416. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16417. }),
  16418. $globals.ProtoStream);
  16419. $core.addMethod(
  16420. $core.method({
  16421. selector: "nextPut:",
  16422. protocol: 'writing',
  16423. fn: function (anObject){
  16424. var self=this;
  16425. return $core.withContext(function($ctx1) {
  16426. self._subclassResponsibility();
  16427. return self;
  16428. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16429. },
  16430. args: ["anObject"],
  16431. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16432. referencedClasses: [],
  16433. messageSends: ["subclassResponsibility"]
  16434. }),
  16435. $globals.ProtoStream);
  16436. $core.addMethod(
  16437. $core.method({
  16438. selector: "nextPutAll:",
  16439. protocol: 'writing',
  16440. fn: function (aCollection){
  16441. var self=this;
  16442. return $core.withContext(function($ctx1) {
  16443. $recv(aCollection)._do_((function(each){
  16444. return $core.withContext(function($ctx2) {
  16445. return self._nextPut_(each);
  16446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16447. }));
  16448. return self;
  16449. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16450. },
  16451. args: ["aCollection"],
  16452. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16453. referencedClasses: [],
  16454. messageSends: ["do:", "nextPut:"]
  16455. }),
  16456. $globals.ProtoStream);
  16457. $core.addMethod(
  16458. $core.method({
  16459. selector: "nextPutJSObject:",
  16460. protocol: 'writing',
  16461. fn: function (aJSObject){
  16462. var self=this;
  16463. return $core.withContext(function($ctx1) {
  16464. self._nextPut_(aJSObject);
  16465. return self;
  16466. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16467. },
  16468. args: ["aJSObject"],
  16469. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16470. referencedClasses: [],
  16471. messageSends: ["nextPut:"]
  16472. }),
  16473. $globals.ProtoStream);
  16474. $core.addMethod(
  16475. $core.method({
  16476. selector: "nextPutString:",
  16477. protocol: 'writing',
  16478. fn: function (aString){
  16479. var self=this;
  16480. return $core.withContext(function($ctx1) {
  16481. self._nextPut_(aString);
  16482. return self;
  16483. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16484. },
  16485. args: ["aString"],
  16486. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16487. referencedClasses: [],
  16488. messageSends: ["nextPut:"]
  16489. }),
  16490. $globals.ProtoStream);
  16491. $core.addMethod(
  16492. $core.method({
  16493. selector: "peek",
  16494. protocol: 'reading',
  16495. fn: function (){
  16496. var self=this;
  16497. return $core.withContext(function($ctx1) {
  16498. var $1;
  16499. $1=self._atEnd();
  16500. if($core.assert($1)){
  16501. return nil;
  16502. } else {
  16503. return self._subclassResponsibility();
  16504. };
  16505. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16506. },
  16507. args: [],
  16508. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16509. referencedClasses: [],
  16510. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16511. }),
  16512. $globals.ProtoStream);
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "reset",
  16516. protocol: 'actions',
  16517. fn: function (){
  16518. var self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. self._subclassResponsibility();
  16521. return self;
  16522. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16523. },
  16524. args: [],
  16525. source: "reset\x0a\x09self subclassResponsibility",
  16526. referencedClasses: [],
  16527. messageSends: ["subclassResponsibility"]
  16528. }),
  16529. $globals.ProtoStream);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "resetContents",
  16533. protocol: 'actions',
  16534. fn: function (){
  16535. var self=this;
  16536. return $core.withContext(function($ctx1) {
  16537. self._subclassResponsibility();
  16538. return self;
  16539. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16540. },
  16541. args: [],
  16542. source: "resetContents\x0a\x09self subclassResponsibility",
  16543. referencedClasses: [],
  16544. messageSends: ["subclassResponsibility"]
  16545. }),
  16546. $globals.ProtoStream);
  16547. $core.addMethod(
  16548. $core.method({
  16549. selector: "setToEnd",
  16550. protocol: 'positioning',
  16551. fn: function (){
  16552. var self=this;
  16553. return $core.withContext(function($ctx1) {
  16554. self._subclassResponsibility();
  16555. return self;
  16556. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16557. },
  16558. args: [],
  16559. source: "setToEnd\x0a\x09self subclassResponsibility",
  16560. referencedClasses: [],
  16561. messageSends: ["subclassResponsibility"]
  16562. }),
  16563. $globals.ProtoStream);
  16564. $core.addMethod(
  16565. $core.method({
  16566. selector: "setToStart",
  16567. protocol: 'positioning',
  16568. fn: function (){
  16569. var self=this;
  16570. return $core.withContext(function($ctx1) {
  16571. self._reset();
  16572. return self;
  16573. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16574. },
  16575. args: [],
  16576. source: "setToStart\x0a\x09self reset",
  16577. referencedClasses: [],
  16578. messageSends: ["reset"]
  16579. }),
  16580. $globals.ProtoStream);
  16581. $core.addMethod(
  16582. $core.method({
  16583. selector: "write:",
  16584. protocol: 'writing',
  16585. fn: function (anObject){
  16586. var self=this;
  16587. return $core.withContext(function($ctx1) {
  16588. $recv(anObject)._putOn_(self);
  16589. return self;
  16590. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16591. },
  16592. args: ["anObject"],
  16593. source: "write: anObject\x0a\x09anObject putOn: self",
  16594. referencedClasses: [],
  16595. messageSends: ["putOn:"]
  16596. }),
  16597. $globals.ProtoStream);
  16598. $core.addMethod(
  16599. $core.method({
  16600. selector: "on:",
  16601. protocol: 'instance creation',
  16602. fn: function (aCollection){
  16603. var self=this;
  16604. return $core.withContext(function($ctx1) {
  16605. var $1;
  16606. $1=self._new();
  16607. $recv($1)._setCollection_(aCollection);
  16608. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16609. return $recv($1)._yourself();
  16610. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16611. },
  16612. args: ["aCollection"],
  16613. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16614. referencedClasses: [],
  16615. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16616. }),
  16617. $globals.ProtoStream.klass);
  16618. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16619. $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.";
  16620. $core.addMethod(
  16621. $core.method({
  16622. selector: "atEnd",
  16623. protocol: 'testing',
  16624. fn: function (){
  16625. var self=this;
  16626. return $core.withContext(function($ctx1) {
  16627. return $recv(self._position()).__eq(self._size());
  16628. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16629. },
  16630. args: [],
  16631. source: "atEnd\x0a\x09^ self position = self size",
  16632. referencedClasses: [],
  16633. messageSends: ["=", "position", "size"]
  16634. }),
  16635. $globals.Stream);
  16636. $core.addMethod(
  16637. $core.method({
  16638. selector: "atStart",
  16639. protocol: 'testing',
  16640. fn: function (){
  16641. var self=this;
  16642. return $core.withContext(function($ctx1) {
  16643. return $recv(self._position()).__eq((0));
  16644. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16645. },
  16646. args: [],
  16647. source: "atStart\x0a\x09^ self position = 0",
  16648. referencedClasses: [],
  16649. messageSends: ["=", "position"]
  16650. }),
  16651. $globals.Stream);
  16652. $core.addMethod(
  16653. $core.method({
  16654. selector: "close",
  16655. protocol: 'actions',
  16656. fn: function (){
  16657. var self=this;
  16658. return self;
  16659. },
  16660. args: [],
  16661. source: "close",
  16662. referencedClasses: [],
  16663. messageSends: []
  16664. }),
  16665. $globals.Stream);
  16666. $core.addMethod(
  16667. $core.method({
  16668. selector: "collection",
  16669. protocol: 'accessing',
  16670. fn: function (){
  16671. var self=this;
  16672. return self["@collection"];
  16673. },
  16674. args: [],
  16675. source: "collection\x0a\x09^ collection",
  16676. referencedClasses: [],
  16677. messageSends: []
  16678. }),
  16679. $globals.Stream);
  16680. $core.addMethod(
  16681. $core.method({
  16682. selector: "contents",
  16683. protocol: 'accessing',
  16684. fn: function (){
  16685. var self=this;
  16686. return $core.withContext(function($ctx1) {
  16687. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16688. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16689. },
  16690. args: [],
  16691. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16692. referencedClasses: [],
  16693. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16694. }),
  16695. $globals.Stream);
  16696. $core.addMethod(
  16697. $core.method({
  16698. selector: "flush",
  16699. protocol: 'actions',
  16700. fn: function (){
  16701. var self=this;
  16702. return self;
  16703. },
  16704. args: [],
  16705. source: "flush",
  16706. referencedClasses: [],
  16707. messageSends: []
  16708. }),
  16709. $globals.Stream);
  16710. $core.addMethod(
  16711. $core.method({
  16712. selector: "isEmpty",
  16713. protocol: 'testing',
  16714. fn: function (){
  16715. var self=this;
  16716. return $core.withContext(function($ctx1) {
  16717. return $recv(self._size()).__eq((0));
  16718. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16719. },
  16720. args: [],
  16721. source: "isEmpty\x0a\x09^ self size = 0",
  16722. referencedClasses: [],
  16723. messageSends: ["=", "size"]
  16724. }),
  16725. $globals.Stream);
  16726. $core.addMethod(
  16727. $core.method({
  16728. selector: "next",
  16729. protocol: 'reading',
  16730. fn: function (){
  16731. var self=this;
  16732. return $core.withContext(function($ctx1) {
  16733. var $1,$3,$2;
  16734. $1=self._atEnd();
  16735. if($core.assert($1)){
  16736. return nil;
  16737. } else {
  16738. $3=self._position();
  16739. $ctx1.sendIdx["position"]=1;
  16740. $2=$recv($3).__plus((1));
  16741. self._position_($2);
  16742. return $recv(self["@collection"])._at_(self._position());
  16743. };
  16744. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16745. },
  16746. args: [],
  16747. 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 ]",
  16748. referencedClasses: [],
  16749. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16750. }),
  16751. $globals.Stream);
  16752. $core.addMethod(
  16753. $core.method({
  16754. selector: "next:",
  16755. protocol: 'reading',
  16756. fn: function (anInteger){
  16757. var self=this;
  16758. var tempCollection;
  16759. return $core.withContext(function($ctx1) {
  16760. var $1;
  16761. tempCollection=$recv($recv(self._collection())._class())._new();
  16762. $recv(anInteger)._timesRepeat_((function(){
  16763. return $core.withContext(function($ctx2) {
  16764. $1=self._atEnd();
  16765. if(!$core.assert($1)){
  16766. return $recv(tempCollection)._add_(self._next());
  16767. };
  16768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16769. }));
  16770. return tempCollection;
  16771. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16772. },
  16773. args: ["anInteger"],
  16774. 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",
  16775. referencedClasses: [],
  16776. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16777. }),
  16778. $globals.Stream);
  16779. $core.addMethod(
  16780. $core.method({
  16781. selector: "nextPut:",
  16782. protocol: 'writing',
  16783. fn: function (anObject){
  16784. var self=this;
  16785. return $core.withContext(function($ctx1) {
  16786. var $2,$1,$3,$4;
  16787. $2=self._position();
  16788. $ctx1.sendIdx["position"]=1;
  16789. $1=$recv($2).__plus((1));
  16790. self._position_($1);
  16791. $3=self._collection();
  16792. $4=self._position();
  16793. $ctx1.sendIdx["position"]=2;
  16794. $recv($3)._at_put_($4,anObject);
  16795. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16796. return self;
  16797. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16798. },
  16799. args: ["anObject"],
  16800. 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)",
  16801. referencedClasses: [],
  16802. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16803. }),
  16804. $globals.Stream);
  16805. $core.addMethod(
  16806. $core.method({
  16807. selector: "peek",
  16808. protocol: 'reading',
  16809. fn: function (){
  16810. var self=this;
  16811. return $core.withContext(function($ctx1) {
  16812. var $1;
  16813. $1=self._atEnd();
  16814. if(!$core.assert($1)){
  16815. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16816. };
  16817. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16818. },
  16819. args: [],
  16820. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16821. referencedClasses: [],
  16822. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16823. }),
  16824. $globals.Stream);
  16825. $core.addMethod(
  16826. $core.method({
  16827. selector: "position",
  16828. protocol: 'accessing',
  16829. fn: function (){
  16830. var self=this;
  16831. return $core.withContext(function($ctx1) {
  16832. var $1,$receiver;
  16833. $1=self["@position"];
  16834. if(($receiver = $1) == null || $receiver.isNil){
  16835. self["@position"]=(0);
  16836. return self["@position"];
  16837. } else {
  16838. return $1;
  16839. };
  16840. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16841. },
  16842. args: [],
  16843. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16844. referencedClasses: [],
  16845. messageSends: ["ifNil:"]
  16846. }),
  16847. $globals.Stream);
  16848. $core.addMethod(
  16849. $core.method({
  16850. selector: "position:",
  16851. protocol: 'accessing',
  16852. fn: function (anInteger){
  16853. var self=this;
  16854. self["@position"]=anInteger;
  16855. return self;
  16856. },
  16857. args: ["anInteger"],
  16858. source: "position: anInteger\x0a\x09position := anInteger",
  16859. referencedClasses: [],
  16860. messageSends: []
  16861. }),
  16862. $globals.Stream);
  16863. $core.addMethod(
  16864. $core.method({
  16865. selector: "reset",
  16866. protocol: 'actions',
  16867. fn: function (){
  16868. var self=this;
  16869. return $core.withContext(function($ctx1) {
  16870. self._position_((0));
  16871. return self;
  16872. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16873. },
  16874. args: [],
  16875. source: "reset\x0a\x09self position: 0",
  16876. referencedClasses: [],
  16877. messageSends: ["position:"]
  16878. }),
  16879. $globals.Stream);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "resetContents",
  16883. protocol: 'actions',
  16884. fn: function (){
  16885. var self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. self._reset();
  16888. self._setStreamSize_((0));
  16889. return self;
  16890. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16891. },
  16892. args: [],
  16893. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16894. referencedClasses: [],
  16895. messageSends: ["reset", "setStreamSize:"]
  16896. }),
  16897. $globals.Stream);
  16898. $core.addMethod(
  16899. $core.method({
  16900. selector: "setCollection:",
  16901. protocol: 'accessing',
  16902. fn: function (aCollection){
  16903. var self=this;
  16904. self["@collection"]=aCollection;
  16905. return self;
  16906. },
  16907. args: ["aCollection"],
  16908. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16909. referencedClasses: [],
  16910. messageSends: []
  16911. }),
  16912. $globals.Stream);
  16913. $core.addMethod(
  16914. $core.method({
  16915. selector: "setStreamSize:",
  16916. protocol: 'accessing',
  16917. fn: function (anInteger){
  16918. var self=this;
  16919. self["@streamSize"]=anInteger;
  16920. return self;
  16921. },
  16922. args: ["anInteger"],
  16923. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16924. referencedClasses: [],
  16925. messageSends: []
  16926. }),
  16927. $globals.Stream);
  16928. $core.addMethod(
  16929. $core.method({
  16930. selector: "setToEnd",
  16931. protocol: 'positioning',
  16932. fn: function (){
  16933. var self=this;
  16934. return $core.withContext(function($ctx1) {
  16935. self._position_(self._size());
  16936. return self;
  16937. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16938. },
  16939. args: [],
  16940. source: "setToEnd\x0a\x09self position: self size",
  16941. referencedClasses: [],
  16942. messageSends: ["position:", "size"]
  16943. }),
  16944. $globals.Stream);
  16945. $core.addMethod(
  16946. $core.method({
  16947. selector: "size",
  16948. protocol: 'accessing',
  16949. fn: function (){
  16950. var self=this;
  16951. return $core.withContext(function($ctx1) {
  16952. return self._streamSize();
  16953. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16954. },
  16955. args: [],
  16956. source: "size\x0a\x09^ self streamSize",
  16957. referencedClasses: [],
  16958. messageSends: ["streamSize"]
  16959. }),
  16960. $globals.Stream);
  16961. $core.addMethod(
  16962. $core.method({
  16963. selector: "skip:",
  16964. protocol: 'positioning',
  16965. fn: function (anInteger){
  16966. var self=this;
  16967. return $core.withContext(function($ctx1) {
  16968. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16969. return self;
  16970. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16971. },
  16972. args: ["anInteger"],
  16973. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16974. referencedClasses: [],
  16975. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16976. }),
  16977. $globals.Stream);
  16978. $core.addMethod(
  16979. $core.method({
  16980. selector: "streamSize",
  16981. protocol: 'accessing',
  16982. fn: function (){
  16983. var self=this;
  16984. return self["@streamSize"];
  16985. },
  16986. args: [],
  16987. source: "streamSize\x0a\x09^ streamSize",
  16988. referencedClasses: [],
  16989. messageSends: []
  16990. }),
  16991. $globals.Stream);
  16992. $core.addMethod(
  16993. $core.method({
  16994. selector: "on:",
  16995. protocol: 'instance creation',
  16996. fn: function (aCollection){
  16997. var self=this;
  16998. return $core.withContext(function($ctx1) {
  16999. var $1;
  17000. $1=self._new();
  17001. $recv($1)._setCollection_(aCollection);
  17002. $recv($1)._setStreamSize_($recv(aCollection)._size());
  17003. return $recv($1)._yourself();
  17004. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  17005. },
  17006. args: ["aCollection"],
  17007. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17008. referencedClasses: [],
  17009. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17010. }),
  17011. $globals.Stream.klass);
  17012. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17013. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17014. $core.addMethod(
  17015. $core.method({
  17016. selector: "cr",
  17017. protocol: 'writing',
  17018. fn: function (){
  17019. var self=this;
  17020. return $core.withContext(function($ctx1) {
  17021. return self._nextPutAll_($recv($globals.String)._cr());
  17022. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17023. },
  17024. args: [],
  17025. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17026. referencedClasses: ["String"],
  17027. messageSends: ["nextPutAll:", "cr"]
  17028. }),
  17029. $globals.StringStream);
  17030. $core.addMethod(
  17031. $core.method({
  17032. selector: "crlf",
  17033. protocol: 'writing',
  17034. fn: function (){
  17035. var self=this;
  17036. return $core.withContext(function($ctx1) {
  17037. return self._nextPutAll_($recv($globals.String)._crlf());
  17038. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17039. },
  17040. args: [],
  17041. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17042. referencedClasses: ["String"],
  17043. messageSends: ["nextPutAll:", "crlf"]
  17044. }),
  17045. $globals.StringStream);
  17046. $core.addMethod(
  17047. $core.method({
  17048. selector: "lf",
  17049. protocol: 'writing',
  17050. fn: function (){
  17051. var self=this;
  17052. return $core.withContext(function($ctx1) {
  17053. return self._nextPutAll_($recv($globals.String)._lf());
  17054. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17055. },
  17056. args: [],
  17057. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17058. referencedClasses: ["String"],
  17059. messageSends: ["nextPutAll:", "lf"]
  17060. }),
  17061. $globals.StringStream);
  17062. $core.addMethod(
  17063. $core.method({
  17064. selector: "next:",
  17065. protocol: 'reading',
  17066. fn: function (anInteger){
  17067. var self=this;
  17068. var tempCollection;
  17069. return $core.withContext(function($ctx1) {
  17070. var $1;
  17071. tempCollection=$recv($recv(self._collection())._class())._new();
  17072. $recv(anInteger)._timesRepeat_((function(){
  17073. return $core.withContext(function($ctx2) {
  17074. $1=self._atEnd();
  17075. if(!$core.assert($1)){
  17076. tempCollection=$recv(tempCollection).__comma(self._next());
  17077. return tempCollection;
  17078. };
  17079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17080. }));
  17081. return tempCollection;
  17082. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17083. },
  17084. args: ["anInteger"],
  17085. 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",
  17086. referencedClasses: [],
  17087. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17088. }),
  17089. $globals.StringStream);
  17090. $core.addMethod(
  17091. $core.method({
  17092. selector: "nextPut:",
  17093. protocol: 'writing',
  17094. fn: function (aString){
  17095. var self=this;
  17096. return $core.withContext(function($ctx1) {
  17097. self._nextPutAll_(aString);
  17098. return self;
  17099. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17100. },
  17101. args: ["aString"],
  17102. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17103. referencedClasses: [],
  17104. messageSends: ["nextPutAll:"]
  17105. }),
  17106. $globals.StringStream);
  17107. $core.addMethod(
  17108. $core.method({
  17109. selector: "nextPutAll:",
  17110. protocol: 'writing',
  17111. fn: function (aString){
  17112. var self=this;
  17113. var pre,post;
  17114. return $core.withContext(function($ctx1) {
  17115. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17116. $1=self._atEnd();
  17117. if($core.assert($1)){
  17118. $3=self._collection();
  17119. $ctx1.sendIdx["collection"]=1;
  17120. $2=$recv($3).__comma(aString);
  17121. $ctx1.sendIdx[","]=1;
  17122. self._setCollection_($2);
  17123. $ctx1.sendIdx["setCollection:"]=1;
  17124. } else {
  17125. $4=self._collection();
  17126. $ctx1.sendIdx["collection"]=2;
  17127. $5=self._position();
  17128. $ctx1.sendIdx["position"]=1;
  17129. pre=$recv($4)._copyFrom_to_((1),$5);
  17130. $ctx1.sendIdx["copyFrom:to:"]=1;
  17131. pre;
  17132. $6=self._collection();
  17133. $ctx1.sendIdx["collection"]=3;
  17134. $9=self._position();
  17135. $ctx1.sendIdx["position"]=2;
  17136. $8=$recv($9).__plus((1));
  17137. $ctx1.sendIdx["+"]=2;
  17138. $10=$recv(aString)._size();
  17139. $ctx1.sendIdx["size"]=1;
  17140. $7=$recv($8).__plus($10);
  17141. $ctx1.sendIdx["+"]=1;
  17142. $11=$recv(self._collection())._size();
  17143. $ctx1.sendIdx["size"]=2;
  17144. post=$recv($6)._copyFrom_to_($7,$11);
  17145. post;
  17146. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17147. $ctx1.sendIdx[","]=2;
  17148. self._setCollection_($12);
  17149. };
  17150. $14=self._position();
  17151. $ctx1.sendIdx["position"]=3;
  17152. $13=$recv($14).__plus($recv(aString)._size());
  17153. self._position_($13);
  17154. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17155. return self;
  17156. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17157. },
  17158. args: ["aString"],
  17159. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  17160. referencedClasses: [],
  17161. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17162. }),
  17163. $globals.StringStream);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "nextPutString:",
  17167. protocol: 'writing',
  17168. fn: function (aString){
  17169. var self=this;
  17170. return $core.withContext(function($ctx1) {
  17171. self._nextPutAll_(aString);
  17172. return self;
  17173. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17174. },
  17175. args: ["aString"],
  17176. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17177. referencedClasses: [],
  17178. messageSends: ["nextPutAll:"]
  17179. }),
  17180. $globals.StringStream);
  17181. $core.addMethod(
  17182. $core.method({
  17183. selector: "space",
  17184. protocol: 'writing',
  17185. fn: function (){
  17186. var self=this;
  17187. return $core.withContext(function($ctx1) {
  17188. self._nextPut_(" ");
  17189. return self;
  17190. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17191. },
  17192. args: [],
  17193. source: "space\x0a\x09self nextPut: ' '",
  17194. referencedClasses: [],
  17195. messageSends: ["nextPut:"]
  17196. }),
  17197. $globals.StringStream);
  17198. $core.addMethod(
  17199. $core.method({
  17200. selector: "tab",
  17201. protocol: 'writing',
  17202. fn: function (){
  17203. var self=this;
  17204. return $core.withContext(function($ctx1) {
  17205. return self._nextPutAll_($recv($globals.String)._tab());
  17206. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17207. },
  17208. args: [],
  17209. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17210. referencedClasses: ["String"],
  17211. messageSends: ["nextPutAll:", "tab"]
  17212. }),
  17213. $globals.StringStream);
  17214. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17215. $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.";
  17216. $core.addMethod(
  17217. $core.method({
  17218. selector: "initialize",
  17219. protocol: 'initialization',
  17220. fn: function (){
  17221. var self=this;
  17222. return $core.withContext(function($ctx1) {
  17223. (
  17224. $ctx1.supercall = true,
  17225. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17226. $ctx1.supercall = false;
  17227. self["@read"]=$recv($globals.OrderedCollection)._new();
  17228. $ctx1.sendIdx["new"]=1;
  17229. self["@write"]=$recv($globals.OrderedCollection)._new();
  17230. self["@readIndex"]=(1);
  17231. return self;
  17232. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17233. },
  17234. args: [],
  17235. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17236. referencedClasses: ["OrderedCollection"],
  17237. messageSends: ["initialize", "new"]
  17238. }),
  17239. $globals.Queue);
  17240. $core.addMethod(
  17241. $core.method({
  17242. selector: "next",
  17243. protocol: 'accessing',
  17244. fn: function (){
  17245. var self=this;
  17246. return $core.withContext(function($ctx1) {
  17247. return self._nextIfAbsent_((function(){
  17248. return $core.withContext(function($ctx2) {
  17249. return self._error_("Cannot read from empty Queue.");
  17250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17251. }));
  17252. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17253. },
  17254. args: [],
  17255. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17256. referencedClasses: [],
  17257. messageSends: ["nextIfAbsent:", "error:"]
  17258. }),
  17259. $globals.Queue);
  17260. $core.addMethod(
  17261. $core.method({
  17262. selector: "nextIfAbsent:",
  17263. protocol: 'accessing',
  17264. fn: function (aBlock){
  17265. var self=this;
  17266. var result;
  17267. return $core.withContext(function($ctx1) {
  17268. var $1,$2;
  17269. var $early={};
  17270. try {
  17271. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17272. return $core.withContext(function($ctx2) {
  17273. $1=$recv(self["@write"])._isEmpty();
  17274. if($core.assert($1)){
  17275. $2=$recv(self["@readIndex"]).__gt((1));
  17276. if($core.assert($2)){
  17277. self["@read"]=[];
  17278. self["@read"];
  17279. self["@readIndex"]=(1);
  17280. self["@readIndex"];
  17281. };
  17282. throw $early=[$recv(aBlock)._value()];
  17283. };
  17284. self["@read"]=self["@write"];
  17285. self["@read"];
  17286. self["@readIndex"]=(1);
  17287. self["@readIndex"];
  17288. self["@write"]=$recv($globals.OrderedCollection)._new();
  17289. self["@write"];
  17290. return $recv(self["@read"])._first();
  17291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17292. }));
  17293. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17294. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17295. return result;
  17296. }
  17297. catch(e) {if(e===$early)return e[0]; throw e}
  17298. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17299. },
  17300. args: ["aBlock"],
  17301. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  17302. referencedClasses: ["OrderedCollection"],
  17303. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17304. }),
  17305. $globals.Queue);
  17306. $core.addMethod(
  17307. $core.method({
  17308. selector: "nextPut:",
  17309. protocol: 'accessing',
  17310. fn: function (anObject){
  17311. var self=this;
  17312. return $core.withContext(function($ctx1) {
  17313. $recv(self["@write"])._add_(anObject);
  17314. return self;
  17315. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17316. },
  17317. args: ["anObject"],
  17318. source: "nextPut: anObject\x0a\x09write add: anObject",
  17319. referencedClasses: [],
  17320. messageSends: ["add:"]
  17321. }),
  17322. $globals.Queue);
  17323. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17324. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17325. $core.addMethod(
  17326. $core.method({
  17327. selector: "compile:",
  17328. protocol: 'evaluating',
  17329. fn: function (aString){
  17330. var self=this;
  17331. return $core.withContext(function($ctx1) {
  17332. return self.compile(aString);
  17333. return self;
  17334. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17335. },
  17336. args: ["aString"],
  17337. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17338. referencedClasses: [],
  17339. messageSends: []
  17340. }),
  17341. $globals.RegularExpression);
  17342. $core.addMethod(
  17343. $core.method({
  17344. selector: "exec:",
  17345. protocol: 'evaluating',
  17346. fn: function (aString){
  17347. var self=this;
  17348. return $core.withContext(function($ctx1) {
  17349. return self.exec(aString) || nil;
  17350. return self;
  17351. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17352. },
  17353. args: ["aString"],
  17354. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17355. referencedClasses: [],
  17356. messageSends: []
  17357. }),
  17358. $globals.RegularExpression);
  17359. $core.addMethod(
  17360. $core.method({
  17361. selector: "test:",
  17362. protocol: 'evaluating',
  17363. fn: function (aString){
  17364. var self=this;
  17365. return $core.withContext(function($ctx1) {
  17366. return self.test(aString);
  17367. return self;
  17368. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17369. },
  17370. args: ["aString"],
  17371. source: "test: aString\x0a\x09<return self.test(aString)>",
  17372. referencedClasses: [],
  17373. messageSends: []
  17374. }),
  17375. $globals.RegularExpression);
  17376. $core.addMethod(
  17377. $core.method({
  17378. selector: "fromString:",
  17379. protocol: 'instance creation',
  17380. fn: function (aString){
  17381. var self=this;
  17382. return $core.withContext(function($ctx1) {
  17383. return self._fromString_flag_(aString,"");
  17384. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17385. },
  17386. args: ["aString"],
  17387. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17388. referencedClasses: [],
  17389. messageSends: ["fromString:flag:"]
  17390. }),
  17391. $globals.RegularExpression.klass);
  17392. $core.addMethod(
  17393. $core.method({
  17394. selector: "fromString:flag:",
  17395. protocol: 'instance creation',
  17396. fn: function (aString,anotherString){
  17397. var self=this;
  17398. return $core.withContext(function($ctx1) {
  17399. return new RegExp(aString, anotherString);
  17400. return self;
  17401. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17402. },
  17403. args: ["aString", "anotherString"],
  17404. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17405. referencedClasses: [],
  17406. messageSends: []
  17407. }),
  17408. $globals.RegularExpression.klass);
  17409. });
  17410. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17411. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17412. $core.addPackage('Kernel-Exceptions');
  17413. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17414. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17415. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17416. $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.";
  17417. $core.addMethod(
  17418. $core.method({
  17419. selector: "beHandled",
  17420. protocol: 'accessing',
  17421. fn: function (){
  17422. var self=this;
  17423. return $core.withContext(function($ctx1) {
  17424. self.amberHandled = true;
  17425. return self;
  17426. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17427. },
  17428. args: [],
  17429. source: "beHandled\x0a\x09<self.amberHandled = true>",
  17430. referencedClasses: [],
  17431. messageSends: []
  17432. }),
  17433. $globals.Error);
  17434. $core.addMethod(
  17435. $core.method({
  17436. selector: "beUnhandled",
  17437. protocol: 'accessing',
  17438. fn: function (){
  17439. var self=this;
  17440. return $core.withContext(function($ctx1) {
  17441. self.amberHandled = false;
  17442. return self;
  17443. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17444. },
  17445. args: [],
  17446. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  17447. referencedClasses: [],
  17448. messageSends: []
  17449. }),
  17450. $globals.Error);
  17451. $core.addMethod(
  17452. $core.method({
  17453. selector: "context",
  17454. protocol: 'accessing',
  17455. fn: function (){
  17456. var self=this;
  17457. return $core.withContext(function($ctx1) {
  17458. return self.context;
  17459. return self;
  17460. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17461. },
  17462. args: [],
  17463. source: "context\x0a\x09<return self.context>",
  17464. referencedClasses: [],
  17465. messageSends: []
  17466. }),
  17467. $globals.Error);
  17468. $core.addMethod(
  17469. $core.method({
  17470. selector: "initialize",
  17471. protocol: 'initialization',
  17472. fn: function (){
  17473. var self=this;
  17474. return $core.withContext(function($ctx1) {
  17475. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17476. return self;
  17477. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17478. },
  17479. args: [],
  17480. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17481. referencedClasses: [],
  17482. messageSends: ["messageText:", ",", "name", "class"]
  17483. }),
  17484. $globals.Error);
  17485. $core.addMethod(
  17486. $core.method({
  17487. selector: "isSmalltalkError",
  17488. protocol: 'testing',
  17489. fn: function (){
  17490. var self=this;
  17491. return $core.withContext(function($ctx1) {
  17492. return self.smalltalkError === true;
  17493. return self;
  17494. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17495. },
  17496. args: [],
  17497. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  17498. referencedClasses: [],
  17499. messageSends: []
  17500. }),
  17501. $globals.Error);
  17502. $core.addMethod(
  17503. $core.method({
  17504. selector: "jsStack",
  17505. protocol: 'accessing',
  17506. fn: function (){
  17507. var self=this;
  17508. return $core.withContext(function($ctx1) {
  17509. return self.stack;
  17510. return self;
  17511. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17512. },
  17513. args: [],
  17514. source: "jsStack\x0a\x09<return self.stack>",
  17515. referencedClasses: [],
  17516. messageSends: []
  17517. }),
  17518. $globals.Error);
  17519. $core.addMethod(
  17520. $core.method({
  17521. selector: "messageText",
  17522. protocol: 'accessing',
  17523. fn: function (){
  17524. var self=this;
  17525. return self["@messageText"];
  17526. },
  17527. args: [],
  17528. source: "messageText\x0a\x09^ messageText",
  17529. referencedClasses: [],
  17530. messageSends: []
  17531. }),
  17532. $globals.Error);
  17533. $core.addMethod(
  17534. $core.method({
  17535. selector: "messageText:",
  17536. protocol: 'accessing',
  17537. fn: function (aString){
  17538. var self=this;
  17539. self["@messageText"]=aString;
  17540. return self;
  17541. },
  17542. args: ["aString"],
  17543. source: "messageText: aString\x0a\x09messageText := aString",
  17544. referencedClasses: [],
  17545. messageSends: []
  17546. }),
  17547. $globals.Error);
  17548. $core.addMethod(
  17549. $core.method({
  17550. selector: "resignal",
  17551. protocol: 'signaling',
  17552. fn: function (){
  17553. var self=this;
  17554. return $core.withContext(function($ctx1) {
  17555. self.amberHandled = false;
  17556. throw(self);
  17557. ;
  17558. return self;
  17559. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17560. },
  17561. args: [],
  17562. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  17563. referencedClasses: [],
  17564. messageSends: []
  17565. }),
  17566. $globals.Error);
  17567. $core.addMethod(
  17568. $core.method({
  17569. selector: "signal",
  17570. protocol: 'signaling',
  17571. fn: function (){
  17572. var self=this;
  17573. return $core.withContext(function($ctx1) {
  17574. self.amberHandled = false;
  17575. self.context = $core.getThisContext();
  17576. self.smalltalkError = true;
  17577. throw self;
  17578. ;
  17579. return self;
  17580. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17581. },
  17582. args: [],
  17583. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09>",
  17584. referencedClasses: [],
  17585. messageSends: []
  17586. }),
  17587. $globals.Error);
  17588. $core.addMethod(
  17589. $core.method({
  17590. selector: "signal:",
  17591. protocol: 'signaling',
  17592. fn: function (aString){
  17593. var self=this;
  17594. return $core.withContext(function($ctx1) {
  17595. self._messageText_(aString);
  17596. self._signal();
  17597. return self;
  17598. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17599. },
  17600. args: ["aString"],
  17601. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17602. referencedClasses: [],
  17603. messageSends: ["messageText:", "signal"]
  17604. }),
  17605. $globals.Error);
  17606. $core.addMethod(
  17607. $core.method({
  17608. selector: "signalerContext",
  17609. protocol: 'accessing',
  17610. fn: function (){
  17611. var self=this;
  17612. return $core.withContext(function($ctx1) {
  17613. return self._signalerContextFrom_(self._context());
  17614. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17615. },
  17616. args: [],
  17617. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17618. referencedClasses: [],
  17619. messageSends: ["signalerContextFrom:", "context"]
  17620. }),
  17621. $globals.Error);
  17622. $core.addMethod(
  17623. $core.method({
  17624. selector: "signalerContextFrom:",
  17625. protocol: 'accessing',
  17626. fn: function (aContext){
  17627. var self=this;
  17628. return $core.withContext(function($ctx1) {
  17629. var $3,$2,$1;
  17630. return $recv(aContext)._findContextSuchThat_((function(context){
  17631. return $core.withContext(function($ctx2) {
  17632. $3=$recv(context)._receiver();
  17633. $ctx2.sendIdx["receiver"]=1;
  17634. $2=$recv($3).__eq_eq(self);
  17635. $ctx2.sendIdx["=="]=1;
  17636. $1=$recv($2)._or_((function(){
  17637. return $core.withContext(function($ctx3) {
  17638. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17640. }));
  17641. return $recv($1)._not();
  17642. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17643. }));
  17644. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17645. },
  17646. args: ["aContext"],
  17647. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  17648. referencedClasses: [],
  17649. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17650. }),
  17651. $globals.Error);
  17652. $core.addMethod(
  17653. $core.method({
  17654. selector: "wasHandled",
  17655. protocol: 'testing',
  17656. fn: function (){
  17657. var self=this;
  17658. return $core.withContext(function($ctx1) {
  17659. return self.amberHandled || false;
  17660. return self;
  17661. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17662. },
  17663. args: [],
  17664. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17665. referencedClasses: [],
  17666. messageSends: []
  17667. }),
  17668. $globals.Error);
  17669. $core.addMethod(
  17670. $core.method({
  17671. selector: "classTag",
  17672. protocol: 'accessing',
  17673. fn: function (){
  17674. var self=this;
  17675. return "exception";
  17676. },
  17677. args: [],
  17678. 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'",
  17679. referencedClasses: [],
  17680. messageSends: []
  17681. }),
  17682. $globals.Error.klass);
  17683. $core.addMethod(
  17684. $core.method({
  17685. selector: "signal",
  17686. protocol: 'instance creation',
  17687. fn: function (){
  17688. var self=this;
  17689. return $core.withContext(function($ctx1) {
  17690. return $recv(self._new())._signal();
  17691. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17692. },
  17693. args: [],
  17694. source: "signal\x0a\x09^ self new signal",
  17695. referencedClasses: [],
  17696. messageSends: ["signal", "new"]
  17697. }),
  17698. $globals.Error.klass);
  17699. $core.addMethod(
  17700. $core.method({
  17701. selector: "signal:",
  17702. protocol: 'instance creation',
  17703. fn: function (aString){
  17704. var self=this;
  17705. return $core.withContext(function($ctx1) {
  17706. return $recv(self._new())._signal_(aString);
  17707. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17708. },
  17709. args: ["aString"],
  17710. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17711. referencedClasses: [],
  17712. messageSends: ["signal:", "new"]
  17713. }),
  17714. $globals.Error.klass);
  17715. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17716. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17717. $core.addMethod(
  17718. $core.method({
  17719. selector: "messageText",
  17720. protocol: 'accessing',
  17721. fn: function (){
  17722. var self=this;
  17723. return "Halt encountered";
  17724. },
  17725. args: [],
  17726. source: "messageText\x0a\x09^ 'Halt encountered'",
  17727. referencedClasses: [],
  17728. messageSends: []
  17729. }),
  17730. $globals.Halt);
  17731. $core.addMethod(
  17732. $core.method({
  17733. selector: "signalerContextFrom:",
  17734. protocol: 'accessing',
  17735. fn: function (aContext){
  17736. var self=this;
  17737. return $core.withContext(function($ctx1) {
  17738. var $3,$2,$1;
  17739. return $recv(aContext)._findContextSuchThat_((function(context){
  17740. return $core.withContext(function($ctx2) {
  17741. $3=$recv(context)._receiver();
  17742. $ctx2.sendIdx["receiver"]=1;
  17743. $2=$recv($3).__eq_eq(self);
  17744. $ctx2.sendIdx["=="]=1;
  17745. $1=$recv($2)._or_((function(){
  17746. return $core.withContext(function($ctx3) {
  17747. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17748. return $core.withContext(function($ctx4) {
  17749. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17750. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17751. }));
  17752. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17753. }));
  17754. $ctx2.sendIdx["or:"]=1;
  17755. return $recv($1)._not();
  17756. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17757. }));
  17758. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17759. },
  17760. args: ["aContext"],
  17761. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  17762. referencedClasses: [],
  17763. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17764. }),
  17765. $globals.Halt);
  17766. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17767. $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:`";
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "context:",
  17771. protocol: 'accessing',
  17772. fn: function (aMethodContext){
  17773. var self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. self.context = aMethodContext;
  17776. return self;
  17777. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17778. },
  17779. args: ["aMethodContext"],
  17780. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  17781. referencedClasses: [],
  17782. messageSends: []
  17783. }),
  17784. $globals.JavaScriptException);
  17785. $core.addMethod(
  17786. $core.method({
  17787. selector: "exception",
  17788. protocol: 'accessing',
  17789. fn: function (){
  17790. var self=this;
  17791. return self["@exception"];
  17792. },
  17793. args: [],
  17794. source: "exception\x0a\x09^ exception",
  17795. referencedClasses: [],
  17796. messageSends: []
  17797. }),
  17798. $globals.JavaScriptException);
  17799. $core.addMethod(
  17800. $core.method({
  17801. selector: "exception:",
  17802. protocol: 'accessing',
  17803. fn: function (anException){
  17804. var self=this;
  17805. self["@exception"]=anException;
  17806. return self;
  17807. },
  17808. args: ["anException"],
  17809. source: "exception: anException\x0a\x09exception := anException",
  17810. referencedClasses: [],
  17811. messageSends: []
  17812. }),
  17813. $globals.JavaScriptException);
  17814. $core.addMethod(
  17815. $core.method({
  17816. selector: "messageText",
  17817. protocol: 'accessing',
  17818. fn: function (){
  17819. var self=this;
  17820. return $core.withContext(function($ctx1) {
  17821. return 'JavaScript exception: ' + self["@exception"].toString();
  17822. return self;
  17823. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  17824. },
  17825. args: [],
  17826. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  17827. referencedClasses: [],
  17828. messageSends: []
  17829. }),
  17830. $globals.JavaScriptException);
  17831. $core.addMethod(
  17832. $core.method({
  17833. selector: "on:",
  17834. protocol: 'instance creation',
  17835. fn: function (anException){
  17836. var self=this;
  17837. return $core.withContext(function($ctx1) {
  17838. var $1;
  17839. $1=self._new();
  17840. $recv($1)._exception_(anException);
  17841. return $recv($1)._yourself();
  17842. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  17843. },
  17844. args: ["anException"],
  17845. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  17846. referencedClasses: [],
  17847. messageSends: ["exception:", "new", "yourself"]
  17848. }),
  17849. $globals.JavaScriptException.klass);
  17850. $core.addMethod(
  17851. $core.method({
  17852. selector: "on:context:",
  17853. protocol: 'instance creation',
  17854. fn: function (anException,aMethodContext){
  17855. var self=this;
  17856. return $core.withContext(function($ctx1) {
  17857. var $1;
  17858. $1=self._new();
  17859. $recv($1)._exception_(anException);
  17860. $recv($1)._context_(aMethodContext);
  17861. return $recv($1)._yourself();
  17862. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  17863. },
  17864. args: ["anException", "aMethodContext"],
  17865. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  17866. referencedClasses: [],
  17867. messageSends: ["exception:", "new", "context:", "yourself"]
  17868. }),
  17869. $globals.JavaScriptException.klass);
  17870. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  17871. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  17872. $core.addMethod(
  17873. $core.method({
  17874. selector: "message",
  17875. protocol: 'accessing',
  17876. fn: function (){
  17877. var self=this;
  17878. return self["@message"];
  17879. },
  17880. args: [],
  17881. source: "message\x0a\x09^ message",
  17882. referencedClasses: [],
  17883. messageSends: []
  17884. }),
  17885. $globals.MessageNotUnderstood);
  17886. $core.addMethod(
  17887. $core.method({
  17888. selector: "message:",
  17889. protocol: 'accessing',
  17890. fn: function (aMessage){
  17891. var self=this;
  17892. self["@message"]=aMessage;
  17893. return self;
  17894. },
  17895. args: ["aMessage"],
  17896. source: "message: aMessage\x0a\x09message := aMessage",
  17897. referencedClasses: [],
  17898. messageSends: []
  17899. }),
  17900. $globals.MessageNotUnderstood);
  17901. $core.addMethod(
  17902. $core.method({
  17903. selector: "messageText",
  17904. protocol: 'accessing',
  17905. fn: function (){
  17906. var self=this;
  17907. return $core.withContext(function($ctx1) {
  17908. var $1;
  17909. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  17910. $ctx1.sendIdx[","]=1;
  17911. return $1;
  17912. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  17913. },
  17914. args: [],
  17915. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  17916. referencedClasses: [],
  17917. messageSends: [",", "asString", "receiver", "selector", "message"]
  17918. }),
  17919. $globals.MessageNotUnderstood);
  17920. $core.addMethod(
  17921. $core.method({
  17922. selector: "receiver",
  17923. protocol: 'accessing',
  17924. fn: function (){
  17925. var self=this;
  17926. return self["@receiver"];
  17927. },
  17928. args: [],
  17929. source: "receiver\x0a\x09^ receiver",
  17930. referencedClasses: [],
  17931. messageSends: []
  17932. }),
  17933. $globals.MessageNotUnderstood);
  17934. $core.addMethod(
  17935. $core.method({
  17936. selector: "receiver:",
  17937. protocol: 'accessing',
  17938. fn: function (anObject){
  17939. var self=this;
  17940. self["@receiver"]=anObject;
  17941. return self;
  17942. },
  17943. args: ["anObject"],
  17944. source: "receiver: anObject\x0a\x09receiver := anObject",
  17945. referencedClasses: [],
  17946. messageSends: []
  17947. }),
  17948. $globals.MessageNotUnderstood);
  17949. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  17950. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  17951. $core.addMethod(
  17952. $core.method({
  17953. selector: "object",
  17954. protocol: 'accessing',
  17955. fn: function (){
  17956. var self=this;
  17957. return self["@object"];
  17958. },
  17959. args: [],
  17960. source: "object\x0a\x09^ object",
  17961. referencedClasses: [],
  17962. messageSends: []
  17963. }),
  17964. $globals.NonBooleanReceiver);
  17965. $core.addMethod(
  17966. $core.method({
  17967. selector: "object:",
  17968. protocol: 'accessing',
  17969. fn: function (anObject){
  17970. var self=this;
  17971. self["@object"]=anObject;
  17972. return self;
  17973. },
  17974. args: ["anObject"],
  17975. source: "object: anObject\x0a\x09object := anObject",
  17976. referencedClasses: [],
  17977. messageSends: []
  17978. }),
  17979. $globals.NonBooleanReceiver);
  17980. });
  17981. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
  17982. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17983. $core.addPackage('Kernel-Infrastructure');
  17984. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17985. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17986. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17987. $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`.";
  17988. $core.addMethod(
  17989. $core.method({
  17990. selector: "=",
  17991. protocol: 'comparing',
  17992. fn: function (anObject){
  17993. var self=this;
  17994. return $core.withContext(function($ctx1) {
  17995. var $2,$1;
  17996. $2=$recv(anObject)._class();
  17997. $ctx1.sendIdx["class"]=1;
  17998. $1=$recv($2).__eq_eq(self._class());
  17999. if(!$core.assert($1)){
  18000. return false;
  18001. };
  18002. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  18003. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  18004. },
  18005. args: ["anObject"],
  18006. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18007. referencedClasses: ["JSObjectProxy"],
  18008. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18009. }),
  18010. $globals.JSObjectProxy);
  18011. $core.addMethod(
  18012. $core.method({
  18013. selector: "asJSON",
  18014. protocol: 'enumerating',
  18015. fn: function (){
  18016. var self=this;
  18017. return self["@jsObject"];
  18018. },
  18019. args: [],
  18020. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18021. referencedClasses: [],
  18022. messageSends: []
  18023. }),
  18024. $globals.JSObjectProxy);
  18025. $core.addMethod(
  18026. $core.method({
  18027. selector: "at:",
  18028. protocol: 'accessing',
  18029. fn: function (aString){
  18030. var self=this;
  18031. return $core.withContext(function($ctx1) {
  18032. return self['@jsObject'][aString];
  18033. return self;
  18034. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18035. },
  18036. args: ["aString"],
  18037. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  18038. referencedClasses: [],
  18039. messageSends: []
  18040. }),
  18041. $globals.JSObjectProxy);
  18042. $core.addMethod(
  18043. $core.method({
  18044. selector: "at:ifAbsent:",
  18045. protocol: 'accessing',
  18046. fn: function (aString,aBlock){
  18047. var self=this;
  18048. return $core.withContext(function($ctx1) {
  18049. var obj = self['@jsObject'];
  18050. return aString in obj ? obj[aString] : aBlock._value();
  18051. ;
  18052. return self;
  18053. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18054. },
  18055. args: ["aString", "aBlock"],
  18056. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  18057. referencedClasses: [],
  18058. messageSends: []
  18059. }),
  18060. $globals.JSObjectProxy);
  18061. $core.addMethod(
  18062. $core.method({
  18063. selector: "at:ifPresent:",
  18064. protocol: 'accessing',
  18065. fn: function (aString,aBlock){
  18066. var self=this;
  18067. return $core.withContext(function($ctx1) {
  18068. var obj = self['@jsObject'];
  18069. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18070. ;
  18071. return self;
  18072. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18073. },
  18074. args: ["aString", "aBlock"],
  18075. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  18076. referencedClasses: [],
  18077. messageSends: []
  18078. }),
  18079. $globals.JSObjectProxy);
  18080. $core.addMethod(
  18081. $core.method({
  18082. selector: "at:ifPresent:ifAbsent:",
  18083. protocol: 'accessing',
  18084. fn: function (aString,aBlock,anotherBlock){
  18085. var self=this;
  18086. return $core.withContext(function($ctx1) {
  18087. var obj = self['@jsObject'];
  18088. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18089. ;
  18090. return self;
  18091. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18092. },
  18093. args: ["aString", "aBlock", "anotherBlock"],
  18094. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  18095. referencedClasses: [],
  18096. messageSends: []
  18097. }),
  18098. $globals.JSObjectProxy);
  18099. $core.addMethod(
  18100. $core.method({
  18101. selector: "at:put:",
  18102. protocol: 'accessing',
  18103. fn: function (aString,anObject){
  18104. var self=this;
  18105. return $core.withContext(function($ctx1) {
  18106. return self['@jsObject'][aString] = anObject;
  18107. return self;
  18108. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18109. },
  18110. args: ["aString", "anObject"],
  18111. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  18112. referencedClasses: [],
  18113. messageSends: []
  18114. }),
  18115. $globals.JSObjectProxy);
  18116. $core.addMethod(
  18117. $core.method({
  18118. selector: "doesNotUnderstand:",
  18119. protocol: 'proxy',
  18120. fn: function (aMessage){
  18121. var self=this;
  18122. return $core.withContext(function($ctx1) {
  18123. var $1,$receiver;
  18124. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18125. if(($receiver = $1) == null || $receiver.isNil){
  18126. return (
  18127. $ctx1.supercall = true,
  18128. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18129. $ctx1.supercall = false;
  18130. } else {
  18131. var jsSelector;
  18132. jsSelector=$receiver;
  18133. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18134. };
  18135. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18136. },
  18137. args: ["aMessage"],
  18138. 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 ]",
  18139. referencedClasses: ["JSObjectProxy"],
  18140. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18141. }),
  18142. $globals.JSObjectProxy);
  18143. $core.addMethod(
  18144. $core.method({
  18145. selector: "in:",
  18146. protocol: 'accessing',
  18147. fn: function (aValuable){
  18148. var self=this;
  18149. return $core.withContext(function($ctx1) {
  18150. return $recv(aValuable)._value_(self["@jsObject"]);
  18151. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18152. },
  18153. args: ["aValuable"],
  18154. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18155. referencedClasses: [],
  18156. messageSends: ["value:"]
  18157. }),
  18158. $globals.JSObjectProxy);
  18159. $core.addMethod(
  18160. $core.method({
  18161. selector: "jsObject",
  18162. protocol: 'accessing',
  18163. fn: function (){
  18164. var self=this;
  18165. return self["@jsObject"];
  18166. },
  18167. args: [],
  18168. source: "jsObject\x0a\x09^ jsObject",
  18169. referencedClasses: [],
  18170. messageSends: []
  18171. }),
  18172. $globals.JSObjectProxy);
  18173. $core.addMethod(
  18174. $core.method({
  18175. selector: "keysAndValuesDo:",
  18176. protocol: 'enumerating',
  18177. fn: function (aBlock){
  18178. var self=this;
  18179. return $core.withContext(function($ctx1) {
  18180. var o = self['@jsObject'];
  18181. for(var i in o) {
  18182. aBlock._value_value_(i, o[i]);
  18183. }
  18184. ;
  18185. return self;
  18186. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18187. },
  18188. args: ["aBlock"],
  18189. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  18190. referencedClasses: [],
  18191. messageSends: []
  18192. }),
  18193. $globals.JSObjectProxy);
  18194. $core.addMethod(
  18195. $core.method({
  18196. selector: "printOn:",
  18197. protocol: 'printing',
  18198. fn: function (aStream){
  18199. var self=this;
  18200. return $core.withContext(function($ctx1) {
  18201. $recv(aStream)._nextPutAll_(self._printString());
  18202. return self;
  18203. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18204. },
  18205. args: ["aStream"],
  18206. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18207. referencedClasses: [],
  18208. messageSends: ["nextPutAll:", "printString"]
  18209. }),
  18210. $globals.JSObjectProxy);
  18211. $core.addMethod(
  18212. $core.method({
  18213. selector: "printString",
  18214. protocol: 'printing',
  18215. fn: function (){
  18216. var self=this;
  18217. return $core.withContext(function($ctx1) {
  18218. var js = self['@jsObject'];
  18219. return js.toString
  18220. ? js.toString()
  18221. : Object.prototype.toString.call(js)
  18222. ;
  18223. return self;
  18224. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18225. },
  18226. args: [],
  18227. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  18228. referencedClasses: [],
  18229. messageSends: []
  18230. }),
  18231. $globals.JSObjectProxy);
  18232. $core.addMethod(
  18233. $core.method({
  18234. selector: "putOn:",
  18235. protocol: 'streaming',
  18236. fn: function (aStream){
  18237. var self=this;
  18238. return $core.withContext(function($ctx1) {
  18239. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18240. return self;
  18241. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18242. },
  18243. args: ["aStream"],
  18244. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18245. referencedClasses: [],
  18246. messageSends: ["nextPutJSObject:"]
  18247. }),
  18248. $globals.JSObjectProxy);
  18249. $core.addMethod(
  18250. $core.method({
  18251. selector: "addObjectVariablesTo:ofProxy:",
  18252. protocol: 'proxy',
  18253. fn: function (aDictionary,aProxy){
  18254. var self=this;
  18255. return $core.withContext(function($ctx1) {
  18256. var jsObject = aProxy['@jsObject'];
  18257. for(var i in jsObject) {
  18258. aDictionary._at_put_(i, jsObject[i]);
  18259. }
  18260. ;
  18261. return self;
  18262. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18263. },
  18264. args: ["aDictionary", "aProxy"],
  18265. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<\x0a\x09\x09var jsObject = aProxy['@jsObject'];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09>",
  18266. referencedClasses: [],
  18267. messageSends: []
  18268. }),
  18269. $globals.JSObjectProxy.klass);
  18270. $core.addMethod(
  18271. $core.method({
  18272. selector: "compareJSObjectOfProxy:withProxy:",
  18273. protocol: 'proxy',
  18274. fn: function (aProxy,anotherProxy){
  18275. var self=this;
  18276. return $core.withContext(function($ctx1) {
  18277. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18278. return aProxy["@jsObject"] === anotherJSObject;
  18279. return self;
  18280. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18281. },
  18282. args: ["aProxy", "anotherProxy"],
  18283. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  18284. referencedClasses: [],
  18285. messageSends: []
  18286. }),
  18287. $globals.JSObjectProxy.klass);
  18288. $core.addMethod(
  18289. $core.method({
  18290. selector: "forwardMessage:withArguments:ofProxy:",
  18291. protocol: 'proxy',
  18292. fn: function (aString,anArray,aProxy){
  18293. var self=this;
  18294. return $core.withContext(function($ctx1) {
  18295. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18296. ;
  18297. return self;
  18298. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18299. },
  18300. args: ["aString", "anArray", "aProxy"],
  18301. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  18302. referencedClasses: [],
  18303. messageSends: []
  18304. }),
  18305. $globals.JSObjectProxy.klass);
  18306. $core.addMethod(
  18307. $core.method({
  18308. selector: "jsObject:ofProxy:",
  18309. protocol: 'proxy',
  18310. fn: function (aJSObject,aProxy){
  18311. var self=this;
  18312. return $core.withContext(function($ctx1) {
  18313. aProxy['@jsObject'] = aJSObject;
  18314. return self;
  18315. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18316. },
  18317. args: ["aJSObject", "aProxy"],
  18318. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  18319. referencedClasses: [],
  18320. messageSends: []
  18321. }),
  18322. $globals.JSObjectProxy.klass);
  18323. $core.addMethod(
  18324. $core.method({
  18325. selector: "lookupProperty:ofProxy:",
  18326. protocol: 'proxy',
  18327. fn: function (aString,aProxy){
  18328. var self=this;
  18329. return $core.withContext(function($ctx1) {
  18330. return aString in aProxy._jsObject() ? aString : nil;
  18331. return self;
  18332. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18333. },
  18334. args: ["aString", "aProxy"],
  18335. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in aProxy._jsObject() ? aString : nil>",
  18336. referencedClasses: [],
  18337. messageSends: []
  18338. }),
  18339. $globals.JSObjectProxy.klass);
  18340. $core.addMethod(
  18341. $core.method({
  18342. selector: "on:",
  18343. protocol: 'instance creation',
  18344. fn: function (aJSObject){
  18345. var self=this;
  18346. var instance;
  18347. return $core.withContext(function($ctx1) {
  18348. instance=self._new();
  18349. self._jsObject_ofProxy_(aJSObject,instance);
  18350. return instance;
  18351. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18352. },
  18353. args: ["aJSObject"],
  18354. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18355. referencedClasses: [],
  18356. messageSends: ["new", "jsObject:ofProxy:"]
  18357. }),
  18358. $globals.JSObjectProxy.klass);
  18359. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18360. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18361. $core.addMethod(
  18362. $core.method({
  18363. selector: "addElement:",
  18364. protocol: 'accessing',
  18365. fn: function (anObject){
  18366. var self=this;
  18367. return $core.withContext(function($ctx1) {
  18368. self.elements.addElement(anObject);
  18369. return self;
  18370. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18371. },
  18372. args: ["anObject"],
  18373. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  18374. referencedClasses: [],
  18375. messageSends: []
  18376. }),
  18377. $globals.Organizer);
  18378. $core.addMethod(
  18379. $core.method({
  18380. selector: "elements",
  18381. protocol: 'accessing',
  18382. fn: function (){
  18383. var self=this;
  18384. return $core.withContext(function($ctx1) {
  18385. return $recv(self._basicAt_("elements"))._copy();
  18386. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18387. },
  18388. args: [],
  18389. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18390. referencedClasses: [],
  18391. messageSends: ["copy", "basicAt:"]
  18392. }),
  18393. $globals.Organizer);
  18394. $core.addMethod(
  18395. $core.method({
  18396. selector: "removeElement:",
  18397. protocol: 'accessing',
  18398. fn: function (anObject){
  18399. var self=this;
  18400. return $core.withContext(function($ctx1) {
  18401. self.elements.removeElement(anObject);
  18402. return self;
  18403. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18404. },
  18405. args: ["anObject"],
  18406. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  18407. referencedClasses: [],
  18408. messageSends: []
  18409. }),
  18410. $globals.Organizer);
  18411. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18412. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18413. $core.addMethod(
  18414. $core.method({
  18415. selector: "addElement:",
  18416. protocol: 'accessing',
  18417. fn: function (aString){
  18418. var self=this;
  18419. return $core.withContext(function($ctx1) {
  18420. var $1,$3,$2;
  18421. (
  18422. $ctx1.supercall = true,
  18423. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  18424. $ctx1.supercall = false;
  18425. $1=$recv($globals.SystemAnnouncer)._current();
  18426. $3=$recv($globals.ProtocolAdded)._new();
  18427. $recv($3)._protocol_(aString);
  18428. $recv($3)._theClass_(self._theClass());
  18429. $2=$recv($3)._yourself();
  18430. $recv($1)._announce_($2);
  18431. return self;
  18432. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18433. },
  18434. args: ["aString"],
  18435. 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)",
  18436. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18437. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18438. }),
  18439. $globals.ClassOrganizer);
  18440. $core.addMethod(
  18441. $core.method({
  18442. selector: "removeElement:",
  18443. protocol: 'accessing',
  18444. fn: function (aString){
  18445. var self=this;
  18446. return $core.withContext(function($ctx1) {
  18447. var $1,$3,$2;
  18448. (
  18449. $ctx1.supercall = true,
  18450. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18451. $ctx1.supercall = false;
  18452. $1=$recv($globals.SystemAnnouncer)._current();
  18453. $3=$recv($globals.ProtocolRemoved)._new();
  18454. $recv($3)._protocol_(aString);
  18455. $recv($3)._theClass_(self._theClass());
  18456. $2=$recv($3)._yourself();
  18457. $recv($1)._announce_($2);
  18458. return self;
  18459. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18460. },
  18461. args: ["aString"],
  18462. 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)",
  18463. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18464. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18465. }),
  18466. $globals.ClassOrganizer);
  18467. $core.addMethod(
  18468. $core.method({
  18469. selector: "theClass",
  18470. protocol: 'accessing',
  18471. fn: function (){
  18472. var self=this;
  18473. return $core.withContext(function($ctx1) {
  18474. return self.theClass ;
  18475. return self;
  18476. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18477. },
  18478. args: [],
  18479. source: "theClass\x0a\x09< return self.theClass >",
  18480. referencedClasses: [],
  18481. messageSends: []
  18482. }),
  18483. $globals.ClassOrganizer);
  18484. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18485. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18486. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18487. $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'";
  18488. $core.addMethod(
  18489. $core.method({
  18490. selector: "basicImports",
  18491. protocol: 'private',
  18492. fn: function (){
  18493. var self=this;
  18494. return $core.withContext(function($ctx1) {
  18495. return self.imports || [];
  18496. return self;
  18497. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18498. },
  18499. args: [],
  18500. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.imports || []>",
  18501. referencedClasses: [],
  18502. messageSends: []
  18503. }),
  18504. $globals.Package);
  18505. $core.addMethod(
  18506. $core.method({
  18507. selector: "basicName:",
  18508. protocol: 'private',
  18509. fn: function (aString){
  18510. var self=this;
  18511. return $core.withContext(function($ctx1) {
  18512. self.pkgName = aString;
  18513. return self;
  18514. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18515. },
  18516. args: ["aString"],
  18517. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18518. referencedClasses: [],
  18519. messageSends: []
  18520. }),
  18521. $globals.Package);
  18522. $core.addMethod(
  18523. $core.method({
  18524. selector: "basicTransport",
  18525. protocol: 'private',
  18526. fn: function (){
  18527. var self=this;
  18528. return $core.withContext(function($ctx1) {
  18529. return self.transport;
  18530. return self;
  18531. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18532. },
  18533. args: [],
  18534. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  18535. referencedClasses: [],
  18536. messageSends: []
  18537. }),
  18538. $globals.Package);
  18539. $core.addMethod(
  18540. $core.method({
  18541. selector: "beClean",
  18542. protocol: 'accessing',
  18543. fn: function (){
  18544. var self=this;
  18545. return $core.withContext(function($ctx1) {
  18546. var $1,$3,$2;
  18547. self["@dirty"]=false;
  18548. $1=$recv($globals.SystemAnnouncer)._current();
  18549. $3=$recv($globals.PackageClean)._new();
  18550. $recv($3)._package_(self);
  18551. $2=$recv($3)._yourself();
  18552. $recv($1)._announce_($2);
  18553. return self;
  18554. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18555. },
  18556. args: [],
  18557. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18558. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18559. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18560. }),
  18561. $globals.Package);
  18562. $core.addMethod(
  18563. $core.method({
  18564. selector: "beDirty",
  18565. protocol: 'accessing',
  18566. fn: function (){
  18567. var self=this;
  18568. return $core.withContext(function($ctx1) {
  18569. var $1,$3,$2;
  18570. self["@dirty"]=true;
  18571. $1=$recv($globals.SystemAnnouncer)._current();
  18572. $3=$recv($globals.PackageDirty)._new();
  18573. $recv($3)._package_(self);
  18574. $2=$recv($3)._yourself();
  18575. $recv($1)._announce_($2);
  18576. return self;
  18577. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18578. },
  18579. args: [],
  18580. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18581. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18582. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18583. }),
  18584. $globals.Package);
  18585. $core.addMethod(
  18586. $core.method({
  18587. selector: "classTemplate",
  18588. protocol: 'accessing',
  18589. fn: function (){
  18590. var self=this;
  18591. return $core.withContext(function($ctx1) {
  18592. var $2,$3,$1,$4,$5;
  18593. return $recv($globals.String)._streamContents_((function(stream){
  18594. return $core.withContext(function($ctx2) {
  18595. $recv(stream)._nextPutAll_("Object");
  18596. $ctx2.sendIdx["nextPutAll:"]=1;
  18597. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18598. $ctx2.sendIdx["nextPutAll:"]=2;
  18599. $2=$recv($globals.String)._lf();
  18600. $ctx2.sendIdx["lf"]=1;
  18601. $3=$recv($globals.String)._tab();
  18602. $ctx2.sendIdx["tab"]=1;
  18603. $1=$recv($2).__comma($3);
  18604. $ctx2.sendIdx[","]=1;
  18605. $recv(stream)._nextPutAll_($1);
  18606. $ctx2.sendIdx["nextPutAll:"]=3;
  18607. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18608. $ctx2.sendIdx["nextPutAll:"]=4;
  18609. $4;
  18610. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  18611. $ctx2.sendIdx[","]=2;
  18612. $recv(stream)._nextPutAll_($5);
  18613. $ctx2.sendIdx["nextPutAll:"]=5;
  18614. $recv(stream)._nextPutAll_("package: '");
  18615. $ctx2.sendIdx["nextPutAll:"]=6;
  18616. $recv(stream)._nextPutAll_(self._name());
  18617. $ctx2.sendIdx["nextPutAll:"]=7;
  18618. return $recv(stream)._nextPutAll_("'");
  18619. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18620. }));
  18621. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18622. },
  18623. args: [],
  18624. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  18625. referencedClasses: ["String"],
  18626. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18627. }),
  18628. $globals.Package);
  18629. $core.addMethod(
  18630. $core.method({
  18631. selector: "classes",
  18632. protocol: 'classes',
  18633. fn: function (){
  18634. var self=this;
  18635. return $core.withContext(function($ctx1) {
  18636. return $recv(self._organization())._elements();
  18637. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18638. },
  18639. args: [],
  18640. source: "classes\x0a\x09^ self organization elements",
  18641. referencedClasses: [],
  18642. messageSends: ["elements", "organization"]
  18643. }),
  18644. $globals.Package);
  18645. $core.addMethod(
  18646. $core.method({
  18647. selector: "definition",
  18648. protocol: 'accessing',
  18649. fn: function (){
  18650. var self=this;
  18651. return $core.withContext(function($ctx1) {
  18652. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  18653. return $recv($globals.String)._streamContents_((function(stream){
  18654. return $core.withContext(function($ctx2) {
  18655. $1=$recv(self._class())._name();
  18656. $ctx2.sendIdx["name"]=1;
  18657. $recv(stream)._nextPutAll_($1);
  18658. $ctx2.sendIdx["nextPutAll:"]=1;
  18659. $3=$recv($globals.String)._lf();
  18660. $ctx2.sendIdx["lf"]=1;
  18661. $4=$recv($globals.String)._tab();
  18662. $ctx2.sendIdx["tab"]=1;
  18663. $2=$recv($3).__comma($4);
  18664. $ctx2.sendIdx[","]=1;
  18665. $recv(stream)._nextPutAll_($2);
  18666. $ctx2.sendIdx["nextPutAll:"]=2;
  18667. $recv(stream)._nextPutAll_("named: ");
  18668. $ctx2.sendIdx["nextPutAll:"]=3;
  18669. $6="'".__comma(self._name());
  18670. $ctx2.sendIdx[","]=3;
  18671. $5=$recv($6).__comma("'");
  18672. $ctx2.sendIdx[","]=2;
  18673. $recv(stream)._nextPutAll_($5);
  18674. $ctx2.sendIdx["nextPutAll:"]=4;
  18675. $8=$recv($globals.String)._lf();
  18676. $ctx2.sendIdx["lf"]=2;
  18677. $9=$recv($globals.String)._tab();
  18678. $ctx2.sendIdx["tab"]=2;
  18679. $7=$recv($8).__comma($9);
  18680. $ctx2.sendIdx[","]=4;
  18681. $recv(stream)._nextPutAll_($7);
  18682. $ctx2.sendIdx["nextPutAll:"]=5;
  18683. $recv(stream)._nextPutAll_("imports: ");
  18684. $ctx2.sendIdx["nextPutAll:"]=6;
  18685. $recv(stream)._nextPutAll_(self._importsDefinition());
  18686. $ctx2.sendIdx["nextPutAll:"]=7;
  18687. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  18688. $ctx2.sendIdx[","]=5;
  18689. $recv(stream)._nextPutAll_($10);
  18690. $ctx2.sendIdx["nextPutAll:"]=8;
  18691. $recv(stream)._nextPutAll_("transport: (");
  18692. $ctx2.sendIdx["nextPutAll:"]=9;
  18693. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18694. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18695. }));
  18696. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18697. },
  18698. args: [],
  18699. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'imports: ';\x0a\x09\x09\x09nextPutAll: self importsDefinition;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  18700. referencedClasses: ["String"],
  18701. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18702. }),
  18703. $globals.Package);
  18704. $core.addMethod(
  18705. $core.method({
  18706. selector: "imports",
  18707. protocol: 'accessing',
  18708. fn: function (){
  18709. var self=this;
  18710. return $core.withContext(function($ctx1) {
  18711. var $1,$receiver;
  18712. $1=self["@imports"];
  18713. if(($receiver = $1) == null || $receiver.isNil){
  18714. var parsed;
  18715. parsed=self._importsFromJson_(self._basicImports());
  18716. parsed;
  18717. self._imports_(parsed);
  18718. return self["@imports"];
  18719. } else {
  18720. return $1;
  18721. };
  18722. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18723. },
  18724. args: [],
  18725. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  18726. referencedClasses: [],
  18727. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18728. }),
  18729. $globals.Package);
  18730. $core.addMethod(
  18731. $core.method({
  18732. selector: "imports:",
  18733. protocol: 'accessing',
  18734. fn: function (anArray){
  18735. var self=this;
  18736. return $core.withContext(function($ctx1) {
  18737. self._validateImports_(anArray);
  18738. self["@imports"]=$recv(anArray)._asSet();
  18739. return self;
  18740. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18741. },
  18742. args: ["anArray"],
  18743. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18744. referencedClasses: [],
  18745. messageSends: ["validateImports:", "asSet"]
  18746. }),
  18747. $globals.Package);
  18748. $core.addMethod(
  18749. $core.method({
  18750. selector: "importsAsJson",
  18751. protocol: 'converting',
  18752. fn: function (){
  18753. var self=this;
  18754. return $core.withContext(function($ctx1) {
  18755. var $1;
  18756. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  18757. return $core.withContext(function($ctx2) {
  18758. $1=$recv(each)._isString();
  18759. if($core.assert($1)){
  18760. return each;
  18761. } else {
  18762. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18763. $ctx2.sendIdx[","]=1;
  18764. };
  18765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18766. }));
  18767. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18768. },
  18769. args: [],
  18770. 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 ]]",
  18771. referencedClasses: [],
  18772. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18773. }),
  18774. $globals.Package);
  18775. $core.addMethod(
  18776. $core.method({
  18777. selector: "importsDefinition",
  18778. protocol: 'accessing',
  18779. fn: function (){
  18780. var self=this;
  18781. return $core.withContext(function($ctx1) {
  18782. return $recv($globals.String)._streamContents_((function(stream){
  18783. return $core.withContext(function($ctx2) {
  18784. $recv(stream)._nextPutAll_("{");
  18785. $ctx2.sendIdx["nextPutAll:"]=1;
  18786. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18787. return $core.withContext(function($ctx3) {
  18788. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18789. $ctx3.sendIdx["nextPutAll:"]=2;
  18790. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18791. }),(function(){
  18792. return $core.withContext(function($ctx3) {
  18793. return $recv(stream)._nextPutAll_(". ");
  18794. $ctx3.sendIdx["nextPutAll:"]=3;
  18795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18796. }));
  18797. return $recv(stream)._nextPutAll_("}");
  18798. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18799. }));
  18800. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18801. },
  18802. args: [],
  18803. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each importsString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]",
  18804. referencedClasses: ["String"],
  18805. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18806. }),
  18807. $globals.Package);
  18808. $core.addMethod(
  18809. $core.method({
  18810. selector: "importsFromJson:",
  18811. protocol: 'converting',
  18812. fn: function (anArray){
  18813. var self=this;
  18814. return $core.withContext(function($ctx1) {
  18815. var $1;
  18816. return $recv(anArray)._collect_((function(each){
  18817. var split;
  18818. return $core.withContext(function($ctx2) {
  18819. split=$recv(each)._tokenize_("=");
  18820. split;
  18821. $1=$recv($recv(split)._size()).__eq((1));
  18822. if($core.assert($1)){
  18823. return $recv(split)._first();
  18824. $ctx2.sendIdx["first"]=1;
  18825. } else {
  18826. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18827. };
  18828. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18829. }));
  18830. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18831. },
  18832. args: ["anArray"],
  18833. 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 ]]",
  18834. referencedClasses: [],
  18835. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18836. }),
  18837. $globals.Package);
  18838. $core.addMethod(
  18839. $core.method({
  18840. selector: "isDirty",
  18841. protocol: 'testing',
  18842. fn: function (){
  18843. var self=this;
  18844. return $core.withContext(function($ctx1) {
  18845. var $1,$receiver;
  18846. $1=self["@dirty"];
  18847. if(($receiver = $1) == null || $receiver.isNil){
  18848. return false;
  18849. } else {
  18850. return $1;
  18851. };
  18852. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18853. },
  18854. args: [],
  18855. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18856. referencedClasses: [],
  18857. messageSends: ["ifNil:"]
  18858. }),
  18859. $globals.Package);
  18860. $core.addMethod(
  18861. $core.method({
  18862. selector: "isPackage",
  18863. protocol: 'testing',
  18864. fn: function (){
  18865. var self=this;
  18866. return true;
  18867. },
  18868. args: [],
  18869. source: "isPackage\x0a\x09^ true",
  18870. referencedClasses: [],
  18871. messageSends: []
  18872. }),
  18873. $globals.Package);
  18874. $core.addMethod(
  18875. $core.method({
  18876. selector: "loadDependencies",
  18877. protocol: 'dependencies',
  18878. fn: function (){
  18879. var self=this;
  18880. var classes,packages;
  18881. return $core.withContext(function($ctx1) {
  18882. var $1;
  18883. classes=self._loadDependencyClasses();
  18884. $1=$recv($recv(classes)._collect_((function(each){
  18885. return $core.withContext(function($ctx2) {
  18886. return $recv(each)._package();
  18887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18888. })))._asSet();
  18889. $recv($1)._remove_ifAbsent_(self,(function(){
  18890. }));
  18891. return $recv($1)._yourself();
  18892. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18893. },
  18894. args: [],
  18895. 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",
  18896. referencedClasses: [],
  18897. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18898. }),
  18899. $globals.Package);
  18900. $core.addMethod(
  18901. $core.method({
  18902. selector: "loadDependencyClasses",
  18903. protocol: 'dependencies',
  18904. fn: function (){
  18905. var self=this;
  18906. var starCategoryName;
  18907. return $core.withContext(function($ctx1) {
  18908. var $3,$2,$1,$5,$4;
  18909. starCategoryName="*".__comma(self._name());
  18910. $ctx1.sendIdx[","]=1;
  18911. $3=self._classes();
  18912. $ctx1.sendIdx["classes"]=1;
  18913. $2=$recv($3)._collect_((function(each){
  18914. return $core.withContext(function($ctx2) {
  18915. return $recv(each)._superclass();
  18916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18917. }));
  18918. $1=$recv($2)._asSet();
  18919. $recv($1)._remove_ifAbsent_(nil,(function(){
  18920. }));
  18921. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  18922. return $core.withContext(function($ctx2) {
  18923. $5=$recv(each)._protocols();
  18924. $ctx2.sendIdx["protocols"]=1;
  18925. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  18926. return $recv($4)._includes_(starCategoryName);
  18927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18928. })));
  18929. return $recv($1)._yourself();
  18930. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18931. },
  18932. args: [],
  18933. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  18934. referencedClasses: ["Smalltalk"],
  18935. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18936. }),
  18937. $globals.Package);
  18938. $core.addMethod(
  18939. $core.method({
  18940. selector: "name",
  18941. protocol: 'accessing',
  18942. fn: function (){
  18943. var self=this;
  18944. return $core.withContext(function($ctx1) {
  18945. return self.pkgName;
  18946. return self;
  18947. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18948. },
  18949. args: [],
  18950. source: "name\x0a\x09<return self.pkgName>",
  18951. referencedClasses: [],
  18952. messageSends: []
  18953. }),
  18954. $globals.Package);
  18955. $core.addMethod(
  18956. $core.method({
  18957. selector: "name:",
  18958. protocol: 'accessing',
  18959. fn: function (aString){
  18960. var self=this;
  18961. return $core.withContext(function($ctx1) {
  18962. self._basicName_(aString);
  18963. self._beDirty();
  18964. return self;
  18965. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18966. },
  18967. args: ["aString"],
  18968. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18969. referencedClasses: [],
  18970. messageSends: ["basicName:", "beDirty"]
  18971. }),
  18972. $globals.Package);
  18973. $core.addMethod(
  18974. $core.method({
  18975. selector: "organization",
  18976. protocol: 'accessing',
  18977. fn: function (){
  18978. var self=this;
  18979. return $core.withContext(function($ctx1) {
  18980. return self._basicAt_("organization");
  18981. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18982. },
  18983. args: [],
  18984. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18985. referencedClasses: [],
  18986. messageSends: ["basicAt:"]
  18987. }),
  18988. $globals.Package);
  18989. $core.addMethod(
  18990. $core.method({
  18991. selector: "printOn:",
  18992. protocol: 'printing',
  18993. fn: function (aStream){
  18994. var self=this;
  18995. return $core.withContext(function($ctx1) {
  18996. (
  18997. $ctx1.supercall = true,
  18998. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18999. $ctx1.supercall = false;
  19000. $recv(aStream)._nextPutAll_(" (");
  19001. $ctx1.sendIdx["nextPutAll:"]=1;
  19002. $recv(aStream)._nextPutAll_(self._name());
  19003. $ctx1.sendIdx["nextPutAll:"]=2;
  19004. $recv(aStream)._nextPutAll_(")");
  19005. return self;
  19006. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19007. },
  19008. args: ["aStream"],
  19009. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19010. referencedClasses: [],
  19011. messageSends: ["printOn:", "nextPutAll:", "name"]
  19012. }),
  19013. $globals.Package);
  19014. $core.addMethod(
  19015. $core.method({
  19016. selector: "setupClasses",
  19017. protocol: 'classes',
  19018. fn: function (){
  19019. var self=this;
  19020. return $core.withContext(function($ctx1) {
  19021. var $1;
  19022. $1=self._classes();
  19023. $recv($1)._do_((function(each){
  19024. return $core.withContext(function($ctx2) {
  19025. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19027. }));
  19028. $ctx1.sendIdx["do:"]=1;
  19029. $recv($1)._do_((function(each){
  19030. return $core.withContext(function($ctx2) {
  19031. return $recv(each)._initialize();
  19032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19033. }));
  19034. return self;
  19035. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19036. },
  19037. args: [],
  19038. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19039. referencedClasses: ["ClassBuilder"],
  19040. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19041. }),
  19042. $globals.Package);
  19043. $core.addMethod(
  19044. $core.method({
  19045. selector: "sortedClasses",
  19046. protocol: 'classes',
  19047. fn: function (){
  19048. var self=this;
  19049. return $core.withContext(function($ctx1) {
  19050. return $recv(self._class())._sortedClasses_(self._classes());
  19051. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19052. },
  19053. args: [],
  19054. 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",
  19055. referencedClasses: [],
  19056. messageSends: ["sortedClasses:", "class", "classes"]
  19057. }),
  19058. $globals.Package);
  19059. $core.addMethod(
  19060. $core.method({
  19061. selector: "sortedImportsAsArray",
  19062. protocol: 'private',
  19063. fn: function (){
  19064. var self=this;
  19065. return $core.withContext(function($ctx1) {
  19066. var $3,$2,$4,$1,$6,$5,$7;
  19067. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19068. return $core.withContext(function($ctx2) {
  19069. $3=$recv(a)._isString();
  19070. $ctx2.sendIdx["isString"]=1;
  19071. $2=$recv($3)._not();
  19072. $4=$recv(b)._isString();
  19073. $ctx2.sendIdx["isString"]=2;
  19074. $1=$recv($2).__and($4);
  19075. return $recv($1)._or_((function(){
  19076. return $core.withContext(function($ctx3) {
  19077. $6=$recv(a)._isString();
  19078. $ctx3.sendIdx["isString"]=3;
  19079. $5=$recv($6).__eq($recv(b)._isString());
  19080. return $recv($5)._and_((function(){
  19081. return $core.withContext(function($ctx4) {
  19082. $7=$recv(a)._value();
  19083. $ctx4.sendIdx["value"]=1;
  19084. return $recv($7).__lt_eq($recv(b)._value());
  19085. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19086. }));
  19087. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19088. }));
  19089. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19090. }));
  19091. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19092. },
  19093. args: [],
  19094. 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 ]]]",
  19095. referencedClasses: [],
  19096. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19097. }),
  19098. $globals.Package);
  19099. $core.addMethod(
  19100. $core.method({
  19101. selector: "transport",
  19102. protocol: 'accessing',
  19103. fn: function (){
  19104. var self=this;
  19105. return $core.withContext(function($ctx1) {
  19106. var $1,$2,$receiver;
  19107. $1=self["@transport"];
  19108. if(($receiver = $1) == null || $receiver.isNil){
  19109. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19110. $recv($2)._package_(self);
  19111. self["@transport"]=$recv($2)._yourself();
  19112. return self["@transport"];
  19113. } else {
  19114. return $1;
  19115. };
  19116. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19117. },
  19118. args: [],
  19119. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19120. referencedClasses: ["PackageTransport"],
  19121. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19122. }),
  19123. $globals.Package);
  19124. $core.addMethod(
  19125. $core.method({
  19126. selector: "transport:",
  19127. protocol: 'accessing',
  19128. fn: function (aPackageTransport){
  19129. var self=this;
  19130. return $core.withContext(function($ctx1) {
  19131. self["@transport"]=aPackageTransport;
  19132. $recv(aPackageTransport)._package_(self);
  19133. return self;
  19134. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19135. },
  19136. args: ["aPackageTransport"],
  19137. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19138. referencedClasses: [],
  19139. messageSends: ["package:"]
  19140. }),
  19141. $globals.Package);
  19142. $core.addMethod(
  19143. $core.method({
  19144. selector: "validateImports:",
  19145. protocol: 'validation',
  19146. fn: function (aCollection){
  19147. var self=this;
  19148. return $core.withContext(function($ctx1) {
  19149. var $1,$2,$5,$4,$3,$6;
  19150. $recv(aCollection)._do_((function(import_){
  19151. return $core.withContext(function($ctx2) {
  19152. $1=$recv(import_)._isString();
  19153. $ctx2.sendIdx["isString"]=1;
  19154. if(!$core.assert($1)){
  19155. $2=$recv(import_)._respondsTo_("key");
  19156. if(!$core.assert($2)){
  19157. self._error_("Imports must be Strings or Associations");
  19158. $ctx2.sendIdx["error:"]=1;
  19159. };
  19160. $5=$recv(import_)._key();
  19161. $ctx2.sendIdx["key"]=1;
  19162. $4=$recv($5)._isString();
  19163. $ctx2.sendIdx["isString"]=2;
  19164. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19165. if(!$core.assert($3)){
  19166. self._error_("Key and value must be Strings");
  19167. $ctx2.sendIdx["error:"]=2;
  19168. };
  19169. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19170. if(!$core.assert($6)){
  19171. return self._error_("Keys must be identifiers");
  19172. };
  19173. };
  19174. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19175. }));
  19176. return self;
  19177. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19178. },
  19179. args: ["aCollection"],
  19180. 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' ]]]",
  19181. referencedClasses: [],
  19182. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19183. }),
  19184. $globals.Package);
  19185. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19186. $core.addMethod(
  19187. $core.method({
  19188. selector: "named:",
  19189. protocol: 'accessing',
  19190. fn: function (aPackageName){
  19191. var self=this;
  19192. return $core.withContext(function($ctx1) {
  19193. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19194. return $core.withContext(function($ctx2) {
  19195. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19197. }));
  19198. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19199. },
  19200. args: ["aPackageName"],
  19201. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19202. referencedClasses: ["Smalltalk"],
  19203. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19204. }),
  19205. $globals.Package.klass);
  19206. $core.addMethod(
  19207. $core.method({
  19208. selector: "named:ifAbsent:",
  19209. protocol: 'accessing',
  19210. fn: function (aPackageName,aBlock){
  19211. var self=this;
  19212. return $core.withContext(function($ctx1) {
  19213. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19214. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19215. },
  19216. args: ["aPackageName", "aBlock"],
  19217. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19218. referencedClasses: ["Smalltalk"],
  19219. messageSends: ["packageAt:ifAbsent:"]
  19220. }),
  19221. $globals.Package.klass);
  19222. $core.addMethod(
  19223. $core.method({
  19224. selector: "named:imports:transport:",
  19225. protocol: 'accessing',
  19226. fn: function (aPackageName,anArray,aTransport){
  19227. var self=this;
  19228. var package_;
  19229. return $core.withContext(function($ctx1) {
  19230. package_=self._named_(aPackageName);
  19231. $recv(package_)._imports_(anArray);
  19232. $recv(package_)._transport_(aTransport);
  19233. return package_;
  19234. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19235. },
  19236. args: ["aPackageName", "anArray", "aTransport"],
  19237. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19238. referencedClasses: [],
  19239. messageSends: ["named:", "imports:", "transport:"]
  19240. }),
  19241. $globals.Package.klass);
  19242. $core.addMethod(
  19243. $core.method({
  19244. selector: "named:transport:",
  19245. protocol: 'accessing',
  19246. fn: function (aPackageName,aTransport){
  19247. var self=this;
  19248. var package_;
  19249. return $core.withContext(function($ctx1) {
  19250. package_=self._named_(aPackageName);
  19251. $recv(package_)._transport_(aTransport);
  19252. return package_;
  19253. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19254. },
  19255. args: ["aPackageName", "aTransport"],
  19256. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19257. referencedClasses: [],
  19258. messageSends: ["named:", "transport:"]
  19259. }),
  19260. $globals.Package.klass);
  19261. $core.addMethod(
  19262. $core.method({
  19263. selector: "sortedClasses:",
  19264. protocol: 'sorting',
  19265. fn: function (classes){
  19266. var self=this;
  19267. var children,others,nodes,expandedClasses;
  19268. return $core.withContext(function($ctx1) {
  19269. var $1,$3,$2;
  19270. children=[];
  19271. others=[];
  19272. $recv(classes)._do_((function(each){
  19273. return $core.withContext(function($ctx2) {
  19274. $1=$recv(classes)._includes_($recv(each)._superclass());
  19275. if($core.assert($1)){
  19276. return $recv(others)._add_(each);
  19277. } else {
  19278. return $recv(children)._add_(each);
  19279. $ctx2.sendIdx["add:"]=1;
  19280. };
  19281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19282. }));
  19283. $ctx1.sendIdx["do:"]=1;
  19284. nodes=$recv(children)._collect_((function(each){
  19285. return $core.withContext(function($ctx2) {
  19286. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19288. }));
  19289. nodes=$recv(nodes)._sorted_((function(a,b){
  19290. return $core.withContext(function($ctx2) {
  19291. $3=$recv(a)._theClass();
  19292. $ctx2.sendIdx["theClass"]=1;
  19293. $2=$recv($3)._name();
  19294. $ctx2.sendIdx["name"]=1;
  19295. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19296. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19297. }));
  19298. expandedClasses=$recv($globals.Array)._new();
  19299. $recv(nodes)._do_((function(aNode){
  19300. return $core.withContext(function($ctx2) {
  19301. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19302. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19303. }));
  19304. return expandedClasses;
  19305. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19306. },
  19307. args: ["classes"],
  19308. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  19309. referencedClasses: ["ClassSorterNode", "Array"],
  19310. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19311. }),
  19312. $globals.Package.klass);
  19313. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19314. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19315. $core.addMethod(
  19316. $core.method({
  19317. selector: "announcer",
  19318. protocol: 'accessing',
  19319. fn: function (){
  19320. var self=this;
  19321. return $core.withContext(function($ctx1) {
  19322. return $recv($globals.SystemAnnouncer)._current();
  19323. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19324. },
  19325. args: [],
  19326. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19327. referencedClasses: ["SystemAnnouncer"],
  19328. messageSends: ["current"]
  19329. }),
  19330. $globals.PackageStateObserver);
  19331. $core.addMethod(
  19332. $core.method({
  19333. selector: "observeSystem",
  19334. protocol: 'actions',
  19335. fn: function (){
  19336. var self=this;
  19337. return $core.withContext(function($ctx1) {
  19338. var $1;
  19339. $1=self._announcer();
  19340. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19341. $ctx1.sendIdx["on:send:to:"]=1;
  19342. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19343. $ctx1.sendIdx["on:send:to:"]=2;
  19344. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19345. $ctx1.sendIdx["on:send:to:"]=3;
  19346. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19347. return self;
  19348. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19349. },
  19350. args: [],
  19351. 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",
  19352. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19353. messageSends: ["on:send:to:", "announcer"]
  19354. }),
  19355. $globals.PackageStateObserver);
  19356. $core.addMethod(
  19357. $core.method({
  19358. selector: "onClassModification:",
  19359. protocol: 'reactions',
  19360. fn: function (anAnnouncement){
  19361. var self=this;
  19362. return $core.withContext(function($ctx1) {
  19363. var $1,$receiver;
  19364. $1=$recv(anAnnouncement)._theClass();
  19365. if(($receiver = $1) == null || $receiver.isNil){
  19366. $1;
  19367. } else {
  19368. var theClass;
  19369. theClass=$receiver;
  19370. $recv($recv(theClass)._package())._beDirty();
  19371. };
  19372. return self;
  19373. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19374. },
  19375. args: ["anAnnouncement"],
  19376. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19377. referencedClasses: [],
  19378. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19379. }),
  19380. $globals.PackageStateObserver);
  19381. $core.addMethod(
  19382. $core.method({
  19383. selector: "onMethodModification:",
  19384. protocol: 'reactions',
  19385. fn: function (anAnnouncement){
  19386. var self=this;
  19387. return $core.withContext(function($ctx1) {
  19388. var $1,$receiver;
  19389. $1=$recv($recv(anAnnouncement)._method())._package();
  19390. if(($receiver = $1) == null || $receiver.isNil){
  19391. $1;
  19392. } else {
  19393. var package_;
  19394. package_=$receiver;
  19395. $recv(package_)._beDirty();
  19396. };
  19397. return self;
  19398. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19399. },
  19400. args: ["anAnnouncement"],
  19401. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19402. referencedClasses: [],
  19403. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19404. }),
  19405. $globals.PackageStateObserver);
  19406. $core.addMethod(
  19407. $core.method({
  19408. selector: "onPackageAdded:",
  19409. protocol: 'reactions',
  19410. fn: function (anAnnouncement){
  19411. var self=this;
  19412. return $core.withContext(function($ctx1) {
  19413. $recv($recv(anAnnouncement)._package())._beDirty();
  19414. return self;
  19415. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19416. },
  19417. args: ["anAnnouncement"],
  19418. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19419. referencedClasses: [],
  19420. messageSends: ["beDirty", "package"]
  19421. }),
  19422. $globals.PackageStateObserver);
  19423. $core.addMethod(
  19424. $core.method({
  19425. selector: "onProtocolModification:",
  19426. protocol: 'reactions',
  19427. fn: function (anAnnouncement){
  19428. var self=this;
  19429. return $core.withContext(function($ctx1) {
  19430. var $1,$receiver;
  19431. $1=$recv(anAnnouncement)._package();
  19432. if(($receiver = $1) == null || $receiver.isNil){
  19433. $1;
  19434. } else {
  19435. var package_;
  19436. package_=$receiver;
  19437. $recv(package_)._beDirty();
  19438. };
  19439. return self;
  19440. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19441. },
  19442. args: ["anAnnouncement"],
  19443. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19444. referencedClasses: [],
  19445. messageSends: ["ifNotNil:", "package", "beDirty"]
  19446. }),
  19447. $globals.PackageStateObserver);
  19448. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "current",
  19452. protocol: 'accessing',
  19453. fn: function (){
  19454. var self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. var $1,$receiver;
  19457. $1=self["@current"];
  19458. if(($receiver = $1) == null || $receiver.isNil){
  19459. self["@current"]=self._new();
  19460. return self["@current"];
  19461. } else {
  19462. return $1;
  19463. };
  19464. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19465. },
  19466. args: [],
  19467. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19468. referencedClasses: [],
  19469. messageSends: ["ifNil:", "new"]
  19470. }),
  19471. $globals.PackageStateObserver.klass);
  19472. $core.addMethod(
  19473. $core.method({
  19474. selector: "initialize",
  19475. protocol: 'initialization',
  19476. fn: function (){
  19477. var self=this;
  19478. return $core.withContext(function($ctx1) {
  19479. $recv(self._current())._observeSystem();
  19480. return self;
  19481. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19482. },
  19483. args: [],
  19484. source: "initialize\x0a\x09self current observeSystem",
  19485. referencedClasses: [],
  19486. messageSends: ["observeSystem", "current"]
  19487. }),
  19488. $globals.PackageStateObserver.klass);
  19489. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19490. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19491. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  19492. $globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  19493. $core.addMethod(
  19494. $core.method({
  19495. selector: "basicSignal:",
  19496. protocol: 'error handling',
  19497. fn: function (anError){
  19498. var self=this;
  19499. return $core.withContext(function($ctx1) {
  19500. throw anError;
  19501. return self;
  19502. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19503. },
  19504. args: ["anError"],
  19505. source: "basicSignal: anError\x0a <throw anError>",
  19506. referencedClasses: [],
  19507. messageSends: []
  19508. }),
  19509. $globals.RethrowErrorHandler);
  19510. $core.addMethod(
  19511. $core.method({
  19512. selector: "handleError:",
  19513. protocol: 'error handling',
  19514. fn: function (anError){
  19515. var self=this;
  19516. return $core.withContext(function($ctx1) {
  19517. self._basicSignal_(anError);
  19518. return self;
  19519. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19520. },
  19521. args: ["anError"],
  19522. source: "handleError: anError\x0a self basicSignal: anError",
  19523. referencedClasses: [],
  19524. messageSends: ["basicSignal:"]
  19525. }),
  19526. $globals.RethrowErrorHandler);
  19527. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19528. $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`";
  19529. $core.addMethod(
  19530. $core.method({
  19531. selector: "defaultValue",
  19532. protocol: 'accessing',
  19533. fn: function (){
  19534. var self=this;
  19535. return self["@defaultValue"];
  19536. },
  19537. args: [],
  19538. source: "defaultValue\x0a\x09^ defaultValue",
  19539. referencedClasses: [],
  19540. messageSends: []
  19541. }),
  19542. $globals.Setting);
  19543. $core.addMethod(
  19544. $core.method({
  19545. selector: "defaultValue:",
  19546. protocol: 'accessing',
  19547. fn: function (aStringifiableObject){
  19548. var self=this;
  19549. self["@defaultValue"]=aStringifiableObject;
  19550. return self;
  19551. },
  19552. args: ["aStringifiableObject"],
  19553. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19554. referencedClasses: [],
  19555. messageSends: []
  19556. }),
  19557. $globals.Setting);
  19558. $core.addMethod(
  19559. $core.method({
  19560. selector: "key",
  19561. protocol: 'accessing',
  19562. fn: function (){
  19563. var self=this;
  19564. return self["@key"];
  19565. },
  19566. args: [],
  19567. source: "key\x0a\x09^ key",
  19568. referencedClasses: [],
  19569. messageSends: []
  19570. }),
  19571. $globals.Setting);
  19572. $core.addMethod(
  19573. $core.method({
  19574. selector: "key:",
  19575. protocol: 'accessing',
  19576. fn: function (aString){
  19577. var self=this;
  19578. self["@key"]=aString;
  19579. return self;
  19580. },
  19581. args: ["aString"],
  19582. source: "key: aString\x0a\x09key := aString",
  19583. referencedClasses: [],
  19584. messageSends: []
  19585. }),
  19586. $globals.Setting);
  19587. $core.addMethod(
  19588. $core.method({
  19589. selector: "value",
  19590. protocol: 'accessing',
  19591. fn: function (){
  19592. var self=this;
  19593. return $core.withContext(function($ctx1) {
  19594. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19595. return $core.withContext(function($ctx2) {
  19596. return self._defaultValue();
  19597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19598. }));
  19599. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19600. },
  19601. args: [],
  19602. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19603. referencedClasses: ["Smalltalk"],
  19604. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19605. }),
  19606. $globals.Setting);
  19607. $core.addMethod(
  19608. $core.method({
  19609. selector: "value:",
  19610. protocol: 'accessing',
  19611. fn: function (aStringifiableObject){
  19612. var self=this;
  19613. return $core.withContext(function($ctx1) {
  19614. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  19615. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19616. },
  19617. args: ["aStringifiableObject"],
  19618. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19619. referencedClasses: ["Smalltalk"],
  19620. messageSends: ["at:put:", "settings", "key"]
  19621. }),
  19622. $globals.Setting);
  19623. $core.addMethod(
  19624. $core.method({
  19625. selector: "at:ifAbsent:",
  19626. protocol: 'instance creation',
  19627. fn: function (aString,aDefaultValue){
  19628. var self=this;
  19629. return $core.withContext(function($ctx1) {
  19630. var $1;
  19631. $1=(
  19632. $ctx1.supercall = true,
  19633. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  19634. $ctx1.supercall = false;
  19635. $recv($1)._key_(aString);
  19636. $recv($1)._defaultValue_(aDefaultValue);
  19637. return $recv($1)._yourself();
  19638. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19639. },
  19640. args: ["aString", "aDefaultValue"],
  19641. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19642. referencedClasses: [],
  19643. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19644. }),
  19645. $globals.Setting.klass);
  19646. $core.addMethod(
  19647. $core.method({
  19648. selector: "new",
  19649. protocol: 'instance creation',
  19650. fn: function (){
  19651. var self=this;
  19652. return $core.withContext(function($ctx1) {
  19653. self._shouldNotImplement();
  19654. return self;
  19655. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19656. },
  19657. args: [],
  19658. source: "new\x0a\x09self shouldNotImplement",
  19659. referencedClasses: [],
  19660. messageSends: ["shouldNotImplement"]
  19661. }),
  19662. $globals.Setting.klass);
  19663. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19664. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  19665. $core.addMethod(
  19666. $core.method({
  19667. selector: "addGlobalJsVariable:",
  19668. protocol: 'globals',
  19669. fn: function (aString){
  19670. var self=this;
  19671. return $core.withContext(function($ctx1) {
  19672. $recv(self._globalJsVariables())._add_(aString);
  19673. return self;
  19674. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19675. },
  19676. args: ["aString"],
  19677. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19678. referencedClasses: [],
  19679. messageSends: ["add:", "globalJsVariables"]
  19680. }),
  19681. $globals.SmalltalkImage);
  19682. $core.addMethod(
  19683. $core.method({
  19684. selector: "amdRequire",
  19685. protocol: 'accessing amd',
  19686. fn: function (){
  19687. var self=this;
  19688. return $core.withContext(function($ctx1) {
  19689. return $recv(self._core())._at_("amdRequire");
  19690. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19691. },
  19692. args: [],
  19693. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19694. referencedClasses: [],
  19695. messageSends: ["at:", "core"]
  19696. }),
  19697. $globals.SmalltalkImage);
  19698. $core.addMethod(
  19699. $core.method({
  19700. selector: "asSmalltalkException:",
  19701. protocol: 'error handling',
  19702. fn: function (anObject){
  19703. var self=this;
  19704. return $core.withContext(function($ctx1) {
  19705. var $1;
  19706. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19707. return $core.withContext(function($ctx2) {
  19708. return $recv(anObject)._isKindOf_($globals.Error);
  19709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19710. }));
  19711. if($core.assert($1)){
  19712. return anObject;
  19713. } else {
  19714. return $recv($globals.JavaScriptException)._on_(anObject);
  19715. };
  19716. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19717. },
  19718. args: ["anObject"],
  19719. 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 ]",
  19720. referencedClasses: ["Error", "JavaScriptException"],
  19721. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19722. }),
  19723. $globals.SmalltalkImage);
  19724. $core.addMethod(
  19725. $core.method({
  19726. selector: "basicCreatePackage:",
  19727. protocol: 'private',
  19728. fn: function (packageName){
  19729. var self=this;
  19730. return $core.withContext(function($ctx1) {
  19731. return $core.addPackage(packageName);
  19732. return self;
  19733. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19734. },
  19735. args: ["packageName"],
  19736. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return $core.addPackage(packageName)>",
  19737. referencedClasses: [],
  19738. messageSends: []
  19739. }),
  19740. $globals.SmalltalkImage);
  19741. $core.addMethod(
  19742. $core.method({
  19743. selector: "basicParse:",
  19744. protocol: 'private',
  19745. fn: function (aString){
  19746. var self=this;
  19747. return $core.withContext(function($ctx1) {
  19748. return $recv($globals.SmalltalkParser)._parse_(aString);
  19749. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19750. },
  19751. args: ["aString"],
  19752. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19753. referencedClasses: ["SmalltalkParser"],
  19754. messageSends: ["parse:"]
  19755. }),
  19756. $globals.SmalltalkImage);
  19757. $core.addMethod(
  19758. $core.method({
  19759. selector: "basicRegisterPackage:",
  19760. protocol: 'private',
  19761. fn: function (aPackage){
  19762. var self=this;
  19763. return $core.withContext(function($ctx1) {
  19764. $core.packages[aPackage.pkgName]=aPackage;
  19765. return self;
  19766. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19767. },
  19768. args: ["aPackage"],
  19769. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19770. referencedClasses: [],
  19771. messageSends: []
  19772. }),
  19773. $globals.SmalltalkImage);
  19774. $core.addMethod(
  19775. $core.method({
  19776. selector: "cancelOptOut:",
  19777. protocol: 'accessing',
  19778. fn: function (anObject){
  19779. var self=this;
  19780. return $core.withContext(function($ctx1) {
  19781. delete anObject.klass;
  19782. return self;
  19783. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19784. },
  19785. args: ["anObject"],
  19786. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<delete anObject.klass>",
  19787. referencedClasses: [],
  19788. messageSends: []
  19789. }),
  19790. $globals.SmalltalkImage);
  19791. $core.addMethod(
  19792. $core.method({
  19793. selector: "classes",
  19794. protocol: 'classes',
  19795. fn: function (){
  19796. var self=this;
  19797. return $core.withContext(function($ctx1) {
  19798. return $core.classes();
  19799. return self;
  19800. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19801. },
  19802. args: [],
  19803. source: "classes\x0a\x09<return $core.classes()>",
  19804. referencedClasses: [],
  19805. messageSends: []
  19806. }),
  19807. $globals.SmalltalkImage);
  19808. $core.addMethod(
  19809. $core.method({
  19810. selector: "core",
  19811. protocol: 'accessing',
  19812. fn: function (){
  19813. var self=this;
  19814. return $core.withContext(function($ctx1) {
  19815. return $core;
  19816. return self;
  19817. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19818. },
  19819. args: [],
  19820. source: "core\x0a\x09<return $core>",
  19821. referencedClasses: [],
  19822. messageSends: []
  19823. }),
  19824. $globals.SmalltalkImage);
  19825. $core.addMethod(
  19826. $core.method({
  19827. selector: "createPackage:",
  19828. protocol: 'packages',
  19829. fn: function (packageName){
  19830. var self=this;
  19831. var package_,announcement;
  19832. return $core.withContext(function($ctx1) {
  19833. var $1;
  19834. package_=self._basicCreatePackage_(packageName);
  19835. $1=$recv($globals.PackageAdded)._new();
  19836. $recv($1)._package_(package_);
  19837. announcement=$recv($1)._yourself();
  19838. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  19839. return package_;
  19840. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19841. },
  19842. args: ["packageName"],
  19843. 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",
  19844. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19845. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19846. }),
  19847. $globals.SmalltalkImage);
  19848. $core.addMethod(
  19849. $core.method({
  19850. selector: "defaultAmdNamespace",
  19851. protocol: 'accessing amd',
  19852. fn: function (){
  19853. var self=this;
  19854. return $core.withContext(function($ctx1) {
  19855. return "transport.defaultAmdNamespace"._settingValue();
  19856. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19857. },
  19858. args: [],
  19859. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19860. referencedClasses: [],
  19861. messageSends: ["settingValue"]
  19862. }),
  19863. $globals.SmalltalkImage);
  19864. $core.addMethod(
  19865. $core.method({
  19866. selector: "defaultAmdNamespace:",
  19867. protocol: 'accessing amd',
  19868. fn: function (aString){
  19869. var self=this;
  19870. return $core.withContext(function($ctx1) {
  19871. "transport.defaultAmdNamespace"._settingValue_(aString);
  19872. return self;
  19873. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19874. },
  19875. args: ["aString"],
  19876. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19877. referencedClasses: [],
  19878. messageSends: ["settingValue:"]
  19879. }),
  19880. $globals.SmalltalkImage);
  19881. $core.addMethod(
  19882. $core.method({
  19883. selector: "deleteClass:",
  19884. protocol: 'private',
  19885. fn: function (aClass){
  19886. var self=this;
  19887. return $core.withContext(function($ctx1) {
  19888. $core.removeClass(aClass);
  19889. return self;
  19890. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19891. },
  19892. args: ["aClass"],
  19893. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19894. referencedClasses: [],
  19895. messageSends: []
  19896. }),
  19897. $globals.SmalltalkImage);
  19898. $core.addMethod(
  19899. $core.method({
  19900. selector: "deleteGlobalJsVariable:",
  19901. protocol: 'globals',
  19902. fn: function (aString){
  19903. var self=this;
  19904. return $core.withContext(function($ctx1) {
  19905. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19906. }));
  19907. return self;
  19908. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19909. },
  19910. args: ["aString"],
  19911. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19912. referencedClasses: [],
  19913. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19914. }),
  19915. $globals.SmalltalkImage);
  19916. $core.addMethod(
  19917. $core.method({
  19918. selector: "deletePackage:",
  19919. protocol: 'private',
  19920. fn: function (packageName){
  19921. var self=this;
  19922. return $core.withContext(function($ctx1) {
  19923. delete $core.packages[packageName];
  19924. return self;
  19925. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19926. },
  19927. args: ["packageName"],
  19928. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete $core.packages[packageName]>",
  19929. referencedClasses: [],
  19930. messageSends: []
  19931. }),
  19932. $globals.SmalltalkImage);
  19933. $core.addMethod(
  19934. $core.method({
  19935. selector: "existsJsGlobal:",
  19936. protocol: 'testing',
  19937. fn: function (aString){
  19938. var self=this;
  19939. return $core.withContext(function($ctx1) {
  19940. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19941. return true;
  19942. }),(function(){
  19943. return false;
  19944. }));
  19945. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19946. },
  19947. args: ["aString"],
  19948. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19949. referencedClasses: ["Platform"],
  19950. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19951. }),
  19952. $globals.SmalltalkImage);
  19953. $core.addMethod(
  19954. $core.method({
  19955. selector: "globalJsVariables",
  19956. protocol: 'globals',
  19957. fn: function (){
  19958. var self=this;
  19959. return $core.withContext(function($ctx1) {
  19960. return $core.globalJsVariables;
  19961. return self;
  19962. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19963. },
  19964. args: [],
  19965. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19966. referencedClasses: [],
  19967. messageSends: []
  19968. }),
  19969. $globals.SmalltalkImage);
  19970. $core.addMethod(
  19971. $core.method({
  19972. selector: "globals",
  19973. protocol: 'accessing',
  19974. fn: function (){
  19975. var self=this;
  19976. return $core.withContext(function($ctx1) {
  19977. return $globals;
  19978. return self;
  19979. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19980. },
  19981. args: [],
  19982. source: "globals\x0a\x09<return $globals>",
  19983. referencedClasses: [],
  19984. messageSends: []
  19985. }),
  19986. $globals.SmalltalkImage);
  19987. $core.addMethod(
  19988. $core.method({
  19989. selector: "includesKey:",
  19990. protocol: 'accessing',
  19991. fn: function (aKey){
  19992. var self=this;
  19993. return $core.withContext(function($ctx1) {
  19994. return $core.hasOwnProperty(aKey);
  19995. return self;
  19996. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19997. },
  19998. args: ["aKey"],
  19999. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  20000. referencedClasses: [],
  20001. messageSends: []
  20002. }),
  20003. $globals.SmalltalkImage);
  20004. $core.addMethod(
  20005. $core.method({
  20006. selector: "isSmalltalkObject:",
  20007. protocol: 'testing',
  20008. fn: function (anObject){
  20009. var self=this;
  20010. return $core.withContext(function($ctx1) {
  20011. return anObject.klass != null;
  20012. return self;
  20013. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20014. },
  20015. args: ["anObject"],
  20016. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return anObject.klass != null>",
  20017. referencedClasses: [],
  20018. messageSends: []
  20019. }),
  20020. $globals.SmalltalkImage);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "optOut:",
  20024. protocol: 'accessing',
  20025. fn: function (anObject){
  20026. var self=this;
  20027. return $core.withContext(function($ctx1) {
  20028. anObject.klass = null;
  20029. return self;
  20030. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20031. },
  20032. args: ["anObject"],
  20033. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<anObject.klass = null>",
  20034. referencedClasses: [],
  20035. messageSends: []
  20036. }),
  20037. $globals.SmalltalkImage);
  20038. $core.addMethod(
  20039. $core.method({
  20040. selector: "packageAt:",
  20041. protocol: 'packages',
  20042. fn: function (packageName){
  20043. var self=this;
  20044. return $core.withContext(function($ctx1) {
  20045. return $core.packages[packageName];
  20046. return self;
  20047. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20048. },
  20049. args: ["packageName"],
  20050. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  20051. referencedClasses: [],
  20052. messageSends: []
  20053. }),
  20054. $globals.SmalltalkImage);
  20055. $core.addMethod(
  20056. $core.method({
  20057. selector: "packageAt:ifAbsent:",
  20058. protocol: 'packages',
  20059. fn: function (packageName,aBlock){
  20060. var self=this;
  20061. return $core.withContext(function($ctx1) {
  20062. var $1;
  20063. $1=self._packageAt_(packageName);
  20064. return $recv($1)._ifNil_(aBlock);
  20065. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20066. },
  20067. args: ["packageName", "aBlock"],
  20068. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20069. referencedClasses: [],
  20070. messageSends: ["ifNil:", "packageAt:"]
  20071. }),
  20072. $globals.SmalltalkImage);
  20073. $core.addMethod(
  20074. $core.method({
  20075. selector: "packages",
  20076. protocol: 'packages',
  20077. fn: function (){
  20078. var self=this;
  20079. return $core.withContext(function($ctx1) {
  20080. return Object.keys($core.packages).map(function(k) {
  20081. return $core.packages[k];
  20082. })
  20083. ;
  20084. return self;
  20085. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20086. },
  20087. args: [],
  20088. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09>",
  20089. referencedClasses: [],
  20090. messageSends: []
  20091. }),
  20092. $globals.SmalltalkImage);
  20093. $core.addMethod(
  20094. $core.method({
  20095. selector: "parse:",
  20096. protocol: 'accessing',
  20097. fn: function (aString){
  20098. var self=this;
  20099. var result;
  20100. return $core.withContext(function($ctx1) {
  20101. var $1;
  20102. $recv((function(){
  20103. return $core.withContext(function($ctx2) {
  20104. result=self._basicParse_(aString);
  20105. return result;
  20106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20107. }))._tryCatch_((function(ex){
  20108. return $core.withContext(function($ctx2) {
  20109. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20110. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20111. }));
  20112. $1=result;
  20113. $recv($1)._source_(aString);
  20114. return $recv($1)._yourself();
  20115. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20116. },
  20117. args: ["aString"],
  20118. 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",
  20119. referencedClasses: [],
  20120. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20121. }),
  20122. $globals.SmalltalkImage);
  20123. $core.addMethod(
  20124. $core.method({
  20125. selector: "parseError:parsing:",
  20126. protocol: 'error handling',
  20127. fn: function (anException,aString){
  20128. var self=this;
  20129. return $core.withContext(function($ctx1) {
  20130. var $1,$7,$6,$5,$8,$4,$3,$2;
  20131. $1=$recv($globals.ParseError)._new();
  20132. $7=$recv(anException)._basicAt_("line");
  20133. $ctx1.sendIdx["basicAt:"]=1;
  20134. $6="Parse error on line ".__comma($7);
  20135. $5=$recv($6).__comma(" column ");
  20136. $ctx1.sendIdx[","]=4;
  20137. $8=$recv(anException)._basicAt_("column");
  20138. $ctx1.sendIdx["basicAt:"]=2;
  20139. $4=$recv($5).__comma($8);
  20140. $ctx1.sendIdx[","]=3;
  20141. $3=$recv($4).__comma(" : Unexpected character ");
  20142. $ctx1.sendIdx[","]=2;
  20143. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20144. $ctx1.sendIdx[","]=1;
  20145. return $recv($1)._messageText_($2);
  20146. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20147. },
  20148. args: ["anException", "aString"],
  20149. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  20150. referencedClasses: ["ParseError"],
  20151. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20152. }),
  20153. $globals.SmalltalkImage);
  20154. $core.addMethod(
  20155. $core.method({
  20156. selector: "pseudoVariableNames",
  20157. protocol: 'accessing',
  20158. fn: function (){
  20159. var self=this;
  20160. return ["self", "super", "nil", "true", "false", "thisContext"];
  20161. },
  20162. args: [],
  20163. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20164. referencedClasses: [],
  20165. messageSends: []
  20166. }),
  20167. $globals.SmalltalkImage);
  20168. $core.addMethod(
  20169. $core.method({
  20170. selector: "readJSObject:",
  20171. protocol: 'accessing',
  20172. fn: function (anObject){
  20173. var self=this;
  20174. return $core.withContext(function($ctx1) {
  20175. return $core.readJSObject(anObject);
  20176. return self;
  20177. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20178. },
  20179. args: ["anObject"],
  20180. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  20181. referencedClasses: [],
  20182. messageSends: []
  20183. }),
  20184. $globals.SmalltalkImage);
  20185. $core.addMethod(
  20186. $core.method({
  20187. selector: "removeClass:",
  20188. protocol: 'classes',
  20189. fn: function (aClass){
  20190. var self=this;
  20191. return $core.withContext(function($ctx1) {
  20192. var $1,$2,$4,$3;
  20193. $1=$recv(aClass)._isMetaclass();
  20194. if($core.assert($1)){
  20195. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20196. };
  20197. self._deleteClass_(aClass);
  20198. $2=$recv($globals.SystemAnnouncer)._current();
  20199. $4=$recv($globals.ClassRemoved)._new();
  20200. $recv($4)._theClass_(aClass);
  20201. $3=$recv($4)._yourself();
  20202. $recv($2)._announce_($3);
  20203. return self;
  20204. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20205. },
  20206. args: ["aClass"],
  20207. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  20208. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20209. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20210. }),
  20211. $globals.SmalltalkImage);
  20212. $core.addMethod(
  20213. $core.method({
  20214. selector: "removePackage:",
  20215. protocol: 'packages',
  20216. fn: function (packageName){
  20217. var self=this;
  20218. var pkg;
  20219. return $core.withContext(function($ctx1) {
  20220. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20221. return $core.withContext(function($ctx2) {
  20222. return self._error_("Missing package: ".__comma(packageName));
  20223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20224. }));
  20225. $recv($recv(pkg)._classes())._do_((function(each){
  20226. return $core.withContext(function($ctx2) {
  20227. return self._removeClass_(each);
  20228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20229. }));
  20230. self._deletePackage_(packageName);
  20231. return self;
  20232. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20233. },
  20234. args: ["packageName"],
  20235. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
  20236. referencedClasses: [],
  20237. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20238. }),
  20239. $globals.SmalltalkImage);
  20240. $core.addMethod(
  20241. $core.method({
  20242. selector: "renamePackage:to:",
  20243. protocol: 'packages',
  20244. fn: function (packageName,newName){
  20245. var self=this;
  20246. var pkg;
  20247. return $core.withContext(function($ctx1) {
  20248. var $1,$2,$receiver;
  20249. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20250. return $core.withContext(function($ctx2) {
  20251. $1="Missing package: ".__comma(packageName);
  20252. $ctx2.sendIdx[","]=1;
  20253. return self._error_($1);
  20254. $ctx2.sendIdx["error:"]=1;
  20255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20256. }));
  20257. $2=self._packageAt_(newName);
  20258. if(($receiver = $2) == null || $receiver.isNil){
  20259. $2;
  20260. } else {
  20261. self._error_("Already exists a package called: ".__comma(newName));
  20262. };
  20263. $recv(pkg)._name_(newName);
  20264. self._basicRegisterPackage_(pkg);
  20265. self._deletePackage_(packageName);
  20266. return self;
  20267. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20268. },
  20269. args: ["packageName", "newName"],
  20270. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  20271. referencedClasses: [],
  20272. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20273. }),
  20274. $globals.SmalltalkImage);
  20275. $core.addMethod(
  20276. $core.method({
  20277. selector: "reservedWords",
  20278. protocol: 'accessing',
  20279. fn: function (){
  20280. var self=this;
  20281. return $core.withContext(function($ctx1) {
  20282. return $core.reservedWords;
  20283. return self;
  20284. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20285. },
  20286. args: [],
  20287. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  20288. referencedClasses: [],
  20289. messageSends: []
  20290. }),
  20291. $globals.SmalltalkImage);
  20292. $core.addMethod(
  20293. $core.method({
  20294. selector: "settings",
  20295. protocol: 'accessing',
  20296. fn: function (){
  20297. var self=this;
  20298. return $globals.SmalltalkSettings;
  20299. },
  20300. args: [],
  20301. source: "settings\x0a\x09^ SmalltalkSettings",
  20302. referencedClasses: ["SmalltalkSettings"],
  20303. messageSends: []
  20304. }),
  20305. $globals.SmalltalkImage);
  20306. $core.addMethod(
  20307. $core.method({
  20308. selector: "version",
  20309. protocol: 'accessing',
  20310. fn: function (){
  20311. var self=this;
  20312. return "0.17.0-pre";
  20313. },
  20314. args: [],
  20315. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.17.0-pre'",
  20316. referencedClasses: [],
  20317. messageSends: []
  20318. }),
  20319. $globals.SmalltalkImage);
  20320. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20321. $core.addMethod(
  20322. $core.method({
  20323. selector: "current",
  20324. protocol: 'instance creation',
  20325. fn: function (){
  20326. var self=this;
  20327. return $core.withContext(function($ctx1) {
  20328. var $1,$receiver;
  20329. $1=self["@current"];
  20330. if(($receiver = $1) == null || $receiver.isNil){
  20331. self["@current"]=(
  20332. $ctx1.supercall = true,
  20333. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20334. $ctx1.supercall = false;
  20335. return self["@current"];
  20336. } else {
  20337. self._deprecatedAPI();
  20338. return self["@current"];
  20339. };
  20340. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20341. },
  20342. args: [],
  20343. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20344. referencedClasses: [],
  20345. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20346. }),
  20347. $globals.SmalltalkImage.klass);
  20348. $core.addMethod(
  20349. $core.method({
  20350. selector: "initialize",
  20351. protocol: 'initialization',
  20352. fn: function (){
  20353. var self=this;
  20354. var st;
  20355. return $core.withContext(function($ctx1) {
  20356. st=self._current();
  20357. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20358. return self;
  20359. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20360. },
  20361. args: [],
  20362. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20363. referencedClasses: [],
  20364. messageSends: ["current", "at:put:", "globals"]
  20365. }),
  20366. $globals.SmalltalkImage.klass);
  20367. $core.addMethod(
  20368. $core.method({
  20369. selector: "new",
  20370. protocol: 'instance creation',
  20371. fn: function (){
  20372. var self=this;
  20373. return $core.withContext(function($ctx1) {
  20374. self._shouldNotImplement();
  20375. return self;
  20376. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20377. },
  20378. args: [],
  20379. source: "new\x0a\x09self shouldNotImplement",
  20380. referencedClasses: [],
  20381. messageSends: ["shouldNotImplement"]
  20382. }),
  20383. $globals.SmalltalkImage.klass);
  20384. $core.addMethod(
  20385. $core.method({
  20386. selector: "importsString",
  20387. protocol: '*Kernel-Infrastructure',
  20388. fn: function (){
  20389. var self=this;
  20390. return $core.withContext(function($ctx1) {
  20391. var $3,$2,$1;
  20392. $3=$recv(self._key())._importsString();
  20393. $ctx1.sendIdx["importsString"]=1;
  20394. $2=$recv($3).__comma(" -> ");
  20395. $1=$recv($2).__comma($recv(self._value())._importsString());
  20396. $ctx1.sendIdx[","]=1;
  20397. return $1;
  20398. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20399. },
  20400. args: [],
  20401. source: "importsString\x0a\x09\x22This is for use by package exporter.\x0a\x09It can fail for non-string keys and values.\x22\x0a\x0a\x09^ self key importsString, ' -> ', self value importsString",
  20402. referencedClasses: [],
  20403. messageSends: [",", "importsString", "key", "value"]
  20404. }),
  20405. $globals.Association);
  20406. $core.addMethod(
  20407. $core.method({
  20408. selector: "asJavaScriptPropertyName",
  20409. protocol: '*Kernel-Infrastructure',
  20410. fn: function (){
  20411. var self=this;
  20412. return $core.withContext(function($ctx1) {
  20413. return $core.st2prop(self);
  20414. return self;
  20415. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20416. },
  20417. args: [],
  20418. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  20419. referencedClasses: [],
  20420. messageSends: []
  20421. }),
  20422. $globals.String);
  20423. $core.addMethod(
  20424. $core.method({
  20425. selector: "asSetting",
  20426. protocol: '*Kernel-Infrastructure',
  20427. fn: function (){
  20428. var self=this;
  20429. return $core.withContext(function($ctx1) {
  20430. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20431. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20432. },
  20433. args: [],
  20434. 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",
  20435. referencedClasses: ["Setting"],
  20436. messageSends: ["at:ifAbsent:"]
  20437. }),
  20438. $globals.String);
  20439. $core.addMethod(
  20440. $core.method({
  20441. selector: "asSettingIfAbsent:",
  20442. protocol: '*Kernel-Infrastructure',
  20443. fn: function (aDefaultValue){
  20444. var self=this;
  20445. return $core.withContext(function($ctx1) {
  20446. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20447. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20448. },
  20449. args: ["aDefaultValue"],
  20450. 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",
  20451. referencedClasses: ["Setting"],
  20452. messageSends: ["at:ifAbsent:"]
  20453. }),
  20454. $globals.String);
  20455. $core.addMethod(
  20456. $core.method({
  20457. selector: "importsString",
  20458. protocol: '*Kernel-Infrastructure',
  20459. fn: function (){
  20460. var self=this;
  20461. return $core.withContext(function($ctx1) {
  20462. var $1;
  20463. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20464. $ctx1.sendIdx[","]=1;
  20465. return $1;
  20466. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20467. },
  20468. args: [],
  20469. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20470. referencedClasses: [],
  20471. messageSends: [",", "replace:with:"]
  20472. }),
  20473. $globals.String);
  20474. $core.addMethod(
  20475. $core.method({
  20476. selector: "settingValue",
  20477. protocol: '*Kernel-Infrastructure',
  20478. fn: function (){
  20479. var self=this;
  20480. return $core.withContext(function($ctx1) {
  20481. return $recv(self._asSetting())._value();
  20482. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20483. },
  20484. args: [],
  20485. source: "settingValue\x0a\x09^ self asSetting value",
  20486. referencedClasses: [],
  20487. messageSends: ["value", "asSetting"]
  20488. }),
  20489. $globals.String);
  20490. $core.addMethod(
  20491. $core.method({
  20492. selector: "settingValue:",
  20493. protocol: '*Kernel-Infrastructure',
  20494. fn: function (aValue){
  20495. var self=this;
  20496. return $core.withContext(function($ctx1) {
  20497. return $recv(self._asSetting())._value_(aValue);
  20498. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20499. },
  20500. args: ["aValue"],
  20501. 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",
  20502. referencedClasses: [],
  20503. messageSends: ["value:", "asSetting"]
  20504. }),
  20505. $globals.String);
  20506. $core.addMethod(
  20507. $core.method({
  20508. selector: "settingValueIfAbsent:",
  20509. protocol: '*Kernel-Infrastructure',
  20510. fn: function (aDefaultValue){
  20511. var self=this;
  20512. return $core.withContext(function($ctx1) {
  20513. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20514. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20515. },
  20516. args: ["aDefaultValue"],
  20517. 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",
  20518. referencedClasses: [],
  20519. messageSends: ["value", "asSettingIfAbsent:"]
  20520. }),
  20521. $globals.String);
  20522. });
  20523. define("amber_core/Kernel-Promises", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  20524. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20525. $core.addPackage('Kernel-Promises');
  20526. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  20527. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20528. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  20529. $globals.Thenable.comment="I am the abstract base class for Promises.\x0a\x0aMy subclasses should wrap existing JS implementations.\x0a\x0aI contain methods that wrap Promises/A+ `.then` behaviour.";
  20530. $core.addMethod(
  20531. $core.method({
  20532. selector: "catch:",
  20533. protocol: 'promises',
  20534. fn: function (aBlock){
  20535. var self=this;
  20536. return $core.withContext(function($ctx1) {
  20537. return self.then(null, function (err) {return $core.seamless(function () {
  20538. return aBlock._value_(err);
  20539. })});
  20540. return self;
  20541. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  20542. },
  20543. args: ["aBlock"],
  20544. source: "catch: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})>",
  20545. referencedClasses: [],
  20546. messageSends: []
  20547. }),
  20548. $globals.Thenable);
  20549. $core.addMethod(
  20550. $core.method({
  20551. selector: "on:do:",
  20552. protocol: 'promises',
  20553. fn: function (aClass,aBlock){
  20554. var self=this;
  20555. return $core.withContext(function($ctx1) {
  20556. return self.then(null, function (err) {return $core.seamless(function () {
  20557. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20558. else throw err;
  20559. })});
  20560. return self;
  20561. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20562. },
  20563. args: ["aClass", "aBlock"],
  20564. source: "on: aClass do: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})>",
  20565. referencedClasses: [],
  20566. messageSends: []
  20567. }),
  20568. $globals.Thenable);
  20569. $core.addMethod(
  20570. $core.method({
  20571. selector: "on:do:catch:",
  20572. protocol: 'promises',
  20573. fn: function (aClass,aBlock,anotherBlock){
  20574. var self=this;
  20575. return $core.withContext(function($ctx1) {
  20576. return self.then(null, function (err) {return $core.seamless(function () {
  20577. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  20578. return anotherBlock._value_(err);
  20579. })});
  20580. return self;
  20581. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20582. },
  20583. args: ["aClass", "aBlock", "anotherBlock"],
  20584. source: "on: aClass do: aBlock catch: anotherBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }\x0a return anotherBlock._value_(err);\x0a})})>",
  20585. referencedClasses: [],
  20586. messageSends: []
  20587. }),
  20588. $globals.Thenable);
  20589. $core.addMethod(
  20590. $core.method({
  20591. selector: "then:",
  20592. protocol: 'promises',
  20593. fn: function (aBlockOrArray){
  20594. var self=this;
  20595. return $core.withContext(function($ctx1) {
  20596. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20597. return array.reduce(function (soFar, aBlock) {
  20598. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20599. function (result) {return $core.seamless(function () {
  20600. if (Array.isArray(result)) {
  20601. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20602. } else {
  20603. return aBlock._value_(result);
  20604. }
  20605. })} :
  20606. function (result) {return $core.seamless(function () {
  20607. return aBlock._value_(result);
  20608. })}
  20609. );
  20610. }, self);
  20611. return self;
  20612. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  20613. },
  20614. args: ["aBlockOrArray"],
  20615. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length >> 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)>",
  20616. referencedClasses: [],
  20617. messageSends: []
  20618. }),
  20619. $globals.Thenable);
  20620. $core.addMethod(
  20621. $core.method({
  20622. selector: "then:catch:",
  20623. protocol: 'promises',
  20624. fn: function (aBlockOrArray,anotherBlock){
  20625. var self=this;
  20626. return $core.withContext(function($ctx1) {
  20627. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  20628. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  20629. },
  20630. args: ["aBlockOrArray", "anotherBlock"],
  20631. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  20632. referencedClasses: [],
  20633. messageSends: ["catch:", "then:"]
  20634. }),
  20635. $globals.Thenable);
  20636. $core.addMethod(
  20637. $core.method({
  20638. selector: "then:on:do:",
  20639. protocol: 'promises',
  20640. fn: function (aBlockOrArray,aClass,aBlock){
  20641. var self=this;
  20642. return $core.withContext(function($ctx1) {
  20643. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  20644. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20645. },
  20646. args: ["aBlockOrArray", "aClass", "aBlock"],
  20647. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  20648. referencedClasses: [],
  20649. messageSends: ["on:do:", "then:"]
  20650. }),
  20651. $globals.Thenable);
  20652. $core.addMethod(
  20653. $core.method({
  20654. selector: "then:on:do:catch:",
  20655. protocol: 'promises',
  20656. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20657. var self=this;
  20658. return $core.withContext(function($ctx1) {
  20659. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  20660. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20661. },
  20662. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20663. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  20664. referencedClasses: [],
  20665. messageSends: ["catch:", "on:do:", "then:"]
  20666. }),
  20667. $globals.Thenable);
  20668. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  20669. $core.addMethod(
  20670. $core.method({
  20671. selector: "all:",
  20672. protocol: 'composites',
  20673. fn: function (aCollection){
  20674. var self=this;
  20675. return $core.withContext(function($ctx1) {
  20676. return Promise.all($recv(aCollection)._asArray());
  20677. return self;
  20678. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  20679. },
  20680. args: ["aCollection"],
  20681. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<return Promise.all($recv(aCollection)._asArray())>",
  20682. referencedClasses: [],
  20683. messageSends: []
  20684. }),
  20685. $globals.Promise.klass);
  20686. $core.addMethod(
  20687. $core.method({
  20688. selector: "any:",
  20689. protocol: 'composites',
  20690. fn: function (aCollection){
  20691. var self=this;
  20692. return $core.withContext(function($ctx1) {
  20693. return Promise.race($recv(aCollection)._asArray());
  20694. return self;
  20695. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  20696. },
  20697. args: ["aCollection"],
  20698. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<return Promise.race($recv(aCollection)._asArray())>",
  20699. referencedClasses: [],
  20700. messageSends: []
  20701. }),
  20702. $globals.Promise.klass);
  20703. $core.addMethod(
  20704. $core.method({
  20705. selector: "forBlock:",
  20706. protocol: 'instance creation',
  20707. fn: function (aBlock){
  20708. var self=this;
  20709. return $core.withContext(function($ctx1) {
  20710. return $recv(self._new())._then_(aBlock);
  20711. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  20712. },
  20713. args: ["aBlock"],
  20714. 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",
  20715. referencedClasses: [],
  20716. messageSends: ["then:", "new"]
  20717. }),
  20718. $globals.Promise.klass);
  20719. $core.addMethod(
  20720. $core.method({
  20721. selector: "new",
  20722. protocol: 'instance creation',
  20723. fn: function (){
  20724. var self=this;
  20725. return $core.withContext(function($ctx1) {
  20726. return Promise.resolve();
  20727. return self;
  20728. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  20729. },
  20730. args: [],
  20731. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<return Promise.resolve()>",
  20732. referencedClasses: [],
  20733. messageSends: []
  20734. }),
  20735. $globals.Promise.klass);
  20736. $core.addMethod(
  20737. $core.method({
  20738. selector: "new:",
  20739. protocol: 'instance creation',
  20740. fn: function (aBlock){
  20741. var self=this;
  20742. return $core.withContext(function($ctx1) {
  20743. return new Promise(function (resolve, reject) {
  20744. var model = {value: resolve, signal: reject}; // TODO make faster
  20745. aBlock._value_(model);
  20746. });
  20747. return self;
  20748. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  20749. },
  20750. args: ["aBlock"],
  20751. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})>",
  20752. referencedClasses: [],
  20753. messageSends: []
  20754. }),
  20755. $globals.Promise.klass);
  20756. $core.addMethod(
  20757. $core.method({
  20758. selector: "signal:",
  20759. protocol: 'instance creation',
  20760. fn: function (anObject){
  20761. var self=this;
  20762. return $core.withContext(function($ctx1) {
  20763. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  20764. return self;
  20765. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  20766. },
  20767. args: ["anObject"],
  20768. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.reject(x)})>",
  20769. referencedClasses: [],
  20770. messageSends: []
  20771. }),
  20772. $globals.Promise.klass);
  20773. $core.addMethod(
  20774. $core.method({
  20775. selector: "value:",
  20776. protocol: 'instance creation',
  20777. fn: function (anObject){
  20778. var self=this;
  20779. return $core.withContext(function($ctx1) {
  20780. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  20781. return self;
  20782. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  20783. },
  20784. args: ["anObject"],
  20785. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})>",
  20786. referencedClasses: [],
  20787. messageSends: []
  20788. }),
  20789. $globals.Promise.klass);
  20790. $core.addMethod(
  20791. $core.method({
  20792. selector: "catch:",
  20793. protocol: '*Kernel-Promises',
  20794. fn: function (aBlock){
  20795. var self=this;
  20796. return $core.withContext(function($ctx1) {
  20797. var js = self["@jsObject"];
  20798. if (typeof js.then === "function")
  20799. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  20800. else
  20801. return self._doesNotUnderstand_(
  20802. $globals.Message._new()
  20803. ._selector_("catch:")
  20804. ._arguments_([aBlock])
  20805. );
  20806. return self;
  20807. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20808. },
  20809. args: ["aBlock"],
  20810. source: "catch: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22catch:\x22)\x0a ._arguments_([aBlock])\x0a )>",
  20811. referencedClasses: [],
  20812. messageSends: []
  20813. }),
  20814. $globals.JSObjectProxy);
  20815. $core.addMethod(
  20816. $core.method({
  20817. selector: "on:do:",
  20818. protocol: '*Kernel-Promises',
  20819. fn: function (aClass,aBlock){
  20820. var self=this;
  20821. return $core.withContext(function($ctx1) {
  20822. var js = self["@jsObject"];
  20823. if (typeof js.then === "function")
  20824. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  20825. else
  20826. return self._doesNotUnderstand_(
  20827. $globals.Message._new()
  20828. ._selector_("on:do:")
  20829. ._arguments_([aClass, aBlock])
  20830. );
  20831. return self;
  20832. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20833. },
  20834. args: ["aClass", "aBlock"],
  20835. source: "on: aClass do: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:\x22)\x0a ._arguments_([aClass, aBlock])\x0a )>",
  20836. referencedClasses: [],
  20837. messageSends: []
  20838. }),
  20839. $globals.JSObjectProxy);
  20840. $core.addMethod(
  20841. $core.method({
  20842. selector: "on:do:catch:",
  20843. protocol: '*Kernel-Promises',
  20844. fn: function (aClass,aBlock,anotherBlock){
  20845. var self=this;
  20846. return $core.withContext(function($ctx1) {
  20847. var js = self["@jsObject"];
  20848. if (typeof js.then === "function")
  20849. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  20850. else
  20851. return self._doesNotUnderstand_(
  20852. $globals.Message._new()
  20853. ._selector_("on:do:catch:")
  20854. ._arguments_([aClass, aBlock, anotherBlock])
  20855. );
  20856. return self;
  20857. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20858. },
  20859. args: ["aClass", "aBlock", "anotherBlock"],
  20860. source: "on: aClass do: aBlock catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:catch:\x22)\x0a ._arguments_([aClass, aBlock, anotherBlock])\x0a )>",
  20861. referencedClasses: [],
  20862. messageSends: []
  20863. }),
  20864. $globals.JSObjectProxy);
  20865. $core.addMethod(
  20866. $core.method({
  20867. selector: "then:",
  20868. protocol: '*Kernel-Promises',
  20869. fn: function (aBlockOrArray){
  20870. var self=this;
  20871. return $core.withContext(function($ctx1) {
  20872. var js = self["@jsObject"];
  20873. if (typeof js.then === "function")
  20874. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  20875. else
  20876. return self._doesNotUnderstand_(
  20877. $globals.Message._new()
  20878. ._selector_("then:")
  20879. ._arguments_([aBlockOrArray])
  20880. );
  20881. return self;
  20882. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  20883. },
  20884. args: ["aBlockOrArray"],
  20885. source: "then: aBlockOrArray\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:\x22)\x0a ._arguments_([aBlockOrArray])\x0a )>",
  20886. referencedClasses: [],
  20887. messageSends: []
  20888. }),
  20889. $globals.JSObjectProxy);
  20890. $core.addMethod(
  20891. $core.method({
  20892. selector: "then:catch:",
  20893. protocol: '*Kernel-Promises',
  20894. fn: function (aBlockOrArray,anotherBlock){
  20895. var self=this;
  20896. return $core.withContext(function($ctx1) {
  20897. var js = self["@jsObject"];
  20898. if (typeof js.then === "function")
  20899. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  20900. else
  20901. return self._doesNotUnderstand_(
  20902. $globals.Message._new()
  20903. ._selector_("then:catch:")
  20904. ._arguments_([aBlockOrArray, anotherBlock])
  20905. );
  20906. return self;
  20907. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20908. },
  20909. args: ["aBlockOrArray", "anotherBlock"],
  20910. source: "then: aBlockOrArray catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:catch:\x22)\x0a ._arguments_([aBlockOrArray, anotherBlock])\x0a )>",
  20911. referencedClasses: [],
  20912. messageSends: []
  20913. }),
  20914. $globals.JSObjectProxy);
  20915. $core.addMethod(
  20916. $core.method({
  20917. selector: "then:on:do:",
  20918. protocol: '*Kernel-Promises',
  20919. fn: function (aBlockOrArray,aClass,aBlock){
  20920. var self=this;
  20921. return $core.withContext(function($ctx1) {
  20922. var js = self["@jsObject"];
  20923. if (typeof js.then === "function")
  20924. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  20925. else
  20926. return self._doesNotUnderstand_(
  20927. $globals.Message._new()
  20928. ._selector_("then:on:do:")
  20929. ._arguments_([aBlockOrArray, aClass, aBlock])
  20930. );
  20931. return self;
  20932. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20933. },
  20934. args: ["aBlockOrArray", "aClass", "aBlock"],
  20935. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock])\x0a )>",
  20936. referencedClasses: [],
  20937. messageSends: []
  20938. }),
  20939. $globals.JSObjectProxy);
  20940. $core.addMethod(
  20941. $core.method({
  20942. selector: "then:on:do:catch:",
  20943. protocol: '*Kernel-Promises',
  20944. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20945. var self=this;
  20946. return $core.withContext(function($ctx1) {
  20947. var js = self["@jsObject"];
  20948. if (typeof js.then === "function")
  20949. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  20950. else
  20951. return self._doesNotUnderstand_(
  20952. $globals.Message._new()
  20953. ._selector_("then:on:do:catch:")
  20954. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  20955. );
  20956. return self;
  20957. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20958. },
  20959. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20960. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:catch:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])\x0a )>",
  20961. referencedClasses: [],
  20962. messageSends: []
  20963. }),
  20964. $globals.JSObjectProxy);
  20965. });
  20966. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20967. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20968. $core.addPackage('Kernel-Announcements');
  20969. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20970. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20971. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20972. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20973. $core.addMethod(
  20974. $core.method({
  20975. selector: "announcementClass",
  20976. protocol: 'accessing',
  20977. fn: function (){
  20978. var self=this;
  20979. return self["@announcementClass"];
  20980. },
  20981. args: [],
  20982. source: "announcementClass\x0a\x09^ announcementClass",
  20983. referencedClasses: [],
  20984. messageSends: []
  20985. }),
  20986. $globals.AnnouncementSubscription);
  20987. $core.addMethod(
  20988. $core.method({
  20989. selector: "announcementClass:",
  20990. protocol: 'accessing',
  20991. fn: function (aClass){
  20992. var self=this;
  20993. self["@announcementClass"]=aClass;
  20994. return self;
  20995. },
  20996. args: ["aClass"],
  20997. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20998. referencedClasses: [],
  20999. messageSends: []
  21000. }),
  21001. $globals.AnnouncementSubscription);
  21002. $core.addMethod(
  21003. $core.method({
  21004. selector: "deliver:",
  21005. protocol: 'announcing',
  21006. fn: function (anAnnouncement){
  21007. var self=this;
  21008. return $core.withContext(function($ctx1) {
  21009. var $1;
  21010. $1=self._handlesAnnouncement_(anAnnouncement);
  21011. if($core.assert($1)){
  21012. $recv(self._valuable())._value_(anAnnouncement);
  21013. };
  21014. return self;
  21015. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21016. },
  21017. args: ["anAnnouncement"],
  21018. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  21019. referencedClasses: [],
  21020. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  21021. }),
  21022. $globals.AnnouncementSubscription);
  21023. $core.addMethod(
  21024. $core.method({
  21025. selector: "handlesAnnouncement:",
  21026. protocol: 'announcing',
  21027. fn: function (anAnnouncement){
  21028. var self=this;
  21029. return $core.withContext(function($ctx1) {
  21030. var $2,$3,$1,$receiver;
  21031. $2=$recv($globals.Smalltalk)._globals();
  21032. $ctx1.sendIdx["globals"]=1;
  21033. $3=$recv(self._announcementClass())._name();
  21034. $ctx1.sendIdx["name"]=1;
  21035. $1=$recv($2)._at_($3);
  21036. $ctx1.sendIdx["at:"]=1;
  21037. if(($receiver = $1) == null || $receiver.isNil){
  21038. return false;
  21039. } else {
  21040. var class_;
  21041. class_=$receiver;
  21042. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  21043. };
  21044. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21045. },
  21046. args: ["anAnnouncement"],
  21047. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  21048. referencedClasses: ["Smalltalk"],
  21049. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  21050. }),
  21051. $globals.AnnouncementSubscription);
  21052. $core.addMethod(
  21053. $core.method({
  21054. selector: "receiver",
  21055. protocol: 'accessing',
  21056. fn: function (){
  21057. var self=this;
  21058. return $core.withContext(function($ctx1) {
  21059. return $recv(self._valuable())._receiver();
  21060. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  21061. },
  21062. args: [],
  21063. source: "receiver\x0a\x09^ self valuable receiver",
  21064. referencedClasses: [],
  21065. messageSends: ["receiver", "valuable"]
  21066. }),
  21067. $globals.AnnouncementSubscription);
  21068. $core.addMethod(
  21069. $core.method({
  21070. selector: "valuable",
  21071. protocol: 'accessing',
  21072. fn: function (){
  21073. var self=this;
  21074. return self["@valuable"];
  21075. },
  21076. args: [],
  21077. source: "valuable\x0a\x09^ valuable",
  21078. referencedClasses: [],
  21079. messageSends: []
  21080. }),
  21081. $globals.AnnouncementSubscription);
  21082. $core.addMethod(
  21083. $core.method({
  21084. selector: "valuable:",
  21085. protocol: 'accessing',
  21086. fn: function (aValuable){
  21087. var self=this;
  21088. self["@valuable"]=aValuable;
  21089. return self;
  21090. },
  21091. args: ["aValuable"],
  21092. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  21093. referencedClasses: [],
  21094. messageSends: []
  21095. }),
  21096. $globals.AnnouncementSubscription);
  21097. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  21098. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  21099. $core.addMethod(
  21100. $core.method({
  21101. selector: "receiver",
  21102. protocol: 'accessing',
  21103. fn: function (){
  21104. var self=this;
  21105. return self["@receiver"];
  21106. },
  21107. args: [],
  21108. source: "receiver\x0a\x09^ receiver",
  21109. referencedClasses: [],
  21110. messageSends: []
  21111. }),
  21112. $globals.AnnouncementValuable);
  21113. $core.addMethod(
  21114. $core.method({
  21115. selector: "receiver:",
  21116. protocol: 'accessing',
  21117. fn: function (anObject){
  21118. var self=this;
  21119. self["@receiver"]=anObject;
  21120. return self;
  21121. },
  21122. args: ["anObject"],
  21123. source: "receiver: anObject\x0a\x09receiver := anObject",
  21124. referencedClasses: [],
  21125. messageSends: []
  21126. }),
  21127. $globals.AnnouncementValuable);
  21128. $core.addMethod(
  21129. $core.method({
  21130. selector: "valuable",
  21131. protocol: 'accessing',
  21132. fn: function (){
  21133. var self=this;
  21134. return self["@valuable"];
  21135. },
  21136. args: [],
  21137. source: "valuable\x0a\x09^ valuable",
  21138. referencedClasses: [],
  21139. messageSends: []
  21140. }),
  21141. $globals.AnnouncementValuable);
  21142. $core.addMethod(
  21143. $core.method({
  21144. selector: "valuable:",
  21145. protocol: 'accessing',
  21146. fn: function (anObject){
  21147. var self=this;
  21148. self["@valuable"]=anObject;
  21149. return self;
  21150. },
  21151. args: ["anObject"],
  21152. source: "valuable: anObject\x0a\x09valuable := anObject",
  21153. referencedClasses: [],
  21154. messageSends: []
  21155. }),
  21156. $globals.AnnouncementValuable);
  21157. $core.addMethod(
  21158. $core.method({
  21159. selector: "value",
  21160. protocol: 'evaluating',
  21161. fn: function (){
  21162. var self=this;
  21163. return $core.withContext(function($ctx1) {
  21164. return $recv(self._valuable())._value();
  21165. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  21166. },
  21167. args: [],
  21168. source: "value\x0a\x09^ self valuable value",
  21169. referencedClasses: [],
  21170. messageSends: ["value", "valuable"]
  21171. }),
  21172. $globals.AnnouncementValuable);
  21173. $core.addMethod(
  21174. $core.method({
  21175. selector: "value:",
  21176. protocol: 'evaluating',
  21177. fn: function (anObject){
  21178. var self=this;
  21179. return $core.withContext(function($ctx1) {
  21180. return $recv(self._valuable())._value_(anObject);
  21181. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  21182. },
  21183. args: ["anObject"],
  21184. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  21185. referencedClasses: [],
  21186. messageSends: ["value:", "valuable"]
  21187. }),
  21188. $globals.AnnouncementValuable);
  21189. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  21190. $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' ].";
  21191. $core.addMethod(
  21192. $core.method({
  21193. selector: "announce:",
  21194. protocol: 'announcing',
  21195. fn: function (anAnnouncement){
  21196. var self=this;
  21197. return $core.withContext(function($ctx1) {
  21198. $recv(self["@subscriptions"])._do_((function(each){
  21199. return $core.withContext(function($ctx2) {
  21200. return $recv(each)._deliver_(anAnnouncement);
  21201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21202. }));
  21203. return self;
  21204. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  21205. },
  21206. args: ["anAnnouncement"],
  21207. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  21208. referencedClasses: [],
  21209. messageSends: ["do:", "deliver:"]
  21210. }),
  21211. $globals.Announcer);
  21212. $core.addMethod(
  21213. $core.method({
  21214. selector: "initialize",
  21215. protocol: 'initialization',
  21216. fn: function (){
  21217. var self=this;
  21218. return $core.withContext(function($ctx1) {
  21219. (
  21220. $ctx1.supercall = true,
  21221. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  21222. $ctx1.supercall = false;
  21223. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  21224. return self;
  21225. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  21226. },
  21227. args: [],
  21228. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  21229. referencedClasses: ["OrderedCollection"],
  21230. messageSends: ["initialize", "new"]
  21231. }),
  21232. $globals.Announcer);
  21233. $core.addMethod(
  21234. $core.method({
  21235. selector: "on:do:",
  21236. protocol: 'subscribing',
  21237. fn: function (aClass,aBlock){
  21238. var self=this;
  21239. return $core.withContext(function($ctx1) {
  21240. self._on_do_for_(aClass,aBlock,nil);
  21241. return self;
  21242. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21243. },
  21244. args: ["aClass", "aBlock"],
  21245. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21246. referencedClasses: [],
  21247. messageSends: ["on:do:for:"]
  21248. }),
  21249. $globals.Announcer);
  21250. $core.addMethod(
  21251. $core.method({
  21252. selector: "on:do:for:",
  21253. protocol: 'subscribing',
  21254. fn: function (aClass,aBlock,aReceiver){
  21255. var self=this;
  21256. return $core.withContext(function($ctx1) {
  21257. var $1,$3,$5,$6,$4,$2;
  21258. $1=self["@subscriptions"];
  21259. $3=$recv($globals.AnnouncementSubscription)._new();
  21260. $ctx1.sendIdx["new"]=1;
  21261. $5=$recv($globals.AnnouncementValuable)._new();
  21262. $recv($5)._valuable_(aBlock);
  21263. $recv($5)._receiver_(aReceiver);
  21264. $6=$recv($5)._yourself();
  21265. $ctx1.sendIdx["yourself"]=1;
  21266. $4=$6;
  21267. $recv($3)._valuable_($4);
  21268. $ctx1.sendIdx["valuable:"]=1;
  21269. $recv($3)._announcementClass_(aClass);
  21270. $2=$recv($3)._yourself();
  21271. $recv($1)._add_($2);
  21272. return self;
  21273. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21274. },
  21275. args: ["aClass", "aBlock", "aReceiver"],
  21276. 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)",
  21277. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21278. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21279. }),
  21280. $globals.Announcer);
  21281. $core.addMethod(
  21282. $core.method({
  21283. selector: "on:doOnce:",
  21284. protocol: 'subscribing',
  21285. fn: function (aClass,aBlock){
  21286. var self=this;
  21287. var subscription;
  21288. return $core.withContext(function($ctx1) {
  21289. var $1;
  21290. $1=$recv($globals.AnnouncementSubscription)._new();
  21291. $recv($1)._announcementClass_(aClass);
  21292. subscription=$recv($1)._yourself();
  21293. $recv(subscription)._valuable_((function(ann){
  21294. return $core.withContext(function($ctx2) {
  21295. $recv(self["@subscriptions"])._remove_(subscription);
  21296. return $recv(aBlock)._value_(ann);
  21297. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21298. }));
  21299. $recv(self["@subscriptions"])._add_(subscription);
  21300. return self;
  21301. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21302. },
  21303. args: ["aClass", "aBlock"],
  21304. 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",
  21305. referencedClasses: ["AnnouncementSubscription"],
  21306. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21307. }),
  21308. $globals.Announcer);
  21309. $core.addMethod(
  21310. $core.method({
  21311. selector: "on:send:to:",
  21312. protocol: 'subscribing',
  21313. fn: function (aClass,aSelector,anObject){
  21314. var self=this;
  21315. return $core.withContext(function($ctx1) {
  21316. var $1,$3,$5,$6,$4,$2;
  21317. $1=self["@subscriptions"];
  21318. $3=$recv($globals.AnnouncementSubscription)._new();
  21319. $ctx1.sendIdx["new"]=1;
  21320. $5=$recv($globals.MessageSend)._new();
  21321. $recv($5)._receiver_(anObject);
  21322. $recv($5)._selector_(aSelector);
  21323. $6=$recv($5)._yourself();
  21324. $ctx1.sendIdx["yourself"]=1;
  21325. $4=$6;
  21326. $recv($3)._valuable_($4);
  21327. $recv($3)._announcementClass_(aClass);
  21328. $2=$recv($3)._yourself();
  21329. $recv($1)._add_($2);
  21330. return self;
  21331. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21332. },
  21333. args: ["aClass", "aSelector", "anObject"],
  21334. 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)",
  21335. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21336. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21337. }),
  21338. $globals.Announcer);
  21339. $core.addMethod(
  21340. $core.method({
  21341. selector: "unsubscribe:",
  21342. protocol: 'subscribing',
  21343. fn: function (anObject){
  21344. var self=this;
  21345. return $core.withContext(function($ctx1) {
  21346. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21347. return $core.withContext(function($ctx2) {
  21348. return $recv($recv(each)._receiver()).__eq(anObject);
  21349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21350. }));
  21351. return self;
  21352. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21353. },
  21354. args: ["anObject"],
  21355. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21356. referencedClasses: [],
  21357. messageSends: ["reject:", "=", "receiver"]
  21358. }),
  21359. $globals.Announcer);
  21360. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21361. $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`";
  21362. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21363. $core.addMethod(
  21364. $core.method({
  21365. selector: "current",
  21366. protocol: 'accessing',
  21367. fn: function (){
  21368. var self=this;
  21369. return $core.withContext(function($ctx1) {
  21370. var $1,$receiver;
  21371. $1=self["@current"];
  21372. if(($receiver = $1) == null || $receiver.isNil){
  21373. self["@current"]=(
  21374. $ctx1.supercall = true,
  21375. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21376. $ctx1.supercall = false;
  21377. return self["@current"];
  21378. } else {
  21379. return $1;
  21380. };
  21381. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21382. },
  21383. args: [],
  21384. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21385. referencedClasses: [],
  21386. messageSends: ["ifNil:", "new"]
  21387. }),
  21388. $globals.SystemAnnouncer.klass);
  21389. $core.addMethod(
  21390. $core.method({
  21391. selector: "new",
  21392. protocol: 'instance creation',
  21393. fn: function (){
  21394. var self=this;
  21395. return $core.withContext(function($ctx1) {
  21396. self._shouldNotImplement();
  21397. return self;
  21398. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21399. },
  21400. args: [],
  21401. source: "new\x0a\x09self shouldNotImplement",
  21402. referencedClasses: [],
  21403. messageSends: ["shouldNotImplement"]
  21404. }),
  21405. $globals.SystemAnnouncer.klass);
  21406. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21407. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21408. $core.addMethod(
  21409. $core.method({
  21410. selector: "classTag",
  21411. protocol: 'accessing',
  21412. fn: function (){
  21413. var self=this;
  21414. return "announcement";
  21415. },
  21416. args: [],
  21417. 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'",
  21418. referencedClasses: [],
  21419. messageSends: []
  21420. }),
  21421. $globals.SystemAnnouncement.klass);
  21422. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21423. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21424. $core.addMethod(
  21425. $core.method({
  21426. selector: "theClass",
  21427. protocol: 'accessing',
  21428. fn: function (){
  21429. var self=this;
  21430. return self["@theClass"];
  21431. },
  21432. args: [],
  21433. source: "theClass\x0a\x09^ theClass",
  21434. referencedClasses: [],
  21435. messageSends: []
  21436. }),
  21437. $globals.ClassAnnouncement);
  21438. $core.addMethod(
  21439. $core.method({
  21440. selector: "theClass:",
  21441. protocol: 'accessing',
  21442. fn: function (aClass){
  21443. var self=this;
  21444. self["@theClass"]=aClass;
  21445. return self;
  21446. },
  21447. args: ["aClass"],
  21448. source: "theClass: aClass\x0a\x09theClass := aClass",
  21449. referencedClasses: [],
  21450. messageSends: []
  21451. }),
  21452. $globals.ClassAnnouncement);
  21453. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21454. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21455. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21456. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21457. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21458. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21459. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21460. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21461. $core.addMethod(
  21462. $core.method({
  21463. selector: "oldClass",
  21464. protocol: 'accessing',
  21465. fn: function (){
  21466. var self=this;
  21467. return self["@oldClass"];
  21468. },
  21469. args: [],
  21470. source: "oldClass\x0a\x09^ oldClass",
  21471. referencedClasses: [],
  21472. messageSends: []
  21473. }),
  21474. $globals.ClassMigrated);
  21475. $core.addMethod(
  21476. $core.method({
  21477. selector: "oldClass:",
  21478. protocol: 'accessing',
  21479. fn: function (aClass){
  21480. var self=this;
  21481. self["@oldClass"]=aClass;
  21482. return self;
  21483. },
  21484. args: ["aClass"],
  21485. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21486. referencedClasses: [],
  21487. messageSends: []
  21488. }),
  21489. $globals.ClassMigrated);
  21490. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21491. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21492. $core.addMethod(
  21493. $core.method({
  21494. selector: "oldPackage",
  21495. protocol: 'accessing',
  21496. fn: function (){
  21497. var self=this;
  21498. return self["@oldPackage"];
  21499. },
  21500. args: [],
  21501. source: "oldPackage\x0a\x09^ oldPackage",
  21502. referencedClasses: [],
  21503. messageSends: []
  21504. }),
  21505. $globals.ClassMoved);
  21506. $core.addMethod(
  21507. $core.method({
  21508. selector: "oldPackage:",
  21509. protocol: 'accessing',
  21510. fn: function (aPackage){
  21511. var self=this;
  21512. self["@oldPackage"]=aPackage;
  21513. return self;
  21514. },
  21515. args: ["aPackage"],
  21516. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21517. referencedClasses: [],
  21518. messageSends: []
  21519. }),
  21520. $globals.ClassMoved);
  21521. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21522. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21523. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21524. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21525. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21526. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21527. $core.addMethod(
  21528. $core.method({
  21529. selector: "method",
  21530. protocol: 'accessing',
  21531. fn: function (){
  21532. var self=this;
  21533. return self["@method"];
  21534. },
  21535. args: [],
  21536. source: "method\x0a\x09^ method",
  21537. referencedClasses: [],
  21538. messageSends: []
  21539. }),
  21540. $globals.MethodAnnouncement);
  21541. $core.addMethod(
  21542. $core.method({
  21543. selector: "method:",
  21544. protocol: 'accessing',
  21545. fn: function (aCompiledMethod){
  21546. var self=this;
  21547. self["@method"]=aCompiledMethod;
  21548. return self;
  21549. },
  21550. args: ["aCompiledMethod"],
  21551. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21552. referencedClasses: [],
  21553. messageSends: []
  21554. }),
  21555. $globals.MethodAnnouncement);
  21556. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21557. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21558. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21559. $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.";
  21560. $core.addMethod(
  21561. $core.method({
  21562. selector: "oldMethod",
  21563. protocol: 'accessing',
  21564. fn: function (){
  21565. var self=this;
  21566. return self["@oldMethod"];
  21567. },
  21568. args: [],
  21569. source: "oldMethod\x0a\x09^ oldMethod",
  21570. referencedClasses: [],
  21571. messageSends: []
  21572. }),
  21573. $globals.MethodModified);
  21574. $core.addMethod(
  21575. $core.method({
  21576. selector: "oldMethod:",
  21577. protocol: 'accessing',
  21578. fn: function (aMethod){
  21579. var self=this;
  21580. self["@oldMethod"]=aMethod;
  21581. return self;
  21582. },
  21583. args: ["aMethod"],
  21584. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21585. referencedClasses: [],
  21586. messageSends: []
  21587. }),
  21588. $globals.MethodModified);
  21589. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21590. $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.";
  21591. $core.addMethod(
  21592. $core.method({
  21593. selector: "oldProtocol",
  21594. protocol: 'accessing',
  21595. fn: function (){
  21596. var self=this;
  21597. return self["@oldProtocol"];
  21598. },
  21599. args: [],
  21600. source: "oldProtocol\x0a\x09^ oldProtocol",
  21601. referencedClasses: [],
  21602. messageSends: []
  21603. }),
  21604. $globals.MethodMoved);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "oldProtocol:",
  21608. protocol: 'accessing',
  21609. fn: function (aString){
  21610. var self=this;
  21611. self["@oldProtocol"]=aString;
  21612. return self;
  21613. },
  21614. args: ["aString"],
  21615. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21616. referencedClasses: [],
  21617. messageSends: []
  21618. }),
  21619. $globals.MethodMoved);
  21620. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21621. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21622. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21623. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21624. $core.addMethod(
  21625. $core.method({
  21626. selector: "package",
  21627. protocol: 'accessing',
  21628. fn: function (){
  21629. var self=this;
  21630. return self["@package"];
  21631. },
  21632. args: [],
  21633. source: "package\x0a\x09^ package",
  21634. referencedClasses: [],
  21635. messageSends: []
  21636. }),
  21637. $globals.PackageAnnouncement);
  21638. $core.addMethod(
  21639. $core.method({
  21640. selector: "package:",
  21641. protocol: 'accessing',
  21642. fn: function (aPackage){
  21643. var self=this;
  21644. self["@package"]=aPackage;
  21645. return self;
  21646. },
  21647. args: ["aPackage"],
  21648. source: "package: aPackage\x0a\x09package := aPackage",
  21649. referencedClasses: [],
  21650. messageSends: []
  21651. }),
  21652. $globals.PackageAnnouncement);
  21653. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21654. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21655. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21656. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21657. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21658. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21659. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21660. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21661. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21662. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21663. $core.addMethod(
  21664. $core.method({
  21665. selector: "package",
  21666. protocol: 'accessing',
  21667. fn: function (){
  21668. var self=this;
  21669. return $core.withContext(function($ctx1) {
  21670. var $1,$receiver;
  21671. $1=self._theClass();
  21672. if(($receiver = $1) == null || $receiver.isNil){
  21673. return $1;
  21674. } else {
  21675. var class_;
  21676. class_=$receiver;
  21677. return $recv(class_)._packageOfProtocol_(self._protocol());
  21678. };
  21679. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21680. },
  21681. args: [],
  21682. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21683. referencedClasses: [],
  21684. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21685. }),
  21686. $globals.ProtocolAnnouncement);
  21687. $core.addMethod(
  21688. $core.method({
  21689. selector: "protocol",
  21690. protocol: 'accessing',
  21691. fn: function (){
  21692. var self=this;
  21693. return self["@protocol"];
  21694. },
  21695. args: [],
  21696. source: "protocol\x0a\x09^ protocol",
  21697. referencedClasses: [],
  21698. messageSends: []
  21699. }),
  21700. $globals.ProtocolAnnouncement);
  21701. $core.addMethod(
  21702. $core.method({
  21703. selector: "protocol:",
  21704. protocol: 'accessing',
  21705. fn: function (aString){
  21706. var self=this;
  21707. self["@protocol"]=aString;
  21708. return self;
  21709. },
  21710. args: ["aString"],
  21711. source: "protocol: aString\x0a\x09protocol := aString",
  21712. referencedClasses: [],
  21713. messageSends: []
  21714. }),
  21715. $globals.ProtocolAnnouncement);
  21716. $core.addMethod(
  21717. $core.method({
  21718. selector: "theClass",
  21719. protocol: 'accessing',
  21720. fn: function (){
  21721. var self=this;
  21722. return self["@theClass"];
  21723. },
  21724. args: [],
  21725. source: "theClass\x0a\x09^ theClass",
  21726. referencedClasses: [],
  21727. messageSends: []
  21728. }),
  21729. $globals.ProtocolAnnouncement);
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "theClass:",
  21733. protocol: 'accessing',
  21734. fn: function (aClass){
  21735. var self=this;
  21736. self["@theClass"]=aClass;
  21737. return self;
  21738. },
  21739. args: ["aClass"],
  21740. source: "theClass: aClass\x0a\x09theClass := aClass",
  21741. referencedClasses: [],
  21742. messageSends: []
  21743. }),
  21744. $globals.ProtocolAnnouncement);
  21745. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21746. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21747. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21748. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21749. });
  21750. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  21751. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21752. $core.addPackage('Platform-Services');
  21753. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21754. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21755. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21756. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21757. $core.addMethod(
  21758. $core.method({
  21759. selector: "handleError:",
  21760. protocol: 'error handling',
  21761. fn: function (anError){
  21762. var self=this;
  21763. return $core.withContext(function($ctx1) {
  21764. var $1,$receiver;
  21765. $1=$recv(anError)._context();
  21766. $ctx1.sendIdx["context"]=1;
  21767. if(($receiver = $1) == null || $receiver.isNil){
  21768. $1;
  21769. } else {
  21770. self._logErrorContext_($recv(anError)._context());
  21771. };
  21772. self._logError_(anError);
  21773. return self;
  21774. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21775. },
  21776. args: ["anError"],
  21777. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21778. referencedClasses: [],
  21779. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21780. }),
  21781. $globals.ConsoleErrorHandler);
  21782. $core.addMethod(
  21783. $core.method({
  21784. selector: "log:",
  21785. protocol: 'private',
  21786. fn: function (aString){
  21787. var self=this;
  21788. return $core.withContext(function($ctx1) {
  21789. $recv(console)._log_(aString);
  21790. return self;
  21791. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21792. },
  21793. args: ["aString"],
  21794. source: "log: aString\x0a\x09console log: aString",
  21795. referencedClasses: [],
  21796. messageSends: ["log:"]
  21797. }),
  21798. $globals.ConsoleErrorHandler);
  21799. $core.addMethod(
  21800. $core.method({
  21801. selector: "logContext:",
  21802. protocol: 'private',
  21803. fn: function (aContext){
  21804. var self=this;
  21805. return $core.withContext(function($ctx1) {
  21806. var $1,$receiver;
  21807. $1=$recv(aContext)._home();
  21808. $ctx1.sendIdx["home"]=1;
  21809. if(($receiver = $1) == null || $receiver.isNil){
  21810. $1;
  21811. } else {
  21812. self._logContext_($recv(aContext)._home());
  21813. };
  21814. self._log_($recv(aContext)._asString());
  21815. return self;
  21816. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21817. },
  21818. args: ["aContext"],
  21819. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21820. referencedClasses: [],
  21821. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21822. }),
  21823. $globals.ConsoleErrorHandler);
  21824. $core.addMethod(
  21825. $core.method({
  21826. selector: "logError:",
  21827. protocol: 'private',
  21828. fn: function (anError){
  21829. var self=this;
  21830. return $core.withContext(function($ctx1) {
  21831. self._log_($recv(anError)._messageText());
  21832. return self;
  21833. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21834. },
  21835. args: ["anError"],
  21836. source: "logError: anError\x0a\x09self log: anError messageText",
  21837. referencedClasses: [],
  21838. messageSends: ["log:", "messageText"]
  21839. }),
  21840. $globals.ConsoleErrorHandler);
  21841. $core.addMethod(
  21842. $core.method({
  21843. selector: "logErrorContext:",
  21844. protocol: 'private',
  21845. fn: function (aContext){
  21846. var self=this;
  21847. return $core.withContext(function($ctx1) {
  21848. var $1,$receiver;
  21849. if(($receiver = aContext) == null || $receiver.isNil){
  21850. aContext;
  21851. } else {
  21852. $1=$recv(aContext)._home();
  21853. $ctx1.sendIdx["home"]=1;
  21854. if(($receiver = $1) == null || $receiver.isNil){
  21855. $1;
  21856. } else {
  21857. self._logContext_($recv(aContext)._home());
  21858. };
  21859. };
  21860. return self;
  21861. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21862. },
  21863. args: ["aContext"],
  21864. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21865. referencedClasses: [],
  21866. messageSends: ["ifNotNil:", "home", "logContext:"]
  21867. }),
  21868. $globals.ConsoleErrorHandler);
  21869. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21870. $core.addMethod(
  21871. $core.method({
  21872. selector: "initialize",
  21873. protocol: 'initialization',
  21874. fn: function (){
  21875. var self=this;
  21876. return $core.withContext(function($ctx1) {
  21877. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  21878. return self;
  21879. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21880. },
  21881. args: [],
  21882. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21883. referencedClasses: ["ErrorHandler"],
  21884. messageSends: ["registerIfNone:", "new"]
  21885. }),
  21886. $globals.ConsoleErrorHandler.klass);
  21887. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21888. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21889. $core.addMethod(
  21890. $core.method({
  21891. selector: "clear",
  21892. protocol: 'printing',
  21893. fn: function (){
  21894. var self=this;
  21895. return self;
  21896. },
  21897. args: [],
  21898. source: "clear\x0a\x09\x22no op\x22",
  21899. referencedClasses: [],
  21900. messageSends: []
  21901. }),
  21902. $globals.ConsoleTranscript);
  21903. $core.addMethod(
  21904. $core.method({
  21905. selector: "cr",
  21906. protocol: 'printing',
  21907. fn: function (){
  21908. var self=this;
  21909. return self;
  21910. },
  21911. args: [],
  21912. source: "cr\x0a\x09\x22no op\x22",
  21913. referencedClasses: [],
  21914. messageSends: []
  21915. }),
  21916. $globals.ConsoleTranscript);
  21917. $core.addMethod(
  21918. $core.method({
  21919. selector: "open",
  21920. protocol: 'actions',
  21921. fn: function (){
  21922. var self=this;
  21923. return self;
  21924. },
  21925. args: [],
  21926. source: "open",
  21927. referencedClasses: [],
  21928. messageSends: []
  21929. }),
  21930. $globals.ConsoleTranscript);
  21931. $core.addMethod(
  21932. $core.method({
  21933. selector: "show:",
  21934. protocol: 'printing',
  21935. fn: function (anObject){
  21936. var self=this;
  21937. return $core.withContext(function($ctx1) {
  21938. console.log(String($recv(anObject)._asString()));
  21939. return self;
  21940. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21941. },
  21942. args: ["anObject"],
  21943. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String($recv(anObject)._asString()))>",
  21944. referencedClasses: [],
  21945. messageSends: []
  21946. }),
  21947. $globals.ConsoleTranscript);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "initialize",
  21951. protocol: 'initialization',
  21952. fn: function (){
  21953. var self=this;
  21954. return $core.withContext(function($ctx1) {
  21955. $recv($globals.Transcript)._registerIfNone_(self._new());
  21956. return self;
  21957. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21958. },
  21959. args: [],
  21960. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21961. referencedClasses: ["Transcript"],
  21962. messageSends: ["registerIfNone:", "new"]
  21963. }),
  21964. $globals.ConsoleTranscript.klass);
  21965. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21966. $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  21967. $core.addMethod(
  21968. $core.method({
  21969. selector: "ajax:",
  21970. protocol: 'actions',
  21971. fn: function (anObject){
  21972. var self=this;
  21973. return $core.withContext(function($ctx1) {
  21974. self._deprecatedAPI();
  21975. return $recv($globals.PlatformInterface)._ajax_(anObject);
  21976. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21977. },
  21978. args: ["anObject"],
  21979. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21980. referencedClasses: ["PlatformInterface"],
  21981. messageSends: ["deprecatedAPI", "ajax:"]
  21982. }),
  21983. $globals.InterfacingObject);
  21984. $core.addMethod(
  21985. $core.method({
  21986. selector: "alert:",
  21987. protocol: 'actions',
  21988. fn: function (aString){
  21989. var self=this;
  21990. return $core.withContext(function($ctx1) {
  21991. return $recv($globals.Terminal)._alert_(aString);
  21992. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21993. },
  21994. args: ["aString"],
  21995. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21996. referencedClasses: ["Terminal"],
  21997. messageSends: ["alert:"]
  21998. }),
  21999. $globals.InterfacingObject);
  22000. $core.addMethod(
  22001. $core.method({
  22002. selector: "confirm:",
  22003. protocol: 'actions',
  22004. fn: function (aString){
  22005. var self=this;
  22006. return $core.withContext(function($ctx1) {
  22007. return $recv($globals.Terminal)._confirm_(aString);
  22008. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  22009. },
  22010. args: ["aString"],
  22011. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  22012. referencedClasses: ["Terminal"],
  22013. messageSends: ["confirm:"]
  22014. }),
  22015. $globals.InterfacingObject);
  22016. $core.addMethod(
  22017. $core.method({
  22018. selector: "prompt:",
  22019. protocol: 'actions',
  22020. fn: function (aString){
  22021. var self=this;
  22022. return $core.withContext(function($ctx1) {
  22023. return $recv($globals.Terminal)._prompt_(aString);
  22024. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  22025. },
  22026. args: ["aString"],
  22027. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  22028. referencedClasses: ["Terminal"],
  22029. messageSends: ["prompt:"]
  22030. }),
  22031. $globals.InterfacingObject);
  22032. $core.addMethod(
  22033. $core.method({
  22034. selector: "prompt:default:",
  22035. protocol: 'actions',
  22036. fn: function (aString,defaultString){
  22037. var self=this;
  22038. return $core.withContext(function($ctx1) {
  22039. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  22040. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  22041. },
  22042. args: ["aString", "defaultString"],
  22043. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  22044. referencedClasses: ["Terminal"],
  22045. messageSends: ["prompt:default:"]
  22046. }),
  22047. $globals.InterfacingObject);
  22048. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  22049. $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.";
  22050. $core.addMethod(
  22051. $core.method({
  22052. selector: "addInstVarNamed:to:",
  22053. protocol: 'compiling',
  22054. fn: function (aString,aClass){
  22055. var self=this;
  22056. return $core.withContext(function($ctx1) {
  22057. var $1,$2,$3,$5,$4;
  22058. $1=self._classBuilder();
  22059. $2=$recv(aClass)._superclass();
  22060. $3=$recv(aClass)._name();
  22061. $ctx1.sendIdx["name"]=1;
  22062. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  22063. $recv($5)._add_(aString);
  22064. $4=$recv($5)._yourself();
  22065. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  22066. return self;
  22067. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  22068. },
  22069. args: ["aString", "aClass"],
  22070. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  22071. referencedClasses: [],
  22072. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  22073. }),
  22074. $globals.Environment);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "allSelectors",
  22078. protocol: 'accessing',
  22079. fn: function (){
  22080. var self=this;
  22081. return $core.withContext(function($ctx1) {
  22082. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  22083. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  22084. },
  22085. args: [],
  22086. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  22087. referencedClasses: ["Smalltalk"],
  22088. messageSends: ["allSelectors", "core"]
  22089. }),
  22090. $globals.Environment);
  22091. $core.addMethod(
  22092. $core.method({
  22093. selector: "availableClassNames",
  22094. protocol: 'accessing',
  22095. fn: function (){
  22096. var self=this;
  22097. return $core.withContext(function($ctx1) {
  22098. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  22099. return $core.withContext(function($ctx2) {
  22100. return $recv(each)._name();
  22101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22102. }));
  22103. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  22104. },
  22105. args: [],
  22106. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  22107. referencedClasses: ["Smalltalk"],
  22108. messageSends: ["collect:", "classes", "name"]
  22109. }),
  22110. $globals.Environment);
  22111. $core.addMethod(
  22112. $core.method({
  22113. selector: "availablePackageNames",
  22114. protocol: 'accessing',
  22115. fn: function (){
  22116. var self=this;
  22117. return $core.withContext(function($ctx1) {
  22118. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  22119. return $core.withContext(function($ctx2) {
  22120. return $recv(each)._name();
  22121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22122. }));
  22123. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  22124. },
  22125. args: [],
  22126. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  22127. referencedClasses: ["Smalltalk"],
  22128. messageSends: ["collect:", "packages", "name"]
  22129. }),
  22130. $globals.Environment);
  22131. $core.addMethod(
  22132. $core.method({
  22133. selector: "availableProtocolsFor:",
  22134. protocol: 'accessing',
  22135. fn: function (aClass){
  22136. var self=this;
  22137. var protocols;
  22138. return $core.withContext(function($ctx1) {
  22139. var $1,$receiver;
  22140. protocols=$recv(aClass)._protocols();
  22141. $1=$recv(aClass)._superclass();
  22142. $ctx1.sendIdx["superclass"]=1;
  22143. if(($receiver = $1) == null || $receiver.isNil){
  22144. $1;
  22145. } else {
  22146. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  22147. };
  22148. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  22149. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  22150. },
  22151. args: ["aClass"],
  22152. 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",
  22153. referencedClasses: [],
  22154. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  22155. }),
  22156. $globals.Environment);
  22157. $core.addMethod(
  22158. $core.method({
  22159. selector: "classBuilder",
  22160. protocol: 'accessing',
  22161. fn: function (){
  22162. var self=this;
  22163. return $core.withContext(function($ctx1) {
  22164. return $recv($globals.ClassBuilder)._new();
  22165. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  22166. },
  22167. args: [],
  22168. source: "classBuilder\x0a\x09^ ClassBuilder new",
  22169. referencedClasses: ["ClassBuilder"],
  22170. messageSends: ["new"]
  22171. }),
  22172. $globals.Environment);
  22173. $core.addMethod(
  22174. $core.method({
  22175. selector: "classNamed:",
  22176. protocol: 'accessing',
  22177. fn: function (aString){
  22178. var self=this;
  22179. return $core.withContext(function($ctx1) {
  22180. var $1,$receiver;
  22181. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  22182. if(($receiver = $1) == null || $receiver.isNil){
  22183. return self._error_("Invalid class name");
  22184. } else {
  22185. return $1;
  22186. };
  22187. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22188. },
  22189. args: ["aString"],
  22190. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22191. referencedClasses: ["Smalltalk"],
  22192. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22193. }),
  22194. $globals.Environment);
  22195. $core.addMethod(
  22196. $core.method({
  22197. selector: "classes",
  22198. protocol: 'accessing',
  22199. fn: function (){
  22200. var self=this;
  22201. return $core.withContext(function($ctx1) {
  22202. return $recv($globals.Smalltalk)._classes();
  22203. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22204. },
  22205. args: [],
  22206. source: "classes\x0a\x09^ Smalltalk classes",
  22207. referencedClasses: ["Smalltalk"],
  22208. messageSends: ["classes"]
  22209. }),
  22210. $globals.Environment);
  22211. $core.addMethod(
  22212. $core.method({
  22213. selector: "commitPackage:onSuccess:onError:",
  22214. protocol: 'actions',
  22215. fn: function (aPackage,aBlock,anotherBlock){
  22216. var self=this;
  22217. return $core.withContext(function($ctx1) {
  22218. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22219. return self;
  22220. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22221. },
  22222. args: ["aPackage", "aBlock", "anotherBlock"],
  22223. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22224. referencedClasses: [],
  22225. messageSends: ["commitOnSuccess:onError:", "transport"]
  22226. }),
  22227. $globals.Environment);
  22228. $core.addMethod(
  22229. $core.method({
  22230. selector: "compileClassComment:for:",
  22231. protocol: 'compiling',
  22232. fn: function (aString,aClass){
  22233. var self=this;
  22234. return $core.withContext(function($ctx1) {
  22235. $recv(aClass)._comment_(aString);
  22236. return self;
  22237. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22238. },
  22239. args: ["aString", "aClass"],
  22240. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22241. referencedClasses: [],
  22242. messageSends: ["comment:"]
  22243. }),
  22244. $globals.Environment);
  22245. $core.addMethod(
  22246. $core.method({
  22247. selector: "compileClassDefinition:",
  22248. protocol: 'compiling',
  22249. fn: function (aString){
  22250. var self=this;
  22251. return $core.withContext(function($ctx1) {
  22252. $recv((function(){
  22253. return $core.withContext(function($ctx2) {
  22254. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22256. }))._on_do_($globals.Error,(function(error){
  22257. return $core.withContext(function($ctx2) {
  22258. return self._alert_($recv(error)._messageText());
  22259. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22260. }));
  22261. return self;
  22262. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22263. },
  22264. args: ["aString"],
  22265. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22266. referencedClasses: ["DoIt", "Error"],
  22267. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22268. }),
  22269. $globals.Environment);
  22270. $core.addMethod(
  22271. $core.method({
  22272. selector: "compileMethod:for:protocol:",
  22273. protocol: 'compiling',
  22274. fn: function (sourceCode,class_,protocol){
  22275. var self=this;
  22276. return $core.withContext(function($ctx1) {
  22277. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22278. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22279. },
  22280. args: ["sourceCode", "class", "protocol"],
  22281. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22282. referencedClasses: [],
  22283. messageSends: ["compile:protocol:"]
  22284. }),
  22285. $globals.Environment);
  22286. $core.addMethod(
  22287. $core.method({
  22288. selector: "copyClass:to:",
  22289. protocol: 'actions',
  22290. fn: function (aClass,aClassName){
  22291. var self=this;
  22292. return $core.withContext(function($ctx1) {
  22293. var $1,$2,$receiver;
  22294. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22295. if(($receiver = $1) == null || $receiver.isNil){
  22296. $1;
  22297. } else {
  22298. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22299. $ctx1.sendIdx[","]=1;
  22300. self._error_($2);
  22301. };
  22302. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22303. return self;
  22304. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22305. },
  22306. args: ["aClass", "aClassName"],
  22307. 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",
  22308. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22309. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22310. }),
  22311. $globals.Environment);
  22312. $core.addMethod(
  22313. $core.method({
  22314. selector: "doItReceiver",
  22315. protocol: 'accessing',
  22316. fn: function (){
  22317. var self=this;
  22318. return $core.withContext(function($ctx1) {
  22319. return $recv($globals.DoIt)._new();
  22320. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22321. },
  22322. args: [],
  22323. source: "doItReceiver\x0a\x09^ DoIt new",
  22324. referencedClasses: ["DoIt"],
  22325. messageSends: ["new"]
  22326. }),
  22327. $globals.Environment);
  22328. $core.addMethod(
  22329. $core.method({
  22330. selector: "evaluate:for:",
  22331. protocol: 'evaluating',
  22332. fn: function (aString,anObject){
  22333. var self=this;
  22334. return $core.withContext(function($ctx1) {
  22335. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22336. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22337. },
  22338. args: ["aString", "anObject"],
  22339. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22340. referencedClasses: ["Evaluator"],
  22341. messageSends: ["evaluate:for:"]
  22342. }),
  22343. $globals.Environment);
  22344. $core.addMethod(
  22345. $core.method({
  22346. selector: "evaluate:on:do:",
  22347. protocol: 'error handling',
  22348. fn: function (aBlock,anErrorClass,exceptionBlock){
  22349. var self=this;
  22350. return $core.withContext(function($ctx1) {
  22351. var $1;
  22352. $recv(aBlock)._tryCatch_((function(exception){
  22353. return $core.withContext(function($ctx2) {
  22354. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22355. if($core.assert($1)){
  22356. return $recv(exceptionBlock)._value_(exception);
  22357. } else {
  22358. return $recv(exception)._resignal();
  22359. };
  22360. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22361. }));
  22362. return self;
  22363. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22364. },
  22365. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22366. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  22367. referencedClasses: [],
  22368. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22369. }),
  22370. $globals.Environment);
  22371. $core.addMethod(
  22372. $core.method({
  22373. selector: "inspect:",
  22374. protocol: 'actions',
  22375. fn: function (anObject){
  22376. var self=this;
  22377. return $core.withContext(function($ctx1) {
  22378. $recv($globals.Inspector)._inspect_(anObject);
  22379. return self;
  22380. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22381. },
  22382. args: ["anObject"],
  22383. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22384. referencedClasses: ["Inspector"],
  22385. messageSends: ["inspect:"]
  22386. }),
  22387. $globals.Environment);
  22388. $core.addMethod(
  22389. $core.method({
  22390. selector: "moveClass:toPackage:",
  22391. protocol: 'actions',
  22392. fn: function (aClass,aPackageName){
  22393. var self=this;
  22394. var package_;
  22395. return $core.withContext(function($ctx1) {
  22396. var $1,$2,$receiver;
  22397. package_=$recv($globals.Package)._named_(aPackageName);
  22398. $1=package_;
  22399. if(($receiver = $1) == null || $receiver.isNil){
  22400. self._error_("Invalid package name");
  22401. } else {
  22402. $1;
  22403. };
  22404. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22405. if($core.assert($2)){
  22406. return self;
  22407. };
  22408. $recv(aClass)._package_(package_);
  22409. return self;
  22410. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22411. },
  22412. args: ["aClass", "aPackageName"],
  22413. 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",
  22414. referencedClasses: ["Package"],
  22415. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22416. }),
  22417. $globals.Environment);
  22418. $core.addMethod(
  22419. $core.method({
  22420. selector: "moveMethod:toClass:",
  22421. protocol: 'actions',
  22422. fn: function (aMethod,aClassName){
  22423. var self=this;
  22424. var destinationClass;
  22425. return $core.withContext(function($ctx1) {
  22426. var $2,$3,$1,$5,$4;
  22427. destinationClass=self._classNamed_(aClassName);
  22428. $2=destinationClass;
  22429. $3=$recv(aMethod)._methodClass();
  22430. $ctx1.sendIdx["methodClass"]=1;
  22431. $1=$recv($2).__eq_eq($3);
  22432. if($core.assert($1)){
  22433. return self;
  22434. };
  22435. $5=$recv(aMethod)._methodClass();
  22436. $ctx1.sendIdx["methodClass"]=2;
  22437. $4=$recv($5)._isMetaclass();
  22438. if($core.assert($4)){
  22439. destinationClass=$recv(destinationClass)._class();
  22440. destinationClass;
  22441. };
  22442. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22443. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22444. return self;
  22445. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22446. },
  22447. args: ["aMethod", "aClassName"],
  22448. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  22449. referencedClasses: [],
  22450. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22451. }),
  22452. $globals.Environment);
  22453. $core.addMethod(
  22454. $core.method({
  22455. selector: "moveMethod:toProtocol:",
  22456. protocol: 'actions',
  22457. fn: function (aMethod,aProtocol){
  22458. var self=this;
  22459. return $core.withContext(function($ctx1) {
  22460. $recv(aMethod)._protocol_(aProtocol);
  22461. return self;
  22462. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22463. },
  22464. args: ["aMethod", "aProtocol"],
  22465. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22466. referencedClasses: [],
  22467. messageSends: ["protocol:"]
  22468. }),
  22469. $globals.Environment);
  22470. $core.addMethod(
  22471. $core.method({
  22472. selector: "packages",
  22473. protocol: 'accessing',
  22474. fn: function (){
  22475. var self=this;
  22476. return $core.withContext(function($ctx1) {
  22477. return $recv($globals.Smalltalk)._packages();
  22478. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22479. },
  22480. args: [],
  22481. source: "packages\x0a\x09^ Smalltalk packages",
  22482. referencedClasses: ["Smalltalk"],
  22483. messageSends: ["packages"]
  22484. }),
  22485. $globals.Environment);
  22486. $core.addMethod(
  22487. $core.method({
  22488. selector: "registerErrorHandler:",
  22489. protocol: 'services',
  22490. fn: function (anErrorHandler){
  22491. var self=this;
  22492. return $core.withContext(function($ctx1) {
  22493. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22494. return self;
  22495. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22496. },
  22497. args: ["anErrorHandler"],
  22498. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22499. referencedClasses: ["ErrorHandler"],
  22500. messageSends: ["register:"]
  22501. }),
  22502. $globals.Environment);
  22503. $core.addMethod(
  22504. $core.method({
  22505. selector: "registerFinder:",
  22506. protocol: 'services',
  22507. fn: function (aFinder){
  22508. var self=this;
  22509. return $core.withContext(function($ctx1) {
  22510. $recv($globals.Finder)._register_(aFinder);
  22511. return self;
  22512. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22513. },
  22514. args: ["aFinder"],
  22515. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22516. referencedClasses: ["Finder"],
  22517. messageSends: ["register:"]
  22518. }),
  22519. $globals.Environment);
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "registerInspector:",
  22523. protocol: 'services',
  22524. fn: function (anInspector){
  22525. var self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. $recv($globals.Inspector)._register_(anInspector);
  22528. return self;
  22529. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22530. },
  22531. args: ["anInspector"],
  22532. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22533. referencedClasses: ["Inspector"],
  22534. messageSends: ["register:"]
  22535. }),
  22536. $globals.Environment);
  22537. $core.addMethod(
  22538. $core.method({
  22539. selector: "registerProgressHandler:",
  22540. protocol: 'services',
  22541. fn: function (aProgressHandler){
  22542. var self=this;
  22543. return $core.withContext(function($ctx1) {
  22544. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22545. return self;
  22546. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22547. },
  22548. args: ["aProgressHandler"],
  22549. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22550. referencedClasses: ["ProgressHandler"],
  22551. messageSends: ["register:"]
  22552. }),
  22553. $globals.Environment);
  22554. $core.addMethod(
  22555. $core.method({
  22556. selector: "registerTranscript:",
  22557. protocol: 'services',
  22558. fn: function (aTranscript){
  22559. var self=this;
  22560. return $core.withContext(function($ctx1) {
  22561. $recv($globals.Transcript)._register_(aTranscript);
  22562. return self;
  22563. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22564. },
  22565. args: ["aTranscript"],
  22566. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22567. referencedClasses: ["Transcript"],
  22568. messageSends: ["register:"]
  22569. }),
  22570. $globals.Environment);
  22571. $core.addMethod(
  22572. $core.method({
  22573. selector: "removeClass:",
  22574. protocol: 'actions',
  22575. fn: function (aClass){
  22576. var self=this;
  22577. return $core.withContext(function($ctx1) {
  22578. $recv($globals.Smalltalk)._removeClass_(aClass);
  22579. return self;
  22580. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22581. },
  22582. args: ["aClass"],
  22583. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22584. referencedClasses: ["Smalltalk"],
  22585. messageSends: ["removeClass:"]
  22586. }),
  22587. $globals.Environment);
  22588. $core.addMethod(
  22589. $core.method({
  22590. selector: "removeMethod:",
  22591. protocol: 'actions',
  22592. fn: function (aMethod){
  22593. var self=this;
  22594. return $core.withContext(function($ctx1) {
  22595. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22596. return self;
  22597. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22598. },
  22599. args: ["aMethod"],
  22600. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22601. referencedClasses: [],
  22602. messageSends: ["removeCompiledMethod:", "methodClass"]
  22603. }),
  22604. $globals.Environment);
  22605. $core.addMethod(
  22606. $core.method({
  22607. selector: "removeProtocol:from:",
  22608. protocol: 'actions',
  22609. fn: function (aString,aClass){
  22610. var self=this;
  22611. return $core.withContext(function($ctx1) {
  22612. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22613. return $core.withContext(function($ctx2) {
  22614. return $recv(aClass)._removeCompiledMethod_(each);
  22615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22616. }));
  22617. return self;
  22618. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22619. },
  22620. args: ["aString", "aClass"],
  22621. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22622. referencedClasses: [],
  22623. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22624. }),
  22625. $globals.Environment);
  22626. $core.addMethod(
  22627. $core.method({
  22628. selector: "renameClass:to:",
  22629. protocol: 'actions',
  22630. fn: function (aClass,aClassName){
  22631. var self=this;
  22632. return $core.withContext(function($ctx1) {
  22633. var $1,$2,$receiver;
  22634. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22635. if(($receiver = $1) == null || $receiver.isNil){
  22636. $1;
  22637. } else {
  22638. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22639. $ctx1.sendIdx[","]=1;
  22640. self._error_($2);
  22641. };
  22642. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22643. return self;
  22644. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22645. },
  22646. args: ["aClass", "aClassName"],
  22647. 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",
  22648. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22649. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22650. }),
  22651. $globals.Environment);
  22652. $core.addMethod(
  22653. $core.method({
  22654. selector: "renamePackage:to:",
  22655. protocol: 'actions',
  22656. fn: function (aPackageName,aNewPackageName){
  22657. var self=this;
  22658. return $core.withContext(function($ctx1) {
  22659. var $1,$2,$receiver;
  22660. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22661. if(($receiver = $1) == null || $receiver.isNil){
  22662. $1;
  22663. } else {
  22664. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22665. $ctx1.sendIdx[","]=1;
  22666. self._error_($2);
  22667. };
  22668. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22669. return self;
  22670. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22671. },
  22672. args: ["aPackageName", "aNewPackageName"],
  22673. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  22674. referencedClasses: ["Smalltalk"],
  22675. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22676. }),
  22677. $globals.Environment);
  22678. $core.addMethod(
  22679. $core.method({
  22680. selector: "renameProtocol:to:in:",
  22681. protocol: 'actions',
  22682. fn: function (aString,anotherString,aClass){
  22683. var self=this;
  22684. return $core.withContext(function($ctx1) {
  22685. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22686. return $core.withContext(function($ctx2) {
  22687. return $recv(each)._protocol_(anotherString);
  22688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22689. }));
  22690. return self;
  22691. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22692. },
  22693. args: ["aString", "anotherString", "aClass"],
  22694. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22695. referencedClasses: [],
  22696. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22697. }),
  22698. $globals.Environment);
  22699. $core.addMethod(
  22700. $core.method({
  22701. selector: "setClassCommentOf:to:",
  22702. protocol: 'actions',
  22703. fn: function (aClass,aString){
  22704. var self=this;
  22705. return $core.withContext(function($ctx1) {
  22706. $recv(aClass)._comment_(aString);
  22707. return self;
  22708. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22709. },
  22710. args: ["aClass", "aString"],
  22711. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22712. referencedClasses: [],
  22713. messageSends: ["comment:"]
  22714. }),
  22715. $globals.Environment);
  22716. $core.addMethod(
  22717. $core.method({
  22718. selector: "systemAnnouncer",
  22719. protocol: 'accessing',
  22720. fn: function (){
  22721. var self=this;
  22722. return $core.withContext(function($ctx1) {
  22723. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  22724. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22725. },
  22726. args: [],
  22727. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22728. referencedClasses: ["Smalltalk"],
  22729. messageSends: ["current", "at:", "globals"]
  22730. }),
  22731. $globals.Environment);
  22732. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22733. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22734. $core.addMethod(
  22735. $core.method({
  22736. selector: "do:on:displaying:",
  22737. protocol: 'progress handling',
  22738. fn: function (aBlock,aCollection,aString){
  22739. var self=this;
  22740. return $core.withContext(function($ctx1) {
  22741. $recv(aCollection)._do_(aBlock);
  22742. return self;
  22743. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22744. },
  22745. args: ["aBlock", "aCollection", "aString"],
  22746. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22747. referencedClasses: [],
  22748. messageSends: ["do:"]
  22749. }),
  22750. $globals.NullProgressHandler);
  22751. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22752. $core.addMethod(
  22753. $core.method({
  22754. selector: "initialize",
  22755. protocol: 'initialization',
  22756. fn: function (){
  22757. var self=this;
  22758. return $core.withContext(function($ctx1) {
  22759. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  22760. return self;
  22761. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22762. },
  22763. args: [],
  22764. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22765. referencedClasses: ["ProgressHandler"],
  22766. messageSends: ["registerIfNone:", "new"]
  22767. }),
  22768. $globals.NullProgressHandler.klass);
  22769. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22770. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22771. $core.addMethod(
  22772. $core.method({
  22773. selector: "ajax:",
  22774. protocol: 'actions',
  22775. fn: function (anObject){
  22776. var self=this;
  22777. return $core.withContext(function($ctx1) {
  22778. var $receiver;
  22779. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22780. if(($receiver = $globals.JQuery) == null || $receiver.isNil){
  22781. return self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22782. } else {
  22783. return $recv($recv($globals.JQuery)._current())._ajax_(anObject);
  22784. };
  22785. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22786. },
  22787. args: ["anObject"],
  22788. source: "ajax: anObject\x0a\x09self deprecatedAPI: 'Use Platform newXhr or dedicated library.'.\x0a\x09^ JQuery\x0a\x09\x09ifNotNil: [ JQuery current ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ]",
  22789. referencedClasses: ["JQuery"],
  22790. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22791. }),
  22792. $globals.PlatformInterface.klass);
  22793. $core.addMethod(
  22794. $core.method({
  22795. selector: "alert:",
  22796. protocol: 'actions',
  22797. fn: function (aString){
  22798. var self=this;
  22799. return $core.withContext(function($ctx1) {
  22800. self._deprecatedAPI_("Use Terminal alert:");
  22801. return $recv($globals.Terminal)._alert_(aString);
  22802. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22803. },
  22804. args: ["aString"],
  22805. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22806. referencedClasses: ["Terminal"],
  22807. messageSends: ["deprecatedAPI:", "alert:"]
  22808. }),
  22809. $globals.PlatformInterface.klass);
  22810. $core.addMethod(
  22811. $core.method({
  22812. selector: "confirm:",
  22813. protocol: 'actions',
  22814. fn: function (aString){
  22815. var self=this;
  22816. return $core.withContext(function($ctx1) {
  22817. self._deprecatedAPI_("Use Terminal confirm:");
  22818. return $recv($globals.Terminal)._confirm_(aString);
  22819. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22820. },
  22821. args: ["aString"],
  22822. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22823. referencedClasses: ["Terminal"],
  22824. messageSends: ["deprecatedAPI:", "confirm:"]
  22825. }),
  22826. $globals.PlatformInterface.klass);
  22827. $core.addMethod(
  22828. $core.method({
  22829. selector: "existsGlobal:",
  22830. protocol: 'actions',
  22831. fn: function (aString){
  22832. var self=this;
  22833. return $core.withContext(function($ctx1) {
  22834. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22835. return $recv($recv($globals.PlatformInterface)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22836. return true;
  22837. }),(function(){
  22838. return false;
  22839. }));
  22840. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22841. },
  22842. args: ["aString"],
  22843. source: "existsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Smalltalk existsJsGlobal:'.\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22844. referencedClasses: ["PlatformInterface"],
  22845. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22846. }),
  22847. $globals.PlatformInterface.klass);
  22848. $core.addMethod(
  22849. $core.method({
  22850. selector: "globals",
  22851. protocol: 'accessing',
  22852. fn: function (){
  22853. var self=this;
  22854. return $core.withContext(function($ctx1) {
  22855. self._deprecatedAPI_("Use Platform globals");
  22856. return $recv($globals.Platform)._globals();
  22857. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22858. },
  22859. args: [],
  22860. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22861. referencedClasses: ["Platform"],
  22862. messageSends: ["deprecatedAPI:", "globals"]
  22863. }),
  22864. $globals.PlatformInterface.klass);
  22865. $core.addMethod(
  22866. $core.method({
  22867. selector: "newXhr",
  22868. protocol: 'actions',
  22869. fn: function (){
  22870. var self=this;
  22871. return $core.withContext(function($ctx1) {
  22872. self._deprecatedAPI_("Use Platform newXhr");
  22873. return $recv($globals.Platform)._newXhr();
  22874. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22875. },
  22876. args: [],
  22877. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22878. referencedClasses: ["Platform"],
  22879. messageSends: ["deprecatedAPI:", "newXhr"]
  22880. }),
  22881. $globals.PlatformInterface.klass);
  22882. $core.addMethod(
  22883. $core.method({
  22884. selector: "prompt:",
  22885. protocol: 'actions',
  22886. fn: function (aString){
  22887. var self=this;
  22888. return $core.withContext(function($ctx1) {
  22889. self._deprecatedAPI_("Use Terminal prompt:");
  22890. return $recv($globals.Terminal)._prompt_(aString);
  22891. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22892. },
  22893. args: ["aString"],
  22894. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22895. referencedClasses: ["Terminal"],
  22896. messageSends: ["deprecatedAPI:", "prompt:"]
  22897. }),
  22898. $globals.PlatformInterface.klass);
  22899. $core.addMethod(
  22900. $core.method({
  22901. selector: "prompt:default:",
  22902. protocol: 'actions',
  22903. fn: function (aString,defaultString){
  22904. var self=this;
  22905. return $core.withContext(function($ctx1) {
  22906. self._deprecatedAPI_("Use Terminal prompt:default:");
  22907. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  22908. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22909. },
  22910. args: ["aString", "defaultString"],
  22911. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22912. referencedClasses: ["Terminal"],
  22913. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22914. }),
  22915. $globals.PlatformInterface.klass);
  22916. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22917. $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.";
  22918. $globals.Service.klass.iVarNames = ['current'];
  22919. $core.addMethod(
  22920. $core.method({
  22921. selector: "current",
  22922. protocol: 'accessing',
  22923. fn: function (){
  22924. var self=this;
  22925. return self["@current"];
  22926. },
  22927. args: [],
  22928. source: "current\x0a\x09^ current",
  22929. referencedClasses: [],
  22930. messageSends: []
  22931. }),
  22932. $globals.Service.klass);
  22933. $core.addMethod(
  22934. $core.method({
  22935. selector: "new",
  22936. protocol: 'instance creation',
  22937. fn: function (){
  22938. var self=this;
  22939. return $core.withContext(function($ctx1) {
  22940. self._shouldNotImplement();
  22941. return self;
  22942. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22943. },
  22944. args: [],
  22945. source: "new\x0a\x09self shouldNotImplement",
  22946. referencedClasses: [],
  22947. messageSends: ["shouldNotImplement"]
  22948. }),
  22949. $globals.Service.klass);
  22950. $core.addMethod(
  22951. $core.method({
  22952. selector: "register:",
  22953. protocol: 'registration',
  22954. fn: function (anObject){
  22955. var self=this;
  22956. self["@current"]=anObject;
  22957. return self;
  22958. },
  22959. args: ["anObject"],
  22960. source: "register: anObject\x0a\x09current := anObject",
  22961. referencedClasses: [],
  22962. messageSends: []
  22963. }),
  22964. $globals.Service.klass);
  22965. $core.addMethod(
  22966. $core.method({
  22967. selector: "registerIfNone:",
  22968. protocol: 'registration',
  22969. fn: function (anObject){
  22970. var self=this;
  22971. return $core.withContext(function($ctx1) {
  22972. var $1,$receiver;
  22973. $1=self._current();
  22974. if(($receiver = $1) == null || $receiver.isNil){
  22975. self._register_(anObject);
  22976. } else {
  22977. $1;
  22978. };
  22979. return self;
  22980. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22981. },
  22982. args: ["anObject"],
  22983. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22984. referencedClasses: [],
  22985. messageSends: ["ifNil:", "current", "register:"]
  22986. }),
  22987. $globals.Service.klass);
  22988. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22989. $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.";
  22990. $core.addMethod(
  22991. $core.method({
  22992. selector: "handleError:",
  22993. protocol: 'error handling',
  22994. fn: function (anError){
  22995. var self=this;
  22996. return $core.withContext(function($ctx1) {
  22997. self._handleUnhandledError_(anError);
  22998. return self;
  22999. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  23000. },
  23001. args: ["anError"],
  23002. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  23003. referencedClasses: [],
  23004. messageSends: ["handleUnhandledError:"]
  23005. }),
  23006. $globals.ErrorHandler.klass);
  23007. $core.addMethod(
  23008. $core.method({
  23009. selector: "handleUnhandledError:",
  23010. protocol: 'error handling',
  23011. fn: function (anError){
  23012. var self=this;
  23013. return $core.withContext(function($ctx1) {
  23014. var $1;
  23015. $1=$recv(anError)._wasHandled();
  23016. if($core.assert($1)){
  23017. return self;
  23018. };
  23019. return $recv(self._current())._handleError_(anError);
  23020. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  23021. },
  23022. args: ["anError"],
  23023. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  23024. referencedClasses: [],
  23025. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  23026. }),
  23027. $globals.ErrorHandler.klass);
  23028. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  23029. $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.";
  23030. $core.addMethod(
  23031. $core.method({
  23032. selector: "findClass:",
  23033. protocol: 'finding',
  23034. fn: function (aClass){
  23035. var self=this;
  23036. return $core.withContext(function($ctx1) {
  23037. return $recv(self._current())._findClass_(aClass);
  23038. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  23039. },
  23040. args: ["aClass"],
  23041. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  23042. referencedClasses: [],
  23043. messageSends: ["findClass:", "current"]
  23044. }),
  23045. $globals.Finder.klass);
  23046. $core.addMethod(
  23047. $core.method({
  23048. selector: "findMethod:",
  23049. protocol: 'finding',
  23050. fn: function (aCompiledMethod){
  23051. var self=this;
  23052. return $core.withContext(function($ctx1) {
  23053. return $recv(self._current())._findMethod_(aCompiledMethod);
  23054. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  23055. },
  23056. args: ["aCompiledMethod"],
  23057. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  23058. referencedClasses: [],
  23059. messageSends: ["findMethod:", "current"]
  23060. }),
  23061. $globals.Finder.klass);
  23062. $core.addMethod(
  23063. $core.method({
  23064. selector: "findString:",
  23065. protocol: 'finding',
  23066. fn: function (aString){
  23067. var self=this;
  23068. return $core.withContext(function($ctx1) {
  23069. return $recv(self._current())._findString_(aString);
  23070. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  23071. },
  23072. args: ["aString"],
  23073. source: "findString: aString\x0a\x09^ self current findString: aString",
  23074. referencedClasses: [],
  23075. messageSends: ["findString:", "current"]
  23076. }),
  23077. $globals.Finder.klass);
  23078. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  23079. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  23080. $core.addMethod(
  23081. $core.method({
  23082. selector: "inspect:",
  23083. protocol: 'inspecting',
  23084. fn: function (anObject){
  23085. var self=this;
  23086. return $core.withContext(function($ctx1) {
  23087. return $recv(self._current())._inspect_(anObject);
  23088. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  23089. },
  23090. args: ["anObject"],
  23091. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  23092. referencedClasses: [],
  23093. messageSends: ["inspect:", "current"]
  23094. }),
  23095. $globals.Inspector.klass);
  23096. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  23097. $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";
  23098. $core.addMethod(
  23099. $core.method({
  23100. selector: "globals",
  23101. protocol: 'accessing',
  23102. fn: function (){
  23103. var self=this;
  23104. return $core.withContext(function($ctx1) {
  23105. return $recv(self._current())._globals();
  23106. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  23107. },
  23108. args: [],
  23109. source: "globals\x0a\x09^ self current globals",
  23110. referencedClasses: [],
  23111. messageSends: ["globals", "current"]
  23112. }),
  23113. $globals.Platform.klass);
  23114. $core.addMethod(
  23115. $core.method({
  23116. selector: "newXhr",
  23117. protocol: 'accessing',
  23118. fn: function (){
  23119. var self=this;
  23120. return $core.withContext(function($ctx1) {
  23121. return $recv(self._current())._newXhr();
  23122. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  23123. },
  23124. args: [],
  23125. source: "newXhr\x0a\x09^ self current newXhr",
  23126. referencedClasses: [],
  23127. messageSends: ["newXhr", "current"]
  23128. }),
  23129. $globals.Platform.klass);
  23130. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  23131. $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`.";
  23132. $core.addMethod(
  23133. $core.method({
  23134. selector: "do:on:displaying:",
  23135. protocol: 'progress handling',
  23136. fn: function (aBlock,aCollection,aString){
  23137. var self=this;
  23138. return $core.withContext(function($ctx1) {
  23139. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  23140. return self;
  23141. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  23142. },
  23143. args: ["aBlock", "aCollection", "aString"],
  23144. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  23145. referencedClasses: [],
  23146. messageSends: ["do:on:displaying:", "current"]
  23147. }),
  23148. $globals.ProgressHandler.klass);
  23149. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  23150. $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:'.";
  23151. $core.addMethod(
  23152. $core.method({
  23153. selector: "alert:",
  23154. protocol: 'dialogs',
  23155. fn: function (aString){
  23156. var self=this;
  23157. return $core.withContext(function($ctx1) {
  23158. return $recv(self._current())._alert_(aString);
  23159. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  23160. },
  23161. args: ["aString"],
  23162. source: "alert: aString\x0a\x09^ self current alert: aString",
  23163. referencedClasses: [],
  23164. messageSends: ["alert:", "current"]
  23165. }),
  23166. $globals.Terminal.klass);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "confirm:",
  23170. protocol: 'dialogs',
  23171. fn: function (aString){
  23172. var self=this;
  23173. return $core.withContext(function($ctx1) {
  23174. return $recv(self._current())._confirm_(aString);
  23175. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23176. },
  23177. args: ["aString"],
  23178. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23179. referencedClasses: [],
  23180. messageSends: ["confirm:", "current"]
  23181. }),
  23182. $globals.Terminal.klass);
  23183. $core.addMethod(
  23184. $core.method({
  23185. selector: "prompt:",
  23186. protocol: 'dialogs',
  23187. fn: function (aString){
  23188. var self=this;
  23189. return $core.withContext(function($ctx1) {
  23190. return $recv(self._current())._prompt_(aString);
  23191. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23192. },
  23193. args: ["aString"],
  23194. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23195. referencedClasses: [],
  23196. messageSends: ["prompt:", "current"]
  23197. }),
  23198. $globals.Terminal.klass);
  23199. $core.addMethod(
  23200. $core.method({
  23201. selector: "prompt:default:",
  23202. protocol: 'dialogs',
  23203. fn: function (aString,defaultString){
  23204. var self=this;
  23205. return $core.withContext(function($ctx1) {
  23206. return $recv(self._current())._prompt_default_(aString,defaultString);
  23207. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23208. },
  23209. args: ["aString", "defaultString"],
  23210. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23211. referencedClasses: [],
  23212. messageSends: ["prompt:default:", "current"]
  23213. }),
  23214. $globals.Terminal.klass);
  23215. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23216. $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.";
  23217. $core.addMethod(
  23218. $core.method({
  23219. selector: "clear",
  23220. protocol: 'printing',
  23221. fn: function (){
  23222. var self=this;
  23223. return $core.withContext(function($ctx1) {
  23224. $recv(self._current())._clear();
  23225. return self;
  23226. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23227. },
  23228. args: [],
  23229. source: "clear\x0a\x09self current clear",
  23230. referencedClasses: [],
  23231. messageSends: ["clear", "current"]
  23232. }),
  23233. $globals.Transcript.klass);
  23234. $core.addMethod(
  23235. $core.method({
  23236. selector: "cr",
  23237. protocol: 'printing',
  23238. fn: function (){
  23239. var self=this;
  23240. return $core.withContext(function($ctx1) {
  23241. $recv(self._current())._show_($recv($globals.String)._cr());
  23242. return self;
  23243. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23244. },
  23245. args: [],
  23246. source: "cr\x0a\x09self current show: String cr",
  23247. referencedClasses: ["String"],
  23248. messageSends: ["show:", "current", "cr"]
  23249. }),
  23250. $globals.Transcript.klass);
  23251. $core.addMethod(
  23252. $core.method({
  23253. selector: "inspect:",
  23254. protocol: 'printing',
  23255. fn: function (anObject){
  23256. var self=this;
  23257. return $core.withContext(function($ctx1) {
  23258. self._show_(anObject);
  23259. return self;
  23260. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23261. },
  23262. args: ["anObject"],
  23263. source: "inspect: anObject\x0a\x09self show: anObject",
  23264. referencedClasses: [],
  23265. messageSends: ["show:"]
  23266. }),
  23267. $globals.Transcript.klass);
  23268. $core.addMethod(
  23269. $core.method({
  23270. selector: "open",
  23271. protocol: 'instance creation',
  23272. fn: function (){
  23273. var self=this;
  23274. return $core.withContext(function($ctx1) {
  23275. $recv(self._current())._open();
  23276. return self;
  23277. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23278. },
  23279. args: [],
  23280. source: "open\x0a\x09self current open",
  23281. referencedClasses: [],
  23282. messageSends: ["open", "current"]
  23283. }),
  23284. $globals.Transcript.klass);
  23285. $core.addMethod(
  23286. $core.method({
  23287. selector: "show:",
  23288. protocol: 'printing',
  23289. fn: function (anObject){
  23290. var self=this;
  23291. return $core.withContext(function($ctx1) {
  23292. $recv(self._current())._show_(anObject);
  23293. return self;
  23294. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23295. },
  23296. args: ["anObject"],
  23297. source: "show: anObject\x0a\x09self current show: anObject",
  23298. referencedClasses: [],
  23299. messageSends: ["show:", "current"]
  23300. }),
  23301. $globals.Transcript.klass);
  23302. $core.addMethod(
  23303. $core.method({
  23304. selector: "inspectOn:",
  23305. protocol: '*Platform-Services',
  23306. fn: function (anInspector){
  23307. var self=this;
  23308. var variables;
  23309. return $core.withContext(function($ctx1) {
  23310. variables=$recv($globals.Dictionary)._new();
  23311. $recv(variables)._at_put_("#self",self);
  23312. $ctx1.sendIdx["at:put:"]=1;
  23313. $recv(variables)._at_put_("#keys",self._keys());
  23314. $ctx1.sendIdx["at:put:"]=2;
  23315. self._keysAndValuesDo_((function(key,value){
  23316. return $core.withContext(function($ctx2) {
  23317. return $recv(variables)._at_put_(key,value);
  23318. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23319. }));
  23320. $recv(anInspector)._setLabel_(self._printString());
  23321. $recv(anInspector)._setVariables_(variables);
  23322. return self;
  23323. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23324. },
  23325. args: ["anInspector"],
  23326. 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",
  23327. referencedClasses: ["Dictionary"],
  23328. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23329. }),
  23330. $globals.AssociativeCollection);
  23331. $core.addMethod(
  23332. $core.method({
  23333. selector: "inspectOn:",
  23334. protocol: '*Platform-Services',
  23335. fn: function (anInspector){
  23336. var self=this;
  23337. var variables;
  23338. return $core.withContext(function($ctx1) {
  23339. variables=$recv($globals.Dictionary)._new();
  23340. $recv(variables)._at_put_("#self",self);
  23341. $ctx1.sendIdx["at:put:"]=1;
  23342. self._withIndexDo_((function(each,i){
  23343. return $core.withContext(function($ctx2) {
  23344. return $recv(variables)._at_put_(i,each);
  23345. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23346. }));
  23347. $recv(anInspector)._setLabel_(self._printString());
  23348. $recv(anInspector)._setVariables_(variables);
  23349. return self;
  23350. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23351. },
  23352. args: ["anInspector"],
  23353. 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",
  23354. referencedClasses: ["Dictionary"],
  23355. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23356. }),
  23357. $globals.Collection);
  23358. $core.addMethod(
  23359. $core.method({
  23360. selector: "inspectOn:",
  23361. protocol: '*Platform-Services',
  23362. fn: function (anInspector){
  23363. var self=this;
  23364. var variables;
  23365. return $core.withContext(function($ctx1) {
  23366. variables=$recv($globals.Dictionary)._new();
  23367. $recv(variables)._at_put_("#self",self);
  23368. $ctx1.sendIdx["at:put:"]=1;
  23369. $recv(variables)._at_put_("#year",self._year());
  23370. $ctx1.sendIdx["at:put:"]=2;
  23371. $recv(variables)._at_put_("#month",self._month());
  23372. $ctx1.sendIdx["at:put:"]=3;
  23373. $recv(variables)._at_put_("#day",self._day());
  23374. $ctx1.sendIdx["at:put:"]=4;
  23375. $recv(variables)._at_put_("#hours",self._hours());
  23376. $ctx1.sendIdx["at:put:"]=5;
  23377. $recv(variables)._at_put_("#minutes",self._minutes());
  23378. $ctx1.sendIdx["at:put:"]=6;
  23379. $recv(variables)._at_put_("#seconds",self._seconds());
  23380. $ctx1.sendIdx["at:put:"]=7;
  23381. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23382. $recv(anInspector)._setLabel_(self._printString());
  23383. $recv(anInspector)._setVariables_(variables);
  23384. return self;
  23385. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23386. },
  23387. args: ["anInspector"],
  23388. 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",
  23389. referencedClasses: ["Dictionary"],
  23390. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23391. }),
  23392. $globals.Date);
  23393. $core.addMethod(
  23394. $core.method({
  23395. selector: "inspectOn:",
  23396. protocol: '*Platform-Services',
  23397. fn: function (anInspector){
  23398. var self=this;
  23399. var variables;
  23400. return $core.withContext(function($ctx1) {
  23401. variables=$recv($globals.Dictionary)._new();
  23402. $recv(variables)._at_put_("#self",self._jsObject());
  23403. $recv(anInspector)._setLabel_(self._printString());
  23404. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23405. $recv(anInspector)._setVariables_(variables);
  23406. return self;
  23407. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23408. },
  23409. args: ["anInspector"],
  23410. 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",
  23411. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23412. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23413. }),
  23414. $globals.JSObjectProxy);
  23415. $core.addMethod(
  23416. $core.method({
  23417. selector: "inspectOn:",
  23418. protocol: '*Platform-Services',
  23419. fn: function (anInspector){
  23420. var self=this;
  23421. var variables;
  23422. return $core.withContext(function($ctx1) {
  23423. variables=$recv($globals.Dictionary)._new();
  23424. $recv(variables)._at_put_("#self",self);
  23425. $ctx1.sendIdx["at:put:"]=1;
  23426. $recv(variables)._at_put_("#home",self._home());
  23427. $ctx1.sendIdx["at:put:"]=2;
  23428. $recv(variables)._at_put_("#receiver",self._receiver());
  23429. $ctx1.sendIdx["at:put:"]=3;
  23430. $recv(variables)._at_put_("#selector",self._selector());
  23431. $ctx1.sendIdx["at:put:"]=4;
  23432. $recv(variables)._at_put_("#locals",self._locals());
  23433. $ctx1.sendIdx["at:put:"]=5;
  23434. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23435. return $core.withContext(function($ctx2) {
  23436. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23438. }));
  23439. $recv(anInspector)._setLabel_(self._printString());
  23440. $recv(anInspector)._setVariables_(variables);
  23441. return self;
  23442. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23443. },
  23444. args: ["anInspector"],
  23445. 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",
  23446. referencedClasses: ["Dictionary"],
  23447. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23448. }),
  23449. $globals.MethodContext);
  23450. $core.addMethod(
  23451. $core.method({
  23452. selector: "inspectOn:",
  23453. protocol: '*Platform-Services',
  23454. fn: function (anInspector){
  23455. var self=this;
  23456. var variables;
  23457. return $core.withContext(function($ctx1) {
  23458. variables=$recv($globals.Dictionary)._new();
  23459. $recv(variables)._at_put_("#self",self);
  23460. $ctx1.sendIdx["at:put:"]=1;
  23461. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23462. return $core.withContext(function($ctx2) {
  23463. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23465. }));
  23466. $recv(anInspector)._setLabel_(self._printString());
  23467. $recv(anInspector)._setVariables_(variables);
  23468. return self;
  23469. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23470. },
  23471. args: ["anInspector"],
  23472. 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",
  23473. referencedClasses: ["Dictionary"],
  23474. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23475. }),
  23476. $globals.Object);
  23477. $core.addMethod(
  23478. $core.method({
  23479. selector: "do:displayingProgress:",
  23480. protocol: '*Platform-Services',
  23481. fn: function (aBlock,aString){
  23482. var self=this;
  23483. return $core.withContext(function($ctx1) {
  23484. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23485. return self;
  23486. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23487. },
  23488. args: ["aBlock", "aString"],
  23489. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23490. referencedClasses: ["ProgressHandler"],
  23491. messageSends: ["do:on:displaying:"]
  23492. }),
  23493. $globals.SequenceableCollection);
  23494. $core.addMethod(
  23495. $core.method({
  23496. selector: "inspectOn:",
  23497. protocol: '*Platform-Services',
  23498. fn: function (anInspector){
  23499. var self=this;
  23500. var variables,i;
  23501. return $core.withContext(function($ctx1) {
  23502. variables=$recv($globals.Dictionary)._new();
  23503. $recv(variables)._at_put_("#self",self);
  23504. $ctx1.sendIdx["at:put:"]=1;
  23505. i=(1);
  23506. self._do_((function(each){
  23507. return $core.withContext(function($ctx2) {
  23508. $recv(variables)._at_put_(i,each);
  23509. i=$recv(i).__plus((1));
  23510. return i;
  23511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23512. }));
  23513. $recv(anInspector)._setLabel_(self._printString());
  23514. $recv(anInspector)._setVariables_(variables);
  23515. return self;
  23516. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23517. },
  23518. args: ["anInspector"],
  23519. 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",
  23520. referencedClasses: ["Dictionary"],
  23521. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23522. }),
  23523. $globals.Set);
  23524. $core.addMethod(
  23525. $core.method({
  23526. selector: "inspectOn:",
  23527. protocol: '*Platform-Services',
  23528. fn: function (anInspector){
  23529. var self=this;
  23530. var label;
  23531. return $core.withContext(function($ctx1) {
  23532. var $3,$2,$1,$5,$4;
  23533. (
  23534. $ctx1.supercall = true,
  23535. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23536. $ctx1.supercall = false;
  23537. $3=self._printString();
  23538. $ctx1.sendIdx["printString"]=1;
  23539. $2=$recv($3)._size();
  23540. $1=$recv($2).__gt((30));
  23541. if($core.assert($1)){
  23542. $5=self._printString();
  23543. $ctx1.sendIdx["printString"]=2;
  23544. $4=$recv($5)._copyFrom_to_((1),(30));
  23545. label=$recv($4).__comma("...'");
  23546. label;
  23547. } else {
  23548. label=self._printString();
  23549. label;
  23550. };
  23551. $recv(anInspector)._setLabel_(label);
  23552. return self;
  23553. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23554. },
  23555. args: ["anInspector"],
  23556. 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",
  23557. referencedClasses: [],
  23558. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23559. }),
  23560. $globals.String);
  23561. });
  23562. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23563. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23564. $core.addPackage('Platform-Node');
  23565. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23566. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23567. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23568. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23569. $core.addMethod(
  23570. $core.method({
  23571. selector: "globals",
  23572. protocol: 'accessing',
  23573. fn: function (){
  23574. var self=this;
  23575. return global;
  23576. },
  23577. args: [],
  23578. source: "globals\x0a\x09^ global",
  23579. referencedClasses: [],
  23580. messageSends: []
  23581. }),
  23582. $globals.NodePlatform);
  23583. $core.addMethod(
  23584. $core.method({
  23585. selector: "newXhr",
  23586. protocol: 'accessing',
  23587. fn: function (){
  23588. var self=this;
  23589. return $core.withContext(function($ctx1) {
  23590. var $receiver;
  23591. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23592. self._error_("XMLHttpRequest not available.");
  23593. } else {
  23594. return $recv($globals.XMLHttpRequest)._new();
  23595. };
  23596. return self;
  23597. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23598. },
  23599. args: [],
  23600. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23601. referencedClasses: ["XMLHttpRequest"],
  23602. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23603. }),
  23604. $globals.NodePlatform);
  23605. $core.addMethod(
  23606. $core.method({
  23607. selector: "initialize",
  23608. protocol: 'testing',
  23609. fn: function (){
  23610. var self=this;
  23611. return $core.withContext(function($ctx1) {
  23612. var $1;
  23613. $1=self._isFeasible();
  23614. if($core.assert($1)){
  23615. $recv($globals.Platform)._registerIfNone_(self._new());
  23616. };
  23617. return self;
  23618. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23619. },
  23620. args: [],
  23621. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23622. referencedClasses: ["Platform"],
  23623. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23624. }),
  23625. $globals.NodePlatform.klass);
  23626. $core.addMethod(
  23627. $core.method({
  23628. selector: "isFeasible",
  23629. protocol: 'testing',
  23630. fn: function (){
  23631. var self=this;
  23632. return $core.withContext(function($ctx1) {
  23633. return typeof global !== "undefined";
  23634. return self;
  23635. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23636. },
  23637. args: [],
  23638. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23639. referencedClasses: [],
  23640. messageSends: []
  23641. }),
  23642. $globals.NodePlatform.klass);
  23643. });
  23644. define('amber/deploy',[
  23645. './helpers',
  23646. './compatibility', // pre-fetch, dep of ./boot
  23647. './boot', // pre-fetch, dep of ./helpers
  23648. // --- packages of the core Amber begin here ---
  23649. 'amber_core/Kernel-Objects',
  23650. 'amber_core/Kernel-Classes',
  23651. 'amber_core/Kernel-Methods',
  23652. 'amber_core/Kernel-Collections',
  23653. 'amber_core/Kernel-Infrastructure',
  23654. 'amber_core/Kernel-Promises',
  23655. 'amber_core/Kernel-Exceptions',
  23656. 'amber_core/Kernel-Announcements',
  23657. 'amber_core/Platform-Services',
  23658. 'amber/Platform'
  23659. // --- packages of the core Amber end here ---
  23660. ], function (amber) { return amber; });
  23661. define('amber/parser',['./boot'], function($boot) {
  23662. var $globals = $boot.globals, nil = $boot.nil;
  23663. $globals.SmalltalkParser = (function() {
  23664. "use strict";
  23665. /*
  23666. * Generated by PEG.js 0.9.0.
  23667. *
  23668. * http://pegjs.org/
  23669. */
  23670. function peg$subclass(child, parent) {
  23671. function ctor() { this.constructor = child; }
  23672. ctor.prototype = parent.prototype;
  23673. child.prototype = new ctor();
  23674. }
  23675. function peg$SyntaxError(message, expected, found, location) {
  23676. this.message = message;
  23677. this.expected = expected;
  23678. this.found = found;
  23679. this.location = location;
  23680. this.name = "SyntaxError";
  23681. if (typeof Error.captureStackTrace === "function") {
  23682. Error.captureStackTrace(this, peg$SyntaxError);
  23683. }
  23684. }
  23685. peg$subclass(peg$SyntaxError, Error);
  23686. function peg$parse(input) {
  23687. var options = arguments.length > 1 ? arguments[1] : {},
  23688. parser = this,
  23689. peg$FAILED = {},
  23690. peg$startRuleFunctions = { start: peg$parsestart },
  23691. peg$startRuleFunction = peg$parsestart,
  23692. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23693. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23694. peg$c2 = "\"",
  23695. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23696. peg$c4 = /^[^"]/,
  23697. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23698. peg$c6 = ".",
  23699. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23700. peg$c8 = /^[a-zA-Z]/,
  23701. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23702. peg$c10 = /^[a-zA-Z0-9]/,
  23703. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23704. peg$c12 = function(first, others) {return first + others.join("");},
  23705. peg$c13 = ":",
  23706. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23707. peg$c15 = function(first, last) {return first + last;},
  23708. peg$c16 = /^[a-zA-Z0-9:]/,
  23709. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23710. peg$c18 = /^[A-Z]/,
  23711. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23712. peg$c20 = "'",
  23713. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23714. peg$c22 = "''",
  23715. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23716. peg$c24 = function() {return "'";},
  23717. peg$c25 = /^[^']/,
  23718. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23719. peg$c27 = function(val) {
  23720. return $globals.ValueNode._new()
  23721. ._location_(location())
  23722. ._source_(text())
  23723. ._value_(val.join(""));
  23724. },
  23725. peg$c28 = "$",
  23726. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23727. peg$c30 = { type: "any", description: "any character" },
  23728. peg$c31 = function(char) {
  23729. return $globals.ValueNode._new()
  23730. ._location_(location())
  23731. ._source_(text())
  23732. ._value_(char);
  23733. },
  23734. peg$c32 = "#",
  23735. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23736. peg$c34 = function(rest) {return rest;},
  23737. peg$c35 = function(node) {return node._value();},
  23738. peg$c36 = function(val) {
  23739. return $globals.ValueNode._new()
  23740. ._location_(location())
  23741. ._source_(text())
  23742. ._value_(val);
  23743. },
  23744. peg$c37 = function(n) {
  23745. return $globals.ValueNode._new()
  23746. ._location_(location())
  23747. ._source_(text())
  23748. ._value_(n);
  23749. },
  23750. peg$c38 = "e",
  23751. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23752. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23753. peg$c41 = "-",
  23754. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23755. peg$c43 = "16r",
  23756. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23757. peg$c45 = /^[0-9a-fA-F]/,
  23758. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23759. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23760. peg$c48 = /^[0-9]/,
  23761. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23762. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23763. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23764. peg$c52 = "#(",
  23765. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23766. peg$c54 = ")",
  23767. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23768. peg$c56 = function(rest) {
  23769. return rest
  23770. ._location_(location())
  23771. ._source_(text());
  23772. },
  23773. peg$c57 = "(",
  23774. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23775. peg$c59 = function(lit) {return lit._value();},
  23776. peg$c60 = function(lits) {
  23777. return $globals.ValueNode._new()
  23778. ._value_(lits);
  23779. },
  23780. peg$c61 = "{",
  23781. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23782. peg$c63 = "}",
  23783. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23784. peg$c65 = function(expressions) {
  23785. return $globals.DynamicArrayNode._new()
  23786. ._location_(location())
  23787. ._source_(text())
  23788. ._nodes_(expressions || []);
  23789. },
  23790. peg$c66 = "#{",
  23791. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23792. peg$c68 = function(expressions) {
  23793. return $globals.DynamicDictionaryNode._new()
  23794. ._location_(location())
  23795. ._source_(text())
  23796. ._nodes_(expressions || []);
  23797. },
  23798. peg$c69 = "true",
  23799. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23800. peg$c71 = function() {return true;},
  23801. peg$c72 = "false",
  23802. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23803. peg$c74 = function() {return false;},
  23804. peg$c75 = "nil",
  23805. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23806. peg$c77 = function() {return nil;},
  23807. peg$c78 = function(val) {
  23808. return $globals.ValueNode._new()
  23809. ._location_(location())
  23810. ._source_(text())
  23811. ._value_(val);
  23812. },
  23813. peg$c79 = function(identifier) {
  23814. return $globals.VariableNode._new()
  23815. ._location_(location())
  23816. ._source_(text())
  23817. ._value_(identifier);
  23818. },
  23819. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23820. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23821. peg$c82 = function(bin) {return bin.join("");},
  23822. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23823. peg$c84 = function(pairs) {
  23824. var selector = "";
  23825. var params = [];
  23826. for(var i = 0; i < pairs.length; i++){
  23827. selector += pairs[i].key;
  23828. params.push(pairs[i].arg);
  23829. }
  23830. return [selector, params];
  23831. },
  23832. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23833. peg$c86 = function(selector) {return [selector, []];},
  23834. peg$c87 = function(expression) {return expression;},
  23835. peg$c88 = function(first, others) { return [first].concat(others); },
  23836. peg$c89 = ":=",
  23837. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  23838. peg$c91 = function(variable, expression) {
  23839. return $globals.AssignmentNode._new()
  23840. ._location_(location())
  23841. ._source_(text())
  23842. ._left_(variable)
  23843. ._right_(expression);
  23844. },
  23845. peg$c92 = "^",
  23846. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  23847. peg$c94 = function(expression) {
  23848. return $globals.ReturnNode._new()
  23849. ._location_(location())
  23850. ._source_(text())
  23851. ._nodes_([expression]);
  23852. },
  23853. peg$c95 = "|",
  23854. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  23855. peg$c97 = function(variable) {return variable;},
  23856. peg$c98 = function(vars) {return vars;},
  23857. peg$c99 = function(param) {return param;},
  23858. peg$c100 = function(params) {return params;},
  23859. peg$c101 = function(ret) {return [ret];},
  23860. peg$c102 = function(exps, ret) {
  23861. var expressions = exps;
  23862. expressions.push(ret);
  23863. return expressions;
  23864. },
  23865. peg$c103 = function(expressions) {
  23866. return expressions || [];
  23867. },
  23868. peg$c104 = function(js) { return js; },
  23869. peg$c105 = function(temps, statements) {
  23870. return $globals.SequenceNode._new()
  23871. ._location_(location())
  23872. ._source_(text())
  23873. ._temps_(temps || [])
  23874. ._nodes_(statements || []);
  23875. },
  23876. peg$c106 = "[",
  23877. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  23878. peg$c108 = "]",
  23879. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  23880. peg$c110 = function(params, sequence) {
  23881. return $globals.BlockNode._new()
  23882. ._location_(location())
  23883. ._source_(text())
  23884. ._parameters_(params || [])
  23885. ._nodes_([sequence._asBlockSequenceNode()]);
  23886. },
  23887. peg$c111 = function(selector) {
  23888. return $globals.SendNode._new()
  23889. ._location_(location())
  23890. ._source_(text())
  23891. ._selector_(selector);
  23892. },
  23893. peg$c112 = function(message, tail) {
  23894. if(tail) {
  23895. return tail._valueForReceiver_(message);
  23896. }
  23897. else {
  23898. return message;
  23899. }
  23900. },
  23901. peg$c113 = function(receiver, tail) {
  23902. if(tail) {
  23903. return tail._valueForReceiver_(receiver);
  23904. }
  23905. else {
  23906. return receiver;
  23907. }
  23908. },
  23909. peg$c114 = function(selector, arg) {
  23910. return $globals.SendNode._new()
  23911. ._location_(location())
  23912. ._source_(text())
  23913. ._selector_(selector)
  23914. ._arguments_([arg]);
  23915. },
  23916. peg$c115 = function(message, tail) {
  23917. if(tail) {
  23918. return tail._valueForReceiver_(message);
  23919. }
  23920. else {
  23921. return message;
  23922. }
  23923. },
  23924. peg$c116 = function(pairs) {
  23925. var selector = "";
  23926. var args = [];
  23927. for(var i = 0; i < pairs.length; i++) {
  23928. selector += pairs[i].key;
  23929. args.push(pairs[i].arg);
  23930. }
  23931. return $globals.SendNode._new()
  23932. ._location_(location())
  23933. ._source_(text())
  23934. ._selector_(selector)
  23935. ._arguments_(args);
  23936. },
  23937. peg$c117 = function(send) { return send._isSendNode(); },
  23938. peg$c118 = ";",
  23939. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  23940. peg$c120 = function(send, mess) {return mess;},
  23941. peg$c121 = function(send, messages) {
  23942. messages.unshift(send);
  23943. return $globals.CascadeNode._new()
  23944. ._location_(location())
  23945. ._source_(text())
  23946. ._nodes_(messages);
  23947. },
  23948. peg$c122 = "<",
  23949. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  23950. peg$c124 = ">>",
  23951. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  23952. peg$c126 = function() {return ">";},
  23953. peg$c127 = /^[^>]/,
  23954. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  23955. peg$c129 = ">",
  23956. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  23957. peg$c131 = function(val) {
  23958. return $globals.JSStatementNode._new()
  23959. ._location_(location())
  23960. ._source_(val.join(""))
  23961. },
  23962. peg$c132 = function(pattern, sequence) {
  23963. return $globals.MethodNode._new()
  23964. ._location_(location())
  23965. ._source_(text())
  23966. ._selector_(pattern[0])
  23967. ._arguments_(pattern[1])
  23968. ._nodes_([sequence]);
  23969. },
  23970. peg$c133 = function(send) { return send._isSendNode() && send._selector() === "->" },
  23971. peg$c134 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23972. peg$c135 = function(first, others) { return first.concat.apply(first, others); },
  23973. peg$currPos = 0,
  23974. peg$savedPos = 0,
  23975. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  23976. peg$maxFailPos = 0,
  23977. peg$maxFailExpected = [],
  23978. peg$silentFails = 0,
  23979. peg$resultsCache = {},
  23980. peg$result;
  23981. if ("startRule" in options) {
  23982. if (!(options.startRule in peg$startRuleFunctions)) {
  23983. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23984. }
  23985. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23986. }
  23987. function text() {
  23988. return input.substring(peg$savedPos, peg$currPos);
  23989. }
  23990. function location() {
  23991. return peg$computeLocation(peg$savedPos, peg$currPos);
  23992. }
  23993. function expected(description) {
  23994. throw peg$buildException(
  23995. null,
  23996. [{ type: "other", description: description }],
  23997. input.substring(peg$savedPos, peg$currPos),
  23998. peg$computeLocation(peg$savedPos, peg$currPos)
  23999. );
  24000. }
  24001. function error(message) {
  24002. throw peg$buildException(
  24003. message,
  24004. null,
  24005. input.substring(peg$savedPos, peg$currPos),
  24006. peg$computeLocation(peg$savedPos, peg$currPos)
  24007. );
  24008. }
  24009. function peg$computePosDetails(pos) {
  24010. var details = peg$posDetailsCache[pos],
  24011. p, ch;
  24012. if (details) {
  24013. return details;
  24014. } else {
  24015. p = pos - 1;
  24016. while (!peg$posDetailsCache[p]) {
  24017. p--;
  24018. }
  24019. details = peg$posDetailsCache[p];
  24020. details = {
  24021. line: details.line,
  24022. column: details.column,
  24023. seenCR: details.seenCR
  24024. };
  24025. while (p < pos) {
  24026. ch = input.charAt(p);
  24027. if (ch === "\n") {
  24028. if (!details.seenCR) { details.line++; }
  24029. details.column = 1;
  24030. details.seenCR = false;
  24031. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  24032. details.line++;
  24033. details.column = 1;
  24034. details.seenCR = true;
  24035. } else {
  24036. details.column++;
  24037. details.seenCR = false;
  24038. }
  24039. p++;
  24040. }
  24041. peg$posDetailsCache[pos] = details;
  24042. return details;
  24043. }
  24044. }
  24045. function peg$computeLocation(startPos, endPos) {
  24046. var startPosDetails = peg$computePosDetails(startPos),
  24047. endPosDetails = peg$computePosDetails(endPos);
  24048. return {
  24049. start: {
  24050. offset: startPos,
  24051. line: startPosDetails.line,
  24052. column: startPosDetails.column
  24053. },
  24054. end: {
  24055. offset: endPos,
  24056. line: endPosDetails.line,
  24057. column: endPosDetails.column
  24058. }
  24059. };
  24060. }
  24061. function peg$fail(expected) {
  24062. if (peg$currPos < peg$maxFailPos) { return; }
  24063. if (peg$currPos > peg$maxFailPos) {
  24064. peg$maxFailPos = peg$currPos;
  24065. peg$maxFailExpected = [];
  24066. }
  24067. peg$maxFailExpected.push(expected);
  24068. }
  24069. function peg$buildException(message, expected, found, location) {
  24070. function cleanupExpected(expected) {
  24071. var i = 1;
  24072. expected.sort(function(a, b) {
  24073. if (a.description < b.description) {
  24074. return -1;
  24075. } else if (a.description > b.description) {
  24076. return 1;
  24077. } else {
  24078. return 0;
  24079. }
  24080. });
  24081. while (i < expected.length) {
  24082. if (expected[i - 1] === expected[i]) {
  24083. expected.splice(i, 1);
  24084. } else {
  24085. i++;
  24086. }
  24087. }
  24088. }
  24089. function buildMessage(expected, found) {
  24090. function stringEscape(s) {
  24091. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  24092. return s
  24093. .replace(/\\/g, '\\\\')
  24094. .replace(/"/g, '\\"')
  24095. .replace(/\x08/g, '\\b')
  24096. .replace(/\t/g, '\\t')
  24097. .replace(/\n/g, '\\n')
  24098. .replace(/\f/g, '\\f')
  24099. .replace(/\r/g, '\\r')
  24100. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  24101. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  24102. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  24103. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  24104. }
  24105. var expectedDescs = new Array(expected.length),
  24106. expectedDesc, foundDesc, i;
  24107. for (i = 0; i < expected.length; i++) {
  24108. expectedDescs[i] = expected[i].description;
  24109. }
  24110. expectedDesc = expected.length > 1
  24111. ? expectedDescs.slice(0, -1).join(", ")
  24112. + " or "
  24113. + expectedDescs[expected.length - 1]
  24114. : expectedDescs[0];
  24115. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  24116. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  24117. }
  24118. if (expected !== null) {
  24119. cleanupExpected(expected);
  24120. }
  24121. return new peg$SyntaxError(
  24122. message !== null ? message : buildMessage(expected, found),
  24123. expected,
  24124. found,
  24125. location
  24126. );
  24127. }
  24128. function peg$parsestart() {
  24129. var s0;
  24130. var key = peg$currPos * 61 + 0,
  24131. cached = peg$resultsCache[key];
  24132. if (cached) {
  24133. peg$currPos = cached.nextPos;
  24134. return cached.result;
  24135. }
  24136. s0 = peg$parsemethod();
  24137. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24138. return s0;
  24139. }
  24140. function peg$parseseparator() {
  24141. var s0, s1;
  24142. var key = peg$currPos * 61 + 1,
  24143. cached = peg$resultsCache[key];
  24144. if (cached) {
  24145. peg$currPos = cached.nextPos;
  24146. return cached.result;
  24147. }
  24148. s0 = [];
  24149. if (peg$c0.test(input.charAt(peg$currPos))) {
  24150. s1 = input.charAt(peg$currPos);
  24151. peg$currPos++;
  24152. } else {
  24153. s1 = peg$FAILED;
  24154. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24155. }
  24156. if (s1 !== peg$FAILED) {
  24157. while (s1 !== peg$FAILED) {
  24158. s0.push(s1);
  24159. if (peg$c0.test(input.charAt(peg$currPos))) {
  24160. s1 = input.charAt(peg$currPos);
  24161. peg$currPos++;
  24162. } else {
  24163. s1 = peg$FAILED;
  24164. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24165. }
  24166. }
  24167. } else {
  24168. s0 = peg$FAILED;
  24169. }
  24170. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24171. return s0;
  24172. }
  24173. function peg$parsecomments() {
  24174. var s0, s1, s2, s3, s4;
  24175. var key = peg$currPos * 61 + 2,
  24176. cached = peg$resultsCache[key];
  24177. if (cached) {
  24178. peg$currPos = cached.nextPos;
  24179. return cached.result;
  24180. }
  24181. s0 = [];
  24182. s1 = peg$currPos;
  24183. if (input.charCodeAt(peg$currPos) === 34) {
  24184. s2 = peg$c2;
  24185. peg$currPos++;
  24186. } else {
  24187. s2 = peg$FAILED;
  24188. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24189. }
  24190. if (s2 !== peg$FAILED) {
  24191. s3 = [];
  24192. if (peg$c4.test(input.charAt(peg$currPos))) {
  24193. s4 = input.charAt(peg$currPos);
  24194. peg$currPos++;
  24195. } else {
  24196. s4 = peg$FAILED;
  24197. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24198. }
  24199. while (s4 !== peg$FAILED) {
  24200. s3.push(s4);
  24201. if (peg$c4.test(input.charAt(peg$currPos))) {
  24202. s4 = input.charAt(peg$currPos);
  24203. peg$currPos++;
  24204. } else {
  24205. s4 = peg$FAILED;
  24206. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24207. }
  24208. }
  24209. if (s3 !== peg$FAILED) {
  24210. if (input.charCodeAt(peg$currPos) === 34) {
  24211. s4 = peg$c2;
  24212. peg$currPos++;
  24213. } else {
  24214. s4 = peg$FAILED;
  24215. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24216. }
  24217. if (s4 !== peg$FAILED) {
  24218. s2 = [s2, s3, s4];
  24219. s1 = s2;
  24220. } else {
  24221. peg$currPos = s1;
  24222. s1 = peg$FAILED;
  24223. }
  24224. } else {
  24225. peg$currPos = s1;
  24226. s1 = peg$FAILED;
  24227. }
  24228. } else {
  24229. peg$currPos = s1;
  24230. s1 = peg$FAILED;
  24231. }
  24232. if (s1 !== peg$FAILED) {
  24233. while (s1 !== peg$FAILED) {
  24234. s0.push(s1);
  24235. s1 = peg$currPos;
  24236. if (input.charCodeAt(peg$currPos) === 34) {
  24237. s2 = peg$c2;
  24238. peg$currPos++;
  24239. } else {
  24240. s2 = peg$FAILED;
  24241. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24242. }
  24243. if (s2 !== peg$FAILED) {
  24244. s3 = [];
  24245. if (peg$c4.test(input.charAt(peg$currPos))) {
  24246. s4 = input.charAt(peg$currPos);
  24247. peg$currPos++;
  24248. } else {
  24249. s4 = peg$FAILED;
  24250. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24251. }
  24252. while (s4 !== peg$FAILED) {
  24253. s3.push(s4);
  24254. if (peg$c4.test(input.charAt(peg$currPos))) {
  24255. s4 = input.charAt(peg$currPos);
  24256. peg$currPos++;
  24257. } else {
  24258. s4 = peg$FAILED;
  24259. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24260. }
  24261. }
  24262. if (s3 !== peg$FAILED) {
  24263. if (input.charCodeAt(peg$currPos) === 34) {
  24264. s4 = peg$c2;
  24265. peg$currPos++;
  24266. } else {
  24267. s4 = peg$FAILED;
  24268. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24269. }
  24270. if (s4 !== peg$FAILED) {
  24271. s2 = [s2, s3, s4];
  24272. s1 = s2;
  24273. } else {
  24274. peg$currPos = s1;
  24275. s1 = peg$FAILED;
  24276. }
  24277. } else {
  24278. peg$currPos = s1;
  24279. s1 = peg$FAILED;
  24280. }
  24281. } else {
  24282. peg$currPos = s1;
  24283. s1 = peg$FAILED;
  24284. }
  24285. }
  24286. } else {
  24287. s0 = peg$FAILED;
  24288. }
  24289. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24290. return s0;
  24291. }
  24292. function peg$parsews() {
  24293. var s0, s1;
  24294. var key = peg$currPos * 61 + 3,
  24295. cached = peg$resultsCache[key];
  24296. if (cached) {
  24297. peg$currPos = cached.nextPos;
  24298. return cached.result;
  24299. }
  24300. s0 = [];
  24301. s1 = peg$parseseparator();
  24302. if (s1 === peg$FAILED) {
  24303. s1 = peg$parsecomments();
  24304. }
  24305. while (s1 !== peg$FAILED) {
  24306. s0.push(s1);
  24307. s1 = peg$parseseparator();
  24308. if (s1 === peg$FAILED) {
  24309. s1 = peg$parsecomments();
  24310. }
  24311. }
  24312. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24313. return s0;
  24314. }
  24315. function peg$parsemaybeDotsWs() {
  24316. var s0, s1;
  24317. var key = peg$currPos * 61 + 4,
  24318. cached = peg$resultsCache[key];
  24319. if (cached) {
  24320. peg$currPos = cached.nextPos;
  24321. return cached.result;
  24322. }
  24323. s0 = [];
  24324. if (input.charCodeAt(peg$currPos) === 46) {
  24325. s1 = peg$c6;
  24326. peg$currPos++;
  24327. } else {
  24328. s1 = peg$FAILED;
  24329. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24330. }
  24331. if (s1 === peg$FAILED) {
  24332. s1 = peg$parseseparator();
  24333. if (s1 === peg$FAILED) {
  24334. s1 = peg$parsecomments();
  24335. }
  24336. }
  24337. while (s1 !== peg$FAILED) {
  24338. s0.push(s1);
  24339. if (input.charCodeAt(peg$currPos) === 46) {
  24340. s1 = peg$c6;
  24341. peg$currPos++;
  24342. } else {
  24343. s1 = peg$FAILED;
  24344. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24345. }
  24346. if (s1 === peg$FAILED) {
  24347. s1 = peg$parseseparator();
  24348. if (s1 === peg$FAILED) {
  24349. s1 = peg$parsecomments();
  24350. }
  24351. }
  24352. }
  24353. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24354. return s0;
  24355. }
  24356. function peg$parseidentifier() {
  24357. var s0, s1, s2, s3;
  24358. var key = peg$currPos * 61 + 5,
  24359. cached = peg$resultsCache[key];
  24360. if (cached) {
  24361. peg$currPos = cached.nextPos;
  24362. return cached.result;
  24363. }
  24364. s0 = peg$currPos;
  24365. if (peg$c8.test(input.charAt(peg$currPos))) {
  24366. s1 = input.charAt(peg$currPos);
  24367. peg$currPos++;
  24368. } else {
  24369. s1 = peg$FAILED;
  24370. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24371. }
  24372. if (s1 !== peg$FAILED) {
  24373. s2 = [];
  24374. if (peg$c10.test(input.charAt(peg$currPos))) {
  24375. s3 = input.charAt(peg$currPos);
  24376. peg$currPos++;
  24377. } else {
  24378. s3 = peg$FAILED;
  24379. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24380. }
  24381. while (s3 !== peg$FAILED) {
  24382. s2.push(s3);
  24383. if (peg$c10.test(input.charAt(peg$currPos))) {
  24384. s3 = input.charAt(peg$currPos);
  24385. peg$currPos++;
  24386. } else {
  24387. s3 = peg$FAILED;
  24388. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24389. }
  24390. }
  24391. if (s2 !== peg$FAILED) {
  24392. peg$savedPos = s0;
  24393. s1 = peg$c12(s1, s2);
  24394. s0 = s1;
  24395. } else {
  24396. peg$currPos = s0;
  24397. s0 = peg$FAILED;
  24398. }
  24399. } else {
  24400. peg$currPos = s0;
  24401. s0 = peg$FAILED;
  24402. }
  24403. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24404. return s0;
  24405. }
  24406. function peg$parsekeyword() {
  24407. var s0, s1, s2;
  24408. var key = peg$currPos * 61 + 6,
  24409. cached = peg$resultsCache[key];
  24410. if (cached) {
  24411. peg$currPos = cached.nextPos;
  24412. return cached.result;
  24413. }
  24414. s0 = peg$currPos;
  24415. s1 = peg$parseidentifier();
  24416. if (s1 !== peg$FAILED) {
  24417. if (input.charCodeAt(peg$currPos) === 58) {
  24418. s2 = peg$c13;
  24419. peg$currPos++;
  24420. } else {
  24421. s2 = peg$FAILED;
  24422. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24423. }
  24424. if (s2 !== peg$FAILED) {
  24425. peg$savedPos = s0;
  24426. s1 = peg$c15(s1, s2);
  24427. s0 = s1;
  24428. } else {
  24429. peg$currPos = s0;
  24430. s0 = peg$FAILED;
  24431. }
  24432. } else {
  24433. peg$currPos = s0;
  24434. s0 = peg$FAILED;
  24435. }
  24436. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24437. return s0;
  24438. }
  24439. function peg$parseselector() {
  24440. var s0, s1, s2, s3;
  24441. var key = peg$currPos * 61 + 7,
  24442. cached = peg$resultsCache[key];
  24443. if (cached) {
  24444. peg$currPos = cached.nextPos;
  24445. return cached.result;
  24446. }
  24447. s0 = peg$currPos;
  24448. if (peg$c8.test(input.charAt(peg$currPos))) {
  24449. s1 = input.charAt(peg$currPos);
  24450. peg$currPos++;
  24451. } else {
  24452. s1 = peg$FAILED;
  24453. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24454. }
  24455. if (s1 !== peg$FAILED) {
  24456. s2 = [];
  24457. if (peg$c16.test(input.charAt(peg$currPos))) {
  24458. s3 = input.charAt(peg$currPos);
  24459. peg$currPos++;
  24460. } else {
  24461. s3 = peg$FAILED;
  24462. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24463. }
  24464. while (s3 !== peg$FAILED) {
  24465. s2.push(s3);
  24466. if (peg$c16.test(input.charAt(peg$currPos))) {
  24467. s3 = input.charAt(peg$currPos);
  24468. peg$currPos++;
  24469. } else {
  24470. s3 = peg$FAILED;
  24471. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24472. }
  24473. }
  24474. if (s2 !== peg$FAILED) {
  24475. peg$savedPos = s0;
  24476. s1 = peg$c12(s1, s2);
  24477. s0 = s1;
  24478. } else {
  24479. peg$currPos = s0;
  24480. s0 = peg$FAILED;
  24481. }
  24482. } else {
  24483. peg$currPos = s0;
  24484. s0 = peg$FAILED;
  24485. }
  24486. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24487. return s0;
  24488. }
  24489. function peg$parseclassName() {
  24490. var s0, s1, s2, s3;
  24491. var key = peg$currPos * 61 + 8,
  24492. cached = peg$resultsCache[key];
  24493. if (cached) {
  24494. peg$currPos = cached.nextPos;
  24495. return cached.result;
  24496. }
  24497. s0 = peg$currPos;
  24498. if (peg$c18.test(input.charAt(peg$currPos))) {
  24499. s1 = input.charAt(peg$currPos);
  24500. peg$currPos++;
  24501. } else {
  24502. s1 = peg$FAILED;
  24503. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24504. }
  24505. if (s1 !== peg$FAILED) {
  24506. s2 = [];
  24507. if (peg$c10.test(input.charAt(peg$currPos))) {
  24508. s3 = input.charAt(peg$currPos);
  24509. peg$currPos++;
  24510. } else {
  24511. s3 = peg$FAILED;
  24512. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24513. }
  24514. while (s3 !== peg$FAILED) {
  24515. s2.push(s3);
  24516. if (peg$c10.test(input.charAt(peg$currPos))) {
  24517. s3 = input.charAt(peg$currPos);
  24518. peg$currPos++;
  24519. } else {
  24520. s3 = peg$FAILED;
  24521. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24522. }
  24523. }
  24524. if (s2 !== peg$FAILED) {
  24525. peg$savedPos = s0;
  24526. s1 = peg$c12(s1, s2);
  24527. s0 = s1;
  24528. } else {
  24529. peg$currPos = s0;
  24530. s0 = peg$FAILED;
  24531. }
  24532. } else {
  24533. peg$currPos = s0;
  24534. s0 = peg$FAILED;
  24535. }
  24536. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24537. return s0;
  24538. }
  24539. function peg$parsestring() {
  24540. var s0, s1, s2, s3, s4;
  24541. var key = peg$currPos * 61 + 9,
  24542. cached = peg$resultsCache[key];
  24543. if (cached) {
  24544. peg$currPos = cached.nextPos;
  24545. return cached.result;
  24546. }
  24547. s0 = peg$currPos;
  24548. if (input.charCodeAt(peg$currPos) === 39) {
  24549. s1 = peg$c20;
  24550. peg$currPos++;
  24551. } else {
  24552. s1 = peg$FAILED;
  24553. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24554. }
  24555. if (s1 !== peg$FAILED) {
  24556. s2 = [];
  24557. s3 = peg$currPos;
  24558. if (input.substr(peg$currPos, 2) === peg$c22) {
  24559. s4 = peg$c22;
  24560. peg$currPos += 2;
  24561. } else {
  24562. s4 = peg$FAILED;
  24563. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24564. }
  24565. if (s4 !== peg$FAILED) {
  24566. peg$savedPos = s3;
  24567. s4 = peg$c24();
  24568. }
  24569. s3 = s4;
  24570. if (s3 === peg$FAILED) {
  24571. if (peg$c25.test(input.charAt(peg$currPos))) {
  24572. s3 = input.charAt(peg$currPos);
  24573. peg$currPos++;
  24574. } else {
  24575. s3 = peg$FAILED;
  24576. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24577. }
  24578. }
  24579. while (s3 !== peg$FAILED) {
  24580. s2.push(s3);
  24581. s3 = peg$currPos;
  24582. if (input.substr(peg$currPos, 2) === peg$c22) {
  24583. s4 = peg$c22;
  24584. peg$currPos += 2;
  24585. } else {
  24586. s4 = peg$FAILED;
  24587. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24588. }
  24589. if (s4 !== peg$FAILED) {
  24590. peg$savedPos = s3;
  24591. s4 = peg$c24();
  24592. }
  24593. s3 = s4;
  24594. if (s3 === peg$FAILED) {
  24595. if (peg$c25.test(input.charAt(peg$currPos))) {
  24596. s3 = input.charAt(peg$currPos);
  24597. peg$currPos++;
  24598. } else {
  24599. s3 = peg$FAILED;
  24600. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24601. }
  24602. }
  24603. }
  24604. if (s2 !== peg$FAILED) {
  24605. if (input.charCodeAt(peg$currPos) === 39) {
  24606. s3 = peg$c20;
  24607. peg$currPos++;
  24608. } else {
  24609. s3 = peg$FAILED;
  24610. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24611. }
  24612. if (s3 !== peg$FAILED) {
  24613. peg$savedPos = s0;
  24614. s1 = peg$c27(s2);
  24615. s0 = s1;
  24616. } else {
  24617. peg$currPos = s0;
  24618. s0 = peg$FAILED;
  24619. }
  24620. } else {
  24621. peg$currPos = s0;
  24622. s0 = peg$FAILED;
  24623. }
  24624. } else {
  24625. peg$currPos = s0;
  24626. s0 = peg$FAILED;
  24627. }
  24628. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24629. return s0;
  24630. }
  24631. function peg$parsecharacter() {
  24632. var s0, s1, s2;
  24633. var key = peg$currPos * 61 + 10,
  24634. cached = peg$resultsCache[key];
  24635. if (cached) {
  24636. peg$currPos = cached.nextPos;
  24637. return cached.result;
  24638. }
  24639. s0 = peg$currPos;
  24640. if (input.charCodeAt(peg$currPos) === 36) {
  24641. s1 = peg$c28;
  24642. peg$currPos++;
  24643. } else {
  24644. s1 = peg$FAILED;
  24645. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24646. }
  24647. if (s1 !== peg$FAILED) {
  24648. if (input.length > peg$currPos) {
  24649. s2 = input.charAt(peg$currPos);
  24650. peg$currPos++;
  24651. } else {
  24652. s2 = peg$FAILED;
  24653. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24654. }
  24655. if (s2 !== peg$FAILED) {
  24656. peg$savedPos = s0;
  24657. s1 = peg$c31(s2);
  24658. s0 = s1;
  24659. } else {
  24660. peg$currPos = s0;
  24661. s0 = peg$FAILED;
  24662. }
  24663. } else {
  24664. peg$currPos = s0;
  24665. s0 = peg$FAILED;
  24666. }
  24667. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24668. return s0;
  24669. }
  24670. function peg$parsesymbol() {
  24671. var s0, s1, s2;
  24672. var key = peg$currPos * 61 + 11,
  24673. cached = peg$resultsCache[key];
  24674. if (cached) {
  24675. peg$currPos = cached.nextPos;
  24676. return cached.result;
  24677. }
  24678. s0 = peg$currPos;
  24679. if (input.charCodeAt(peg$currPos) === 35) {
  24680. s1 = peg$c32;
  24681. peg$currPos++;
  24682. } else {
  24683. s1 = peg$FAILED;
  24684. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24685. }
  24686. if (s1 !== peg$FAILED) {
  24687. s2 = peg$parsebareSymbol();
  24688. if (s2 !== peg$FAILED) {
  24689. peg$savedPos = s0;
  24690. s1 = peg$c34(s2);
  24691. s0 = s1;
  24692. } else {
  24693. peg$currPos = s0;
  24694. s0 = peg$FAILED;
  24695. }
  24696. } else {
  24697. peg$currPos = s0;
  24698. s0 = peg$FAILED;
  24699. }
  24700. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24701. return s0;
  24702. }
  24703. function peg$parsebareSymbol() {
  24704. var s0, s1, s2;
  24705. var key = peg$currPos * 61 + 12,
  24706. cached = peg$resultsCache[key];
  24707. if (cached) {
  24708. peg$currPos = cached.nextPos;
  24709. return cached.result;
  24710. }
  24711. s0 = peg$currPos;
  24712. s1 = peg$parseselector();
  24713. if (s1 === peg$FAILED) {
  24714. s1 = peg$parsebinarySelector();
  24715. if (s1 === peg$FAILED) {
  24716. s1 = peg$currPos;
  24717. s2 = peg$parsestring();
  24718. if (s2 !== peg$FAILED) {
  24719. peg$savedPos = s1;
  24720. s2 = peg$c35(s2);
  24721. }
  24722. s1 = s2;
  24723. }
  24724. }
  24725. if (s1 !== peg$FAILED) {
  24726. peg$savedPos = s0;
  24727. s1 = peg$c36(s1);
  24728. }
  24729. s0 = s1;
  24730. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24731. return s0;
  24732. }
  24733. function peg$parsenumber() {
  24734. var s0, s1;
  24735. var key = peg$currPos * 61 + 13,
  24736. cached = peg$resultsCache[key];
  24737. if (cached) {
  24738. peg$currPos = cached.nextPos;
  24739. return cached.result;
  24740. }
  24741. s0 = peg$currPos;
  24742. s1 = peg$parsenumberExp();
  24743. if (s1 === peg$FAILED) {
  24744. s1 = peg$parsehex();
  24745. if (s1 === peg$FAILED) {
  24746. s1 = peg$parsefloat();
  24747. if (s1 === peg$FAILED) {
  24748. s1 = peg$parseinteger();
  24749. }
  24750. }
  24751. }
  24752. if (s1 !== peg$FAILED) {
  24753. peg$savedPos = s0;
  24754. s1 = peg$c37(s1);
  24755. }
  24756. s0 = s1;
  24757. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24758. return s0;
  24759. }
  24760. function peg$parsenumberExp() {
  24761. var s0, s1, s2, s3, s4;
  24762. var key = peg$currPos * 61 + 14,
  24763. cached = peg$resultsCache[key];
  24764. if (cached) {
  24765. peg$currPos = cached.nextPos;
  24766. return cached.result;
  24767. }
  24768. s0 = peg$currPos;
  24769. s1 = peg$currPos;
  24770. s2 = peg$parsefloat();
  24771. if (s2 === peg$FAILED) {
  24772. s2 = peg$parseinteger();
  24773. }
  24774. if (s2 !== peg$FAILED) {
  24775. if (input.charCodeAt(peg$currPos) === 101) {
  24776. s3 = peg$c38;
  24777. peg$currPos++;
  24778. } else {
  24779. s3 = peg$FAILED;
  24780. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24781. }
  24782. if (s3 !== peg$FAILED) {
  24783. s4 = peg$parseinteger();
  24784. if (s4 !== peg$FAILED) {
  24785. s2 = [s2, s3, s4];
  24786. s1 = s2;
  24787. } else {
  24788. peg$currPos = s1;
  24789. s1 = peg$FAILED;
  24790. }
  24791. } else {
  24792. peg$currPos = s1;
  24793. s1 = peg$FAILED;
  24794. }
  24795. } else {
  24796. peg$currPos = s1;
  24797. s1 = peg$FAILED;
  24798. }
  24799. if (s1 !== peg$FAILED) {
  24800. peg$savedPos = s0;
  24801. s1 = peg$c40(s1);
  24802. }
  24803. s0 = s1;
  24804. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24805. return s0;
  24806. }
  24807. function peg$parsehex() {
  24808. var s0, s1, s2, s3, s4;
  24809. var key = peg$currPos * 61 + 15,
  24810. cached = peg$resultsCache[key];
  24811. if (cached) {
  24812. peg$currPos = cached.nextPos;
  24813. return cached.result;
  24814. }
  24815. s0 = peg$currPos;
  24816. if (input.charCodeAt(peg$currPos) === 45) {
  24817. s1 = peg$c41;
  24818. peg$currPos++;
  24819. } else {
  24820. s1 = peg$FAILED;
  24821. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24822. }
  24823. if (s1 === peg$FAILED) {
  24824. s1 = null;
  24825. }
  24826. if (s1 !== peg$FAILED) {
  24827. if (input.substr(peg$currPos, 3) === peg$c43) {
  24828. s2 = peg$c43;
  24829. peg$currPos += 3;
  24830. } else {
  24831. s2 = peg$FAILED;
  24832. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24833. }
  24834. if (s2 !== peg$FAILED) {
  24835. s3 = [];
  24836. if (peg$c45.test(input.charAt(peg$currPos))) {
  24837. s4 = input.charAt(peg$currPos);
  24838. peg$currPos++;
  24839. } else {
  24840. s4 = peg$FAILED;
  24841. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24842. }
  24843. if (s4 !== peg$FAILED) {
  24844. while (s4 !== peg$FAILED) {
  24845. s3.push(s4);
  24846. if (peg$c45.test(input.charAt(peg$currPos))) {
  24847. s4 = input.charAt(peg$currPos);
  24848. peg$currPos++;
  24849. } else {
  24850. s4 = peg$FAILED;
  24851. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24852. }
  24853. }
  24854. } else {
  24855. s3 = peg$FAILED;
  24856. }
  24857. if (s3 !== peg$FAILED) {
  24858. peg$savedPos = s0;
  24859. s1 = peg$c47(s1, s3);
  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. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24874. return s0;
  24875. }
  24876. function peg$parsefloat() {
  24877. var s0, s1, s2, s3, s4, s5;
  24878. var key = peg$currPos * 61 + 16,
  24879. cached = peg$resultsCache[key];
  24880. if (cached) {
  24881. peg$currPos = cached.nextPos;
  24882. return cached.result;
  24883. }
  24884. s0 = peg$currPos;
  24885. if (input.charCodeAt(peg$currPos) === 45) {
  24886. s1 = peg$c41;
  24887. peg$currPos++;
  24888. } else {
  24889. s1 = peg$FAILED;
  24890. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24891. }
  24892. if (s1 === peg$FAILED) {
  24893. s1 = null;
  24894. }
  24895. if (s1 !== peg$FAILED) {
  24896. s2 = [];
  24897. if (peg$c48.test(input.charAt(peg$currPos))) {
  24898. s3 = input.charAt(peg$currPos);
  24899. peg$currPos++;
  24900. } else {
  24901. s3 = peg$FAILED;
  24902. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24903. }
  24904. if (s3 !== peg$FAILED) {
  24905. while (s3 !== peg$FAILED) {
  24906. s2.push(s3);
  24907. if (peg$c48.test(input.charAt(peg$currPos))) {
  24908. s3 = input.charAt(peg$currPos);
  24909. peg$currPos++;
  24910. } else {
  24911. s3 = peg$FAILED;
  24912. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24913. }
  24914. }
  24915. } else {
  24916. s2 = peg$FAILED;
  24917. }
  24918. if (s2 !== peg$FAILED) {
  24919. if (input.charCodeAt(peg$currPos) === 46) {
  24920. s3 = peg$c6;
  24921. peg$currPos++;
  24922. } else {
  24923. s3 = peg$FAILED;
  24924. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24925. }
  24926. if (s3 !== peg$FAILED) {
  24927. s4 = [];
  24928. if (peg$c48.test(input.charAt(peg$currPos))) {
  24929. s5 = input.charAt(peg$currPos);
  24930. peg$currPos++;
  24931. } else {
  24932. s5 = peg$FAILED;
  24933. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24934. }
  24935. if (s5 !== peg$FAILED) {
  24936. while (s5 !== peg$FAILED) {
  24937. s4.push(s5);
  24938. if (peg$c48.test(input.charAt(peg$currPos))) {
  24939. s5 = input.charAt(peg$currPos);
  24940. peg$currPos++;
  24941. } else {
  24942. s5 = peg$FAILED;
  24943. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24944. }
  24945. }
  24946. } else {
  24947. s4 = peg$FAILED;
  24948. }
  24949. if (s4 !== peg$FAILED) {
  24950. peg$savedPos = s0;
  24951. s1 = peg$c50(s1, s2, s4);
  24952. s0 = s1;
  24953. } else {
  24954. peg$currPos = s0;
  24955. s0 = peg$FAILED;
  24956. }
  24957. } else {
  24958. peg$currPos = s0;
  24959. s0 = peg$FAILED;
  24960. }
  24961. } else {
  24962. peg$currPos = s0;
  24963. s0 = peg$FAILED;
  24964. }
  24965. } else {
  24966. peg$currPos = s0;
  24967. s0 = peg$FAILED;
  24968. }
  24969. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24970. return s0;
  24971. }
  24972. function peg$parseinteger() {
  24973. var s0, s1, s2, s3;
  24974. var key = peg$currPos * 61 + 17,
  24975. cached = peg$resultsCache[key];
  24976. if (cached) {
  24977. peg$currPos = cached.nextPos;
  24978. return cached.result;
  24979. }
  24980. s0 = peg$currPos;
  24981. if (input.charCodeAt(peg$currPos) === 45) {
  24982. s1 = peg$c41;
  24983. peg$currPos++;
  24984. } else {
  24985. s1 = peg$FAILED;
  24986. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24987. }
  24988. if (s1 === peg$FAILED) {
  24989. s1 = null;
  24990. }
  24991. if (s1 !== peg$FAILED) {
  24992. s2 = [];
  24993. if (peg$c48.test(input.charAt(peg$currPos))) {
  24994. s3 = input.charAt(peg$currPos);
  24995. peg$currPos++;
  24996. } else {
  24997. s3 = peg$FAILED;
  24998. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24999. }
  25000. if (s3 !== peg$FAILED) {
  25001. while (s3 !== peg$FAILED) {
  25002. s2.push(s3);
  25003. if (peg$c48.test(input.charAt(peg$currPos))) {
  25004. s3 = input.charAt(peg$currPos);
  25005. peg$currPos++;
  25006. } else {
  25007. s3 = peg$FAILED;
  25008. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25009. }
  25010. }
  25011. } else {
  25012. s2 = peg$FAILED;
  25013. }
  25014. if (s2 !== peg$FAILED) {
  25015. peg$savedPos = s0;
  25016. s1 = peg$c51(s1, s2);
  25017. s0 = s1;
  25018. } else {
  25019. peg$currPos = s0;
  25020. s0 = peg$FAILED;
  25021. }
  25022. } else {
  25023. peg$currPos = s0;
  25024. s0 = peg$FAILED;
  25025. }
  25026. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25027. return s0;
  25028. }
  25029. function peg$parseliteralArray() {
  25030. var s0, s1, s2, s3, s4;
  25031. var key = peg$currPos * 61 + 18,
  25032. cached = peg$resultsCache[key];
  25033. if (cached) {
  25034. peg$currPos = cached.nextPos;
  25035. return cached.result;
  25036. }
  25037. s0 = peg$currPos;
  25038. if (input.substr(peg$currPos, 2) === peg$c52) {
  25039. s1 = peg$c52;
  25040. peg$currPos += 2;
  25041. } else {
  25042. s1 = peg$FAILED;
  25043. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  25044. }
  25045. if (s1 !== peg$FAILED) {
  25046. s2 = peg$parsewsLiteralArrayContents();
  25047. if (s2 !== peg$FAILED) {
  25048. s3 = peg$parsews();
  25049. if (s3 !== peg$FAILED) {
  25050. if (input.charCodeAt(peg$currPos) === 41) {
  25051. s4 = peg$c54;
  25052. peg$currPos++;
  25053. } else {
  25054. s4 = peg$FAILED;
  25055. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25056. }
  25057. if (s4 !== peg$FAILED) {
  25058. peg$savedPos = s0;
  25059. s1 = peg$c56(s2);
  25060. s0 = s1;
  25061. } else {
  25062. peg$currPos = s0;
  25063. s0 = peg$FAILED;
  25064. }
  25065. } else {
  25066. peg$currPos = s0;
  25067. s0 = peg$FAILED;
  25068. }
  25069. } else {
  25070. peg$currPos = s0;
  25071. s0 = peg$FAILED;
  25072. }
  25073. } else {
  25074. peg$currPos = s0;
  25075. s0 = peg$FAILED;
  25076. }
  25077. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25078. return s0;
  25079. }
  25080. function peg$parsebareLiteralArray() {
  25081. var s0, s1, s2, s3, s4;
  25082. var key = peg$currPos * 61 + 19,
  25083. cached = peg$resultsCache[key];
  25084. if (cached) {
  25085. peg$currPos = cached.nextPos;
  25086. return cached.result;
  25087. }
  25088. s0 = peg$currPos;
  25089. if (input.charCodeAt(peg$currPos) === 40) {
  25090. s1 = peg$c57;
  25091. peg$currPos++;
  25092. } else {
  25093. s1 = peg$FAILED;
  25094. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25095. }
  25096. if (s1 !== peg$FAILED) {
  25097. s2 = peg$parsewsLiteralArrayContents();
  25098. if (s2 !== peg$FAILED) {
  25099. s3 = peg$parsews();
  25100. if (s3 !== peg$FAILED) {
  25101. if (input.charCodeAt(peg$currPos) === 41) {
  25102. s4 = peg$c54;
  25103. peg$currPos++;
  25104. } else {
  25105. s4 = peg$FAILED;
  25106. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25107. }
  25108. if (s4 !== peg$FAILED) {
  25109. peg$savedPos = s0;
  25110. s1 = peg$c56(s2);
  25111. s0 = s1;
  25112. } else {
  25113. peg$currPos = s0;
  25114. s0 = peg$FAILED;
  25115. }
  25116. } else {
  25117. peg$currPos = s0;
  25118. s0 = peg$FAILED;
  25119. }
  25120. } else {
  25121. peg$currPos = s0;
  25122. s0 = peg$FAILED;
  25123. }
  25124. } else {
  25125. peg$currPos = s0;
  25126. s0 = peg$FAILED;
  25127. }
  25128. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25129. return s0;
  25130. }
  25131. function peg$parseliteralArrayElement() {
  25132. var s0;
  25133. var key = peg$currPos * 61 + 20,
  25134. cached = peg$resultsCache[key];
  25135. if (cached) {
  25136. peg$currPos = cached.nextPos;
  25137. return cached.result;
  25138. }
  25139. s0 = peg$parseparseTimeLiteral();
  25140. if (s0 === peg$FAILED) {
  25141. s0 = peg$parsebareLiteralArray();
  25142. if (s0 === peg$FAILED) {
  25143. s0 = peg$parsebareSymbol();
  25144. }
  25145. }
  25146. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25147. return s0;
  25148. }
  25149. function peg$parsewsLiteralArrayContents() {
  25150. var s0, s1, s2, s3, s4;
  25151. var key = peg$currPos * 61 + 21,
  25152. cached = peg$resultsCache[key];
  25153. if (cached) {
  25154. peg$currPos = cached.nextPos;
  25155. return cached.result;
  25156. }
  25157. s0 = peg$currPos;
  25158. s1 = [];
  25159. s2 = peg$currPos;
  25160. s3 = peg$parsews();
  25161. if (s3 !== peg$FAILED) {
  25162. s4 = peg$parseliteralArrayElement();
  25163. if (s4 !== peg$FAILED) {
  25164. peg$savedPos = s2;
  25165. s3 = peg$c59(s4);
  25166. s2 = s3;
  25167. } else {
  25168. peg$currPos = s2;
  25169. s2 = peg$FAILED;
  25170. }
  25171. } else {
  25172. peg$currPos = s2;
  25173. s2 = peg$FAILED;
  25174. }
  25175. while (s2 !== peg$FAILED) {
  25176. s1.push(s2);
  25177. s2 = peg$currPos;
  25178. s3 = peg$parsews();
  25179. if (s3 !== peg$FAILED) {
  25180. s4 = peg$parseliteralArrayElement();
  25181. if (s4 !== peg$FAILED) {
  25182. peg$savedPos = s2;
  25183. s3 = peg$c59(s4);
  25184. s2 = s3;
  25185. } else {
  25186. peg$currPos = s2;
  25187. s2 = peg$FAILED;
  25188. }
  25189. } else {
  25190. peg$currPos = s2;
  25191. s2 = peg$FAILED;
  25192. }
  25193. }
  25194. if (s1 !== peg$FAILED) {
  25195. peg$savedPos = s0;
  25196. s1 = peg$c60(s1);
  25197. }
  25198. s0 = s1;
  25199. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25200. return s0;
  25201. }
  25202. function peg$parsedynamicArray() {
  25203. var s0, s1, s2, s3, s4, s5;
  25204. var key = peg$currPos * 61 + 22,
  25205. cached = peg$resultsCache[key];
  25206. if (cached) {
  25207. peg$currPos = cached.nextPos;
  25208. return cached.result;
  25209. }
  25210. s0 = peg$currPos;
  25211. if (input.charCodeAt(peg$currPos) === 123) {
  25212. s1 = peg$c61;
  25213. peg$currPos++;
  25214. } else {
  25215. s1 = peg$FAILED;
  25216. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  25217. }
  25218. if (s1 !== peg$FAILED) {
  25219. s2 = peg$parsews();
  25220. if (s2 !== peg$FAILED) {
  25221. s3 = peg$parseexpressions();
  25222. if (s3 === peg$FAILED) {
  25223. s3 = null;
  25224. }
  25225. if (s3 !== peg$FAILED) {
  25226. s4 = peg$parsemaybeDotsWs();
  25227. if (s4 !== peg$FAILED) {
  25228. if (input.charCodeAt(peg$currPos) === 125) {
  25229. s5 = peg$c63;
  25230. peg$currPos++;
  25231. } else {
  25232. s5 = peg$FAILED;
  25233. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25234. }
  25235. if (s5 !== peg$FAILED) {
  25236. peg$savedPos = s0;
  25237. s1 = peg$c65(s3);
  25238. s0 = s1;
  25239. } else {
  25240. peg$currPos = s0;
  25241. s0 = peg$FAILED;
  25242. }
  25243. } else {
  25244. peg$currPos = s0;
  25245. s0 = peg$FAILED;
  25246. }
  25247. } else {
  25248. peg$currPos = s0;
  25249. s0 = peg$FAILED;
  25250. }
  25251. } else {
  25252. peg$currPos = s0;
  25253. s0 = peg$FAILED;
  25254. }
  25255. } else {
  25256. peg$currPos = s0;
  25257. s0 = peg$FAILED;
  25258. }
  25259. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25260. return s0;
  25261. }
  25262. function peg$parsedynamicDictionary() {
  25263. var s0, s1, s2, s3, s4, s5;
  25264. var key = peg$currPos * 61 + 23,
  25265. cached = peg$resultsCache[key];
  25266. if (cached) {
  25267. peg$currPos = cached.nextPos;
  25268. return cached.result;
  25269. }
  25270. s0 = peg$currPos;
  25271. if (input.substr(peg$currPos, 2) === peg$c66) {
  25272. s1 = peg$c66;
  25273. peg$currPos += 2;
  25274. } else {
  25275. s1 = peg$FAILED;
  25276. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25277. }
  25278. if (s1 !== peg$FAILED) {
  25279. s2 = peg$parsews();
  25280. if (s2 !== peg$FAILED) {
  25281. s3 = peg$parseassociations();
  25282. if (s3 === peg$FAILED) {
  25283. s3 = null;
  25284. }
  25285. if (s3 !== peg$FAILED) {
  25286. s4 = peg$parsemaybeDotsWs();
  25287. if (s4 !== peg$FAILED) {
  25288. if (input.charCodeAt(peg$currPos) === 125) {
  25289. s5 = peg$c63;
  25290. peg$currPos++;
  25291. } else {
  25292. s5 = peg$FAILED;
  25293. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25294. }
  25295. if (s5 !== peg$FAILED) {
  25296. peg$savedPos = s0;
  25297. s1 = peg$c68(s3);
  25298. s0 = s1;
  25299. } else {
  25300. peg$currPos = s0;
  25301. s0 = peg$FAILED;
  25302. }
  25303. } else {
  25304. peg$currPos = s0;
  25305. s0 = peg$FAILED;
  25306. }
  25307. } else {
  25308. peg$currPos = s0;
  25309. s0 = peg$FAILED;
  25310. }
  25311. } else {
  25312. peg$currPos = s0;
  25313. s0 = peg$FAILED;
  25314. }
  25315. } else {
  25316. peg$currPos = s0;
  25317. s0 = peg$FAILED;
  25318. }
  25319. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25320. return s0;
  25321. }
  25322. function peg$parsepseudoVariable() {
  25323. var s0, s1, s2;
  25324. var key = peg$currPos * 61 + 24,
  25325. cached = peg$resultsCache[key];
  25326. if (cached) {
  25327. peg$currPos = cached.nextPos;
  25328. return cached.result;
  25329. }
  25330. s0 = peg$currPos;
  25331. s1 = peg$currPos;
  25332. if (input.substr(peg$currPos, 4) === peg$c69) {
  25333. s2 = peg$c69;
  25334. peg$currPos += 4;
  25335. } else {
  25336. s2 = peg$FAILED;
  25337. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25338. }
  25339. if (s2 !== peg$FAILED) {
  25340. peg$savedPos = s1;
  25341. s2 = peg$c71();
  25342. }
  25343. s1 = s2;
  25344. if (s1 === peg$FAILED) {
  25345. s1 = peg$currPos;
  25346. if (input.substr(peg$currPos, 5) === peg$c72) {
  25347. s2 = peg$c72;
  25348. peg$currPos += 5;
  25349. } else {
  25350. s2 = peg$FAILED;
  25351. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25352. }
  25353. if (s2 !== peg$FAILED) {
  25354. peg$savedPos = s1;
  25355. s2 = peg$c74();
  25356. }
  25357. s1 = s2;
  25358. if (s1 === peg$FAILED) {
  25359. s1 = peg$currPos;
  25360. if (input.substr(peg$currPos, 3) === peg$c75) {
  25361. s2 = peg$c75;
  25362. peg$currPos += 3;
  25363. } else {
  25364. s2 = peg$FAILED;
  25365. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25366. }
  25367. if (s2 !== peg$FAILED) {
  25368. peg$savedPos = s1;
  25369. s2 = peg$c77();
  25370. }
  25371. s1 = s2;
  25372. }
  25373. }
  25374. if (s1 !== peg$FAILED) {
  25375. peg$savedPos = s0;
  25376. s1 = peg$c78(s1);
  25377. }
  25378. s0 = s1;
  25379. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25380. return s0;
  25381. }
  25382. function peg$parseparseTimeLiteral() {
  25383. var s0;
  25384. var key = peg$currPos * 61 + 25,
  25385. cached = peg$resultsCache[key];
  25386. if (cached) {
  25387. peg$currPos = cached.nextPos;
  25388. return cached.result;
  25389. }
  25390. s0 = peg$parsepseudoVariable();
  25391. if (s0 === peg$FAILED) {
  25392. s0 = peg$parsenumber();
  25393. if (s0 === peg$FAILED) {
  25394. s0 = peg$parseliteralArray();
  25395. if (s0 === peg$FAILED) {
  25396. s0 = peg$parsestring();
  25397. if (s0 === peg$FAILED) {
  25398. s0 = peg$parsesymbol();
  25399. if (s0 === peg$FAILED) {
  25400. s0 = peg$parsecharacter();
  25401. }
  25402. }
  25403. }
  25404. }
  25405. }
  25406. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25407. return s0;
  25408. }
  25409. function peg$parseruntimeLiteral() {
  25410. var s0;
  25411. var key = peg$currPos * 61 + 26,
  25412. cached = peg$resultsCache[key];
  25413. if (cached) {
  25414. peg$currPos = cached.nextPos;
  25415. return cached.result;
  25416. }
  25417. s0 = peg$parsedynamicDictionary();
  25418. if (s0 === peg$FAILED) {
  25419. s0 = peg$parsedynamicArray();
  25420. if (s0 === peg$FAILED) {
  25421. s0 = peg$parseblock();
  25422. }
  25423. }
  25424. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25425. return s0;
  25426. }
  25427. function peg$parseliteral() {
  25428. var s0;
  25429. var key = peg$currPos * 61 + 27,
  25430. cached = peg$resultsCache[key];
  25431. if (cached) {
  25432. peg$currPos = cached.nextPos;
  25433. return cached.result;
  25434. }
  25435. s0 = peg$parseruntimeLiteral();
  25436. if (s0 === peg$FAILED) {
  25437. s0 = peg$parseparseTimeLiteral();
  25438. }
  25439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25440. return s0;
  25441. }
  25442. function peg$parsevariable() {
  25443. var s0, s1;
  25444. var key = peg$currPos * 61 + 28,
  25445. cached = peg$resultsCache[key];
  25446. if (cached) {
  25447. peg$currPos = cached.nextPos;
  25448. return cached.result;
  25449. }
  25450. s0 = peg$currPos;
  25451. s1 = peg$parseidentifier();
  25452. if (s1 !== peg$FAILED) {
  25453. peg$savedPos = s0;
  25454. s1 = peg$c79(s1);
  25455. }
  25456. s0 = s1;
  25457. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25458. return s0;
  25459. }
  25460. function peg$parsebinarySelector() {
  25461. var s0, s1, s2;
  25462. var key = peg$currPos * 61 + 29,
  25463. cached = peg$resultsCache[key];
  25464. if (cached) {
  25465. peg$currPos = cached.nextPos;
  25466. return cached.result;
  25467. }
  25468. s0 = peg$currPos;
  25469. s1 = [];
  25470. if (peg$c80.test(input.charAt(peg$currPos))) {
  25471. s2 = input.charAt(peg$currPos);
  25472. peg$currPos++;
  25473. } else {
  25474. s2 = peg$FAILED;
  25475. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25476. }
  25477. if (s2 !== peg$FAILED) {
  25478. while (s2 !== peg$FAILED) {
  25479. s1.push(s2);
  25480. if (peg$c80.test(input.charAt(peg$currPos))) {
  25481. s2 = input.charAt(peg$currPos);
  25482. peg$currPos++;
  25483. } else {
  25484. s2 = peg$FAILED;
  25485. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25486. }
  25487. }
  25488. } else {
  25489. s1 = peg$FAILED;
  25490. }
  25491. if (s1 !== peg$FAILED) {
  25492. peg$savedPos = s0;
  25493. s1 = peg$c82(s1);
  25494. }
  25495. s0 = s1;
  25496. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25497. return s0;
  25498. }
  25499. function peg$parsewsKeywordPattern() {
  25500. var s0, s1, s2, s3, s4, s5, s6;
  25501. var key = peg$currPos * 61 + 30,
  25502. cached = peg$resultsCache[key];
  25503. if (cached) {
  25504. peg$currPos = cached.nextPos;
  25505. return cached.result;
  25506. }
  25507. s0 = peg$currPos;
  25508. s1 = [];
  25509. s2 = peg$currPos;
  25510. s3 = peg$parsews();
  25511. if (s3 !== peg$FAILED) {
  25512. s4 = peg$parsekeyword();
  25513. if (s4 !== peg$FAILED) {
  25514. s5 = peg$parsews();
  25515. if (s5 !== peg$FAILED) {
  25516. s6 = peg$parseidentifier();
  25517. if (s6 !== peg$FAILED) {
  25518. peg$savedPos = s2;
  25519. s3 = peg$c83(s4, s6);
  25520. s2 = s3;
  25521. } else {
  25522. peg$currPos = s2;
  25523. s2 = peg$FAILED;
  25524. }
  25525. } else {
  25526. peg$currPos = s2;
  25527. s2 = peg$FAILED;
  25528. }
  25529. } else {
  25530. peg$currPos = s2;
  25531. s2 = peg$FAILED;
  25532. }
  25533. } else {
  25534. peg$currPos = s2;
  25535. s2 = peg$FAILED;
  25536. }
  25537. if (s2 !== peg$FAILED) {
  25538. while (s2 !== peg$FAILED) {
  25539. s1.push(s2);
  25540. s2 = peg$currPos;
  25541. s3 = peg$parsews();
  25542. if (s3 !== peg$FAILED) {
  25543. s4 = peg$parsekeyword();
  25544. if (s4 !== peg$FAILED) {
  25545. s5 = peg$parsews();
  25546. if (s5 !== peg$FAILED) {
  25547. s6 = peg$parseidentifier();
  25548. if (s6 !== peg$FAILED) {
  25549. peg$savedPos = s2;
  25550. s3 = peg$c83(s4, s6);
  25551. s2 = s3;
  25552. } else {
  25553. peg$currPos = s2;
  25554. s2 = peg$FAILED;
  25555. }
  25556. } else {
  25557. peg$currPos = s2;
  25558. s2 = peg$FAILED;
  25559. }
  25560. } else {
  25561. peg$currPos = s2;
  25562. s2 = peg$FAILED;
  25563. }
  25564. } else {
  25565. peg$currPos = s2;
  25566. s2 = peg$FAILED;
  25567. }
  25568. }
  25569. } else {
  25570. s1 = peg$FAILED;
  25571. }
  25572. if (s1 !== peg$FAILED) {
  25573. peg$savedPos = s0;
  25574. s1 = peg$c84(s1);
  25575. }
  25576. s0 = s1;
  25577. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25578. return s0;
  25579. }
  25580. function peg$parsewsBinaryPattern() {
  25581. var s0, s1, s2, s3, s4;
  25582. var key = peg$currPos * 61 + 31,
  25583. cached = peg$resultsCache[key];
  25584. if (cached) {
  25585. peg$currPos = cached.nextPos;
  25586. return cached.result;
  25587. }
  25588. s0 = peg$currPos;
  25589. s1 = peg$parsews();
  25590. if (s1 !== peg$FAILED) {
  25591. s2 = peg$parsebinarySelector();
  25592. if (s2 !== peg$FAILED) {
  25593. s3 = peg$parsews();
  25594. if (s3 !== peg$FAILED) {
  25595. s4 = peg$parseidentifier();
  25596. if (s4 !== peg$FAILED) {
  25597. peg$savedPos = s0;
  25598. s1 = peg$c85(s2, s4);
  25599. s0 = s1;
  25600. } else {
  25601. peg$currPos = s0;
  25602. s0 = peg$FAILED;
  25603. }
  25604. } else {
  25605. peg$currPos = s0;
  25606. s0 = peg$FAILED;
  25607. }
  25608. } else {
  25609. peg$currPos = s0;
  25610. s0 = peg$FAILED;
  25611. }
  25612. } else {
  25613. peg$currPos = s0;
  25614. s0 = peg$FAILED;
  25615. }
  25616. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25617. return s0;
  25618. }
  25619. function peg$parsewsUnaryPattern() {
  25620. var s0, s1, s2;
  25621. var key = peg$currPos * 61 + 32,
  25622. cached = peg$resultsCache[key];
  25623. if (cached) {
  25624. peg$currPos = cached.nextPos;
  25625. return cached.result;
  25626. }
  25627. s0 = peg$currPos;
  25628. s1 = peg$parsews();
  25629. if (s1 !== peg$FAILED) {
  25630. s2 = peg$parseidentifier();
  25631. if (s2 !== peg$FAILED) {
  25632. peg$savedPos = s0;
  25633. s1 = peg$c86(s2);
  25634. s0 = s1;
  25635. } else {
  25636. peg$currPos = s0;
  25637. s0 = peg$FAILED;
  25638. }
  25639. } else {
  25640. peg$currPos = s0;
  25641. s0 = peg$FAILED;
  25642. }
  25643. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25644. return s0;
  25645. }
  25646. function peg$parseexpression() {
  25647. var s0;
  25648. var key = peg$currPos * 61 + 33,
  25649. cached = peg$resultsCache[key];
  25650. if (cached) {
  25651. peg$currPos = cached.nextPos;
  25652. return cached.result;
  25653. }
  25654. s0 = peg$parseassignment();
  25655. if (s0 === peg$FAILED) {
  25656. s0 = peg$parsecascade();
  25657. if (s0 === peg$FAILED) {
  25658. s0 = peg$parsekeywordSend();
  25659. }
  25660. }
  25661. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25662. return s0;
  25663. }
  25664. function peg$parsewsExpressionsRest() {
  25665. var s0, s1, s2, s3, s4;
  25666. var key = peg$currPos * 61 + 34,
  25667. cached = peg$resultsCache[key];
  25668. if (cached) {
  25669. peg$currPos = cached.nextPos;
  25670. return cached.result;
  25671. }
  25672. s0 = peg$currPos;
  25673. s1 = peg$parsews();
  25674. if (s1 !== peg$FAILED) {
  25675. if (input.charCodeAt(peg$currPos) === 46) {
  25676. s2 = peg$c6;
  25677. peg$currPos++;
  25678. } else {
  25679. s2 = peg$FAILED;
  25680. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25681. }
  25682. if (s2 !== peg$FAILED) {
  25683. s3 = peg$parsemaybeDotsWs();
  25684. if (s3 !== peg$FAILED) {
  25685. s4 = peg$parseexpression();
  25686. if (s4 !== peg$FAILED) {
  25687. peg$savedPos = s0;
  25688. s1 = peg$c87(s4);
  25689. s0 = s1;
  25690. } else {
  25691. peg$currPos = s0;
  25692. s0 = peg$FAILED;
  25693. }
  25694. } else {
  25695. peg$currPos = s0;
  25696. s0 = peg$FAILED;
  25697. }
  25698. } else {
  25699. peg$currPos = s0;
  25700. s0 = peg$FAILED;
  25701. }
  25702. } else {
  25703. peg$currPos = s0;
  25704. s0 = peg$FAILED;
  25705. }
  25706. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25707. return s0;
  25708. }
  25709. function peg$parseexpressions() {
  25710. var s0, s1, s2, s3;
  25711. var key = peg$currPos * 61 + 35,
  25712. cached = peg$resultsCache[key];
  25713. if (cached) {
  25714. peg$currPos = cached.nextPos;
  25715. return cached.result;
  25716. }
  25717. s0 = peg$currPos;
  25718. s1 = peg$parseexpression();
  25719. if (s1 !== peg$FAILED) {
  25720. s2 = [];
  25721. s3 = peg$parsewsExpressionsRest();
  25722. while (s3 !== peg$FAILED) {
  25723. s2.push(s3);
  25724. s3 = peg$parsewsExpressionsRest();
  25725. }
  25726. if (s2 !== peg$FAILED) {
  25727. peg$savedPos = s0;
  25728. s1 = peg$c88(s1, s2);
  25729. s0 = s1;
  25730. } else {
  25731. peg$currPos = s0;
  25732. s0 = peg$FAILED;
  25733. }
  25734. } else {
  25735. peg$currPos = s0;
  25736. s0 = peg$FAILED;
  25737. }
  25738. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25739. return s0;
  25740. }
  25741. function peg$parseassignment() {
  25742. var s0, s1, s2, s3, s4, s5;
  25743. var key = peg$currPos * 61 + 36,
  25744. cached = peg$resultsCache[key];
  25745. if (cached) {
  25746. peg$currPos = cached.nextPos;
  25747. return cached.result;
  25748. }
  25749. s0 = peg$currPos;
  25750. s1 = peg$parsevariable();
  25751. if (s1 !== peg$FAILED) {
  25752. s2 = peg$parsews();
  25753. if (s2 !== peg$FAILED) {
  25754. if (input.substr(peg$currPos, 2) === peg$c89) {
  25755. s3 = peg$c89;
  25756. peg$currPos += 2;
  25757. } else {
  25758. s3 = peg$FAILED;
  25759. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25760. }
  25761. if (s3 !== peg$FAILED) {
  25762. s4 = peg$parsews();
  25763. if (s4 !== peg$FAILED) {
  25764. s5 = peg$parseexpression();
  25765. if (s5 !== peg$FAILED) {
  25766. peg$savedPos = s0;
  25767. s1 = peg$c91(s1, s5);
  25768. s0 = s1;
  25769. } else {
  25770. peg$currPos = s0;
  25771. s0 = peg$FAILED;
  25772. }
  25773. } else {
  25774. peg$currPos = s0;
  25775. s0 = peg$FAILED;
  25776. }
  25777. } else {
  25778. peg$currPos = s0;
  25779. s0 = peg$FAILED;
  25780. }
  25781. } else {
  25782. peg$currPos = s0;
  25783. s0 = peg$FAILED;
  25784. }
  25785. } else {
  25786. peg$currPos = s0;
  25787. s0 = peg$FAILED;
  25788. }
  25789. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25790. return s0;
  25791. }
  25792. function peg$parseret() {
  25793. var s0, s1, s2, s3;
  25794. var key = peg$currPos * 61 + 37,
  25795. cached = peg$resultsCache[key];
  25796. if (cached) {
  25797. peg$currPos = cached.nextPos;
  25798. return cached.result;
  25799. }
  25800. s0 = peg$currPos;
  25801. if (input.charCodeAt(peg$currPos) === 94) {
  25802. s1 = peg$c92;
  25803. peg$currPos++;
  25804. } else {
  25805. s1 = peg$FAILED;
  25806. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25807. }
  25808. if (s1 !== peg$FAILED) {
  25809. s2 = peg$parsews();
  25810. if (s2 !== peg$FAILED) {
  25811. s3 = peg$parseexpression();
  25812. if (s3 !== peg$FAILED) {
  25813. peg$savedPos = s0;
  25814. s1 = peg$c94(s3);
  25815. s0 = s1;
  25816. } else {
  25817. peg$currPos = s0;
  25818. s0 = peg$FAILED;
  25819. }
  25820. } else {
  25821. peg$currPos = s0;
  25822. s0 = peg$FAILED;
  25823. }
  25824. } else {
  25825. peg$currPos = s0;
  25826. s0 = peg$FAILED;
  25827. }
  25828. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25829. return s0;
  25830. }
  25831. function peg$parsetemps() {
  25832. var s0, s1, s2, s3, s4, s5;
  25833. var key = peg$currPos * 61 + 38,
  25834. cached = peg$resultsCache[key];
  25835. if (cached) {
  25836. peg$currPos = cached.nextPos;
  25837. return cached.result;
  25838. }
  25839. s0 = peg$currPos;
  25840. if (input.charCodeAt(peg$currPos) === 124) {
  25841. s1 = peg$c95;
  25842. peg$currPos++;
  25843. } else {
  25844. s1 = peg$FAILED;
  25845. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25846. }
  25847. if (s1 !== peg$FAILED) {
  25848. s2 = [];
  25849. s3 = peg$currPos;
  25850. s4 = peg$parsews();
  25851. if (s4 !== peg$FAILED) {
  25852. s5 = peg$parseidentifier();
  25853. if (s5 !== peg$FAILED) {
  25854. peg$savedPos = s3;
  25855. s4 = peg$c97(s5);
  25856. s3 = s4;
  25857. } else {
  25858. peg$currPos = s3;
  25859. s3 = peg$FAILED;
  25860. }
  25861. } else {
  25862. peg$currPos = s3;
  25863. s3 = peg$FAILED;
  25864. }
  25865. while (s3 !== peg$FAILED) {
  25866. s2.push(s3);
  25867. s3 = peg$currPos;
  25868. s4 = peg$parsews();
  25869. if (s4 !== peg$FAILED) {
  25870. s5 = peg$parseidentifier();
  25871. if (s5 !== peg$FAILED) {
  25872. peg$savedPos = s3;
  25873. s4 = peg$c97(s5);
  25874. s3 = s4;
  25875. } else {
  25876. peg$currPos = s3;
  25877. s3 = peg$FAILED;
  25878. }
  25879. } else {
  25880. peg$currPos = s3;
  25881. s3 = peg$FAILED;
  25882. }
  25883. }
  25884. if (s2 !== peg$FAILED) {
  25885. s3 = peg$parsews();
  25886. if (s3 !== peg$FAILED) {
  25887. if (input.charCodeAt(peg$currPos) === 124) {
  25888. s4 = peg$c95;
  25889. peg$currPos++;
  25890. } else {
  25891. s4 = peg$FAILED;
  25892. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25893. }
  25894. if (s4 !== peg$FAILED) {
  25895. peg$savedPos = s0;
  25896. s1 = peg$c98(s2);
  25897. s0 = s1;
  25898. } else {
  25899. peg$currPos = s0;
  25900. s0 = peg$FAILED;
  25901. }
  25902. } else {
  25903. peg$currPos = s0;
  25904. s0 = peg$FAILED;
  25905. }
  25906. } else {
  25907. peg$currPos = s0;
  25908. s0 = peg$FAILED;
  25909. }
  25910. } else {
  25911. peg$currPos = s0;
  25912. s0 = peg$FAILED;
  25913. }
  25914. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25915. return s0;
  25916. }
  25917. function peg$parsewsBlockParamList() {
  25918. var s0, s1, s2, s3, s4, s5, s6;
  25919. var key = peg$currPos * 61 + 39,
  25920. cached = peg$resultsCache[key];
  25921. if (cached) {
  25922. peg$currPos = cached.nextPos;
  25923. return cached.result;
  25924. }
  25925. s0 = peg$currPos;
  25926. s1 = [];
  25927. s2 = peg$currPos;
  25928. s3 = peg$parsews();
  25929. if (s3 !== peg$FAILED) {
  25930. if (input.charCodeAt(peg$currPos) === 58) {
  25931. s4 = peg$c13;
  25932. peg$currPos++;
  25933. } else {
  25934. s4 = peg$FAILED;
  25935. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25936. }
  25937. if (s4 !== peg$FAILED) {
  25938. s5 = peg$parsews();
  25939. if (s5 !== peg$FAILED) {
  25940. s6 = peg$parseidentifier();
  25941. if (s6 !== peg$FAILED) {
  25942. peg$savedPos = s2;
  25943. s3 = peg$c99(s6);
  25944. s2 = s3;
  25945. } else {
  25946. peg$currPos = s2;
  25947. s2 = peg$FAILED;
  25948. }
  25949. } else {
  25950. peg$currPos = s2;
  25951. s2 = peg$FAILED;
  25952. }
  25953. } else {
  25954. peg$currPos = s2;
  25955. s2 = peg$FAILED;
  25956. }
  25957. } else {
  25958. peg$currPos = s2;
  25959. s2 = peg$FAILED;
  25960. }
  25961. if (s2 !== peg$FAILED) {
  25962. while (s2 !== peg$FAILED) {
  25963. s1.push(s2);
  25964. s2 = peg$currPos;
  25965. s3 = peg$parsews();
  25966. if (s3 !== peg$FAILED) {
  25967. if (input.charCodeAt(peg$currPos) === 58) {
  25968. s4 = peg$c13;
  25969. peg$currPos++;
  25970. } else {
  25971. s4 = peg$FAILED;
  25972. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25973. }
  25974. if (s4 !== peg$FAILED) {
  25975. s5 = peg$parsews();
  25976. if (s5 !== peg$FAILED) {
  25977. s6 = peg$parseidentifier();
  25978. if (s6 !== peg$FAILED) {
  25979. peg$savedPos = s2;
  25980. s3 = peg$c99(s6);
  25981. s2 = s3;
  25982. } else {
  25983. peg$currPos = s2;
  25984. s2 = peg$FAILED;
  25985. }
  25986. } else {
  25987. peg$currPos = s2;
  25988. s2 = peg$FAILED;
  25989. }
  25990. } else {
  25991. peg$currPos = s2;
  25992. s2 = peg$FAILED;
  25993. }
  25994. } else {
  25995. peg$currPos = s2;
  25996. s2 = peg$FAILED;
  25997. }
  25998. }
  25999. } else {
  26000. s1 = peg$FAILED;
  26001. }
  26002. if (s1 !== peg$FAILED) {
  26003. s2 = peg$parsews();
  26004. if (s2 !== peg$FAILED) {
  26005. if (input.charCodeAt(peg$currPos) === 124) {
  26006. s3 = peg$c95;
  26007. peg$currPos++;
  26008. } else {
  26009. s3 = peg$FAILED;
  26010. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26011. }
  26012. if (s3 !== peg$FAILED) {
  26013. peg$savedPos = s0;
  26014. s1 = peg$c100(s1);
  26015. s0 = s1;
  26016. } else {
  26017. peg$currPos = s0;
  26018. s0 = peg$FAILED;
  26019. }
  26020. } else {
  26021. peg$currPos = s0;
  26022. s0 = peg$FAILED;
  26023. }
  26024. } else {
  26025. peg$currPos = s0;
  26026. s0 = peg$FAILED;
  26027. }
  26028. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26029. return s0;
  26030. }
  26031. function peg$parsesubexpression() {
  26032. var s0, s1, s2, s3, s4, s5;
  26033. var key = peg$currPos * 61 + 40,
  26034. cached = peg$resultsCache[key];
  26035. if (cached) {
  26036. peg$currPos = cached.nextPos;
  26037. return cached.result;
  26038. }
  26039. s0 = peg$currPos;
  26040. if (input.charCodeAt(peg$currPos) === 40) {
  26041. s1 = peg$c57;
  26042. peg$currPos++;
  26043. } else {
  26044. s1 = peg$FAILED;
  26045. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26046. }
  26047. if (s1 !== peg$FAILED) {
  26048. s2 = peg$parsews();
  26049. if (s2 !== peg$FAILED) {
  26050. s3 = peg$parseexpression();
  26051. if (s3 !== peg$FAILED) {
  26052. s4 = peg$parsews();
  26053. if (s4 !== peg$FAILED) {
  26054. if (input.charCodeAt(peg$currPos) === 41) {
  26055. s5 = peg$c54;
  26056. peg$currPos++;
  26057. } else {
  26058. s5 = peg$FAILED;
  26059. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  26060. }
  26061. if (s5 !== peg$FAILED) {
  26062. peg$savedPos = s0;
  26063. s1 = peg$c87(s3);
  26064. s0 = s1;
  26065. } else {
  26066. peg$currPos = s0;
  26067. s0 = peg$FAILED;
  26068. }
  26069. } else {
  26070. peg$currPos = s0;
  26071. s0 = peg$FAILED;
  26072. }
  26073. } else {
  26074. peg$currPos = s0;
  26075. s0 = peg$FAILED;
  26076. }
  26077. } else {
  26078. peg$currPos = s0;
  26079. s0 = peg$FAILED;
  26080. }
  26081. } else {
  26082. peg$currPos = s0;
  26083. s0 = peg$FAILED;
  26084. }
  26085. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26086. return s0;
  26087. }
  26088. function peg$parsestatementsWs() {
  26089. var s0, s1, s2, s3, s4, s5, s6;
  26090. var key = peg$currPos * 61 + 41,
  26091. cached = peg$resultsCache[key];
  26092. if (cached) {
  26093. peg$currPos = cached.nextPos;
  26094. return cached.result;
  26095. }
  26096. s0 = peg$currPos;
  26097. s1 = peg$parseret();
  26098. if (s1 !== peg$FAILED) {
  26099. s2 = peg$parsemaybeDotsWs();
  26100. if (s2 !== peg$FAILED) {
  26101. peg$savedPos = s0;
  26102. s1 = peg$c101(s1);
  26103. s0 = s1;
  26104. } else {
  26105. peg$currPos = s0;
  26106. s0 = peg$FAILED;
  26107. }
  26108. } else {
  26109. peg$currPos = s0;
  26110. s0 = peg$FAILED;
  26111. }
  26112. if (s0 === peg$FAILED) {
  26113. s0 = peg$currPos;
  26114. s1 = peg$parseexpressions();
  26115. if (s1 !== peg$FAILED) {
  26116. s2 = peg$parsews();
  26117. if (s2 !== peg$FAILED) {
  26118. if (input.charCodeAt(peg$currPos) === 46) {
  26119. s3 = peg$c6;
  26120. peg$currPos++;
  26121. } else {
  26122. s3 = peg$FAILED;
  26123. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26124. }
  26125. if (s3 !== peg$FAILED) {
  26126. s4 = peg$parsemaybeDotsWs();
  26127. if (s4 !== peg$FAILED) {
  26128. s5 = peg$parseret();
  26129. if (s5 !== peg$FAILED) {
  26130. s6 = peg$parsemaybeDotsWs();
  26131. if (s6 !== peg$FAILED) {
  26132. peg$savedPos = s0;
  26133. s1 = peg$c102(s1, s5);
  26134. s0 = s1;
  26135. } else {
  26136. peg$currPos = s0;
  26137. s0 = peg$FAILED;
  26138. }
  26139. } else {
  26140. peg$currPos = s0;
  26141. s0 = peg$FAILED;
  26142. }
  26143. } else {
  26144. peg$currPos = s0;
  26145. s0 = peg$FAILED;
  26146. }
  26147. } else {
  26148. peg$currPos = s0;
  26149. s0 = peg$FAILED;
  26150. }
  26151. } else {
  26152. peg$currPos = s0;
  26153. s0 = peg$FAILED;
  26154. }
  26155. } else {
  26156. peg$currPos = s0;
  26157. s0 = peg$FAILED;
  26158. }
  26159. if (s0 === peg$FAILED) {
  26160. s0 = peg$currPos;
  26161. s1 = peg$parseexpressions();
  26162. if (s1 === peg$FAILED) {
  26163. s1 = null;
  26164. }
  26165. if (s1 !== peg$FAILED) {
  26166. s2 = peg$parsemaybeDotsWs();
  26167. if (s2 !== peg$FAILED) {
  26168. peg$savedPos = s0;
  26169. s1 = peg$c103(s1);
  26170. s0 = s1;
  26171. } else {
  26172. peg$currPos = s0;
  26173. s0 = peg$FAILED;
  26174. }
  26175. } else {
  26176. peg$currPos = s0;
  26177. s0 = peg$FAILED;
  26178. }
  26179. }
  26180. }
  26181. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26182. return s0;
  26183. }
  26184. function peg$parsewsSequenceWs() {
  26185. var s0, s1, s2, s3;
  26186. var key = peg$currPos * 61 + 42,
  26187. cached = peg$resultsCache[key];
  26188. if (cached) {
  26189. peg$currPos = cached.nextPos;
  26190. return cached.result;
  26191. }
  26192. s0 = peg$currPos;
  26193. s1 = peg$parsews();
  26194. if (s1 !== peg$FAILED) {
  26195. s2 = peg$parsejsStatement();
  26196. if (s2 !== peg$FAILED) {
  26197. s3 = peg$parsews();
  26198. if (s3 !== peg$FAILED) {
  26199. peg$savedPos = s0;
  26200. s1 = peg$c104(s2);
  26201. s0 = s1;
  26202. } else {
  26203. peg$currPos = s0;
  26204. s0 = peg$FAILED;
  26205. }
  26206. } else {
  26207. peg$currPos = s0;
  26208. s0 = peg$FAILED;
  26209. }
  26210. } else {
  26211. peg$currPos = s0;
  26212. s0 = peg$FAILED;
  26213. }
  26214. if (s0 === peg$FAILED) {
  26215. s0 = peg$parsewsStSequenceWs();
  26216. }
  26217. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26218. return s0;
  26219. }
  26220. function peg$parsewsStSequenceWs() {
  26221. var s0, s1, s2, s3, s4;
  26222. var key = peg$currPos * 61 + 43,
  26223. cached = peg$resultsCache[key];
  26224. if (cached) {
  26225. peg$currPos = cached.nextPos;
  26226. return cached.result;
  26227. }
  26228. s0 = peg$currPos;
  26229. s1 = peg$parsews();
  26230. if (s1 !== peg$FAILED) {
  26231. s2 = peg$parsetemps();
  26232. if (s2 === peg$FAILED) {
  26233. s2 = null;
  26234. }
  26235. if (s2 !== peg$FAILED) {
  26236. s3 = peg$parsemaybeDotsWs();
  26237. if (s3 !== peg$FAILED) {
  26238. s4 = peg$parsestatementsWs();
  26239. if (s4 === peg$FAILED) {
  26240. s4 = null;
  26241. }
  26242. if (s4 !== peg$FAILED) {
  26243. peg$savedPos = s0;
  26244. s1 = peg$c105(s2, s4);
  26245. s0 = s1;
  26246. } else {
  26247. peg$currPos = s0;
  26248. s0 = peg$FAILED;
  26249. }
  26250. } else {
  26251. peg$currPos = s0;
  26252. s0 = peg$FAILED;
  26253. }
  26254. } else {
  26255. peg$currPos = s0;
  26256. s0 = peg$FAILED;
  26257. }
  26258. } else {
  26259. peg$currPos = s0;
  26260. s0 = peg$FAILED;
  26261. }
  26262. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26263. return s0;
  26264. }
  26265. function peg$parseblock() {
  26266. var s0, s1, s2, s3, s4;
  26267. var key = peg$currPos * 61 + 44,
  26268. cached = peg$resultsCache[key];
  26269. if (cached) {
  26270. peg$currPos = cached.nextPos;
  26271. return cached.result;
  26272. }
  26273. s0 = peg$currPos;
  26274. if (input.charCodeAt(peg$currPos) === 91) {
  26275. s1 = peg$c106;
  26276. peg$currPos++;
  26277. } else {
  26278. s1 = peg$FAILED;
  26279. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26280. }
  26281. if (s1 !== peg$FAILED) {
  26282. s2 = peg$parsewsBlockParamList();
  26283. if (s2 === peg$FAILED) {
  26284. s2 = null;
  26285. }
  26286. if (s2 !== peg$FAILED) {
  26287. s3 = peg$parsewsSequenceWs();
  26288. if (s3 === peg$FAILED) {
  26289. s3 = null;
  26290. }
  26291. if (s3 !== peg$FAILED) {
  26292. if (input.charCodeAt(peg$currPos) === 93) {
  26293. s4 = peg$c108;
  26294. peg$currPos++;
  26295. } else {
  26296. s4 = peg$FAILED;
  26297. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26298. }
  26299. if (s4 !== peg$FAILED) {
  26300. peg$savedPos = s0;
  26301. s1 = peg$c110(s2, s3);
  26302. s0 = s1;
  26303. } else {
  26304. peg$currPos = s0;
  26305. s0 = peg$FAILED;
  26306. }
  26307. } else {
  26308. peg$currPos = s0;
  26309. s0 = peg$FAILED;
  26310. }
  26311. } else {
  26312. peg$currPos = s0;
  26313. s0 = peg$FAILED;
  26314. }
  26315. } else {
  26316. peg$currPos = s0;
  26317. s0 = peg$FAILED;
  26318. }
  26319. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26320. return s0;
  26321. }
  26322. function peg$parseoperand() {
  26323. var s0;
  26324. var key = peg$currPos * 61 + 45,
  26325. cached = peg$resultsCache[key];
  26326. if (cached) {
  26327. peg$currPos = cached.nextPos;
  26328. return cached.result;
  26329. }
  26330. s0 = peg$parseliteral();
  26331. if (s0 === peg$FAILED) {
  26332. s0 = peg$parsevariable();
  26333. if (s0 === peg$FAILED) {
  26334. s0 = peg$parsesubexpression();
  26335. }
  26336. }
  26337. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26338. return s0;
  26339. }
  26340. function peg$parsewsUnaryMessage() {
  26341. var s0, s1, s2, s3, s4;
  26342. var key = peg$currPos * 61 + 46,
  26343. cached = peg$resultsCache[key];
  26344. if (cached) {
  26345. peg$currPos = cached.nextPos;
  26346. return cached.result;
  26347. }
  26348. s0 = peg$currPos;
  26349. s1 = peg$parsews();
  26350. if (s1 !== peg$FAILED) {
  26351. s2 = peg$parseidentifier();
  26352. if (s2 !== peg$FAILED) {
  26353. s3 = peg$currPos;
  26354. peg$silentFails++;
  26355. if (input.charCodeAt(peg$currPos) === 58) {
  26356. s4 = peg$c13;
  26357. peg$currPos++;
  26358. } else {
  26359. s4 = peg$FAILED;
  26360. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26361. }
  26362. peg$silentFails--;
  26363. if (s4 === peg$FAILED) {
  26364. s3 = void 0;
  26365. } else {
  26366. peg$currPos = s3;
  26367. s3 = peg$FAILED;
  26368. }
  26369. if (s3 !== peg$FAILED) {
  26370. peg$savedPos = s0;
  26371. s1 = peg$c111(s2);
  26372. s0 = s1;
  26373. } else {
  26374. peg$currPos = s0;
  26375. s0 = peg$FAILED;
  26376. }
  26377. } else {
  26378. peg$currPos = s0;
  26379. s0 = peg$FAILED;
  26380. }
  26381. } else {
  26382. peg$currPos = s0;
  26383. s0 = peg$FAILED;
  26384. }
  26385. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26386. return s0;
  26387. }
  26388. function peg$parsewsUnaryTail() {
  26389. var s0, s1, s2;
  26390. var key = peg$currPos * 61 + 47,
  26391. cached = peg$resultsCache[key];
  26392. if (cached) {
  26393. peg$currPos = cached.nextPos;
  26394. return cached.result;
  26395. }
  26396. s0 = peg$currPos;
  26397. s1 = peg$parsewsUnaryMessage();
  26398. if (s1 !== peg$FAILED) {
  26399. s2 = peg$parsewsUnaryTail();
  26400. if (s2 === peg$FAILED) {
  26401. s2 = null;
  26402. }
  26403. if (s2 !== peg$FAILED) {
  26404. peg$savedPos = s0;
  26405. s1 = peg$c112(s1, s2);
  26406. s0 = s1;
  26407. } else {
  26408. peg$currPos = s0;
  26409. s0 = peg$FAILED;
  26410. }
  26411. } else {
  26412. peg$currPos = s0;
  26413. s0 = peg$FAILED;
  26414. }
  26415. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26416. return s0;
  26417. }
  26418. function peg$parseunarySend() {
  26419. var s0, s1, s2;
  26420. var key = peg$currPos * 61 + 48,
  26421. cached = peg$resultsCache[key];
  26422. if (cached) {
  26423. peg$currPos = cached.nextPos;
  26424. return cached.result;
  26425. }
  26426. s0 = peg$currPos;
  26427. s1 = peg$parseoperand();
  26428. if (s1 !== peg$FAILED) {
  26429. s2 = peg$parsewsUnaryTail();
  26430. if (s2 === peg$FAILED) {
  26431. s2 = null;
  26432. }
  26433. if (s2 !== peg$FAILED) {
  26434. peg$savedPos = s0;
  26435. s1 = peg$c113(s1, s2);
  26436. s0 = s1;
  26437. } else {
  26438. peg$currPos = s0;
  26439. s0 = peg$FAILED;
  26440. }
  26441. } else {
  26442. peg$currPos = s0;
  26443. s0 = peg$FAILED;
  26444. }
  26445. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26446. return s0;
  26447. }
  26448. function peg$parsewsBinaryMessage() {
  26449. var s0, s1, s2, s3, s4;
  26450. var key = peg$currPos * 61 + 49,
  26451. cached = peg$resultsCache[key];
  26452. if (cached) {
  26453. peg$currPos = cached.nextPos;
  26454. return cached.result;
  26455. }
  26456. s0 = peg$currPos;
  26457. s1 = peg$parsews();
  26458. if (s1 !== peg$FAILED) {
  26459. s2 = peg$parsebinarySelector();
  26460. if (s2 !== peg$FAILED) {
  26461. s3 = peg$parsews();
  26462. if (s3 !== peg$FAILED) {
  26463. s4 = peg$parseunarySend();
  26464. if (s4 !== peg$FAILED) {
  26465. peg$savedPos = s0;
  26466. s1 = peg$c114(s2, s4);
  26467. s0 = s1;
  26468. } else {
  26469. peg$currPos = s0;
  26470. s0 = peg$FAILED;
  26471. }
  26472. } else {
  26473. peg$currPos = s0;
  26474. s0 = peg$FAILED;
  26475. }
  26476. } else {
  26477. peg$currPos = s0;
  26478. s0 = peg$FAILED;
  26479. }
  26480. } else {
  26481. peg$currPos = s0;
  26482. s0 = peg$FAILED;
  26483. }
  26484. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26485. return s0;
  26486. }
  26487. function peg$parsewsBinaryTail() {
  26488. var s0, s1, s2;
  26489. var key = peg$currPos * 61 + 50,
  26490. cached = peg$resultsCache[key];
  26491. if (cached) {
  26492. peg$currPos = cached.nextPos;
  26493. return cached.result;
  26494. }
  26495. s0 = peg$currPos;
  26496. s1 = peg$parsewsBinaryMessage();
  26497. if (s1 !== peg$FAILED) {
  26498. s2 = peg$parsewsBinaryTail();
  26499. if (s2 === peg$FAILED) {
  26500. s2 = null;
  26501. }
  26502. if (s2 !== peg$FAILED) {
  26503. peg$savedPos = s0;
  26504. s1 = peg$c115(s1, s2);
  26505. s0 = s1;
  26506. } else {
  26507. peg$currPos = s0;
  26508. s0 = peg$FAILED;
  26509. }
  26510. } else {
  26511. peg$currPos = s0;
  26512. s0 = peg$FAILED;
  26513. }
  26514. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26515. return s0;
  26516. }
  26517. function peg$parsebinarySend() {
  26518. var s0, s1, s2;
  26519. var key = peg$currPos * 61 + 51,
  26520. cached = peg$resultsCache[key];
  26521. if (cached) {
  26522. peg$currPos = cached.nextPos;
  26523. return cached.result;
  26524. }
  26525. s0 = peg$currPos;
  26526. s1 = peg$parseunarySend();
  26527. if (s1 !== peg$FAILED) {
  26528. s2 = peg$parsewsBinaryTail();
  26529. if (s2 === peg$FAILED) {
  26530. s2 = null;
  26531. }
  26532. if (s2 !== peg$FAILED) {
  26533. peg$savedPos = s0;
  26534. s1 = peg$c113(s1, s2);
  26535. s0 = s1;
  26536. } else {
  26537. peg$currPos = s0;
  26538. s0 = peg$FAILED;
  26539. }
  26540. } else {
  26541. peg$currPos = s0;
  26542. s0 = peg$FAILED;
  26543. }
  26544. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26545. return s0;
  26546. }
  26547. function peg$parsewsKeywordMessage() {
  26548. var s0, s1, s2, s3, s4, s5, s6;
  26549. var key = peg$currPos * 61 + 52,
  26550. cached = peg$resultsCache[key];
  26551. if (cached) {
  26552. peg$currPos = cached.nextPos;
  26553. return cached.result;
  26554. }
  26555. s0 = peg$currPos;
  26556. s1 = [];
  26557. s2 = peg$currPos;
  26558. s3 = peg$parsews();
  26559. if (s3 !== peg$FAILED) {
  26560. s4 = peg$parsekeyword();
  26561. if (s4 !== peg$FAILED) {
  26562. s5 = peg$parsews();
  26563. if (s5 !== peg$FAILED) {
  26564. s6 = peg$parsebinarySend();
  26565. if (s6 !== peg$FAILED) {
  26566. peg$savedPos = s2;
  26567. s3 = peg$c83(s4, s6);
  26568. s2 = s3;
  26569. } else {
  26570. peg$currPos = s2;
  26571. s2 = peg$FAILED;
  26572. }
  26573. } else {
  26574. peg$currPos = s2;
  26575. s2 = peg$FAILED;
  26576. }
  26577. } else {
  26578. peg$currPos = s2;
  26579. s2 = peg$FAILED;
  26580. }
  26581. } else {
  26582. peg$currPos = s2;
  26583. s2 = peg$FAILED;
  26584. }
  26585. if (s2 !== peg$FAILED) {
  26586. while (s2 !== peg$FAILED) {
  26587. s1.push(s2);
  26588. s2 = peg$currPos;
  26589. s3 = peg$parsews();
  26590. if (s3 !== peg$FAILED) {
  26591. s4 = peg$parsekeyword();
  26592. if (s4 !== peg$FAILED) {
  26593. s5 = peg$parsews();
  26594. if (s5 !== peg$FAILED) {
  26595. s6 = peg$parsebinarySend();
  26596. if (s6 !== peg$FAILED) {
  26597. peg$savedPos = s2;
  26598. s3 = peg$c83(s4, s6);
  26599. s2 = s3;
  26600. } else {
  26601. peg$currPos = s2;
  26602. s2 = peg$FAILED;
  26603. }
  26604. } else {
  26605. peg$currPos = s2;
  26606. s2 = peg$FAILED;
  26607. }
  26608. } else {
  26609. peg$currPos = s2;
  26610. s2 = peg$FAILED;
  26611. }
  26612. } else {
  26613. peg$currPos = s2;
  26614. s2 = peg$FAILED;
  26615. }
  26616. }
  26617. } else {
  26618. s1 = peg$FAILED;
  26619. }
  26620. if (s1 !== peg$FAILED) {
  26621. peg$savedPos = s0;
  26622. s1 = peg$c116(s1);
  26623. }
  26624. s0 = s1;
  26625. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26626. return s0;
  26627. }
  26628. function peg$parsekeywordSend() {
  26629. var s0, s1, s2;
  26630. var key = peg$currPos * 61 + 53,
  26631. cached = peg$resultsCache[key];
  26632. if (cached) {
  26633. peg$currPos = cached.nextPos;
  26634. return cached.result;
  26635. }
  26636. s0 = peg$currPos;
  26637. s1 = peg$parsebinarySend();
  26638. if (s1 !== peg$FAILED) {
  26639. s2 = peg$parsewsKeywordMessage();
  26640. if (s2 === peg$FAILED) {
  26641. s2 = null;
  26642. }
  26643. if (s2 !== peg$FAILED) {
  26644. peg$savedPos = s0;
  26645. s1 = peg$c113(s1, s2);
  26646. s0 = s1;
  26647. } else {
  26648. peg$currPos = s0;
  26649. s0 = peg$FAILED;
  26650. }
  26651. } else {
  26652. peg$currPos = s0;
  26653. s0 = peg$FAILED;
  26654. }
  26655. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26656. return s0;
  26657. }
  26658. function peg$parsewsMessage() {
  26659. var s0;
  26660. var key = peg$currPos * 61 + 54,
  26661. cached = peg$resultsCache[key];
  26662. if (cached) {
  26663. peg$currPos = cached.nextPos;
  26664. return cached.result;
  26665. }
  26666. s0 = peg$parsewsBinaryMessage();
  26667. if (s0 === peg$FAILED) {
  26668. s0 = peg$parsewsUnaryMessage();
  26669. if (s0 === peg$FAILED) {
  26670. s0 = peg$parsewsKeywordMessage();
  26671. }
  26672. }
  26673. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26674. return s0;
  26675. }
  26676. function peg$parsecascade() {
  26677. var s0, s1, s2, s3, s4, s5, s6, s7;
  26678. var key = peg$currPos * 61 + 55,
  26679. cached = peg$resultsCache[key];
  26680. if (cached) {
  26681. peg$currPos = cached.nextPos;
  26682. return cached.result;
  26683. }
  26684. s0 = peg$currPos;
  26685. s1 = peg$parsekeywordSend();
  26686. if (s1 !== peg$FAILED) {
  26687. peg$savedPos = peg$currPos;
  26688. s2 = peg$c117(s1);
  26689. if (s2) {
  26690. s2 = void 0;
  26691. } else {
  26692. s2 = peg$FAILED;
  26693. }
  26694. if (s2 !== peg$FAILED) {
  26695. s3 = [];
  26696. s4 = peg$currPos;
  26697. s5 = peg$parsews();
  26698. if (s5 !== peg$FAILED) {
  26699. if (input.charCodeAt(peg$currPos) === 59) {
  26700. s6 = peg$c118;
  26701. peg$currPos++;
  26702. } else {
  26703. s6 = peg$FAILED;
  26704. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26705. }
  26706. if (s6 !== peg$FAILED) {
  26707. s7 = peg$parsewsMessage();
  26708. if (s7 !== peg$FAILED) {
  26709. peg$savedPos = s4;
  26710. s5 = peg$c120(s1, s7);
  26711. s4 = s5;
  26712. } else {
  26713. peg$currPos = s4;
  26714. s4 = peg$FAILED;
  26715. }
  26716. } else {
  26717. peg$currPos = s4;
  26718. s4 = peg$FAILED;
  26719. }
  26720. } else {
  26721. peg$currPos = s4;
  26722. s4 = peg$FAILED;
  26723. }
  26724. if (s4 !== peg$FAILED) {
  26725. while (s4 !== peg$FAILED) {
  26726. s3.push(s4);
  26727. s4 = peg$currPos;
  26728. s5 = peg$parsews();
  26729. if (s5 !== peg$FAILED) {
  26730. if (input.charCodeAt(peg$currPos) === 59) {
  26731. s6 = peg$c118;
  26732. peg$currPos++;
  26733. } else {
  26734. s6 = peg$FAILED;
  26735. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26736. }
  26737. if (s6 !== peg$FAILED) {
  26738. s7 = peg$parsewsMessage();
  26739. if (s7 !== peg$FAILED) {
  26740. peg$savedPos = s4;
  26741. s5 = peg$c120(s1, s7);
  26742. s4 = s5;
  26743. } else {
  26744. peg$currPos = s4;
  26745. s4 = peg$FAILED;
  26746. }
  26747. } else {
  26748. peg$currPos = s4;
  26749. s4 = peg$FAILED;
  26750. }
  26751. } else {
  26752. peg$currPos = s4;
  26753. s4 = peg$FAILED;
  26754. }
  26755. }
  26756. } else {
  26757. s3 = peg$FAILED;
  26758. }
  26759. if (s3 !== peg$FAILED) {
  26760. peg$savedPos = s0;
  26761. s1 = peg$c121(s1, s3);
  26762. s0 = s1;
  26763. } else {
  26764. peg$currPos = s0;
  26765. s0 = peg$FAILED;
  26766. }
  26767. } else {
  26768. peg$currPos = s0;
  26769. s0 = peg$FAILED;
  26770. }
  26771. } else {
  26772. peg$currPos = s0;
  26773. s0 = peg$FAILED;
  26774. }
  26775. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26776. return s0;
  26777. }
  26778. function peg$parsejsStatement() {
  26779. var s0, s1, s2, s3, s4;
  26780. var key = peg$currPos * 61 + 56,
  26781. cached = peg$resultsCache[key];
  26782. if (cached) {
  26783. peg$currPos = cached.nextPos;
  26784. return cached.result;
  26785. }
  26786. s0 = peg$currPos;
  26787. if (input.charCodeAt(peg$currPos) === 60) {
  26788. s1 = peg$c122;
  26789. peg$currPos++;
  26790. } else {
  26791. s1 = peg$FAILED;
  26792. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  26793. }
  26794. if (s1 !== peg$FAILED) {
  26795. s2 = [];
  26796. s3 = peg$currPos;
  26797. if (input.substr(peg$currPos, 2) === peg$c124) {
  26798. s4 = peg$c124;
  26799. peg$currPos += 2;
  26800. } else {
  26801. s4 = peg$FAILED;
  26802. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26803. }
  26804. if (s4 !== peg$FAILED) {
  26805. peg$savedPos = s3;
  26806. s4 = peg$c126();
  26807. }
  26808. s3 = s4;
  26809. if (s3 === peg$FAILED) {
  26810. if (peg$c127.test(input.charAt(peg$currPos))) {
  26811. s3 = input.charAt(peg$currPos);
  26812. peg$currPos++;
  26813. } else {
  26814. s3 = peg$FAILED;
  26815. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26816. }
  26817. }
  26818. while (s3 !== peg$FAILED) {
  26819. s2.push(s3);
  26820. s3 = peg$currPos;
  26821. if (input.substr(peg$currPos, 2) === peg$c124) {
  26822. s4 = peg$c124;
  26823. peg$currPos += 2;
  26824. } else {
  26825. s4 = peg$FAILED;
  26826. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26827. }
  26828. if (s4 !== peg$FAILED) {
  26829. peg$savedPos = s3;
  26830. s4 = peg$c126();
  26831. }
  26832. s3 = s4;
  26833. if (s3 === peg$FAILED) {
  26834. if (peg$c127.test(input.charAt(peg$currPos))) {
  26835. s3 = input.charAt(peg$currPos);
  26836. peg$currPos++;
  26837. } else {
  26838. s3 = peg$FAILED;
  26839. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26840. }
  26841. }
  26842. }
  26843. if (s2 !== peg$FAILED) {
  26844. if (input.charCodeAt(peg$currPos) === 62) {
  26845. s3 = peg$c129;
  26846. peg$currPos++;
  26847. } else {
  26848. s3 = peg$FAILED;
  26849. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26850. }
  26851. if (s3 !== peg$FAILED) {
  26852. peg$savedPos = s0;
  26853. s1 = peg$c131(s2);
  26854. s0 = s1;
  26855. } else {
  26856. peg$currPos = s0;
  26857. s0 = peg$FAILED;
  26858. }
  26859. } else {
  26860. peg$currPos = s0;
  26861. s0 = peg$FAILED;
  26862. }
  26863. } else {
  26864. peg$currPos = s0;
  26865. s0 = peg$FAILED;
  26866. }
  26867. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26868. return s0;
  26869. }
  26870. function peg$parsemethod() {
  26871. var s0, s1, s2;
  26872. var key = peg$currPos * 61 + 57,
  26873. cached = peg$resultsCache[key];
  26874. if (cached) {
  26875. peg$currPos = cached.nextPos;
  26876. return cached.result;
  26877. }
  26878. s0 = peg$currPos;
  26879. s1 = peg$parsewsKeywordPattern();
  26880. if (s1 === peg$FAILED) {
  26881. s1 = peg$parsewsBinaryPattern();
  26882. if (s1 === peg$FAILED) {
  26883. s1 = peg$parsewsUnaryPattern();
  26884. }
  26885. }
  26886. if (s1 !== peg$FAILED) {
  26887. s2 = peg$parsewsSequenceWs();
  26888. if (s2 === peg$FAILED) {
  26889. s2 = null;
  26890. }
  26891. if (s2 !== peg$FAILED) {
  26892. peg$savedPos = s0;
  26893. s1 = peg$c132(s1, s2);
  26894. s0 = s1;
  26895. } else {
  26896. peg$currPos = s0;
  26897. s0 = peg$FAILED;
  26898. }
  26899. } else {
  26900. peg$currPos = s0;
  26901. s0 = peg$FAILED;
  26902. }
  26903. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26904. return s0;
  26905. }
  26906. function peg$parseassociationSend() {
  26907. var s0, s1, s2;
  26908. var key = peg$currPos * 61 + 58,
  26909. cached = peg$resultsCache[key];
  26910. if (cached) {
  26911. peg$currPos = cached.nextPos;
  26912. return cached.result;
  26913. }
  26914. s0 = peg$currPos;
  26915. s1 = peg$parsebinarySend();
  26916. if (s1 !== peg$FAILED) {
  26917. peg$savedPos = peg$currPos;
  26918. s2 = peg$c133(s1);
  26919. if (s2) {
  26920. s2 = void 0;
  26921. } else {
  26922. s2 = peg$FAILED;
  26923. }
  26924. if (s2 !== peg$FAILED) {
  26925. peg$savedPos = s0;
  26926. s1 = peg$c134(s1);
  26927. s0 = s1;
  26928. } else {
  26929. peg$currPos = s0;
  26930. s0 = peg$FAILED;
  26931. }
  26932. } else {
  26933. peg$currPos = s0;
  26934. s0 = peg$FAILED;
  26935. }
  26936. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26937. return s0;
  26938. }
  26939. function peg$parsewsAssociationsRest() {
  26940. var s0, s1, s2, s3, s4;
  26941. var key = peg$currPos * 61 + 59,
  26942. cached = peg$resultsCache[key];
  26943. if (cached) {
  26944. peg$currPos = cached.nextPos;
  26945. return cached.result;
  26946. }
  26947. s0 = peg$currPos;
  26948. s1 = peg$parsews();
  26949. if (s1 !== peg$FAILED) {
  26950. if (input.charCodeAt(peg$currPos) === 46) {
  26951. s2 = peg$c6;
  26952. peg$currPos++;
  26953. } else {
  26954. s2 = peg$FAILED;
  26955. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26956. }
  26957. if (s2 !== peg$FAILED) {
  26958. s3 = peg$parsemaybeDotsWs();
  26959. if (s3 !== peg$FAILED) {
  26960. s4 = peg$parseassociationSend();
  26961. if (s4 !== peg$FAILED) {
  26962. peg$savedPos = s0;
  26963. s1 = peg$c87(s4);
  26964. s0 = s1;
  26965. } else {
  26966. peg$currPos = s0;
  26967. s0 = peg$FAILED;
  26968. }
  26969. } else {
  26970. peg$currPos = s0;
  26971. s0 = peg$FAILED;
  26972. }
  26973. } else {
  26974. peg$currPos = s0;
  26975. s0 = peg$FAILED;
  26976. }
  26977. } else {
  26978. peg$currPos = s0;
  26979. s0 = peg$FAILED;
  26980. }
  26981. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26982. return s0;
  26983. }
  26984. function peg$parseassociations() {
  26985. var s0, s1, s2, s3;
  26986. var key = peg$currPos * 61 + 60,
  26987. cached = peg$resultsCache[key];
  26988. if (cached) {
  26989. peg$currPos = cached.nextPos;
  26990. return cached.result;
  26991. }
  26992. s0 = peg$currPos;
  26993. s1 = peg$parseassociationSend();
  26994. if (s1 !== peg$FAILED) {
  26995. s2 = [];
  26996. s3 = peg$parsewsAssociationsRest();
  26997. while (s3 !== peg$FAILED) {
  26998. s2.push(s3);
  26999. s3 = peg$parsewsAssociationsRest();
  27000. }
  27001. if (s2 !== peg$FAILED) {
  27002. peg$savedPos = s0;
  27003. s1 = peg$c135(s1, s2);
  27004. s0 = s1;
  27005. } else {
  27006. peg$currPos = s0;
  27007. s0 = peg$FAILED;
  27008. }
  27009. } else {
  27010. peg$currPos = s0;
  27011. s0 = peg$FAILED;
  27012. }
  27013. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27014. return s0;
  27015. }
  27016. peg$result = peg$startRuleFunction();
  27017. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  27018. return peg$result;
  27019. } else {
  27020. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  27021. peg$fail({ type: "end", description: "end of input" });
  27022. }
  27023. throw peg$buildException(
  27024. null,
  27025. peg$maxFailExpected,
  27026. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  27027. peg$maxFailPos < input.length
  27028. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  27029. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  27030. );
  27031. }
  27032. }
  27033. return {
  27034. SyntaxError: peg$SyntaxError,
  27035. parse: peg$parse
  27036. };
  27037. })();
  27038. });
  27039. define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  27040. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  27041. $core.addPackage('Platform-ImportExport');
  27042. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  27043. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27044. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  27045. $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.";
  27046. $core.addMethod(
  27047. $core.method({
  27048. selector: "classNameFor:",
  27049. protocol: 'convenience',
  27050. fn: function (aClass){
  27051. var self=this;
  27052. return $core.withContext(function($ctx1) {
  27053. var $1,$2,$receiver;
  27054. $1=$recv(aClass)._isMetaclass();
  27055. if($core.assert($1)){
  27056. $2=$recv($recv(aClass)._instanceClass())._name();
  27057. $ctx1.sendIdx["name"]=1;
  27058. return $recv($2).__comma(" class");
  27059. } else {
  27060. if(($receiver = aClass) == null || $receiver.isNil){
  27061. return "nil";
  27062. } else {
  27063. return $recv(aClass)._name();
  27064. };
  27065. };
  27066. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  27067. },
  27068. args: ["aClass"],
  27069. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'nil' ]\x0a\x09\x09\x09\x09ifNotNil: [ aClass name ] ]",
  27070. referencedClasses: [],
  27071. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "ifNil:ifNotNil:"]
  27072. }),
  27073. $globals.AbstractExporter);
  27074. $core.addMethod(
  27075. $core.method({
  27076. selector: "exportPackage:on:",
  27077. protocol: 'output',
  27078. fn: function (aPackage,aStream){
  27079. var self=this;
  27080. return $core.withContext(function($ctx1) {
  27081. self._subclassResponsibility();
  27082. return self;
  27083. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  27084. },
  27085. args: ["aPackage", "aStream"],
  27086. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27087. referencedClasses: [],
  27088. messageSends: ["subclassResponsibility"]
  27089. }),
  27090. $globals.AbstractExporter);
  27091. $core.addMethod(
  27092. $core.method({
  27093. selector: "extensionMethodsOfPackage:",
  27094. protocol: 'accessing',
  27095. fn: function (aPackage){
  27096. var self=this;
  27097. var result;
  27098. return $core.withContext(function($ctx1) {
  27099. result=$recv($globals.OrderedCollection)._new();
  27100. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  27101. return $core.withContext(function($ctx2) {
  27102. return $recv(result)._addAll_($recv(each)._methods());
  27103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27104. }));
  27105. return result;
  27106. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27107. },
  27108. args: ["aPackage"],
  27109. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  27110. referencedClasses: ["OrderedCollection"],
  27111. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27112. }),
  27113. $globals.AbstractExporter);
  27114. $core.addMethod(
  27115. $core.method({
  27116. selector: "extensionProtocolsOfPackage:",
  27117. protocol: 'accessing',
  27118. fn: function (aPackage){
  27119. var self=this;
  27120. var extensionName,result;
  27121. return $core.withContext(function($ctx1) {
  27122. var $1,$2,$3;
  27123. $1=$recv(aPackage)._name();
  27124. $ctx1.sendIdx["name"]=1;
  27125. extensionName="*".__comma($1);
  27126. result=$recv($globals.OrderedCollection)._new();
  27127. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  27128. return $core.withContext(function($ctx2) {
  27129. $2=$recv(a)._name();
  27130. $ctx2.sendIdx["name"]=2;
  27131. return $recv($2).__lt($recv(b)._name());
  27132. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27133. })))._do_((function(each){
  27134. return $core.withContext(function($ctx2) {
  27135. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27136. return $core.withContext(function($ctx3) {
  27137. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27138. if($core.assert($3)){
  27139. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  27140. };
  27141. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27142. }));
  27143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27144. }));
  27145. $ctx1.sendIdx["do:"]=1;
  27146. return result;
  27147. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27148. },
  27149. args: ["aPackage"],
  27150. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  27151. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27152. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27153. }),
  27154. $globals.AbstractExporter);
  27155. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27156. $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.";
  27157. $core.addMethod(
  27158. $core.method({
  27159. selector: "chunkEscape:",
  27160. protocol: 'convenience',
  27161. fn: function (aString){
  27162. var self=this;
  27163. return $core.withContext(function($ctx1) {
  27164. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27165. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27166. },
  27167. args: ["aString"],
  27168. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27169. referencedClasses: [],
  27170. messageSends: ["trimBoth", "replace:with:"]
  27171. }),
  27172. $globals.ChunkExporter);
  27173. $core.addMethod(
  27174. $core.method({
  27175. selector: "exportCategoryEpilogueOf:on:",
  27176. protocol: 'output',
  27177. fn: function (aCategory,aStream){
  27178. var self=this;
  27179. return $core.withContext(function($ctx1) {
  27180. $recv(aStream)._nextPutAll_(" !");
  27181. $recv(aStream)._lf();
  27182. $ctx1.sendIdx["lf"]=1;
  27183. $recv(aStream)._lf();
  27184. return self;
  27185. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27186. },
  27187. args: ["aCategory", "aStream"],
  27188. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27189. referencedClasses: [],
  27190. messageSends: ["nextPutAll:", "lf"]
  27191. }),
  27192. $globals.ChunkExporter);
  27193. $core.addMethod(
  27194. $core.method({
  27195. selector: "exportCategoryPrologueOf:on:",
  27196. protocol: 'output',
  27197. fn: function (aCategory,aStream){
  27198. var self=this;
  27199. return $core.withContext(function($ctx1) {
  27200. var $1,$2;
  27201. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27202. $ctx1.sendIdx[","]=1;
  27203. $recv(aStream)._nextPutAll_($1);
  27204. $ctx1.sendIdx["nextPutAll:"]=1;
  27205. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27206. $ctx1.sendIdx[","]=2;
  27207. $recv(aStream)._nextPutAll_($2);
  27208. return self;
  27209. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27210. },
  27211. args: ["aCategory", "aStream"],
  27212. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27213. referencedClasses: [],
  27214. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27215. }),
  27216. $globals.ChunkExporter);
  27217. $core.addMethod(
  27218. $core.method({
  27219. selector: "exportDefinitionOf:on:",
  27220. protocol: 'output',
  27221. fn: function (aClass,aStream){
  27222. var self=this;
  27223. return $core.withContext(function($ctx1) {
  27224. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27225. $1=self._classNameFor_($recv(aClass)._superclass());
  27226. $ctx1.sendIdx["classNameFor:"]=1;
  27227. $recv(aStream)._nextPutAll_($1);
  27228. $ctx1.sendIdx["nextPutAll:"]=1;
  27229. $3=self._classNameFor_(aClass);
  27230. $ctx1.sendIdx["classNameFor:"]=2;
  27231. $2=" subclass: #".__comma($3);
  27232. $ctx1.sendIdx[","]=1;
  27233. $recv(aStream)._nextPutAll_($2);
  27234. $ctx1.sendIdx["nextPutAll:"]=2;
  27235. $recv(aStream)._lf();
  27236. $ctx1.sendIdx["lf"]=1;
  27237. $recv(aStream)._tab();
  27238. $ctx1.sendIdx["tab"]=1;
  27239. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27240. $ctx1.sendIdx["nextPutAll:"]=3;
  27241. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27242. return $core.withContext(function($ctx2) {
  27243. return $recv(aStream)._nextPutAll_(each);
  27244. $ctx2.sendIdx["nextPutAll:"]=4;
  27245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27246. }),(function(){
  27247. return $core.withContext(function($ctx2) {
  27248. return $recv(aStream)._nextPutAll_(" ");
  27249. $ctx2.sendIdx["nextPutAll:"]=5;
  27250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27251. }));
  27252. $recv(aStream)._nextPutAll_("'");
  27253. $ctx1.sendIdx["nextPutAll:"]=6;
  27254. $recv(aStream)._lf();
  27255. $ctx1.sendIdx["lf"]=2;
  27256. $recv(aStream)._tab();
  27257. $6="package: '".__comma($recv(aClass)._category());
  27258. $ctx1.sendIdx[","]=3;
  27259. $5=$recv($6).__comma("'!");
  27260. $ctx1.sendIdx[","]=2;
  27261. $recv(aStream)._nextPutAll_($5);
  27262. $ctx1.sendIdx["nextPutAll:"]=7;
  27263. $7=$recv(aStream)._lf();
  27264. $ctx1.sendIdx["lf"]=3;
  27265. $9=$recv(aClass)._comment();
  27266. $ctx1.sendIdx["comment"]=1;
  27267. $8=$recv($9)._notEmpty();
  27268. if($core.assert($8)){
  27269. $11="!".__comma(self._classNameFor_(aClass));
  27270. $ctx1.sendIdx[","]=5;
  27271. $10=$recv($11).__comma(" commentStamp!");
  27272. $ctx1.sendIdx[","]=4;
  27273. $recv(aStream)._nextPutAll_($10);
  27274. $ctx1.sendIdx["nextPutAll:"]=8;
  27275. $recv(aStream)._lf();
  27276. $ctx1.sendIdx["lf"]=4;
  27277. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27278. $12=$recv(aStream)._lf();
  27279. $ctx1.sendIdx["lf"]=5;
  27280. $12;
  27281. };
  27282. $recv(aStream)._lf();
  27283. return self;
  27284. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27285. },
  27286. args: ["aClass", "aStream"],
  27287. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27288. referencedClasses: [],
  27289. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27290. }),
  27291. $globals.ChunkExporter);
  27292. $core.addMethod(
  27293. $core.method({
  27294. selector: "exportMetaDefinitionOf:on:",
  27295. protocol: 'output',
  27296. fn: function (aClass,aStream){
  27297. var self=this;
  27298. return $core.withContext(function($ctx1) {
  27299. var $3,$2,$1,$5,$4,$6;
  27300. $3=$recv(aClass)._class();
  27301. $ctx1.sendIdx["class"]=1;
  27302. $2=$recv($3)._instanceVariableNames();
  27303. $ctx1.sendIdx["instanceVariableNames"]=1;
  27304. $1=$recv($2)._isEmpty();
  27305. if(!$core.assert($1)){
  27306. $5=$recv(aClass)._class();
  27307. $ctx1.sendIdx["class"]=2;
  27308. $4=self._classNameFor_($5);
  27309. $recv(aStream)._nextPutAll_($4);
  27310. $ctx1.sendIdx["nextPutAll:"]=1;
  27311. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27312. $ctx1.sendIdx["nextPutAll:"]=2;
  27313. $6;
  27314. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27315. return $core.withContext(function($ctx2) {
  27316. return $recv(aStream)._nextPutAll_(each);
  27317. $ctx2.sendIdx["nextPutAll:"]=3;
  27318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27319. }),(function(){
  27320. return $core.withContext(function($ctx2) {
  27321. return $recv(aStream)._nextPutAll_(" ");
  27322. $ctx2.sendIdx["nextPutAll:"]=4;
  27323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27324. }));
  27325. $recv(aStream)._nextPutAll_("'!");
  27326. $recv(aStream)._lf();
  27327. $ctx1.sendIdx["lf"]=1;
  27328. $recv(aStream)._lf();
  27329. };
  27330. return self;
  27331. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27332. },
  27333. args: ["aClass", "aStream"],
  27334. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27335. referencedClasses: [],
  27336. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27337. }),
  27338. $globals.ChunkExporter);
  27339. $core.addMethod(
  27340. $core.method({
  27341. selector: "exportMethod:on:",
  27342. protocol: 'output',
  27343. fn: function (aMethod,aStream){
  27344. var self=this;
  27345. return $core.withContext(function($ctx1) {
  27346. $recv(aStream)._lf();
  27347. $ctx1.sendIdx["lf"]=1;
  27348. $recv(aStream)._lf();
  27349. $ctx1.sendIdx["lf"]=2;
  27350. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27351. $ctx1.sendIdx["nextPutAll:"]=1;
  27352. $recv(aStream)._lf();
  27353. $recv(aStream)._nextPutAll_("!");
  27354. return self;
  27355. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27356. },
  27357. args: ["aMethod", "aStream"],
  27358. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27359. referencedClasses: [],
  27360. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27361. }),
  27362. $globals.ChunkExporter);
  27363. $core.addMethod(
  27364. $core.method({
  27365. selector: "exportPackage:on:",
  27366. protocol: 'output',
  27367. fn: function (aPackage,aStream){
  27368. var self=this;
  27369. return $core.withContext(function($ctx1) {
  27370. var $1;
  27371. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27372. self._exportPackageImportsOf_on_(aPackage,aStream);
  27373. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27374. return $core.withContext(function($ctx2) {
  27375. self._exportDefinitionOf_on_(each,aStream);
  27376. $1=self._ownMethodProtocolsOfClass_(each);
  27377. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27378. self._exportProtocols_on_($1,aStream);
  27379. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27380. self._exportMetaDefinitionOf_on_(each,aStream);
  27381. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27382. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27383. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27384. }));
  27385. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27386. return self;
  27387. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27388. },
  27389. args: ["aPackage", "aStream"],
  27390. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  27391. referencedClasses: [],
  27392. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27393. }),
  27394. $globals.ChunkExporter);
  27395. $core.addMethod(
  27396. $core.method({
  27397. selector: "exportPackageDefinitionOf:on:",
  27398. protocol: 'output',
  27399. fn: function (aPackage,aStream){
  27400. var self=this;
  27401. return $core.withContext(function($ctx1) {
  27402. var $1;
  27403. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27404. $ctx1.sendIdx[","]=1;
  27405. $recv(aStream)._nextPutAll_($1);
  27406. $recv(aStream)._lf();
  27407. return self;
  27408. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27409. },
  27410. args: ["aPackage", "aStream"],
  27411. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27412. referencedClasses: [],
  27413. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27414. }),
  27415. $globals.ChunkExporter);
  27416. $core.addMethod(
  27417. $core.method({
  27418. selector: "exportPackageImportsOf:on:",
  27419. protocol: 'output',
  27420. fn: function (aPackage,aStream){
  27421. var self=this;
  27422. return $core.withContext(function($ctx1) {
  27423. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27424. return $core.withContext(function($ctx2) {
  27425. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27426. $ctx2.sendIdx["nextPutAll:"]=1;
  27427. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27428. $ctx2.sendIdx["nextPutAll:"]=2;
  27429. $recv(aStream)._nextPutAll_("') imports: ");
  27430. $ctx2.sendIdx["nextPutAll:"]=3;
  27431. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27432. $ctx2.sendIdx["nextPutAll:"]=4;
  27433. $recv(aStream)._nextPutAll_("!");
  27434. return $recv(aStream)._lf();
  27435. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27436. }));
  27437. return self;
  27438. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27439. },
  27440. args: ["aPackage", "aStream"],
  27441. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]",
  27442. referencedClasses: [],
  27443. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27444. }),
  27445. $globals.ChunkExporter);
  27446. $core.addMethod(
  27447. $core.method({
  27448. selector: "exportProtocol:on:",
  27449. protocol: 'output',
  27450. fn: function (aProtocol,aStream){
  27451. var self=this;
  27452. return $core.withContext(function($ctx1) {
  27453. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27454. $recv($recv(aProtocol)._methods())._do_((function(method){
  27455. return $core.withContext(function($ctx2) {
  27456. return self._exportMethod_on_(method,aStream);
  27457. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27458. }));
  27459. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27460. return self;
  27461. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27462. },
  27463. args: ["aProtocol", "aStream"],
  27464. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  27465. referencedClasses: [],
  27466. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27467. }),
  27468. $globals.ChunkExporter);
  27469. $core.addMethod(
  27470. $core.method({
  27471. selector: "exportProtocolEpilogueOf:on:",
  27472. protocol: 'output',
  27473. fn: function (aProtocol,aStream){
  27474. var self=this;
  27475. return $core.withContext(function($ctx1) {
  27476. $recv(aStream)._nextPutAll_(" !");
  27477. $recv(aStream)._lf();
  27478. $ctx1.sendIdx["lf"]=1;
  27479. $recv(aStream)._lf();
  27480. return self;
  27481. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27482. },
  27483. args: ["aProtocol", "aStream"],
  27484. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27485. referencedClasses: [],
  27486. messageSends: ["nextPutAll:", "lf"]
  27487. }),
  27488. $globals.ChunkExporter);
  27489. $core.addMethod(
  27490. $core.method({
  27491. selector: "exportProtocolPrologueOf:on:",
  27492. protocol: 'output',
  27493. fn: function (aProtocol,aStream){
  27494. var self=this;
  27495. return $core.withContext(function($ctx1) {
  27496. var $1,$2;
  27497. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27498. $ctx1.sendIdx[","]=1;
  27499. $recv(aStream)._nextPutAll_($1);
  27500. $ctx1.sendIdx["nextPutAll:"]=1;
  27501. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27502. $ctx1.sendIdx[","]=2;
  27503. $recv(aStream)._nextPutAll_($2);
  27504. return self;
  27505. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27506. },
  27507. args: ["aProtocol", "aStream"],
  27508. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27509. referencedClasses: [],
  27510. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27511. }),
  27512. $globals.ChunkExporter);
  27513. $core.addMethod(
  27514. $core.method({
  27515. selector: "exportProtocols:on:",
  27516. protocol: 'output',
  27517. fn: function (aCollection,aStream){
  27518. var self=this;
  27519. return $core.withContext(function($ctx1) {
  27520. $recv(aCollection)._do_((function(each){
  27521. return $core.withContext(function($ctx2) {
  27522. return self._exportProtocol_on_(each,aStream);
  27523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27524. }));
  27525. return self;
  27526. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27527. },
  27528. args: ["aCollection", "aStream"],
  27529. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27530. referencedClasses: [],
  27531. messageSends: ["do:", "exportProtocol:on:"]
  27532. }),
  27533. $globals.ChunkExporter);
  27534. $core.addMethod(
  27535. $core.method({
  27536. selector: "extensionCategoriesOfPackage:",
  27537. protocol: 'accessing',
  27538. fn: function (aPackage){
  27539. var self=this;
  27540. var name,map,result;
  27541. return $core.withContext(function($ctx1) {
  27542. var $1;
  27543. name=$recv(aPackage)._name();
  27544. result=$recv($globals.OrderedCollection)._new();
  27545. $ctx1.sendIdx["new"]=1;
  27546. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27547. return $core.withContext(function($ctx2) {
  27548. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27549. return $core.withContext(function($ctx3) {
  27550. map=$recv($globals.Dictionary)._new();
  27551. map;
  27552. $recv(aClass)._protocolsDo_((function(category,methods){
  27553. return $core.withContext(function($ctx4) {
  27554. $1=$recv(category).__eq("*".__comma(name));
  27555. if($core.assert($1)){
  27556. return $recv(map)._at_put_(category,methods);
  27557. };
  27558. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27559. }));
  27560. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27561. return $core.withContext(function($ctx4) {
  27562. return $recv(a).__lt_eq(b);
  27563. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27564. })))._collect_((function(category){
  27565. return $core.withContext(function($ctx4) {
  27566. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27567. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27568. })));
  27569. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27570. }));
  27571. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27572. }));
  27573. $ctx1.sendIdx["do:"]=1;
  27574. return result;
  27575. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27576. },
  27577. args: ["aPackage"],
  27578. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  27579. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27580. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27581. }),
  27582. $globals.ChunkExporter);
  27583. $core.addMethod(
  27584. $core.method({
  27585. selector: "ownCategoriesOfClass:",
  27586. protocol: 'accessing',
  27587. fn: function (aClass){
  27588. var self=this;
  27589. var map;
  27590. return $core.withContext(function($ctx1) {
  27591. var $1;
  27592. map=$recv($globals.Dictionary)._new();
  27593. $recv(aClass)._protocolsDo_((function(each,methods){
  27594. return $core.withContext(function($ctx2) {
  27595. $1=$recv(each)._match_("^\x5c*");
  27596. if(!$core.assert($1)){
  27597. return $recv(map)._at_put_(each,methods);
  27598. };
  27599. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27600. }));
  27601. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27602. return $core.withContext(function($ctx2) {
  27603. return $recv(a).__lt_eq(b);
  27604. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27605. })))._collect_((function(each){
  27606. return $core.withContext(function($ctx2) {
  27607. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27609. }));
  27610. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27611. },
  27612. args: ["aClass"],
  27613. 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) ]",
  27614. referencedClasses: ["Dictionary", "MethodCategory"],
  27615. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27616. }),
  27617. $globals.ChunkExporter);
  27618. $core.addMethod(
  27619. $core.method({
  27620. selector: "ownCategoriesOfMetaClass:",
  27621. protocol: 'accessing',
  27622. fn: function (aClass){
  27623. var self=this;
  27624. return $core.withContext(function($ctx1) {
  27625. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27626. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27627. },
  27628. args: ["aClass"],
  27629. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27630. referencedClasses: [],
  27631. messageSends: ["ownCategoriesOfClass:", "class"]
  27632. }),
  27633. $globals.ChunkExporter);
  27634. $core.addMethod(
  27635. $core.method({
  27636. selector: "ownMethodProtocolsOfClass:",
  27637. protocol: 'accessing',
  27638. fn: function (aClass){
  27639. var self=this;
  27640. return $core.withContext(function($ctx1) {
  27641. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27642. return $core.withContext(function($ctx2) {
  27643. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27645. }));
  27646. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27647. },
  27648. args: ["aClass"],
  27649. 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 ]",
  27650. referencedClasses: ["ExportMethodProtocol"],
  27651. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27652. }),
  27653. $globals.ChunkExporter);
  27654. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27655. $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.).";
  27656. $core.addMethod(
  27657. $core.method({
  27658. selector: "exportDefinitionOf:on:",
  27659. protocol: 'output',
  27660. fn: function (aClass,aStream){
  27661. var self=this;
  27662. return $core.withContext(function($ctx1) {
  27663. var $2,$1,$3,$4,$6,$5,$7,$9,$8;
  27664. $recv(aStream)._lf();
  27665. $ctx1.sendIdx["lf"]=1;
  27666. $recv(aStream)._nextPutAll_("$core.addClass(");
  27667. $ctx1.sendIdx["nextPutAll:"]=1;
  27668. $2="'".__comma(self._classNameFor_(aClass));
  27669. $ctx1.sendIdx[","]=2;
  27670. $1=$recv($2).__comma("', ");
  27671. $ctx1.sendIdx[","]=1;
  27672. $recv(aStream)._nextPutAll_($1);
  27673. $ctx1.sendIdx["nextPutAll:"]=2;
  27674. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27675. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27676. $recv(aStream)._nextPutAll_($3);
  27677. $ctx1.sendIdx["nextPutAll:"]=3;
  27678. $4=$recv(aStream)._nextPutAll_(", [");
  27679. $ctx1.sendIdx["nextPutAll:"]=4;
  27680. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27681. return $core.withContext(function($ctx2) {
  27682. $6="'".__comma(each);
  27683. $ctx2.sendIdx[","]=4;
  27684. $5=$recv($6).__comma("'");
  27685. $ctx2.sendIdx[","]=3;
  27686. return $recv(aStream)._nextPutAll_($5);
  27687. $ctx2.sendIdx["nextPutAll:"]=5;
  27688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27689. }),(function(){
  27690. return $core.withContext(function($ctx2) {
  27691. return $recv(aStream)._nextPutAll_(", ");
  27692. $ctx2.sendIdx["nextPutAll:"]=6;
  27693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27694. }));
  27695. $recv(aStream)._nextPutAll_("], '");
  27696. $ctx1.sendIdx["nextPutAll:"]=7;
  27697. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27698. $ctx1.sendIdx["nextPutAll:"]=8;
  27699. $7=$recv(aStream)._nextPutAll_(");");
  27700. $ctx1.sendIdx["nextPutAll:"]=9;
  27701. $9=$recv(aClass)._comment();
  27702. $ctx1.sendIdx["comment"]=1;
  27703. $8=$recv($9)._notEmpty();
  27704. if($core.assert($8)){
  27705. $recv(aStream)._lf();
  27706. $ctx1.sendIdx["lf"]=2;
  27707. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27708. $ctx1.sendIdx["nextPutAll:"]=10;
  27709. $recv(aStream)._lf();
  27710. $ctx1.sendIdx["lf"]=3;
  27711. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27712. $ctx1.sendIdx["nextPutAll:"]=11;
  27713. $recv(aStream)._nextPutAll_(".comment=");
  27714. $ctx1.sendIdx["nextPutAll:"]=12;
  27715. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27716. $ctx1.sendIdx["nextPutAll:"]=13;
  27717. $recv(aStream)._nextPutAll_(";");
  27718. $ctx1.sendIdx["nextPutAll:"]=14;
  27719. $recv(aStream)._lf();
  27720. $ctx1.sendIdx["lf"]=4;
  27721. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27722. };
  27723. $recv(aStream)._lf();
  27724. return self;
  27725. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27726. },
  27727. args: ["aClass", "aStream"],
  27728. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  27729. referencedClasses: [],
  27730. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27731. }),
  27732. $globals.Exporter);
  27733. $core.addMethod(
  27734. $core.method({
  27735. selector: "exportMetaDefinitionOf:on:",
  27736. protocol: 'output',
  27737. fn: function (aClass,aStream){
  27738. var self=this;
  27739. return $core.withContext(function($ctx1) {
  27740. var $3,$2,$1,$5,$4,$6,$8,$7;
  27741. $recv(aStream)._lf();
  27742. $ctx1.sendIdx["lf"]=1;
  27743. $3=$recv(aClass)._class();
  27744. $ctx1.sendIdx["class"]=1;
  27745. $2=$recv($3)._instanceVariableNames();
  27746. $ctx1.sendIdx["instanceVariableNames"]=1;
  27747. $1=$recv($2)._isEmpty();
  27748. if(!$core.assert($1)){
  27749. $5=$recv(aClass)._class();
  27750. $ctx1.sendIdx["class"]=2;
  27751. $4=self._jsClassNameFor_($5);
  27752. $recv(aStream)._nextPutAll_($4);
  27753. $ctx1.sendIdx["nextPutAll:"]=1;
  27754. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27755. $ctx1.sendIdx["nextPutAll:"]=2;
  27756. $6;
  27757. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27758. return $core.withContext(function($ctx2) {
  27759. $8="'".__comma(each);
  27760. $ctx2.sendIdx[","]=2;
  27761. $7=$recv($8).__comma("'");
  27762. $ctx2.sendIdx[","]=1;
  27763. return $recv(aStream)._nextPutAll_($7);
  27764. $ctx2.sendIdx["nextPutAll:"]=3;
  27765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27766. }),(function(){
  27767. return $core.withContext(function($ctx2) {
  27768. return $recv(aStream)._nextPutAll_(",");
  27769. $ctx2.sendIdx["nextPutAll:"]=4;
  27770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27771. }));
  27772. $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  27773. };
  27774. return self;
  27775. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27776. },
  27777. args: ["aClass", "aStream"],
  27778. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  27779. referencedClasses: ["String"],
  27780. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27781. }),
  27782. $globals.Exporter);
  27783. $core.addMethod(
  27784. $core.method({
  27785. selector: "exportMethod:on:",
  27786. protocol: 'output',
  27787. fn: function (aMethod,aStream){
  27788. var self=this;
  27789. return $core.withContext(function($ctx1) {
  27790. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  27791. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27792. $ctx1.sendIdx["nextPutAll:"]=1;
  27793. $recv(aStream)._lf();
  27794. $ctx1.sendIdx["lf"]=1;
  27795. $recv(aStream)._nextPutAll_("$core.method({");
  27796. $ctx1.sendIdx["nextPutAll:"]=2;
  27797. $recv(aStream)._lf();
  27798. $ctx1.sendIdx["lf"]=2;
  27799. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27800. $ctx1.sendIdx["asJavascript"]=1;
  27801. $2="selector: ".__comma($3);
  27802. $ctx1.sendIdx[","]=2;
  27803. $1=$recv($2).__comma(",");
  27804. $ctx1.sendIdx[","]=1;
  27805. $recv(aStream)._nextPutAll_($1);
  27806. $ctx1.sendIdx["nextPutAll:"]=3;
  27807. $recv(aStream)._lf();
  27808. $ctx1.sendIdx["lf"]=3;
  27809. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27810. $ctx1.sendIdx[","]=4;
  27811. $4=$recv($5).__comma("',");
  27812. $ctx1.sendIdx[","]=3;
  27813. $recv(aStream)._nextPutAll_($4);
  27814. $ctx1.sendIdx["nextPutAll:"]=4;
  27815. $recv(aStream)._lf();
  27816. $ctx1.sendIdx["lf"]=4;
  27817. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27818. $ctx1.sendIdx[","]=6;
  27819. $6=$recv($7).__comma(",");
  27820. $ctx1.sendIdx[","]=5;
  27821. $recv(aStream)._nextPutAll_($6);
  27822. $ctx1.sendIdx["nextPutAll:"]=5;
  27823. $recv(aStream)._lf();
  27824. $ctx1.sendIdx["lf"]=5;
  27825. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27826. $ctx1.sendIdx["nextPutAll:"]=6;
  27827. $recv(aStream)._lf();
  27828. $ctx1.sendIdx["lf"]=6;
  27829. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27830. $ctx1.sendIdx["asJavascript"]=2;
  27831. $9="args: ".__comma($10);
  27832. $ctx1.sendIdx[","]=8;
  27833. $8=$recv($9).__comma(",");
  27834. $ctx1.sendIdx[","]=7;
  27835. $recv(aStream)._nextPutAll_($8);
  27836. $ctx1.sendIdx["nextPutAll:"]=7;
  27837. $recv(aStream)._lf();
  27838. $ctx1.sendIdx["lf"]=7;
  27839. $13=$recv($recv(aMethod)._source())._asJavascript();
  27840. $ctx1.sendIdx["asJavascript"]=3;
  27841. $12="source: ".__comma($13);
  27842. $ctx1.sendIdx[","]=10;
  27843. $11=$recv($12).__comma(",");
  27844. $ctx1.sendIdx[","]=9;
  27845. $recv(aStream)._nextPutAll_($11);
  27846. $ctx1.sendIdx["nextPutAll:"]=8;
  27847. $recv(aStream)._lf();
  27848. $ctx1.sendIdx["lf"]=8;
  27849. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27850. $ctx1.sendIdx["asJavascript"]=4;
  27851. $15="referencedClasses: ".__comma($16);
  27852. $ctx1.sendIdx[","]=12;
  27853. $14=$recv($15).__comma(",");
  27854. $ctx1.sendIdx[","]=11;
  27855. $recv(aStream)._nextPutAll_($14);
  27856. $ctx1.sendIdx["nextPutAll:"]=9;
  27857. $recv(aStream)._lf();
  27858. $ctx1.sendIdx["lf"]=9;
  27859. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27860. $ctx1.sendIdx["nextPutAll:"]=10;
  27861. $recv(aStream)._lf();
  27862. $ctx1.sendIdx["lf"]=10;
  27863. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27864. $ctx1.sendIdx["nextPutAll:"]=11;
  27865. $recv(aStream)._lf();
  27866. $ctx1.sendIdx["lf"]=11;
  27867. $recv(aStream)._nextPutAll_("}),");
  27868. $ctx1.sendIdx["nextPutAll:"]=12;
  27869. $recv(aStream)._lf();
  27870. $ctx1.sendIdx["lf"]=12;
  27871. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27872. $ctx1.sendIdx["nextPutAll:"]=13;
  27873. $recv(aStream)._nextPutAll_(");");
  27874. $recv(aStream)._lf();
  27875. $ctx1.sendIdx["lf"]=13;
  27876. $recv(aStream)._lf();
  27877. return self;
  27878. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27879. },
  27880. args: ["aMethod", "aStream"],
  27881. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  27882. referencedClasses: [],
  27883. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27884. }),
  27885. $globals.Exporter);
  27886. $core.addMethod(
  27887. $core.method({
  27888. selector: "exportPackage:on:",
  27889. protocol: 'output',
  27890. fn: function (aPackage,aStream){
  27891. var self=this;
  27892. return $core.withContext(function($ctx1) {
  27893. var $1;
  27894. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27895. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27896. self._exportPackageContextOf_on_(aPackage,aStream);
  27897. self._exportPackageImportsOf_on_(aPackage,aStream);
  27898. self._exportPackageTransportOf_on_(aPackage,aStream);
  27899. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27900. return $core.withContext(function($ctx2) {
  27901. self._exportDefinitionOf_on_(each,aStream);
  27902. $1=$recv(each)._ownMethods();
  27903. $ctx2.sendIdx["ownMethods"]=1;
  27904. $recv($1)._do_((function(method){
  27905. return $core.withContext(function($ctx3) {
  27906. return self._exportMethod_on_(method,aStream);
  27907. $ctx3.sendIdx["exportMethod:on:"]=1;
  27908. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27909. }));
  27910. $ctx2.sendIdx["do:"]=2;
  27911. self._exportMetaDefinitionOf_on_(each,aStream);
  27912. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27913. return $core.withContext(function($ctx3) {
  27914. return self._exportMethod_on_(method,aStream);
  27915. $ctx3.sendIdx["exportMethod:on:"]=2;
  27916. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27917. }));
  27918. $ctx2.sendIdx["do:"]=3;
  27919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27920. }));
  27921. $ctx1.sendIdx["do:"]=1;
  27922. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27923. return $core.withContext(function($ctx2) {
  27924. return self._exportMethod_on_(each,aStream);
  27925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27926. }));
  27927. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27928. return self;
  27929. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27930. },
  27931. args: ["aPackage", "aStream"],
  27932. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  27933. referencedClasses: [],
  27934. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27935. }),
  27936. $globals.Exporter);
  27937. $core.addMethod(
  27938. $core.method({
  27939. selector: "exportPackageContextOf:on:",
  27940. protocol: 'output',
  27941. fn: function (aPackage,aStream){
  27942. var self=this;
  27943. return $core.withContext(function($ctx1) {
  27944. $recv(aStream)._nextPutAll_("$core.packages[");
  27945. $ctx1.sendIdx["nextPutAll:"]=1;
  27946. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27947. $ctx1.sendIdx["nextPutAll:"]=2;
  27948. $recv(aStream)._nextPutAll_("].innerEval = ");
  27949. $ctx1.sendIdx["nextPutAll:"]=3;
  27950. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27951. $ctx1.sendIdx["nextPutAll:"]=4;
  27952. $recv(aStream)._nextPutAll_(";");
  27953. $recv(aStream)._lf();
  27954. return self;
  27955. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27956. },
  27957. args: ["aPackage", "aStream"],
  27958. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  27959. referencedClasses: [],
  27960. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27961. }),
  27962. $globals.Exporter);
  27963. $core.addMethod(
  27964. $core.method({
  27965. selector: "exportPackageDefinitionOf:on:",
  27966. protocol: 'output',
  27967. fn: function (aPackage,aStream){
  27968. var self=this;
  27969. return $core.withContext(function($ctx1) {
  27970. var $1;
  27971. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27972. $ctx1.sendIdx["nextPutAll:"]=1;
  27973. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27974. $ctx1.sendIdx[","]=1;
  27975. $recv(aStream)._nextPutAll_($1);
  27976. $recv(aStream)._lf();
  27977. return self;
  27978. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27979. },
  27980. args: ["aPackage", "aStream"],
  27981. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27982. referencedClasses: [],
  27983. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27984. }),
  27985. $globals.Exporter);
  27986. $core.addMethod(
  27987. $core.method({
  27988. selector: "exportPackageEpilogueOf:on:",
  27989. protocol: 'output',
  27990. fn: function (aPackage,aStream){
  27991. var self=this;
  27992. return $core.withContext(function($ctx1) {
  27993. self._subclassResponsibility();
  27994. return self;
  27995. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27996. },
  27997. args: ["aPackage", "aStream"],
  27998. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27999. referencedClasses: [],
  28000. messageSends: ["subclassResponsibility"]
  28001. }),
  28002. $globals.Exporter);
  28003. $core.addMethod(
  28004. $core.method({
  28005. selector: "exportPackageImportsOf:on:",
  28006. protocol: 'output',
  28007. fn: function (aPackage,aStream){
  28008. var self=this;
  28009. return $core.withContext(function($ctx1) {
  28010. var $1;
  28011. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  28012. return $core.withContext(function($ctx2) {
  28013. $recv(aStream)._nextPutAll_("$core.packages[");
  28014. $ctx2.sendIdx["nextPutAll:"]=1;
  28015. $1=$recv($recv(aPackage)._name())._asJavascript();
  28016. $ctx2.sendIdx["asJavascript"]=1;
  28017. $recv(aStream)._nextPutAll_($1);
  28018. $ctx2.sendIdx["nextPutAll:"]=2;
  28019. $recv(aStream)._nextPutAll_("].imports = ");
  28020. $ctx2.sendIdx["nextPutAll:"]=3;
  28021. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  28022. $ctx2.sendIdx["nextPutAll:"]=4;
  28023. $recv(aStream)._nextPutAll_(";");
  28024. return $recv(aStream)._lf();
  28025. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  28026. }));
  28027. return self;
  28028. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28029. },
  28030. args: ["aPackage", "aStream"],
  28031. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]",
  28032. referencedClasses: [],
  28033. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  28034. }),
  28035. $globals.Exporter);
  28036. $core.addMethod(
  28037. $core.method({
  28038. selector: "exportPackagePrologueOf:on:",
  28039. protocol: 'output',
  28040. fn: function (aPackage,aStream){
  28041. var self=this;
  28042. return $core.withContext(function($ctx1) {
  28043. self._subclassResponsibility();
  28044. return self;
  28045. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28046. },
  28047. args: ["aPackage", "aStream"],
  28048. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28049. referencedClasses: [],
  28050. messageSends: ["subclassResponsibility"]
  28051. }),
  28052. $globals.Exporter);
  28053. $core.addMethod(
  28054. $core.method({
  28055. selector: "exportPackageTransportOf:on:",
  28056. protocol: 'output',
  28057. fn: function (aPackage,aStream){
  28058. var self=this;
  28059. return $core.withContext(function($ctx1) {
  28060. $recv(aStream)._nextPutAll_("$core.packages[");
  28061. $ctx1.sendIdx["nextPutAll:"]=1;
  28062. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28063. $ctx1.sendIdx["nextPutAll:"]=2;
  28064. $recv(aStream)._nextPutAll_("].transport = ");
  28065. $ctx1.sendIdx["nextPutAll:"]=3;
  28066. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  28067. $ctx1.sendIdx["nextPutAll:"]=4;
  28068. $recv(aStream)._nextPutAll_(";");
  28069. $recv(aStream)._lf();
  28070. return self;
  28071. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28072. },
  28073. args: ["aPackage", "aStream"],
  28074. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28075. referencedClasses: [],
  28076. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28077. }),
  28078. $globals.Exporter);
  28079. $core.addMethod(
  28080. $core.method({
  28081. selector: "jsClassNameFor:",
  28082. protocol: 'convenience',
  28083. fn: function (aClass){
  28084. var self=this;
  28085. return $core.withContext(function($ctx1) {
  28086. var $1,$receiver;
  28087. $1=$recv(aClass)._isMetaclass();
  28088. if($core.assert($1)){
  28089. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28090. $ctx1.sendIdx[","]=1;
  28091. } else {
  28092. if(($receiver = aClass) == null || $receiver.isNil){
  28093. return "null";
  28094. } else {
  28095. return "$globals.".__comma($recv(aClass)._name());
  28096. };
  28097. };
  28098. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28099. },
  28100. args: ["aClass"],
  28101. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]",
  28102. referencedClasses: [],
  28103. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28104. }),
  28105. $globals.Exporter);
  28106. $core.addMethod(
  28107. $core.method({
  28108. selector: "ownMethodsOfClass:",
  28109. protocol: 'accessing',
  28110. fn: function (aClass){
  28111. var self=this;
  28112. return $core.withContext(function($ctx1) {
  28113. var $1;
  28114. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28115. return $core.withContext(function($ctx2) {
  28116. $1=$recv(a)._selector();
  28117. $ctx2.sendIdx["selector"]=1;
  28118. return $recv($1).__lt_eq($recv(b)._selector());
  28119. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28120. })))._reject_((function(each){
  28121. return $core.withContext(function($ctx2) {
  28122. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28124. }));
  28125. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28126. },
  28127. args: ["aClass"],
  28128. 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*') ]",
  28129. referencedClasses: [],
  28130. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28131. }),
  28132. $globals.Exporter);
  28133. $core.addMethod(
  28134. $core.method({
  28135. selector: "ownMethodsOfMetaClass:",
  28136. protocol: 'accessing',
  28137. fn: function (aClass){
  28138. var self=this;
  28139. return $core.withContext(function($ctx1) {
  28140. return self._ownMethodsOfClass_($recv(aClass)._class());
  28141. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28142. },
  28143. args: ["aClass"],
  28144. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28145. referencedClasses: [],
  28146. messageSends: ["ownMethodsOfClass:", "class"]
  28147. }),
  28148. $globals.Exporter);
  28149. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28150. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28151. $core.addMethod(
  28152. $core.method({
  28153. selector: "amdNamesOfPackages:",
  28154. protocol: 'private',
  28155. fn: function (anArray){
  28156. var self=this;
  28157. return $core.withContext(function($ctx1) {
  28158. var $1;
  28159. return $recv($recv(anArray)._select_((function(each){
  28160. return $core.withContext(function($ctx2) {
  28161. $1=self._amdNamespaceOfPackage_(each);
  28162. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28163. return $recv($1)._notNil();
  28164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28165. })))._collect_((function(each){
  28166. return $core.withContext(function($ctx2) {
  28167. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28168. $ctx2.sendIdx[","]=1;
  28169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28170. }));
  28171. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28172. },
  28173. args: ["anArray"],
  28174. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28175. referencedClasses: [],
  28176. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28177. }),
  28178. $globals.AmdExporter);
  28179. $core.addMethod(
  28180. $core.method({
  28181. selector: "amdNamespaceOfPackage:",
  28182. protocol: 'private',
  28183. fn: function (aPackage){
  28184. var self=this;
  28185. return $core.withContext(function($ctx1) {
  28186. var $3,$2,$1;
  28187. $3=$recv(aPackage)._transport();
  28188. $ctx1.sendIdx["transport"]=1;
  28189. $2=$recv($3)._type();
  28190. $1=$recv($2).__eq("amd");
  28191. if($core.assert($1)){
  28192. return $recv($recv(aPackage)._transport())._namespace();
  28193. } else {
  28194. return nil;
  28195. };
  28196. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28197. },
  28198. args: ["aPackage"],
  28199. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28200. referencedClasses: [],
  28201. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28202. }),
  28203. $globals.AmdExporter);
  28204. $core.addMethod(
  28205. $core.method({
  28206. selector: "exportPackageEpilogueOf:on:",
  28207. protocol: 'output',
  28208. fn: function (aPackage,aStream){
  28209. var self=this;
  28210. return $core.withContext(function($ctx1) {
  28211. $recv(aStream)._nextPutAll_("});");
  28212. $recv(aStream)._lf();
  28213. return self;
  28214. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28215. },
  28216. args: ["aPackage", "aStream"],
  28217. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28218. referencedClasses: [],
  28219. messageSends: ["nextPutAll:", "lf"]
  28220. }),
  28221. $globals.AmdExporter);
  28222. $core.addMethod(
  28223. $core.method({
  28224. selector: "exportPackagePrologueOf:on:",
  28225. protocol: 'output',
  28226. fn: function (aPackage,aStream){
  28227. var self=this;
  28228. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28229. return $core.withContext(function($ctx1) {
  28230. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  28231. pragmaStart="";
  28232. pragmaEnd="";
  28233. importsForOutput=self._importsForOutput_(aPackage);
  28234. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28235. $1=$recv(importsForOutput)._value();
  28236. $ctx1.sendIdx["value"]=1;
  28237. $recv($1)._ifNotEmpty_((function(){
  28238. return $core.withContext(function($ctx2) {
  28239. $3=$recv($globals.String)._lf();
  28240. $ctx2.sendIdx["lf"]=1;
  28241. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28242. $ctx2.sendIdx[","]=2;
  28243. $4=$recv($globals.String)._lf();
  28244. $ctx2.sendIdx["lf"]=2;
  28245. pragmaStart=$recv($2).__comma($4);
  28246. $ctx2.sendIdx[","]=1;
  28247. pragmaStart;
  28248. $6=$recv($globals.String)._lf();
  28249. $ctx2.sendIdx["lf"]=3;
  28250. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28251. $ctx2.sendIdx[","]=4;
  28252. $7=$recv($globals.String)._lf();
  28253. $ctx2.sendIdx["lf"]=4;
  28254. pragmaEnd=$recv($5).__comma($7);
  28255. $ctx2.sendIdx[","]=3;
  28256. return pragmaEnd;
  28257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28258. }));
  28259. $recv(aStream)._nextPutAll_("define(\x22");
  28260. $ctx1.sendIdx["nextPutAll:"]=1;
  28261. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28262. $ctx1.sendIdx["nextPutAll:"]=2;
  28263. $recv(aStream)._nextPutAll_("/");
  28264. $ctx1.sendIdx["nextPutAll:"]=3;
  28265. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28266. $ctx1.sendIdx["nextPutAll:"]=4;
  28267. $recv(aStream)._nextPutAll_("\x22, ");
  28268. $ctx1.sendIdx["nextPutAll:"]=5;
  28269. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28270. $ctx1.sendIdx[","]=7;
  28271. $12=$recv($13).__comma([":2:"]);
  28272. $ctx1.sendIdx[","]=6;
  28273. $11=$recv($12).__comma(loadDependencies);
  28274. $ctx1.sendIdx[","]=5;
  28275. $10=$recv($11)._asJavascript();
  28276. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28277. $ctx1.sendIdx["replace:with:"]=2;
  28278. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28279. $ctx1.sendIdx["replace:with:"]=1;
  28280. $recv(aStream)._nextPutAll_($8);
  28281. $ctx1.sendIdx["nextPutAll:"]=6;
  28282. $recv(aStream)._nextPutAll_(", function(");
  28283. $ctx1.sendIdx["nextPutAll:"]=7;
  28284. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28285. $ctx1.sendIdx[","]=8;
  28286. $16=$recv($17)._join_(",");
  28287. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28288. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28289. $ctx1.sendIdx["replace:with:"]=3;
  28290. $recv(aStream)._nextPutAll_($14);
  28291. $ctx1.sendIdx["nextPutAll:"]=8;
  28292. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28293. $ctx1.sendIdx["nextPutAll:"]=9;
  28294. $recv(aStream)._lf();
  28295. $ctx1.sendIdx["lf"]=5;
  28296. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28297. $recv(aStream)._lf();
  28298. return self;
  28299. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28300. },
  28301. args: ["aPackage", "aStream"],
  28302. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){\x22use strict\x22;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf",
  28303. referencedClasses: ["String"],
  28304. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28305. }),
  28306. $globals.AmdExporter);
  28307. $core.addMethod(
  28308. $core.method({
  28309. selector: "importsForOutput:",
  28310. protocol: 'private',
  28311. fn: function (aPackage){
  28312. var self=this;
  28313. var namedImports,anonImports,importVarNames;
  28314. return $core.withContext(function($ctx1) {
  28315. var $1;
  28316. namedImports=[];
  28317. anonImports=[];
  28318. importVarNames=[];
  28319. $recv($recv(aPackage)._imports())._do_((function(each){
  28320. return $core.withContext(function($ctx2) {
  28321. $1=$recv(each)._isString();
  28322. if($core.assert($1)){
  28323. return $recv(anonImports)._add_(each);
  28324. $ctx2.sendIdx["add:"]=1;
  28325. } else {
  28326. $recv(namedImports)._add_($recv(each)._value());
  28327. $ctx2.sendIdx["add:"]=2;
  28328. return $recv(importVarNames)._add_($recv(each)._key());
  28329. };
  28330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28331. }));
  28332. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28333. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28334. },
  28335. args: ["aPackage"],
  28336. 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)",
  28337. referencedClasses: [],
  28338. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28339. }),
  28340. $globals.AmdExporter);
  28341. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28342. $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";
  28343. $core.addMethod(
  28344. $core.method({
  28345. selector: "last",
  28346. protocol: 'accessing',
  28347. fn: function (){
  28348. var self=this;
  28349. return self["@last"];
  28350. },
  28351. args: [],
  28352. source: "last\x0a\x09^ last",
  28353. referencedClasses: [],
  28354. messageSends: []
  28355. }),
  28356. $globals.ChunkParser);
  28357. $core.addMethod(
  28358. $core.method({
  28359. selector: "nextChunk",
  28360. protocol: 'reading',
  28361. fn: function (){
  28362. var self=this;
  28363. var char,result,chunk;
  28364. return $core.withContext(function($ctx1) {
  28365. var $1,$2,$3,$4;
  28366. var $early={};
  28367. try {
  28368. result=""._writeStream();
  28369. $recv((function(){
  28370. return $core.withContext(function($ctx2) {
  28371. char=$recv(self["@stream"])._next();
  28372. $ctx2.sendIdx["next"]=1;
  28373. char;
  28374. return $recv(char)._notNil();
  28375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28376. }))._whileTrue_((function(){
  28377. return $core.withContext(function($ctx2) {
  28378. $1=$recv(char).__eq("!");
  28379. $ctx2.sendIdx["="]=1;
  28380. if($core.assert($1)){
  28381. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28382. if($core.assert($2)){
  28383. $recv(self["@stream"])._next();
  28384. } else {
  28385. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28386. $3=self["@last"];
  28387. throw $early=[$3];
  28388. };
  28389. };
  28390. return $recv(result)._nextPut_(char);
  28391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28392. }));
  28393. self["@last"]=nil;
  28394. $4=self["@last"];
  28395. return $4;
  28396. }
  28397. catch(e) {if(e===$early)return e[0]; throw e}
  28398. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28399. },
  28400. args: [],
  28401. 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",
  28402. referencedClasses: [],
  28403. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28404. }),
  28405. $globals.ChunkParser);
  28406. $core.addMethod(
  28407. $core.method({
  28408. selector: "stream:",
  28409. protocol: 'accessing',
  28410. fn: function (aStream){
  28411. var self=this;
  28412. self["@stream"]=aStream;
  28413. return self;
  28414. },
  28415. args: ["aStream"],
  28416. source: "stream: aStream\x0a\x09stream := aStream",
  28417. referencedClasses: [],
  28418. messageSends: []
  28419. }),
  28420. $globals.ChunkParser);
  28421. $core.addMethod(
  28422. $core.method({
  28423. selector: "on:",
  28424. protocol: 'instance creation',
  28425. fn: function (aStream){
  28426. var self=this;
  28427. return $core.withContext(function($ctx1) {
  28428. return $recv(self._new())._stream_(aStream);
  28429. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28430. },
  28431. args: ["aStream"],
  28432. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28433. referencedClasses: [],
  28434. messageSends: ["stream:", "new"]
  28435. }),
  28436. $globals.ChunkParser.klass);
  28437. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28438. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28439. $core.addMethod(
  28440. $core.method({
  28441. selector: "class:",
  28442. protocol: 'accessing',
  28443. fn: function (aClass){
  28444. var self=this;
  28445. self["@class"]=aClass;
  28446. return self;
  28447. },
  28448. args: ["aClass"],
  28449. source: "class: aClass\x0a\x09class := aClass",
  28450. referencedClasses: [],
  28451. messageSends: []
  28452. }),
  28453. $globals.ClassCommentReader);
  28454. $core.addMethod(
  28455. $core.method({
  28456. selector: "initialize",
  28457. protocol: 'initialization',
  28458. fn: function (){
  28459. var self=this;
  28460. return $core.withContext(function($ctx1) {
  28461. (
  28462. $ctx1.supercall = true,
  28463. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28464. $ctx1.supercall = false;
  28465. return self;
  28466. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28467. },
  28468. args: [],
  28469. source: "initialize\x0a\x09super initialize.",
  28470. referencedClasses: [],
  28471. messageSends: ["initialize"]
  28472. }),
  28473. $globals.ClassCommentReader);
  28474. $core.addMethod(
  28475. $core.method({
  28476. selector: "scanFrom:",
  28477. protocol: 'fileIn',
  28478. fn: function (aChunkParser){
  28479. var self=this;
  28480. var chunk;
  28481. return $core.withContext(function($ctx1) {
  28482. var $1;
  28483. chunk=$recv(aChunkParser)._nextChunk();
  28484. $1=$recv(chunk)._isEmpty();
  28485. if(!$core.assert($1)){
  28486. self._setComment_(chunk);
  28487. };
  28488. return self;
  28489. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28490. },
  28491. args: ["aChunkParser"],
  28492. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28493. referencedClasses: [],
  28494. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28495. }),
  28496. $globals.ClassCommentReader);
  28497. $core.addMethod(
  28498. $core.method({
  28499. selector: "setComment:",
  28500. protocol: 'private',
  28501. fn: function (aString){
  28502. var self=this;
  28503. return $core.withContext(function($ctx1) {
  28504. $recv(self["@class"])._comment_(aString);
  28505. return self;
  28506. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28507. },
  28508. args: ["aString"],
  28509. source: "setComment: aString\x0a\x09class comment: aString",
  28510. referencedClasses: [],
  28511. messageSends: ["comment:"]
  28512. }),
  28513. $globals.ClassCommentReader);
  28514. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28515. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28516. $core.addMethod(
  28517. $core.method({
  28518. selector: "class:category:",
  28519. protocol: 'accessing',
  28520. fn: function (aClass,aString){
  28521. var self=this;
  28522. self["@class"]=aClass;
  28523. self["@category"]=aString;
  28524. return self;
  28525. },
  28526. args: ["aClass", "aString"],
  28527. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28528. referencedClasses: [],
  28529. messageSends: []
  28530. }),
  28531. $globals.ClassProtocolReader);
  28532. $core.addMethod(
  28533. $core.method({
  28534. selector: "compileMethod:",
  28535. protocol: 'private',
  28536. fn: function (aString){
  28537. var self=this;
  28538. return $core.withContext(function($ctx1) {
  28539. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28540. return self;
  28541. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28542. },
  28543. args: ["aString"],
  28544. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28545. referencedClasses: ["Compiler"],
  28546. messageSends: ["install:forClass:protocol:", "new"]
  28547. }),
  28548. $globals.ClassProtocolReader);
  28549. $core.addMethod(
  28550. $core.method({
  28551. selector: "initialize",
  28552. protocol: 'initialization',
  28553. fn: function (){
  28554. var self=this;
  28555. return $core.withContext(function($ctx1) {
  28556. (
  28557. $ctx1.supercall = true,
  28558. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28559. $ctx1.supercall = false;
  28560. return self;
  28561. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28562. },
  28563. args: [],
  28564. source: "initialize\x0a\x09super initialize.",
  28565. referencedClasses: [],
  28566. messageSends: ["initialize"]
  28567. }),
  28568. $globals.ClassProtocolReader);
  28569. $core.addMethod(
  28570. $core.method({
  28571. selector: "scanFrom:",
  28572. protocol: 'fileIn',
  28573. fn: function (aChunkParser){
  28574. var self=this;
  28575. var chunk;
  28576. return $core.withContext(function($ctx1) {
  28577. $recv((function(){
  28578. return $core.withContext(function($ctx2) {
  28579. chunk=$recv(aChunkParser)._nextChunk();
  28580. chunk;
  28581. return $recv(chunk)._isEmpty();
  28582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28583. }))._whileFalse_((function(){
  28584. return $core.withContext(function($ctx2) {
  28585. return self._compileMethod_(chunk);
  28586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28587. }));
  28588. return self;
  28589. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28590. },
  28591. args: ["aChunkParser"],
  28592. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  28593. referencedClasses: [],
  28594. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  28595. }),
  28596. $globals.ClassProtocolReader);
  28597. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28598. $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.";
  28599. $core.addMethod(
  28600. $core.method({
  28601. selector: "methods",
  28602. protocol: 'accessing',
  28603. fn: function (){
  28604. var self=this;
  28605. return $core.withContext(function($ctx1) {
  28606. var $1;
  28607. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28608. return $core.withContext(function($ctx2) {
  28609. $1=$recv(a)._selector();
  28610. $ctx2.sendIdx["selector"]=1;
  28611. return $recv($1).__lt_eq($recv(b)._selector());
  28612. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28613. }));
  28614. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28615. },
  28616. args: [],
  28617. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28618. referencedClasses: [],
  28619. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28620. }),
  28621. $globals.ExportMethodProtocol);
  28622. $core.addMethod(
  28623. $core.method({
  28624. selector: "name",
  28625. protocol: 'accessing',
  28626. fn: function (){
  28627. var self=this;
  28628. return self["@name"];
  28629. },
  28630. args: [],
  28631. source: "name\x0a\x09^ name",
  28632. referencedClasses: [],
  28633. messageSends: []
  28634. }),
  28635. $globals.ExportMethodProtocol);
  28636. $core.addMethod(
  28637. $core.method({
  28638. selector: "name:",
  28639. protocol: 'accessing',
  28640. fn: function (aString){
  28641. var self=this;
  28642. self["@name"]=aString;
  28643. return self;
  28644. },
  28645. args: ["aString"],
  28646. source: "name: aString\x0a\x09name := aString",
  28647. referencedClasses: [],
  28648. messageSends: []
  28649. }),
  28650. $globals.ExportMethodProtocol);
  28651. $core.addMethod(
  28652. $core.method({
  28653. selector: "theClass",
  28654. protocol: 'accessing',
  28655. fn: function (){
  28656. var self=this;
  28657. return self["@theClass"];
  28658. },
  28659. args: [],
  28660. source: "theClass\x0a\x09^ theClass",
  28661. referencedClasses: [],
  28662. messageSends: []
  28663. }),
  28664. $globals.ExportMethodProtocol);
  28665. $core.addMethod(
  28666. $core.method({
  28667. selector: "theClass:",
  28668. protocol: 'accessing',
  28669. fn: function (aClass){
  28670. var self=this;
  28671. self["@theClass"]=aClass;
  28672. return self;
  28673. },
  28674. args: ["aClass"],
  28675. source: "theClass: aClass\x0a\x09theClass := aClass",
  28676. referencedClasses: [],
  28677. messageSends: []
  28678. }),
  28679. $globals.ExportMethodProtocol);
  28680. $core.addMethod(
  28681. $core.method({
  28682. selector: "name:theClass:",
  28683. protocol: 'instance creation',
  28684. fn: function (aString,aClass){
  28685. var self=this;
  28686. return $core.withContext(function($ctx1) {
  28687. var $1;
  28688. $1=self._new();
  28689. $recv($1)._name_(aString);
  28690. $recv($1)._theClass_(aClass);
  28691. return $recv($1)._yourself();
  28692. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28693. },
  28694. args: ["aString", "aClass"],
  28695. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28696. referencedClasses: [],
  28697. messageSends: ["name:", "new", "theClass:", "yourself"]
  28698. }),
  28699. $globals.ExportMethodProtocol.klass);
  28700. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28701. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28702. $core.addMethod(
  28703. $core.method({
  28704. selector: "import:",
  28705. protocol: 'fileIn',
  28706. fn: function (aStream){
  28707. var self=this;
  28708. var chunk,result,parser,lastEmpty;
  28709. return $core.withContext(function($ctx1) {
  28710. var $1,$2;
  28711. parser=$recv($globals.ChunkParser)._on_(aStream);
  28712. lastEmpty=false;
  28713. self["@lastSection"]="n/a, not started";
  28714. self["@lastChunk"]=nil;
  28715. $recv((function(){
  28716. return $core.withContext(function($ctx2) {
  28717. $recv((function(){
  28718. return $core.withContext(function($ctx3) {
  28719. chunk=$recv(parser)._nextChunk();
  28720. chunk;
  28721. return $recv(chunk)._isNil();
  28722. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28723. }))._whileFalse_((function(){
  28724. return $core.withContext(function($ctx3) {
  28725. $1=$recv(chunk)._isEmpty();
  28726. if($core.assert($1)){
  28727. lastEmpty=true;
  28728. return lastEmpty;
  28729. } else {
  28730. self["@lastSection"]=chunk;
  28731. self["@lastSection"];
  28732. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28733. result;
  28734. $2=lastEmpty;
  28735. if($core.assert($2)){
  28736. lastEmpty=false;
  28737. lastEmpty;
  28738. return $recv(result)._scanFrom_(parser);
  28739. };
  28740. };
  28741. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28742. }));
  28743. self["@lastSection"]="n/a, finished";
  28744. return self["@lastSection"];
  28745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28746. }))._on_do_($globals.Error,(function(e){
  28747. return $core.withContext(function($ctx2) {
  28748. self["@lastChunk"]=$recv(parser)._last();
  28749. self["@lastChunk"];
  28750. return $recv(e)._resignal();
  28751. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28752. }));
  28753. return self;
  28754. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28755. },
  28756. args: ["aStream"],
  28757. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  28758. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28759. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28760. }),
  28761. $globals.Importer);
  28762. $core.addMethod(
  28763. $core.method({
  28764. selector: "lastChunk",
  28765. protocol: 'accessing',
  28766. fn: function (){
  28767. var self=this;
  28768. return self["@lastChunk"];
  28769. },
  28770. args: [],
  28771. source: "lastChunk\x0a\x09^ lastChunk",
  28772. referencedClasses: [],
  28773. messageSends: []
  28774. }),
  28775. $globals.Importer);
  28776. $core.addMethod(
  28777. $core.method({
  28778. selector: "lastSection",
  28779. protocol: 'accessing',
  28780. fn: function (){
  28781. var self=this;
  28782. return self["@lastSection"];
  28783. },
  28784. args: [],
  28785. source: "lastSection\x0a\x09^ lastSection",
  28786. referencedClasses: [],
  28787. messageSends: []
  28788. }),
  28789. $globals.Importer);
  28790. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28791. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28792. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28793. $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.";
  28794. $core.addMethod(
  28795. $core.method({
  28796. selector: "ajaxPutAt:data:onSuccess:onError:",
  28797. protocol: 'private',
  28798. fn: function (aURL,aString,aBlock,anotherBlock){
  28799. var self=this;
  28800. var xhr;
  28801. return $core.withContext(function($ctx1) {
  28802. var $1,$4,$3,$2;
  28803. xhr=$recv($globals.Platform)._newXhr();
  28804. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28805. $recv(xhr)._onreadystatechange_((function(){
  28806. return $core.withContext(function($ctx2) {
  28807. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28808. if($core.assert($1)){
  28809. $4=$recv(xhr)._status();
  28810. $ctx2.sendIdx["status"]=1;
  28811. $3=$recv($4).__gt_eq((200));
  28812. $2=$recv($3)._and_((function(){
  28813. return $core.withContext(function($ctx3) {
  28814. return $recv($recv(xhr)._status()).__lt((300));
  28815. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28816. }));
  28817. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28818. };
  28819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28820. }));
  28821. $recv(xhr)._send_(aString);
  28822. return self;
  28823. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28824. },
  28825. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28826. 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",
  28827. referencedClasses: ["Platform"],
  28828. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28829. }),
  28830. $globals.PackageHandler);
  28831. $core.addMethod(
  28832. $core.method({
  28833. selector: "chunkContentsFor:",
  28834. protocol: 'accessing',
  28835. fn: function (aPackage){
  28836. var self=this;
  28837. return $core.withContext(function($ctx1) {
  28838. return $recv($globals.String)._streamContents_((function(str){
  28839. return $core.withContext(function($ctx2) {
  28840. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28841. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28842. }));
  28843. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28844. },
  28845. args: ["aPackage"],
  28846. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28847. referencedClasses: ["String"],
  28848. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28849. }),
  28850. $globals.PackageHandler);
  28851. $core.addMethod(
  28852. $core.method({
  28853. selector: "chunkExporter",
  28854. protocol: 'factory',
  28855. fn: function (){
  28856. var self=this;
  28857. return $core.withContext(function($ctx1) {
  28858. return $recv(self._chunkExporterClass())._new();
  28859. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28860. },
  28861. args: [],
  28862. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28863. referencedClasses: [],
  28864. messageSends: ["new", "chunkExporterClass"]
  28865. }),
  28866. $globals.PackageHandler);
  28867. $core.addMethod(
  28868. $core.method({
  28869. selector: "chunkExporterClass",
  28870. protocol: 'accessing',
  28871. fn: function (){
  28872. var self=this;
  28873. return $globals.ChunkExporter;
  28874. },
  28875. args: [],
  28876. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28877. referencedClasses: ["ChunkExporter"],
  28878. messageSends: []
  28879. }),
  28880. $globals.PackageHandler);
  28881. $core.addMethod(
  28882. $core.method({
  28883. selector: "commit:",
  28884. protocol: 'committing',
  28885. fn: function (aPackage){
  28886. var self=this;
  28887. return $core.withContext(function($ctx1) {
  28888. var $1,$2;
  28889. self._commit_onSuccess_onError_(aPackage,(function(){
  28890. }),(function(error){
  28891. return $core.withContext(function($ctx2) {
  28892. $1=$recv($globals.PackageCommitError)._new();
  28893. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28894. $ctx2.sendIdx[","]=1;
  28895. $recv($1)._messageText_($2);
  28896. return $recv($1)._signal();
  28897. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28898. }));
  28899. return self;
  28900. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28901. },
  28902. args: ["aPackage"],
  28903. 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 ]",
  28904. referencedClasses: ["PackageCommitError"],
  28905. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28906. }),
  28907. $globals.PackageHandler);
  28908. $core.addMethod(
  28909. $core.method({
  28910. selector: "commit:onSuccess:onError:",
  28911. protocol: 'committing',
  28912. fn: function (aPackage,aBlock,anotherBlock){
  28913. var self=this;
  28914. return $core.withContext(function($ctx1) {
  28915. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28916. return $core.withContext(function($ctx2) {
  28917. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28918. return $core.withContext(function($ctx3) {
  28919. $recv(aPackage)._beClean();
  28920. return $recv(aBlock)._value();
  28921. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28922. }),anotherBlock);
  28923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28924. }),anotherBlock);
  28925. return self;
  28926. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28927. },
  28928. args: ["aPackage", "aBlock", "anotherBlock"],
  28929. 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",
  28930. referencedClasses: [],
  28931. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28932. }),
  28933. $globals.PackageHandler);
  28934. $core.addMethod(
  28935. $core.method({
  28936. selector: "commitJsFileFor:onSuccess:onError:",
  28937. protocol: 'committing',
  28938. fn: function (aPackage,aBlock,anotherBlock){
  28939. var self=this;
  28940. return $core.withContext(function($ctx1) {
  28941. var $2,$1;
  28942. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28943. $ctx1.sendIdx[","]=2;
  28944. $1=$recv($2).__comma(".js");
  28945. $ctx1.sendIdx[","]=1;
  28946. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28947. return self;
  28948. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28949. },
  28950. args: ["aPackage", "aBlock", "anotherBlock"],
  28951. 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",
  28952. referencedClasses: [],
  28953. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28954. }),
  28955. $globals.PackageHandler);
  28956. $core.addMethod(
  28957. $core.method({
  28958. selector: "commitPathJsFor:",
  28959. protocol: 'accessing',
  28960. fn: function (aPackage){
  28961. var self=this;
  28962. return $core.withContext(function($ctx1) {
  28963. self._subclassResponsibility();
  28964. return self;
  28965. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28966. },
  28967. args: ["aPackage"],
  28968. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28969. referencedClasses: [],
  28970. messageSends: ["subclassResponsibility"]
  28971. }),
  28972. $globals.PackageHandler);
  28973. $core.addMethod(
  28974. $core.method({
  28975. selector: "commitPathStFor:",
  28976. protocol: 'accessing',
  28977. fn: function (aPackage){
  28978. var self=this;
  28979. return $core.withContext(function($ctx1) {
  28980. self._subclassResponsibility();
  28981. return self;
  28982. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28983. },
  28984. args: ["aPackage"],
  28985. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28986. referencedClasses: [],
  28987. messageSends: ["subclassResponsibility"]
  28988. }),
  28989. $globals.PackageHandler);
  28990. $core.addMethod(
  28991. $core.method({
  28992. selector: "commitStFileFor:onSuccess:onError:",
  28993. protocol: 'committing',
  28994. fn: function (aPackage,aBlock,anotherBlock){
  28995. var self=this;
  28996. return $core.withContext(function($ctx1) {
  28997. var $2,$1;
  28998. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28999. $ctx1.sendIdx[","]=2;
  29000. $1=$recv($2).__comma(".st");
  29001. $ctx1.sendIdx[","]=1;
  29002. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  29003. return self;
  29004. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29005. },
  29006. args: ["aPackage", "aBlock", "anotherBlock"],
  29007. 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",
  29008. referencedClasses: [],
  29009. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  29010. }),
  29011. $globals.PackageHandler);
  29012. $core.addMethod(
  29013. $core.method({
  29014. selector: "contentsFor:",
  29015. protocol: 'accessing',
  29016. fn: function (aPackage){
  29017. var self=this;
  29018. return $core.withContext(function($ctx1) {
  29019. return $recv($globals.String)._streamContents_((function(str){
  29020. return $core.withContext(function($ctx2) {
  29021. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  29022. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29023. }));
  29024. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29025. },
  29026. args: ["aPackage"],
  29027. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29028. referencedClasses: ["String"],
  29029. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29030. }),
  29031. $globals.PackageHandler);
  29032. $core.addMethod(
  29033. $core.method({
  29034. selector: "exporter",
  29035. protocol: 'factory',
  29036. fn: function (){
  29037. var self=this;
  29038. return $core.withContext(function($ctx1) {
  29039. return $recv(self._exporterClass())._new();
  29040. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29041. },
  29042. args: [],
  29043. source: "exporter\x0a\x09^ self exporterClass new",
  29044. referencedClasses: [],
  29045. messageSends: ["new", "exporterClass"]
  29046. }),
  29047. $globals.PackageHandler);
  29048. $core.addMethod(
  29049. $core.method({
  29050. selector: "exporterClass",
  29051. protocol: 'accessing',
  29052. fn: function (){
  29053. var self=this;
  29054. return $core.withContext(function($ctx1) {
  29055. self._subclassResponsibility();
  29056. return self;
  29057. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29058. },
  29059. args: [],
  29060. source: "exporterClass\x0a\x09self subclassResponsibility",
  29061. referencedClasses: [],
  29062. messageSends: ["subclassResponsibility"]
  29063. }),
  29064. $globals.PackageHandler);
  29065. $core.addMethod(
  29066. $core.method({
  29067. selector: "load:",
  29068. protocol: 'loading',
  29069. fn: function (aPackage){
  29070. var self=this;
  29071. return $core.withContext(function($ctx1) {
  29072. self._subclassResponsibility();
  29073. return self;
  29074. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29075. },
  29076. args: ["aPackage"],
  29077. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29078. referencedClasses: [],
  29079. messageSends: ["subclassResponsibility"]
  29080. }),
  29081. $globals.PackageHandler);
  29082. $core.addMethod(
  29083. $core.method({
  29084. selector: "onCommitError:",
  29085. protocol: 'error handling',
  29086. fn: function (anError){
  29087. var self=this;
  29088. return $core.withContext(function($ctx1) {
  29089. var $1,$2;
  29090. $1=$recv($globals.PackageCommitError)._new();
  29091. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29092. $ctx1.sendIdx[","]=1;
  29093. $recv($1)._messageText_($2);
  29094. $recv($1)._signal();
  29095. return self;
  29096. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29097. },
  29098. args: ["anError"],
  29099. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29100. referencedClasses: ["PackageCommitError"],
  29101. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29102. }),
  29103. $globals.PackageHandler);
  29104. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29105. $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.";
  29106. $core.addMethod(
  29107. $core.method({
  29108. selector: "commitPathJsFor:",
  29109. protocol: 'accessing',
  29110. fn: function (aPackage){
  29111. var self=this;
  29112. return $core.withContext(function($ctx1) {
  29113. return self._toUrl_(self._namespaceFor_(aPackage));
  29114. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29115. },
  29116. args: ["aPackage"],
  29117. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29118. referencedClasses: [],
  29119. messageSends: ["toUrl:", "namespaceFor:"]
  29120. }),
  29121. $globals.AmdPackageHandler);
  29122. $core.addMethod(
  29123. $core.method({
  29124. selector: "commitPathStFor:",
  29125. protocol: 'accessing',
  29126. fn: function (aPackage){
  29127. var self=this;
  29128. var path,pathWithout;
  29129. return $core.withContext(function($ctx1) {
  29130. var $1,$2;
  29131. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29132. $ctx1.sendIdx[","]=1;
  29133. path=self._toUrl_($1);
  29134. pathWithout=self._commitPathJsFor_(aPackage);
  29135. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29136. if($core.assert($2)){
  29137. return pathWithout;
  29138. } else {
  29139. return path;
  29140. };
  29141. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29142. },
  29143. args: ["aPackage"],
  29144. 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 ]",
  29145. referencedClasses: [],
  29146. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29147. }),
  29148. $globals.AmdPackageHandler);
  29149. $core.addMethod(
  29150. $core.method({
  29151. selector: "exporterClass",
  29152. protocol: 'accessing',
  29153. fn: function (){
  29154. var self=this;
  29155. return $globals.AmdExporter;
  29156. },
  29157. args: [],
  29158. source: "exporterClass\x0a\x09^ AmdExporter",
  29159. referencedClasses: ["AmdExporter"],
  29160. messageSends: []
  29161. }),
  29162. $globals.AmdPackageHandler);
  29163. $core.addMethod(
  29164. $core.method({
  29165. selector: "load:",
  29166. protocol: 'loading',
  29167. fn: function (aPackage){
  29168. var self=this;
  29169. return $core.withContext(function($ctx1) {
  29170. var $1,$3,$2,$receiver;
  29171. $1=$recv($globals.Smalltalk)._amdRequire();
  29172. if(($receiver = $1) == null || $receiver.isNil){
  29173. self._error_("AMD loader not present");
  29174. } else {
  29175. var require;
  29176. require=$receiver;
  29177. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29178. $ctx1.sendIdx[","]=1;
  29179. $2=$recv($globals.Array)._with_($3);
  29180. $recv(require)._value_($2);
  29181. };
  29182. return self;
  29183. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29184. },
  29185. args: ["aPackage"],
  29186. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  29187. referencedClasses: ["Smalltalk", "Array"],
  29188. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29189. }),
  29190. $globals.AmdPackageHandler);
  29191. $core.addMethod(
  29192. $core.method({
  29193. selector: "namespaceFor:",
  29194. protocol: 'committing',
  29195. fn: function (aPackage){
  29196. var self=this;
  29197. return $core.withContext(function($ctx1) {
  29198. return $recv($recv(aPackage)._transport())._namespace();
  29199. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29200. },
  29201. args: ["aPackage"],
  29202. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29203. referencedClasses: [],
  29204. messageSends: ["namespace", "transport"]
  29205. }),
  29206. $globals.AmdPackageHandler);
  29207. $core.addMethod(
  29208. $core.method({
  29209. selector: "toUrl:",
  29210. protocol: 'private',
  29211. fn: function (aString){
  29212. var self=this;
  29213. return $core.withContext(function($ctx1) {
  29214. var $1,$receiver;
  29215. $1=$recv($globals.Smalltalk)._amdRequire();
  29216. if(($receiver = $1) == null || $receiver.isNil){
  29217. return self._error_("AMD loader not present");
  29218. } else {
  29219. var require;
  29220. require=$receiver;
  29221. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29222. };
  29223. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29224. },
  29225. args: ["aString"],
  29226. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  29227. referencedClasses: ["Smalltalk"],
  29228. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29229. }),
  29230. $globals.AmdPackageHandler);
  29231. $core.addMethod(
  29232. $core.method({
  29233. selector: "defaultNamespace",
  29234. protocol: 'commit paths',
  29235. fn: function (){
  29236. var self=this;
  29237. return $core.withContext(function($ctx1) {
  29238. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29239. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29240. },
  29241. args: [],
  29242. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29243. referencedClasses: ["Smalltalk"],
  29244. messageSends: ["defaultAmdNamespace"]
  29245. }),
  29246. $globals.AmdPackageHandler.klass);
  29247. $core.addMethod(
  29248. $core.method({
  29249. selector: "defaultNamespace:",
  29250. protocol: 'commit paths',
  29251. fn: function (aString){
  29252. var self=this;
  29253. return $core.withContext(function($ctx1) {
  29254. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29255. return self;
  29256. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29257. },
  29258. args: ["aString"],
  29259. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29260. referencedClasses: ["Smalltalk"],
  29261. messageSends: ["defaultAmdNamespace:"]
  29262. }),
  29263. $globals.AmdPackageHandler.klass);
  29264. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29265. $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.";
  29266. $core.addMethod(
  29267. $core.method({
  29268. selector: "asJSON",
  29269. protocol: 'converting',
  29270. fn: function (){
  29271. var self=this;
  29272. return $core.withContext(function($ctx1) {
  29273. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29274. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29275. },
  29276. args: [],
  29277. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29278. referencedClasses: [],
  29279. messageSends: ["type"]
  29280. }),
  29281. $globals.PackageTransport);
  29282. $core.addMethod(
  29283. $core.method({
  29284. selector: "commit",
  29285. protocol: 'committing',
  29286. fn: function (){
  29287. var self=this;
  29288. return $core.withContext(function($ctx1) {
  29289. $recv(self._commitHandler())._commit_(self._package());
  29290. return self;
  29291. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29292. },
  29293. args: [],
  29294. source: "commit\x0a\x09self commitHandler commit: self package",
  29295. referencedClasses: [],
  29296. messageSends: ["commit:", "commitHandler", "package"]
  29297. }),
  29298. $globals.PackageTransport);
  29299. $core.addMethod(
  29300. $core.method({
  29301. selector: "commitHandler",
  29302. protocol: 'factory',
  29303. fn: function (){
  29304. var self=this;
  29305. return $core.withContext(function($ctx1) {
  29306. return $recv(self._commitHandlerClass())._new();
  29307. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29308. },
  29309. args: [],
  29310. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29311. referencedClasses: [],
  29312. messageSends: ["new", "commitHandlerClass"]
  29313. }),
  29314. $globals.PackageTransport);
  29315. $core.addMethod(
  29316. $core.method({
  29317. selector: "commitHandlerClass",
  29318. protocol: 'accessing',
  29319. fn: function (){
  29320. var self=this;
  29321. return $core.withContext(function($ctx1) {
  29322. self._subclassResponsibility();
  29323. return self;
  29324. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29325. },
  29326. args: [],
  29327. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29328. referencedClasses: [],
  29329. messageSends: ["subclassResponsibility"]
  29330. }),
  29331. $globals.PackageTransport);
  29332. $core.addMethod(
  29333. $core.method({
  29334. selector: "commitOnSuccess:onError:",
  29335. protocol: 'committing',
  29336. fn: function (aBlock,anotherBlock){
  29337. var self=this;
  29338. return $core.withContext(function($ctx1) {
  29339. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29340. return self;
  29341. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29342. },
  29343. args: ["aBlock", "anotherBlock"],
  29344. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29345. referencedClasses: [],
  29346. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29347. }),
  29348. $globals.PackageTransport);
  29349. $core.addMethod(
  29350. $core.method({
  29351. selector: "definition",
  29352. protocol: 'accessing',
  29353. fn: function (){
  29354. var self=this;
  29355. return "";
  29356. },
  29357. args: [],
  29358. source: "definition\x0a\x09^ ''",
  29359. referencedClasses: [],
  29360. messageSends: []
  29361. }),
  29362. $globals.PackageTransport);
  29363. $core.addMethod(
  29364. $core.method({
  29365. selector: "load",
  29366. protocol: 'loading',
  29367. fn: function (){
  29368. var self=this;
  29369. return $core.withContext(function($ctx1) {
  29370. $recv(self._commitHandler())._load_(self._package());
  29371. return self;
  29372. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29373. },
  29374. args: [],
  29375. source: "load\x0a\x09self commitHandler load: self package",
  29376. referencedClasses: [],
  29377. messageSends: ["load:", "commitHandler", "package"]
  29378. }),
  29379. $globals.PackageTransport);
  29380. $core.addMethod(
  29381. $core.method({
  29382. selector: "package",
  29383. protocol: 'accessing',
  29384. fn: function (){
  29385. var self=this;
  29386. return self["@package"];
  29387. },
  29388. args: [],
  29389. source: "package\x0a\x09^ package",
  29390. referencedClasses: [],
  29391. messageSends: []
  29392. }),
  29393. $globals.PackageTransport);
  29394. $core.addMethod(
  29395. $core.method({
  29396. selector: "package:",
  29397. protocol: 'accessing',
  29398. fn: function (aPackage){
  29399. var self=this;
  29400. self["@package"]=aPackage;
  29401. return self;
  29402. },
  29403. args: ["aPackage"],
  29404. source: "package: aPackage\x0a\x09package := aPackage",
  29405. referencedClasses: [],
  29406. messageSends: []
  29407. }),
  29408. $globals.PackageTransport);
  29409. $core.addMethod(
  29410. $core.method({
  29411. selector: "setupFromJson:",
  29412. protocol: 'initialization',
  29413. fn: function (anObject){
  29414. var self=this;
  29415. return self;
  29416. },
  29417. args: ["anObject"],
  29418. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29419. referencedClasses: [],
  29420. messageSends: []
  29421. }),
  29422. $globals.PackageTransport);
  29423. $core.addMethod(
  29424. $core.method({
  29425. selector: "type",
  29426. protocol: 'accessing',
  29427. fn: function (){
  29428. var self=this;
  29429. return $core.withContext(function($ctx1) {
  29430. return $recv(self._class())._type();
  29431. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29432. },
  29433. args: [],
  29434. source: "type\x0a\x09^ self class type",
  29435. referencedClasses: [],
  29436. messageSends: ["type", "class"]
  29437. }),
  29438. $globals.PackageTransport);
  29439. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29440. $core.addMethod(
  29441. $core.method({
  29442. selector: "classRegisteredFor:",
  29443. protocol: 'accessing',
  29444. fn: function (aString){
  29445. var self=this;
  29446. return $core.withContext(function($ctx1) {
  29447. return $recv(self["@registry"])._at_(aString);
  29448. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29449. },
  29450. args: ["aString"],
  29451. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29452. referencedClasses: [],
  29453. messageSends: ["at:"]
  29454. }),
  29455. $globals.PackageTransport.klass);
  29456. $core.addMethod(
  29457. $core.method({
  29458. selector: "defaultType",
  29459. protocol: 'accessing',
  29460. fn: function (){
  29461. var self=this;
  29462. return $core.withContext(function($ctx1) {
  29463. return $recv($globals.AmdPackageTransport)._type();
  29464. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29465. },
  29466. args: [],
  29467. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29468. referencedClasses: ["AmdPackageTransport"],
  29469. messageSends: ["type"]
  29470. }),
  29471. $globals.PackageTransport.klass);
  29472. $core.addMethod(
  29473. $core.method({
  29474. selector: "for:",
  29475. protocol: 'instance creation',
  29476. fn: function (aString){
  29477. var self=this;
  29478. return $core.withContext(function($ctx1) {
  29479. return $recv(self._classRegisteredFor_(aString))._new();
  29480. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29481. },
  29482. args: ["aString"],
  29483. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29484. referencedClasses: [],
  29485. messageSends: ["new", "classRegisteredFor:"]
  29486. }),
  29487. $globals.PackageTransport.klass);
  29488. $core.addMethod(
  29489. $core.method({
  29490. selector: "fromJson:",
  29491. protocol: 'instance creation',
  29492. fn: function (anObject){
  29493. var self=this;
  29494. return $core.withContext(function($ctx1) {
  29495. var $1,$2,$receiver;
  29496. if(($receiver = anObject) == null || $receiver.isNil){
  29497. $1=self._for_(self._defaultType());
  29498. $ctx1.sendIdx["for:"]=1;
  29499. return $1;
  29500. } else {
  29501. anObject;
  29502. };
  29503. $2=self._for_($recv(anObject)._type());
  29504. $recv($2)._setupFromJson_(anObject);
  29505. return $recv($2)._yourself();
  29506. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29507. },
  29508. args: ["anObject"],
  29509. 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",
  29510. referencedClasses: [],
  29511. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29512. }),
  29513. $globals.PackageTransport.klass);
  29514. $core.addMethod(
  29515. $core.method({
  29516. selector: "initialize",
  29517. protocol: 'initialization',
  29518. fn: function (){
  29519. var self=this;
  29520. return $core.withContext(function($ctx1) {
  29521. var $1;
  29522. (
  29523. $ctx1.supercall = true,
  29524. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  29525. $ctx1.supercall = false;
  29526. $1=self.__eq_eq($globals.PackageTransport);
  29527. if($core.assert($1)){
  29528. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29529. self["@registry"];
  29530. } else {
  29531. self._register();
  29532. };
  29533. return self;
  29534. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29535. },
  29536. args: [],
  29537. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29538. referencedClasses: ["PackageTransport"],
  29539. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29540. }),
  29541. $globals.PackageTransport.klass);
  29542. $core.addMethod(
  29543. $core.method({
  29544. selector: "register",
  29545. protocol: 'registration',
  29546. fn: function (){
  29547. var self=this;
  29548. return $core.withContext(function($ctx1) {
  29549. $recv($globals.PackageTransport)._register_(self);
  29550. return self;
  29551. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29552. },
  29553. args: [],
  29554. source: "register\x0a\x09PackageTransport register: self",
  29555. referencedClasses: ["PackageTransport"],
  29556. messageSends: ["register:"]
  29557. }),
  29558. $globals.PackageTransport.klass);
  29559. $core.addMethod(
  29560. $core.method({
  29561. selector: "register:",
  29562. protocol: 'registration',
  29563. fn: function (aClass){
  29564. var self=this;
  29565. return $core.withContext(function($ctx1) {
  29566. var $1,$receiver;
  29567. $1=$recv(aClass)._type();
  29568. $ctx1.sendIdx["type"]=1;
  29569. if(($receiver = $1) == null || $receiver.isNil){
  29570. $1;
  29571. } else {
  29572. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29573. };
  29574. return self;
  29575. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29576. },
  29577. args: ["aClass"],
  29578. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29579. referencedClasses: [],
  29580. messageSends: ["ifNotNil:", "type", "at:put:"]
  29581. }),
  29582. $globals.PackageTransport.klass);
  29583. $core.addMethod(
  29584. $core.method({
  29585. selector: "type",
  29586. protocol: 'accessing',
  29587. fn: function (){
  29588. var self=this;
  29589. return nil;
  29590. },
  29591. args: [],
  29592. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29593. referencedClasses: [],
  29594. messageSends: []
  29595. }),
  29596. $globals.PackageTransport.klass);
  29597. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29598. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29599. $core.addMethod(
  29600. $core.method({
  29601. selector: "asJSON",
  29602. protocol: 'converting',
  29603. fn: function (){
  29604. var self=this;
  29605. return $core.withContext(function($ctx1) {
  29606. var $1;
  29607. $1=(
  29608. $ctx1.supercall = true,
  29609. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJSON.apply($recv(self), []));
  29610. $ctx1.supercall = false;
  29611. $recv($1)._at_put_("amdNamespace",self._namespace());
  29612. return $recv($1)._yourself();
  29613. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29614. },
  29615. args: [],
  29616. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29617. referencedClasses: [],
  29618. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29619. }),
  29620. $globals.AmdPackageTransport);
  29621. $core.addMethod(
  29622. $core.method({
  29623. selector: "commitHandlerClass",
  29624. protocol: 'accessing',
  29625. fn: function (){
  29626. var self=this;
  29627. return $globals.AmdPackageHandler;
  29628. },
  29629. args: [],
  29630. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29631. referencedClasses: ["AmdPackageHandler"],
  29632. messageSends: []
  29633. }),
  29634. $globals.AmdPackageTransport);
  29635. $core.addMethod(
  29636. $core.method({
  29637. selector: "defaultNamespace",
  29638. protocol: 'defaults',
  29639. fn: function (){
  29640. var self=this;
  29641. return $core.withContext(function($ctx1) {
  29642. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29643. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29644. },
  29645. args: [],
  29646. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29647. referencedClasses: ["Smalltalk"],
  29648. messageSends: ["defaultAmdNamespace"]
  29649. }),
  29650. $globals.AmdPackageTransport);
  29651. $core.addMethod(
  29652. $core.method({
  29653. selector: "definition",
  29654. protocol: 'accessing',
  29655. fn: function (){
  29656. var self=this;
  29657. return $core.withContext(function($ctx1) {
  29658. var $1;
  29659. return $recv($globals.String)._streamContents_((function(stream){
  29660. return $core.withContext(function($ctx2) {
  29661. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29662. $ctx2.sendIdx["nextPutAll:"]=1;
  29663. $recv(stream)._nextPutAll_(" namespace: ");
  29664. $ctx2.sendIdx["nextPutAll:"]=2;
  29665. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29666. $ctx2.sendIdx[","]=1;
  29667. return $recv(stream)._nextPutAll_($1);
  29668. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29669. }));
  29670. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29671. },
  29672. args: [],
  29673. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  29674. referencedClasses: ["String"],
  29675. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29676. }),
  29677. $globals.AmdPackageTransport);
  29678. $core.addMethod(
  29679. $core.method({
  29680. selector: "namespace",
  29681. protocol: 'accessing',
  29682. fn: function (){
  29683. var self=this;
  29684. return $core.withContext(function($ctx1) {
  29685. var $1,$receiver;
  29686. $1=self["@namespace"];
  29687. if(($receiver = $1) == null || $receiver.isNil){
  29688. return self._defaultNamespace();
  29689. } else {
  29690. return $1;
  29691. };
  29692. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29693. },
  29694. args: [],
  29695. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29696. referencedClasses: [],
  29697. messageSends: ["ifNil:", "defaultNamespace"]
  29698. }),
  29699. $globals.AmdPackageTransport);
  29700. $core.addMethod(
  29701. $core.method({
  29702. selector: "namespace:",
  29703. protocol: 'accessing',
  29704. fn: function (aString){
  29705. var self=this;
  29706. self["@namespace"]=aString;
  29707. return self;
  29708. },
  29709. args: ["aString"],
  29710. source: "namespace: aString\x0a\x09namespace := aString",
  29711. referencedClasses: [],
  29712. messageSends: []
  29713. }),
  29714. $globals.AmdPackageTransport);
  29715. $core.addMethod(
  29716. $core.method({
  29717. selector: "printOn:",
  29718. protocol: 'printing',
  29719. fn: function (aStream){
  29720. var self=this;
  29721. return $core.withContext(function($ctx1) {
  29722. (
  29723. $ctx1.supercall = true,
  29724. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29725. $ctx1.supercall = false;
  29726. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29727. $ctx1.sendIdx["nextPutAll:"]=1;
  29728. $recv(aStream)._nextPutAll_(self._namespace());
  29729. $ctx1.sendIdx["nextPutAll:"]=2;
  29730. $recv(aStream)._nextPutAll_(")");
  29731. return self;
  29732. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29733. },
  29734. args: ["aStream"],
  29735. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29736. referencedClasses: [],
  29737. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29738. }),
  29739. $globals.AmdPackageTransport);
  29740. $core.addMethod(
  29741. $core.method({
  29742. selector: "setPath:",
  29743. protocol: 'actions',
  29744. fn: function (aString){
  29745. var self=this;
  29746. return $core.withContext(function($ctx1) {
  29747. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29748. return self;
  29749. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29750. },
  29751. args: ["aString"],
  29752. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  29753. referencedClasses: [],
  29754. messageSends: ["value:", "basicAt:", "namespace"]
  29755. }),
  29756. $globals.AmdPackageTransport);
  29757. $core.addMethod(
  29758. $core.method({
  29759. selector: "setupFromJson:",
  29760. protocol: 'initialization',
  29761. fn: function (anObject){
  29762. var self=this;
  29763. return $core.withContext(function($ctx1) {
  29764. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29765. return self;
  29766. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29767. },
  29768. args: ["anObject"],
  29769. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29770. referencedClasses: [],
  29771. messageSends: ["namespace:", "at:"]
  29772. }),
  29773. $globals.AmdPackageTransport);
  29774. $core.addMethod(
  29775. $core.method({
  29776. selector: "namespace:",
  29777. protocol: 'instance creation',
  29778. fn: function (aString){
  29779. var self=this;
  29780. return $core.withContext(function($ctx1) {
  29781. var $1;
  29782. $1=self._new();
  29783. $recv($1)._namespace_(aString);
  29784. return $recv($1)._yourself();
  29785. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29786. },
  29787. args: ["aString"],
  29788. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29789. referencedClasses: [],
  29790. messageSends: ["namespace:", "new", "yourself"]
  29791. }),
  29792. $globals.AmdPackageTransport.klass);
  29793. $core.addMethod(
  29794. $core.method({
  29795. selector: "type",
  29796. protocol: 'accessing',
  29797. fn: function (){
  29798. var self=this;
  29799. return "amd";
  29800. },
  29801. args: [],
  29802. source: "type\x0a\x09^ 'amd'",
  29803. referencedClasses: [],
  29804. messageSends: []
  29805. }),
  29806. $globals.AmdPackageTransport.klass);
  29807. $core.addMethod(
  29808. $core.method({
  29809. selector: "commentStamp",
  29810. protocol: '*Platform-ImportExport',
  29811. fn: function (){
  29812. var self=this;
  29813. return $core.withContext(function($ctx1) {
  29814. var $1;
  29815. $1=$recv($globals.ClassCommentReader)._new();
  29816. $recv($1)._class_(self);
  29817. return $recv($1)._yourself();
  29818. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29819. },
  29820. args: [],
  29821. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29822. referencedClasses: ["ClassCommentReader"],
  29823. messageSends: ["class:", "new", "yourself"]
  29824. }),
  29825. $globals.Behavior);
  29826. $core.addMethod(
  29827. $core.method({
  29828. selector: "commentStamp:prior:",
  29829. protocol: '*Platform-ImportExport',
  29830. fn: function (aStamp,prior){
  29831. var self=this;
  29832. return $core.withContext(function($ctx1) {
  29833. return self._commentStamp();
  29834. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29835. },
  29836. args: ["aStamp", "prior"],
  29837. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29838. referencedClasses: [],
  29839. messageSends: ["commentStamp"]
  29840. }),
  29841. $globals.Behavior);
  29842. $core.addMethod(
  29843. $core.method({
  29844. selector: "methodsFor:",
  29845. protocol: '*Platform-ImportExport',
  29846. fn: function (aString){
  29847. var self=this;
  29848. return $core.withContext(function($ctx1) {
  29849. var $1;
  29850. $1=$recv($globals.ClassProtocolReader)._new();
  29851. $recv($1)._class_category_(self,aString);
  29852. return $recv($1)._yourself();
  29853. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29854. },
  29855. args: ["aString"],
  29856. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29857. referencedClasses: ["ClassProtocolReader"],
  29858. messageSends: ["class:category:", "new", "yourself"]
  29859. }),
  29860. $globals.Behavior);
  29861. $core.addMethod(
  29862. $core.method({
  29863. selector: "methodsFor:stamp:",
  29864. protocol: '*Platform-ImportExport',
  29865. fn: function (aString,aStamp){
  29866. var self=this;
  29867. return $core.withContext(function($ctx1) {
  29868. return self._methodsFor_(aString);
  29869. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29870. },
  29871. args: ["aString", "aStamp"],
  29872. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29873. referencedClasses: [],
  29874. messageSends: ["methodsFor:"]
  29875. }),
  29876. $globals.Behavior);
  29877. $core.addMethod(
  29878. $core.method({
  29879. selector: "commit",
  29880. protocol: '*Platform-ImportExport',
  29881. fn: function (){
  29882. var self=this;
  29883. return $core.withContext(function($ctx1) {
  29884. return $recv(self._transport())._commit();
  29885. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29886. },
  29887. args: [],
  29888. source: "commit\x0a\x09^ self transport commit",
  29889. referencedClasses: [],
  29890. messageSends: ["commit", "transport"]
  29891. }),
  29892. $globals.Package);
  29893. $core.addMethod(
  29894. $core.method({
  29895. selector: "load",
  29896. protocol: '*Platform-ImportExport',
  29897. fn: function (){
  29898. var self=this;
  29899. return $core.withContext(function($ctx1) {
  29900. return $recv(self._transport())._load();
  29901. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29902. },
  29903. args: [],
  29904. source: "load\x0a\x09^ self transport load",
  29905. referencedClasses: [],
  29906. messageSends: ["load", "transport"]
  29907. }),
  29908. $globals.Package);
  29909. $core.addMethod(
  29910. $core.method({
  29911. selector: "loadFromNamespace:",
  29912. protocol: '*Platform-ImportExport',
  29913. fn: function (aString){
  29914. var self=this;
  29915. return $core.withContext(function($ctx1) {
  29916. var $1;
  29917. $1=self._transport();
  29918. $recv($1)._namespace_(aString);
  29919. return $recv($1)._load();
  29920. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29921. },
  29922. args: ["aString"],
  29923. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29924. referencedClasses: [],
  29925. messageSends: ["namespace:", "transport", "load"]
  29926. }),
  29927. $globals.Package);
  29928. $core.addMethod(
  29929. $core.method({
  29930. selector: "load:",
  29931. protocol: '*Platform-ImportExport',
  29932. fn: function (aPackageName){
  29933. var self=this;
  29934. return $core.withContext(function($ctx1) {
  29935. $recv(self._named_(aPackageName))._load();
  29936. return self;
  29937. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29938. },
  29939. args: ["aPackageName"],
  29940. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29941. referencedClasses: [],
  29942. messageSends: ["load", "named:"]
  29943. }),
  29944. $globals.Package.klass);
  29945. $core.addMethod(
  29946. $core.method({
  29947. selector: "load:fromNamespace:",
  29948. protocol: '*Platform-ImportExport',
  29949. fn: function (aPackageName,aString){
  29950. var self=this;
  29951. return $core.withContext(function($ctx1) {
  29952. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29953. return self;
  29954. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29955. },
  29956. args: ["aPackageName", "aString"],
  29957. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29958. referencedClasses: [],
  29959. messageSends: ["loadFromNamespace:", "named:"]
  29960. }),
  29961. $globals.Package.klass);
  29962. });
  29963. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  29964. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29965. $core.addPackage('Compiler-Core');
  29966. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  29967. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29968. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  29969. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  29970. $core.addMethod(
  29971. $core.method({
  29972. selector: "compileNode:",
  29973. protocol: 'compiling',
  29974. fn: function (aNode){
  29975. var self=this;
  29976. return $core.withContext(function($ctx1) {
  29977. self._subclassResponsibility();
  29978. return self;
  29979. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  29980. },
  29981. args: ["aNode"],
  29982. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  29983. referencedClasses: [],
  29984. messageSends: ["subclassResponsibility"]
  29985. }),
  29986. $globals.AbstractCodeGenerator);
  29987. $core.addMethod(
  29988. $core.method({
  29989. selector: "currentClass",
  29990. protocol: 'accessing',
  29991. fn: function (){
  29992. var self=this;
  29993. return self["@currentClass"];
  29994. },
  29995. args: [],
  29996. source: "currentClass\x0a\x09^ currentClass",
  29997. referencedClasses: [],
  29998. messageSends: []
  29999. }),
  30000. $globals.AbstractCodeGenerator);
  30001. $core.addMethod(
  30002. $core.method({
  30003. selector: "currentClass:",
  30004. protocol: 'accessing',
  30005. fn: function (aClass){
  30006. var self=this;
  30007. self["@currentClass"]=aClass;
  30008. return self;
  30009. },
  30010. args: ["aClass"],
  30011. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30012. referencedClasses: [],
  30013. messageSends: []
  30014. }),
  30015. $globals.AbstractCodeGenerator);
  30016. $core.addMethod(
  30017. $core.method({
  30018. selector: "currentPackage",
  30019. protocol: 'accessing',
  30020. fn: function (){
  30021. var self=this;
  30022. return self["@currentPackage"];
  30023. },
  30024. args: [],
  30025. source: "currentPackage\x0a\x09^ currentPackage",
  30026. referencedClasses: [],
  30027. messageSends: []
  30028. }),
  30029. $globals.AbstractCodeGenerator);
  30030. $core.addMethod(
  30031. $core.method({
  30032. selector: "currentPackage:",
  30033. protocol: 'accessing',
  30034. fn: function (anObject){
  30035. var self=this;
  30036. self["@currentPackage"]=anObject;
  30037. return self;
  30038. },
  30039. args: ["anObject"],
  30040. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30041. referencedClasses: [],
  30042. messageSends: []
  30043. }),
  30044. $globals.AbstractCodeGenerator);
  30045. $core.addMethod(
  30046. $core.method({
  30047. selector: "pseudoVariables",
  30048. protocol: 'accessing',
  30049. fn: function (){
  30050. var self=this;
  30051. return $core.withContext(function($ctx1) {
  30052. return $recv($globals.Smalltalk)._pseudoVariableNames();
  30053. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30054. },
  30055. args: [],
  30056. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30057. referencedClasses: ["Smalltalk"],
  30058. messageSends: ["pseudoVariableNames"]
  30059. }),
  30060. $globals.AbstractCodeGenerator);
  30061. $core.addMethod(
  30062. $core.method({
  30063. selector: "source",
  30064. protocol: 'accessing',
  30065. fn: function (){
  30066. var self=this;
  30067. return $core.withContext(function($ctx1) {
  30068. var $1,$receiver;
  30069. $1=self["@source"];
  30070. if(($receiver = $1) == null || $receiver.isNil){
  30071. return "";
  30072. } else {
  30073. return $1;
  30074. };
  30075. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30076. },
  30077. args: [],
  30078. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30079. referencedClasses: [],
  30080. messageSends: ["ifNil:"]
  30081. }),
  30082. $globals.AbstractCodeGenerator);
  30083. $core.addMethod(
  30084. $core.method({
  30085. selector: "source:",
  30086. protocol: 'accessing',
  30087. fn: function (aString){
  30088. var self=this;
  30089. self["@source"]=aString;
  30090. return self;
  30091. },
  30092. args: ["aString"],
  30093. source: "source: aString\x0a\x09source := aString",
  30094. referencedClasses: [],
  30095. messageSends: []
  30096. }),
  30097. $globals.AbstractCodeGenerator);
  30098. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30099. $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.";
  30100. $core.addMethod(
  30101. $core.method({
  30102. selector: "compileNode:",
  30103. protocol: 'compiling',
  30104. fn: function (aNode){
  30105. var self=this;
  30106. var ir,stream;
  30107. return $core.withContext(function($ctx1) {
  30108. var $1;
  30109. $recv(self._semanticAnalyzer())._visit_(aNode);
  30110. $ctx1.sendIdx["visit:"]=1;
  30111. ir=$recv(self._translator())._visit_(aNode);
  30112. $ctx1.sendIdx["visit:"]=2;
  30113. $1=self._irTranslator();
  30114. $recv($1)._currentClass_(self._currentClass());
  30115. $recv($1)._visit_(ir);
  30116. return $recv($1)._contents();
  30117. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30118. },
  30119. args: ["aNode"],
  30120. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  30121. referencedClasses: [],
  30122. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30123. }),
  30124. $globals.CodeGenerator);
  30125. $core.addMethod(
  30126. $core.method({
  30127. selector: "irTranslator",
  30128. protocol: 'compiling',
  30129. fn: function (){
  30130. var self=this;
  30131. return $core.withContext(function($ctx1) {
  30132. return $recv($globals.IRJSTranslator)._new();
  30133. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30134. },
  30135. args: [],
  30136. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30137. referencedClasses: ["IRJSTranslator"],
  30138. messageSends: ["new"]
  30139. }),
  30140. $globals.CodeGenerator);
  30141. $core.addMethod(
  30142. $core.method({
  30143. selector: "semanticAnalyzer",
  30144. protocol: 'compiling',
  30145. fn: function (){
  30146. var self=this;
  30147. return $core.withContext(function($ctx1) {
  30148. var $1;
  30149. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  30150. $recv($1)._thePackage_(self._currentPackage());
  30151. return $recv($1)._yourself();
  30152. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30153. },
  30154. args: [],
  30155. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30156. referencedClasses: ["SemanticAnalyzer"],
  30157. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30158. }),
  30159. $globals.CodeGenerator);
  30160. $core.addMethod(
  30161. $core.method({
  30162. selector: "translator",
  30163. protocol: 'compiling',
  30164. fn: function (){
  30165. var self=this;
  30166. return $core.withContext(function($ctx1) {
  30167. var $1;
  30168. $1=$recv($globals.IRASTTranslator)._new();
  30169. $recv($1)._source_(self._source());
  30170. $recv($1)._theClass_(self._currentClass());
  30171. return $recv($1)._yourself();
  30172. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30173. },
  30174. args: [],
  30175. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30176. referencedClasses: ["IRASTTranslator"],
  30177. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30178. }),
  30179. $globals.CodeGenerator);
  30180. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30181. $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`";
  30182. $core.addMethod(
  30183. $core.method({
  30184. selector: "codeGeneratorClass",
  30185. protocol: 'accessing',
  30186. fn: function (){
  30187. var self=this;
  30188. return $core.withContext(function($ctx1) {
  30189. var $1,$receiver;
  30190. $1=self["@codeGeneratorClass"];
  30191. if(($receiver = $1) == null || $receiver.isNil){
  30192. return $globals.InliningCodeGenerator;
  30193. } else {
  30194. return $1;
  30195. };
  30196. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30197. },
  30198. args: [],
  30199. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30200. referencedClasses: ["InliningCodeGenerator"],
  30201. messageSends: ["ifNil:"]
  30202. }),
  30203. $globals.Compiler);
  30204. $core.addMethod(
  30205. $core.method({
  30206. selector: "codeGeneratorClass:",
  30207. protocol: 'accessing',
  30208. fn: function (aClass){
  30209. var self=this;
  30210. self["@codeGeneratorClass"]=aClass;
  30211. return self;
  30212. },
  30213. args: ["aClass"],
  30214. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30215. referencedClasses: [],
  30216. messageSends: []
  30217. }),
  30218. $globals.Compiler);
  30219. $core.addMethod(
  30220. $core.method({
  30221. selector: "compile:forClass:protocol:",
  30222. protocol: 'compiling',
  30223. fn: function (aString,aClass,anotherString){
  30224. var self=this;
  30225. return $core.withContext(function($ctx1) {
  30226. self._source_(aString);
  30227. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30228. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30229. },
  30230. args: ["aString", "aClass", "anotherString"],
  30231. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  30232. referencedClasses: [],
  30233. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30234. }),
  30235. $globals.Compiler);
  30236. $core.addMethod(
  30237. $core.method({
  30238. selector: "compileExpression:on:",
  30239. protocol: 'compiling',
  30240. fn: function (aString,anObject){
  30241. var self=this;
  30242. return $core.withContext(function($ctx1) {
  30243. var $1;
  30244. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30245. $ctx1.sendIdx[","]=1;
  30246. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30247. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30248. },
  30249. args: ["aString", "anObject"],
  30250. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30251. referencedClasses: [],
  30252. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30253. }),
  30254. $globals.Compiler);
  30255. $core.addMethod(
  30256. $core.method({
  30257. selector: "compileNode:",
  30258. protocol: 'compiling',
  30259. fn: function (aNode){
  30260. var self=this;
  30261. var generator,result;
  30262. return $core.withContext(function($ctx1) {
  30263. var $1;
  30264. generator=$recv(self._codeGeneratorClass())._new();
  30265. $1=generator;
  30266. $recv($1)._source_(self._source());
  30267. $recv($1)._currentClass_(self._currentClass());
  30268. $recv($1)._currentPackage_(self._currentPackage());
  30269. result=$recv(generator)._compileNode_(aNode);
  30270. self._unknownVariables_([]);
  30271. return result;
  30272. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30273. },
  30274. args: ["aNode"],
  30275. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  30276. referencedClasses: [],
  30277. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30278. }),
  30279. $globals.Compiler);
  30280. $core.addMethod(
  30281. $core.method({
  30282. selector: "compileNode:forClass:package:",
  30283. protocol: 'compiling',
  30284. fn: function (aNode,aClass,aPackage){
  30285. var self=this;
  30286. return $core.withContext(function($ctx1) {
  30287. self._currentClass_(aClass);
  30288. self._currentPackage_(aPackage);
  30289. return self._compileNode_(aNode);
  30290. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30291. },
  30292. args: ["aNode", "aClass", "aPackage"],
  30293. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30294. referencedClasses: [],
  30295. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30296. }),
  30297. $globals.Compiler);
  30298. $core.addMethod(
  30299. $core.method({
  30300. selector: "currentClass",
  30301. protocol: 'accessing',
  30302. fn: function (){
  30303. var self=this;
  30304. return self["@currentClass"];
  30305. },
  30306. args: [],
  30307. source: "currentClass\x0a\x09^ currentClass",
  30308. referencedClasses: [],
  30309. messageSends: []
  30310. }),
  30311. $globals.Compiler);
  30312. $core.addMethod(
  30313. $core.method({
  30314. selector: "currentClass:",
  30315. protocol: 'accessing',
  30316. fn: function (aClass){
  30317. var self=this;
  30318. self["@currentClass"]=aClass;
  30319. return self;
  30320. },
  30321. args: ["aClass"],
  30322. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30323. referencedClasses: [],
  30324. messageSends: []
  30325. }),
  30326. $globals.Compiler);
  30327. $core.addMethod(
  30328. $core.method({
  30329. selector: "currentPackage",
  30330. protocol: 'accessing',
  30331. fn: function (){
  30332. var self=this;
  30333. return self["@currentPackage"];
  30334. },
  30335. args: [],
  30336. source: "currentPackage\x0a\x09^ currentPackage",
  30337. referencedClasses: [],
  30338. messageSends: []
  30339. }),
  30340. $globals.Compiler);
  30341. $core.addMethod(
  30342. $core.method({
  30343. selector: "currentPackage:",
  30344. protocol: 'accessing',
  30345. fn: function (anObject){
  30346. var self=this;
  30347. self["@currentPackage"]=anObject;
  30348. return self;
  30349. },
  30350. args: ["anObject"],
  30351. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30352. referencedClasses: [],
  30353. messageSends: []
  30354. }),
  30355. $globals.Compiler);
  30356. $core.addMethod(
  30357. $core.method({
  30358. selector: "eval:",
  30359. protocol: 'compiling',
  30360. fn: function (aString){
  30361. var self=this;
  30362. return $core.withContext(function($ctx1) {
  30363. return eval(aString);
  30364. return self;
  30365. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30366. },
  30367. args: ["aString"],
  30368. source: "eval: aString\x0a\x09<return eval(aString)>",
  30369. referencedClasses: [],
  30370. messageSends: []
  30371. }),
  30372. $globals.Compiler);
  30373. $core.addMethod(
  30374. $core.method({
  30375. selector: "eval:forPackage:",
  30376. protocol: 'compiling',
  30377. fn: function (aString,aPackage){
  30378. var self=this;
  30379. return $core.withContext(function($ctx1) {
  30380. return aPackage && aPackage.innerEval
  30381. ? aPackage.innerEval(aString)
  30382. : eval(aString);
  30383. return self;
  30384. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30385. },
  30386. args: ["aString", "aPackage"],
  30387. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30388. referencedClasses: [],
  30389. messageSends: []
  30390. }),
  30391. $globals.Compiler);
  30392. $core.addMethod(
  30393. $core.method({
  30394. selector: "evaluateExpression:",
  30395. protocol: 'compiling',
  30396. fn: function (aString){
  30397. var self=this;
  30398. return $core.withContext(function($ctx1) {
  30399. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30400. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30401. },
  30402. args: ["aString"],
  30403. 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",
  30404. referencedClasses: ["DoIt"],
  30405. messageSends: ["evaluateExpression:on:", "new"]
  30406. }),
  30407. $globals.Compiler);
  30408. $core.addMethod(
  30409. $core.method({
  30410. selector: "evaluateExpression:on:",
  30411. protocol: 'compiling',
  30412. fn: function (aString,anObject){
  30413. var self=this;
  30414. var result,method;
  30415. return $core.withContext(function($ctx1) {
  30416. var $1;
  30417. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30418. $recv(method)._protocol_("**xxxDoIt");
  30419. $1=$recv(anObject)._class();
  30420. $ctx1.sendIdx["class"]=1;
  30421. $recv($1)._addCompiledMethod_(method);
  30422. result=$recv(anObject)._xxxDoIt();
  30423. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30424. return result;
  30425. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30426. },
  30427. args: ["aString", "anObject"],
  30428. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  30429. referencedClasses: [],
  30430. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30431. }),
  30432. $globals.Compiler);
  30433. $core.addMethod(
  30434. $core.method({
  30435. selector: "install:forClass:protocol:",
  30436. protocol: 'compiling',
  30437. fn: function (aString,aBehavior,anotherString){
  30438. var self=this;
  30439. var compiledMethod;
  30440. return $core.withContext(function($ctx1) {
  30441. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30442. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30443. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30444. },
  30445. args: ["aString", "aBehavior", "anotherString"],
  30446. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  30447. referencedClasses: ["ClassBuilder"],
  30448. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30449. }),
  30450. $globals.Compiler);
  30451. $core.addMethod(
  30452. $core.method({
  30453. selector: "parse:",
  30454. protocol: 'compiling',
  30455. fn: function (aString){
  30456. var self=this;
  30457. return $core.withContext(function($ctx1) {
  30458. return $recv($globals.Smalltalk)._parse_(aString);
  30459. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30460. },
  30461. args: ["aString"],
  30462. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30463. referencedClasses: ["Smalltalk"],
  30464. messageSends: ["parse:"]
  30465. }),
  30466. $globals.Compiler);
  30467. $core.addMethod(
  30468. $core.method({
  30469. selector: "parseExpression:",
  30470. protocol: 'compiling',
  30471. fn: function (aString){
  30472. var self=this;
  30473. return $core.withContext(function($ctx1) {
  30474. var $1;
  30475. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30476. $ctx1.sendIdx[","]=1;
  30477. return self._parse_($1);
  30478. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30479. },
  30480. args: ["aString"],
  30481. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30482. referencedClasses: [],
  30483. messageSends: ["parse:", ","]
  30484. }),
  30485. $globals.Compiler);
  30486. $core.addMethod(
  30487. $core.method({
  30488. selector: "recompile:",
  30489. protocol: 'compiling',
  30490. fn: function (aClass){
  30491. var self=this;
  30492. return $core.withContext(function($ctx1) {
  30493. var $1;
  30494. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30495. return $core.withContext(function($ctx2) {
  30496. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30498. }),"Recompiling ".__comma($recv(aClass)._name()));
  30499. $1=$recv(aClass)._isMetaclass();
  30500. if(!$core.assert($1)){
  30501. self._recompile_($recv(aClass)._class());
  30502. };
  30503. return self;
  30504. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30505. },
  30506. args: ["aClass"],
  30507. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  30508. referencedClasses: [],
  30509. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30510. }),
  30511. $globals.Compiler);
  30512. $core.addMethod(
  30513. $core.method({
  30514. selector: "recompileAll",
  30515. protocol: 'compiling',
  30516. fn: function (){
  30517. var self=this;
  30518. return $core.withContext(function($ctx1) {
  30519. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30520. return $core.withContext(function($ctx2) {
  30521. return self._recompile_(each);
  30522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30523. }),"Compiling all classes...");
  30524. return self;
  30525. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30526. },
  30527. args: [],
  30528. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30529. referencedClasses: ["Smalltalk"],
  30530. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30531. }),
  30532. $globals.Compiler);
  30533. $core.addMethod(
  30534. $core.method({
  30535. selector: "source",
  30536. protocol: 'accessing',
  30537. fn: function (){
  30538. var self=this;
  30539. return $core.withContext(function($ctx1) {
  30540. var $1,$receiver;
  30541. $1=self["@source"];
  30542. if(($receiver = $1) == null || $receiver.isNil){
  30543. return "";
  30544. } else {
  30545. return $1;
  30546. };
  30547. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30548. },
  30549. args: [],
  30550. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30551. referencedClasses: [],
  30552. messageSends: ["ifNil:"]
  30553. }),
  30554. $globals.Compiler);
  30555. $core.addMethod(
  30556. $core.method({
  30557. selector: "source:",
  30558. protocol: 'accessing',
  30559. fn: function (aString){
  30560. var self=this;
  30561. self["@source"]=aString;
  30562. return self;
  30563. },
  30564. args: ["aString"],
  30565. source: "source: aString\x0a\x09source := aString",
  30566. referencedClasses: [],
  30567. messageSends: []
  30568. }),
  30569. $globals.Compiler);
  30570. $core.addMethod(
  30571. $core.method({
  30572. selector: "unknownVariables",
  30573. protocol: 'accessing',
  30574. fn: function (){
  30575. var self=this;
  30576. return self["@unknownVariables"];
  30577. },
  30578. args: [],
  30579. source: "unknownVariables\x0a\x09^ unknownVariables",
  30580. referencedClasses: [],
  30581. messageSends: []
  30582. }),
  30583. $globals.Compiler);
  30584. $core.addMethod(
  30585. $core.method({
  30586. selector: "unknownVariables:",
  30587. protocol: 'accessing',
  30588. fn: function (aCollection){
  30589. var self=this;
  30590. self["@unknownVariables"]=aCollection;
  30591. return self;
  30592. },
  30593. args: ["aCollection"],
  30594. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30595. referencedClasses: [],
  30596. messageSends: []
  30597. }),
  30598. $globals.Compiler);
  30599. $core.addMethod(
  30600. $core.method({
  30601. selector: "recompile:",
  30602. protocol: 'compiling',
  30603. fn: function (aClass){
  30604. var self=this;
  30605. return $core.withContext(function($ctx1) {
  30606. $recv(self._new())._recompile_(aClass);
  30607. return self;
  30608. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30609. },
  30610. args: ["aClass"],
  30611. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30612. referencedClasses: [],
  30613. messageSends: ["recompile:", "new"]
  30614. }),
  30615. $globals.Compiler.klass);
  30616. $core.addMethod(
  30617. $core.method({
  30618. selector: "recompileAll",
  30619. protocol: 'compiling',
  30620. fn: function (){
  30621. var self=this;
  30622. return $core.withContext(function($ctx1) {
  30623. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30624. return $core.withContext(function($ctx2) {
  30625. return self._recompile_(each);
  30626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30627. }));
  30628. return self;
  30629. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30630. },
  30631. args: [],
  30632. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30633. referencedClasses: ["Smalltalk"],
  30634. messageSends: ["do:", "classes", "recompile:"]
  30635. }),
  30636. $globals.Compiler.klass);
  30637. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30638. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30639. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30640. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30641. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30642. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30643. $core.addMethod(
  30644. $core.method({
  30645. selector: "evaluate:context:",
  30646. protocol: 'evaluating',
  30647. fn: function (aString,aContext){
  30648. var self=this;
  30649. var compiler,ast;
  30650. return $core.withContext(function($ctx1) {
  30651. var $1;
  30652. var $early={};
  30653. try {
  30654. compiler=$recv($globals.Compiler)._new();
  30655. $recv((function(){
  30656. return $core.withContext(function($ctx2) {
  30657. ast=$recv(compiler)._parseExpression_(aString);
  30658. return ast;
  30659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30660. }))._on_do_($globals.Error,(function(ex){
  30661. return $core.withContext(function($ctx2) {
  30662. throw $early=[self._alert_($recv(ex)._messageText())];
  30663. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30664. }));
  30665. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30666. $recv($1)._context_(aContext);
  30667. $recv($1)._visit_(ast);
  30668. return $recv(aContext)._evaluateNode_(ast);
  30669. }
  30670. catch(e) {if(e===$early)return e[0]; throw e}
  30671. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30672. },
  30673. args: ["aString", "aContext"],
  30674. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  30675. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30676. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30677. }),
  30678. $globals.Evaluator);
  30679. $core.addMethod(
  30680. $core.method({
  30681. selector: "evaluate:for:",
  30682. protocol: 'evaluating',
  30683. fn: function (aString,anObject){
  30684. var self=this;
  30685. return $core.withContext(function($ctx1) {
  30686. return $recv(anObject)._evaluate_on_(aString,self);
  30687. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30688. },
  30689. args: ["aString", "anObject"],
  30690. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30691. referencedClasses: [],
  30692. messageSends: ["evaluate:on:"]
  30693. }),
  30694. $globals.Evaluator);
  30695. $core.addMethod(
  30696. $core.method({
  30697. selector: "evaluate:receiver:",
  30698. protocol: 'evaluating',
  30699. fn: function (aString,anObject){
  30700. var self=this;
  30701. var compiler;
  30702. return $core.withContext(function($ctx1) {
  30703. var $early={};
  30704. try {
  30705. compiler=$recv($globals.Compiler)._new();
  30706. $recv((function(){
  30707. return $core.withContext(function($ctx2) {
  30708. return $recv(compiler)._parseExpression_(aString);
  30709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30710. }))._on_do_($globals.Error,(function(ex){
  30711. return $core.withContext(function($ctx2) {
  30712. throw $early=[self._alert_($recv(ex)._messageText())];
  30713. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30714. }));
  30715. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30716. }
  30717. catch(e) {if(e===$early)return e[0]; throw e}
  30718. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30719. },
  30720. args: ["aString", "anObject"],
  30721. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  30722. referencedClasses: ["Compiler", "Error"],
  30723. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30724. }),
  30725. $globals.Evaluator);
  30726. $core.addMethod(
  30727. $core.method({
  30728. selector: "evaluate:for:",
  30729. protocol: 'instance creation',
  30730. fn: function (aString,anObject){
  30731. var self=this;
  30732. return $core.withContext(function($ctx1) {
  30733. return $recv(self._new())._evaluate_for_(aString,anObject);
  30734. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30735. },
  30736. args: ["aString", "anObject"],
  30737. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30738. referencedClasses: [],
  30739. messageSends: ["evaluate:for:", "new"]
  30740. }),
  30741. $globals.Evaluator.klass);
  30742. $core.addMethod(
  30743. $core.method({
  30744. selector: "asVariableName",
  30745. protocol: '*Compiler-Core',
  30746. fn: function (){
  30747. var self=this;
  30748. return $core.withContext(function($ctx1) {
  30749. var $1;
  30750. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  30751. if($core.assert($1)){
  30752. return self.__comma("_");
  30753. } else {
  30754. return self;
  30755. };
  30756. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  30757. },
  30758. args: [],
  30759. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  30760. referencedClasses: ["Smalltalk"],
  30761. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  30762. }),
  30763. $globals.String);
  30764. });
  30765. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  30766. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30767. $core.addPackage('Compiler-AST');
  30768. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  30769. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30770. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  30771. $globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  30772. $core.addMethod(
  30773. $core.method({
  30774. selector: "accept:",
  30775. protocol: 'visiting',
  30776. fn: function (aVisitor){
  30777. var self=this;
  30778. return $core.withContext(function($ctx1) {
  30779. return $recv(aVisitor)._visitNode_(self);
  30780. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30781. },
  30782. args: ["aVisitor"],
  30783. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30784. referencedClasses: [],
  30785. messageSends: ["visitNode:"]
  30786. }),
  30787. $globals.Node);
  30788. $core.addMethod(
  30789. $core.method({
  30790. selector: "addNode:",
  30791. protocol: 'accessing',
  30792. fn: function (aNode){
  30793. var self=this;
  30794. return $core.withContext(function($ctx1) {
  30795. $recv(self._nodes())._add_(aNode);
  30796. $recv(aNode)._parent_(self);
  30797. return self;
  30798. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30799. },
  30800. args: ["aNode"],
  30801. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30802. referencedClasses: [],
  30803. messageSends: ["add:", "nodes", "parent:"]
  30804. }),
  30805. $globals.Node);
  30806. $core.addMethod(
  30807. $core.method({
  30808. selector: "allNodes",
  30809. protocol: 'accessing',
  30810. fn: function (){
  30811. var self=this;
  30812. var allNodes;
  30813. return $core.withContext(function($ctx1) {
  30814. var $1;
  30815. $1=self._nodes();
  30816. $ctx1.sendIdx["nodes"]=1;
  30817. allNodes=$recv($1)._asSet();
  30818. $recv(self._nodes())._do_((function(each){
  30819. return $core.withContext(function($ctx2) {
  30820. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  30821. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30822. }));
  30823. return allNodes;
  30824. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  30825. },
  30826. args: [],
  30827. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  30828. referencedClasses: [],
  30829. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  30830. }),
  30831. $globals.Node);
  30832. $core.addMethod(
  30833. $core.method({
  30834. selector: "inPosition:",
  30835. protocol: 'testing',
  30836. fn: function (aPoint){
  30837. var self=this;
  30838. return $core.withContext(function($ctx1) {
  30839. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  30840. return $core.withContext(function($ctx2) {
  30841. return $recv(self._positionEnd()).__gt_eq(aPoint);
  30842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30843. }));
  30844. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  30845. },
  30846. args: ["aPoint"],
  30847. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  30848. referencedClasses: [],
  30849. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  30850. }),
  30851. $globals.Node);
  30852. $core.addMethod(
  30853. $core.method({
  30854. selector: "isAssignmentNode",
  30855. protocol: 'testing',
  30856. fn: function (){
  30857. var self=this;
  30858. return false;
  30859. },
  30860. args: [],
  30861. source: "isAssignmentNode\x0a\x09^ false",
  30862. referencedClasses: [],
  30863. messageSends: []
  30864. }),
  30865. $globals.Node);
  30866. $core.addMethod(
  30867. $core.method({
  30868. selector: "isBlockNode",
  30869. protocol: 'testing',
  30870. fn: function (){
  30871. var self=this;
  30872. return false;
  30873. },
  30874. args: [],
  30875. source: "isBlockNode\x0a\x09^ false",
  30876. referencedClasses: [],
  30877. messageSends: []
  30878. }),
  30879. $globals.Node);
  30880. $core.addMethod(
  30881. $core.method({
  30882. selector: "isBlockSequenceNode",
  30883. protocol: 'testing',
  30884. fn: function (){
  30885. var self=this;
  30886. return false;
  30887. },
  30888. args: [],
  30889. source: "isBlockSequenceNode\x0a\x09^ false",
  30890. referencedClasses: [],
  30891. messageSends: []
  30892. }),
  30893. $globals.Node);
  30894. $core.addMethod(
  30895. $core.method({
  30896. selector: "isCascadeNode",
  30897. protocol: 'testing',
  30898. fn: function (){
  30899. var self=this;
  30900. return false;
  30901. },
  30902. args: [],
  30903. source: "isCascadeNode\x0a\x09^ false",
  30904. referencedClasses: [],
  30905. messageSends: []
  30906. }),
  30907. $globals.Node);
  30908. $core.addMethod(
  30909. $core.method({
  30910. selector: "isImmutable",
  30911. protocol: 'testing',
  30912. fn: function (){
  30913. var self=this;
  30914. return false;
  30915. },
  30916. args: [],
  30917. source: "isImmutable\x0a\x09^ false",
  30918. referencedClasses: [],
  30919. messageSends: []
  30920. }),
  30921. $globals.Node);
  30922. $core.addMethod(
  30923. $core.method({
  30924. selector: "isJSStatementNode",
  30925. protocol: 'testing',
  30926. fn: function (){
  30927. var self=this;
  30928. return false;
  30929. },
  30930. args: [],
  30931. source: "isJSStatementNode\x0a\x09^ false",
  30932. referencedClasses: [],
  30933. messageSends: []
  30934. }),
  30935. $globals.Node);
  30936. $core.addMethod(
  30937. $core.method({
  30938. selector: "isLastChild",
  30939. protocol: 'testing',
  30940. fn: function (){
  30941. var self=this;
  30942. return $core.withContext(function($ctx1) {
  30943. return $recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  30944. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  30945. },
  30946. args: [],
  30947. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  30948. referencedClasses: [],
  30949. messageSends: ["=", "last", "nodes", "parent"]
  30950. }),
  30951. $globals.Node);
  30952. $core.addMethod(
  30953. $core.method({
  30954. selector: "isNavigationNode",
  30955. protocol: 'testing',
  30956. fn: function (){
  30957. var self=this;
  30958. return false;
  30959. },
  30960. args: [],
  30961. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  30962. referencedClasses: [],
  30963. messageSends: []
  30964. }),
  30965. $globals.Node);
  30966. $core.addMethod(
  30967. $core.method({
  30968. selector: "isNode",
  30969. protocol: 'testing',
  30970. fn: function (){
  30971. var self=this;
  30972. return true;
  30973. },
  30974. args: [],
  30975. source: "isNode\x0a\x09^ true",
  30976. referencedClasses: [],
  30977. messageSends: []
  30978. }),
  30979. $globals.Node);
  30980. $core.addMethod(
  30981. $core.method({
  30982. selector: "isReferenced",
  30983. protocol: 'testing',
  30984. fn: function (){
  30985. var self=this;
  30986. return $core.withContext(function($ctx1) {
  30987. var $3,$2,$1;
  30988. $3=self._parent();
  30989. $ctx1.sendIdx["parent"]=1;
  30990. $2=$recv($3)._isSequenceNode();
  30991. $1=$recv($2)._or_((function(){
  30992. return $core.withContext(function($ctx2) {
  30993. return $recv(self._parent())._isAssignmentNode();
  30994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30995. }));
  30996. return $recv($1)._not();
  30997. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  30998. },
  30999. args: [],
  31000. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  31001. referencedClasses: [],
  31002. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31003. }),
  31004. $globals.Node);
  31005. $core.addMethod(
  31006. $core.method({
  31007. selector: "isReturnNode",
  31008. protocol: 'testing',
  31009. fn: function (){
  31010. var self=this;
  31011. return false;
  31012. },
  31013. args: [],
  31014. source: "isReturnNode\x0a\x09^ false",
  31015. referencedClasses: [],
  31016. messageSends: []
  31017. }),
  31018. $globals.Node);
  31019. $core.addMethod(
  31020. $core.method({
  31021. selector: "isSendNode",
  31022. protocol: 'testing',
  31023. fn: function (){
  31024. var self=this;
  31025. return false;
  31026. },
  31027. args: [],
  31028. source: "isSendNode\x0a\x09^ false",
  31029. referencedClasses: [],
  31030. messageSends: []
  31031. }),
  31032. $globals.Node);
  31033. $core.addMethod(
  31034. $core.method({
  31035. selector: "isSequenceNode",
  31036. protocol: 'testing',
  31037. fn: function (){
  31038. var self=this;
  31039. return false;
  31040. },
  31041. args: [],
  31042. source: "isSequenceNode\x0a\x09^ false",
  31043. referencedClasses: [],
  31044. messageSends: []
  31045. }),
  31046. $globals.Node);
  31047. $core.addMethod(
  31048. $core.method({
  31049. selector: "isValueNode",
  31050. protocol: 'testing',
  31051. fn: function (){
  31052. var self=this;
  31053. return false;
  31054. },
  31055. args: [],
  31056. source: "isValueNode\x0a\x09^ false",
  31057. referencedClasses: [],
  31058. messageSends: []
  31059. }),
  31060. $globals.Node);
  31061. $core.addMethod(
  31062. $core.method({
  31063. selector: "isVariableNode",
  31064. protocol: 'testing',
  31065. fn: function (){
  31066. var self=this;
  31067. return false;
  31068. },
  31069. args: [],
  31070. source: "isVariableNode\x0a\x09^ false",
  31071. referencedClasses: [],
  31072. messageSends: []
  31073. }),
  31074. $globals.Node);
  31075. $core.addMethod(
  31076. $core.method({
  31077. selector: "location:",
  31078. protocol: 'accessing',
  31079. fn: function (aLocation){
  31080. var self=this;
  31081. return $core.withContext(function($ctx1) {
  31082. var $3,$2,$1;
  31083. $3=$recv(aLocation)._start();
  31084. $ctx1.sendIdx["start"]=1;
  31085. $2=$recv($3)._line();
  31086. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  31087. self._position_($1);
  31088. return self;
  31089. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.Node)});
  31090. },
  31091. args: ["aLocation"],
  31092. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  31093. referencedClasses: [],
  31094. messageSends: ["position:", "@", "line", "start", "column"]
  31095. }),
  31096. $globals.Node);
  31097. $core.addMethod(
  31098. $core.method({
  31099. selector: "method",
  31100. protocol: 'accessing',
  31101. fn: function (){
  31102. var self=this;
  31103. return $core.withContext(function($ctx1) {
  31104. var $1,$receiver;
  31105. $1=self._parent();
  31106. if(($receiver = $1) == null || $receiver.isNil){
  31107. return $1;
  31108. } else {
  31109. var node;
  31110. node=$receiver;
  31111. return $recv(node)._method();
  31112. };
  31113. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31114. },
  31115. args: [],
  31116. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31117. referencedClasses: [],
  31118. messageSends: ["ifNotNil:", "parent", "method"]
  31119. }),
  31120. $globals.Node);
  31121. $core.addMethod(
  31122. $core.method({
  31123. selector: "navigationNodeAt:ifAbsent:",
  31124. protocol: 'accessing',
  31125. fn: function (aPoint,aBlock){
  31126. var self=this;
  31127. var children;
  31128. return $core.withContext(function($ctx1) {
  31129. var $2,$1;
  31130. var $early={};
  31131. try {
  31132. children=$recv(self._allNodes())._select_((function(each){
  31133. return $core.withContext(function($ctx2) {
  31134. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31135. return $core.withContext(function($ctx3) {
  31136. return $recv(each)._inPosition_(aPoint);
  31137. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31138. }));
  31139. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31140. }));
  31141. $recv(children)._ifEmpty_((function(){
  31142. return $core.withContext(function($ctx2) {
  31143. throw $early=[$recv(aBlock)._value()];
  31144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31145. }));
  31146. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31147. return $core.withContext(function($ctx2) {
  31148. $2=$recv(a)._positionStart();
  31149. $ctx2.sendIdx["positionStart"]=1;
  31150. $1=$recv($2)._dist_(aPoint);
  31151. $ctx2.sendIdx["dist:"]=1;
  31152. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31153. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31154. })))._first();
  31155. }
  31156. catch(e) {if(e===$early)return e[0]; throw e}
  31157. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31158. },
  31159. args: ["aPoint", "aBlock"],
  31160. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  31161. referencedClasses: [],
  31162. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31163. }),
  31164. $globals.Node);
  31165. $core.addMethod(
  31166. $core.method({
  31167. selector: "nodes",
  31168. protocol: 'accessing',
  31169. fn: function (){
  31170. var self=this;
  31171. return $core.withContext(function($ctx1) {
  31172. var $1,$receiver;
  31173. $1=self["@nodes"];
  31174. if(($receiver = $1) == null || $receiver.isNil){
  31175. self["@nodes"]=$recv($globals.Array)._new();
  31176. return self["@nodes"];
  31177. } else {
  31178. return $1;
  31179. };
  31180. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31181. },
  31182. args: [],
  31183. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31184. referencedClasses: ["Array"],
  31185. messageSends: ["ifNil:", "new"]
  31186. }),
  31187. $globals.Node);
  31188. $core.addMethod(
  31189. $core.method({
  31190. selector: "nodes:",
  31191. protocol: 'building',
  31192. fn: function (aCollection){
  31193. var self=this;
  31194. return $core.withContext(function($ctx1) {
  31195. self["@nodes"]=aCollection;
  31196. $recv(aCollection)._do_((function(each){
  31197. return $core.withContext(function($ctx2) {
  31198. return $recv(each)._parent_(self);
  31199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31200. }));
  31201. return self;
  31202. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31203. },
  31204. args: ["aCollection"],
  31205. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31206. referencedClasses: [],
  31207. messageSends: ["do:", "parent:"]
  31208. }),
  31209. $globals.Node);
  31210. $core.addMethod(
  31211. $core.method({
  31212. selector: "parent",
  31213. protocol: 'accessing',
  31214. fn: function (){
  31215. var self=this;
  31216. return self["@parent"];
  31217. },
  31218. args: [],
  31219. source: "parent\x0a\x09^ parent",
  31220. referencedClasses: [],
  31221. messageSends: []
  31222. }),
  31223. $globals.Node);
  31224. $core.addMethod(
  31225. $core.method({
  31226. selector: "parent:",
  31227. protocol: 'accessing',
  31228. fn: function (aNode){
  31229. var self=this;
  31230. self["@parent"]=aNode;
  31231. return self;
  31232. },
  31233. args: ["aNode"],
  31234. source: "parent: aNode\x0a\x09parent := aNode",
  31235. referencedClasses: [],
  31236. messageSends: []
  31237. }),
  31238. $globals.Node);
  31239. $core.addMethod(
  31240. $core.method({
  31241. selector: "position",
  31242. protocol: 'accessing',
  31243. fn: function (){
  31244. var self=this;
  31245. return $core.withContext(function($ctx1) {
  31246. var $1,$2,$receiver;
  31247. $1=self["@position"];
  31248. if(($receiver = $1) == null || $receiver.isNil){
  31249. $2=self._parent();
  31250. if(($receiver = $2) == null || $receiver.isNil){
  31251. return $2;
  31252. } else {
  31253. var node;
  31254. node=$receiver;
  31255. return $recv(node)._position();
  31256. };
  31257. } else {
  31258. return $1;
  31259. };
  31260. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31261. },
  31262. args: [],
  31263. 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 ] ]",
  31264. referencedClasses: [],
  31265. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31266. }),
  31267. $globals.Node);
  31268. $core.addMethod(
  31269. $core.method({
  31270. selector: "position:",
  31271. protocol: 'accessing',
  31272. fn: function (aPosition){
  31273. var self=this;
  31274. self["@position"]=aPosition;
  31275. return self;
  31276. },
  31277. args: ["aPosition"],
  31278. source: "position: aPosition\x0a\x09position := aPosition",
  31279. referencedClasses: [],
  31280. messageSends: []
  31281. }),
  31282. $globals.Node);
  31283. $core.addMethod(
  31284. $core.method({
  31285. selector: "positionEnd",
  31286. protocol: 'accessing',
  31287. fn: function (){
  31288. var self=this;
  31289. return $core.withContext(function($ctx1) {
  31290. var $1,$6,$5,$4,$3,$2;
  31291. $1=self._positionStart();
  31292. $6=self._source();
  31293. $ctx1.sendIdx["source"]=1;
  31294. $5=$recv($6)._lines();
  31295. $ctx1.sendIdx["lines"]=1;
  31296. $4=$recv($5)._size();
  31297. $ctx1.sendIdx["size"]=1;
  31298. $3=$recv($4).__minus((1));
  31299. $ctx1.sendIdx["-"]=1;
  31300. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31301. return $recv($1).__plus($2);
  31302. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31303. },
  31304. args: [],
  31305. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31306. referencedClasses: [],
  31307. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31308. }),
  31309. $globals.Node);
  31310. $core.addMethod(
  31311. $core.method({
  31312. selector: "positionStart",
  31313. protocol: 'accessing',
  31314. fn: function (){
  31315. var self=this;
  31316. return $core.withContext(function($ctx1) {
  31317. return self._position();
  31318. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31319. },
  31320. args: [],
  31321. source: "positionStart\x0a\x09^ self position",
  31322. referencedClasses: [],
  31323. messageSends: ["position"]
  31324. }),
  31325. $globals.Node);
  31326. $core.addMethod(
  31327. $core.method({
  31328. selector: "postCopy",
  31329. protocol: 'copying',
  31330. fn: function (){
  31331. var self=this;
  31332. return $core.withContext(function($ctx1) {
  31333. (
  31334. $ctx1.supercall = true,
  31335. ($globals.Node.superclass||$boot.nilAsClass).fn.prototype._postCopy.apply($recv(self), []));
  31336. $ctx1.supercall = false;
  31337. $recv(self._nodes())._do_((function(each){
  31338. return $core.withContext(function($ctx2) {
  31339. return $recv(each)._parent_(self);
  31340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31341. }));
  31342. return self;
  31343. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31344. },
  31345. args: [],
  31346. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31347. referencedClasses: [],
  31348. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31349. }),
  31350. $globals.Node);
  31351. $core.addMethod(
  31352. $core.method({
  31353. selector: "requiresSmalltalkContext",
  31354. protocol: 'testing',
  31355. fn: function (){
  31356. var self=this;
  31357. return $core.withContext(function($ctx1) {
  31358. return $recv($recv(self._nodes())._detect_ifNone_((function(each){
  31359. return $core.withContext(function($ctx2) {
  31360. return $recv(each)._requiresSmalltalkContext();
  31361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31362. }),(function(){
  31363. return nil;
  31364. })))._notNil();
  31365. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31366. },
  31367. args: [],
  31368. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  31369. referencedClasses: [],
  31370. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31371. }),
  31372. $globals.Node);
  31373. $core.addMethod(
  31374. $core.method({
  31375. selector: "shouldBeAliased",
  31376. protocol: 'accessing',
  31377. fn: function (){
  31378. var self=this;
  31379. return $core.withContext(function($ctx1) {
  31380. var $1,$receiver;
  31381. $1=self["@shouldBeAliased"];
  31382. if(($receiver = $1) == null || $receiver.isNil){
  31383. return false;
  31384. } else {
  31385. return $1;
  31386. };
  31387. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  31388. },
  31389. args: [],
  31390. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31391. referencedClasses: [],
  31392. messageSends: ["ifNil:"]
  31393. }),
  31394. $globals.Node);
  31395. $core.addMethod(
  31396. $core.method({
  31397. selector: "shouldBeAliased:",
  31398. protocol: 'accessing',
  31399. fn: function (aBoolean){
  31400. var self=this;
  31401. self["@shouldBeAliased"]=aBoolean;
  31402. return self;
  31403. },
  31404. args: ["aBoolean"],
  31405. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31406. referencedClasses: [],
  31407. messageSends: []
  31408. }),
  31409. $globals.Node);
  31410. $core.addMethod(
  31411. $core.method({
  31412. selector: "shouldBeInlined",
  31413. protocol: 'accessing',
  31414. fn: function (){
  31415. var self=this;
  31416. return $core.withContext(function($ctx1) {
  31417. var $1,$receiver;
  31418. $1=self["@shouldBeInlined"];
  31419. if(($receiver = $1) == null || $receiver.isNil){
  31420. return false;
  31421. } else {
  31422. return $1;
  31423. };
  31424. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  31425. },
  31426. args: [],
  31427. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  31428. referencedClasses: [],
  31429. messageSends: ["ifNil:"]
  31430. }),
  31431. $globals.Node);
  31432. $core.addMethod(
  31433. $core.method({
  31434. selector: "shouldBeInlined:",
  31435. protocol: 'accessing',
  31436. fn: function (aBoolean){
  31437. var self=this;
  31438. self["@shouldBeInlined"]=aBoolean;
  31439. return self;
  31440. },
  31441. args: ["aBoolean"],
  31442. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  31443. referencedClasses: [],
  31444. messageSends: []
  31445. }),
  31446. $globals.Node);
  31447. $core.addMethod(
  31448. $core.method({
  31449. selector: "size",
  31450. protocol: 'accessing',
  31451. fn: function (){
  31452. var self=this;
  31453. return $core.withContext(function($ctx1) {
  31454. return $recv(self._source())._size();
  31455. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  31456. },
  31457. args: [],
  31458. source: "size\x0a\x09^ self source size",
  31459. referencedClasses: [],
  31460. messageSends: ["size", "source"]
  31461. }),
  31462. $globals.Node);
  31463. $core.addMethod(
  31464. $core.method({
  31465. selector: "source",
  31466. protocol: 'accessing',
  31467. fn: function (){
  31468. var self=this;
  31469. return $core.withContext(function($ctx1) {
  31470. var $1,$receiver;
  31471. $1=self["@source"];
  31472. if(($receiver = $1) == null || $receiver.isNil){
  31473. return "";
  31474. } else {
  31475. return $1;
  31476. };
  31477. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  31478. },
  31479. args: [],
  31480. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31481. referencedClasses: [],
  31482. messageSends: ["ifNil:"]
  31483. }),
  31484. $globals.Node);
  31485. $core.addMethod(
  31486. $core.method({
  31487. selector: "source:",
  31488. protocol: 'accessing',
  31489. fn: function (aString){
  31490. var self=this;
  31491. self["@source"]=aString;
  31492. return self;
  31493. },
  31494. args: ["aString"],
  31495. source: "source: aString\x0a\x09source := aString",
  31496. referencedClasses: [],
  31497. messageSends: []
  31498. }),
  31499. $globals.Node);
  31500. $core.addMethod(
  31501. $core.method({
  31502. selector: "subtreeNeedsAliasing",
  31503. protocol: 'testing',
  31504. fn: function (){
  31505. var self=this;
  31506. return $core.withContext(function($ctx1) {
  31507. var $1;
  31508. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  31509. return $core.withContext(function($ctx2) {
  31510. return self._shouldBeInlined();
  31511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31512. })))._or_((function(){
  31513. return $core.withContext(function($ctx2) {
  31514. return $recv(self._nodes())._anySatisfy_((function(each){
  31515. return $core.withContext(function($ctx3) {
  31516. return $recv(each)._subtreeNeedsAliasing();
  31517. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31518. }));
  31519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31520. }));
  31521. $ctx1.sendIdx["or:"]=1;
  31522. return $1;
  31523. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  31524. },
  31525. args: [],
  31526. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  31527. referencedClasses: [],
  31528. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  31529. }),
  31530. $globals.Node);
  31531. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  31532. $globals.AssignmentNode.comment="I represent an assignment node.";
  31533. $core.addMethod(
  31534. $core.method({
  31535. selector: "accept:",
  31536. protocol: 'visiting',
  31537. fn: function (aVisitor){
  31538. var self=this;
  31539. return $core.withContext(function($ctx1) {
  31540. return $recv(aVisitor)._visitAssignmentNode_(self);
  31541. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31542. },
  31543. args: ["aVisitor"],
  31544. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31545. referencedClasses: [],
  31546. messageSends: ["visitAssignmentNode:"]
  31547. }),
  31548. $globals.AssignmentNode);
  31549. $core.addMethod(
  31550. $core.method({
  31551. selector: "isAssignmentNode",
  31552. protocol: 'testing',
  31553. fn: function (){
  31554. var self=this;
  31555. return true;
  31556. },
  31557. args: [],
  31558. source: "isAssignmentNode\x0a\x09^ true",
  31559. referencedClasses: [],
  31560. messageSends: []
  31561. }),
  31562. $globals.AssignmentNode);
  31563. $core.addMethod(
  31564. $core.method({
  31565. selector: "left",
  31566. protocol: 'accessing',
  31567. fn: function (){
  31568. var self=this;
  31569. return self["@left"];
  31570. },
  31571. args: [],
  31572. source: "left\x0a\x09^ left",
  31573. referencedClasses: [],
  31574. messageSends: []
  31575. }),
  31576. $globals.AssignmentNode);
  31577. $core.addMethod(
  31578. $core.method({
  31579. selector: "left:",
  31580. protocol: 'accessing',
  31581. fn: function (aNode){
  31582. var self=this;
  31583. return $core.withContext(function($ctx1) {
  31584. self["@left"]=aNode;
  31585. $recv(aNode)._parent_(self);
  31586. return self;
  31587. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  31588. },
  31589. args: ["aNode"],
  31590. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  31591. referencedClasses: [],
  31592. messageSends: ["parent:"]
  31593. }),
  31594. $globals.AssignmentNode);
  31595. $core.addMethod(
  31596. $core.method({
  31597. selector: "nodes",
  31598. protocol: 'accessing',
  31599. fn: function (){
  31600. var self=this;
  31601. return $core.withContext(function($ctx1) {
  31602. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31603. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  31604. },
  31605. args: [],
  31606. source: "nodes\x0a\x09^ Array with: self left with: self right",
  31607. referencedClasses: ["Array"],
  31608. messageSends: ["with:with:", "left", "right"]
  31609. }),
  31610. $globals.AssignmentNode);
  31611. $core.addMethod(
  31612. $core.method({
  31613. selector: "right",
  31614. protocol: 'accessing',
  31615. fn: function (){
  31616. var self=this;
  31617. return self["@right"];
  31618. },
  31619. args: [],
  31620. source: "right\x0a\x09^ right",
  31621. referencedClasses: [],
  31622. messageSends: []
  31623. }),
  31624. $globals.AssignmentNode);
  31625. $core.addMethod(
  31626. $core.method({
  31627. selector: "right:",
  31628. protocol: 'accessing',
  31629. fn: function (aNode){
  31630. var self=this;
  31631. return $core.withContext(function($ctx1) {
  31632. self["@right"]=aNode;
  31633. $recv(aNode)._parent_(self);
  31634. return self;
  31635. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  31636. },
  31637. args: ["aNode"],
  31638. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  31639. referencedClasses: [],
  31640. messageSends: ["parent:"]
  31641. }),
  31642. $globals.AssignmentNode);
  31643. $core.addMethod(
  31644. $core.method({
  31645. selector: "shouldBeAliased",
  31646. protocol: 'testing',
  31647. fn: function (){
  31648. var self=this;
  31649. return $core.withContext(function($ctx1) {
  31650. var $1;
  31651. $1=(
  31652. $ctx1.supercall = true,
  31653. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  31654. $ctx1.supercall = false;
  31655. return $recv($1)._or_((function(){
  31656. return $core.withContext(function($ctx2) {
  31657. return self._isReferenced();
  31658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31659. }));
  31660. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  31661. },
  31662. args: [],
  31663. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  31664. referencedClasses: [],
  31665. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  31666. }),
  31667. $globals.AssignmentNode);
  31668. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  31669. $globals.BlockNode.comment="I represent an block closure node.";
  31670. $core.addMethod(
  31671. $core.method({
  31672. selector: "accept:",
  31673. protocol: 'visiting',
  31674. fn: function (aVisitor){
  31675. var self=this;
  31676. return $core.withContext(function($ctx1) {
  31677. return $recv(aVisitor)._visitBlockNode_(self);
  31678. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  31679. },
  31680. args: ["aVisitor"],
  31681. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31682. referencedClasses: [],
  31683. messageSends: ["visitBlockNode:"]
  31684. }),
  31685. $globals.BlockNode);
  31686. $core.addMethod(
  31687. $core.method({
  31688. selector: "isBlockNode",
  31689. protocol: 'testing',
  31690. fn: function (){
  31691. var self=this;
  31692. return true;
  31693. },
  31694. args: [],
  31695. source: "isBlockNode\x0a\x09^ true",
  31696. referencedClasses: [],
  31697. messageSends: []
  31698. }),
  31699. $globals.BlockNode);
  31700. $core.addMethod(
  31701. $core.method({
  31702. selector: "parameters",
  31703. protocol: 'accessing',
  31704. fn: function (){
  31705. var self=this;
  31706. return $core.withContext(function($ctx1) {
  31707. var $1,$receiver;
  31708. $1=self["@parameters"];
  31709. if(($receiver = $1) == null || $receiver.isNil){
  31710. self["@parameters"]=$recv($globals.Array)._new();
  31711. return self["@parameters"];
  31712. } else {
  31713. return $1;
  31714. };
  31715. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31716. },
  31717. args: [],
  31718. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31719. referencedClasses: ["Array"],
  31720. messageSends: ["ifNil:", "new"]
  31721. }),
  31722. $globals.BlockNode);
  31723. $core.addMethod(
  31724. $core.method({
  31725. selector: "parameters:",
  31726. protocol: 'accessing',
  31727. fn: function (aCollection){
  31728. var self=this;
  31729. self["@parameters"]=aCollection;
  31730. return self;
  31731. },
  31732. args: ["aCollection"],
  31733. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31734. referencedClasses: [],
  31735. messageSends: []
  31736. }),
  31737. $globals.BlockNode);
  31738. $core.addMethod(
  31739. $core.method({
  31740. selector: "scope",
  31741. protocol: 'accessing',
  31742. fn: function (){
  31743. var self=this;
  31744. return self["@scope"];
  31745. },
  31746. args: [],
  31747. source: "scope\x0a\x09^ scope",
  31748. referencedClasses: [],
  31749. messageSends: []
  31750. }),
  31751. $globals.BlockNode);
  31752. $core.addMethod(
  31753. $core.method({
  31754. selector: "scope:",
  31755. protocol: 'accessing',
  31756. fn: function (aLexicalScope){
  31757. var self=this;
  31758. self["@scope"]=aLexicalScope;
  31759. return self;
  31760. },
  31761. args: ["aLexicalScope"],
  31762. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31763. referencedClasses: [],
  31764. messageSends: []
  31765. }),
  31766. $globals.BlockNode);
  31767. $core.addMethod(
  31768. $core.method({
  31769. selector: "subtreeNeedsAliasing",
  31770. protocol: 'testing',
  31771. fn: function (){
  31772. var self=this;
  31773. return $core.withContext(function($ctx1) {
  31774. return $recv(self._shouldBeAliased())._or_((function(){
  31775. return $core.withContext(function($ctx2) {
  31776. return self._shouldBeInlined();
  31777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31778. }));
  31779. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31780. },
  31781. args: [],
  31782. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31783. referencedClasses: [],
  31784. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31785. }),
  31786. $globals.BlockNode);
  31787. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  31788. $globals.CascadeNode.comment="I represent an cascade node.";
  31789. $core.addMethod(
  31790. $core.method({
  31791. selector: "accept:",
  31792. protocol: 'visiting',
  31793. fn: function (aVisitor){
  31794. var self=this;
  31795. return $core.withContext(function($ctx1) {
  31796. return $recv(aVisitor)._visitCascadeNode_(self);
  31797. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31798. },
  31799. args: ["aVisitor"],
  31800. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31801. referencedClasses: [],
  31802. messageSends: ["visitCascadeNode:"]
  31803. }),
  31804. $globals.CascadeNode);
  31805. $core.addMethod(
  31806. $core.method({
  31807. selector: "isCascadeNode",
  31808. protocol: 'testing',
  31809. fn: function (){
  31810. var self=this;
  31811. return true;
  31812. },
  31813. args: [],
  31814. source: "isCascadeNode\x0a\x09^ true",
  31815. referencedClasses: [],
  31816. messageSends: []
  31817. }),
  31818. $globals.CascadeNode);
  31819. $core.addMethod(
  31820. $core.method({
  31821. selector: "receiver",
  31822. protocol: 'accessing',
  31823. fn: function (){
  31824. var self=this;
  31825. return self["@receiver"];
  31826. },
  31827. args: [],
  31828. source: "receiver\x0a\x09^ receiver",
  31829. referencedClasses: [],
  31830. messageSends: []
  31831. }),
  31832. $globals.CascadeNode);
  31833. $core.addMethod(
  31834. $core.method({
  31835. selector: "receiver:",
  31836. protocol: 'accessing',
  31837. fn: function (aNode){
  31838. var self=this;
  31839. self["@receiver"]=aNode;
  31840. return self;
  31841. },
  31842. args: ["aNode"],
  31843. source: "receiver: aNode\x0a\x09receiver := aNode",
  31844. referencedClasses: [],
  31845. messageSends: []
  31846. }),
  31847. $globals.CascadeNode);
  31848. $core.addMethod(
  31849. $core.method({
  31850. selector: "subtreeNeedsAliasing",
  31851. protocol: 'testing',
  31852. fn: function (){
  31853. var self=this;
  31854. return $core.withContext(function($ctx1) {
  31855. return $recv($recv(self._parent())._isSequenceNode())._not();
  31856. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  31857. },
  31858. args: [],
  31859. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  31860. referencedClasses: [],
  31861. messageSends: ["not", "isSequenceNode", "parent"]
  31862. }),
  31863. $globals.CascadeNode);
  31864. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  31865. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31866. $core.addMethod(
  31867. $core.method({
  31868. selector: "accept:",
  31869. protocol: 'visiting',
  31870. fn: function (aVisitor){
  31871. var self=this;
  31872. return $core.withContext(function($ctx1) {
  31873. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31874. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31875. },
  31876. args: ["aVisitor"],
  31877. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31878. referencedClasses: [],
  31879. messageSends: ["visitDynamicArrayNode:"]
  31880. }),
  31881. $globals.DynamicArrayNode);
  31882. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  31883. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31884. $core.addMethod(
  31885. $core.method({
  31886. selector: "accept:",
  31887. protocol: 'visiting',
  31888. fn: function (aVisitor){
  31889. var self=this;
  31890. return $core.withContext(function($ctx1) {
  31891. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31892. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31893. },
  31894. args: ["aVisitor"],
  31895. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31896. referencedClasses: [],
  31897. messageSends: ["visitDynamicDictionaryNode:"]
  31898. }),
  31899. $globals.DynamicDictionaryNode);
  31900. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  31901. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31902. $core.addMethod(
  31903. $core.method({
  31904. selector: "accept:",
  31905. protocol: 'visiting',
  31906. fn: function (aVisitor){
  31907. var self=this;
  31908. return $core.withContext(function($ctx1) {
  31909. return $recv(aVisitor)._visitJSStatementNode_(self);
  31910. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31911. },
  31912. args: ["aVisitor"],
  31913. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31914. referencedClasses: [],
  31915. messageSends: ["visitJSStatementNode:"]
  31916. }),
  31917. $globals.JSStatementNode);
  31918. $core.addMethod(
  31919. $core.method({
  31920. selector: "isJSStatementNode",
  31921. protocol: 'testing',
  31922. fn: function (){
  31923. var self=this;
  31924. return true;
  31925. },
  31926. args: [],
  31927. source: "isJSStatementNode\x0a\x09^ true",
  31928. referencedClasses: [],
  31929. messageSends: []
  31930. }),
  31931. $globals.JSStatementNode);
  31932. $core.addMethod(
  31933. $core.method({
  31934. selector: "requiresSmalltalkContext",
  31935. protocol: 'testing',
  31936. fn: function (){
  31937. var self=this;
  31938. return true;
  31939. },
  31940. args: [],
  31941. source: "requiresSmalltalkContext\x0a\x09^ true",
  31942. referencedClasses: [],
  31943. messageSends: []
  31944. }),
  31945. $globals.JSStatementNode);
  31946. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31947. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31948. $core.addMethod(
  31949. $core.method({
  31950. selector: "accept:",
  31951. protocol: 'visiting',
  31952. fn: function (aVisitor){
  31953. var self=this;
  31954. return $core.withContext(function($ctx1) {
  31955. return $recv(aVisitor)._visitMethodNode_(self);
  31956. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  31957. },
  31958. args: ["aVisitor"],
  31959. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31960. referencedClasses: [],
  31961. messageSends: ["visitMethodNode:"]
  31962. }),
  31963. $globals.MethodNode);
  31964. $core.addMethod(
  31965. $core.method({
  31966. selector: "arguments",
  31967. protocol: 'accessing',
  31968. fn: function (){
  31969. var self=this;
  31970. return $core.withContext(function($ctx1) {
  31971. var $1,$receiver;
  31972. $1=self["@arguments"];
  31973. if(($receiver = $1) == null || $receiver.isNil){
  31974. return [];
  31975. } else {
  31976. return $1;
  31977. };
  31978. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31979. },
  31980. args: [],
  31981. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31982. referencedClasses: [],
  31983. messageSends: ["ifNil:"]
  31984. }),
  31985. $globals.MethodNode);
  31986. $core.addMethod(
  31987. $core.method({
  31988. selector: "arguments:",
  31989. protocol: 'accessing',
  31990. fn: function (aCollection){
  31991. var self=this;
  31992. self["@arguments"]=aCollection;
  31993. return self;
  31994. },
  31995. args: ["aCollection"],
  31996. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31997. referencedClasses: [],
  31998. messageSends: []
  31999. }),
  32000. $globals.MethodNode);
  32001. $core.addMethod(
  32002. $core.method({
  32003. selector: "classReferences",
  32004. protocol: 'accessing',
  32005. fn: function (){
  32006. var self=this;
  32007. return self["@classReferences"];
  32008. },
  32009. args: [],
  32010. source: "classReferences\x0a\x09^ classReferences",
  32011. referencedClasses: [],
  32012. messageSends: []
  32013. }),
  32014. $globals.MethodNode);
  32015. $core.addMethod(
  32016. $core.method({
  32017. selector: "classReferences:",
  32018. protocol: 'accessing',
  32019. fn: function (aCollection){
  32020. var self=this;
  32021. self["@classReferences"]=aCollection;
  32022. return self;
  32023. },
  32024. args: ["aCollection"],
  32025. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32026. referencedClasses: [],
  32027. messageSends: []
  32028. }),
  32029. $globals.MethodNode);
  32030. $core.addMethod(
  32031. $core.method({
  32032. selector: "messageSends",
  32033. protocol: 'accessing',
  32034. fn: function (){
  32035. var self=this;
  32036. return $core.withContext(function($ctx1) {
  32037. return $recv(self._sendIndexes())._keys();
  32038. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32039. },
  32040. args: [],
  32041. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32042. referencedClasses: [],
  32043. messageSends: ["keys", "sendIndexes"]
  32044. }),
  32045. $globals.MethodNode);
  32046. $core.addMethod(
  32047. $core.method({
  32048. selector: "method",
  32049. protocol: 'accessing',
  32050. fn: function (){
  32051. var self=this;
  32052. return self;
  32053. },
  32054. args: [],
  32055. source: "method\x0a\x09^ self",
  32056. referencedClasses: [],
  32057. messageSends: []
  32058. }),
  32059. $globals.MethodNode);
  32060. $core.addMethod(
  32061. $core.method({
  32062. selector: "scope",
  32063. protocol: 'accessing',
  32064. fn: function (){
  32065. var self=this;
  32066. return self["@scope"];
  32067. },
  32068. args: [],
  32069. source: "scope\x0a\x09^ scope",
  32070. referencedClasses: [],
  32071. messageSends: []
  32072. }),
  32073. $globals.MethodNode);
  32074. $core.addMethod(
  32075. $core.method({
  32076. selector: "scope:",
  32077. protocol: 'accessing',
  32078. fn: function (aMethodScope){
  32079. var self=this;
  32080. self["@scope"]=aMethodScope;
  32081. return self;
  32082. },
  32083. args: ["aMethodScope"],
  32084. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32085. referencedClasses: [],
  32086. messageSends: []
  32087. }),
  32088. $globals.MethodNode);
  32089. $core.addMethod(
  32090. $core.method({
  32091. selector: "selector",
  32092. protocol: 'accessing',
  32093. fn: function (){
  32094. var self=this;
  32095. return self["@selector"];
  32096. },
  32097. args: [],
  32098. source: "selector\x0a\x09^ selector",
  32099. referencedClasses: [],
  32100. messageSends: []
  32101. }),
  32102. $globals.MethodNode);
  32103. $core.addMethod(
  32104. $core.method({
  32105. selector: "selector:",
  32106. protocol: 'accessing',
  32107. fn: function (aString){
  32108. var self=this;
  32109. self["@selector"]=aString;
  32110. return self;
  32111. },
  32112. args: ["aString"],
  32113. source: "selector: aString\x0a\x09selector := aString",
  32114. referencedClasses: [],
  32115. messageSends: []
  32116. }),
  32117. $globals.MethodNode);
  32118. $core.addMethod(
  32119. $core.method({
  32120. selector: "sendIndexes",
  32121. protocol: 'accessing',
  32122. fn: function (){
  32123. var self=this;
  32124. return self["@sendIndexes"];
  32125. },
  32126. args: [],
  32127. source: "sendIndexes\x0a\x09^ sendIndexes",
  32128. referencedClasses: [],
  32129. messageSends: []
  32130. }),
  32131. $globals.MethodNode);
  32132. $core.addMethod(
  32133. $core.method({
  32134. selector: "sendIndexes:",
  32135. protocol: 'accessing',
  32136. fn: function (aDictionary){
  32137. var self=this;
  32138. self["@sendIndexes"]=aDictionary;
  32139. return self;
  32140. },
  32141. args: ["aDictionary"],
  32142. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32143. referencedClasses: [],
  32144. messageSends: []
  32145. }),
  32146. $globals.MethodNode);
  32147. $core.addMethod(
  32148. $core.method({
  32149. selector: "sequenceNode",
  32150. protocol: 'accessing',
  32151. fn: function (){
  32152. var self=this;
  32153. return $core.withContext(function($ctx1) {
  32154. var $1;
  32155. var $early={};
  32156. try {
  32157. $recv(self._nodes())._do_((function(each){
  32158. return $core.withContext(function($ctx2) {
  32159. $1=$recv(each)._isSequenceNode();
  32160. if($core.assert($1)){
  32161. throw $early=[each];
  32162. };
  32163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32164. }));
  32165. return nil;
  32166. }
  32167. catch(e) {if(e===$early)return e[0]; throw e}
  32168. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32169. },
  32170. args: [],
  32171. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32172. referencedClasses: [],
  32173. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32174. }),
  32175. $globals.MethodNode);
  32176. $core.addMethod(
  32177. $core.method({
  32178. selector: "source",
  32179. protocol: 'accessing',
  32180. fn: function (){
  32181. var self=this;
  32182. return self["@source"];
  32183. },
  32184. args: [],
  32185. source: "source\x0a\x09^ source",
  32186. referencedClasses: [],
  32187. messageSends: []
  32188. }),
  32189. $globals.MethodNode);
  32190. $core.addMethod(
  32191. $core.method({
  32192. selector: "source:",
  32193. protocol: 'accessing',
  32194. fn: function (aString){
  32195. var self=this;
  32196. self["@source"]=aString;
  32197. return self;
  32198. },
  32199. args: ["aString"],
  32200. source: "source: aString\x0a\x09source := aString",
  32201. referencedClasses: [],
  32202. messageSends: []
  32203. }),
  32204. $globals.MethodNode);
  32205. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  32206. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32207. $core.addMethod(
  32208. $core.method({
  32209. selector: "accept:",
  32210. protocol: 'visiting',
  32211. fn: function (aVisitor){
  32212. var self=this;
  32213. return $core.withContext(function($ctx1) {
  32214. return $recv(aVisitor)._visitReturnNode_(self);
  32215. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32216. },
  32217. args: ["aVisitor"],
  32218. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32219. referencedClasses: [],
  32220. messageSends: ["visitReturnNode:"]
  32221. }),
  32222. $globals.ReturnNode);
  32223. $core.addMethod(
  32224. $core.method({
  32225. selector: "isReturnNode",
  32226. protocol: 'testing',
  32227. fn: function (){
  32228. var self=this;
  32229. return true;
  32230. },
  32231. args: [],
  32232. source: "isReturnNode\x0a\x09^ true",
  32233. referencedClasses: [],
  32234. messageSends: []
  32235. }),
  32236. $globals.ReturnNode);
  32237. $core.addMethod(
  32238. $core.method({
  32239. selector: "nonLocalReturn",
  32240. protocol: 'testing',
  32241. fn: function (){
  32242. var self=this;
  32243. return $core.withContext(function($ctx1) {
  32244. return $recv($recv(self._scope())._isMethodScope())._not();
  32245. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32246. },
  32247. args: [],
  32248. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32249. referencedClasses: [],
  32250. messageSends: ["not", "isMethodScope", "scope"]
  32251. }),
  32252. $globals.ReturnNode);
  32253. $core.addMethod(
  32254. $core.method({
  32255. selector: "scope",
  32256. protocol: 'accessing',
  32257. fn: function (){
  32258. var self=this;
  32259. return self["@scope"];
  32260. },
  32261. args: [],
  32262. source: "scope\x0a\x09^ scope",
  32263. referencedClasses: [],
  32264. messageSends: []
  32265. }),
  32266. $globals.ReturnNode);
  32267. $core.addMethod(
  32268. $core.method({
  32269. selector: "scope:",
  32270. protocol: 'accessing',
  32271. fn: function (aLexicalScope){
  32272. var self=this;
  32273. self["@scope"]=aLexicalScope;
  32274. return self;
  32275. },
  32276. args: ["aLexicalScope"],
  32277. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32278. referencedClasses: [],
  32279. messageSends: []
  32280. }),
  32281. $globals.ReturnNode);
  32282. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'index'], 'Compiler-AST');
  32283. $globals.SendNode.comment="I represent an message send node.";
  32284. $core.addMethod(
  32285. $core.method({
  32286. selector: "accept:",
  32287. protocol: 'visiting',
  32288. fn: function (aVisitor){
  32289. var self=this;
  32290. return $core.withContext(function($ctx1) {
  32291. return $recv(aVisitor)._visitSendNode_(self);
  32292. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  32293. },
  32294. args: ["aVisitor"],
  32295. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32296. referencedClasses: [],
  32297. messageSends: ["visitSendNode:"]
  32298. }),
  32299. $globals.SendNode);
  32300. $core.addMethod(
  32301. $core.method({
  32302. selector: "arguments",
  32303. protocol: 'accessing',
  32304. fn: function (){
  32305. var self=this;
  32306. return $core.withContext(function($ctx1) {
  32307. var $1,$receiver;
  32308. $1=self["@arguments"];
  32309. if(($receiver = $1) == null || $receiver.isNil){
  32310. self["@arguments"]=[];
  32311. return self["@arguments"];
  32312. } else {
  32313. return $1;
  32314. };
  32315. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32316. },
  32317. args: [],
  32318. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32319. referencedClasses: [],
  32320. messageSends: ["ifNil:"]
  32321. }),
  32322. $globals.SendNode);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "arguments:",
  32326. protocol: 'accessing',
  32327. fn: function (aCollection){
  32328. var self=this;
  32329. return $core.withContext(function($ctx1) {
  32330. self["@arguments"]=aCollection;
  32331. $recv(aCollection)._do_((function(each){
  32332. return $core.withContext(function($ctx2) {
  32333. return $recv(each)._parent_(self);
  32334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32335. }));
  32336. return self;
  32337. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  32338. },
  32339. args: ["aCollection"],
  32340. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32341. referencedClasses: [],
  32342. messageSends: ["do:", "parent:"]
  32343. }),
  32344. $globals.SendNode);
  32345. $core.addMethod(
  32346. $core.method({
  32347. selector: "cascadeNodeWithMessages:",
  32348. protocol: 'accessing',
  32349. fn: function (aCollection){
  32350. var self=this;
  32351. var first;
  32352. return $core.withContext(function($ctx1) {
  32353. var $1,$2,$3;
  32354. $1=$recv($globals.SendNode)._new();
  32355. $ctx1.sendIdx["new"]=1;
  32356. $recv($1)._selector_(self._selector());
  32357. $recv($1)._arguments_(self._arguments());
  32358. $2=$recv($1)._yourself();
  32359. $ctx1.sendIdx["yourself"]=1;
  32360. first=$2;
  32361. $3=$recv($globals.CascadeNode)._new();
  32362. $recv($3)._receiver_(self._receiver());
  32363. $recv($3)._nodes_($recv($recv($globals.Array)._with_(first)).__comma(aCollection));
  32364. return $recv($3)._yourself();
  32365. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  32366. },
  32367. args: ["aCollection"],
  32368. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  32369. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  32370. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  32371. }),
  32372. $globals.SendNode);
  32373. $core.addMethod(
  32374. $core.method({
  32375. selector: "index",
  32376. protocol: 'accessing',
  32377. fn: function (){
  32378. var self=this;
  32379. return self["@index"];
  32380. },
  32381. args: [],
  32382. source: "index\x0a\x09^ index",
  32383. referencedClasses: [],
  32384. messageSends: []
  32385. }),
  32386. $globals.SendNode);
  32387. $core.addMethod(
  32388. $core.method({
  32389. selector: "index:",
  32390. protocol: 'accessing',
  32391. fn: function (anInteger){
  32392. var self=this;
  32393. self["@index"]=anInteger;
  32394. return self;
  32395. },
  32396. args: ["anInteger"],
  32397. source: "index: anInteger\x0a\x09index := anInteger",
  32398. referencedClasses: [],
  32399. messageSends: []
  32400. }),
  32401. $globals.SendNode);
  32402. $core.addMethod(
  32403. $core.method({
  32404. selector: "isCascadeSendNode",
  32405. protocol: 'testing',
  32406. fn: function (){
  32407. var self=this;
  32408. return $core.withContext(function($ctx1) {
  32409. return $recv(self._parent())._isCascadeNode();
  32410. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  32411. },
  32412. args: [],
  32413. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  32414. referencedClasses: [],
  32415. messageSends: ["isCascadeNode", "parent"]
  32416. }),
  32417. $globals.SendNode);
  32418. $core.addMethod(
  32419. $core.method({
  32420. selector: "isNavigationNode",
  32421. protocol: 'testing',
  32422. fn: function (){
  32423. var self=this;
  32424. return true;
  32425. },
  32426. args: [],
  32427. source: "isNavigationNode\x0a\x09^ true",
  32428. referencedClasses: [],
  32429. messageSends: []
  32430. }),
  32431. $globals.SendNode);
  32432. $core.addMethod(
  32433. $core.method({
  32434. selector: "isSendNode",
  32435. protocol: 'testing',
  32436. fn: function (){
  32437. var self=this;
  32438. return true;
  32439. },
  32440. args: [],
  32441. source: "isSendNode\x0a\x09^ true",
  32442. referencedClasses: [],
  32443. messageSends: []
  32444. }),
  32445. $globals.SendNode);
  32446. $core.addMethod(
  32447. $core.method({
  32448. selector: "navigationLink",
  32449. protocol: 'accessing',
  32450. fn: function (){
  32451. var self=this;
  32452. return $core.withContext(function($ctx1) {
  32453. return self._selector();
  32454. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32455. },
  32456. args: [],
  32457. source: "navigationLink\x0a\x09^ self selector",
  32458. referencedClasses: [],
  32459. messageSends: ["selector"]
  32460. }),
  32461. $globals.SendNode);
  32462. $core.addMethod(
  32463. $core.method({
  32464. selector: "nodes",
  32465. protocol: 'accessing',
  32466. fn: function (){
  32467. var self=this;
  32468. return $core.withContext(function($ctx1) {
  32469. var $1,$2,$3,$receiver;
  32470. $1=self._receiver();
  32471. $ctx1.sendIdx["receiver"]=1;
  32472. if(($receiver = $1) == null || $receiver.isNil){
  32473. $2=self._arguments();
  32474. $ctx1.sendIdx["arguments"]=1;
  32475. return $recv($2)._copy();
  32476. } else {
  32477. $1;
  32478. };
  32479. $3=$recv($globals.Array)._with_(self._receiver());
  32480. $recv($3)._addAll_(self._arguments());
  32481. return $recv($3)._yourself();
  32482. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  32483. },
  32484. args: [],
  32485. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  32486. referencedClasses: ["Array"],
  32487. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32488. }),
  32489. $globals.SendNode);
  32490. $core.addMethod(
  32491. $core.method({
  32492. selector: "receiver",
  32493. protocol: 'accessing',
  32494. fn: function (){
  32495. var self=this;
  32496. return self["@receiver"];
  32497. },
  32498. args: [],
  32499. source: "receiver\x0a\x09^ receiver",
  32500. referencedClasses: [],
  32501. messageSends: []
  32502. }),
  32503. $globals.SendNode);
  32504. $core.addMethod(
  32505. $core.method({
  32506. selector: "receiver:",
  32507. protocol: 'accessing',
  32508. fn: function (aNode){
  32509. var self=this;
  32510. return $core.withContext(function($ctx1) {
  32511. var $1;
  32512. self["@receiver"]=aNode;
  32513. $1=$recv(aNode)._isNode();
  32514. if($core.assert($1)){
  32515. $recv(aNode)._parent_(self);
  32516. };
  32517. return self;
  32518. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  32519. },
  32520. args: ["aNode"],
  32521. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  32522. referencedClasses: [],
  32523. messageSends: ["ifTrue:", "isNode", "parent:"]
  32524. }),
  32525. $globals.SendNode);
  32526. $core.addMethod(
  32527. $core.method({
  32528. selector: "requiresSmalltalkContext",
  32529. protocol: 'testing',
  32530. fn: function (){
  32531. var self=this;
  32532. return true;
  32533. },
  32534. args: [],
  32535. source: "requiresSmalltalkContext\x0a\x09^ true",
  32536. referencedClasses: [],
  32537. messageSends: []
  32538. }),
  32539. $globals.SendNode);
  32540. $core.addMethod(
  32541. $core.method({
  32542. selector: "selector",
  32543. protocol: 'accessing',
  32544. fn: function (){
  32545. var self=this;
  32546. return self["@selector"];
  32547. },
  32548. args: [],
  32549. source: "selector\x0a\x09^ selector",
  32550. referencedClasses: [],
  32551. messageSends: []
  32552. }),
  32553. $globals.SendNode);
  32554. $core.addMethod(
  32555. $core.method({
  32556. selector: "selector:",
  32557. protocol: 'accessing',
  32558. fn: function (aString){
  32559. var self=this;
  32560. self["@selector"]=aString;
  32561. return self;
  32562. },
  32563. args: ["aString"],
  32564. source: "selector: aString\x0a\x09selector := aString",
  32565. referencedClasses: [],
  32566. messageSends: []
  32567. }),
  32568. $globals.SendNode);
  32569. $core.addMethod(
  32570. $core.method({
  32571. selector: "shouldBeAliased",
  32572. protocol: 'testing',
  32573. fn: function (){
  32574. var self=this;
  32575. var sends;
  32576. return $core.withContext(function($ctx1) {
  32577. var $2,$1;
  32578. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  32579. $2=(
  32580. $ctx1.supercall = true,
  32581. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  32582. $ctx1.supercall = false;
  32583. $1=$recv($2)._or_((function(){
  32584. return $core.withContext(function($ctx2) {
  32585. return $recv(self._isReferenced())._and_((function(){
  32586. return $core.withContext(function($ctx3) {
  32587. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  32588. return $core.withContext(function($ctx4) {
  32589. return $recv(self._index()).__lt(sends);
  32590. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  32591. })))._or_((function(){
  32592. return $core.withContext(function($ctx4) {
  32593. return self._superSend();
  32594. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  32595. }));
  32596. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32597. }));
  32598. $ctx2.sendIdx["and:"]=1;
  32599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32600. }));
  32601. $ctx1.sendIdx["or:"]=1;
  32602. return $1;
  32603. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  32604. },
  32605. args: [],
  32606. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  32607. referencedClasses: [],
  32608. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  32609. }),
  32610. $globals.SendNode);
  32611. $core.addMethod(
  32612. $core.method({
  32613. selector: "superSend",
  32614. protocol: 'accessing',
  32615. fn: function (){
  32616. var self=this;
  32617. return $core.withContext(function($ctx1) {
  32618. return $recv($recv(self._receiver())._value()).__eq("super");
  32619. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32620. },
  32621. args: [],
  32622. source: "superSend\x0a\x09^ self receiver value = 'super'",
  32623. referencedClasses: [],
  32624. messageSends: ["=", "value", "receiver"]
  32625. }),
  32626. $globals.SendNode);
  32627. $core.addMethod(
  32628. $core.method({
  32629. selector: "valueForReceiver:",
  32630. protocol: 'building',
  32631. fn: function (anObject){
  32632. var self=this;
  32633. return $core.withContext(function($ctx1) {
  32634. var $1,$3,$2,$receiver;
  32635. $1=$recv($globals.SendNode)._new();
  32636. $recv($1)._position_(self._position());
  32637. $recv($1)._source_(self._source());
  32638. $3=self._receiver();
  32639. $ctx1.sendIdx["receiver"]=1;
  32640. if(($receiver = $3) == null || $receiver.isNil){
  32641. $2=anObject;
  32642. } else {
  32643. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  32644. };
  32645. $recv($1)._receiver_($2);
  32646. $recv($1)._selector_(self._selector());
  32647. $recv($1)._arguments_(self._arguments());
  32648. return $recv($1)._yourself();
  32649. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32650. },
  32651. args: ["anObject"],
  32652. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  32653. referencedClasses: ["SendNode"],
  32654. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32655. }),
  32656. $globals.SendNode);
  32657. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  32658. $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).";
  32659. $core.addMethod(
  32660. $core.method({
  32661. selector: "accept:",
  32662. protocol: 'visiting',
  32663. fn: function (aVisitor){
  32664. var self=this;
  32665. return $core.withContext(function($ctx1) {
  32666. return $recv(aVisitor)._visitSequenceNode_(self);
  32667. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32668. },
  32669. args: ["aVisitor"],
  32670. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32671. referencedClasses: [],
  32672. messageSends: ["visitSequenceNode:"]
  32673. }),
  32674. $globals.SequenceNode);
  32675. $core.addMethod(
  32676. $core.method({
  32677. selector: "asBlockSequenceNode",
  32678. protocol: 'building',
  32679. fn: function (){
  32680. var self=this;
  32681. return $core.withContext(function($ctx1) {
  32682. var $1;
  32683. $1=$recv($globals.BlockSequenceNode)._new();
  32684. $recv($1)._position_(self._position());
  32685. $recv($1)._source_(self._source());
  32686. $recv($1)._nodes_(self._nodes());
  32687. $recv($1)._temps_(self._temps());
  32688. return $recv($1)._yourself();
  32689. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32690. },
  32691. args: [],
  32692. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  32693. referencedClasses: ["BlockSequenceNode"],
  32694. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  32695. }),
  32696. $globals.SequenceNode);
  32697. $core.addMethod(
  32698. $core.method({
  32699. selector: "isSequenceNode",
  32700. protocol: 'testing',
  32701. fn: function (){
  32702. var self=this;
  32703. return true;
  32704. },
  32705. args: [],
  32706. source: "isSequenceNode\x0a\x09^ true",
  32707. referencedClasses: [],
  32708. messageSends: []
  32709. }),
  32710. $globals.SequenceNode);
  32711. $core.addMethod(
  32712. $core.method({
  32713. selector: "scope",
  32714. protocol: 'accessing',
  32715. fn: function (){
  32716. var self=this;
  32717. return self["@scope"];
  32718. },
  32719. args: [],
  32720. source: "scope\x0a\x09^ scope",
  32721. referencedClasses: [],
  32722. messageSends: []
  32723. }),
  32724. $globals.SequenceNode);
  32725. $core.addMethod(
  32726. $core.method({
  32727. selector: "scope:",
  32728. protocol: 'accessing',
  32729. fn: function (aLexicalScope){
  32730. var self=this;
  32731. self["@scope"]=aLexicalScope;
  32732. return self;
  32733. },
  32734. args: ["aLexicalScope"],
  32735. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32736. referencedClasses: [],
  32737. messageSends: []
  32738. }),
  32739. $globals.SequenceNode);
  32740. $core.addMethod(
  32741. $core.method({
  32742. selector: "temps",
  32743. protocol: 'accessing',
  32744. fn: function (){
  32745. var self=this;
  32746. return $core.withContext(function($ctx1) {
  32747. var $1,$receiver;
  32748. $1=self["@temps"];
  32749. if(($receiver = $1) == null || $receiver.isNil){
  32750. return [];
  32751. } else {
  32752. return $1;
  32753. };
  32754. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32755. },
  32756. args: [],
  32757. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32758. referencedClasses: [],
  32759. messageSends: ["ifNil:"]
  32760. }),
  32761. $globals.SequenceNode);
  32762. $core.addMethod(
  32763. $core.method({
  32764. selector: "temps:",
  32765. protocol: 'accessing',
  32766. fn: function (aCollection){
  32767. var self=this;
  32768. self["@temps"]=aCollection;
  32769. return self;
  32770. },
  32771. args: ["aCollection"],
  32772. source: "temps: aCollection\x0a\x09temps := aCollection",
  32773. referencedClasses: [],
  32774. messageSends: []
  32775. }),
  32776. $globals.SequenceNode);
  32777. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32778. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32779. $core.addMethod(
  32780. $core.method({
  32781. selector: "accept:",
  32782. protocol: 'visiting',
  32783. fn: function (aVisitor){
  32784. var self=this;
  32785. return $core.withContext(function($ctx1) {
  32786. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32787. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32788. },
  32789. args: ["aVisitor"],
  32790. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32791. referencedClasses: [],
  32792. messageSends: ["visitBlockSequenceNode:"]
  32793. }),
  32794. $globals.BlockSequenceNode);
  32795. $core.addMethod(
  32796. $core.method({
  32797. selector: "isBlockSequenceNode",
  32798. protocol: 'testing',
  32799. fn: function (){
  32800. var self=this;
  32801. return true;
  32802. },
  32803. args: [],
  32804. source: "isBlockSequenceNode\x0a\x09^ true",
  32805. referencedClasses: [],
  32806. messageSends: []
  32807. }),
  32808. $globals.BlockSequenceNode);
  32809. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  32810. $globals.ValueNode.comment="I represent a value node.";
  32811. $core.addMethod(
  32812. $core.method({
  32813. selector: "accept:",
  32814. protocol: 'visiting',
  32815. fn: function (aVisitor){
  32816. var self=this;
  32817. return $core.withContext(function($ctx1) {
  32818. return $recv(aVisitor)._visitValueNode_(self);
  32819. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  32820. },
  32821. args: ["aVisitor"],
  32822. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32823. referencedClasses: [],
  32824. messageSends: ["visitValueNode:"]
  32825. }),
  32826. $globals.ValueNode);
  32827. $core.addMethod(
  32828. $core.method({
  32829. selector: "isImmutable",
  32830. protocol: 'testing',
  32831. fn: function (){
  32832. var self=this;
  32833. return $core.withContext(function($ctx1) {
  32834. return $recv(self._value())._isImmutable();
  32835. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32836. },
  32837. args: [],
  32838. source: "isImmutable\x0a\x09^ self value isImmutable",
  32839. referencedClasses: [],
  32840. messageSends: ["isImmutable", "value"]
  32841. }),
  32842. $globals.ValueNode);
  32843. $core.addMethod(
  32844. $core.method({
  32845. selector: "isValueNode",
  32846. protocol: 'testing',
  32847. fn: function (){
  32848. var self=this;
  32849. return true;
  32850. },
  32851. args: [],
  32852. source: "isValueNode\x0a\x09^ true",
  32853. referencedClasses: [],
  32854. messageSends: []
  32855. }),
  32856. $globals.ValueNode);
  32857. $core.addMethod(
  32858. $core.method({
  32859. selector: "value",
  32860. protocol: 'accessing',
  32861. fn: function (){
  32862. var self=this;
  32863. return self["@value"];
  32864. },
  32865. args: [],
  32866. source: "value\x0a\x09^ value",
  32867. referencedClasses: [],
  32868. messageSends: []
  32869. }),
  32870. $globals.ValueNode);
  32871. $core.addMethod(
  32872. $core.method({
  32873. selector: "value:",
  32874. protocol: 'accessing',
  32875. fn: function (anObject){
  32876. var self=this;
  32877. self["@value"]=anObject;
  32878. return self;
  32879. },
  32880. args: ["anObject"],
  32881. source: "value: anObject\x0a\x09value := anObject",
  32882. referencedClasses: [],
  32883. messageSends: []
  32884. }),
  32885. $globals.ValueNode);
  32886. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32887. $globals.VariableNode.comment="I represent an variable node.";
  32888. $core.addMethod(
  32889. $core.method({
  32890. selector: "accept:",
  32891. protocol: 'visiting',
  32892. fn: function (aVisitor){
  32893. var self=this;
  32894. return $core.withContext(function($ctx1) {
  32895. return $recv(aVisitor)._visitVariableNode_(self);
  32896. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  32897. },
  32898. args: ["aVisitor"],
  32899. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32900. referencedClasses: [],
  32901. messageSends: ["visitVariableNode:"]
  32902. }),
  32903. $globals.VariableNode);
  32904. $core.addMethod(
  32905. $core.method({
  32906. selector: "alias",
  32907. protocol: 'accessing',
  32908. fn: function (){
  32909. var self=this;
  32910. return $core.withContext(function($ctx1) {
  32911. return $recv(self._binding())._alias();
  32912. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32913. },
  32914. args: [],
  32915. source: "alias\x0a\x09^ self binding alias",
  32916. referencedClasses: [],
  32917. messageSends: ["alias", "binding"]
  32918. }),
  32919. $globals.VariableNode);
  32920. $core.addMethod(
  32921. $core.method({
  32922. selector: "assigned",
  32923. protocol: 'accessing',
  32924. fn: function (){
  32925. var self=this;
  32926. return $core.withContext(function($ctx1) {
  32927. var $1,$receiver;
  32928. $1=self["@assigned"];
  32929. if(($receiver = $1) == null || $receiver.isNil){
  32930. return false;
  32931. } else {
  32932. return $1;
  32933. };
  32934. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32935. },
  32936. args: [],
  32937. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32938. referencedClasses: [],
  32939. messageSends: ["ifNil:"]
  32940. }),
  32941. $globals.VariableNode);
  32942. $core.addMethod(
  32943. $core.method({
  32944. selector: "assigned:",
  32945. protocol: 'accessing',
  32946. fn: function (aBoolean){
  32947. var self=this;
  32948. self["@assigned"]=aBoolean;
  32949. return self;
  32950. },
  32951. args: ["aBoolean"],
  32952. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32953. referencedClasses: [],
  32954. messageSends: []
  32955. }),
  32956. $globals.VariableNode);
  32957. $core.addMethod(
  32958. $core.method({
  32959. selector: "beAssigned",
  32960. protocol: 'accessing',
  32961. fn: function (){
  32962. var self=this;
  32963. return $core.withContext(function($ctx1) {
  32964. $recv(self._binding())._validateAssignment();
  32965. self["@assigned"]=true;
  32966. return self;
  32967. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32968. },
  32969. args: [],
  32970. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32971. referencedClasses: [],
  32972. messageSends: ["validateAssignment", "binding"]
  32973. }),
  32974. $globals.VariableNode);
  32975. $core.addMethod(
  32976. $core.method({
  32977. selector: "binding",
  32978. protocol: 'accessing',
  32979. fn: function (){
  32980. var self=this;
  32981. return self["@binding"];
  32982. },
  32983. args: [],
  32984. source: "binding\x0a\x09^ binding",
  32985. referencedClasses: [],
  32986. messageSends: []
  32987. }),
  32988. $globals.VariableNode);
  32989. $core.addMethod(
  32990. $core.method({
  32991. selector: "binding:",
  32992. protocol: 'accessing',
  32993. fn: function (aScopeVar){
  32994. var self=this;
  32995. self["@binding"]=aScopeVar;
  32996. return self;
  32997. },
  32998. args: ["aScopeVar"],
  32999. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33000. referencedClasses: [],
  33001. messageSends: []
  33002. }),
  33003. $globals.VariableNode);
  33004. $core.addMethod(
  33005. $core.method({
  33006. selector: "isArgument",
  33007. protocol: 'testing',
  33008. fn: function (){
  33009. var self=this;
  33010. return $core.withContext(function($ctx1) {
  33011. return $recv(self._binding())._isArgVar();
  33012. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33013. },
  33014. args: [],
  33015. source: "isArgument\x0a\x09^ self binding isArgVar",
  33016. referencedClasses: [],
  33017. messageSends: ["isArgVar", "binding"]
  33018. }),
  33019. $globals.VariableNode);
  33020. $core.addMethod(
  33021. $core.method({
  33022. selector: "isImmutable",
  33023. protocol: 'testing',
  33024. fn: function (){
  33025. var self=this;
  33026. return $core.withContext(function($ctx1) {
  33027. return $recv(self._binding())._isImmutable();
  33028. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33029. },
  33030. args: [],
  33031. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33032. referencedClasses: [],
  33033. messageSends: ["isImmutable", "binding"]
  33034. }),
  33035. $globals.VariableNode);
  33036. $core.addMethod(
  33037. $core.method({
  33038. selector: "isNavigationNode",
  33039. protocol: 'testing',
  33040. fn: function (){
  33041. var self=this;
  33042. return true;
  33043. },
  33044. args: [],
  33045. source: "isNavigationNode\x0a\x09^ true",
  33046. referencedClasses: [],
  33047. messageSends: []
  33048. }),
  33049. $globals.VariableNode);
  33050. $core.addMethod(
  33051. $core.method({
  33052. selector: "isVariableNode",
  33053. protocol: 'testing',
  33054. fn: function (){
  33055. var self=this;
  33056. return true;
  33057. },
  33058. args: [],
  33059. source: "isVariableNode\x0a\x09^ true",
  33060. referencedClasses: [],
  33061. messageSends: []
  33062. }),
  33063. $globals.VariableNode);
  33064. $core.addMethod(
  33065. $core.method({
  33066. selector: "navigationLink",
  33067. protocol: 'accessing',
  33068. fn: function (){
  33069. var self=this;
  33070. return $core.withContext(function($ctx1) {
  33071. return self._value();
  33072. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33073. },
  33074. args: [],
  33075. source: "navigationLink\x0a\x09^ self value",
  33076. referencedClasses: [],
  33077. messageSends: ["value"]
  33078. }),
  33079. $globals.VariableNode);
  33080. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  33081. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  33082. $core.addMethod(
  33083. $core.method({
  33084. selector: "visit:",
  33085. protocol: 'visiting',
  33086. fn: function (aNode){
  33087. var self=this;
  33088. return $core.withContext(function($ctx1) {
  33089. return $recv(aNode)._accept_(self);
  33090. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  33091. },
  33092. args: ["aNode"],
  33093. source: "visit: aNode\x0a\x09^ aNode accept: self",
  33094. referencedClasses: [],
  33095. messageSends: ["accept:"]
  33096. }),
  33097. $globals.NodeVisitor);
  33098. $core.addMethod(
  33099. $core.method({
  33100. selector: "visitAll:",
  33101. protocol: 'visiting',
  33102. fn: function (aCollection){
  33103. var self=this;
  33104. return $core.withContext(function($ctx1) {
  33105. return $recv(aCollection)._collect_((function(each){
  33106. return $core.withContext(function($ctx2) {
  33107. return self._visit_(each);
  33108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33109. }));
  33110. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  33111. },
  33112. args: ["aCollection"],
  33113. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  33114. referencedClasses: [],
  33115. messageSends: ["collect:", "visit:"]
  33116. }),
  33117. $globals.NodeVisitor);
  33118. $core.addMethod(
  33119. $core.method({
  33120. selector: "visitAssignmentNode:",
  33121. protocol: 'visiting',
  33122. fn: function (aNode){
  33123. var self=this;
  33124. return $core.withContext(function($ctx1) {
  33125. return self._visitNode_(aNode);
  33126. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  33127. },
  33128. args: ["aNode"],
  33129. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  33130. referencedClasses: [],
  33131. messageSends: ["visitNode:"]
  33132. }),
  33133. $globals.NodeVisitor);
  33134. $core.addMethod(
  33135. $core.method({
  33136. selector: "visitBlockNode:",
  33137. protocol: 'visiting',
  33138. fn: function (aNode){
  33139. var self=this;
  33140. return $core.withContext(function($ctx1) {
  33141. return self._visitNode_(aNode);
  33142. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  33143. },
  33144. args: ["aNode"],
  33145. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  33146. referencedClasses: [],
  33147. messageSends: ["visitNode:"]
  33148. }),
  33149. $globals.NodeVisitor);
  33150. $core.addMethod(
  33151. $core.method({
  33152. selector: "visitBlockSequenceNode:",
  33153. protocol: 'visiting',
  33154. fn: function (aNode){
  33155. var self=this;
  33156. return $core.withContext(function($ctx1) {
  33157. return self._visitSequenceNode_(aNode);
  33158. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33159. },
  33160. args: ["aNode"],
  33161. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  33162. referencedClasses: [],
  33163. messageSends: ["visitSequenceNode:"]
  33164. }),
  33165. $globals.NodeVisitor);
  33166. $core.addMethod(
  33167. $core.method({
  33168. selector: "visitCascadeNode:",
  33169. protocol: 'visiting',
  33170. fn: function (aNode){
  33171. var self=this;
  33172. return $core.withContext(function($ctx1) {
  33173. return self._visitNode_(aNode);
  33174. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  33175. },
  33176. args: ["aNode"],
  33177. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  33178. referencedClasses: [],
  33179. messageSends: ["visitNode:"]
  33180. }),
  33181. $globals.NodeVisitor);
  33182. $core.addMethod(
  33183. $core.method({
  33184. selector: "visitDynamicArrayNode:",
  33185. protocol: 'visiting',
  33186. fn: function (aNode){
  33187. var self=this;
  33188. return $core.withContext(function($ctx1) {
  33189. return self._visitNode_(aNode);
  33190. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33191. },
  33192. args: ["aNode"],
  33193. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  33194. referencedClasses: [],
  33195. messageSends: ["visitNode:"]
  33196. }),
  33197. $globals.NodeVisitor);
  33198. $core.addMethod(
  33199. $core.method({
  33200. selector: "visitDynamicDictionaryNode:",
  33201. protocol: 'visiting',
  33202. fn: function (aNode){
  33203. var self=this;
  33204. return $core.withContext(function($ctx1) {
  33205. return self._visitNode_(aNode);
  33206. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33207. },
  33208. args: ["aNode"],
  33209. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  33210. referencedClasses: [],
  33211. messageSends: ["visitNode:"]
  33212. }),
  33213. $globals.NodeVisitor);
  33214. $core.addMethod(
  33215. $core.method({
  33216. selector: "visitJSStatementNode:",
  33217. protocol: 'visiting',
  33218. fn: function (aNode){
  33219. var self=this;
  33220. return $core.withContext(function($ctx1) {
  33221. return self._visitNode_(aNode);
  33222. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33223. },
  33224. args: ["aNode"],
  33225. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  33226. referencedClasses: [],
  33227. messageSends: ["visitNode:"]
  33228. }),
  33229. $globals.NodeVisitor);
  33230. $core.addMethod(
  33231. $core.method({
  33232. selector: "visitMethodNode:",
  33233. protocol: 'visiting',
  33234. fn: function (aNode){
  33235. var self=this;
  33236. return $core.withContext(function($ctx1) {
  33237. return self._visitNode_(aNode);
  33238. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33239. },
  33240. args: ["aNode"],
  33241. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  33242. referencedClasses: [],
  33243. messageSends: ["visitNode:"]
  33244. }),
  33245. $globals.NodeVisitor);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "visitNode:",
  33249. protocol: 'visiting',
  33250. fn: function (aNode){
  33251. var self=this;
  33252. return $core.withContext(function($ctx1) {
  33253. return self._visitAll_($recv(aNode)._nodes());
  33254. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  33255. },
  33256. args: ["aNode"],
  33257. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  33258. referencedClasses: [],
  33259. messageSends: ["visitAll:", "nodes"]
  33260. }),
  33261. $globals.NodeVisitor);
  33262. $core.addMethod(
  33263. $core.method({
  33264. selector: "visitReturnNode:",
  33265. protocol: 'visiting',
  33266. fn: function (aNode){
  33267. var self=this;
  33268. return $core.withContext(function($ctx1) {
  33269. return self._visitNode_(aNode);
  33270. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33271. },
  33272. args: ["aNode"],
  33273. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  33274. referencedClasses: [],
  33275. messageSends: ["visitNode:"]
  33276. }),
  33277. $globals.NodeVisitor);
  33278. $core.addMethod(
  33279. $core.method({
  33280. selector: "visitSendNode:",
  33281. protocol: 'visiting',
  33282. fn: function (aNode){
  33283. var self=this;
  33284. return $core.withContext(function($ctx1) {
  33285. return self._visitNode_(aNode);
  33286. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33287. },
  33288. args: ["aNode"],
  33289. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  33290. referencedClasses: [],
  33291. messageSends: ["visitNode:"]
  33292. }),
  33293. $globals.NodeVisitor);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "visitSequenceNode:",
  33297. protocol: 'visiting',
  33298. fn: function (aNode){
  33299. var self=this;
  33300. return $core.withContext(function($ctx1) {
  33301. return self._visitNode_(aNode);
  33302. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33303. },
  33304. args: ["aNode"],
  33305. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  33306. referencedClasses: [],
  33307. messageSends: ["visitNode:"]
  33308. }),
  33309. $globals.NodeVisitor);
  33310. $core.addMethod(
  33311. $core.method({
  33312. selector: "visitValueNode:",
  33313. protocol: 'visiting',
  33314. fn: function (aNode){
  33315. var self=this;
  33316. return $core.withContext(function($ctx1) {
  33317. return self._visitNode_(aNode);
  33318. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33319. },
  33320. args: ["aNode"],
  33321. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  33322. referencedClasses: [],
  33323. messageSends: ["visitNode:"]
  33324. }),
  33325. $globals.NodeVisitor);
  33326. $core.addMethod(
  33327. $core.method({
  33328. selector: "visitVariableNode:",
  33329. protocol: 'visiting',
  33330. fn: function (aNode){
  33331. var self=this;
  33332. return $core.withContext(function($ctx1) {
  33333. return self._visitNode_(aNode);
  33334. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33335. },
  33336. args: ["aNode"],
  33337. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  33338. referencedClasses: [],
  33339. messageSends: ["visitNode:"]
  33340. }),
  33341. $globals.NodeVisitor);
  33342. $core.addMethod(
  33343. $core.method({
  33344. selector: "ast",
  33345. protocol: '*Compiler-AST',
  33346. fn: function (){
  33347. var self=this;
  33348. return $core.withContext(function($ctx1) {
  33349. var $1;
  33350. $1=self._source();
  33351. $ctx1.sendIdx["source"]=1;
  33352. $recv($1)._ifEmpty_((function(){
  33353. return $core.withContext(function($ctx2) {
  33354. return self._error_("Method source is empty");
  33355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33356. }));
  33357. return $recv($globals.Smalltalk)._parse_(self._source());
  33358. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33359. },
  33360. args: [],
  33361. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33362. referencedClasses: ["Smalltalk"],
  33363. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33364. }),
  33365. $globals.CompiledMethod);
  33366. $core.addMethod(
  33367. $core.method({
  33368. selector: "isNode",
  33369. protocol: '*Compiler-AST',
  33370. fn: function (){
  33371. var self=this;
  33372. return false;
  33373. },
  33374. args: [],
  33375. source: "isNode\x0a\x09^ false",
  33376. referencedClasses: [],
  33377. messageSends: []
  33378. }),
  33379. $globals.Object);
  33380. });
  33381. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
  33382. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  33383. $core.addPackage('Compiler-Semantic');
  33384. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33385. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33386. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33387. $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.";
  33388. $core.addMethod(
  33389. $core.method({
  33390. selector: "addArg:",
  33391. protocol: 'adding',
  33392. fn: function (aString){
  33393. var self=this;
  33394. return $core.withContext(function($ctx1) {
  33395. var $1;
  33396. $1=self._args();
  33397. $ctx1.sendIdx["args"]=1;
  33398. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33399. $recv($recv(self._args())._at_(aString))._scope_(self);
  33400. return self;
  33401. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33402. },
  33403. args: ["aString"],
  33404. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33405. referencedClasses: ["ArgVar"],
  33406. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33407. }),
  33408. $globals.LexicalScope);
  33409. $core.addMethod(
  33410. $core.method({
  33411. selector: "addTemp:",
  33412. protocol: 'adding',
  33413. fn: function (aString){
  33414. var self=this;
  33415. return $core.withContext(function($ctx1) {
  33416. var $1;
  33417. $1=self._temps();
  33418. $ctx1.sendIdx["temps"]=1;
  33419. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33420. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33421. return self;
  33422. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33423. },
  33424. args: ["aString"],
  33425. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33426. referencedClasses: ["TempVar"],
  33427. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33428. }),
  33429. $globals.LexicalScope);
  33430. $core.addMethod(
  33431. $core.method({
  33432. selector: "alias",
  33433. protocol: 'accessing',
  33434. fn: function (){
  33435. var self=this;
  33436. return $core.withContext(function($ctx1) {
  33437. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33438. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33439. },
  33440. args: [],
  33441. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33442. referencedClasses: [],
  33443. messageSends: [",", "asString", "scopeLevel"]
  33444. }),
  33445. $globals.LexicalScope);
  33446. $core.addMethod(
  33447. $core.method({
  33448. selector: "allVariableNames",
  33449. protocol: 'accessing',
  33450. fn: function (){
  33451. var self=this;
  33452. return $core.withContext(function($ctx1) {
  33453. var $1;
  33454. $1=$recv(self._args())._keys();
  33455. $ctx1.sendIdx["keys"]=1;
  33456. return $recv($1).__comma($recv(self._temps())._keys());
  33457. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33458. },
  33459. args: [],
  33460. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33461. referencedClasses: [],
  33462. messageSends: [",", "keys", "args", "temps"]
  33463. }),
  33464. $globals.LexicalScope);
  33465. $core.addMethod(
  33466. $core.method({
  33467. selector: "args",
  33468. protocol: 'accessing',
  33469. fn: function (){
  33470. var self=this;
  33471. return $core.withContext(function($ctx1) {
  33472. var $1,$receiver;
  33473. $1=self["@args"];
  33474. if(($receiver = $1) == null || $receiver.isNil){
  33475. self["@args"]=$recv($globals.Dictionary)._new();
  33476. return self["@args"];
  33477. } else {
  33478. return $1;
  33479. };
  33480. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33481. },
  33482. args: [],
  33483. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33484. referencedClasses: ["Dictionary"],
  33485. messageSends: ["ifNil:", "new"]
  33486. }),
  33487. $globals.LexicalScope);
  33488. $core.addMethod(
  33489. $core.method({
  33490. selector: "bindingFor:",
  33491. protocol: 'accessing',
  33492. fn: function (aStringOrNode){
  33493. var self=this;
  33494. return $core.withContext(function($ctx1) {
  33495. var $2,$3,$4,$5,$1;
  33496. $2=self._pseudoVars();
  33497. $3=$recv(aStringOrNode)._value();
  33498. $ctx1.sendIdx["value"]=1;
  33499. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33500. return $core.withContext(function($ctx2) {
  33501. $4=self._args();
  33502. $5=$recv(aStringOrNode)._value();
  33503. $ctx2.sendIdx["value"]=2;
  33504. return $recv($4)._at_ifAbsent_($5,(function(){
  33505. return $core.withContext(function($ctx3) {
  33506. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33507. return nil;
  33508. }));
  33509. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33510. }));
  33511. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33513. }));
  33514. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33515. return $1;
  33516. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33517. },
  33518. args: ["aStringOrNode"],
  33519. 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 ]]]",
  33520. referencedClasses: [],
  33521. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33522. }),
  33523. $globals.LexicalScope);
  33524. $core.addMethod(
  33525. $core.method({
  33526. selector: "blockIndex",
  33527. protocol: 'accessing',
  33528. fn: function (){
  33529. var self=this;
  33530. return $core.withContext(function($ctx1) {
  33531. var $1,$receiver;
  33532. $1=self["@blockIndex"];
  33533. if(($receiver = $1) == null || $receiver.isNil){
  33534. return (0);
  33535. } else {
  33536. return $1;
  33537. };
  33538. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33539. },
  33540. args: [],
  33541. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33542. referencedClasses: [],
  33543. messageSends: ["ifNil:"]
  33544. }),
  33545. $globals.LexicalScope);
  33546. $core.addMethod(
  33547. $core.method({
  33548. selector: "blockIndex:",
  33549. protocol: 'accessing',
  33550. fn: function (anInteger){
  33551. var self=this;
  33552. self["@blockIndex"]=anInteger;
  33553. return self;
  33554. },
  33555. args: ["anInteger"],
  33556. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33557. referencedClasses: [],
  33558. messageSends: []
  33559. }),
  33560. $globals.LexicalScope);
  33561. $core.addMethod(
  33562. $core.method({
  33563. selector: "canInlineNonLocalReturns",
  33564. protocol: 'testing',
  33565. fn: function (){
  33566. var self=this;
  33567. return $core.withContext(function($ctx1) {
  33568. return $recv(self._isInlined())._and_((function(){
  33569. return $core.withContext(function($ctx2) {
  33570. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33572. }));
  33573. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33574. },
  33575. args: [],
  33576. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33577. referencedClasses: [],
  33578. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33579. }),
  33580. $globals.LexicalScope);
  33581. $core.addMethod(
  33582. $core.method({
  33583. selector: "instruction",
  33584. protocol: 'accessing',
  33585. fn: function (){
  33586. var self=this;
  33587. return self["@instruction"];
  33588. },
  33589. args: [],
  33590. source: "instruction\x0a\x09^ instruction",
  33591. referencedClasses: [],
  33592. messageSends: []
  33593. }),
  33594. $globals.LexicalScope);
  33595. $core.addMethod(
  33596. $core.method({
  33597. selector: "instruction:",
  33598. protocol: 'accessing',
  33599. fn: function (anIRInstruction){
  33600. var self=this;
  33601. self["@instruction"]=anIRInstruction;
  33602. return self;
  33603. },
  33604. args: ["anIRInstruction"],
  33605. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33606. referencedClasses: [],
  33607. messageSends: []
  33608. }),
  33609. $globals.LexicalScope);
  33610. $core.addMethod(
  33611. $core.method({
  33612. selector: "isBlockScope",
  33613. protocol: 'testing',
  33614. fn: function (){
  33615. var self=this;
  33616. return $core.withContext(function($ctx1) {
  33617. return $recv(self._isMethodScope())._not();
  33618. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33619. },
  33620. args: [],
  33621. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33622. referencedClasses: [],
  33623. messageSends: ["not", "isMethodScope"]
  33624. }),
  33625. $globals.LexicalScope);
  33626. $core.addMethod(
  33627. $core.method({
  33628. selector: "isInlined",
  33629. protocol: 'testing',
  33630. fn: function (){
  33631. var self=this;
  33632. return $core.withContext(function($ctx1) {
  33633. var $2,$1;
  33634. $2=self._instruction();
  33635. $ctx1.sendIdx["instruction"]=1;
  33636. $1=$recv($2)._notNil();
  33637. return $recv($1)._and_((function(){
  33638. return $core.withContext(function($ctx2) {
  33639. return $recv(self._instruction())._isInlined();
  33640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33641. }));
  33642. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33643. },
  33644. args: [],
  33645. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33646. referencedClasses: [],
  33647. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33648. }),
  33649. $globals.LexicalScope);
  33650. $core.addMethod(
  33651. $core.method({
  33652. selector: "isMethodScope",
  33653. protocol: 'testing',
  33654. fn: function (){
  33655. var self=this;
  33656. return false;
  33657. },
  33658. args: [],
  33659. source: "isMethodScope\x0a\x09^ false",
  33660. referencedClasses: [],
  33661. messageSends: []
  33662. }),
  33663. $globals.LexicalScope);
  33664. $core.addMethod(
  33665. $core.method({
  33666. selector: "lookupVariable:",
  33667. protocol: 'accessing',
  33668. fn: function (aNode){
  33669. var self=this;
  33670. var lookup;
  33671. return $core.withContext(function($ctx1) {
  33672. var $1,$2,$receiver;
  33673. lookup=self._bindingFor_(aNode);
  33674. $1=lookup;
  33675. if(($receiver = $1) == null || $receiver.isNil){
  33676. $2=self._outerScope();
  33677. $ctx1.sendIdx["outerScope"]=1;
  33678. if(($receiver = $2) == null || $receiver.isNil){
  33679. lookup=$2;
  33680. } else {
  33681. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33682. };
  33683. lookup;
  33684. } else {
  33685. $1;
  33686. };
  33687. return lookup;
  33688. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33689. },
  33690. args: ["aNode"],
  33691. 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",
  33692. referencedClasses: [],
  33693. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33694. }),
  33695. $globals.LexicalScope);
  33696. $core.addMethod(
  33697. $core.method({
  33698. selector: "methodScope",
  33699. protocol: 'accessing',
  33700. fn: function (){
  33701. var self=this;
  33702. return $core.withContext(function($ctx1) {
  33703. var $1,$receiver;
  33704. $1=self._outerScope();
  33705. $ctx1.sendIdx["outerScope"]=1;
  33706. if(($receiver = $1) == null || $receiver.isNil){
  33707. return $1;
  33708. } else {
  33709. return $recv(self._outerScope())._methodScope();
  33710. };
  33711. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33712. },
  33713. args: [],
  33714. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33715. referencedClasses: [],
  33716. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33717. }),
  33718. $globals.LexicalScope);
  33719. $core.addMethod(
  33720. $core.method({
  33721. selector: "node",
  33722. protocol: 'accessing',
  33723. fn: function (){
  33724. var self=this;
  33725. return self["@node"];
  33726. },
  33727. args: [],
  33728. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33729. referencedClasses: [],
  33730. messageSends: []
  33731. }),
  33732. $globals.LexicalScope);
  33733. $core.addMethod(
  33734. $core.method({
  33735. selector: "node:",
  33736. protocol: 'accessing',
  33737. fn: function (aNode){
  33738. var self=this;
  33739. self["@node"]=aNode;
  33740. return self;
  33741. },
  33742. args: ["aNode"],
  33743. source: "node: aNode\x0a\x09node := aNode",
  33744. referencedClasses: [],
  33745. messageSends: []
  33746. }),
  33747. $globals.LexicalScope);
  33748. $core.addMethod(
  33749. $core.method({
  33750. selector: "outerScope",
  33751. protocol: 'accessing',
  33752. fn: function (){
  33753. var self=this;
  33754. return self["@outerScope"];
  33755. },
  33756. args: [],
  33757. source: "outerScope\x0a\x09^ outerScope",
  33758. referencedClasses: [],
  33759. messageSends: []
  33760. }),
  33761. $globals.LexicalScope);
  33762. $core.addMethod(
  33763. $core.method({
  33764. selector: "outerScope:",
  33765. protocol: 'accessing',
  33766. fn: function (aLexicalScope){
  33767. var self=this;
  33768. self["@outerScope"]=aLexicalScope;
  33769. return self;
  33770. },
  33771. args: ["aLexicalScope"],
  33772. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33773. referencedClasses: [],
  33774. messageSends: []
  33775. }),
  33776. $globals.LexicalScope);
  33777. $core.addMethod(
  33778. $core.method({
  33779. selector: "pseudoVars",
  33780. protocol: 'accessing',
  33781. fn: function (){
  33782. var self=this;
  33783. return $core.withContext(function($ctx1) {
  33784. return $recv(self._methodScope())._pseudoVars();
  33785. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33786. },
  33787. args: [],
  33788. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33789. referencedClasses: [],
  33790. messageSends: ["pseudoVars", "methodScope"]
  33791. }),
  33792. $globals.LexicalScope);
  33793. $core.addMethod(
  33794. $core.method({
  33795. selector: "scopeLevel",
  33796. protocol: 'accessing',
  33797. fn: function (){
  33798. var self=this;
  33799. return $core.withContext(function($ctx1) {
  33800. var $1,$2,$4,$3,$receiver;
  33801. $1=self._outerScope();
  33802. $ctx1.sendIdx["outerScope"]=1;
  33803. if(($receiver = $1) == null || $receiver.isNil){
  33804. return (1);
  33805. } else {
  33806. $1;
  33807. };
  33808. $2=self._isInlined();
  33809. if($core.assert($2)){
  33810. $4=self._outerScope();
  33811. $ctx1.sendIdx["outerScope"]=2;
  33812. $3=$recv($4)._scopeLevel();
  33813. $ctx1.sendIdx["scopeLevel"]=1;
  33814. return $3;
  33815. };
  33816. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33817. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33818. },
  33819. args: [],
  33820. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33821. referencedClasses: [],
  33822. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33823. }),
  33824. $globals.LexicalScope);
  33825. $core.addMethod(
  33826. $core.method({
  33827. selector: "temps",
  33828. protocol: 'accessing',
  33829. fn: function (){
  33830. var self=this;
  33831. return $core.withContext(function($ctx1) {
  33832. var $1,$receiver;
  33833. $1=self["@temps"];
  33834. if(($receiver = $1) == null || $receiver.isNil){
  33835. self["@temps"]=$recv($globals.Dictionary)._new();
  33836. return self["@temps"];
  33837. } else {
  33838. return $1;
  33839. };
  33840. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33841. },
  33842. args: [],
  33843. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33844. referencedClasses: ["Dictionary"],
  33845. messageSends: ["ifNil:", "new"]
  33846. }),
  33847. $globals.LexicalScope);
  33848. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33849. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33850. $core.addMethod(
  33851. $core.method({
  33852. selector: "addIVar:",
  33853. protocol: 'adding',
  33854. fn: function (aString){
  33855. var self=this;
  33856. return $core.withContext(function($ctx1) {
  33857. var $1;
  33858. $1=self._iVars();
  33859. $ctx1.sendIdx["iVars"]=1;
  33860. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33861. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33862. return self;
  33863. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33864. },
  33865. args: ["aString"],
  33866. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33867. referencedClasses: ["InstanceVar"],
  33868. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33869. }),
  33870. $globals.MethodLexicalScope);
  33871. $core.addMethod(
  33872. $core.method({
  33873. selector: "addNonLocalReturn:",
  33874. protocol: 'adding',
  33875. fn: function (aScope){
  33876. var self=this;
  33877. return $core.withContext(function($ctx1) {
  33878. $recv(self._nonLocalReturns())._add_(aScope);
  33879. return self;
  33880. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33881. },
  33882. args: ["aScope"],
  33883. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33884. referencedClasses: [],
  33885. messageSends: ["add:", "nonLocalReturns"]
  33886. }),
  33887. $globals.MethodLexicalScope);
  33888. $core.addMethod(
  33889. $core.method({
  33890. selector: "allVariableNames",
  33891. protocol: 'accessing',
  33892. fn: function (){
  33893. var self=this;
  33894. return $core.withContext(function($ctx1) {
  33895. var $1;
  33896. $1=(
  33897. $ctx1.supercall = true,
  33898. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  33899. $ctx1.supercall = false;
  33900. return $recv($1).__comma($recv(self._iVars())._keys());
  33901. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33902. },
  33903. args: [],
  33904. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33905. referencedClasses: [],
  33906. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33907. }),
  33908. $globals.MethodLexicalScope);
  33909. $core.addMethod(
  33910. $core.method({
  33911. selector: "bindingFor:",
  33912. protocol: 'accessing',
  33913. fn: function (aNode){
  33914. var self=this;
  33915. return $core.withContext(function($ctx1) {
  33916. var $1,$receiver;
  33917. $1=(
  33918. $ctx1.supercall = true,
  33919. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33920. $ctx1.supercall = false;
  33921. if(($receiver = $1) == null || $receiver.isNil){
  33922. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33923. return nil;
  33924. }));
  33925. } else {
  33926. return $1;
  33927. };
  33928. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33929. },
  33930. args: ["aNode"],
  33931. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33932. referencedClasses: [],
  33933. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33934. }),
  33935. $globals.MethodLexicalScope);
  33936. $core.addMethod(
  33937. $core.method({
  33938. selector: "canInlineNonLocalReturns",
  33939. protocol: 'testing',
  33940. fn: function (){
  33941. var self=this;
  33942. return true;
  33943. },
  33944. args: [],
  33945. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33946. referencedClasses: [],
  33947. messageSends: []
  33948. }),
  33949. $globals.MethodLexicalScope);
  33950. $core.addMethod(
  33951. $core.method({
  33952. selector: "hasLocalReturn",
  33953. protocol: 'testing',
  33954. fn: function (){
  33955. var self=this;
  33956. return $core.withContext(function($ctx1) {
  33957. return self._localReturn();
  33958. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33959. },
  33960. args: [],
  33961. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33962. referencedClasses: [],
  33963. messageSends: ["localReturn"]
  33964. }),
  33965. $globals.MethodLexicalScope);
  33966. $core.addMethod(
  33967. $core.method({
  33968. selector: "hasNonLocalReturn",
  33969. protocol: 'testing',
  33970. fn: function (){
  33971. var self=this;
  33972. return $core.withContext(function($ctx1) {
  33973. return $recv(self._nonLocalReturns())._notEmpty();
  33974. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33975. },
  33976. args: [],
  33977. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33978. referencedClasses: [],
  33979. messageSends: ["notEmpty", "nonLocalReturns"]
  33980. }),
  33981. $globals.MethodLexicalScope);
  33982. $core.addMethod(
  33983. $core.method({
  33984. selector: "iVars",
  33985. protocol: 'accessing',
  33986. fn: function (){
  33987. var self=this;
  33988. return $core.withContext(function($ctx1) {
  33989. var $1,$receiver;
  33990. $1=self["@iVars"];
  33991. if(($receiver = $1) == null || $receiver.isNil){
  33992. self["@iVars"]=$recv($globals.Dictionary)._new();
  33993. return self["@iVars"];
  33994. } else {
  33995. return $1;
  33996. };
  33997. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33998. },
  33999. args: [],
  34000. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34001. referencedClasses: ["Dictionary"],
  34002. messageSends: ["ifNil:", "new"]
  34003. }),
  34004. $globals.MethodLexicalScope);
  34005. $core.addMethod(
  34006. $core.method({
  34007. selector: "isMethodScope",
  34008. protocol: 'testing',
  34009. fn: function (){
  34010. var self=this;
  34011. return true;
  34012. },
  34013. args: [],
  34014. source: "isMethodScope\x0a\x09^ true",
  34015. referencedClasses: [],
  34016. messageSends: []
  34017. }),
  34018. $globals.MethodLexicalScope);
  34019. $core.addMethod(
  34020. $core.method({
  34021. selector: "localReturn",
  34022. protocol: 'accessing',
  34023. fn: function (){
  34024. var self=this;
  34025. return $core.withContext(function($ctx1) {
  34026. var $1,$receiver;
  34027. $1=self["@localReturn"];
  34028. if(($receiver = $1) == null || $receiver.isNil){
  34029. return false;
  34030. } else {
  34031. return $1;
  34032. };
  34033. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34034. },
  34035. args: [],
  34036. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34037. referencedClasses: [],
  34038. messageSends: ["ifNil:"]
  34039. }),
  34040. $globals.MethodLexicalScope);
  34041. $core.addMethod(
  34042. $core.method({
  34043. selector: "localReturn:",
  34044. protocol: 'accessing',
  34045. fn: function (aBoolean){
  34046. var self=this;
  34047. self["@localReturn"]=aBoolean;
  34048. return self;
  34049. },
  34050. args: ["aBoolean"],
  34051. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34052. referencedClasses: [],
  34053. messageSends: []
  34054. }),
  34055. $globals.MethodLexicalScope);
  34056. $core.addMethod(
  34057. $core.method({
  34058. selector: "methodScope",
  34059. protocol: 'accessing',
  34060. fn: function (){
  34061. var self=this;
  34062. return self;
  34063. },
  34064. args: [],
  34065. source: "methodScope\x0a\x09^ self",
  34066. referencedClasses: [],
  34067. messageSends: []
  34068. }),
  34069. $globals.MethodLexicalScope);
  34070. $core.addMethod(
  34071. $core.method({
  34072. selector: "nonLocalReturns",
  34073. protocol: 'accessing',
  34074. fn: function (){
  34075. var self=this;
  34076. return $core.withContext(function($ctx1) {
  34077. var $1,$receiver;
  34078. $1=self["@nonLocalReturns"];
  34079. if(($receiver = $1) == null || $receiver.isNil){
  34080. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  34081. return self["@nonLocalReturns"];
  34082. } else {
  34083. return $1;
  34084. };
  34085. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34086. },
  34087. args: [],
  34088. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34089. referencedClasses: ["OrderedCollection"],
  34090. messageSends: ["ifNil:", "new"]
  34091. }),
  34092. $globals.MethodLexicalScope);
  34093. $core.addMethod(
  34094. $core.method({
  34095. selector: "pseudoVars",
  34096. protocol: 'accessing',
  34097. fn: function (){
  34098. var self=this;
  34099. return $core.withContext(function($ctx1) {
  34100. var $1,$2,$4,$3,$receiver;
  34101. $1=self["@pseudoVars"];
  34102. if(($receiver = $1) == null || $receiver.isNil){
  34103. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  34104. self["@pseudoVars"];
  34105. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  34106. return $core.withContext(function($ctx2) {
  34107. $2=self["@pseudoVars"];
  34108. $4=$recv($globals.PseudoVar)._on_(each);
  34109. $recv($4)._scope_(self._methodScope());
  34110. $3=$recv($4)._yourself();
  34111. return $recv($2)._at_put_(each,$3);
  34112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34113. }));
  34114. } else {
  34115. $1;
  34116. };
  34117. return self["@pseudoVars"];
  34118. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34119. },
  34120. args: [],
  34121. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  34122. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34123. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34124. }),
  34125. $globals.MethodLexicalScope);
  34126. $core.addMethod(
  34127. $core.method({
  34128. selector: "removeNonLocalReturn:",
  34129. protocol: 'adding',
  34130. fn: function (aScope){
  34131. var self=this;
  34132. return $core.withContext(function($ctx1) {
  34133. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34134. }));
  34135. return self;
  34136. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34137. },
  34138. args: ["aScope"],
  34139. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34140. referencedClasses: [],
  34141. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34142. }),
  34143. $globals.MethodLexicalScope);
  34144. $core.addMethod(
  34145. $core.method({
  34146. selector: "unknownVariables",
  34147. protocol: 'accessing',
  34148. fn: function (){
  34149. var self=this;
  34150. return $core.withContext(function($ctx1) {
  34151. var $1,$receiver;
  34152. $1=self["@unknownVariables"];
  34153. if(($receiver = $1) == null || $receiver.isNil){
  34154. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  34155. return self["@unknownVariables"];
  34156. } else {
  34157. return $1;
  34158. };
  34159. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34160. },
  34161. args: [],
  34162. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34163. referencedClasses: ["OrderedCollection"],
  34164. messageSends: ["ifNil:", "new"]
  34165. }),
  34166. $globals.MethodLexicalScope);
  34167. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34168. $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.";
  34169. $core.addMethod(
  34170. $core.method({
  34171. selector: "alias",
  34172. protocol: 'accessing',
  34173. fn: function (){
  34174. var self=this;
  34175. return $core.withContext(function($ctx1) {
  34176. return $recv(self._name())._asVariableName();
  34177. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34178. },
  34179. args: [],
  34180. source: "alias\x0a\x09^ self name asVariableName",
  34181. referencedClasses: [],
  34182. messageSends: ["asVariableName", "name"]
  34183. }),
  34184. $globals.ScopeVar);
  34185. $core.addMethod(
  34186. $core.method({
  34187. selector: "isArgVar",
  34188. protocol: 'testing',
  34189. fn: function (){
  34190. var self=this;
  34191. return false;
  34192. },
  34193. args: [],
  34194. source: "isArgVar\x0a\x09^ false",
  34195. referencedClasses: [],
  34196. messageSends: []
  34197. }),
  34198. $globals.ScopeVar);
  34199. $core.addMethod(
  34200. $core.method({
  34201. selector: "isClassRefVar",
  34202. protocol: 'testing',
  34203. fn: function (){
  34204. var self=this;
  34205. return false;
  34206. },
  34207. args: [],
  34208. source: "isClassRefVar\x0a\x09^ false",
  34209. referencedClasses: [],
  34210. messageSends: []
  34211. }),
  34212. $globals.ScopeVar);
  34213. $core.addMethod(
  34214. $core.method({
  34215. selector: "isImmutable",
  34216. protocol: 'testing',
  34217. fn: function (){
  34218. var self=this;
  34219. return false;
  34220. },
  34221. args: [],
  34222. source: "isImmutable\x0a\x09^ false",
  34223. referencedClasses: [],
  34224. messageSends: []
  34225. }),
  34226. $globals.ScopeVar);
  34227. $core.addMethod(
  34228. $core.method({
  34229. selector: "isInstanceVar",
  34230. protocol: 'testing',
  34231. fn: function (){
  34232. var self=this;
  34233. return false;
  34234. },
  34235. args: [],
  34236. source: "isInstanceVar\x0a\x09^ false",
  34237. referencedClasses: [],
  34238. messageSends: []
  34239. }),
  34240. $globals.ScopeVar);
  34241. $core.addMethod(
  34242. $core.method({
  34243. selector: "isPseudoVar",
  34244. protocol: 'testing',
  34245. fn: function (){
  34246. var self=this;
  34247. return false;
  34248. },
  34249. args: [],
  34250. source: "isPseudoVar\x0a\x09^ false",
  34251. referencedClasses: [],
  34252. messageSends: []
  34253. }),
  34254. $globals.ScopeVar);
  34255. $core.addMethod(
  34256. $core.method({
  34257. selector: "isTempVar",
  34258. protocol: 'testing',
  34259. fn: function (){
  34260. var self=this;
  34261. return false;
  34262. },
  34263. args: [],
  34264. source: "isTempVar\x0a\x09^ false",
  34265. referencedClasses: [],
  34266. messageSends: []
  34267. }),
  34268. $globals.ScopeVar);
  34269. $core.addMethod(
  34270. $core.method({
  34271. selector: "isUnknownVar",
  34272. protocol: 'testing',
  34273. fn: function (){
  34274. var self=this;
  34275. return false;
  34276. },
  34277. args: [],
  34278. source: "isUnknownVar\x0a\x09^ false",
  34279. referencedClasses: [],
  34280. messageSends: []
  34281. }),
  34282. $globals.ScopeVar);
  34283. $core.addMethod(
  34284. $core.method({
  34285. selector: "name",
  34286. protocol: 'accessing',
  34287. fn: function (){
  34288. var self=this;
  34289. return self["@name"];
  34290. },
  34291. args: [],
  34292. source: "name\x0a\x09^ name",
  34293. referencedClasses: [],
  34294. messageSends: []
  34295. }),
  34296. $globals.ScopeVar);
  34297. $core.addMethod(
  34298. $core.method({
  34299. selector: "name:",
  34300. protocol: 'accessing',
  34301. fn: function (aString){
  34302. var self=this;
  34303. self["@name"]=aString;
  34304. return self;
  34305. },
  34306. args: ["aString"],
  34307. source: "name: aString\x0a\x09name := aString",
  34308. referencedClasses: [],
  34309. messageSends: []
  34310. }),
  34311. $globals.ScopeVar);
  34312. $core.addMethod(
  34313. $core.method({
  34314. selector: "scope",
  34315. protocol: 'accessing',
  34316. fn: function (){
  34317. var self=this;
  34318. return self["@scope"];
  34319. },
  34320. args: [],
  34321. source: "scope\x0a\x09^ scope",
  34322. referencedClasses: [],
  34323. messageSends: []
  34324. }),
  34325. $globals.ScopeVar);
  34326. $core.addMethod(
  34327. $core.method({
  34328. selector: "scope:",
  34329. protocol: 'accessing',
  34330. fn: function (aScope){
  34331. var self=this;
  34332. self["@scope"]=aScope;
  34333. return self;
  34334. },
  34335. args: ["aScope"],
  34336. source: "scope: aScope\x0a\x09scope := aScope",
  34337. referencedClasses: [],
  34338. messageSends: []
  34339. }),
  34340. $globals.ScopeVar);
  34341. $core.addMethod(
  34342. $core.method({
  34343. selector: "validateAssignment",
  34344. protocol: 'testing',
  34345. fn: function (){
  34346. var self=this;
  34347. return $core.withContext(function($ctx1) {
  34348. var $1,$2;
  34349. $1=$recv(self._isArgVar())._or_((function(){
  34350. return $core.withContext(function($ctx2) {
  34351. return self._isPseudoVar();
  34352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34353. }));
  34354. if($core.assert($1)){
  34355. $2=$recv($globals.InvalidAssignmentError)._new();
  34356. $recv($2)._variableName_(self._name());
  34357. $recv($2)._signal();
  34358. };
  34359. return self;
  34360. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34361. },
  34362. args: [],
  34363. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34364. referencedClasses: ["InvalidAssignmentError"],
  34365. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34366. }),
  34367. $globals.ScopeVar);
  34368. $core.addMethod(
  34369. $core.method({
  34370. selector: "on:",
  34371. protocol: 'instance creation',
  34372. fn: function (aString){
  34373. var self=this;
  34374. return $core.withContext(function($ctx1) {
  34375. var $1;
  34376. $1=self._new();
  34377. $recv($1)._name_(aString);
  34378. return $recv($1)._yourself();
  34379. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34380. },
  34381. args: ["aString"],
  34382. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34383. referencedClasses: [],
  34384. messageSends: ["name:", "new", "yourself"]
  34385. }),
  34386. $globals.ScopeVar.klass);
  34387. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34388. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34389. $core.addMethod(
  34390. $core.method({
  34391. selector: "isImmutable",
  34392. protocol: 'testing',
  34393. fn: function (){
  34394. var self=this;
  34395. return true;
  34396. },
  34397. args: [],
  34398. source: "isImmutable\x0a\x09^ true",
  34399. referencedClasses: [],
  34400. messageSends: []
  34401. }),
  34402. $globals.AliasVar);
  34403. $core.addMethod(
  34404. $core.method({
  34405. selector: "node",
  34406. protocol: 'accessing',
  34407. fn: function (){
  34408. var self=this;
  34409. return self["@node"];
  34410. },
  34411. args: [],
  34412. source: "node\x0a\x09^ node",
  34413. referencedClasses: [],
  34414. messageSends: []
  34415. }),
  34416. $globals.AliasVar);
  34417. $core.addMethod(
  34418. $core.method({
  34419. selector: "node:",
  34420. protocol: 'accessing',
  34421. fn: function (aNode){
  34422. var self=this;
  34423. self["@node"]=aNode;
  34424. return self;
  34425. },
  34426. args: ["aNode"],
  34427. source: "node: aNode\x0a\x09node := aNode",
  34428. referencedClasses: [],
  34429. messageSends: []
  34430. }),
  34431. $globals.AliasVar);
  34432. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34433. $globals.ArgVar.comment="I am an argument of a method or block.";
  34434. $core.addMethod(
  34435. $core.method({
  34436. selector: "isArgVar",
  34437. protocol: 'testing',
  34438. fn: function (){
  34439. var self=this;
  34440. return true;
  34441. },
  34442. args: [],
  34443. source: "isArgVar\x0a\x09^ true",
  34444. referencedClasses: [],
  34445. messageSends: []
  34446. }),
  34447. $globals.ArgVar);
  34448. $core.addMethod(
  34449. $core.method({
  34450. selector: "isImmutable",
  34451. protocol: 'testing',
  34452. fn: function (){
  34453. var self=this;
  34454. return true;
  34455. },
  34456. args: [],
  34457. source: "isImmutable\x0a\x09^ true",
  34458. referencedClasses: [],
  34459. messageSends: []
  34460. }),
  34461. $globals.ArgVar);
  34462. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34463. $globals.ClassRefVar.comment="I am an class reference variable";
  34464. $core.addMethod(
  34465. $core.method({
  34466. selector: "alias",
  34467. protocol: 'accessing',
  34468. fn: function (){
  34469. var self=this;
  34470. return $core.withContext(function($ctx1) {
  34471. return "$globals.".__comma(self._name());
  34472. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34473. },
  34474. args: [],
  34475. 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",
  34476. referencedClasses: [],
  34477. messageSends: [",", "name"]
  34478. }),
  34479. $globals.ClassRefVar);
  34480. $core.addMethod(
  34481. $core.method({
  34482. selector: "isClassRefVar",
  34483. protocol: 'testing',
  34484. fn: function (){
  34485. var self=this;
  34486. return true;
  34487. },
  34488. args: [],
  34489. source: "isClassRefVar\x0a\x09^ true",
  34490. referencedClasses: [],
  34491. messageSends: []
  34492. }),
  34493. $globals.ClassRefVar);
  34494. $core.addMethod(
  34495. $core.method({
  34496. selector: "isImmutable",
  34497. protocol: 'testing',
  34498. fn: function (){
  34499. var self=this;
  34500. return true;
  34501. },
  34502. args: [],
  34503. source: "isImmutable\x0a\x09^ true",
  34504. referencedClasses: [],
  34505. messageSends: []
  34506. }),
  34507. $globals.ClassRefVar);
  34508. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34509. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34510. $core.addMethod(
  34511. $core.method({
  34512. selector: "alias",
  34513. protocol: 'testing',
  34514. fn: function (){
  34515. var self=this;
  34516. return $core.withContext(function($ctx1) {
  34517. var $1;
  34518. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34519. $ctx1.sendIdx[","]=1;
  34520. return $1;
  34521. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34522. },
  34523. args: [],
  34524. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34525. referencedClasses: [],
  34526. messageSends: [",", "name"]
  34527. }),
  34528. $globals.InstanceVar);
  34529. $core.addMethod(
  34530. $core.method({
  34531. selector: "isInstanceVar",
  34532. protocol: 'testing',
  34533. fn: function (){
  34534. var self=this;
  34535. return true;
  34536. },
  34537. args: [],
  34538. source: "isInstanceVar\x0a\x09^ true",
  34539. referencedClasses: [],
  34540. messageSends: []
  34541. }),
  34542. $globals.InstanceVar);
  34543. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34544. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34545. $core.addMethod(
  34546. $core.method({
  34547. selector: "alias",
  34548. protocol: 'accessing',
  34549. fn: function (){
  34550. var self=this;
  34551. return $core.withContext(function($ctx1) {
  34552. return self._name();
  34553. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34554. },
  34555. args: [],
  34556. source: "alias\x0a\x09^ self name",
  34557. referencedClasses: [],
  34558. messageSends: ["name"]
  34559. }),
  34560. $globals.PseudoVar);
  34561. $core.addMethod(
  34562. $core.method({
  34563. selector: "isImmutable",
  34564. protocol: 'testing',
  34565. fn: function (){
  34566. var self=this;
  34567. return true;
  34568. },
  34569. args: [],
  34570. source: "isImmutable\x0a\x09^ true",
  34571. referencedClasses: [],
  34572. messageSends: []
  34573. }),
  34574. $globals.PseudoVar);
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "isPseudoVar",
  34578. protocol: 'testing',
  34579. fn: function (){
  34580. var self=this;
  34581. return true;
  34582. },
  34583. args: [],
  34584. source: "isPseudoVar\x0a\x09^ true",
  34585. referencedClasses: [],
  34586. messageSends: []
  34587. }),
  34588. $globals.PseudoVar);
  34589. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34590. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34591. $core.addMethod(
  34592. $core.method({
  34593. selector: "isTempVar",
  34594. protocol: 'testing',
  34595. fn: function (){
  34596. var self=this;
  34597. return true;
  34598. },
  34599. args: [],
  34600. source: "isTempVar\x0a\x09^ true",
  34601. referencedClasses: [],
  34602. messageSends: []
  34603. }),
  34604. $globals.TempVar);
  34605. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34606. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34607. $core.addMethod(
  34608. $core.method({
  34609. selector: "isUnknownVar",
  34610. protocol: 'testing',
  34611. fn: function (){
  34612. var self=this;
  34613. return true;
  34614. },
  34615. args: [],
  34616. source: "isUnknownVar\x0a\x09^ true",
  34617. referencedClasses: [],
  34618. messageSends: []
  34619. }),
  34620. $globals.UnknownVar);
  34621. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34622. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34623. $core.addMethod(
  34624. $core.method({
  34625. selector: "classReferences",
  34626. protocol: 'accessing',
  34627. fn: function (){
  34628. var self=this;
  34629. return $core.withContext(function($ctx1) {
  34630. var $1,$receiver;
  34631. $1=self["@classReferences"];
  34632. if(($receiver = $1) == null || $receiver.isNil){
  34633. self["@classReferences"]=$recv($globals.Set)._new();
  34634. return self["@classReferences"];
  34635. } else {
  34636. return $1;
  34637. };
  34638. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34639. },
  34640. args: [],
  34641. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34642. referencedClasses: ["Set"],
  34643. messageSends: ["ifNil:", "new"]
  34644. }),
  34645. $globals.SemanticAnalyzer);
  34646. $core.addMethod(
  34647. $core.method({
  34648. selector: "errorShadowingVariable:",
  34649. protocol: 'error handling',
  34650. fn: function (aString){
  34651. var self=this;
  34652. return $core.withContext(function($ctx1) {
  34653. var $1;
  34654. $1=$recv($globals.ShadowingVariableError)._new();
  34655. $recv($1)._variableName_(aString);
  34656. $recv($1)._signal();
  34657. return self;
  34658. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34659. },
  34660. args: ["aString"],
  34661. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34662. referencedClasses: ["ShadowingVariableError"],
  34663. messageSends: ["variableName:", "new", "signal"]
  34664. }),
  34665. $globals.SemanticAnalyzer);
  34666. $core.addMethod(
  34667. $core.method({
  34668. selector: "errorUnknownVariable:",
  34669. protocol: 'error handling',
  34670. fn: function (aNode){
  34671. var self=this;
  34672. var identifier;
  34673. return $core.withContext(function($ctx1) {
  34674. var $1,$2,$3;
  34675. identifier=$recv(aNode)._value();
  34676. $ctx1.sendIdx["value"]=1;
  34677. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34678. return $core.withContext(function($ctx2) {
  34679. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34681. }));
  34682. if($core.assert($1)){
  34683. $2=$recv($globals.UnknownVariableError)._new();
  34684. $3=$recv(aNode)._value();
  34685. $ctx1.sendIdx["value"]=2;
  34686. $recv($2)._variableName_($3);
  34687. $recv($2)._signal();
  34688. } else {
  34689. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34690. };
  34691. return self;
  34692. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34693. },
  34694. args: ["aNode"],
  34695. 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 ]",
  34696. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34697. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34698. }),
  34699. $globals.SemanticAnalyzer);
  34700. $core.addMethod(
  34701. $core.method({
  34702. selector: "isVariableUndefined:inPackage:",
  34703. protocol: 'testing',
  34704. fn: function (aString,aPackage){
  34705. var self=this;
  34706. return $core.withContext(function($ctx1) {
  34707. var $1,$2,$3,$receiver;
  34708. if(($receiver = aPackage) == null || $receiver.isNil){
  34709. aPackage;
  34710. } else {
  34711. var packageKnownVars;
  34712. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34713. packageKnownVars;
  34714. $1=$recv(packageKnownVars)._includes_(aString);
  34715. if($core.assert($1)){
  34716. return false;
  34717. };
  34718. };
  34719. $2=$recv($globals.Compiler)._new();
  34720. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34721. $ctx1.sendIdx[","]=1;
  34722. return $recv($2)._eval_($3);
  34723. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34724. },
  34725. args: ["aString", "aPackage"],
  34726. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  34727. referencedClasses: ["Compiler"],
  34728. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34729. }),
  34730. $globals.SemanticAnalyzer);
  34731. $core.addMethod(
  34732. $core.method({
  34733. selector: "messageSends",
  34734. protocol: 'accessing',
  34735. fn: function (){
  34736. var self=this;
  34737. return $core.withContext(function($ctx1) {
  34738. var $1,$receiver;
  34739. $1=self["@messageSends"];
  34740. if(($receiver = $1) == null || $receiver.isNil){
  34741. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34742. return self["@messageSends"];
  34743. } else {
  34744. return $1;
  34745. };
  34746. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34747. },
  34748. args: [],
  34749. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34750. referencedClasses: ["Dictionary"],
  34751. messageSends: ["ifNil:", "new"]
  34752. }),
  34753. $globals.SemanticAnalyzer);
  34754. $core.addMethod(
  34755. $core.method({
  34756. selector: "newBlockScope",
  34757. protocol: 'factory',
  34758. fn: function (){
  34759. var self=this;
  34760. return $core.withContext(function($ctx1) {
  34761. return self._newScopeOfClass_($globals.LexicalScope);
  34762. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34763. },
  34764. args: [],
  34765. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34766. referencedClasses: ["LexicalScope"],
  34767. messageSends: ["newScopeOfClass:"]
  34768. }),
  34769. $globals.SemanticAnalyzer);
  34770. $core.addMethod(
  34771. $core.method({
  34772. selector: "newMethodScope",
  34773. protocol: 'factory',
  34774. fn: function (){
  34775. var self=this;
  34776. return $core.withContext(function($ctx1) {
  34777. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34778. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34779. },
  34780. args: [],
  34781. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34782. referencedClasses: ["MethodLexicalScope"],
  34783. messageSends: ["newScopeOfClass:"]
  34784. }),
  34785. $globals.SemanticAnalyzer);
  34786. $core.addMethod(
  34787. $core.method({
  34788. selector: "newScopeOfClass:",
  34789. protocol: 'factory',
  34790. fn: function (aLexicalScopeClass){
  34791. var self=this;
  34792. return $core.withContext(function($ctx1) {
  34793. var $1;
  34794. $1=$recv(aLexicalScopeClass)._new();
  34795. $recv($1)._outerScope_(self["@currentScope"]);
  34796. return $recv($1)._yourself();
  34797. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34798. },
  34799. args: ["aLexicalScopeClass"],
  34800. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34801. referencedClasses: [],
  34802. messageSends: ["outerScope:", "new", "yourself"]
  34803. }),
  34804. $globals.SemanticAnalyzer);
  34805. $core.addMethod(
  34806. $core.method({
  34807. selector: "nextBlockIndex",
  34808. protocol: 'private',
  34809. fn: function (){
  34810. var self=this;
  34811. return $core.withContext(function($ctx1) {
  34812. var $1,$receiver;
  34813. $1=self["@blockIndex"];
  34814. if(($receiver = $1) == null || $receiver.isNil){
  34815. self["@blockIndex"]=(0);
  34816. self["@blockIndex"];
  34817. } else {
  34818. $1;
  34819. };
  34820. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34821. return self["@blockIndex"];
  34822. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34823. },
  34824. args: [],
  34825. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34826. referencedClasses: [],
  34827. messageSends: ["ifNil:", "+"]
  34828. }),
  34829. $globals.SemanticAnalyzer);
  34830. $core.addMethod(
  34831. $core.method({
  34832. selector: "popScope",
  34833. protocol: 'scope',
  34834. fn: function (){
  34835. var self=this;
  34836. return $core.withContext(function($ctx1) {
  34837. var $1,$receiver;
  34838. $1=self["@currentScope"];
  34839. if(($receiver = $1) == null || $receiver.isNil){
  34840. $1;
  34841. } else {
  34842. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34843. self["@currentScope"];
  34844. };
  34845. return self;
  34846. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34847. },
  34848. args: [],
  34849. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34850. referencedClasses: [],
  34851. messageSends: ["ifNotNil:", "outerScope"]
  34852. }),
  34853. $globals.SemanticAnalyzer);
  34854. $core.addMethod(
  34855. $core.method({
  34856. selector: "pushScope:",
  34857. protocol: 'scope',
  34858. fn: function (aScope){
  34859. var self=this;
  34860. return $core.withContext(function($ctx1) {
  34861. $recv(aScope)._outerScope_(self["@currentScope"]);
  34862. self["@currentScope"]=aScope;
  34863. return self;
  34864. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34865. },
  34866. args: ["aScope"],
  34867. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34868. referencedClasses: [],
  34869. messageSends: ["outerScope:"]
  34870. }),
  34871. $globals.SemanticAnalyzer);
  34872. $core.addMethod(
  34873. $core.method({
  34874. selector: "theClass",
  34875. protocol: 'accessing',
  34876. fn: function (){
  34877. var self=this;
  34878. return self["@theClass"];
  34879. },
  34880. args: [],
  34881. source: "theClass\x0a\x09^ theClass",
  34882. referencedClasses: [],
  34883. messageSends: []
  34884. }),
  34885. $globals.SemanticAnalyzer);
  34886. $core.addMethod(
  34887. $core.method({
  34888. selector: "theClass:",
  34889. protocol: 'accessing',
  34890. fn: function (aClass){
  34891. var self=this;
  34892. self["@theClass"]=aClass;
  34893. return self;
  34894. },
  34895. args: ["aClass"],
  34896. source: "theClass: aClass\x0a\x09theClass := aClass",
  34897. referencedClasses: [],
  34898. messageSends: []
  34899. }),
  34900. $globals.SemanticAnalyzer);
  34901. $core.addMethod(
  34902. $core.method({
  34903. selector: "thePackage",
  34904. protocol: 'accessing',
  34905. fn: function (){
  34906. var self=this;
  34907. return self["@thePackage"];
  34908. },
  34909. args: [],
  34910. source: "thePackage\x0a\x09^ thePackage",
  34911. referencedClasses: [],
  34912. messageSends: []
  34913. }),
  34914. $globals.SemanticAnalyzer);
  34915. $core.addMethod(
  34916. $core.method({
  34917. selector: "thePackage:",
  34918. protocol: 'accessing',
  34919. fn: function (aPackage){
  34920. var self=this;
  34921. self["@thePackage"]=aPackage;
  34922. return self;
  34923. },
  34924. args: ["aPackage"],
  34925. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34926. referencedClasses: [],
  34927. messageSends: []
  34928. }),
  34929. $globals.SemanticAnalyzer);
  34930. $core.addMethod(
  34931. $core.method({
  34932. selector: "validateVariableScope:",
  34933. protocol: 'scope',
  34934. fn: function (aString){
  34935. var self=this;
  34936. return $core.withContext(function($ctx1) {
  34937. var $1,$receiver;
  34938. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34939. if(($receiver = $1) == null || $receiver.isNil){
  34940. $1;
  34941. } else {
  34942. self._errorShadowingVariable_(aString);
  34943. };
  34944. return self;
  34945. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34946. },
  34947. args: ["aString"],
  34948. 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 ]",
  34949. referencedClasses: [],
  34950. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34951. }),
  34952. $globals.SemanticAnalyzer);
  34953. $core.addMethod(
  34954. $core.method({
  34955. selector: "visitAssignmentNode:",
  34956. protocol: 'visiting',
  34957. fn: function (aNode){
  34958. var self=this;
  34959. return $core.withContext(function($ctx1) {
  34960. (
  34961. $ctx1.supercall = true,
  34962. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34963. $ctx1.supercall = false;
  34964. $recv($recv(aNode)._left())._beAssigned();
  34965. return self;
  34966. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34967. },
  34968. args: ["aNode"],
  34969. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34970. referencedClasses: [],
  34971. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34972. }),
  34973. $globals.SemanticAnalyzer);
  34974. $core.addMethod(
  34975. $core.method({
  34976. selector: "visitBlockNode:",
  34977. protocol: 'visiting',
  34978. fn: function (aNode){
  34979. var self=this;
  34980. return $core.withContext(function($ctx1) {
  34981. self._pushScope_(self._newBlockScope());
  34982. $recv(aNode)._scope_(self["@currentScope"]);
  34983. $recv(self["@currentScope"])._node_(aNode);
  34984. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34985. $recv($recv(aNode)._parameters())._do_((function(each){
  34986. return $core.withContext(function($ctx2) {
  34987. self._validateVariableScope_(each);
  34988. return $recv(self["@currentScope"])._addArg_(each);
  34989. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34990. }));
  34991. (
  34992. $ctx1.supercall = true,
  34993. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34994. $ctx1.supercall = false;
  34995. self._popScope();
  34996. return self;
  34997. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34998. },
  34999. args: ["aNode"],
  35000. 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",
  35001. referencedClasses: [],
  35002. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35003. }),
  35004. $globals.SemanticAnalyzer);
  35005. $core.addMethod(
  35006. $core.method({
  35007. selector: "visitCascadeNode:",
  35008. protocol: 'visiting',
  35009. fn: function (aNode){
  35010. var self=this;
  35011. return $core.withContext(function($ctx1) {
  35012. $recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
  35013. (
  35014. $ctx1.supercall = true,
  35015. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35016. $ctx1.supercall = false;
  35017. return self;
  35018. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35019. },
  35020. args: ["aNode"],
  35021. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
  35022. referencedClasses: [],
  35023. messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
  35024. }),
  35025. $globals.SemanticAnalyzer);
  35026. $core.addMethod(
  35027. $core.method({
  35028. selector: "visitMethodNode:",
  35029. protocol: 'visiting',
  35030. fn: function (aNode){
  35031. var self=this;
  35032. return $core.withContext(function($ctx1) {
  35033. self._pushScope_(self._newMethodScope());
  35034. $recv(aNode)._scope_(self["@currentScope"]);
  35035. $recv(self["@currentScope"])._node_(aNode);
  35036. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35037. return $core.withContext(function($ctx2) {
  35038. return $recv(self["@currentScope"])._addIVar_(each);
  35039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35040. }));
  35041. $ctx1.sendIdx["do:"]=1;
  35042. $recv($recv(aNode)._arguments())._do_((function(each){
  35043. return $core.withContext(function($ctx2) {
  35044. self._validateVariableScope_(each);
  35045. return $recv(self["@currentScope"])._addArg_(each);
  35046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35047. }));
  35048. (
  35049. $ctx1.supercall = true,
  35050. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35051. $ctx1.supercall = false;
  35052. $recv(aNode)._classReferences_(self._classReferences());
  35053. $recv(aNode)._sendIndexes_(self._messageSends());
  35054. self._popScope();
  35055. return self;
  35056. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35057. },
  35058. args: ["aNode"],
  35059. 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",
  35060. referencedClasses: [],
  35061. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  35062. }),
  35063. $globals.SemanticAnalyzer);
  35064. $core.addMethod(
  35065. $core.method({
  35066. selector: "visitReturnNode:",
  35067. protocol: 'visiting',
  35068. fn: function (aNode){
  35069. var self=this;
  35070. return $core.withContext(function($ctx1) {
  35071. var $1;
  35072. $recv(aNode)._scope_(self["@currentScope"]);
  35073. $1=$recv(self["@currentScope"])._isMethodScope();
  35074. if($core.assert($1)){
  35075. $recv(self["@currentScope"])._localReturn_(true);
  35076. } else {
  35077. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35078. };
  35079. (
  35080. $ctx1.supercall = true,
  35081. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35082. $ctx1.supercall = false;
  35083. return self;
  35084. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35085. },
  35086. args: ["aNode"],
  35087. 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",
  35088. referencedClasses: [],
  35089. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35090. }),
  35091. $globals.SemanticAnalyzer);
  35092. $core.addMethod(
  35093. $core.method({
  35094. selector: "visitSendNode:",
  35095. protocol: 'visiting',
  35096. fn: function (aNode){
  35097. var self=this;
  35098. return $core.withContext(function($ctx1) {
  35099. var $3,$2,$1,$5,$6,$4,$7,$8,$9,$11,$12,$10,$receiver;
  35100. $3=$recv(aNode)._receiver();
  35101. $ctx1.sendIdx["receiver"]=1;
  35102. $2=$recv($3)._value();
  35103. $1=$recv($2).__eq("super");
  35104. if(!$core.assert($1)){
  35105. $5=$recv($globals.IRSendInliner)._inlinedSelectors();
  35106. $6=$recv(aNode)._selector();
  35107. $ctx1.sendIdx["selector"]=1;
  35108. $4=$recv($5)._includes_($6);
  35109. if($core.assert($4)){
  35110. $recv(aNode)._shouldBeInlined_(true);
  35111. $7=$recv(aNode)._receiver();
  35112. if(($receiver = $7) == null || $receiver.isNil){
  35113. $7;
  35114. } else {
  35115. var receiver;
  35116. receiver=$receiver;
  35117. $recv(receiver)._shouldBeAliased_(true);
  35118. };
  35119. };
  35120. };
  35121. $8=self._messageSends();
  35122. $ctx1.sendIdx["messageSends"]=1;
  35123. $9=$recv(aNode)._selector();
  35124. $ctx1.sendIdx["selector"]=2;
  35125. $recv($8)._at_ifAbsentPut_($9,(function(){
  35126. return $core.withContext(function($ctx2) {
  35127. return $recv($globals.Set)._new();
  35128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  35129. }));
  35130. $11=self._messageSends();
  35131. $ctx1.sendIdx["messageSends"]=2;
  35132. $12=$recv(aNode)._selector();
  35133. $ctx1.sendIdx["selector"]=3;
  35134. $10=$recv($11)._at_($12);
  35135. $ctx1.sendIdx["at:"]=1;
  35136. $recv($10)._add_(aNode);
  35137. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35138. (
  35139. $ctx1.supercall = true,
  35140. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35141. $ctx1.supercall = false;
  35142. return self;
  35143. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35144. },
  35145. args: ["aNode"],
  35146. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  35147. referencedClasses: ["IRSendInliner", "Set"],
  35148. messageSends: ["ifFalse:", "=", "value", "receiver", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "at:ifAbsentPut:", "messageSends", "new", "add:", "at:", "index:", "size", "visitSendNode:"]
  35149. }),
  35150. $globals.SemanticAnalyzer);
  35151. $core.addMethod(
  35152. $core.method({
  35153. selector: "visitSequenceNode:",
  35154. protocol: 'visiting',
  35155. fn: function (aNode){
  35156. var self=this;
  35157. return $core.withContext(function($ctx1) {
  35158. $recv($recv(aNode)._temps())._do_((function(each){
  35159. return $core.withContext(function($ctx2) {
  35160. self._validateVariableScope_(each);
  35161. return $recv(self["@currentScope"])._addTemp_(each);
  35162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35163. }));
  35164. (
  35165. $ctx1.supercall = true,
  35166. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35167. $ctx1.supercall = false;
  35168. return self;
  35169. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35170. },
  35171. args: ["aNode"],
  35172. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35173. referencedClasses: [],
  35174. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35175. }),
  35176. $globals.SemanticAnalyzer);
  35177. $core.addMethod(
  35178. $core.method({
  35179. selector: "visitVariableNode:",
  35180. protocol: 'visiting',
  35181. fn: function (aNode){
  35182. var self=this;
  35183. var binding;
  35184. return $core.withContext(function($ctx1) {
  35185. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  35186. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35187. $1=binding;
  35188. if(($receiver = $1) == null || $receiver.isNil){
  35189. $3=$recv(aNode)._value();
  35190. $ctx1.sendIdx["value"]=1;
  35191. $2=$recv($3)._isCapitalized();
  35192. if($core.assert($2)){
  35193. $4=$recv($globals.ClassRefVar)._new();
  35194. $ctx1.sendIdx["new"]=1;
  35195. $5=$recv(aNode)._value();
  35196. $ctx1.sendIdx["value"]=2;
  35197. $recv($4)._name_($5);
  35198. $ctx1.sendIdx["name:"]=1;
  35199. $6=$recv($4)._yourself();
  35200. $ctx1.sendIdx["yourself"]=1;
  35201. binding=$6;
  35202. binding;
  35203. $7=self._classReferences();
  35204. $8=$recv(aNode)._value();
  35205. $ctx1.sendIdx["value"]=3;
  35206. $recv($7)._add_($8);
  35207. } else {
  35208. self._errorUnknownVariable_(aNode);
  35209. $9=$recv($globals.UnknownVar)._new();
  35210. $recv($9)._name_($recv(aNode)._value());
  35211. binding=$recv($9)._yourself();
  35212. binding;
  35213. };
  35214. } else {
  35215. $1;
  35216. };
  35217. $recv(aNode)._binding_(binding);
  35218. return self;
  35219. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35220. },
  35221. args: ["aNode"],
  35222. 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.",
  35223. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35224. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35225. }),
  35226. $globals.SemanticAnalyzer);
  35227. $core.addMethod(
  35228. $core.method({
  35229. selector: "on:",
  35230. protocol: 'instance creation',
  35231. fn: function (aClass){
  35232. var self=this;
  35233. return $core.withContext(function($ctx1) {
  35234. var $1;
  35235. $1=self._new();
  35236. $recv($1)._theClass_(aClass);
  35237. return $recv($1)._yourself();
  35238. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35239. },
  35240. args: ["aClass"],
  35241. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35242. referencedClasses: [],
  35243. messageSends: ["theClass:", "new", "yourself"]
  35244. }),
  35245. $globals.SemanticAnalyzer.klass);
  35246. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35247. $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";
  35248. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35249. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35250. $core.addMethod(
  35251. $core.method({
  35252. selector: "messageText",
  35253. protocol: 'accessing',
  35254. fn: function (){
  35255. var self=this;
  35256. return $core.withContext(function($ctx1) {
  35257. return " Invalid assignment to variable: ".__comma(self._variableName());
  35258. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35259. },
  35260. args: [],
  35261. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35262. referencedClasses: [],
  35263. messageSends: [",", "variableName"]
  35264. }),
  35265. $globals.InvalidAssignmentError);
  35266. $core.addMethod(
  35267. $core.method({
  35268. selector: "variableName",
  35269. protocol: 'accessing',
  35270. fn: function (){
  35271. var self=this;
  35272. return self["@variableName"];
  35273. },
  35274. args: [],
  35275. source: "variableName\x0a\x09^ variableName",
  35276. referencedClasses: [],
  35277. messageSends: []
  35278. }),
  35279. $globals.InvalidAssignmentError);
  35280. $core.addMethod(
  35281. $core.method({
  35282. selector: "variableName:",
  35283. protocol: 'accessing',
  35284. fn: function (aString){
  35285. var self=this;
  35286. self["@variableName"]=aString;
  35287. return self;
  35288. },
  35289. args: ["aString"],
  35290. source: "variableName: aString\x0a\x09variableName := aString",
  35291. referencedClasses: [],
  35292. messageSends: []
  35293. }),
  35294. $globals.InvalidAssignmentError);
  35295. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35296. $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.";
  35297. $core.addMethod(
  35298. $core.method({
  35299. selector: "messageText",
  35300. protocol: 'accessing',
  35301. fn: function (){
  35302. var self=this;
  35303. return $core.withContext(function($ctx1) {
  35304. var $1;
  35305. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35306. $ctx1.sendIdx[","]=1;
  35307. return $1;
  35308. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35309. },
  35310. args: [],
  35311. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35312. referencedClasses: [],
  35313. messageSends: [",", "variableName"]
  35314. }),
  35315. $globals.ShadowingVariableError);
  35316. $core.addMethod(
  35317. $core.method({
  35318. selector: "variableName",
  35319. protocol: 'accessing',
  35320. fn: function (){
  35321. var self=this;
  35322. return self["@variableName"];
  35323. },
  35324. args: [],
  35325. source: "variableName\x0a\x09^ variableName",
  35326. referencedClasses: [],
  35327. messageSends: []
  35328. }),
  35329. $globals.ShadowingVariableError);
  35330. $core.addMethod(
  35331. $core.method({
  35332. selector: "variableName:",
  35333. protocol: 'accessing',
  35334. fn: function (aString){
  35335. var self=this;
  35336. self["@variableName"]=aString;
  35337. return self;
  35338. },
  35339. args: ["aString"],
  35340. source: "variableName: aString\x0a\x09variableName := aString",
  35341. referencedClasses: [],
  35342. messageSends: []
  35343. }),
  35344. $globals.ShadowingVariableError);
  35345. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35346. $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.";
  35347. $core.addMethod(
  35348. $core.method({
  35349. selector: "messageText",
  35350. protocol: 'accessing',
  35351. fn: function (){
  35352. var self=this;
  35353. return $core.withContext(function($ctx1) {
  35354. var $1;
  35355. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35356. $ctx1.sendIdx[","]=1;
  35357. return $1;
  35358. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35359. },
  35360. args: [],
  35361. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35362. referencedClasses: [],
  35363. messageSends: [",", "variableName"]
  35364. }),
  35365. $globals.UnknownVariableError);
  35366. $core.addMethod(
  35367. $core.method({
  35368. selector: "variableName",
  35369. protocol: 'accessing',
  35370. fn: function (){
  35371. var self=this;
  35372. return self["@variableName"];
  35373. },
  35374. args: [],
  35375. source: "variableName\x0a\x09^ variableName",
  35376. referencedClasses: [],
  35377. messageSends: []
  35378. }),
  35379. $globals.UnknownVariableError);
  35380. $core.addMethod(
  35381. $core.method({
  35382. selector: "variableName:",
  35383. protocol: 'accessing',
  35384. fn: function (aString){
  35385. var self=this;
  35386. self["@variableName"]=aString;
  35387. return self;
  35388. },
  35389. args: ["aString"],
  35390. source: "variableName: aString\x0a\x09variableName := aString",
  35391. referencedClasses: [],
  35392. messageSends: []
  35393. }),
  35394. $globals.UnknownVariableError);
  35395. });
  35396. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  35397. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  35398. $core.addPackage('Compiler-IR');
  35399. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35400. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35401. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35402. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35403. $core.addMethod(
  35404. $core.method({
  35405. selector: "alias:",
  35406. protocol: 'visiting',
  35407. fn: function (aNode){
  35408. var self=this;
  35409. var variable;
  35410. return $core.withContext(function($ctx1) {
  35411. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35412. $1=$recv(aNode)._isImmutable();
  35413. if($core.assert($1)){
  35414. $2=self._visit_(aNode);
  35415. $ctx1.sendIdx["visit:"]=1;
  35416. return $2;
  35417. };
  35418. $3=$recv($globals.IRVariable)._new();
  35419. $ctx1.sendIdx["new"]=1;
  35420. $5=$recv($globals.AliasVar)._new();
  35421. $ctx1.sendIdx["new"]=2;
  35422. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35423. $recv($3)._variable_($4);
  35424. $6=$recv($3)._yourself();
  35425. $ctx1.sendIdx["yourself"]=1;
  35426. variable=$6;
  35427. $7=self._sequence();
  35428. $9=$recv($globals.IRAssignment)._new();
  35429. $recv($9)._add_(variable);
  35430. $ctx1.sendIdx["add:"]=2;
  35431. $recv($9)._add_(self._visit_(aNode));
  35432. $ctx1.sendIdx["add:"]=3;
  35433. $8=$recv($9)._yourself();
  35434. $recv($7)._add_($8);
  35435. $ctx1.sendIdx["add:"]=1;
  35436. $recv($recv(self._method())._internalVariables())._add_(variable);
  35437. return variable;
  35438. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35439. },
  35440. args: ["aNode"],
  35441. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  35442. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35443. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35444. }),
  35445. $globals.IRASTTranslator);
  35446. $core.addMethod(
  35447. $core.method({
  35448. selector: "aliasTemporally:",
  35449. protocol: 'visiting',
  35450. fn: function (aCollection){
  35451. var self=this;
  35452. var threshold,result;
  35453. return $core.withContext(function($ctx1) {
  35454. var $1,$2,$4,$3;
  35455. threshold=(0);
  35456. $recv(aCollection)._withIndexDo_((function(each,i){
  35457. return $core.withContext(function($ctx2) {
  35458. $1=$recv(each)._subtreeNeedsAliasing();
  35459. if($core.assert($1)){
  35460. threshold=i;
  35461. return threshold;
  35462. };
  35463. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35464. }));
  35465. $ctx1.sendIdx["withIndexDo:"]=1;
  35466. result=$recv($globals.OrderedCollection)._new();
  35467. $recv(aCollection)._withIndexDo_((function(each,i){
  35468. return $core.withContext(function($ctx2) {
  35469. $2=result;
  35470. $4=$recv(i).__lt_eq(threshold);
  35471. if($core.assert($4)){
  35472. $3=self._alias_(each);
  35473. } else {
  35474. $3=self._visit_(each);
  35475. };
  35476. return $recv($2)._add_($3);
  35477. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35478. }));
  35479. return result;
  35480. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35481. },
  35482. args: ["aCollection"],
  35483. 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",
  35484. referencedClasses: ["OrderedCollection"],
  35485. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35486. }),
  35487. $globals.IRASTTranslator);
  35488. $core.addMethod(
  35489. $core.method({
  35490. selector: "method",
  35491. protocol: 'accessing',
  35492. fn: function (){
  35493. var self=this;
  35494. return self["@method"];
  35495. },
  35496. args: [],
  35497. source: "method\x0a\x09^ method",
  35498. referencedClasses: [],
  35499. messageSends: []
  35500. }),
  35501. $globals.IRASTTranslator);
  35502. $core.addMethod(
  35503. $core.method({
  35504. selector: "method:",
  35505. protocol: 'accessing',
  35506. fn: function (anIRMethod){
  35507. var self=this;
  35508. self["@method"]=anIRMethod;
  35509. return self;
  35510. },
  35511. args: ["anIRMethod"],
  35512. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35513. referencedClasses: [],
  35514. messageSends: []
  35515. }),
  35516. $globals.IRASTTranslator);
  35517. $core.addMethod(
  35518. $core.method({
  35519. selector: "nextAlias",
  35520. protocol: 'accessing',
  35521. fn: function (){
  35522. var self=this;
  35523. return $core.withContext(function($ctx1) {
  35524. var $1,$receiver;
  35525. $1=self["@nextAlias"];
  35526. if(($receiver = $1) == null || $receiver.isNil){
  35527. self["@nextAlias"]=(0);
  35528. self["@nextAlias"];
  35529. } else {
  35530. $1;
  35531. };
  35532. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35533. return $recv(self["@nextAlias"])._asString();
  35534. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35535. },
  35536. args: [],
  35537. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35538. referencedClasses: [],
  35539. messageSends: ["ifNil:", "+", "asString"]
  35540. }),
  35541. $globals.IRASTTranslator);
  35542. $core.addMethod(
  35543. $core.method({
  35544. selector: "sequence",
  35545. protocol: 'accessing',
  35546. fn: function (){
  35547. var self=this;
  35548. return self["@sequence"];
  35549. },
  35550. args: [],
  35551. source: "sequence\x0a\x09^ sequence",
  35552. referencedClasses: [],
  35553. messageSends: []
  35554. }),
  35555. $globals.IRASTTranslator);
  35556. $core.addMethod(
  35557. $core.method({
  35558. selector: "sequence:",
  35559. protocol: 'accessing',
  35560. fn: function (anIRSequence){
  35561. var self=this;
  35562. self["@sequence"]=anIRSequence;
  35563. return self;
  35564. },
  35565. args: ["anIRSequence"],
  35566. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35567. referencedClasses: [],
  35568. messageSends: []
  35569. }),
  35570. $globals.IRASTTranslator);
  35571. $core.addMethod(
  35572. $core.method({
  35573. selector: "source",
  35574. protocol: 'accessing',
  35575. fn: function (){
  35576. var self=this;
  35577. return self["@source"];
  35578. },
  35579. args: [],
  35580. source: "source\x0a\x09^ source",
  35581. referencedClasses: [],
  35582. messageSends: []
  35583. }),
  35584. $globals.IRASTTranslator);
  35585. $core.addMethod(
  35586. $core.method({
  35587. selector: "source:",
  35588. protocol: 'accessing',
  35589. fn: function (aString){
  35590. var self=this;
  35591. self["@source"]=aString;
  35592. return self;
  35593. },
  35594. args: ["aString"],
  35595. source: "source: aString\x0a\x09source := aString",
  35596. referencedClasses: [],
  35597. messageSends: []
  35598. }),
  35599. $globals.IRASTTranslator);
  35600. $core.addMethod(
  35601. $core.method({
  35602. selector: "theClass",
  35603. protocol: 'accessing',
  35604. fn: function (){
  35605. var self=this;
  35606. return self["@theClass"];
  35607. },
  35608. args: [],
  35609. source: "theClass\x0a\x09^ theClass",
  35610. referencedClasses: [],
  35611. messageSends: []
  35612. }),
  35613. $globals.IRASTTranslator);
  35614. $core.addMethod(
  35615. $core.method({
  35616. selector: "theClass:",
  35617. protocol: 'accessing',
  35618. fn: function (aClass){
  35619. var self=this;
  35620. self["@theClass"]=aClass;
  35621. return self;
  35622. },
  35623. args: ["aClass"],
  35624. source: "theClass: aClass\x0a\x09theClass := aClass",
  35625. referencedClasses: [],
  35626. messageSends: []
  35627. }),
  35628. $globals.IRASTTranslator);
  35629. $core.addMethod(
  35630. $core.method({
  35631. selector: "visitAssignmentNode:",
  35632. protocol: 'visiting',
  35633. fn: function (aNode){
  35634. var self=this;
  35635. var left,right,assignment;
  35636. return $core.withContext(function($ctx1) {
  35637. var $1,$3,$2;
  35638. right=self._visit_($recv(aNode)._right());
  35639. $ctx1.sendIdx["visit:"]=1;
  35640. left=self._visit_($recv(aNode)._left());
  35641. $1=self._sequence();
  35642. $3=$recv($globals.IRAssignment)._new();
  35643. $recv($3)._add_(left);
  35644. $ctx1.sendIdx["add:"]=2;
  35645. $recv($3)._add_(right);
  35646. $2=$recv($3)._yourself();
  35647. $recv($1)._add_($2);
  35648. $ctx1.sendIdx["add:"]=1;
  35649. return left;
  35650. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35651. },
  35652. args: ["aNode"],
  35653. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  35654. referencedClasses: ["IRAssignment"],
  35655. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35656. }),
  35657. $globals.IRASTTranslator);
  35658. $core.addMethod(
  35659. $core.method({
  35660. selector: "visitBlockNode:",
  35661. protocol: 'visiting',
  35662. fn: function (aNode){
  35663. var self=this;
  35664. var closure;
  35665. return $core.withContext(function($ctx1) {
  35666. var $1,$2,$3,$5,$4,$6,$8,$7;
  35667. $1=$recv($globals.IRClosure)._new();
  35668. $ctx1.sendIdx["new"]=1;
  35669. $recv($1)._arguments_($recv(aNode)._parameters());
  35670. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35671. $2=$recv(aNode)._scope();
  35672. $ctx1.sendIdx["scope"]=1;
  35673. $recv($1)._scope_($2);
  35674. $ctx1.sendIdx["scope:"]=1;
  35675. $3=$recv($1)._yourself();
  35676. $ctx1.sendIdx["yourself"]=1;
  35677. closure=$3;
  35678. $5=$recv(aNode)._scope();
  35679. $ctx1.sendIdx["scope"]=2;
  35680. $4=$recv($5)._temps();
  35681. $recv($4)._do_((function(each){
  35682. return $core.withContext(function($ctx2) {
  35683. $6=closure;
  35684. $8=$recv($globals.IRTempDeclaration)._new();
  35685. $recv($8)._name_($recv(each)._name());
  35686. $recv($8)._scope_($recv(aNode)._scope());
  35687. $7=$recv($8)._yourself();
  35688. return $recv($6)._add_($7);
  35689. $ctx2.sendIdx["add:"]=1;
  35690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35691. }));
  35692. $ctx1.sendIdx["do:"]=1;
  35693. $recv($recv(aNode)._nodes())._do_((function(each){
  35694. return $core.withContext(function($ctx2) {
  35695. return $recv(closure)._add_(self._visit_(each));
  35696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35697. }));
  35698. return closure;
  35699. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35700. },
  35701. args: ["aNode"],
  35702. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  35703. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35704. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35705. }),
  35706. $globals.IRASTTranslator);
  35707. $core.addMethod(
  35708. $core.method({
  35709. selector: "visitBlockSequenceNode:",
  35710. protocol: 'visiting',
  35711. fn: function (aNode){
  35712. var self=this;
  35713. return $core.withContext(function($ctx1) {
  35714. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35715. $1=$recv($globals.IRBlockSequence)._new();
  35716. $ctx1.sendIdx["new"]=1;
  35717. return self._withSequence_do_($1,(function(){
  35718. return $core.withContext(function($ctx2) {
  35719. $2=$recv(aNode)._nodes();
  35720. $ctx2.sendIdx["nodes"]=1;
  35721. return $recv($2)._ifNotEmpty_((function(){
  35722. return $core.withContext(function($ctx3) {
  35723. $4=$recv(aNode)._nodes();
  35724. $ctx3.sendIdx["nodes"]=2;
  35725. $3=$recv($4)._allButLast();
  35726. $recv($3)._do_((function(each){
  35727. return $core.withContext(function($ctx4) {
  35728. $5=self._sequence();
  35729. $ctx4.sendIdx["sequence"]=1;
  35730. $6=self._visitOrAlias_(each);
  35731. $ctx4.sendIdx["visitOrAlias:"]=1;
  35732. return $recv($5)._add_($6);
  35733. $ctx4.sendIdx["add:"]=1;
  35734. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35735. }));
  35736. $9=$recv(aNode)._nodes();
  35737. $ctx3.sendIdx["nodes"]=3;
  35738. $8=$recv($9)._last();
  35739. $ctx3.sendIdx["last"]=1;
  35740. $7=$recv($8)._isReturnNode();
  35741. if($core.assert($7)){
  35742. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  35743. } else {
  35744. $10=self._sequence();
  35745. $ctx3.sendIdx["sequence"]=2;
  35746. $12=$recv($globals.IRBlockReturn)._new();
  35747. $15=$recv(aNode)._nodes();
  35748. $ctx3.sendIdx["nodes"]=4;
  35749. $14=$recv($15)._last();
  35750. $ctx3.sendIdx["last"]=2;
  35751. $13=self._visitOrAlias_($14);
  35752. $ctx3.sendIdx["visitOrAlias:"]=2;
  35753. $recv($12)._add_($13);
  35754. $ctx3.sendIdx["add:"]=3;
  35755. $11=$recv($12)._yourself();
  35756. return $recv($10)._add_($11);
  35757. $ctx3.sendIdx["add:"]=2;
  35758. };
  35759. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35760. }));
  35761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35762. }));
  35763. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35764. },
  35765. args: ["aNode"],
  35766. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  35767. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35768. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35769. }),
  35770. $globals.IRASTTranslator);
  35771. $core.addMethod(
  35772. $core.method({
  35773. selector: "visitCascadeNode:",
  35774. protocol: 'visiting',
  35775. fn: function (aNode){
  35776. var self=this;
  35777. return $core.withContext(function($ctx1) {
  35778. var $1,$2,$4,$3;
  35779. $1=$recv(aNode)._nodes();
  35780. $ctx1.sendIdx["nodes"]=1;
  35781. $recv($1)._inject_into_($recv(aNode)._receiver(),(function(previous,each){
  35782. var receiver;
  35783. return $core.withContext(function($ctx2) {
  35784. $2=$recv(previous)._isImmutable();
  35785. if($core.assert($2)){
  35786. receiver=previous;
  35787. } else {
  35788. var alias;
  35789. alias=self._alias_(previous);
  35790. alias;
  35791. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35792. };
  35793. receiver;
  35794. $recv(each)._receiver_(receiver);
  35795. return receiver;
  35796. }, function($ctx2) {$ctx2.fillBlock({previous:previous,each:each,receiver:receiver},$ctx1,1)});
  35797. }));
  35798. $4=$recv(aNode)._nodes();
  35799. $ctx1.sendIdx["nodes"]=2;
  35800. $3=$recv($4)._allButLast();
  35801. $recv($3)._do_((function(each){
  35802. return $core.withContext(function($ctx2) {
  35803. return $recv(self._sequence())._add_(self._visit_(each));
  35804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35805. }));
  35806. return self._visitOrAlias_($recv($recv(aNode)._nodes())._last());
  35807. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35808. },
  35809. args: ["aNode"],
  35810. source: "visitCascadeNode: aNode\x0a\x09aNode nodes inject: aNode receiver into: [ :previous :each |\x0a\x09\x09| receiver |\x0a\x09\x09receiver := previous isImmutable \x0a\x09\x09\x09ifTrue: [ previous ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09| alias |\x0a\x09\x09\x09\x09alias := self alias: previous.\x0a\x09\x09\x09\x09VariableNode new binding: alias variable ].\x0a\x09\x09each receiver: receiver.\x0a\x09\x09receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode nodes last",
  35811. referencedClasses: ["VariableNode"],
  35812. messageSends: ["inject:into:", "nodes", "receiver", "ifTrue:ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "receiver:", "do:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35813. }),
  35814. $globals.IRASTTranslator);
  35815. $core.addMethod(
  35816. $core.method({
  35817. selector: "visitDynamicArrayNode:",
  35818. protocol: 'visiting',
  35819. fn: function (aNode){
  35820. var self=this;
  35821. var array;
  35822. return $core.withContext(function($ctx1) {
  35823. array=$recv($globals.IRDynamicArray)._new();
  35824. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35825. return $core.withContext(function($ctx2) {
  35826. return $recv(array)._add_(each);
  35827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35828. }));
  35829. return array;
  35830. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35831. },
  35832. args: ["aNode"],
  35833. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35834. referencedClasses: ["IRDynamicArray"],
  35835. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35836. }),
  35837. $globals.IRASTTranslator);
  35838. $core.addMethod(
  35839. $core.method({
  35840. selector: "visitDynamicDictionaryNode:",
  35841. protocol: 'visiting',
  35842. fn: function (aNode){
  35843. var self=this;
  35844. var dictionary;
  35845. return $core.withContext(function($ctx1) {
  35846. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35847. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35848. return $core.withContext(function($ctx2) {
  35849. return $recv(dictionary)._add_(each);
  35850. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35851. }));
  35852. return dictionary;
  35853. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35854. },
  35855. args: ["aNode"],
  35856. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35857. referencedClasses: ["IRDynamicDictionary"],
  35858. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35859. }),
  35860. $globals.IRASTTranslator);
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "visitJSStatementNode:",
  35864. protocol: 'visiting',
  35865. fn: function (aNode){
  35866. var self=this;
  35867. return $core.withContext(function($ctx1) {
  35868. var $1;
  35869. $1=$recv($globals.IRVerbatim)._new();
  35870. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35871. return $recv($1)._yourself();
  35872. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35873. },
  35874. args: ["aNode"],
  35875. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35876. referencedClasses: ["IRVerbatim"],
  35877. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35878. }),
  35879. $globals.IRASTTranslator);
  35880. $core.addMethod(
  35881. $core.method({
  35882. selector: "visitMethodNode:",
  35883. protocol: 'visiting',
  35884. fn: function (aNode){
  35885. var self=this;
  35886. return $core.withContext(function($ctx1) {
  35887. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35888. $2=$recv($globals.IRMethod)._new();
  35889. $ctx1.sendIdx["new"]=1;
  35890. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35891. $ctx1.sendIdx["source:"]=1;
  35892. $recv($2)._theClass_(self._theClass());
  35893. $recv($2)._arguments_($recv(aNode)._arguments());
  35894. $recv($2)._selector_($recv(aNode)._selector());
  35895. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35896. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35897. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35898. $3=$recv(aNode)._scope();
  35899. $ctx1.sendIdx["scope"]=1;
  35900. $recv($2)._scope_($3);
  35901. $ctx1.sendIdx["scope:"]=1;
  35902. $4=$recv($2)._yourself();
  35903. $ctx1.sendIdx["yourself"]=1;
  35904. $1=$4;
  35905. self._method_($1);
  35906. $6=$recv(aNode)._scope();
  35907. $ctx1.sendIdx["scope"]=2;
  35908. $5=$recv($6)._temps();
  35909. $recv($5)._do_((function(each){
  35910. return $core.withContext(function($ctx2) {
  35911. $7=self._method();
  35912. $ctx2.sendIdx["method"]=1;
  35913. $9=$recv($globals.IRTempDeclaration)._new();
  35914. $ctx2.sendIdx["new"]=2;
  35915. $recv($9)._name_($recv(each)._name());
  35916. $10=$recv(aNode)._scope();
  35917. $ctx2.sendIdx["scope"]=3;
  35918. $recv($9)._scope_($10);
  35919. $11=$recv($9)._yourself();
  35920. $ctx2.sendIdx["yourself"]=2;
  35921. $8=$11;
  35922. return $recv($7)._add_($8);
  35923. $ctx2.sendIdx["add:"]=1;
  35924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35925. }));
  35926. $ctx1.sendIdx["do:"]=1;
  35927. $recv($recv(aNode)._nodes())._do_((function(each){
  35928. return $core.withContext(function($ctx2) {
  35929. $12=self._method();
  35930. $ctx2.sendIdx["method"]=2;
  35931. return $recv($12)._add_(self._visit_(each));
  35932. $ctx2.sendIdx["add:"]=2;
  35933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35934. }));
  35935. $14=$recv(aNode)._scope();
  35936. $ctx1.sendIdx["scope"]=4;
  35937. $13=$recv($14)._hasLocalReturn();
  35938. if(!$core.assert($13)){
  35939. $15=self._method();
  35940. $ctx1.sendIdx["method"]=3;
  35941. $17=$recv($globals.IRReturn)._new();
  35942. $ctx1.sendIdx["new"]=3;
  35943. $19=$recv($globals.IRVariable)._new();
  35944. $ctx1.sendIdx["new"]=4;
  35945. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35946. $20=$recv($19)._yourself();
  35947. $ctx1.sendIdx["yourself"]=3;
  35948. $18=$20;
  35949. $recv($17)._add_($18);
  35950. $ctx1.sendIdx["add:"]=4;
  35951. $21=$recv($17)._yourself();
  35952. $ctx1.sendIdx["yourself"]=4;
  35953. $16=$21;
  35954. $recv($15)._add_($16);
  35955. $ctx1.sendIdx["add:"]=3;
  35956. $23=$recv($globals.IRVerbatim)._new();
  35957. $recv($23)._source_("");
  35958. $22=$recv($23)._yourself();
  35959. $recv($15)._add_($22);
  35960. };
  35961. return self._method();
  35962. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35963. },
  35964. args: ["aNode"],
  35965. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  35966. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35967. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  35968. }),
  35969. $globals.IRASTTranslator);
  35970. $core.addMethod(
  35971. $core.method({
  35972. selector: "visitOrAlias:",
  35973. protocol: 'visiting',
  35974. fn: function (aNode){
  35975. var self=this;
  35976. return $core.withContext(function($ctx1) {
  35977. var $1;
  35978. $1=$recv(aNode)._shouldBeAliased();
  35979. if($core.assert($1)){
  35980. return self._alias_(aNode);
  35981. } else {
  35982. return self._visit_(aNode);
  35983. };
  35984. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35985. },
  35986. args: ["aNode"],
  35987. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35988. referencedClasses: [],
  35989. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35990. }),
  35991. $globals.IRASTTranslator);
  35992. $core.addMethod(
  35993. $core.method({
  35994. selector: "visitReturnNode:",
  35995. protocol: 'visiting',
  35996. fn: function (aNode){
  35997. var self=this;
  35998. var return_;
  35999. return $core.withContext(function($ctx1) {
  36000. var $1;
  36001. $1=$recv(aNode)._nonLocalReturn();
  36002. if($core.assert($1)){
  36003. return_=$recv($globals.IRNonLocalReturn)._new();
  36004. $ctx1.sendIdx["new"]=1;
  36005. } else {
  36006. return_=$recv($globals.IRReturn)._new();
  36007. };
  36008. $recv(return_)._scope_($recv(aNode)._scope());
  36009. $recv($recv(aNode)._nodes())._do_((function(each){
  36010. return $core.withContext(function($ctx2) {
  36011. return $recv(return_)._add_(self._visitOrAlias_(each));
  36012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36013. }));
  36014. return return_;
  36015. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36016. },
  36017. args: ["aNode"],
  36018. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  36019. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36020. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visitOrAlias:"]
  36021. }),
  36022. $globals.IRASTTranslator);
  36023. $core.addMethod(
  36024. $core.method({
  36025. selector: "visitSendNode:",
  36026. protocol: 'visiting',
  36027. fn: function (aNode){
  36028. var self=this;
  36029. var send;
  36030. return $core.withContext(function($ctx1) {
  36031. var $1;
  36032. send=$recv($globals.IRSend)._new();
  36033. $1=send;
  36034. $recv($1)._selector_($recv(aNode)._selector());
  36035. $recv($1)._index_($recv(aNode)._index());
  36036. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36037. return $core.withContext(function($ctx2) {
  36038. return $recv(send)._add_(each);
  36039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36040. }));
  36041. return send;
  36042. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  36043. },
  36044. args: ["aNode"],
  36045. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36046. referencedClasses: ["IRSend"],
  36047. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "nodes", "add:"]
  36048. }),
  36049. $globals.IRASTTranslator);
  36050. $core.addMethod(
  36051. $core.method({
  36052. selector: "visitSequenceNode:",
  36053. protocol: 'visiting',
  36054. fn: function (aNode){
  36055. var self=this;
  36056. return $core.withContext(function($ctx1) {
  36057. var $1;
  36058. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  36059. return $core.withContext(function($ctx2) {
  36060. return $recv($recv(aNode)._nodes())._do_((function(each){
  36061. var instruction;
  36062. return $core.withContext(function($ctx3) {
  36063. instruction=self._visitOrAlias_(each);
  36064. instruction;
  36065. $1=$recv(instruction)._isVariable();
  36066. if(!$core.assert($1)){
  36067. return $recv(self._sequence())._add_(instruction);
  36068. };
  36069. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36070. }));
  36071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36072. }));
  36073. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36074. },
  36075. args: ["aNode"],
  36076. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  36077. referencedClasses: ["IRSequence"],
  36078. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36079. }),
  36080. $globals.IRASTTranslator);
  36081. $core.addMethod(
  36082. $core.method({
  36083. selector: "visitValueNode:",
  36084. protocol: 'visiting',
  36085. fn: function (aNode){
  36086. var self=this;
  36087. return $core.withContext(function($ctx1) {
  36088. var $1;
  36089. $1=$recv($globals.IRValue)._new();
  36090. $recv($1)._value_($recv(aNode)._value());
  36091. return $recv($1)._yourself();
  36092. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36093. },
  36094. args: ["aNode"],
  36095. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36096. referencedClasses: ["IRValue"],
  36097. messageSends: ["value:", "new", "value", "yourself"]
  36098. }),
  36099. $globals.IRASTTranslator);
  36100. $core.addMethod(
  36101. $core.method({
  36102. selector: "visitVariableNode:",
  36103. protocol: 'visiting',
  36104. fn: function (aNode){
  36105. var self=this;
  36106. return $core.withContext(function($ctx1) {
  36107. var $1;
  36108. $1=$recv($globals.IRVariable)._new();
  36109. $recv($1)._variable_($recv(aNode)._binding());
  36110. return $recv($1)._yourself();
  36111. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36112. },
  36113. args: ["aNode"],
  36114. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36115. referencedClasses: ["IRVariable"],
  36116. messageSends: ["variable:", "new", "binding", "yourself"]
  36117. }),
  36118. $globals.IRASTTranslator);
  36119. $core.addMethod(
  36120. $core.method({
  36121. selector: "withSequence:do:",
  36122. protocol: 'accessing',
  36123. fn: function (aSequence,aBlock){
  36124. var self=this;
  36125. var outerSequence;
  36126. return $core.withContext(function($ctx1) {
  36127. outerSequence=self._sequence();
  36128. self._sequence_(aSequence);
  36129. $ctx1.sendIdx["sequence:"]=1;
  36130. $recv(aBlock)._value();
  36131. self._sequence_(outerSequence);
  36132. return aSequence;
  36133. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36134. },
  36135. args: ["aSequence", "aBlock"],
  36136. 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",
  36137. referencedClasses: [],
  36138. messageSends: ["sequence", "sequence:", "value"]
  36139. }),
  36140. $globals.IRASTTranslator);
  36141. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36142. $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.";
  36143. $core.addMethod(
  36144. $core.method({
  36145. selector: "accept:",
  36146. protocol: 'visiting',
  36147. fn: function (aVisitor){
  36148. var self=this;
  36149. return $core.withContext(function($ctx1) {
  36150. return $recv(aVisitor)._visitIRInstruction_(self);
  36151. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36152. },
  36153. args: ["aVisitor"],
  36154. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36155. referencedClasses: [],
  36156. messageSends: ["visitIRInstruction:"]
  36157. }),
  36158. $globals.IRInstruction);
  36159. $core.addMethod(
  36160. $core.method({
  36161. selector: "add:",
  36162. protocol: 'building',
  36163. fn: function (anObject){
  36164. var self=this;
  36165. return $core.withContext(function($ctx1) {
  36166. $recv(anObject)._parent_(self);
  36167. return $recv(self._instructions())._add_(anObject);
  36168. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36169. },
  36170. args: ["anObject"],
  36171. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36172. referencedClasses: [],
  36173. messageSends: ["parent:", "add:", "instructions"]
  36174. }),
  36175. $globals.IRInstruction);
  36176. $core.addMethod(
  36177. $core.method({
  36178. selector: "canBeAssigned",
  36179. protocol: 'testing',
  36180. fn: function (){
  36181. var self=this;
  36182. return true;
  36183. },
  36184. args: [],
  36185. source: "canBeAssigned\x0a\x09^ true",
  36186. referencedClasses: [],
  36187. messageSends: []
  36188. }),
  36189. $globals.IRInstruction);
  36190. $core.addMethod(
  36191. $core.method({
  36192. selector: "instructions",
  36193. protocol: 'accessing',
  36194. fn: function (){
  36195. var self=this;
  36196. return $core.withContext(function($ctx1) {
  36197. var $1,$receiver;
  36198. $1=self["@instructions"];
  36199. if(($receiver = $1) == null || $receiver.isNil){
  36200. self["@instructions"]=$recv($globals.OrderedCollection)._new();
  36201. return self["@instructions"];
  36202. } else {
  36203. return $1;
  36204. };
  36205. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36206. },
  36207. args: [],
  36208. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36209. referencedClasses: ["OrderedCollection"],
  36210. messageSends: ["ifNil:", "new"]
  36211. }),
  36212. $globals.IRInstruction);
  36213. $core.addMethod(
  36214. $core.method({
  36215. selector: "isClosure",
  36216. protocol: 'testing',
  36217. fn: function (){
  36218. var self=this;
  36219. return false;
  36220. },
  36221. args: [],
  36222. source: "isClosure\x0a\x09^ false",
  36223. referencedClasses: [],
  36224. messageSends: []
  36225. }),
  36226. $globals.IRInstruction);
  36227. $core.addMethod(
  36228. $core.method({
  36229. selector: "isInlined",
  36230. protocol: 'testing',
  36231. fn: function (){
  36232. var self=this;
  36233. return false;
  36234. },
  36235. args: [],
  36236. source: "isInlined\x0a\x09^ false",
  36237. referencedClasses: [],
  36238. messageSends: []
  36239. }),
  36240. $globals.IRInstruction);
  36241. $core.addMethod(
  36242. $core.method({
  36243. selector: "isLocalReturn",
  36244. protocol: 'testing',
  36245. fn: function (){
  36246. var self=this;
  36247. return false;
  36248. },
  36249. args: [],
  36250. source: "isLocalReturn\x0a\x09^ false",
  36251. referencedClasses: [],
  36252. messageSends: []
  36253. }),
  36254. $globals.IRInstruction);
  36255. $core.addMethod(
  36256. $core.method({
  36257. selector: "isMethod",
  36258. protocol: 'testing',
  36259. fn: function (){
  36260. var self=this;
  36261. return false;
  36262. },
  36263. args: [],
  36264. source: "isMethod\x0a\x09^ false",
  36265. referencedClasses: [],
  36266. messageSends: []
  36267. }),
  36268. $globals.IRInstruction);
  36269. $core.addMethod(
  36270. $core.method({
  36271. selector: "isReturn",
  36272. protocol: 'testing',
  36273. fn: function (){
  36274. var self=this;
  36275. return false;
  36276. },
  36277. args: [],
  36278. source: "isReturn\x0a\x09^ false",
  36279. referencedClasses: [],
  36280. messageSends: []
  36281. }),
  36282. $globals.IRInstruction);
  36283. $core.addMethod(
  36284. $core.method({
  36285. selector: "isSend",
  36286. protocol: 'testing',
  36287. fn: function (){
  36288. var self=this;
  36289. return false;
  36290. },
  36291. args: [],
  36292. source: "isSend\x0a\x09^ false",
  36293. referencedClasses: [],
  36294. messageSends: []
  36295. }),
  36296. $globals.IRInstruction);
  36297. $core.addMethod(
  36298. $core.method({
  36299. selector: "isSequence",
  36300. protocol: 'testing',
  36301. fn: function (){
  36302. var self=this;
  36303. return false;
  36304. },
  36305. args: [],
  36306. source: "isSequence\x0a\x09^ false",
  36307. referencedClasses: [],
  36308. messageSends: []
  36309. }),
  36310. $globals.IRInstruction);
  36311. $core.addMethod(
  36312. $core.method({
  36313. selector: "isTempDeclaration",
  36314. protocol: 'testing',
  36315. fn: function (){
  36316. var self=this;
  36317. return false;
  36318. },
  36319. args: [],
  36320. source: "isTempDeclaration\x0a\x09^ false",
  36321. referencedClasses: [],
  36322. messageSends: []
  36323. }),
  36324. $globals.IRInstruction);
  36325. $core.addMethod(
  36326. $core.method({
  36327. selector: "isVariable",
  36328. protocol: 'testing',
  36329. fn: function (){
  36330. var self=this;
  36331. return false;
  36332. },
  36333. args: [],
  36334. source: "isVariable\x0a\x09^ false",
  36335. referencedClasses: [],
  36336. messageSends: []
  36337. }),
  36338. $globals.IRInstruction);
  36339. $core.addMethod(
  36340. $core.method({
  36341. selector: "method",
  36342. protocol: 'accessing',
  36343. fn: function (){
  36344. var self=this;
  36345. return $core.withContext(function($ctx1) {
  36346. return $recv(self._parent())._method();
  36347. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36348. },
  36349. args: [],
  36350. source: "method\x0a\x09^ self parent method",
  36351. referencedClasses: [],
  36352. messageSends: ["method", "parent"]
  36353. }),
  36354. $globals.IRInstruction);
  36355. $core.addMethod(
  36356. $core.method({
  36357. selector: "needsBoxingAsReceiver",
  36358. protocol: 'testing',
  36359. fn: function (){
  36360. var self=this;
  36361. return true;
  36362. },
  36363. args: [],
  36364. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36365. referencedClasses: [],
  36366. messageSends: []
  36367. }),
  36368. $globals.IRInstruction);
  36369. $core.addMethod(
  36370. $core.method({
  36371. selector: "parent",
  36372. protocol: 'accessing',
  36373. fn: function (){
  36374. var self=this;
  36375. return self["@parent"];
  36376. },
  36377. args: [],
  36378. source: "parent\x0a\x09^ parent",
  36379. referencedClasses: [],
  36380. messageSends: []
  36381. }),
  36382. $globals.IRInstruction);
  36383. $core.addMethod(
  36384. $core.method({
  36385. selector: "parent:",
  36386. protocol: 'accessing',
  36387. fn: function (anIRInstruction){
  36388. var self=this;
  36389. self["@parent"]=anIRInstruction;
  36390. return self;
  36391. },
  36392. args: ["anIRInstruction"],
  36393. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36394. referencedClasses: [],
  36395. messageSends: []
  36396. }),
  36397. $globals.IRInstruction);
  36398. $core.addMethod(
  36399. $core.method({
  36400. selector: "remove",
  36401. protocol: 'building',
  36402. fn: function (){
  36403. var self=this;
  36404. return $core.withContext(function($ctx1) {
  36405. $recv(self._parent())._remove_(self);
  36406. return self;
  36407. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  36408. },
  36409. args: [],
  36410. source: "remove\x0a\x09self parent remove: self",
  36411. referencedClasses: [],
  36412. messageSends: ["remove:", "parent"]
  36413. }),
  36414. $globals.IRInstruction);
  36415. $core.addMethod(
  36416. $core.method({
  36417. selector: "remove:",
  36418. protocol: 'building',
  36419. fn: function (anIRInstruction){
  36420. var self=this;
  36421. return $core.withContext(function($ctx1) {
  36422. $recv(self._instructions())._remove_(anIRInstruction);
  36423. return self;
  36424. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36425. },
  36426. args: ["anIRInstruction"],
  36427. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36428. referencedClasses: [],
  36429. messageSends: ["remove:", "instructions"]
  36430. }),
  36431. $globals.IRInstruction);
  36432. $core.addMethod(
  36433. $core.method({
  36434. selector: "replace:with:",
  36435. protocol: 'building',
  36436. fn: function (anIRInstruction,anotherIRInstruction){
  36437. var self=this;
  36438. return $core.withContext(function($ctx1) {
  36439. var $1;
  36440. $recv(anotherIRInstruction)._parent_(self);
  36441. $1=self._instructions();
  36442. $ctx1.sendIdx["instructions"]=1;
  36443. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36444. return self;
  36445. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36446. },
  36447. args: ["anIRInstruction", "anotherIRInstruction"],
  36448. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36449. referencedClasses: [],
  36450. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36451. }),
  36452. $globals.IRInstruction);
  36453. $core.addMethod(
  36454. $core.method({
  36455. selector: "replaceWith:",
  36456. protocol: 'building',
  36457. fn: function (anIRInstruction){
  36458. var self=this;
  36459. return $core.withContext(function($ctx1) {
  36460. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36461. return self;
  36462. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36463. },
  36464. args: ["anIRInstruction"],
  36465. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36466. referencedClasses: [],
  36467. messageSends: ["replace:with:", "parent"]
  36468. }),
  36469. $globals.IRInstruction);
  36470. $core.addMethod(
  36471. $core.method({
  36472. selector: "scope",
  36473. protocol: 'accessing',
  36474. fn: function (){
  36475. var self=this;
  36476. return $core.withContext(function($ctx1) {
  36477. var $1,$receiver;
  36478. $1=self._parent();
  36479. if(($receiver = $1) == null || $receiver.isNil){
  36480. return $1;
  36481. } else {
  36482. var node;
  36483. node=$receiver;
  36484. return $recv(node)._scope();
  36485. };
  36486. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36487. },
  36488. args: [],
  36489. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36490. referencedClasses: [],
  36491. messageSends: ["ifNotNil:", "parent", "scope"]
  36492. }),
  36493. $globals.IRInstruction);
  36494. $core.addMethod(
  36495. $core.method({
  36496. selector: "on:",
  36497. protocol: 'instance creation',
  36498. fn: function (aBuilder){
  36499. var self=this;
  36500. return $core.withContext(function($ctx1) {
  36501. var $1;
  36502. $1=self._new();
  36503. $recv($1)._builder_(aBuilder);
  36504. return $recv($1)._yourself();
  36505. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36506. },
  36507. args: ["aBuilder"],
  36508. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36509. referencedClasses: [],
  36510. messageSends: ["builder:", "new", "yourself"]
  36511. }),
  36512. $globals.IRInstruction.klass);
  36513. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36514. $core.addMethod(
  36515. $core.method({
  36516. selector: "accept:",
  36517. protocol: 'visiting',
  36518. fn: function (aVisitor){
  36519. var self=this;
  36520. return $core.withContext(function($ctx1) {
  36521. return $recv(aVisitor)._visitIRAssignment_(self);
  36522. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36523. },
  36524. args: ["aVisitor"],
  36525. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36526. referencedClasses: [],
  36527. messageSends: ["visitIRAssignment:"]
  36528. }),
  36529. $globals.IRAssignment);
  36530. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36531. $core.addMethod(
  36532. $core.method({
  36533. selector: "accept:",
  36534. protocol: 'visiting',
  36535. fn: function (aVisitor){
  36536. var self=this;
  36537. return $core.withContext(function($ctx1) {
  36538. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36539. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36540. },
  36541. args: ["aVisitor"],
  36542. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36543. referencedClasses: [],
  36544. messageSends: ["visitIRDynamicArray:"]
  36545. }),
  36546. $globals.IRDynamicArray);
  36547. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36548. $core.addMethod(
  36549. $core.method({
  36550. selector: "accept:",
  36551. protocol: 'visiting',
  36552. fn: function (aVisitor){
  36553. var self=this;
  36554. return $core.withContext(function($ctx1) {
  36555. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36556. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36557. },
  36558. args: ["aVisitor"],
  36559. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36560. referencedClasses: [],
  36561. messageSends: ["visitIRDynamicDictionary:"]
  36562. }),
  36563. $globals.IRDynamicDictionary);
  36564. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36565. $core.addMethod(
  36566. $core.method({
  36567. selector: "scope",
  36568. protocol: 'accessing',
  36569. fn: function (){
  36570. var self=this;
  36571. return self["@scope"];
  36572. },
  36573. args: [],
  36574. source: "scope\x0a\x09^ scope",
  36575. referencedClasses: [],
  36576. messageSends: []
  36577. }),
  36578. $globals.IRScopedInstruction);
  36579. $core.addMethod(
  36580. $core.method({
  36581. selector: "scope:",
  36582. protocol: 'accessing',
  36583. fn: function (aScope){
  36584. var self=this;
  36585. self["@scope"]=aScope;
  36586. return self;
  36587. },
  36588. args: ["aScope"],
  36589. source: "scope: aScope\x0a\x09scope := aScope",
  36590. referencedClasses: [],
  36591. messageSends: []
  36592. }),
  36593. $globals.IRScopedInstruction);
  36594. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36595. $core.addMethod(
  36596. $core.method({
  36597. selector: "arguments",
  36598. protocol: 'accessing',
  36599. fn: function (){
  36600. var self=this;
  36601. return $core.withContext(function($ctx1) {
  36602. var $1,$receiver;
  36603. $1=self["@arguments"];
  36604. if(($receiver = $1) == null || $receiver.isNil){
  36605. return [];
  36606. } else {
  36607. return $1;
  36608. };
  36609. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36610. },
  36611. args: [],
  36612. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36613. referencedClasses: [],
  36614. messageSends: ["ifNil:"]
  36615. }),
  36616. $globals.IRClosureInstruction);
  36617. $core.addMethod(
  36618. $core.method({
  36619. selector: "arguments:",
  36620. protocol: 'accessing',
  36621. fn: function (aCollection){
  36622. var self=this;
  36623. self["@arguments"]=aCollection;
  36624. return self;
  36625. },
  36626. args: ["aCollection"],
  36627. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36628. referencedClasses: [],
  36629. messageSends: []
  36630. }),
  36631. $globals.IRClosureInstruction);
  36632. $core.addMethod(
  36633. $core.method({
  36634. selector: "locals",
  36635. protocol: 'accessing',
  36636. fn: function (){
  36637. var self=this;
  36638. return $core.withContext(function($ctx1) {
  36639. var $1;
  36640. $1=$recv(self._arguments())._copy();
  36641. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36642. return $core.withContext(function($ctx2) {
  36643. return $recv(each)._name();
  36644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36645. })));
  36646. return $recv($1)._yourself();
  36647. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36648. },
  36649. args: [],
  36650. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36651. referencedClasses: [],
  36652. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36653. }),
  36654. $globals.IRClosureInstruction);
  36655. $core.addMethod(
  36656. $core.method({
  36657. selector: "requiresSmalltalkContext",
  36658. protocol: 'accessing',
  36659. fn: function (){
  36660. var self=this;
  36661. return $core.withContext(function($ctx1) {
  36662. var $1,$receiver;
  36663. $1=self["@requiresSmalltalkContext"];
  36664. if(($receiver = $1) == null || $receiver.isNil){
  36665. return false;
  36666. } else {
  36667. return $1;
  36668. };
  36669. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36670. },
  36671. args: [],
  36672. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36673. referencedClasses: [],
  36674. messageSends: ["ifNil:"]
  36675. }),
  36676. $globals.IRClosureInstruction);
  36677. $core.addMethod(
  36678. $core.method({
  36679. selector: "requiresSmalltalkContext:",
  36680. protocol: 'accessing',
  36681. fn: function (anObject){
  36682. var self=this;
  36683. self["@requiresSmalltalkContext"]=anObject;
  36684. return self;
  36685. },
  36686. args: ["anObject"],
  36687. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36688. referencedClasses: [],
  36689. messageSends: []
  36690. }),
  36691. $globals.IRClosureInstruction);
  36692. $core.addMethod(
  36693. $core.method({
  36694. selector: "scope:",
  36695. protocol: 'accessing',
  36696. fn: function (aScope){
  36697. var self=this;
  36698. return $core.withContext(function($ctx1) {
  36699. (
  36700. $ctx1.supercall = true,
  36701. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  36702. $ctx1.supercall = false;
  36703. $recv(aScope)._instruction_(self);
  36704. return self;
  36705. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36706. },
  36707. args: ["aScope"],
  36708. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36709. referencedClasses: [],
  36710. messageSends: ["scope:", "instruction:"]
  36711. }),
  36712. $globals.IRClosureInstruction);
  36713. $core.addMethod(
  36714. $core.method({
  36715. selector: "tempDeclarations",
  36716. protocol: 'accessing',
  36717. fn: function (){
  36718. var self=this;
  36719. return $core.withContext(function($ctx1) {
  36720. return $recv(self._instructions())._select_((function(each){
  36721. return $core.withContext(function($ctx2) {
  36722. return $recv(each)._isTempDeclaration();
  36723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36724. }));
  36725. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36726. },
  36727. args: [],
  36728. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36729. referencedClasses: [],
  36730. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36731. }),
  36732. $globals.IRClosureInstruction);
  36733. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36734. $core.addMethod(
  36735. $core.method({
  36736. selector: "accept:",
  36737. protocol: 'visiting',
  36738. fn: function (aVisitor){
  36739. var self=this;
  36740. return $core.withContext(function($ctx1) {
  36741. return $recv(aVisitor)._visitIRClosure_(self);
  36742. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  36743. },
  36744. args: ["aVisitor"],
  36745. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36746. referencedClasses: [],
  36747. messageSends: ["visitIRClosure:"]
  36748. }),
  36749. $globals.IRClosure);
  36750. $core.addMethod(
  36751. $core.method({
  36752. selector: "isClosure",
  36753. protocol: 'testing',
  36754. fn: function (){
  36755. var self=this;
  36756. return true;
  36757. },
  36758. args: [],
  36759. source: "isClosure\x0a\x09^ true",
  36760. referencedClasses: [],
  36761. messageSends: []
  36762. }),
  36763. $globals.IRClosure);
  36764. $core.addMethod(
  36765. $core.method({
  36766. selector: "sequence",
  36767. protocol: 'accessing',
  36768. fn: function (){
  36769. var self=this;
  36770. return $core.withContext(function($ctx1) {
  36771. return $recv(self._instructions())._last();
  36772. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36773. },
  36774. args: [],
  36775. source: "sequence\x0a\x09^ self instructions last",
  36776. referencedClasses: [],
  36777. messageSends: ["last", "instructions"]
  36778. }),
  36779. $globals.IRClosure);
  36780. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36781. $globals.IRMethod.comment="I am a method instruction";
  36782. $core.addMethod(
  36783. $core.method({
  36784. selector: "accept:",
  36785. protocol: 'visiting',
  36786. fn: function (aVisitor){
  36787. var self=this;
  36788. return $core.withContext(function($ctx1) {
  36789. return $recv(aVisitor)._visitIRMethod_(self);
  36790. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  36791. },
  36792. args: ["aVisitor"],
  36793. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36794. referencedClasses: [],
  36795. messageSends: ["visitIRMethod:"]
  36796. }),
  36797. $globals.IRMethod);
  36798. $core.addMethod(
  36799. $core.method({
  36800. selector: "classReferences",
  36801. protocol: 'accessing',
  36802. fn: function (){
  36803. var self=this;
  36804. return self["@classReferences"];
  36805. },
  36806. args: [],
  36807. source: "classReferences\x0a\x09^ classReferences",
  36808. referencedClasses: [],
  36809. messageSends: []
  36810. }),
  36811. $globals.IRMethod);
  36812. $core.addMethod(
  36813. $core.method({
  36814. selector: "classReferences:",
  36815. protocol: 'accessing',
  36816. fn: function (aCollection){
  36817. var self=this;
  36818. self["@classReferences"]=aCollection;
  36819. return self;
  36820. },
  36821. args: ["aCollection"],
  36822. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36823. referencedClasses: [],
  36824. messageSends: []
  36825. }),
  36826. $globals.IRMethod);
  36827. $core.addMethod(
  36828. $core.method({
  36829. selector: "internalVariables",
  36830. protocol: 'accessing',
  36831. fn: function (){
  36832. var self=this;
  36833. return $core.withContext(function($ctx1) {
  36834. var $1,$receiver;
  36835. $1=self["@internalVariables"];
  36836. if(($receiver = $1) == null || $receiver.isNil){
  36837. self["@internalVariables"]=$recv($globals.Set)._new();
  36838. return self["@internalVariables"];
  36839. } else {
  36840. return $1;
  36841. };
  36842. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36843. },
  36844. args: [],
  36845. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36846. referencedClasses: ["Set"],
  36847. messageSends: ["ifNil:", "new"]
  36848. }),
  36849. $globals.IRMethod);
  36850. $core.addMethod(
  36851. $core.method({
  36852. selector: "isMethod",
  36853. protocol: 'accessing',
  36854. fn: function (){
  36855. var self=this;
  36856. return true;
  36857. },
  36858. args: [],
  36859. source: "isMethod\x0a\x09^ true",
  36860. referencedClasses: [],
  36861. messageSends: []
  36862. }),
  36863. $globals.IRMethod);
  36864. $core.addMethod(
  36865. $core.method({
  36866. selector: "messageSends",
  36867. protocol: 'accessing',
  36868. fn: function (){
  36869. var self=this;
  36870. return $core.withContext(function($ctx1) {
  36871. return $recv(self._sendIndexes())._keys();
  36872. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36873. },
  36874. args: [],
  36875. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36876. referencedClasses: [],
  36877. messageSends: ["keys", "sendIndexes"]
  36878. }),
  36879. $globals.IRMethod);
  36880. $core.addMethod(
  36881. $core.method({
  36882. selector: "method",
  36883. protocol: 'accessing',
  36884. fn: function (){
  36885. var self=this;
  36886. return self;
  36887. },
  36888. args: [],
  36889. source: "method\x0a\x09^ self",
  36890. referencedClasses: [],
  36891. messageSends: []
  36892. }),
  36893. $globals.IRMethod);
  36894. $core.addMethod(
  36895. $core.method({
  36896. selector: "selector",
  36897. protocol: 'accessing',
  36898. fn: function (){
  36899. var self=this;
  36900. return self["@selector"];
  36901. },
  36902. args: [],
  36903. source: "selector\x0a\x09^ selector",
  36904. referencedClasses: [],
  36905. messageSends: []
  36906. }),
  36907. $globals.IRMethod);
  36908. $core.addMethod(
  36909. $core.method({
  36910. selector: "selector:",
  36911. protocol: 'accessing',
  36912. fn: function (aString){
  36913. var self=this;
  36914. self["@selector"]=aString;
  36915. return self;
  36916. },
  36917. args: ["aString"],
  36918. source: "selector: aString\x0a\x09selector := aString",
  36919. referencedClasses: [],
  36920. messageSends: []
  36921. }),
  36922. $globals.IRMethod);
  36923. $core.addMethod(
  36924. $core.method({
  36925. selector: "sendIndexes",
  36926. protocol: 'accessing',
  36927. fn: function (){
  36928. var self=this;
  36929. return self["@sendIndexes"];
  36930. },
  36931. args: [],
  36932. source: "sendIndexes\x0a\x09^ sendIndexes",
  36933. referencedClasses: [],
  36934. messageSends: []
  36935. }),
  36936. $globals.IRMethod);
  36937. $core.addMethod(
  36938. $core.method({
  36939. selector: "sendIndexes:",
  36940. protocol: 'accessing',
  36941. fn: function (aDictionary){
  36942. var self=this;
  36943. self["@sendIndexes"]=aDictionary;
  36944. return self;
  36945. },
  36946. args: ["aDictionary"],
  36947. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36948. referencedClasses: [],
  36949. messageSends: []
  36950. }),
  36951. $globals.IRMethod);
  36952. $core.addMethod(
  36953. $core.method({
  36954. selector: "source",
  36955. protocol: 'accessing',
  36956. fn: function (){
  36957. var self=this;
  36958. return self["@source"];
  36959. },
  36960. args: [],
  36961. source: "source\x0a\x09^ source",
  36962. referencedClasses: [],
  36963. messageSends: []
  36964. }),
  36965. $globals.IRMethod);
  36966. $core.addMethod(
  36967. $core.method({
  36968. selector: "source:",
  36969. protocol: 'accessing',
  36970. fn: function (aString){
  36971. var self=this;
  36972. self["@source"]=aString;
  36973. return self;
  36974. },
  36975. args: ["aString"],
  36976. source: "source: aString\x0a\x09source := aString",
  36977. referencedClasses: [],
  36978. messageSends: []
  36979. }),
  36980. $globals.IRMethod);
  36981. $core.addMethod(
  36982. $core.method({
  36983. selector: "theClass",
  36984. protocol: 'accessing',
  36985. fn: function (){
  36986. var self=this;
  36987. return self["@theClass"];
  36988. },
  36989. args: [],
  36990. source: "theClass\x0a\x09^ theClass",
  36991. referencedClasses: [],
  36992. messageSends: []
  36993. }),
  36994. $globals.IRMethod);
  36995. $core.addMethod(
  36996. $core.method({
  36997. selector: "theClass:",
  36998. protocol: 'accessing',
  36999. fn: function (aClass){
  37000. var self=this;
  37001. self["@theClass"]=aClass;
  37002. return self;
  37003. },
  37004. args: ["aClass"],
  37005. source: "theClass: aClass\x0a\x09theClass := aClass",
  37006. referencedClasses: [],
  37007. messageSends: []
  37008. }),
  37009. $globals.IRMethod);
  37010. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37011. $globals.IRReturn.comment="I am a local return instruction.";
  37012. $core.addMethod(
  37013. $core.method({
  37014. selector: "accept:",
  37015. protocol: 'visiting',
  37016. fn: function (aVisitor){
  37017. var self=this;
  37018. return $core.withContext(function($ctx1) {
  37019. return $recv(aVisitor)._visitIRReturn_(self);
  37020. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37021. },
  37022. args: ["aVisitor"],
  37023. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37024. referencedClasses: [],
  37025. messageSends: ["visitIRReturn:"]
  37026. }),
  37027. $globals.IRReturn);
  37028. $core.addMethod(
  37029. $core.method({
  37030. selector: "canBeAssigned",
  37031. protocol: 'testing',
  37032. fn: function (){
  37033. var self=this;
  37034. return false;
  37035. },
  37036. args: [],
  37037. source: "canBeAssigned\x0a\x09^ false",
  37038. referencedClasses: [],
  37039. messageSends: []
  37040. }),
  37041. $globals.IRReturn);
  37042. $core.addMethod(
  37043. $core.method({
  37044. selector: "isBlockReturn",
  37045. protocol: 'testing',
  37046. fn: function (){
  37047. var self=this;
  37048. return false;
  37049. },
  37050. args: [],
  37051. source: "isBlockReturn\x0a\x09^ false",
  37052. referencedClasses: [],
  37053. messageSends: []
  37054. }),
  37055. $globals.IRReturn);
  37056. $core.addMethod(
  37057. $core.method({
  37058. selector: "isLocalReturn",
  37059. protocol: 'testing',
  37060. fn: function (){
  37061. var self=this;
  37062. return true;
  37063. },
  37064. args: [],
  37065. source: "isLocalReturn\x0a\x09^ true",
  37066. referencedClasses: [],
  37067. messageSends: []
  37068. }),
  37069. $globals.IRReturn);
  37070. $core.addMethod(
  37071. $core.method({
  37072. selector: "isNonLocalReturn",
  37073. protocol: 'testing',
  37074. fn: function (){
  37075. var self=this;
  37076. return $core.withContext(function($ctx1) {
  37077. return $recv(self._isLocalReturn())._not();
  37078. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37079. },
  37080. args: [],
  37081. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37082. referencedClasses: [],
  37083. messageSends: ["not", "isLocalReturn"]
  37084. }),
  37085. $globals.IRReturn);
  37086. $core.addMethod(
  37087. $core.method({
  37088. selector: "isReturn",
  37089. protocol: 'testing',
  37090. fn: function (){
  37091. var self=this;
  37092. return true;
  37093. },
  37094. args: [],
  37095. source: "isReturn\x0a\x09^ true",
  37096. referencedClasses: [],
  37097. messageSends: []
  37098. }),
  37099. $globals.IRReturn);
  37100. $core.addMethod(
  37101. $core.method({
  37102. selector: "scope",
  37103. protocol: 'accessing',
  37104. fn: function (){
  37105. var self=this;
  37106. return $core.withContext(function($ctx1) {
  37107. var $1,$receiver;
  37108. $1=self["@scope"];
  37109. if(($receiver = $1) == null || $receiver.isNil){
  37110. return $recv(self._parent())._scope();
  37111. } else {
  37112. return $1;
  37113. };
  37114. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37115. },
  37116. args: [],
  37117. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37118. referencedClasses: [],
  37119. messageSends: ["ifNil:", "scope", "parent"]
  37120. }),
  37121. $globals.IRReturn);
  37122. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37123. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37124. $core.addMethod(
  37125. $core.method({
  37126. selector: "accept:",
  37127. protocol: 'visiting',
  37128. fn: function (aVisitor){
  37129. var self=this;
  37130. return $core.withContext(function($ctx1) {
  37131. return $recv(aVisitor)._visitIRBlockReturn_(self);
  37132. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37133. },
  37134. args: ["aVisitor"],
  37135. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37136. referencedClasses: [],
  37137. messageSends: ["visitIRBlockReturn:"]
  37138. }),
  37139. $globals.IRBlockReturn);
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "isBlockReturn",
  37143. protocol: 'testing',
  37144. fn: function (){
  37145. var self=this;
  37146. return true;
  37147. },
  37148. args: [],
  37149. source: "isBlockReturn\x0a\x09^ true",
  37150. referencedClasses: [],
  37151. messageSends: []
  37152. }),
  37153. $globals.IRBlockReturn);
  37154. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37155. $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.";
  37156. $core.addMethod(
  37157. $core.method({
  37158. selector: "accept:",
  37159. protocol: 'visiting',
  37160. fn: function (aVisitor){
  37161. var self=this;
  37162. return $core.withContext(function($ctx1) {
  37163. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  37164. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37165. },
  37166. args: ["aVisitor"],
  37167. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37168. referencedClasses: [],
  37169. messageSends: ["visitIRNonLocalReturn:"]
  37170. }),
  37171. $globals.IRNonLocalReturn);
  37172. $core.addMethod(
  37173. $core.method({
  37174. selector: "isLocalReturn",
  37175. protocol: 'testing',
  37176. fn: function (){
  37177. var self=this;
  37178. return false;
  37179. },
  37180. args: [],
  37181. source: "isLocalReturn\x0a\x09^ false",
  37182. referencedClasses: [],
  37183. messageSends: []
  37184. }),
  37185. $globals.IRNonLocalReturn);
  37186. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37187. $core.addMethod(
  37188. $core.method({
  37189. selector: "accept:",
  37190. protocol: 'visiting',
  37191. fn: function (aVisitor){
  37192. var self=this;
  37193. return $core.withContext(function($ctx1) {
  37194. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  37195. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  37196. },
  37197. args: ["aVisitor"],
  37198. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37199. referencedClasses: [],
  37200. messageSends: ["visitIRTempDeclaration:"]
  37201. }),
  37202. $globals.IRTempDeclaration);
  37203. $core.addMethod(
  37204. $core.method({
  37205. selector: "isTempDeclaration",
  37206. protocol: 'testing',
  37207. fn: function (){
  37208. var self=this;
  37209. return true;
  37210. },
  37211. args: [],
  37212. source: "isTempDeclaration\x0a\x09^ true",
  37213. referencedClasses: [],
  37214. messageSends: []
  37215. }),
  37216. $globals.IRTempDeclaration);
  37217. $core.addMethod(
  37218. $core.method({
  37219. selector: "name",
  37220. protocol: 'accessing',
  37221. fn: function (){
  37222. var self=this;
  37223. return self["@name"];
  37224. },
  37225. args: [],
  37226. source: "name\x0a\x09^ name",
  37227. referencedClasses: [],
  37228. messageSends: []
  37229. }),
  37230. $globals.IRTempDeclaration);
  37231. $core.addMethod(
  37232. $core.method({
  37233. selector: "name:",
  37234. protocol: 'accessing',
  37235. fn: function (aString){
  37236. var self=this;
  37237. self["@name"]=aString;
  37238. return self;
  37239. },
  37240. args: ["aString"],
  37241. source: "name: aString\x0a\x09name := aString",
  37242. referencedClasses: [],
  37243. messageSends: []
  37244. }),
  37245. $globals.IRTempDeclaration);
  37246. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37247. $globals.IRSend.comment="I am a message send instruction.";
  37248. $core.addMethod(
  37249. $core.method({
  37250. selector: "accept:",
  37251. protocol: 'visiting',
  37252. fn: function (aVisitor){
  37253. var self=this;
  37254. return $core.withContext(function($ctx1) {
  37255. return $recv(aVisitor)._visitIRSend_(self);
  37256. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37257. },
  37258. args: ["aVisitor"],
  37259. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37260. referencedClasses: [],
  37261. messageSends: ["visitIRSend:"]
  37262. }),
  37263. $globals.IRSend);
  37264. $core.addMethod(
  37265. $core.method({
  37266. selector: "index",
  37267. protocol: 'accessing',
  37268. fn: function (){
  37269. var self=this;
  37270. return self["@index"];
  37271. },
  37272. args: [],
  37273. source: "index\x0a\x09^ index",
  37274. referencedClasses: [],
  37275. messageSends: []
  37276. }),
  37277. $globals.IRSend);
  37278. $core.addMethod(
  37279. $core.method({
  37280. selector: "index:",
  37281. protocol: 'accessing',
  37282. fn: function (anInteger){
  37283. var self=this;
  37284. self["@index"]=anInteger;
  37285. return self;
  37286. },
  37287. args: ["anInteger"],
  37288. source: "index: anInteger\x0a\x09index := anInteger",
  37289. referencedClasses: [],
  37290. messageSends: []
  37291. }),
  37292. $globals.IRSend);
  37293. $core.addMethod(
  37294. $core.method({
  37295. selector: "isSend",
  37296. protocol: 'testing',
  37297. fn: function (){
  37298. var self=this;
  37299. return true;
  37300. },
  37301. args: [],
  37302. source: "isSend\x0a\x09^ true",
  37303. referencedClasses: [],
  37304. messageSends: []
  37305. }),
  37306. $globals.IRSend);
  37307. $core.addMethod(
  37308. $core.method({
  37309. selector: "isSuperSend",
  37310. protocol: 'accessing',
  37311. fn: function (){
  37312. var self=this;
  37313. var receiver;
  37314. return $core.withContext(function($ctx1) {
  37315. receiver=$recv(self._instructions())._first();
  37316. return $recv($recv(receiver)._isVariable())._and_((function(){
  37317. return $core.withContext(function($ctx2) {
  37318. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37320. }));
  37321. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37322. },
  37323. args: [],
  37324. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self instructions first.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37325. referencedClasses: [],
  37326. messageSends: ["first", "instructions", "and:", "isVariable", "=", "name", "variable"]
  37327. }),
  37328. $globals.IRSend);
  37329. $core.addMethod(
  37330. $core.method({
  37331. selector: "selector",
  37332. protocol: 'accessing',
  37333. fn: function (){
  37334. var self=this;
  37335. return self["@selector"];
  37336. },
  37337. args: [],
  37338. source: "selector\x0a\x09^ selector",
  37339. referencedClasses: [],
  37340. messageSends: []
  37341. }),
  37342. $globals.IRSend);
  37343. $core.addMethod(
  37344. $core.method({
  37345. selector: "selector:",
  37346. protocol: 'accessing',
  37347. fn: function (aString){
  37348. var self=this;
  37349. self["@selector"]=aString;
  37350. return self;
  37351. },
  37352. args: ["aString"],
  37353. source: "selector: aString\x0a\x09selector := aString",
  37354. referencedClasses: [],
  37355. messageSends: []
  37356. }),
  37357. $globals.IRSend);
  37358. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37359. $core.addMethod(
  37360. $core.method({
  37361. selector: "accept:",
  37362. protocol: 'visiting',
  37363. fn: function (aVisitor){
  37364. var self=this;
  37365. return $core.withContext(function($ctx1) {
  37366. return $recv(aVisitor)._visitIRSequence_(self);
  37367. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  37368. },
  37369. args: ["aVisitor"],
  37370. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37371. referencedClasses: [],
  37372. messageSends: ["visitIRSequence:"]
  37373. }),
  37374. $globals.IRSequence);
  37375. $core.addMethod(
  37376. $core.method({
  37377. selector: "isSequence",
  37378. protocol: 'testing',
  37379. fn: function (){
  37380. var self=this;
  37381. return true;
  37382. },
  37383. args: [],
  37384. source: "isSequence\x0a\x09^ true",
  37385. referencedClasses: [],
  37386. messageSends: []
  37387. }),
  37388. $globals.IRSequence);
  37389. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37390. $core.addMethod(
  37391. $core.method({
  37392. selector: "accept:",
  37393. protocol: 'visiting',
  37394. fn: function (aVisitor){
  37395. var self=this;
  37396. return $core.withContext(function($ctx1) {
  37397. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37398. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37399. },
  37400. args: ["aVisitor"],
  37401. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37402. referencedClasses: [],
  37403. messageSends: ["visitIRBlockSequence:"]
  37404. }),
  37405. $globals.IRBlockSequence);
  37406. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37407. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37408. $core.addMethod(
  37409. $core.method({
  37410. selector: "accept:",
  37411. protocol: 'visiting',
  37412. fn: function (aVisitor){
  37413. var self=this;
  37414. return $core.withContext(function($ctx1) {
  37415. return $recv(aVisitor)._visitIRValue_(self);
  37416. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  37417. },
  37418. args: ["aVisitor"],
  37419. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37420. referencedClasses: [],
  37421. messageSends: ["visitIRValue:"]
  37422. }),
  37423. $globals.IRValue);
  37424. $core.addMethod(
  37425. $core.method({
  37426. selector: "needsBoxingAsReceiver",
  37427. protocol: 'testing',
  37428. fn: function (){
  37429. var self=this;
  37430. return false;
  37431. },
  37432. args: [],
  37433. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37434. referencedClasses: [],
  37435. messageSends: []
  37436. }),
  37437. $globals.IRValue);
  37438. $core.addMethod(
  37439. $core.method({
  37440. selector: "value",
  37441. protocol: 'accessing',
  37442. fn: function (){
  37443. var self=this;
  37444. return self["@value"];
  37445. },
  37446. args: [],
  37447. source: "value\x0a\x09^ value",
  37448. referencedClasses: [],
  37449. messageSends: []
  37450. }),
  37451. $globals.IRValue);
  37452. $core.addMethod(
  37453. $core.method({
  37454. selector: "value:",
  37455. protocol: 'accessing',
  37456. fn: function (aString){
  37457. var self=this;
  37458. self["@value"]=aString;
  37459. return self;
  37460. },
  37461. args: ["aString"],
  37462. source: "value: aString\x0a\x09value := aString",
  37463. referencedClasses: [],
  37464. messageSends: []
  37465. }),
  37466. $globals.IRValue);
  37467. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37468. $globals.IRVariable.comment="I am a variable instruction.";
  37469. $core.addMethod(
  37470. $core.method({
  37471. selector: "accept:",
  37472. protocol: 'visiting',
  37473. fn: function (aVisitor){
  37474. var self=this;
  37475. return $core.withContext(function($ctx1) {
  37476. return $recv(aVisitor)._visitIRVariable_(self);
  37477. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  37478. },
  37479. args: ["aVisitor"],
  37480. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37481. referencedClasses: [],
  37482. messageSends: ["visitIRVariable:"]
  37483. }),
  37484. $globals.IRVariable);
  37485. $core.addMethod(
  37486. $core.method({
  37487. selector: "isVariable",
  37488. protocol: 'testing',
  37489. fn: function (){
  37490. var self=this;
  37491. return true;
  37492. },
  37493. args: [],
  37494. source: "isVariable\x0a\x09^ true",
  37495. referencedClasses: [],
  37496. messageSends: []
  37497. }),
  37498. $globals.IRVariable);
  37499. $core.addMethod(
  37500. $core.method({
  37501. selector: "needsBoxingAsReceiver",
  37502. protocol: 'testing',
  37503. fn: function (){
  37504. var self=this;
  37505. return $core.withContext(function($ctx1) {
  37506. return $recv($recv(self._variable())._isPseudoVar())._not();
  37507. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37508. },
  37509. args: [],
  37510. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37511. referencedClasses: [],
  37512. messageSends: ["not", "isPseudoVar", "variable"]
  37513. }),
  37514. $globals.IRVariable);
  37515. $core.addMethod(
  37516. $core.method({
  37517. selector: "variable",
  37518. protocol: 'accessing',
  37519. fn: function (){
  37520. var self=this;
  37521. return self["@variable"];
  37522. },
  37523. args: [],
  37524. source: "variable\x0a\x09^ variable",
  37525. referencedClasses: [],
  37526. messageSends: []
  37527. }),
  37528. $globals.IRVariable);
  37529. $core.addMethod(
  37530. $core.method({
  37531. selector: "variable:",
  37532. protocol: 'accessing',
  37533. fn: function (aScopeVariable){
  37534. var self=this;
  37535. self["@variable"]=aScopeVariable;
  37536. return self;
  37537. },
  37538. args: ["aScopeVariable"],
  37539. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37540. referencedClasses: [],
  37541. messageSends: []
  37542. }),
  37543. $globals.IRVariable);
  37544. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37545. $core.addMethod(
  37546. $core.method({
  37547. selector: "accept:",
  37548. protocol: 'visiting',
  37549. fn: function (aVisitor){
  37550. var self=this;
  37551. return $core.withContext(function($ctx1) {
  37552. return $recv(aVisitor)._visitIRVerbatim_(self);
  37553. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37554. },
  37555. args: ["aVisitor"],
  37556. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37557. referencedClasses: [],
  37558. messageSends: ["visitIRVerbatim:"]
  37559. }),
  37560. $globals.IRVerbatim);
  37561. $core.addMethod(
  37562. $core.method({
  37563. selector: "source",
  37564. protocol: 'accessing',
  37565. fn: function (){
  37566. var self=this;
  37567. return self["@source"];
  37568. },
  37569. args: [],
  37570. source: "source\x0a\x09^ source",
  37571. referencedClasses: [],
  37572. messageSends: []
  37573. }),
  37574. $globals.IRVerbatim);
  37575. $core.addMethod(
  37576. $core.method({
  37577. selector: "source:",
  37578. protocol: 'accessing',
  37579. fn: function (aString){
  37580. var self=this;
  37581. self["@source"]=aString;
  37582. return self;
  37583. },
  37584. args: ["aString"],
  37585. source: "source: aString\x0a\x09source := aString",
  37586. referencedClasses: [],
  37587. messageSends: []
  37588. }),
  37589. $globals.IRVerbatim);
  37590. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  37591. $core.addMethod(
  37592. $core.method({
  37593. selector: "visit:",
  37594. protocol: 'visiting',
  37595. fn: function (anIRInstruction){
  37596. var self=this;
  37597. return $core.withContext(function($ctx1) {
  37598. return $recv(anIRInstruction)._accept_(self);
  37599. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37600. },
  37601. args: ["anIRInstruction"],
  37602. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  37603. referencedClasses: [],
  37604. messageSends: ["accept:"]
  37605. }),
  37606. $globals.IRVisitor);
  37607. $core.addMethod(
  37608. $core.method({
  37609. selector: "visitIRAssignment:",
  37610. protocol: 'visiting',
  37611. fn: function (anIRAssignment){
  37612. var self=this;
  37613. return $core.withContext(function($ctx1) {
  37614. return self._visitIRInstruction_(anIRAssignment);
  37615. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37616. },
  37617. args: ["anIRAssignment"],
  37618. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  37619. referencedClasses: [],
  37620. messageSends: ["visitIRInstruction:"]
  37621. }),
  37622. $globals.IRVisitor);
  37623. $core.addMethod(
  37624. $core.method({
  37625. selector: "visitIRBlockReturn:",
  37626. protocol: 'visiting',
  37627. fn: function (anIRBlockReturn){
  37628. var self=this;
  37629. return $core.withContext(function($ctx1) {
  37630. return self._visitIRReturn_(anIRBlockReturn);
  37631. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37632. },
  37633. args: ["anIRBlockReturn"],
  37634. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37635. referencedClasses: [],
  37636. messageSends: ["visitIRReturn:"]
  37637. }),
  37638. $globals.IRVisitor);
  37639. $core.addMethod(
  37640. $core.method({
  37641. selector: "visitIRBlockSequence:",
  37642. protocol: 'visiting',
  37643. fn: function (anIRBlockSequence){
  37644. var self=this;
  37645. return $core.withContext(function($ctx1) {
  37646. return self._visitIRSequence_(anIRBlockSequence);
  37647. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37648. },
  37649. args: ["anIRBlockSequence"],
  37650. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37651. referencedClasses: [],
  37652. messageSends: ["visitIRSequence:"]
  37653. }),
  37654. $globals.IRVisitor);
  37655. $core.addMethod(
  37656. $core.method({
  37657. selector: "visitIRClosure:",
  37658. protocol: 'visiting',
  37659. fn: function (anIRClosure){
  37660. var self=this;
  37661. return $core.withContext(function($ctx1) {
  37662. return self._visitIRInstruction_(anIRClosure);
  37663. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37664. },
  37665. args: ["anIRClosure"],
  37666. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  37667. referencedClasses: [],
  37668. messageSends: ["visitIRInstruction:"]
  37669. }),
  37670. $globals.IRVisitor);
  37671. $core.addMethod(
  37672. $core.method({
  37673. selector: "visitIRDynamicArray:",
  37674. protocol: 'visiting',
  37675. fn: function (anIRDynamicArray){
  37676. var self=this;
  37677. return $core.withContext(function($ctx1) {
  37678. return self._visitIRInstruction_(anIRDynamicArray);
  37679. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37680. },
  37681. args: ["anIRDynamicArray"],
  37682. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  37683. referencedClasses: [],
  37684. messageSends: ["visitIRInstruction:"]
  37685. }),
  37686. $globals.IRVisitor);
  37687. $core.addMethod(
  37688. $core.method({
  37689. selector: "visitIRDynamicDictionary:",
  37690. protocol: 'visiting',
  37691. fn: function (anIRDynamicDictionary){
  37692. var self=this;
  37693. return $core.withContext(function($ctx1) {
  37694. return self._visitIRInstruction_(anIRDynamicDictionary);
  37695. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37696. },
  37697. args: ["anIRDynamicDictionary"],
  37698. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  37699. referencedClasses: [],
  37700. messageSends: ["visitIRInstruction:"]
  37701. }),
  37702. $globals.IRVisitor);
  37703. $core.addMethod(
  37704. $core.method({
  37705. selector: "visitIRInlinedClosure:",
  37706. protocol: 'visiting',
  37707. fn: function (anIRInlinedClosure){
  37708. var self=this;
  37709. return $core.withContext(function($ctx1) {
  37710. return self._visitIRClosure_(anIRInlinedClosure);
  37711. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37712. },
  37713. args: ["anIRInlinedClosure"],
  37714. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37715. referencedClasses: [],
  37716. messageSends: ["visitIRClosure:"]
  37717. }),
  37718. $globals.IRVisitor);
  37719. $core.addMethod(
  37720. $core.method({
  37721. selector: "visitIRInlinedSequence:",
  37722. protocol: 'visiting',
  37723. fn: function (anIRInlinedSequence){
  37724. var self=this;
  37725. return $core.withContext(function($ctx1) {
  37726. return self._visitIRSequence_(anIRInlinedSequence);
  37727. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37728. },
  37729. args: ["anIRInlinedSequence"],
  37730. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37731. referencedClasses: [],
  37732. messageSends: ["visitIRSequence:"]
  37733. }),
  37734. $globals.IRVisitor);
  37735. $core.addMethod(
  37736. $core.method({
  37737. selector: "visitIRInstruction:",
  37738. protocol: 'visiting',
  37739. fn: function (anIRInstruction){
  37740. var self=this;
  37741. return $core.withContext(function($ctx1) {
  37742. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  37743. return $core.withContext(function($ctx2) {
  37744. return self._visit_(each);
  37745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37746. }));
  37747. return anIRInstruction;
  37748. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37749. },
  37750. args: ["anIRInstruction"],
  37751. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  37752. referencedClasses: [],
  37753. messageSends: ["do:", "instructions", "visit:"]
  37754. }),
  37755. $globals.IRVisitor);
  37756. $core.addMethod(
  37757. $core.method({
  37758. selector: "visitIRMethod:",
  37759. protocol: 'visiting',
  37760. fn: function (anIRMethod){
  37761. var self=this;
  37762. return $core.withContext(function($ctx1) {
  37763. return self._visitIRInstruction_(anIRMethod);
  37764. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37765. },
  37766. args: ["anIRMethod"],
  37767. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  37768. referencedClasses: [],
  37769. messageSends: ["visitIRInstruction:"]
  37770. }),
  37771. $globals.IRVisitor);
  37772. $core.addMethod(
  37773. $core.method({
  37774. selector: "visitIRNonLocalReturn:",
  37775. protocol: 'visiting',
  37776. fn: function (anIRNonLocalReturn){
  37777. var self=this;
  37778. return $core.withContext(function($ctx1) {
  37779. return self._visitIRInstruction_(anIRNonLocalReturn);
  37780. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37781. },
  37782. args: ["anIRNonLocalReturn"],
  37783. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  37784. referencedClasses: [],
  37785. messageSends: ["visitIRInstruction:"]
  37786. }),
  37787. $globals.IRVisitor);
  37788. $core.addMethod(
  37789. $core.method({
  37790. selector: "visitIRNonLocalReturnHandling:",
  37791. protocol: 'visiting',
  37792. fn: function (anIRNonLocalReturnHandling){
  37793. var self=this;
  37794. return $core.withContext(function($ctx1) {
  37795. return self._visitIRInstruction_(anIRNonLocalReturnHandling);
  37796. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37797. },
  37798. args: ["anIRNonLocalReturnHandling"],
  37799. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  37800. referencedClasses: [],
  37801. messageSends: ["visitIRInstruction:"]
  37802. }),
  37803. $globals.IRVisitor);
  37804. $core.addMethod(
  37805. $core.method({
  37806. selector: "visitIRReturn:",
  37807. protocol: 'visiting',
  37808. fn: function (anIRReturn){
  37809. var self=this;
  37810. return $core.withContext(function($ctx1) {
  37811. return self._visitIRInstruction_(anIRReturn);
  37812. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37813. },
  37814. args: ["anIRReturn"],
  37815. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  37816. referencedClasses: [],
  37817. messageSends: ["visitIRInstruction:"]
  37818. }),
  37819. $globals.IRVisitor);
  37820. $core.addMethod(
  37821. $core.method({
  37822. selector: "visitIRSend:",
  37823. protocol: 'visiting',
  37824. fn: function (anIRSend){
  37825. var self=this;
  37826. return $core.withContext(function($ctx1) {
  37827. return self._visitIRInstruction_(anIRSend);
  37828. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37829. },
  37830. args: ["anIRSend"],
  37831. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  37832. referencedClasses: [],
  37833. messageSends: ["visitIRInstruction:"]
  37834. }),
  37835. $globals.IRVisitor);
  37836. $core.addMethod(
  37837. $core.method({
  37838. selector: "visitIRSequence:",
  37839. protocol: 'visiting',
  37840. fn: function (anIRSequence){
  37841. var self=this;
  37842. return $core.withContext(function($ctx1) {
  37843. return self._visitIRInstruction_(anIRSequence);
  37844. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37845. },
  37846. args: ["anIRSequence"],
  37847. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  37848. referencedClasses: [],
  37849. messageSends: ["visitIRInstruction:"]
  37850. }),
  37851. $globals.IRVisitor);
  37852. $core.addMethod(
  37853. $core.method({
  37854. selector: "visitIRTempDeclaration:",
  37855. protocol: 'visiting',
  37856. fn: function (anIRTempDeclaration){
  37857. var self=this;
  37858. return $core.withContext(function($ctx1) {
  37859. return self._visitIRInstruction_(anIRTempDeclaration);
  37860. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37861. },
  37862. args: ["anIRTempDeclaration"],
  37863. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  37864. referencedClasses: [],
  37865. messageSends: ["visitIRInstruction:"]
  37866. }),
  37867. $globals.IRVisitor);
  37868. $core.addMethod(
  37869. $core.method({
  37870. selector: "visitIRValue:",
  37871. protocol: 'visiting',
  37872. fn: function (anIRValue){
  37873. var self=this;
  37874. return $core.withContext(function($ctx1) {
  37875. return self._visitIRInstruction_(anIRValue);
  37876. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37877. },
  37878. args: ["anIRValue"],
  37879. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  37880. referencedClasses: [],
  37881. messageSends: ["visitIRInstruction:"]
  37882. }),
  37883. $globals.IRVisitor);
  37884. $core.addMethod(
  37885. $core.method({
  37886. selector: "visitIRVariable:",
  37887. protocol: 'visiting',
  37888. fn: function (anIRVariable){
  37889. var self=this;
  37890. return $core.withContext(function($ctx1) {
  37891. return self._visitIRInstruction_(anIRVariable);
  37892. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37893. },
  37894. args: ["anIRVariable"],
  37895. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  37896. referencedClasses: [],
  37897. messageSends: ["visitIRInstruction:"]
  37898. }),
  37899. $globals.IRVisitor);
  37900. $core.addMethod(
  37901. $core.method({
  37902. selector: "visitIRVerbatim:",
  37903. protocol: 'visiting',
  37904. fn: function (anIRVerbatim){
  37905. var self=this;
  37906. return $core.withContext(function($ctx1) {
  37907. return self._visitIRInstruction_(anIRVerbatim);
  37908. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37909. },
  37910. args: ["anIRVerbatim"],
  37911. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  37912. referencedClasses: [],
  37913. messageSends: ["visitIRInstruction:"]
  37914. }),
  37915. $globals.IRVisitor);
  37916. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37917. $core.addMethod(
  37918. $core.method({
  37919. selector: "contents",
  37920. protocol: 'accessing',
  37921. fn: function (){
  37922. var self=this;
  37923. return $core.withContext(function($ctx1) {
  37924. return $recv(self._stream())._contents();
  37925. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37926. },
  37927. args: [],
  37928. source: "contents\x0a\x09^ self stream contents",
  37929. referencedClasses: [],
  37930. messageSends: ["contents", "stream"]
  37931. }),
  37932. $globals.IRJSTranslator);
  37933. $core.addMethod(
  37934. $core.method({
  37935. selector: "currentClass",
  37936. protocol: 'accessing',
  37937. fn: function (){
  37938. var self=this;
  37939. return self["@currentClass"];
  37940. },
  37941. args: [],
  37942. source: "currentClass\x0a\x09^ currentClass",
  37943. referencedClasses: [],
  37944. messageSends: []
  37945. }),
  37946. $globals.IRJSTranslator);
  37947. $core.addMethod(
  37948. $core.method({
  37949. selector: "currentClass:",
  37950. protocol: 'accessing',
  37951. fn: function (aClass){
  37952. var self=this;
  37953. self["@currentClass"]=aClass;
  37954. return self;
  37955. },
  37956. args: ["aClass"],
  37957. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37958. referencedClasses: [],
  37959. messageSends: []
  37960. }),
  37961. $globals.IRJSTranslator);
  37962. $core.addMethod(
  37963. $core.method({
  37964. selector: "initialize",
  37965. protocol: 'initialization',
  37966. fn: function (){
  37967. var self=this;
  37968. return $core.withContext(function($ctx1) {
  37969. (
  37970. $ctx1.supercall = true,
  37971. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  37972. $ctx1.supercall = false;
  37973. self["@stream"]=$recv($globals.JSStream)._new();
  37974. return self;
  37975. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37976. },
  37977. args: [],
  37978. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37979. referencedClasses: ["JSStream"],
  37980. messageSends: ["initialize", "new"]
  37981. }),
  37982. $globals.IRJSTranslator);
  37983. $core.addMethod(
  37984. $core.method({
  37985. selector: "stream",
  37986. protocol: 'accessing',
  37987. fn: function (){
  37988. var self=this;
  37989. return self["@stream"];
  37990. },
  37991. args: [],
  37992. source: "stream\x0a\x09^ stream",
  37993. referencedClasses: [],
  37994. messageSends: []
  37995. }),
  37996. $globals.IRJSTranslator);
  37997. $core.addMethod(
  37998. $core.method({
  37999. selector: "stream:",
  38000. protocol: 'accessing',
  38001. fn: function (aStream){
  38002. var self=this;
  38003. self["@stream"]=aStream;
  38004. return self;
  38005. },
  38006. args: ["aStream"],
  38007. source: "stream: aStream\x0a\x09stream := aStream",
  38008. referencedClasses: [],
  38009. messageSends: []
  38010. }),
  38011. $globals.IRJSTranslator);
  38012. $core.addMethod(
  38013. $core.method({
  38014. selector: "visitIRAssignment:",
  38015. protocol: 'visiting',
  38016. fn: function (anIRAssignment){
  38017. var self=this;
  38018. return $core.withContext(function($ctx1) {
  38019. var $2,$1;
  38020. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  38021. return $core.withContext(function($ctx2) {
  38022. $2=$recv(anIRAssignment)._instructions();
  38023. $ctx2.sendIdx["instructions"]=1;
  38024. $1=$recv($2)._first();
  38025. return self._visit_($1);
  38026. $ctx2.sendIdx["visit:"]=1;
  38027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38028. }),(function(){
  38029. return $core.withContext(function($ctx2) {
  38030. return self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38032. }));
  38033. return self;
  38034. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38035. },
  38036. args: ["anIRAssignment"],
  38037. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment instructions first]\x0a\x09\x09rhs: [self visit: anIRAssignment instructions last].",
  38038. referencedClasses: [],
  38039. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "first", "instructions", "last"]
  38040. }),
  38041. $globals.IRJSTranslator);
  38042. $core.addMethod(
  38043. $core.method({
  38044. selector: "visitIRClosure:",
  38045. protocol: 'visiting',
  38046. fn: function (anIRClosure){
  38047. var self=this;
  38048. return $core.withContext(function($ctx1) {
  38049. var $1,$2;
  38050. $1=self._stream();
  38051. $ctx1.sendIdx["stream"]=1;
  38052. $recv($1)._nextPutClosureWith_arguments_((function(){
  38053. return $core.withContext(function($ctx2) {
  38054. $2=self._stream();
  38055. $ctx2.sendIdx["stream"]=2;
  38056. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38057. return $core.withContext(function($ctx3) {
  38058. return $recv($recv(each)._name())._asVariableName();
  38059. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38060. })));
  38061. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38062. return $core.withContext(function($ctx3) {
  38063. return (
  38064. $ctx3.supercall = true,
  38065. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38066. $ctx3.supercall = false;
  38067. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38068. }));
  38069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38070. }),$recv(anIRClosure)._arguments());
  38071. return self;
  38072. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38073. },
  38074. args: ["anIRClosure"],
  38075. 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",
  38076. referencedClasses: [],
  38077. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38078. }),
  38079. $globals.IRJSTranslator);
  38080. $core.addMethod(
  38081. $core.method({
  38082. selector: "visitIRDynamicArray:",
  38083. protocol: 'visiting',
  38084. fn: function (anIRDynamicArray){
  38085. var self=this;
  38086. return $core.withContext(function($ctx1) {
  38087. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._instructions(),"[","]");
  38088. return self;
  38089. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38090. },
  38091. args: ["anIRDynamicArray"],
  38092. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray instructions\x0a\x09\x09enclosedBetween: '[' and: ']'",
  38093. referencedClasses: [],
  38094. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  38095. }),
  38096. $globals.IRJSTranslator);
  38097. $core.addMethod(
  38098. $core.method({
  38099. selector: "visitIRDynamicDictionary:",
  38100. protocol: 'visiting',
  38101. fn: function (anIRDynamicDictionary){
  38102. var self=this;
  38103. return $core.withContext(function($ctx1) {
  38104. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._instructions(),"$globals.HashedCollection._newFromPairs_([","])");
  38105. return self;
  38106. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  38107. },
  38108. args: ["anIRDynamicDictionary"],
  38109. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary instructions\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  38110. referencedClasses: [],
  38111. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  38112. }),
  38113. $globals.IRJSTranslator);
  38114. $core.addMethod(
  38115. $core.method({
  38116. selector: "visitIRMethod:",
  38117. protocol: 'visiting',
  38118. fn: function (anIRMethod){
  38119. var self=this;
  38120. return $core.withContext(function($ctx1) {
  38121. var $1,$2,$3,$4,$5,$7,$6,$8,$9;
  38122. $1=self._stream();
  38123. $ctx1.sendIdx["stream"]=1;
  38124. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38125. return $core.withContext(function($ctx2) {
  38126. $2=self._stream();
  38127. $ctx2.sendIdx["stream"]=2;
  38128. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  38129. return $core.withContext(function($ctx3) {
  38130. $3=self._stream();
  38131. $ctx3.sendIdx["stream"]=3;
  38132. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  38133. return $core.withContext(function($ctx4) {
  38134. return $recv($recv(each)._name())._asVariableName();
  38135. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38136. }));
  38137. $ctx3.sendIdx["collect:"]=1;
  38138. $recv($3)._nextPutVars_($4);
  38139. $ctx3.sendIdx["nextPutVars:"]=1;
  38140. $5=self._stream();
  38141. $ctx3.sendIdx["stream"]=4;
  38142. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  38143. return $core.withContext(function($ctx4) {
  38144. $7=$recv(anIRMethod)._internalVariables();
  38145. $ctx4.sendIdx["internalVariables"]=1;
  38146. $6=$recv($7)._notEmpty();
  38147. if($core.assert($6)){
  38148. $8=self._stream();
  38149. $ctx4.sendIdx["stream"]=5;
  38150. $recv($8)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38151. return $core.withContext(function($ctx5) {
  38152. return $recv($recv(each)._variable())._alias();
  38153. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,6)});
  38154. })));
  38155. };
  38156. $9=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  38157. if($core.assert($9)){
  38158. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  38159. return $core.withContext(function($ctx5) {
  38160. return (
  38161. $ctx5.supercall = true,
  38162. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38163. $ctx5.supercall = false;
  38164. $ctx5.sendIdx["visitIRMethod:"]=1;
  38165. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  38166. }));
  38167. } else {
  38168. return (
  38169. $ctx4.supercall = true,
  38170. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38171. $ctx4.supercall = false;
  38172. };
  38173. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  38174. }));
  38175. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38176. }),$recv(anIRMethod)._arguments());
  38177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38178. }));
  38179. return self;
  38180. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  38181. },
  38182. args: ["anIRMethod"],
  38183. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  38184. referencedClasses: [],
  38185. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  38186. }),
  38187. $globals.IRJSTranslator);
  38188. $core.addMethod(
  38189. $core.method({
  38190. selector: "visitIRNonLocalReturn:",
  38191. protocol: 'visiting',
  38192. fn: function (anIRNonLocalReturn){
  38193. var self=this;
  38194. return $core.withContext(function($ctx1) {
  38195. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  38196. return $core.withContext(function($ctx2) {
  38197. return (
  38198. $ctx2.supercall = true,
  38199. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  38200. $ctx2.supercall = false;
  38201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38202. }));
  38203. return self;
  38204. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  38205. },
  38206. args: ["anIRNonLocalReturn"],
  38207. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  38208. referencedClasses: [],
  38209. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  38210. }),
  38211. $globals.IRJSTranslator);
  38212. $core.addMethod(
  38213. $core.method({
  38214. selector: "visitIRReturn:",
  38215. protocol: 'visiting',
  38216. fn: function (anIRReturn){
  38217. var self=this;
  38218. return $core.withContext(function($ctx1) {
  38219. $recv(self._stream())._nextPutReturnWith_((function(){
  38220. return $core.withContext(function($ctx2) {
  38221. return (
  38222. $ctx2.supercall = true,
  38223. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  38224. $ctx2.supercall = false;
  38225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38226. }));
  38227. return self;
  38228. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  38229. },
  38230. args: ["anIRReturn"],
  38231. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  38232. referencedClasses: [],
  38233. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  38234. }),
  38235. $globals.IRJSTranslator);
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "visitIRSend:",
  38239. protocol: 'visiting',
  38240. fn: function (anIRSend){
  38241. var self=this;
  38242. var sends,superclass;
  38243. return $core.withContext(function($ctx1) {
  38244. var $1,$2;
  38245. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38246. $1=$recv(anIRSend)._isSuperSend();
  38247. if($core.assert($1)){
  38248. self._visitSuperSend_(anIRSend);
  38249. } else {
  38250. self._visitSend_(anIRSend);
  38251. };
  38252. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  38253. return $core.withContext(function($ctx2) {
  38254. return $recv($recv(anIRSend)._index()).__lt(sends);
  38255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38256. }));
  38257. if($core.assert($2)){
  38258. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38259. };
  38260. return self;
  38261. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38262. },
  38263. args: ["anIRSend"],
  38264. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend isSuperSend\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  38265. referencedClasses: [],
  38266. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  38267. }),
  38268. $globals.IRJSTranslator);
  38269. $core.addMethod(
  38270. $core.method({
  38271. selector: "visitIRSequence:",
  38272. protocol: 'visiting',
  38273. fn: function (anIRSequence){
  38274. var self=this;
  38275. return $core.withContext(function($ctx1) {
  38276. var $1;
  38277. $1=self._stream();
  38278. $ctx1.sendIdx["stream"]=1;
  38279. $recv($1)._nextPutSequenceWith_((function(){
  38280. return $core.withContext(function($ctx2) {
  38281. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  38282. return $core.withContext(function($ctx3) {
  38283. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  38284. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38285. }));
  38286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38287. }));
  38288. return self;
  38289. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38290. },
  38291. args: ["anIRSequence"],
  38292. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  38293. referencedClasses: [],
  38294. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  38295. }),
  38296. $globals.IRJSTranslator);
  38297. $core.addMethod(
  38298. $core.method({
  38299. selector: "visitIRTempDeclaration:",
  38300. protocol: 'visiting',
  38301. fn: function (anIRTempDeclaration){
  38302. var self=this;
  38303. return self;
  38304. },
  38305. args: ["anIRTempDeclaration"],
  38306. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38307. referencedClasses: [],
  38308. messageSends: []
  38309. }),
  38310. $globals.IRJSTranslator);
  38311. $core.addMethod(
  38312. $core.method({
  38313. selector: "visitIRValue:",
  38314. protocol: 'visiting',
  38315. fn: function (anIRValue){
  38316. var self=this;
  38317. return $core.withContext(function($ctx1) {
  38318. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38319. return self;
  38320. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38321. },
  38322. args: ["anIRValue"],
  38323. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38324. referencedClasses: [],
  38325. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38326. }),
  38327. $globals.IRJSTranslator);
  38328. $core.addMethod(
  38329. $core.method({
  38330. selector: "visitIRVariable:",
  38331. protocol: 'visiting',
  38332. fn: function (anIRVariable){
  38333. var self=this;
  38334. return $core.withContext(function($ctx1) {
  38335. var $3,$2,$1,$4;
  38336. $3=$recv(anIRVariable)._variable();
  38337. $ctx1.sendIdx["variable"]=1;
  38338. $2=$recv($3)._name();
  38339. $1=$recv($2).__eq("thisContext");
  38340. if($core.assert($1)){
  38341. $4=self._stream();
  38342. $ctx1.sendIdx["stream"]=1;
  38343. $recv($4)._nextPutAll_("$core.getThisContext()");
  38344. $ctx1.sendIdx["nextPutAll:"]=1;
  38345. } else {
  38346. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38347. };
  38348. return self;
  38349. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38350. },
  38351. args: ["anIRVariable"],
  38352. 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 ]",
  38353. referencedClasses: [],
  38354. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38355. }),
  38356. $globals.IRJSTranslator);
  38357. $core.addMethod(
  38358. $core.method({
  38359. selector: "visitIRVerbatim:",
  38360. protocol: 'visiting',
  38361. fn: function (anIRVerbatim){
  38362. var self=this;
  38363. return $core.withContext(function($ctx1) {
  38364. var $1;
  38365. $1=self._stream();
  38366. $ctx1.sendIdx["stream"]=1;
  38367. $recv($1)._nextPutStatementWith_((function(){
  38368. return $core.withContext(function($ctx2) {
  38369. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38371. }));
  38372. return self;
  38373. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38374. },
  38375. args: ["anIRVerbatim"],
  38376. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38377. referencedClasses: [],
  38378. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38379. }),
  38380. $globals.IRJSTranslator);
  38381. $core.addMethod(
  38382. $core.method({
  38383. selector: "visitInstructionList:enclosedBetween:and:",
  38384. protocol: 'visiting',
  38385. fn: function (anArray,aString,anotherString){
  38386. var self=this;
  38387. return $core.withContext(function($ctx1) {
  38388. var $1;
  38389. $1=self._stream();
  38390. $ctx1.sendIdx["stream"]=1;
  38391. $recv($1)._nextPutAll_(aString);
  38392. $ctx1.sendIdx["nextPutAll:"]=1;
  38393. $recv(anArray)._do_separatedBy_((function(each){
  38394. return $core.withContext(function($ctx2) {
  38395. return self._visit_(each);
  38396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38397. }),(function(){
  38398. return $core.withContext(function($ctx2) {
  38399. return $recv(self._stream())._nextPutAll_(",");
  38400. $ctx2.sendIdx["nextPutAll:"]=2;
  38401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38402. }));
  38403. $recv(self["@stream"])._nextPutAll_(anotherString);
  38404. return self;
  38405. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38406. },
  38407. args: ["anArray", "aString", "anotherString"],
  38408. 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",
  38409. referencedClasses: [],
  38410. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38411. }),
  38412. $globals.IRJSTranslator);
  38413. $core.addMethod(
  38414. $core.method({
  38415. selector: "visitReceiver:",
  38416. protocol: 'visiting',
  38417. fn: function (anIRInstruction){
  38418. var self=this;
  38419. return $core.withContext(function($ctx1) {
  38420. var $1,$2,$3;
  38421. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38422. if(!$core.assert($1)){
  38423. $2=self._visit_(anIRInstruction);
  38424. $ctx1.sendIdx["visit:"]=1;
  38425. return $2;
  38426. };
  38427. $3=self._stream();
  38428. $ctx1.sendIdx["stream"]=1;
  38429. $recv($3)._nextPutAll_("$recv(");
  38430. $ctx1.sendIdx["nextPutAll:"]=1;
  38431. self._visit_(anIRInstruction);
  38432. $recv(self._stream())._nextPutAll_(")");
  38433. return self;
  38434. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38435. },
  38436. args: ["anIRInstruction"],
  38437. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  38438. referencedClasses: [],
  38439. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38440. }),
  38441. $globals.IRJSTranslator);
  38442. $core.addMethod(
  38443. $core.method({
  38444. selector: "visitSend:",
  38445. protocol: 'visiting',
  38446. fn: function (anIRSend){
  38447. var self=this;
  38448. return $core.withContext(function($ctx1) {
  38449. var $2,$1;
  38450. $2=$recv(anIRSend)._instructions();
  38451. $ctx1.sendIdx["instructions"]=1;
  38452. $1=$recv($2)._first();
  38453. self._visitReceiver_($1);
  38454. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38455. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"(",")");
  38456. return self;
  38457. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38458. },
  38459. args: ["anIRSend"],
  38460. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '(' and: ')'",
  38461. referencedClasses: [],
  38462. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst"]
  38463. }),
  38464. $globals.IRJSTranslator);
  38465. $core.addMethod(
  38466. $core.method({
  38467. selector: "visitSuperSend:",
  38468. protocol: 'visiting',
  38469. fn: function (anIRSend){
  38470. var self=this;
  38471. return $core.withContext(function($ctx1) {
  38472. var $1,$4,$3,$2,$5,$6,$7,$8;
  38473. $1=self._stream();
  38474. $ctx1.sendIdx["stream"]=1;
  38475. $recv($1)._nextPutAll_("(");
  38476. $ctx1.sendIdx["nextPutAll:"]=1;
  38477. $recv($1)._lf();
  38478. $ctx1.sendIdx["lf"]=1;
  38479. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38480. $ctx1.sendIdx["nextPutAll:"]=2;
  38481. $recv($1)._lf();
  38482. $ctx1.sendIdx["lf"]=2;
  38483. $4=$recv(anIRSend)._scope();
  38484. $ctx1.sendIdx["scope"]=1;
  38485. $3=$recv($4)._alias();
  38486. $ctx1.sendIdx["alias"]=1;
  38487. $2=$recv($3).__comma(".supercall = true,");
  38488. $ctx1.sendIdx[","]=1;
  38489. $recv($1)._nextPutAll_($2);
  38490. $ctx1.sendIdx["nextPutAll:"]=3;
  38491. $recv($1)._lf();
  38492. $ctx1.sendIdx["lf"]=3;
  38493. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38494. $ctx1.sendIdx["nextPutAll:"]=4;
  38495. $recv($1)._lf();
  38496. $ctx1.sendIdx["lf"]=4;
  38497. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38498. $ctx1.sendIdx[","]=2;
  38499. $recv($1)._nextPutAll_($5);
  38500. $ctx1.sendIdx["nextPutAll:"]=5;
  38501. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  38502. $ctx1.sendIdx["nextPutAll:"]=6;
  38503. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38504. $ctx1.sendIdx[","]=3;
  38505. $recv($1)._nextPutAll_($6);
  38506. $ctx1.sendIdx["nextPutAll:"]=7;
  38507. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38508. $ctx1.sendIdx["nextPutAll:"]=8;
  38509. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"[","]");
  38510. $8=self._stream();
  38511. $recv($8)._nextPutAll_("));");
  38512. $ctx1.sendIdx["nextPutAll:"]=9;
  38513. $recv($8)._lf();
  38514. $ctx1.sendIdx["lf"]=5;
  38515. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38516. $ctx1.sendIdx["nextPutAll:"]=10;
  38517. $recv($8)._lf();
  38518. $ctx1.sendIdx["lf"]=6;
  38519. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38520. $ctx1.sendIdx["nextPutAll:"]=11;
  38521. $recv($8)._lf();
  38522. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38523. return self;
  38524. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38525. },
  38526. args: ["anIRSend"],
  38527. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  38528. referencedClasses: [],
  38529. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst", "instructions"]
  38530. }),
  38531. $globals.IRJSTranslator);
  38532. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  38533. $core.addMethod(
  38534. $core.method({
  38535. selector: "contents",
  38536. protocol: 'accessing',
  38537. fn: function (){
  38538. var self=this;
  38539. return $core.withContext(function($ctx1) {
  38540. return $recv(self["@stream"])._contents();
  38541. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38542. },
  38543. args: [],
  38544. source: "contents\x0a\x09^ stream contents",
  38545. referencedClasses: [],
  38546. messageSends: ["contents"]
  38547. }),
  38548. $globals.JSStream);
  38549. $core.addMethod(
  38550. $core.method({
  38551. selector: "initialize",
  38552. protocol: 'initialization',
  38553. fn: function (){
  38554. var self=this;
  38555. return $core.withContext(function($ctx1) {
  38556. (
  38557. $ctx1.supercall = true,
  38558. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  38559. $ctx1.supercall = false;
  38560. self["@stream"]=""._writeStream();
  38561. return self;
  38562. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38563. },
  38564. args: [],
  38565. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38566. referencedClasses: [],
  38567. messageSends: ["initialize", "writeStream"]
  38568. }),
  38569. $globals.JSStream);
  38570. $core.addMethod(
  38571. $core.method({
  38572. selector: "lf",
  38573. protocol: 'streaming',
  38574. fn: function (){
  38575. var self=this;
  38576. return $core.withContext(function($ctx1) {
  38577. $recv(self["@stream"])._lf();
  38578. return self;
  38579. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38580. },
  38581. args: [],
  38582. source: "lf\x0a\x09stream lf",
  38583. referencedClasses: [],
  38584. messageSends: ["lf"]
  38585. }),
  38586. $globals.JSStream);
  38587. $core.addMethod(
  38588. $core.method({
  38589. selector: "nextPut:",
  38590. protocol: 'streaming',
  38591. fn: function (aString){
  38592. var self=this;
  38593. return $core.withContext(function($ctx1) {
  38594. $recv(self["@stream"])._nextPut_(aString);
  38595. return self;
  38596. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38597. },
  38598. args: ["aString"],
  38599. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38600. referencedClasses: [],
  38601. messageSends: ["nextPut:"]
  38602. }),
  38603. $globals.JSStream);
  38604. $core.addMethod(
  38605. $core.method({
  38606. selector: "nextPutAll:",
  38607. protocol: 'streaming',
  38608. fn: function (aString){
  38609. var self=this;
  38610. return $core.withContext(function($ctx1) {
  38611. $recv(self["@stream"])._nextPutAll_(aString);
  38612. return self;
  38613. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38614. },
  38615. args: ["aString"],
  38616. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38617. referencedClasses: [],
  38618. messageSends: ["nextPutAll:"]
  38619. }),
  38620. $globals.JSStream);
  38621. $core.addMethod(
  38622. $core.method({
  38623. selector: "nextPutAssignLhs:rhs:",
  38624. protocol: 'streaming',
  38625. fn: function (aBlock,anotherBlock){
  38626. var self=this;
  38627. return $core.withContext(function($ctx1) {
  38628. $recv(aBlock)._value();
  38629. $ctx1.sendIdx["value"]=1;
  38630. $recv(self["@stream"])._nextPutAll_("=");
  38631. $recv(anotherBlock)._value();
  38632. return self;
  38633. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38634. },
  38635. args: ["aBlock", "anotherBlock"],
  38636. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38637. referencedClasses: [],
  38638. messageSends: ["value", "nextPutAll:"]
  38639. }),
  38640. $globals.JSStream);
  38641. $core.addMethod(
  38642. $core.method({
  38643. selector: "nextPutBlockContextFor:during:",
  38644. protocol: 'streaming',
  38645. fn: function (anIRClosure,aBlock){
  38646. var self=this;
  38647. return $core.withContext(function($ctx1) {
  38648. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38649. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38650. if(!$core.assert($1)){
  38651. $2=$recv(aBlock)._value();
  38652. $ctx1.sendIdx["value"]=1;
  38653. return $2;
  38654. };
  38655. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38656. $ctx1.sendIdx["nextPutAll:"]=1;
  38657. self._lf();
  38658. $ctx1.sendIdx["lf"]=1;
  38659. $6=$recv(anIRClosure)._scope();
  38660. $ctx1.sendIdx["scope"]=1;
  38661. $5=$recv($6)._alias();
  38662. $ctx1.sendIdx["alias"]=1;
  38663. $4="return $core.withContext(function(".__comma($5);
  38664. $ctx1.sendIdx[","]=2;
  38665. $3=$recv($4).__comma(") {");
  38666. $ctx1.sendIdx[","]=1;
  38667. self._nextPutAll_($3);
  38668. $ctx1.sendIdx["nextPutAll:"]=2;
  38669. self._lf();
  38670. $ctx1.sendIdx["lf"]=2;
  38671. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38672. $ctx1.sendIdx["nextPutAll:"]=3;
  38673. $7=self._lf();
  38674. $ctx1.sendIdx["lf"]=3;
  38675. $recv(aBlock)._value();
  38676. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38677. $ctx1.sendIdx["nextPutAll:"]=4;
  38678. self._lf();
  38679. $ctx1.sendIdx["lf"]=4;
  38680. $11=$recv(anIRClosure)._scope();
  38681. $ctx1.sendIdx["scope"]=2;
  38682. $10=$recv($11)._alias();
  38683. $ctx1.sendIdx["alias"]=2;
  38684. $9="}, function(".__comma($10);
  38685. $ctx1.sendIdx[","]=4;
  38686. $8=$recv($9).__comma(") {");
  38687. $ctx1.sendIdx[","]=3;
  38688. self._nextPutAll_($8);
  38689. $ctx1.sendIdx["nextPutAll:"]=5;
  38690. $15=$recv(anIRClosure)._scope();
  38691. $ctx1.sendIdx["scope"]=3;
  38692. $14=$recv($15)._alias();
  38693. $ctx1.sendIdx["alias"]=3;
  38694. $13=$recv($14).__comma(".fillBlock({");
  38695. $ctx1.sendIdx[","]=5;
  38696. $12=self._nextPutAll_($13);
  38697. $ctx1.sendIdx["nextPutAll:"]=6;
  38698. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38699. return $core.withContext(function($ctx2) {
  38700. $16=$recv(each)._asVariableName();
  38701. $ctx2.sendIdx["asVariableName"]=1;
  38702. self._nextPutAll_($16);
  38703. $ctx2.sendIdx["nextPutAll:"]=7;
  38704. self._nextPutAll_(":");
  38705. $ctx2.sendIdx["nextPutAll:"]=8;
  38706. $17=self._nextPutAll_($recv(each)._asVariableName());
  38707. $ctx2.sendIdx["nextPutAll:"]=9;
  38708. return $17;
  38709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38710. }),(function(){
  38711. return $core.withContext(function($ctx2) {
  38712. return self._nextPutAll_(",");
  38713. $ctx2.sendIdx["nextPutAll:"]=10;
  38714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38715. }));
  38716. self._nextPutAll_("},");
  38717. $ctx1.sendIdx["nextPutAll:"]=11;
  38718. $23=$recv(anIRClosure)._scope();
  38719. $ctx1.sendIdx["scope"]=4;
  38720. $22=$recv($23)._outerScope();
  38721. $21=$recv($22)._alias();
  38722. $20=$recv($21).__comma(",");
  38723. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38724. $ctx1.sendIdx[","]=7;
  38725. $18=$recv($19).__comma(")});");
  38726. $ctx1.sendIdx[","]=6;
  38727. self._nextPutAll_($18);
  38728. $ctx1.sendIdx["nextPutAll:"]=12;
  38729. self._lf();
  38730. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38731. return self;
  38732. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38733. },
  38734. args: ["anIRClosure", "aBlock"],
  38735. 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);'",
  38736. referencedClasses: [],
  38737. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38738. }),
  38739. $globals.JSStream);
  38740. $core.addMethod(
  38741. $core.method({
  38742. selector: "nextPutClosureWith:arguments:",
  38743. protocol: 'streaming',
  38744. fn: function (aBlock,anArray){
  38745. var self=this;
  38746. return $core.withContext(function($ctx1) {
  38747. var $1,$2,$3;
  38748. $recv(self["@stream"])._nextPutAll_("(function(");
  38749. $ctx1.sendIdx["nextPutAll:"]=1;
  38750. $recv(anArray)._do_separatedBy_((function(each){
  38751. return $core.withContext(function($ctx2) {
  38752. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38753. $ctx2.sendIdx["nextPutAll:"]=2;
  38754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38755. }),(function(){
  38756. return $core.withContext(function($ctx2) {
  38757. return $recv(self["@stream"])._nextPut_(",");
  38758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38759. }));
  38760. $1=self["@stream"];
  38761. $recv($1)._nextPutAll_("){");
  38762. $ctx1.sendIdx["nextPutAll:"]=3;
  38763. $2=$recv($1)._lf();
  38764. $ctx1.sendIdx["lf"]=1;
  38765. $recv(aBlock)._value();
  38766. $3=self["@stream"];
  38767. $recv($3)._lf();
  38768. $recv($3)._nextPutAll_("})");
  38769. return self;
  38770. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38771. },
  38772. args: ["aBlock", "anArray"],
  38773. 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: '})'",
  38774. referencedClasses: [],
  38775. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38776. }),
  38777. $globals.JSStream);
  38778. $core.addMethod(
  38779. $core.method({
  38780. selector: "nextPutContextFor:during:",
  38781. protocol: 'streaming',
  38782. fn: function (aMethod,aBlock){
  38783. var self=this;
  38784. return $core.withContext(function($ctx1) {
  38785. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38786. $1=$recv(aMethod)._requiresSmalltalkContext();
  38787. if(!$core.assert($1)){
  38788. $2=$recv(aBlock)._value();
  38789. $ctx1.sendIdx["value"]=1;
  38790. return $2;
  38791. };
  38792. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38793. $ctx1.sendIdx["nextPutAll:"]=1;
  38794. self._lf();
  38795. $ctx1.sendIdx["lf"]=1;
  38796. $6=$recv(aMethod)._scope();
  38797. $ctx1.sendIdx["scope"]=1;
  38798. $5=$recv($6)._alias();
  38799. $ctx1.sendIdx["alias"]=1;
  38800. $4="return $core.withContext(function(".__comma($5);
  38801. $ctx1.sendIdx[","]=2;
  38802. $3=$recv($4).__comma(") {");
  38803. $ctx1.sendIdx[","]=1;
  38804. self._nextPutAll_($3);
  38805. $ctx1.sendIdx["nextPutAll:"]=2;
  38806. self._lf();
  38807. $ctx1.sendIdx["lf"]=2;
  38808. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38809. $ctx1.sendIdx["nextPutAll:"]=3;
  38810. $7=self._lf();
  38811. $ctx1.sendIdx["lf"]=3;
  38812. $recv(aBlock)._value();
  38813. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38814. $ctx1.sendIdx["nextPutAll:"]=4;
  38815. self._lf();
  38816. $ctx1.sendIdx["lf"]=4;
  38817. $12=$recv(aMethod)._scope();
  38818. $ctx1.sendIdx["scope"]=2;
  38819. $11=$recv($12)._alias();
  38820. $ctx1.sendIdx["alias"]=2;
  38821. $10="}, function(".__comma($11);
  38822. $ctx1.sendIdx[","]=5;
  38823. $9=$recv($10).__comma(") {");
  38824. $ctx1.sendIdx[","]=4;
  38825. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38826. $ctx1.sendIdx[","]=3;
  38827. self._nextPutAll_($8);
  38828. $ctx1.sendIdx["nextPutAll:"]=5;
  38829. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38830. $ctx1.sendIdx["asJavascript"]=1;
  38831. $15=".fill(self,".__comma($16);
  38832. $14=$recv($15).__comma(",{");
  38833. $ctx1.sendIdx[","]=6;
  38834. $13=self._nextPutAll_($14);
  38835. $ctx1.sendIdx["nextPutAll:"]=6;
  38836. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38837. return $core.withContext(function($ctx2) {
  38838. $17=$recv(each)._asVariableName();
  38839. $ctx2.sendIdx["asVariableName"]=1;
  38840. self._nextPutAll_($17);
  38841. $ctx2.sendIdx["nextPutAll:"]=7;
  38842. self._nextPutAll_(":");
  38843. $ctx2.sendIdx["nextPutAll:"]=8;
  38844. $18=self._nextPutAll_($recv(each)._asVariableName());
  38845. $ctx2.sendIdx["nextPutAll:"]=9;
  38846. return $18;
  38847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38848. }),(function(){
  38849. return $core.withContext(function($ctx2) {
  38850. return self._nextPutAll_(",");
  38851. $ctx2.sendIdx["nextPutAll:"]=10;
  38852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38853. }));
  38854. self._nextPutAll_("},");
  38855. $ctx1.sendIdx["nextPutAll:"]=11;
  38856. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38857. $ctx1.sendIdx["nextPutAll:"]=12;
  38858. self._nextPutAll_(")});");
  38859. $ctx1.sendIdx["nextPutAll:"]=13;
  38860. self._lf();
  38861. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38862. return self;
  38863. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38864. },
  38865. args: ["aMethod", "aBlock"],
  38866. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  38867. referencedClasses: [],
  38868. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38869. }),
  38870. $globals.JSStream);
  38871. $core.addMethod(
  38872. $core.method({
  38873. selector: "nextPutFunctionWith:arguments:",
  38874. protocol: 'streaming',
  38875. fn: function (aBlock,anArray){
  38876. var self=this;
  38877. return $core.withContext(function($ctx1) {
  38878. var $1,$2,$3,$4,$5;
  38879. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38880. $ctx1.sendIdx["nextPutAll:"]=1;
  38881. $recv(anArray)._do_separatedBy_((function(each){
  38882. return $core.withContext(function($ctx2) {
  38883. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38884. $ctx2.sendIdx["nextPutAll:"]=2;
  38885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38886. }),(function(){
  38887. return $core.withContext(function($ctx2) {
  38888. return $recv(self["@stream"])._nextPut_(",");
  38889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38890. }));
  38891. $1=self["@stream"];
  38892. $recv($1)._nextPutAll_("){");
  38893. $ctx1.sendIdx["nextPutAll:"]=3;
  38894. $2=$recv($1)._lf();
  38895. $ctx1.sendIdx["lf"]=1;
  38896. $3=self["@stream"];
  38897. $recv($3)._nextPutAll_("var self=this;");
  38898. $ctx1.sendIdx["nextPutAll:"]=4;
  38899. $4=$recv($3)._lf();
  38900. $ctx1.sendIdx["lf"]=2;
  38901. $recv(aBlock)._value();
  38902. $5=self["@stream"];
  38903. $recv($5)._lf();
  38904. $recv($5)._nextPutAll_("}");
  38905. return self;
  38906. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38907. },
  38908. args: ["aBlock", "anArray"],
  38909. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  38910. referencedClasses: [],
  38911. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38912. }),
  38913. $globals.JSStream);
  38914. $core.addMethod(
  38915. $core.method({
  38916. selector: "nextPutIf:then:",
  38917. protocol: 'streaming',
  38918. fn: function (aBlock,anotherBlock){
  38919. var self=this;
  38920. return $core.withContext(function($ctx1) {
  38921. var $1;
  38922. $recv(self["@stream"])._nextPutAll_("if(");
  38923. $ctx1.sendIdx["nextPutAll:"]=1;
  38924. $recv(aBlock)._value();
  38925. $ctx1.sendIdx["value"]=1;
  38926. $1=self["@stream"];
  38927. $recv($1)._nextPutAll_("){");
  38928. $ctx1.sendIdx["nextPutAll:"]=2;
  38929. $recv($1)._lf();
  38930. $recv(anotherBlock)._value();
  38931. $recv(self["@stream"])._nextPutAll_("}");
  38932. return self;
  38933. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38934. },
  38935. args: ["aBlock", "anotherBlock"],
  38936. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38937. referencedClasses: [],
  38938. messageSends: ["nextPutAll:", "value", "lf"]
  38939. }),
  38940. $globals.JSStream);
  38941. $core.addMethod(
  38942. $core.method({
  38943. selector: "nextPutIf:then:else:",
  38944. protocol: 'streaming',
  38945. fn: function (aBlock,ifBlock,elseBlock){
  38946. var self=this;
  38947. return $core.withContext(function($ctx1) {
  38948. var $1,$2,$3;
  38949. $recv(self["@stream"])._nextPutAll_("if(");
  38950. $ctx1.sendIdx["nextPutAll:"]=1;
  38951. $recv(aBlock)._value();
  38952. $ctx1.sendIdx["value"]=1;
  38953. $1=self["@stream"];
  38954. $recv($1)._nextPutAll_("){");
  38955. $ctx1.sendIdx["nextPutAll:"]=2;
  38956. $2=$recv($1)._lf();
  38957. $ctx1.sendIdx["lf"]=1;
  38958. $recv(ifBlock)._value();
  38959. $ctx1.sendIdx["value"]=2;
  38960. $3=self["@stream"];
  38961. $recv($3)._nextPutAll_("} else {");
  38962. $ctx1.sendIdx["nextPutAll:"]=3;
  38963. $recv($3)._lf();
  38964. $recv(elseBlock)._value();
  38965. $recv(self["@stream"])._nextPutAll_("}");
  38966. return self;
  38967. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38968. },
  38969. args: ["aBlock", "ifBlock", "elseBlock"],
  38970. 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: '}'",
  38971. referencedClasses: [],
  38972. messageSends: ["nextPutAll:", "value", "lf"]
  38973. }),
  38974. $globals.JSStream);
  38975. $core.addMethod(
  38976. $core.method({
  38977. selector: "nextPutMethodDeclaration:with:",
  38978. protocol: 'streaming',
  38979. fn: function (aMethod,aBlock){
  38980. var self=this;
  38981. return $core.withContext(function($ctx1) {
  38982. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38983. $1=self["@stream"];
  38984. $recv($1)._nextPutAll_("$core.method({");
  38985. $ctx1.sendIdx["nextPutAll:"]=1;
  38986. $recv($1)._lf();
  38987. $ctx1.sendIdx["lf"]=1;
  38988. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38989. $ctx1.sendIdx["asJavascript"]=1;
  38990. $3="selector: ".__comma($4);
  38991. $ctx1.sendIdx[","]=2;
  38992. $2=$recv($3).__comma(",");
  38993. $ctx1.sendIdx[","]=1;
  38994. $recv($1)._nextPutAll_($2);
  38995. $ctx1.sendIdx["nextPutAll:"]=2;
  38996. $recv($1)._lf();
  38997. $ctx1.sendIdx["lf"]=2;
  38998. $7=$recv($recv(aMethod)._source())._asJavascript();
  38999. $ctx1.sendIdx["asJavascript"]=2;
  39000. $6="source: ".__comma($7);
  39001. $ctx1.sendIdx[","]=4;
  39002. $5=$recv($6).__comma(",");
  39003. $ctx1.sendIdx[","]=3;
  39004. $recv($1)._nextPutAll_($5);
  39005. $ctx1.sendIdx["nextPutAll:"]=3;
  39006. $8=$recv($1)._lf();
  39007. $ctx1.sendIdx["lf"]=3;
  39008. $recv(aBlock)._value();
  39009. $ctx1.sendIdx["value"]=1;
  39010. $9=self["@stream"];
  39011. $12=$recv($globals.String)._lf();
  39012. $ctx1.sendIdx["lf"]=4;
  39013. $11=",".__comma($12);
  39014. $ctx1.sendIdx[","]=6;
  39015. $10=$recv($11).__comma("messageSends: ");
  39016. $ctx1.sendIdx[","]=5;
  39017. $recv($9)._nextPutAll_($10);
  39018. $ctx1.sendIdx["nextPutAll:"]=4;
  39019. $15=$recv($recv(aMethod)._messageSends())._asArray();
  39020. $ctx1.sendIdx["asArray"]=1;
  39021. $14=$recv($15)._asJavascript();
  39022. $ctx1.sendIdx["asJavascript"]=3;
  39023. $13=$recv($14).__comma(",");
  39024. $ctx1.sendIdx[","]=7;
  39025. $recv($9)._nextPutAll_($13);
  39026. $ctx1.sendIdx["nextPutAll:"]=5;
  39027. $recv($9)._lf();
  39028. $ctx1.sendIdx["lf"]=5;
  39029. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39030. return $core.withContext(function($ctx2) {
  39031. return $recv(each)._value();
  39032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39033. })))._asArray())._asJavascript();
  39034. $ctx1.sendIdx["asJavascript"]=4;
  39035. $17="args: ".__comma($18);
  39036. $16=$recv($17).__comma(",");
  39037. $ctx1.sendIdx[","]=8;
  39038. $recv($9)._nextPutAll_($16);
  39039. $ctx1.sendIdx["nextPutAll:"]=6;
  39040. $recv($9)._lf();
  39041. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  39042. $ctx1.sendIdx["nextPutAll:"]=7;
  39043. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  39044. return $core.withContext(function($ctx2) {
  39045. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  39046. $ctx2.sendIdx["nextPutAll:"]=8;
  39047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39048. }),(function(){
  39049. return $core.withContext(function($ctx2) {
  39050. return $recv(self["@stream"])._nextPutAll_(",");
  39051. $ctx2.sendIdx["nextPutAll:"]=9;
  39052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39053. }));
  39054. $20=self["@stream"];
  39055. $recv($20)._nextPutAll_("]");
  39056. $ctx1.sendIdx["nextPutAll:"]=10;
  39057. $recv($20)._nextPutAll_("})");
  39058. return self;
  39059. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39060. },
  39061. args: ["aMethod", "aBlock"],
  39062. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  39063. referencedClasses: ["String"],
  39064. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  39065. }),
  39066. $globals.JSStream);
  39067. $core.addMethod(
  39068. $core.method({
  39069. selector: "nextPutNonLocalReturnHandlingWith:",
  39070. protocol: 'streaming',
  39071. fn: function (aBlock){
  39072. var self=this;
  39073. return $core.withContext(function($ctx1) {
  39074. var $1,$2,$3;
  39075. $1=self["@stream"];
  39076. $recv($1)._nextPutAll_("var $early={};");
  39077. $ctx1.sendIdx["nextPutAll:"]=1;
  39078. $recv($1)._lf();
  39079. $ctx1.sendIdx["lf"]=1;
  39080. $recv($1)._nextPutAll_("try {");
  39081. $ctx1.sendIdx["nextPutAll:"]=2;
  39082. $2=$recv($1)._lf();
  39083. $ctx1.sendIdx["lf"]=2;
  39084. $recv(aBlock)._value();
  39085. $3=self["@stream"];
  39086. $recv($3)._nextPutAll_("}");
  39087. $ctx1.sendIdx["nextPutAll:"]=3;
  39088. $recv($3)._lf();
  39089. $ctx1.sendIdx["lf"]=3;
  39090. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  39091. $recv($3)._lf();
  39092. return self;
  39093. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  39094. },
  39095. args: ["aBlock"],
  39096. 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",
  39097. referencedClasses: [],
  39098. messageSends: ["nextPutAll:", "lf", "value"]
  39099. }),
  39100. $globals.JSStream);
  39101. $core.addMethod(
  39102. $core.method({
  39103. selector: "nextPutNonLocalReturnWith:",
  39104. protocol: 'streaming',
  39105. fn: function (aBlock){
  39106. var self=this;
  39107. return $core.withContext(function($ctx1) {
  39108. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  39109. $ctx1.sendIdx["nextPutAll:"]=1;
  39110. $recv(aBlock)._value();
  39111. $recv(self["@stream"])._nextPutAll_("]");
  39112. return self;
  39113. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39114. },
  39115. args: ["aBlock"],
  39116. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  39117. referencedClasses: [],
  39118. messageSends: ["nextPutAll:", "value"]
  39119. }),
  39120. $globals.JSStream);
  39121. $core.addMethod(
  39122. $core.method({
  39123. selector: "nextPutReturnWith:",
  39124. protocol: 'streaming',
  39125. fn: function (aBlock){
  39126. var self=this;
  39127. return $core.withContext(function($ctx1) {
  39128. $recv(self["@stream"])._nextPutAll_("return ");
  39129. $recv(aBlock)._value();
  39130. return self;
  39131. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39132. },
  39133. args: ["aBlock"],
  39134. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  39135. referencedClasses: [],
  39136. messageSends: ["nextPutAll:", "value"]
  39137. }),
  39138. $globals.JSStream);
  39139. $core.addMethod(
  39140. $core.method({
  39141. selector: "nextPutSendIndexFor:",
  39142. protocol: 'streaming',
  39143. fn: function (anIRSend){
  39144. var self=this;
  39145. return $core.withContext(function($ctx1) {
  39146. self._nextPutAll_(";");
  39147. $ctx1.sendIdx["nextPutAll:"]=1;
  39148. self._lf();
  39149. $ctx1.sendIdx["lf"]=1;
  39150. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39151. $ctx1.sendIdx["nextPutAll:"]=2;
  39152. self._lf();
  39153. $ctx1.sendIdx["lf"]=2;
  39154. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  39155. $ctx1.sendIdx["nextPutAll:"]=3;
  39156. self._nextPutAll_(".sendIdx[");
  39157. $ctx1.sendIdx["nextPutAll:"]=4;
  39158. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  39159. $ctx1.sendIdx["nextPutAll:"]=5;
  39160. self._nextPutAll_("]=");
  39161. $ctx1.sendIdx["nextPutAll:"]=6;
  39162. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  39163. $ctx1.sendIdx["nextPutAll:"]=7;
  39164. self._nextPutAll_(";");
  39165. $ctx1.sendIdx["nextPutAll:"]=8;
  39166. self._lf();
  39167. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  39168. return self;
  39169. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  39170. },
  39171. args: ["anIRSend"],
  39172. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  39173. referencedClasses: [],
  39174. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  39175. }),
  39176. $globals.JSStream);
  39177. $core.addMethod(
  39178. $core.method({
  39179. selector: "nextPutSequenceWith:",
  39180. protocol: 'streaming',
  39181. fn: function (aBlock){
  39182. var self=this;
  39183. return $core.withContext(function($ctx1) {
  39184. $recv(aBlock)._value();
  39185. return self;
  39186. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  39187. },
  39188. args: ["aBlock"],
  39189. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  39190. referencedClasses: [],
  39191. messageSends: ["value"]
  39192. }),
  39193. $globals.JSStream);
  39194. $core.addMethod(
  39195. $core.method({
  39196. selector: "nextPutStatementWith:",
  39197. protocol: 'streaming',
  39198. fn: function (aBlock){
  39199. var self=this;
  39200. return $core.withContext(function($ctx1) {
  39201. var $1;
  39202. $recv(aBlock)._value();
  39203. $1=self["@stream"];
  39204. $recv($1)._nextPutAll_(";");
  39205. $recv($1)._lf();
  39206. return self;
  39207. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  39208. },
  39209. args: ["aBlock"],
  39210. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  39211. referencedClasses: [],
  39212. messageSends: ["value", "nextPutAll:", "lf"]
  39213. }),
  39214. $globals.JSStream);
  39215. $core.addMethod(
  39216. $core.method({
  39217. selector: "nextPutVars:",
  39218. protocol: 'streaming',
  39219. fn: function (aCollection){
  39220. var self=this;
  39221. return $core.withContext(function($ctx1) {
  39222. var $1;
  39223. $recv(aCollection)._ifNotEmpty_((function(){
  39224. return $core.withContext(function($ctx2) {
  39225. $recv(self["@stream"])._nextPutAll_("var ");
  39226. $ctx2.sendIdx["nextPutAll:"]=1;
  39227. $recv(aCollection)._do_separatedBy_((function(each){
  39228. return $core.withContext(function($ctx3) {
  39229. return $recv(self["@stream"])._nextPutAll_(each);
  39230. $ctx3.sendIdx["nextPutAll:"]=2;
  39231. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39232. }),(function(){
  39233. return $core.withContext(function($ctx3) {
  39234. return $recv(self["@stream"])._nextPutAll_(",");
  39235. $ctx3.sendIdx["nextPutAll:"]=3;
  39236. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39237. }));
  39238. $1=self["@stream"];
  39239. $recv($1)._nextPutAll_(";");
  39240. return $recv($1)._lf();
  39241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39242. }));
  39243. return self;
  39244. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  39245. },
  39246. args: ["aCollection"],
  39247. 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 ]",
  39248. referencedClasses: [],
  39249. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  39250. }),
  39251. $globals.JSStream);
  39252. $core.addMethod(
  39253. $core.method({
  39254. selector: "appendToInstruction:",
  39255. protocol: '*Compiler-IR',
  39256. fn: function (anIRInstruction){
  39257. var self=this;
  39258. return $core.withContext(function($ctx1) {
  39259. $recv(anIRInstruction)._appendBlock_(self);
  39260. return self;
  39261. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39262. },
  39263. args: ["anIRInstruction"],
  39264. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39265. referencedClasses: [],
  39266. messageSends: ["appendBlock:"]
  39267. }),
  39268. $globals.BlockClosure);
  39269. });
  39270. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Compiler-Semantic"], function($boot){"use strict";
  39271. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  39272. $core.addPackage('Compiler-Inlining');
  39273. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39274. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39275. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  39276. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  39277. $core.addMethod(
  39278. $core.method({
  39279. selector: "accept:",
  39280. protocol: 'visiting',
  39281. fn: function (aVisitor){
  39282. var self=this;
  39283. return $core.withContext(function($ctx1) {
  39284. return $recv(aVisitor)._visitIRInlinedAssignment_(self);
  39285. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  39286. },
  39287. args: ["aVisitor"],
  39288. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  39289. referencedClasses: [],
  39290. messageSends: ["visitIRInlinedAssignment:"]
  39291. }),
  39292. $globals.IRInlinedAssignment);
  39293. $core.addMethod(
  39294. $core.method({
  39295. selector: "isInlined",
  39296. protocol: 'testing',
  39297. fn: function (){
  39298. var self=this;
  39299. return true;
  39300. },
  39301. args: [],
  39302. source: "isInlined\x0a\x09^ true",
  39303. referencedClasses: [],
  39304. messageSends: []
  39305. }),
  39306. $globals.IRInlinedAssignment);
  39307. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39308. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39309. $core.addMethod(
  39310. $core.method({
  39311. selector: "accept:",
  39312. protocol: 'visiting',
  39313. fn: function (aVisitor){
  39314. var self=this;
  39315. return $core.withContext(function($ctx1) {
  39316. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39317. return self;
  39318. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39319. },
  39320. args: ["aVisitor"],
  39321. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39322. referencedClasses: [],
  39323. messageSends: ["visitIRInlinedClosure:"]
  39324. }),
  39325. $globals.IRInlinedClosure);
  39326. $core.addMethod(
  39327. $core.method({
  39328. selector: "isInlined",
  39329. protocol: 'testing',
  39330. fn: function (){
  39331. var self=this;
  39332. return true;
  39333. },
  39334. args: [],
  39335. source: "isInlined\x0a\x09^ true",
  39336. referencedClasses: [],
  39337. messageSends: []
  39338. }),
  39339. $globals.IRInlinedClosure);
  39340. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  39341. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  39342. $core.addMethod(
  39343. $core.method({
  39344. selector: "accept:",
  39345. protocol: 'visiting',
  39346. fn: function (aVisitor){
  39347. var self=this;
  39348. return $core.withContext(function($ctx1) {
  39349. return $recv(aVisitor)._visitIRInlinedReturn_(self);
  39350. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  39351. },
  39352. args: ["aVisitor"],
  39353. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  39354. referencedClasses: [],
  39355. messageSends: ["visitIRInlinedReturn:"]
  39356. }),
  39357. $globals.IRInlinedReturn);
  39358. $core.addMethod(
  39359. $core.method({
  39360. selector: "isInlined",
  39361. protocol: 'testing',
  39362. fn: function (){
  39363. var self=this;
  39364. return true;
  39365. },
  39366. args: [],
  39367. source: "isInlined\x0a\x09^ true",
  39368. referencedClasses: [],
  39369. messageSends: []
  39370. }),
  39371. $globals.IRInlinedReturn);
  39372. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39373. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39374. $core.addMethod(
  39375. $core.method({
  39376. selector: "accept:",
  39377. protocol: 'visiting',
  39378. fn: function (aVisitor){
  39379. var self=this;
  39380. return $core.withContext(function($ctx1) {
  39381. $recv(aVisitor)._visitInlinedSend_(self);
  39382. return self;
  39383. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39384. },
  39385. args: ["aVisitor"],
  39386. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39387. referencedClasses: [],
  39388. messageSends: ["visitInlinedSend:"]
  39389. }),
  39390. $globals.IRInlinedSend);
  39391. $core.addMethod(
  39392. $core.method({
  39393. selector: "internalVariables",
  39394. protocol: 'accessing',
  39395. fn: function (){
  39396. var self=this;
  39397. return [];
  39398. },
  39399. args: [],
  39400. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39401. referencedClasses: [],
  39402. messageSends: []
  39403. }),
  39404. $globals.IRInlinedSend);
  39405. $core.addMethod(
  39406. $core.method({
  39407. selector: "isInlined",
  39408. protocol: 'testing',
  39409. fn: function (){
  39410. var self=this;
  39411. return true;
  39412. },
  39413. args: [],
  39414. source: "isInlined\x0a\x09^ true",
  39415. referencedClasses: [],
  39416. messageSends: []
  39417. }),
  39418. $globals.IRInlinedSend);
  39419. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39420. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39421. $core.addMethod(
  39422. $core.method({
  39423. selector: "accept:",
  39424. protocol: 'visiting',
  39425. fn: function (aVisitor){
  39426. var self=this;
  39427. return $core.withContext(function($ctx1) {
  39428. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39429. return self;
  39430. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39431. },
  39432. args: ["aVisitor"],
  39433. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39434. referencedClasses: [],
  39435. messageSends: ["visitIRInlinedIfFalse:"]
  39436. }),
  39437. $globals.IRInlinedIfFalse);
  39438. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39439. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39440. $core.addMethod(
  39441. $core.method({
  39442. selector: "accept:",
  39443. protocol: 'visiting',
  39444. fn: function (aVisitor){
  39445. var self=this;
  39446. return $core.withContext(function($ctx1) {
  39447. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39448. return self;
  39449. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39450. },
  39451. args: ["aVisitor"],
  39452. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39453. referencedClasses: [],
  39454. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39455. }),
  39456. $globals.IRInlinedIfNilIfNotNil);
  39457. $core.addMethod(
  39458. $core.method({
  39459. selector: "internalVariables",
  39460. protocol: 'accessing',
  39461. fn: function (){
  39462. var self=this;
  39463. return $core.withContext(function($ctx1) {
  39464. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39465. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39466. },
  39467. args: [],
  39468. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39469. referencedClasses: ["Array"],
  39470. messageSends: ["with:", "receiverInternalVariable"]
  39471. }),
  39472. $globals.IRInlinedIfNilIfNotNil);
  39473. $core.addMethod(
  39474. $core.method({
  39475. selector: "receiverInternalVariable",
  39476. protocol: 'accessing',
  39477. fn: function (){
  39478. var self=this;
  39479. return $core.withContext(function($ctx1) {
  39480. var $1;
  39481. $1=$recv($globals.IRVariable)._new();
  39482. $ctx1.sendIdx["new"]=1;
  39483. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39484. return $recv($1)._yourself();
  39485. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39486. },
  39487. args: [],
  39488. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39489. referencedClasses: ["IRVariable", "AliasVar"],
  39490. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39491. }),
  39492. $globals.IRInlinedIfNilIfNotNil);
  39493. $core.addMethod(
  39494. $core.method({
  39495. selector: "receiverInternalVariableName",
  39496. protocol: 'accessing',
  39497. fn: function (){
  39498. var self=this;
  39499. return "$receiver";
  39500. },
  39501. args: [],
  39502. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39503. referencedClasses: [],
  39504. messageSends: []
  39505. }),
  39506. $globals.IRInlinedIfNilIfNotNil);
  39507. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39508. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39509. $core.addMethod(
  39510. $core.method({
  39511. selector: "accept:",
  39512. protocol: 'visiting',
  39513. fn: function (aVisitor){
  39514. var self=this;
  39515. return $core.withContext(function($ctx1) {
  39516. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39517. return self;
  39518. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39519. },
  39520. args: ["aVisitor"],
  39521. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39522. referencedClasses: [],
  39523. messageSends: ["visitIRInlinedIfTrue:"]
  39524. }),
  39525. $globals.IRInlinedIfTrue);
  39526. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39527. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39528. $core.addMethod(
  39529. $core.method({
  39530. selector: "accept:",
  39531. protocol: 'visiting',
  39532. fn: function (aVisitor){
  39533. var self=this;
  39534. return $core.withContext(function($ctx1) {
  39535. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39536. return self;
  39537. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39538. },
  39539. args: ["aVisitor"],
  39540. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39541. referencedClasses: [],
  39542. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39543. }),
  39544. $globals.IRInlinedIfTrueIfFalse);
  39545. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39546. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39547. $core.addMethod(
  39548. $core.method({
  39549. selector: "accept:",
  39550. protocol: 'visiting',
  39551. fn: function (aVisitor){
  39552. var self=this;
  39553. return $core.withContext(function($ctx1) {
  39554. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39555. return self;
  39556. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39557. },
  39558. args: ["aVisitor"],
  39559. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39560. referencedClasses: [],
  39561. messageSends: ["visitIRInlinedSequence:"]
  39562. }),
  39563. $globals.IRInlinedSequence);
  39564. $core.addMethod(
  39565. $core.method({
  39566. selector: "isInlined",
  39567. protocol: 'testing',
  39568. fn: function (){
  39569. var self=this;
  39570. return true;
  39571. },
  39572. args: [],
  39573. source: "isInlined\x0a\x09^ true",
  39574. referencedClasses: [],
  39575. messageSends: []
  39576. }),
  39577. $globals.IRInlinedSequence);
  39578. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39579. $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`";
  39580. $core.addMethod(
  39581. $core.method({
  39582. selector: "assignmentInliner",
  39583. protocol: 'factory',
  39584. fn: function (){
  39585. var self=this;
  39586. return $core.withContext(function($ctx1) {
  39587. var $1;
  39588. $1=$recv($globals.IRAssignmentInliner)._new();
  39589. $recv($1)._translator_(self);
  39590. return $recv($1)._yourself();
  39591. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39592. },
  39593. args: [],
  39594. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39595. referencedClasses: ["IRAssignmentInliner"],
  39596. messageSends: ["translator:", "new", "yourself"]
  39597. }),
  39598. $globals.IRInliner);
  39599. $core.addMethod(
  39600. $core.method({
  39601. selector: "returnInliner",
  39602. protocol: 'factory',
  39603. fn: function (){
  39604. var self=this;
  39605. return $core.withContext(function($ctx1) {
  39606. var $1;
  39607. $1=$recv($globals.IRReturnInliner)._new();
  39608. $recv($1)._translator_(self);
  39609. return $recv($1)._yourself();
  39610. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39611. },
  39612. args: [],
  39613. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39614. referencedClasses: ["IRReturnInliner"],
  39615. messageSends: ["translator:", "new", "yourself"]
  39616. }),
  39617. $globals.IRInliner);
  39618. $core.addMethod(
  39619. $core.method({
  39620. selector: "sendInliner",
  39621. protocol: 'factory',
  39622. fn: function (){
  39623. var self=this;
  39624. return $core.withContext(function($ctx1) {
  39625. var $1;
  39626. $1=$recv($globals.IRSendInliner)._new();
  39627. $recv($1)._translator_(self);
  39628. return $recv($1)._yourself();
  39629. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39630. },
  39631. args: [],
  39632. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39633. referencedClasses: ["IRSendInliner"],
  39634. messageSends: ["translator:", "new", "yourself"]
  39635. }),
  39636. $globals.IRInliner);
  39637. $core.addMethod(
  39638. $core.method({
  39639. selector: "shouldInlineAssignment:",
  39640. protocol: 'testing',
  39641. fn: function (anIRAssignment){
  39642. var self=this;
  39643. return $core.withContext(function($ctx1) {
  39644. var $4,$3,$2,$1;
  39645. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39646. return $core.withContext(function($ctx2) {
  39647. $4=$recv(anIRAssignment)._instructions();
  39648. $ctx2.sendIdx["instructions"]=1;
  39649. $3=$recv($4)._last();
  39650. $ctx2.sendIdx["last"]=1;
  39651. $2=$recv($3)._isSend();
  39652. return $recv($2)._and_((function(){
  39653. return $core.withContext(function($ctx3) {
  39654. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  39655. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39656. }));
  39657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39658. }));
  39659. $ctx1.sendIdx["and:"]=1;
  39660. return $1;
  39661. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39662. },
  39663. args: ["anIRAssignment"],
  39664. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  39665. referencedClasses: [],
  39666. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  39667. }),
  39668. $globals.IRInliner);
  39669. $core.addMethod(
  39670. $core.method({
  39671. selector: "shouldInlineReturn:",
  39672. protocol: 'testing',
  39673. fn: function (anIRReturn){
  39674. var self=this;
  39675. return $core.withContext(function($ctx1) {
  39676. var $4,$3,$2,$1;
  39677. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39678. return $core.withContext(function($ctx2) {
  39679. $4=$recv(anIRReturn)._instructions();
  39680. $ctx2.sendIdx["instructions"]=1;
  39681. $3=$recv($4)._first();
  39682. $ctx2.sendIdx["first"]=1;
  39683. $2=$recv($3)._isSend();
  39684. return $recv($2)._and_((function(){
  39685. return $core.withContext(function($ctx3) {
  39686. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  39687. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39688. }));
  39689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39690. }));
  39691. $ctx1.sendIdx["and:"]=1;
  39692. return $1;
  39693. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39694. },
  39695. args: ["anIRReturn"],
  39696. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  39697. referencedClasses: [],
  39698. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  39699. }),
  39700. $globals.IRInliner);
  39701. $core.addMethod(
  39702. $core.method({
  39703. selector: "shouldInlineSend:",
  39704. protocol: 'testing',
  39705. fn: function (anIRSend){
  39706. var self=this;
  39707. return $core.withContext(function($ctx1) {
  39708. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39709. return $core.withContext(function($ctx2) {
  39710. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39712. }));
  39713. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39714. },
  39715. args: ["anIRSend"],
  39716. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39717. referencedClasses: ["IRSendInliner"],
  39718. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39719. }),
  39720. $globals.IRInliner);
  39721. $core.addMethod(
  39722. $core.method({
  39723. selector: "transformNonLocalReturn:",
  39724. protocol: 'visiting',
  39725. fn: function (anIRNonLocalReturn){
  39726. var self=this;
  39727. var localReturn;
  39728. return $core.withContext(function($ctx1) {
  39729. var $2,$1,$4,$3,$5,$6,$7;
  39730. $2=$recv(anIRNonLocalReturn)._scope();
  39731. $ctx1.sendIdx["scope"]=1;
  39732. $1=$recv($2)._canInlineNonLocalReturns();
  39733. if($core.assert($1)){
  39734. $4=$recv(anIRNonLocalReturn)._scope();
  39735. $ctx1.sendIdx["scope"]=2;
  39736. $3=$recv($4)._methodScope();
  39737. $5=$recv(anIRNonLocalReturn)._scope();
  39738. $ctx1.sendIdx["scope"]=3;
  39739. $recv($3)._removeNonLocalReturn_($5);
  39740. $6=$recv($globals.IRReturn)._new();
  39741. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39742. localReturn=$recv($6)._yourself();
  39743. localReturn;
  39744. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  39745. return $core.withContext(function($ctx2) {
  39746. return $recv(localReturn)._add_(each);
  39747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39748. }));
  39749. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39750. return localReturn;
  39751. };
  39752. $7=(
  39753. $ctx1.supercall = true,
  39754. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39755. $ctx1.supercall = false;
  39756. return $7;
  39757. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39758. },
  39759. args: ["anIRNonLocalReturn"],
  39760. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  39761. referencedClasses: ["IRReturn"],
  39762. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  39763. }),
  39764. $globals.IRInliner);
  39765. $core.addMethod(
  39766. $core.method({
  39767. selector: "visitIRAssignment:",
  39768. protocol: 'visiting',
  39769. fn: function (anIRAssignment){
  39770. var self=this;
  39771. return $core.withContext(function($ctx1) {
  39772. var $1;
  39773. $1=self._shouldInlineAssignment_(anIRAssignment);
  39774. if($core.assert($1)){
  39775. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39776. } else {
  39777. return (
  39778. $ctx1.supercall = true,
  39779. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39780. $ctx1.supercall = false;
  39781. };
  39782. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39783. },
  39784. args: ["anIRAssignment"],
  39785. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39786. referencedClasses: [],
  39787. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39788. }),
  39789. $globals.IRInliner);
  39790. $core.addMethod(
  39791. $core.method({
  39792. selector: "visitIRNonLocalReturn:",
  39793. protocol: 'visiting',
  39794. fn: function (anIRNonLocalReturn){
  39795. var self=this;
  39796. return $core.withContext(function($ctx1) {
  39797. return self._transformNonLocalReturn_(anIRNonLocalReturn);
  39798. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  39799. },
  39800. args: ["anIRNonLocalReturn"],
  39801. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  39802. referencedClasses: [],
  39803. messageSends: ["transformNonLocalReturn:"]
  39804. }),
  39805. $globals.IRInliner);
  39806. $core.addMethod(
  39807. $core.method({
  39808. selector: "visitIRReturn:",
  39809. protocol: 'visiting',
  39810. fn: function (anIRReturn){
  39811. var self=this;
  39812. return $core.withContext(function($ctx1) {
  39813. var $1;
  39814. $1=self._shouldInlineReturn_(anIRReturn);
  39815. if($core.assert($1)){
  39816. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39817. } else {
  39818. return (
  39819. $ctx1.supercall = true,
  39820. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39821. $ctx1.supercall = false;
  39822. };
  39823. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39824. },
  39825. args: ["anIRReturn"],
  39826. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39827. referencedClasses: [],
  39828. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39829. }),
  39830. $globals.IRInliner);
  39831. $core.addMethod(
  39832. $core.method({
  39833. selector: "visitIRSend:",
  39834. protocol: 'visiting',
  39835. fn: function (anIRSend){
  39836. var self=this;
  39837. return $core.withContext(function($ctx1) {
  39838. var $1;
  39839. $1=self._shouldInlineSend_(anIRSend);
  39840. if($core.assert($1)){
  39841. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39842. } else {
  39843. return (
  39844. $ctx1.supercall = true,
  39845. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39846. $ctx1.supercall = false;
  39847. };
  39848. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39849. },
  39850. args: ["anIRSend"],
  39851. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39852. referencedClasses: [],
  39853. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39854. }),
  39855. $globals.IRInliner);
  39856. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39857. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39858. $core.addMethod(
  39859. $core.method({
  39860. selector: "visitIRInlinedAssignment:",
  39861. protocol: 'visiting',
  39862. fn: function (anIRInlinedAssignment){
  39863. var self=this;
  39864. return $core.withContext(function($ctx1) {
  39865. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  39866. return self;
  39867. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  39868. },
  39869. args: ["anIRInlinedAssignment"],
  39870. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  39871. referencedClasses: [],
  39872. messageSends: ["visit:", "last", "instructions"]
  39873. }),
  39874. $globals.IRInliningJSTranslator);
  39875. $core.addMethod(
  39876. $core.method({
  39877. selector: "visitIRInlinedClosure:",
  39878. protocol: 'visiting',
  39879. fn: function (anIRInlinedClosure){
  39880. var self=this;
  39881. return $core.withContext(function($ctx1) {
  39882. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39883. return $core.withContext(function($ctx2) {
  39884. return $recv($recv(each)._name())._asVariableName();
  39885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39886. })));
  39887. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  39888. return $core.withContext(function($ctx2) {
  39889. return self._visit_(each);
  39890. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39891. }));
  39892. return self;
  39893. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39894. },
  39895. args: ["anIRInlinedClosure"],
  39896. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  39897. referencedClasses: [],
  39898. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  39899. }),
  39900. $globals.IRInliningJSTranslator);
  39901. $core.addMethod(
  39902. $core.method({
  39903. selector: "visitIRInlinedIfFalse:",
  39904. protocol: 'visiting',
  39905. fn: function (anIRInlinedIfFalse){
  39906. var self=this;
  39907. return $core.withContext(function($ctx1) {
  39908. var $1,$2,$4,$3;
  39909. $1=self._stream();
  39910. $ctx1.sendIdx["stream"]=1;
  39911. $recv($1)._nextPutIf_then_((function(){
  39912. return $core.withContext(function($ctx2) {
  39913. $2=self._stream();
  39914. $ctx2.sendIdx["stream"]=2;
  39915. $recv($2)._nextPutAll_("!$core.assert(");
  39916. $ctx2.sendIdx["nextPutAll:"]=1;
  39917. $4=$recv(anIRInlinedIfFalse)._instructions();
  39918. $ctx2.sendIdx["instructions"]=1;
  39919. $3=$recv($4)._first();
  39920. self._visit_($3);
  39921. $ctx2.sendIdx["visit:"]=1;
  39922. return $recv(self._stream())._nextPutAll_(")");
  39923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39924. }),(function(){
  39925. return $core.withContext(function($ctx2) {
  39926. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  39927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39928. }));
  39929. return self;
  39930. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39931. },
  39932. args: ["anIRInlinedIfFalse"],
  39933. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse instructions last ]",
  39934. referencedClasses: [],
  39935. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39936. }),
  39937. $globals.IRInliningJSTranslator);
  39938. $core.addMethod(
  39939. $core.method({
  39940. selector: "visitIRInlinedIfNilIfNotNil:",
  39941. protocol: 'visiting',
  39942. fn: function (anIRInlinedIfNilIfNotNil){
  39943. var self=this;
  39944. return $core.withContext(function($ctx1) {
  39945. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39946. $1=self._stream();
  39947. $ctx1.sendIdx["stream"]=1;
  39948. $recv($1)._nextPutIf_then_else_((function(){
  39949. var recvVarName;
  39950. return $core.withContext(function($ctx2) {
  39951. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39952. recvVarName;
  39953. $2=self._stream();
  39954. $ctx2.sendIdx["stream"]=2;
  39955. $4="(".__comma(recvVarName);
  39956. $ctx2.sendIdx[","]=2;
  39957. $3=$recv($4).__comma(" = ");
  39958. $ctx2.sendIdx[","]=1;
  39959. $recv($2)._nextPutAll_($3);
  39960. $ctx2.sendIdx["nextPutAll:"]=1;
  39961. $6=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39962. $ctx2.sendIdx["instructions"]=1;
  39963. $5=$recv($6)._first();
  39964. self._visit_($5);
  39965. $ctx2.sendIdx["visit:"]=1;
  39966. $7=self._stream();
  39967. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39968. $ctx2.sendIdx[","]=3;
  39969. return $recv($7)._nextPutAll_($8);
  39970. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39971. }),(function(){
  39972. return $core.withContext(function($ctx2) {
  39973. $10=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39974. $ctx2.sendIdx["instructions"]=2;
  39975. $9=$recv($10)._second();
  39976. return self._visit_($9);
  39977. $ctx2.sendIdx["visit:"]=2;
  39978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39979. }),(function(){
  39980. return $core.withContext(function($ctx2) {
  39981. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  39982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39983. }));
  39984. return self;
  39985. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39986. },
  39987. args: ["anIRInlinedIfNilIfNotNil"],
  39988. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  39989. referencedClasses: [],
  39990. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "instructions", "second", "third"]
  39991. }),
  39992. $globals.IRInliningJSTranslator);
  39993. $core.addMethod(
  39994. $core.method({
  39995. selector: "visitIRInlinedIfTrue:",
  39996. protocol: 'visiting',
  39997. fn: function (anIRInlinedIfTrue){
  39998. var self=this;
  39999. return $core.withContext(function($ctx1) {
  40000. var $1,$2,$4,$3;
  40001. $1=self._stream();
  40002. $ctx1.sendIdx["stream"]=1;
  40003. $recv($1)._nextPutIf_then_((function(){
  40004. return $core.withContext(function($ctx2) {
  40005. $2=self._stream();
  40006. $ctx2.sendIdx["stream"]=2;
  40007. $recv($2)._nextPutAll_("$core.assert(");
  40008. $ctx2.sendIdx["nextPutAll:"]=1;
  40009. $4=$recv(anIRInlinedIfTrue)._instructions();
  40010. $ctx2.sendIdx["instructions"]=1;
  40011. $3=$recv($4)._first();
  40012. self._visit_($3);
  40013. $ctx2.sendIdx["visit:"]=1;
  40014. return $recv(self._stream())._nextPutAll_(")");
  40015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40016. }),(function(){
  40017. return $core.withContext(function($ctx2) {
  40018. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  40019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40020. }));
  40021. return self;
  40022. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  40023. },
  40024. args: ["anIRInlinedIfTrue"],
  40025. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue instructions last ]",
  40026. referencedClasses: [],
  40027. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40028. }),
  40029. $globals.IRInliningJSTranslator);
  40030. $core.addMethod(
  40031. $core.method({
  40032. selector: "visitIRInlinedIfTrueIfFalse:",
  40033. protocol: 'visiting',
  40034. fn: function (anIRInlinedIfTrueIfFalse){
  40035. var self=this;
  40036. return $core.withContext(function($ctx1) {
  40037. var $1,$2,$4,$3,$6,$5;
  40038. $1=self._stream();
  40039. $ctx1.sendIdx["stream"]=1;
  40040. $recv($1)._nextPutIf_then_else_((function(){
  40041. return $core.withContext(function($ctx2) {
  40042. $2=self._stream();
  40043. $ctx2.sendIdx["stream"]=2;
  40044. $recv($2)._nextPutAll_("$core.assert(");
  40045. $ctx2.sendIdx["nextPutAll:"]=1;
  40046. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40047. $ctx2.sendIdx["instructions"]=1;
  40048. $3=$recv($4)._first();
  40049. self._visit_($3);
  40050. $ctx2.sendIdx["visit:"]=1;
  40051. return $recv(self._stream())._nextPutAll_(")");
  40052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40053. }),(function(){
  40054. return $core.withContext(function($ctx2) {
  40055. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40056. $ctx2.sendIdx["instructions"]=2;
  40057. $5=$recv($6)._second();
  40058. return self._visit_($5);
  40059. $ctx2.sendIdx["visit:"]=2;
  40060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40061. }),(function(){
  40062. return $core.withContext(function($ctx2) {
  40063. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  40064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40065. }));
  40066. return self;
  40067. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  40068. },
  40069. args: ["anIRInlinedIfTrueIfFalse"],
  40070. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  40071. referencedClasses: [],
  40072. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  40073. }),
  40074. $globals.IRInliningJSTranslator);
  40075. $core.addMethod(
  40076. $core.method({
  40077. selector: "visitIRInlinedNonLocalReturn:",
  40078. protocol: 'visiting',
  40079. fn: function (anIRInlinedReturn){
  40080. var self=this;
  40081. return $core.withContext(function($ctx1) {
  40082. var $1;
  40083. $1=self._stream();
  40084. $ctx1.sendIdx["stream"]=1;
  40085. $recv($1)._nextPutStatementWith_((function(){
  40086. return $core.withContext(function($ctx2) {
  40087. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40089. }));
  40090. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  40091. }));
  40092. return self;
  40093. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40094. },
  40095. args: ["anIRInlinedReturn"],
  40096. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  40097. referencedClasses: [],
  40098. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  40099. }),
  40100. $globals.IRInliningJSTranslator);
  40101. $core.addMethod(
  40102. $core.method({
  40103. selector: "visitIRInlinedReturn:",
  40104. protocol: 'visiting',
  40105. fn: function (anIRInlinedReturn){
  40106. var self=this;
  40107. return $core.withContext(function($ctx1) {
  40108. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  40109. return self;
  40110. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  40111. },
  40112. args: ["anIRInlinedReturn"],
  40113. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  40114. referencedClasses: [],
  40115. messageSends: ["visit:", "last", "instructions"]
  40116. }),
  40117. $globals.IRInliningJSTranslator);
  40118. $core.addMethod(
  40119. $core.method({
  40120. selector: "visitIRInlinedSequence:",
  40121. protocol: 'visiting',
  40122. fn: function (anIRInlinedSequence){
  40123. var self=this;
  40124. return $core.withContext(function($ctx1) {
  40125. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  40126. return $core.withContext(function($ctx2) {
  40127. return $recv(self._stream())._nextPutStatementWith_((function(){
  40128. return $core.withContext(function($ctx3) {
  40129. return self._visit_(each);
  40130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40131. }));
  40132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40133. }));
  40134. return self;
  40135. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  40136. },
  40137. args: ["anIRInlinedSequence"],
  40138. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  40139. referencedClasses: [],
  40140. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  40141. }),
  40142. $globals.IRInliningJSTranslator);
  40143. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  40144. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  40145. $core.addMethod(
  40146. $core.method({
  40147. selector: "ifFalse:",
  40148. protocol: 'inlining',
  40149. fn: function (anIRInstruction){
  40150. var self=this;
  40151. return $core.withContext(function($ctx1) {
  40152. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  40153. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40154. },
  40155. args: ["anIRInstruction"],
  40156. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  40157. referencedClasses: ["IRInlinedIfFalse"],
  40158. messageSends: ["inlinedSend:withBlock:", "new"]
  40159. }),
  40160. $globals.IRSendInliner);
  40161. $core.addMethod(
  40162. $core.method({
  40163. selector: "ifFalse:ifTrue:",
  40164. protocol: 'inlining',
  40165. fn: function (anIRInstruction,anotherIRInstruction){
  40166. var self=this;
  40167. return $core.withContext(function($ctx1) {
  40168. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  40169. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40170. },
  40171. args: ["anIRInstruction", "anotherIRInstruction"],
  40172. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  40173. referencedClasses: [],
  40174. messageSends: ["perform:withArguments:"]
  40175. }),
  40176. $globals.IRSendInliner);
  40177. $core.addMethod(
  40178. $core.method({
  40179. selector: "ifNil:",
  40180. protocol: 'inlining',
  40181. fn: function (anIRInstruction){
  40182. var self=this;
  40183. return $core.withContext(function($ctx1) {
  40184. var $1,$3,$5,$6,$4,$2;
  40185. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40186. $ctx1.sendIdx["new"]=1;
  40187. $3=$recv($globals.IRClosure)._new();
  40188. $ctx1.sendIdx["new"]=2;
  40189. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40190. $5=$recv($globals.IRBlockSequence)._new();
  40191. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  40192. $6=$recv($5)._yourself();
  40193. $ctx1.sendIdx["yourself"]=1;
  40194. $4=$6;
  40195. $recv($3)._add_($4);
  40196. $ctx1.sendIdx["add:"]=1;
  40197. $2=$recv($3)._yourself();
  40198. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  40199. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40200. },
  40201. args: ["anIRInstruction"],
  40202. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  40203. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40204. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  40205. }),
  40206. $globals.IRSendInliner);
  40207. $core.addMethod(
  40208. $core.method({
  40209. selector: "ifNil:ifNotNil:",
  40210. protocol: 'inlining',
  40211. fn: function (anIRInstruction,anotherIRInstruction){
  40212. var self=this;
  40213. return $core.withContext(function($ctx1) {
  40214. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  40215. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40216. },
  40217. args: ["anIRInstruction", "anotherIRInstruction"],
  40218. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40219. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40220. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40221. }),
  40222. $globals.IRSendInliner);
  40223. $core.addMethod(
  40224. $core.method({
  40225. selector: "ifNotNil:",
  40226. protocol: 'inlining',
  40227. fn: function (anIRInstruction){
  40228. var self=this;
  40229. return $core.withContext(function($ctx1) {
  40230. var $1,$3,$5,$6,$4,$2;
  40231. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40232. $ctx1.sendIdx["new"]=1;
  40233. $3=$recv($globals.IRClosure)._new();
  40234. $ctx1.sendIdx["new"]=2;
  40235. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40236. $5=$recv($globals.IRBlockSequence)._new();
  40237. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  40238. $6=$recv($5)._yourself();
  40239. $ctx1.sendIdx["yourself"]=1;
  40240. $4=$6;
  40241. $recv($3)._add_($4);
  40242. $ctx1.sendIdx["add:"]=1;
  40243. $2=$recv($3)._yourself();
  40244. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40245. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40246. },
  40247. args: ["anIRInstruction"],
  40248. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  40249. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40250. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  40251. }),
  40252. $globals.IRSendInliner);
  40253. $core.addMethod(
  40254. $core.method({
  40255. selector: "ifNotNil:ifNil:",
  40256. protocol: 'inlining',
  40257. fn: function (anIRInstruction,anotherIRInstruction){
  40258. var self=this;
  40259. return $core.withContext(function($ctx1) {
  40260. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40261. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40262. },
  40263. args: ["anIRInstruction", "anotherIRInstruction"],
  40264. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40265. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40266. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40267. }),
  40268. $globals.IRSendInliner);
  40269. $core.addMethod(
  40270. $core.method({
  40271. selector: "ifTrue:",
  40272. protocol: 'inlining',
  40273. fn: function (anIRInstruction){
  40274. var self=this;
  40275. return $core.withContext(function($ctx1) {
  40276. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40277. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40278. },
  40279. args: ["anIRInstruction"],
  40280. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40281. referencedClasses: ["IRInlinedIfTrue"],
  40282. messageSends: ["inlinedSend:withBlock:", "new"]
  40283. }),
  40284. $globals.IRSendInliner);
  40285. $core.addMethod(
  40286. $core.method({
  40287. selector: "ifTrue:ifFalse:",
  40288. protocol: 'inlining',
  40289. fn: function (anIRInstruction,anotherIRInstruction){
  40290. var self=this;
  40291. return $core.withContext(function($ctx1) {
  40292. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40293. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40294. },
  40295. args: ["anIRInstruction", "anotherIRInstruction"],
  40296. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40297. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40298. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40299. }),
  40300. $globals.IRSendInliner);
  40301. $core.addMethod(
  40302. $core.method({
  40303. selector: "inlineClosure:",
  40304. protocol: 'inlining',
  40305. fn: function (anIRClosure){
  40306. var self=this;
  40307. var inlinedClosure,sequence,statements;
  40308. return $core.withContext(function($ctx1) {
  40309. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$22,$21,$25,$24,$26,$23,$27,$30,$29,$28;
  40310. inlinedClosure=self._inlinedClosure();
  40311. $1=inlinedClosure;
  40312. $2=$recv(anIRClosure)._scope();
  40313. $ctx1.sendIdx["scope"]=1;
  40314. $recv($1)._scope_($2);
  40315. $ctx1.sendIdx["scope:"]=1;
  40316. $recv($1)._parent_($recv(anIRClosure)._parent());
  40317. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40318. return $core.withContext(function($ctx2) {
  40319. return $recv(inlinedClosure)._add_(each);
  40320. $ctx2.sendIdx["add:"]=1;
  40321. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40322. }));
  40323. $ctx1.sendIdx["do:"]=1;
  40324. sequence=self._inlinedSequence();
  40325. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40326. return $core.withContext(function($ctx2) {
  40327. $3=inlinedClosure;
  40328. $5=$recv($globals.IRTempDeclaration)._new();
  40329. $ctx2.sendIdx["new"]=1;
  40330. $recv($5)._name_(each);
  40331. $ctx2.sendIdx["name:"]=1;
  40332. $6=$recv($5)._yourself();
  40333. $ctx2.sendIdx["yourself"]=1;
  40334. $4=$6;
  40335. $recv($3)._add_($4);
  40336. $ctx2.sendIdx["add:"]=2;
  40337. $7=sequence;
  40338. $9=$recv($globals.IRAssignment)._new();
  40339. $ctx2.sendIdx["new"]=2;
  40340. $11=$recv($globals.IRVariable)._new();
  40341. $ctx2.sendIdx["new"]=3;
  40342. $13=$recv($globals.AliasVar)._new();
  40343. $ctx2.sendIdx["new"]=4;
  40344. $14=$recv(inlinedClosure)._scope();
  40345. $ctx2.sendIdx["scope"]=2;
  40346. $recv($13)._scope_($14);
  40347. $ctx2.sendIdx["scope:"]=2;
  40348. $recv($13)._name_(each);
  40349. $ctx2.sendIdx["name:"]=2;
  40350. $15=$recv($13)._yourself();
  40351. $ctx2.sendIdx["yourself"]=2;
  40352. $12=$15;
  40353. $10=$recv($11)._variable_($12);
  40354. $ctx2.sendIdx["variable:"]=1;
  40355. $recv($9)._add_($10);
  40356. $ctx2.sendIdx["add:"]=4;
  40357. $17=$recv($globals.IRVariable)._new();
  40358. $ctx2.sendIdx["new"]=5;
  40359. $19=$recv($globals.AliasVar)._new();
  40360. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40361. $recv($19)._name_("$receiver");
  40362. $20=$recv($19)._yourself();
  40363. $ctx2.sendIdx["yourself"]=3;
  40364. $18=$20;
  40365. $16=$recv($17)._variable_($18);
  40366. $recv($9)._add_($16);
  40367. $ctx2.sendIdx["add:"]=5;
  40368. $8=$recv($9)._yourself();
  40369. return $recv($7)._add_($8);
  40370. $ctx2.sendIdx["add:"]=3;
  40371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40372. }));
  40373. $ctx1.sendIdx["do:"]=2;
  40374. $recv(inlinedClosure)._add_(sequence);
  40375. $ctx1.sendIdx["add:"]=6;
  40376. $22=$recv(anIRClosure)._instructions();
  40377. $ctx1.sendIdx["instructions"]=2;
  40378. $21=$recv($22)._last();
  40379. $ctx1.sendIdx["last"]=1;
  40380. statements=$recv($21)._instructions();
  40381. $ctx1.sendIdx["instructions"]=1;
  40382. $recv(statements)._ifNotEmpty_((function(){
  40383. return $core.withContext(function($ctx2) {
  40384. $recv($recv(statements)._allButLast())._do_((function(each){
  40385. return $core.withContext(function($ctx3) {
  40386. return $recv(sequence)._add_(each);
  40387. $ctx3.sendIdx["add:"]=7;
  40388. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40389. }));
  40390. $25=$recv(statements)._last();
  40391. $ctx2.sendIdx["last"]=2;
  40392. $24=$recv($25)._isReturn();
  40393. $23=$recv($24)._and_((function(){
  40394. return $core.withContext(function($ctx3) {
  40395. $26=$recv(statements)._last();
  40396. $ctx3.sendIdx["last"]=3;
  40397. return $recv($26)._isBlockReturn();
  40398. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  40399. }));
  40400. if($core.assert($23)){
  40401. $27=sequence;
  40402. $30=$recv(statements)._last();
  40403. $ctx2.sendIdx["last"]=4;
  40404. $29=$recv($30)._instructions();
  40405. $28=$recv($29)._first();
  40406. return $recv($27)._add_($28);
  40407. $ctx2.sendIdx["add:"]=8;
  40408. } else {
  40409. return $recv(sequence)._add_($recv(statements)._last());
  40410. };
  40411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40412. }));
  40413. return inlinedClosure;
  40414. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40415. },
  40416. args: ["anIRClosure"],
  40417. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  40418. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40419. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
  40420. }),
  40421. $globals.IRSendInliner);
  40422. $core.addMethod(
  40423. $core.method({
  40424. selector: "inlineSend:",
  40425. protocol: 'inlining',
  40426. fn: function (anIRSend){
  40427. var self=this;
  40428. return $core.withContext(function($ctx1) {
  40429. var $2,$1;
  40430. self._send_(anIRSend);
  40431. $2=self._send();
  40432. $ctx1.sendIdx["send"]=1;
  40433. $1=$recv($2)._selector();
  40434. return self._perform_withArguments_($1,$recv($recv(self._send())._instructions())._allButFirst());
  40435. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40436. },
  40437. args: ["anIRSend"],
  40438. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  40439. referencedClasses: [],
  40440. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  40441. }),
  40442. $globals.IRSendInliner);
  40443. $core.addMethod(
  40444. $core.method({
  40445. selector: "inlinedClosure",
  40446. protocol: 'factory',
  40447. fn: function (){
  40448. var self=this;
  40449. return $core.withContext(function($ctx1) {
  40450. return $recv($globals.IRInlinedClosure)._new();
  40451. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40452. },
  40453. args: [],
  40454. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40455. referencedClasses: ["IRInlinedClosure"],
  40456. messageSends: ["new"]
  40457. }),
  40458. $globals.IRSendInliner);
  40459. $core.addMethod(
  40460. $core.method({
  40461. selector: "inlinedSend:withBlock:",
  40462. protocol: 'inlining',
  40463. fn: function (inlinedSend,anIRInstruction){
  40464. var self=this;
  40465. var inlinedClosure;
  40466. return $core.withContext(function($ctx1) {
  40467. var $1,$2,$5,$4,$3,$6;
  40468. $1=$recv(anIRInstruction)._isClosure();
  40469. if(!$core.assert($1)){
  40470. self._inliningError_("Message argument should be a block");
  40471. $ctx1.sendIdx["inliningError:"]=1;
  40472. };
  40473. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40474. if(!$core.assert($2)){
  40475. self._inliningError_("Inlined block should have zero argument");
  40476. };
  40477. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40478. $5=self._send();
  40479. $ctx1.sendIdx["send"]=1;
  40480. $4=$recv($5)._instructions();
  40481. $3=$recv($4)._first();
  40482. $recv(inlinedSend)._add_($3);
  40483. $ctx1.sendIdx["add:"]=1;
  40484. $recv(inlinedSend)._add_(inlinedClosure);
  40485. $recv(self._send())._replaceWith_(inlinedSend);
  40486. $6=$recv($recv(inlinedSend)._method())._internalVariables();
  40487. $ctx1.sendIdx["internalVariables"]=1;
  40488. $recv($6)._addAll_($recv(inlinedSend)._internalVariables());
  40489. return inlinedSend;
  40490. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40491. },
  40492. args: ["inlinedSend", "anIRInstruction"],
  40493. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  40494. referencedClasses: [],
  40495. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40496. }),
  40497. $globals.IRSendInliner);
  40498. $core.addMethod(
  40499. $core.method({
  40500. selector: "inlinedSend:withBlock:withBlock:",
  40501. protocol: 'inlining',
  40502. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40503. var self=this;
  40504. var inlinedClosure1,inlinedClosure2;
  40505. return $core.withContext(function($ctx1) {
  40506. var $1,$2,$3,$4,$7,$6,$5,$8;
  40507. $1=$recv(anIRInstruction)._isClosure();
  40508. $ctx1.sendIdx["isClosure"]=1;
  40509. if(!$core.assert($1)){
  40510. self._inliningError_("Message argument should be a block");
  40511. $ctx1.sendIdx["inliningError:"]=1;
  40512. };
  40513. $2=$recv(anotherIRInstruction)._isClosure();
  40514. if(!$core.assert($2)){
  40515. self._inliningError_("Message argument should be a block");
  40516. };
  40517. $3=self._translator();
  40518. $ctx1.sendIdx["translator"]=1;
  40519. $4=self._inlineClosure_(anIRInstruction);
  40520. $ctx1.sendIdx["inlineClosure:"]=1;
  40521. inlinedClosure1=$recv($3)._visit_($4);
  40522. $ctx1.sendIdx["visit:"]=1;
  40523. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40524. $7=self._send();
  40525. $ctx1.sendIdx["send"]=1;
  40526. $6=$recv($7)._instructions();
  40527. $5=$recv($6)._first();
  40528. $recv(inlinedSend)._add_($5);
  40529. $ctx1.sendIdx["add:"]=1;
  40530. $recv(inlinedSend)._add_(inlinedClosure1);
  40531. $ctx1.sendIdx["add:"]=2;
  40532. $recv(inlinedSend)._add_(inlinedClosure2);
  40533. $recv(self._send())._replaceWith_(inlinedSend);
  40534. $8=$recv($recv(inlinedSend)._method())._internalVariables();
  40535. $ctx1.sendIdx["internalVariables"]=1;
  40536. $recv($8)._addAll_($recv(inlinedSend)._internalVariables());
  40537. return inlinedSend;
  40538. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40539. },
  40540. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40541. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  40542. referencedClasses: [],
  40543. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40544. }),
  40545. $globals.IRSendInliner);
  40546. $core.addMethod(
  40547. $core.method({
  40548. selector: "inlinedSequence",
  40549. protocol: 'factory',
  40550. fn: function (){
  40551. var self=this;
  40552. return $core.withContext(function($ctx1) {
  40553. return $recv($globals.IRInlinedSequence)._new();
  40554. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40555. },
  40556. args: [],
  40557. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40558. referencedClasses: ["IRInlinedSequence"],
  40559. messageSends: ["new"]
  40560. }),
  40561. $globals.IRSendInliner);
  40562. $core.addMethod(
  40563. $core.method({
  40564. selector: "inliningError:",
  40565. protocol: 'error handling',
  40566. fn: function (aString){
  40567. var self=this;
  40568. return $core.withContext(function($ctx1) {
  40569. $recv($globals.InliningError)._signal_(aString);
  40570. return self;
  40571. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40572. },
  40573. args: ["aString"],
  40574. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40575. referencedClasses: ["InliningError"],
  40576. messageSends: ["signal:"]
  40577. }),
  40578. $globals.IRSendInliner);
  40579. $core.addMethod(
  40580. $core.method({
  40581. selector: "send",
  40582. protocol: 'accessing',
  40583. fn: function (){
  40584. var self=this;
  40585. return self["@send"];
  40586. },
  40587. args: [],
  40588. source: "send\x0a\x09^ send",
  40589. referencedClasses: [],
  40590. messageSends: []
  40591. }),
  40592. $globals.IRSendInliner);
  40593. $core.addMethod(
  40594. $core.method({
  40595. selector: "send:",
  40596. protocol: 'accessing',
  40597. fn: function (anIRSend){
  40598. var self=this;
  40599. self["@send"]=anIRSend;
  40600. return self;
  40601. },
  40602. args: ["anIRSend"],
  40603. source: "send: anIRSend\x0a\x09send := anIRSend",
  40604. referencedClasses: [],
  40605. messageSends: []
  40606. }),
  40607. $globals.IRSendInliner);
  40608. $core.addMethod(
  40609. $core.method({
  40610. selector: "translator",
  40611. protocol: 'accessing',
  40612. fn: function (){
  40613. var self=this;
  40614. return self["@translator"];
  40615. },
  40616. args: [],
  40617. source: "translator\x0a\x09^ translator",
  40618. referencedClasses: [],
  40619. messageSends: []
  40620. }),
  40621. $globals.IRSendInliner);
  40622. $core.addMethod(
  40623. $core.method({
  40624. selector: "translator:",
  40625. protocol: 'accessing',
  40626. fn: function (anASTTranslator){
  40627. var self=this;
  40628. self["@translator"]=anASTTranslator;
  40629. return self;
  40630. },
  40631. args: ["anASTTranslator"],
  40632. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40633. referencedClasses: [],
  40634. messageSends: []
  40635. }),
  40636. $globals.IRSendInliner);
  40637. $core.addMethod(
  40638. $core.method({
  40639. selector: "inlinedSelectors",
  40640. protocol: 'accessing',
  40641. fn: function (){
  40642. var self=this;
  40643. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40644. },
  40645. args: [],
  40646. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40647. referencedClasses: [],
  40648. messageSends: []
  40649. }),
  40650. $globals.IRSendInliner.klass);
  40651. $core.addMethod(
  40652. $core.method({
  40653. selector: "shouldInline:",
  40654. protocol: 'accessing',
  40655. fn: function (anIRInstruction){
  40656. var self=this;
  40657. return $core.withContext(function($ctx1) {
  40658. var $1;
  40659. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  40660. if(!$core.assert($1)){
  40661. return false;
  40662. };
  40663. return $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  40664. return $core.withContext(function($ctx2) {
  40665. return $recv(each)._isClosure();
  40666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40667. }));
  40668. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  40669. },
  40670. args: ["anIRInstruction"],
  40671. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  40672. referencedClasses: [],
  40673. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  40674. }),
  40675. $globals.IRSendInliner.klass);
  40676. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  40677. $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};";
  40678. $core.addMethod(
  40679. $core.method({
  40680. selector: "assignment",
  40681. protocol: 'accessing',
  40682. fn: function (){
  40683. var self=this;
  40684. return self["@assignment"];
  40685. },
  40686. args: [],
  40687. source: "assignment\x0a\x09^ assignment",
  40688. referencedClasses: [],
  40689. messageSends: []
  40690. }),
  40691. $globals.IRAssignmentInliner);
  40692. $core.addMethod(
  40693. $core.method({
  40694. selector: "assignment:",
  40695. protocol: 'accessing',
  40696. fn: function (aNode){
  40697. var self=this;
  40698. self["@assignment"]=aNode;
  40699. return self;
  40700. },
  40701. args: ["aNode"],
  40702. source: "assignment: aNode\x0a\x09assignment := aNode",
  40703. referencedClasses: [],
  40704. messageSends: []
  40705. }),
  40706. $globals.IRAssignmentInliner);
  40707. $core.addMethod(
  40708. $core.method({
  40709. selector: "inlineAssignment:",
  40710. protocol: 'inlining',
  40711. fn: function (anIRAssignment){
  40712. var self=this;
  40713. var inlinedAssignment;
  40714. return $core.withContext(function($ctx1) {
  40715. var $1;
  40716. self._assignment_(anIRAssignment);
  40717. inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
  40718. $1=$recv(anIRAssignment)._instructions();
  40719. $ctx1.sendIdx["instructions"]=1;
  40720. $recv($1)._do_((function(each){
  40721. return $core.withContext(function($ctx2) {
  40722. return $recv(inlinedAssignment)._add_(each);
  40723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40724. }));
  40725. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  40726. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  40727. return inlinedAssignment;
  40728. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  40729. },
  40730. args: ["anIRAssignment"],
  40731. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  40732. referencedClasses: ["IRInlinedAssignment"],
  40733. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40734. }),
  40735. $globals.IRAssignmentInliner);
  40736. $core.addMethod(
  40737. $core.method({
  40738. selector: "inlineClosure:",
  40739. protocol: 'inlining',
  40740. fn: function (anIRClosure){
  40741. var self=this;
  40742. var inlinedClosure,statements;
  40743. return $core.withContext(function($ctx1) {
  40744. var $2,$1,$4,$3,$5,$7,$6;
  40745. inlinedClosure=(
  40746. $ctx1.supercall = true,
  40747. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40748. $ctx1.supercall = false;
  40749. $2=$recv(inlinedClosure)._instructions();
  40750. $ctx1.sendIdx["instructions"]=2;
  40751. $1=$recv($2)._last();
  40752. $ctx1.sendIdx["last"]=1;
  40753. statements=$recv($1)._instructions();
  40754. $ctx1.sendIdx["instructions"]=1;
  40755. $recv(statements)._ifNotEmpty_((function(){
  40756. return $core.withContext(function($ctx2) {
  40757. $4=$recv(statements)._last();
  40758. $ctx2.sendIdx["last"]=2;
  40759. $3=$recv($4)._canBeAssigned();
  40760. if($core.assert($3)){
  40761. $5=$recv(statements)._last();
  40762. $ctx2.sendIdx["last"]=3;
  40763. $7=$recv($globals.IRAssignment)._new();
  40764. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  40765. $ctx2.sendIdx["add:"]=1;
  40766. $recv($7)._add_($recv($recv(statements)._last())._copy());
  40767. $6=$recv($7)._yourself();
  40768. return $recv($5)._replaceWith_($6);
  40769. };
  40770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40771. }));
  40772. return inlinedClosure;
  40773. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  40774. },
  40775. args: ["anIRClosure"],
  40776. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  40777. referencedClasses: ["IRAssignment"],
  40778. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  40779. }),
  40780. $globals.IRAssignmentInliner);
  40781. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40782. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40783. $core.addMethod(
  40784. $core.method({
  40785. selector: "inlineClosure:",
  40786. protocol: 'inlining',
  40787. fn: function (anIRClosure){
  40788. var self=this;
  40789. var closure,statements;
  40790. return $core.withContext(function($ctx1) {
  40791. var $1,$3,$2,$4,$6,$5;
  40792. closure=(
  40793. $ctx1.supercall = true,
  40794. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40795. $ctx1.supercall = false;
  40796. $1=$recv($recv(closure)._instructions())._last();
  40797. $ctx1.sendIdx["last"]=1;
  40798. statements=$recv($1)._instructions();
  40799. $ctx1.sendIdx["instructions"]=1;
  40800. $recv(statements)._ifNotEmpty_((function(){
  40801. return $core.withContext(function($ctx2) {
  40802. $3=$recv(statements)._last();
  40803. $ctx2.sendIdx["last"]=2;
  40804. $2=$recv($3)._isReturn();
  40805. if(!$core.assert($2)){
  40806. $4=$recv(statements)._last();
  40807. $ctx2.sendIdx["last"]=3;
  40808. $6=$recv($globals.IRReturn)._new();
  40809. $recv($6)._add_($recv($recv(statements)._last())._copy());
  40810. $5=$recv($6)._yourself();
  40811. return $recv($4)._replaceWith_($5);
  40812. };
  40813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40814. }));
  40815. return closure;
  40816. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  40817. },
  40818. args: ["anIRClosure"],
  40819. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  40820. referencedClasses: ["IRReturn"],
  40821. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  40822. }),
  40823. $globals.IRReturnInliner);
  40824. $core.addMethod(
  40825. $core.method({
  40826. selector: "inlineReturn:",
  40827. protocol: 'inlining',
  40828. fn: function (anIRReturn){
  40829. var self=this;
  40830. var return_;
  40831. return $core.withContext(function($ctx1) {
  40832. var $1;
  40833. return_=self._inlinedReturn();
  40834. $1=$recv(anIRReturn)._instructions();
  40835. $ctx1.sendIdx["instructions"]=1;
  40836. $recv($1)._do_((function(each){
  40837. return $core.withContext(function($ctx2) {
  40838. return $recv(return_)._add_(each);
  40839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40840. }));
  40841. $recv(anIRReturn)._replaceWith_(return_);
  40842. self._inlineSend_($recv($recv(return_)._instructions())._last());
  40843. return return_;
  40844. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  40845. },
  40846. args: ["anIRReturn"],
  40847. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  40848. referencedClasses: [],
  40849. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40850. }),
  40851. $globals.IRReturnInliner);
  40852. $core.addMethod(
  40853. $core.method({
  40854. selector: "inlinedReturn",
  40855. protocol: 'factory',
  40856. fn: function (){
  40857. var self=this;
  40858. return $core.withContext(function($ctx1) {
  40859. return $recv($globals.IRInlinedReturn)._new();
  40860. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  40861. },
  40862. args: [],
  40863. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  40864. referencedClasses: ["IRInlinedReturn"],
  40865. messageSends: ["new"]
  40866. }),
  40867. $globals.IRReturnInliner);
  40868. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40869. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40870. $core.addMethod(
  40871. $core.method({
  40872. selector: "compileNode:",
  40873. protocol: 'compiling',
  40874. fn: function (aNode){
  40875. var self=this;
  40876. var ir,stream;
  40877. return $core.withContext(function($ctx1) {
  40878. var $1;
  40879. $recv(self._semanticAnalyzer())._visit_(aNode);
  40880. $ctx1.sendIdx["visit:"]=1;
  40881. ir=$recv(self._translator())._visit_(aNode);
  40882. $ctx1.sendIdx["visit:"]=2;
  40883. $recv(self._inliner())._visit_(ir);
  40884. $ctx1.sendIdx["visit:"]=3;
  40885. $1=self._irTranslator();
  40886. $recv($1)._currentClass_(self._currentClass());
  40887. $recv($1)._visit_(ir);
  40888. return $recv($1)._contents();
  40889. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40890. },
  40891. args: ["aNode"],
  40892. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  40893. referencedClasses: [],
  40894. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40895. }),
  40896. $globals.InliningCodeGenerator);
  40897. $core.addMethod(
  40898. $core.method({
  40899. selector: "inliner",
  40900. protocol: 'compiling',
  40901. fn: function (){
  40902. var self=this;
  40903. return $core.withContext(function($ctx1) {
  40904. return $recv($globals.IRInliner)._new();
  40905. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40906. },
  40907. args: [],
  40908. source: "inliner\x0a\x09^ IRInliner new",
  40909. referencedClasses: ["IRInliner"],
  40910. messageSends: ["new"]
  40911. }),
  40912. $globals.InliningCodeGenerator);
  40913. $core.addMethod(
  40914. $core.method({
  40915. selector: "irTranslator",
  40916. protocol: 'compiling',
  40917. fn: function (){
  40918. var self=this;
  40919. return $core.withContext(function($ctx1) {
  40920. return $recv($globals.IRInliningJSTranslator)._new();
  40921. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40922. },
  40923. args: [],
  40924. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40925. referencedClasses: ["IRInliningJSTranslator"],
  40926. messageSends: ["new"]
  40927. }),
  40928. $globals.InliningCodeGenerator);
  40929. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40930. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40931. });
  40932. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
  40933. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40934. $core.addPackage('Compiler-Interpreter');
  40935. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40936. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40937. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40938. $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`).";
  40939. $core.addMethod(
  40940. $core.method({
  40941. selector: "applyTo:arguments:",
  40942. protocol: 'evaluating',
  40943. fn: function (anObject,aCollection){
  40944. var self=this;
  40945. return $core.withContext(function($ctx1) {
  40946. self._interpreterError();
  40947. return self;
  40948. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40949. },
  40950. args: ["anObject", "aCollection"],
  40951. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40952. referencedClasses: [],
  40953. messageSends: ["interpreterError"]
  40954. }),
  40955. $globals.AIBlockClosure);
  40956. $core.addMethod(
  40957. $core.method({
  40958. selector: "compiledSource",
  40959. protocol: 'accessing',
  40960. fn: function (){
  40961. var self=this;
  40962. return "[ AST Block closure ]";
  40963. },
  40964. args: [],
  40965. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40966. referencedClasses: [],
  40967. messageSends: []
  40968. }),
  40969. $globals.AIBlockClosure);
  40970. $core.addMethod(
  40971. $core.method({
  40972. selector: "currySelf",
  40973. protocol: 'converting',
  40974. fn: function (){
  40975. var self=this;
  40976. return $core.withContext(function($ctx1) {
  40977. self._interpreterError();
  40978. return self;
  40979. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40980. },
  40981. args: [],
  40982. source: "currySelf\x0a\x09self interpreterError",
  40983. referencedClasses: [],
  40984. messageSends: ["interpreterError"]
  40985. }),
  40986. $globals.AIBlockClosure);
  40987. $core.addMethod(
  40988. $core.method({
  40989. selector: "initializeWithContext:node:",
  40990. protocol: 'initialization',
  40991. fn: function (aContext,aNode){
  40992. var self=this;
  40993. self["@node"]=aNode;
  40994. self["@outerContext"]=aContext;
  40995. return self;
  40996. },
  40997. args: ["aContext", "aNode"],
  40998. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40999. referencedClasses: [],
  41000. messageSends: []
  41001. }),
  41002. $globals.AIBlockClosure);
  41003. $core.addMethod(
  41004. $core.method({
  41005. selector: "interpreterError",
  41006. protocol: 'error handling',
  41007. fn: function (){
  41008. var self=this;
  41009. return $core.withContext(function($ctx1) {
  41010. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  41011. return self;
  41012. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  41013. },
  41014. args: [],
  41015. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  41016. referencedClasses: ["ASTInterpreterError"],
  41017. messageSends: ["signal:"]
  41018. }),
  41019. $globals.AIBlockClosure);
  41020. $core.addMethod(
  41021. $core.method({
  41022. selector: "numArgs",
  41023. protocol: 'accessing',
  41024. fn: function (){
  41025. var self=this;
  41026. return $core.withContext(function($ctx1) {
  41027. return $recv($recv(self["@node"])._temps())._size();
  41028. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  41029. },
  41030. args: [],
  41031. source: "numArgs\x0a\x09^ node temps size",
  41032. referencedClasses: [],
  41033. messageSends: ["size", "temps"]
  41034. }),
  41035. $globals.AIBlockClosure);
  41036. $core.addMethod(
  41037. $core.method({
  41038. selector: "value",
  41039. protocol: 'evaluating',
  41040. fn: function (){
  41041. var self=this;
  41042. return $core.withContext(function($ctx1) {
  41043. return self._valueWithPossibleArguments_([]);
  41044. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  41045. },
  41046. args: [],
  41047. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  41048. referencedClasses: [],
  41049. messageSends: ["valueWithPossibleArguments:"]
  41050. }),
  41051. $globals.AIBlockClosure);
  41052. $core.addMethod(
  41053. $core.method({
  41054. selector: "value:",
  41055. protocol: 'evaluating',
  41056. fn: function (anArgument){
  41057. var self=this;
  41058. return $core.withContext(function($ctx1) {
  41059. return self._valueWithPossibleArguments_([anArgument]);
  41060. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  41061. },
  41062. args: ["anArgument"],
  41063. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  41064. referencedClasses: [],
  41065. messageSends: ["valueWithPossibleArguments:"]
  41066. }),
  41067. $globals.AIBlockClosure);
  41068. $core.addMethod(
  41069. $core.method({
  41070. selector: "value:value:",
  41071. protocol: 'evaluating',
  41072. fn: function (firstArgument,secondArgument){
  41073. var self=this;
  41074. return $core.withContext(function($ctx1) {
  41075. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  41076. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  41077. },
  41078. args: ["firstArgument", "secondArgument"],
  41079. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  41080. referencedClasses: [],
  41081. messageSends: ["valueWithPossibleArguments:"]
  41082. }),
  41083. $globals.AIBlockClosure);
  41084. $core.addMethod(
  41085. $core.method({
  41086. selector: "value:value:value:",
  41087. protocol: 'evaluating',
  41088. fn: function (firstArgument,secondArgument,thirdArgument){
  41089. var self=this;
  41090. return $core.withContext(function($ctx1) {
  41091. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  41092. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  41093. },
  41094. args: ["firstArgument", "secondArgument", "thirdArgument"],
  41095. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  41096. referencedClasses: [],
  41097. messageSends: ["valueWithPossibleArguments:"]
  41098. }),
  41099. $globals.AIBlockClosure);
  41100. $core.addMethod(
  41101. $core.method({
  41102. selector: "valueWithPossibleArguments:",
  41103. protocol: 'evaluating',
  41104. fn: function (aCollection){
  41105. var self=this;
  41106. var context,sequenceNode;
  41107. return $core.withContext(function($ctx1) {
  41108. var $1,$2,$3;
  41109. context=$recv(self["@outerContext"])._newInnerContext();
  41110. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  41111. $recv($1)._parent_(nil);
  41112. sequenceNode=$recv($1)._yourself();
  41113. $recv($recv(sequenceNode)._temps())._do_((function(each){
  41114. return $core.withContext(function($ctx2) {
  41115. return $recv(context)._defineLocal_(each);
  41116. $ctx2.sendIdx["defineLocal:"]=1;
  41117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41118. }));
  41119. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  41120. return $core.withContext(function($ctx2) {
  41121. $recv(context)._defineLocal_(each);
  41122. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  41123. return nil;
  41124. })));
  41125. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  41126. }));
  41127. $2=$recv(context)._interpreter();
  41128. $ctx1.sendIdx["interpreter"]=1;
  41129. $recv($2)._node_(sequenceNode);
  41130. $recv($2)._enterNode();
  41131. $recv($2)._proceed();
  41132. $3=$recv(self["@outerContext"])._interpreter();
  41133. $ctx1.sendIdx["interpreter"]=2;
  41134. $recv($3)._setNonLocalReturnFromContext_(context);
  41135. return $recv($recv(context)._interpreter())._pop();
  41136. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  41137. },
  41138. args: ["aCollection"],
  41139. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  41140. referencedClasses: [],
  41141. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  41142. }),
  41143. $globals.AIBlockClosure);
  41144. $core.addMethod(
  41145. $core.method({
  41146. selector: "forContext:node:",
  41147. protocol: 'instance creation',
  41148. fn: function (aContext,aNode){
  41149. var self=this;
  41150. return $core.withContext(function($ctx1) {
  41151. var $1;
  41152. $1=self._new();
  41153. $recv($1)._initializeWithContext_node_(aContext,aNode);
  41154. return $recv($1)._yourself();
  41155. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  41156. },
  41157. args: ["aContext", "aNode"],
  41158. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  41159. referencedClasses: [],
  41160. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  41161. }),
  41162. $globals.AIBlockClosure.klass);
  41163. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  41164. $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)";
  41165. $core.addMethod(
  41166. $core.method({
  41167. selector: "arguments",
  41168. protocol: 'interpreting',
  41169. fn: function (){
  41170. var self=this;
  41171. return $core.withContext(function($ctx1) {
  41172. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  41173. return $core.withContext(function($ctx2) {
  41174. return self._localAt_ifAbsent_(each,(function(){
  41175. return $core.withContext(function($ctx3) {
  41176. return self._error_("Argument not in context");
  41177. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41178. }));
  41179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41180. }));
  41181. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  41182. },
  41183. args: [],
  41184. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  41185. referencedClasses: [],
  41186. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  41187. }),
  41188. $globals.AIContext);
  41189. $core.addMethod(
  41190. $core.method({
  41191. selector: "ast",
  41192. protocol: 'interpreting',
  41193. fn: function (){
  41194. var self=this;
  41195. return $core.withContext(function($ctx1) {
  41196. var $1,$2,$3,$receiver;
  41197. $1=self._isBlockContext();
  41198. if($core.assert($1)){
  41199. $2=self._outerContext();
  41200. return $recv($2)._ifNotNil_((function(context){
  41201. return $core.withContext(function($ctx2) {
  41202. return $recv(context)._ast();
  41203. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,2)});
  41204. }));
  41205. };
  41206. $3=self["@ast"];
  41207. if(($receiver = $3) == null || $receiver.isNil){
  41208. self._initializeAST();
  41209. } else {
  41210. $3;
  41211. };
  41212. return self["@ast"];
  41213. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41214. },
  41215. args: [],
  41216. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41217. referencedClasses: [],
  41218. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41219. }),
  41220. $globals.AIContext);
  41221. $core.addMethod(
  41222. $core.method({
  41223. selector: "basicLocalAt:",
  41224. protocol: 'private',
  41225. fn: function (aString){
  41226. var self=this;
  41227. return $core.withContext(function($ctx1) {
  41228. return $recv(self._locals())._at_(aString);
  41229. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41230. },
  41231. args: ["aString"],
  41232. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41233. referencedClasses: [],
  41234. messageSends: ["at:", "locals"]
  41235. }),
  41236. $globals.AIContext);
  41237. $core.addMethod(
  41238. $core.method({
  41239. selector: "basicLocalAt:put:",
  41240. protocol: 'private',
  41241. fn: function (aString,anObject){
  41242. var self=this;
  41243. return $core.withContext(function($ctx1) {
  41244. $recv(self._locals())._at_put_(aString,anObject);
  41245. return self;
  41246. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41247. },
  41248. args: ["aString", "anObject"],
  41249. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41250. referencedClasses: [],
  41251. messageSends: ["at:put:", "locals"]
  41252. }),
  41253. $globals.AIContext);
  41254. $core.addMethod(
  41255. $core.method({
  41256. selector: "basicReceiver",
  41257. protocol: 'interpreting',
  41258. fn: function (){
  41259. var self=this;
  41260. return $core.withContext(function($ctx1) {
  41261. return self._localAt_("self");
  41262. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41263. },
  41264. args: [],
  41265. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41266. referencedClasses: [],
  41267. messageSends: ["localAt:"]
  41268. }),
  41269. $globals.AIContext);
  41270. $core.addMethod(
  41271. $core.method({
  41272. selector: "defineLocal:",
  41273. protocol: 'accessing',
  41274. fn: function (aString){
  41275. var self=this;
  41276. return $core.withContext(function($ctx1) {
  41277. $recv(self._locals())._at_put_(aString,nil);
  41278. return self;
  41279. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41280. },
  41281. args: ["aString"],
  41282. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41283. referencedClasses: [],
  41284. messageSends: ["at:put:", "locals"]
  41285. }),
  41286. $globals.AIContext);
  41287. $core.addMethod(
  41288. $core.method({
  41289. selector: "evaluate:on:",
  41290. protocol: 'evaluating',
  41291. fn: function (aString,anEvaluator){
  41292. var self=this;
  41293. return $core.withContext(function($ctx1) {
  41294. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41295. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41296. },
  41297. args: ["aString", "anEvaluator"],
  41298. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41299. referencedClasses: [],
  41300. messageSends: ["evaluate:context:"]
  41301. }),
  41302. $globals.AIContext);
  41303. $core.addMethod(
  41304. $core.method({
  41305. selector: "evaluateNode:",
  41306. protocol: 'evaluating',
  41307. fn: function (aNode){
  41308. var self=this;
  41309. return $core.withContext(function($ctx1) {
  41310. var $1;
  41311. $1=$recv($globals.ASTInterpreter)._new();
  41312. $recv($1)._context_(self);
  41313. $recv($1)._node_(aNode);
  41314. $recv($1)._enterNode();
  41315. $recv($1)._proceed();
  41316. return $recv($1)._result();
  41317. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41318. },
  41319. args: ["aNode"],
  41320. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41321. referencedClasses: ["ASTInterpreter"],
  41322. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41323. }),
  41324. $globals.AIContext);
  41325. $core.addMethod(
  41326. $core.method({
  41327. selector: "evaluatedSelector",
  41328. protocol: 'accessing',
  41329. fn: function (){
  41330. var self=this;
  41331. return self["@evaluatedSelector"];
  41332. },
  41333. args: [],
  41334. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41335. referencedClasses: [],
  41336. messageSends: []
  41337. }),
  41338. $globals.AIContext);
  41339. $core.addMethod(
  41340. $core.method({
  41341. selector: "evaluatedSelector:",
  41342. protocol: 'accessing',
  41343. fn: function (aString){
  41344. var self=this;
  41345. self["@evaluatedSelector"]=aString;
  41346. return self;
  41347. },
  41348. args: ["aString"],
  41349. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41350. referencedClasses: [],
  41351. messageSends: []
  41352. }),
  41353. $globals.AIContext);
  41354. $core.addMethod(
  41355. $core.method({
  41356. selector: "index",
  41357. protocol: 'accessing',
  41358. fn: function (){
  41359. var self=this;
  41360. return $core.withContext(function($ctx1) {
  41361. var $1,$receiver;
  41362. $1=self["@index"];
  41363. if(($receiver = $1) == null || $receiver.isNil){
  41364. return (0);
  41365. } else {
  41366. return $1;
  41367. };
  41368. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41369. },
  41370. args: [],
  41371. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41372. referencedClasses: [],
  41373. messageSends: ["ifNil:"]
  41374. }),
  41375. $globals.AIContext);
  41376. $core.addMethod(
  41377. $core.method({
  41378. selector: "index:",
  41379. protocol: 'accessing',
  41380. fn: function (anInteger){
  41381. var self=this;
  41382. self["@index"]=anInteger;
  41383. return self;
  41384. },
  41385. args: ["anInteger"],
  41386. source: "index: anInteger\x0a\x09index := anInteger",
  41387. referencedClasses: [],
  41388. messageSends: []
  41389. }),
  41390. $globals.AIContext);
  41391. $core.addMethod(
  41392. $core.method({
  41393. selector: "initializeAST",
  41394. protocol: 'initialization',
  41395. fn: function (){
  41396. var self=this;
  41397. return $core.withContext(function($ctx1) {
  41398. var $1;
  41399. $1=self._method();
  41400. $ctx1.sendIdx["method"]=1;
  41401. self["@ast"]=$recv($1)._ast();
  41402. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41403. return self;
  41404. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41405. },
  41406. args: [],
  41407. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41408. referencedClasses: ["SemanticAnalyzer"],
  41409. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41410. }),
  41411. $globals.AIContext);
  41412. $core.addMethod(
  41413. $core.method({
  41414. selector: "initializeFromMethodContext:",
  41415. protocol: 'initialization',
  41416. fn: function (aMethodContext){
  41417. var self=this;
  41418. return $core.withContext(function($ctx1) {
  41419. var $1,$2,$3,$receiver;
  41420. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41421. self._index_($recv(aMethodContext)._index());
  41422. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41423. self._receiver_($recv(aMethodContext)._receiver());
  41424. self._supercall_($recv(aMethodContext)._supercall());
  41425. self._selector_($recv(aMethodContext)._selector());
  41426. $1=$recv(aMethodContext)._outerContext();
  41427. $ctx1.sendIdx["outerContext"]=1;
  41428. if(($receiver = $1) == null || $receiver.isNil){
  41429. $1;
  41430. } else {
  41431. var outer;
  41432. outer=$receiver;
  41433. $2=$recv(outer)._methodContext();
  41434. if(($receiver = $2) == null || $receiver.isNil){
  41435. $2;
  41436. } else {
  41437. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41438. };
  41439. $3=$recv(aMethodContext)._locals();
  41440. $ctx1.sendIdx["locals"]=1;
  41441. $recv($3)._keysAndValuesDo_((function(key,value){
  41442. return $core.withContext(function($ctx2) {
  41443. return $recv(self._locals())._at_put_(key,value);
  41444. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41445. }));
  41446. };
  41447. return self;
  41448. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41449. },
  41450. args: ["aMethodContext"],
  41451. 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 ] ]",
  41452. referencedClasses: [],
  41453. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41454. }),
  41455. $globals.AIContext);
  41456. $core.addMethod(
  41457. $core.method({
  41458. selector: "initializeInterpreter",
  41459. protocol: 'initialization',
  41460. fn: function (){
  41461. var self=this;
  41462. return $core.withContext(function($ctx1) {
  41463. var $1,$2,$receiver;
  41464. $1=$recv($globals.ASTInterpreter)._new();
  41465. $recv($1)._context_(self);
  41466. self["@interpreter"]=$recv($1)._yourself();
  41467. $2=self._innerContext();
  41468. if(($receiver = $2) == null || $receiver.isNil){
  41469. $2;
  41470. } else {
  41471. self._setupInterpreter_(self["@interpreter"]);
  41472. };
  41473. return self;
  41474. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41475. },
  41476. args: [],
  41477. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41478. referencedClasses: ["ASTInterpreter"],
  41479. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41480. }),
  41481. $globals.AIContext);
  41482. $core.addMethod(
  41483. $core.method({
  41484. selector: "initializeLocals",
  41485. protocol: 'initialization',
  41486. fn: function (){
  41487. var self=this;
  41488. return $core.withContext(function($ctx1) {
  41489. self["@locals"]=$recv($globals.Dictionary)._new();
  41490. $recv(self["@locals"])._at_put_("thisContext",self);
  41491. return self;
  41492. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41493. },
  41494. args: [],
  41495. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41496. referencedClasses: ["Dictionary"],
  41497. messageSends: ["new", "at:put:"]
  41498. }),
  41499. $globals.AIContext);
  41500. $core.addMethod(
  41501. $core.method({
  41502. selector: "innerContext",
  41503. protocol: 'accessing',
  41504. fn: function (){
  41505. var self=this;
  41506. return self["@innerContext"];
  41507. },
  41508. args: [],
  41509. source: "innerContext\x0a\x09^ innerContext",
  41510. referencedClasses: [],
  41511. messageSends: []
  41512. }),
  41513. $globals.AIContext);
  41514. $core.addMethod(
  41515. $core.method({
  41516. selector: "innerContext:",
  41517. protocol: 'accessing',
  41518. fn: function (anAIContext){
  41519. var self=this;
  41520. self["@innerContext"]=anAIContext;
  41521. return self;
  41522. },
  41523. args: ["anAIContext"],
  41524. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41525. referencedClasses: [],
  41526. messageSends: []
  41527. }),
  41528. $globals.AIContext);
  41529. $core.addMethod(
  41530. $core.method({
  41531. selector: "interpreter",
  41532. protocol: 'interpreting',
  41533. fn: function (){
  41534. var self=this;
  41535. return $core.withContext(function($ctx1) {
  41536. var $1,$receiver;
  41537. $1=self["@interpreter"];
  41538. if(($receiver = $1) == null || $receiver.isNil){
  41539. self._initializeInterpreter();
  41540. } else {
  41541. $1;
  41542. };
  41543. return self["@interpreter"];
  41544. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41545. },
  41546. args: [],
  41547. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41548. referencedClasses: [],
  41549. messageSends: ["ifNil:", "initializeInterpreter"]
  41550. }),
  41551. $globals.AIContext);
  41552. $core.addMethod(
  41553. $core.method({
  41554. selector: "interpreter:",
  41555. protocol: 'interpreting',
  41556. fn: function (anInterpreter){
  41557. var self=this;
  41558. self["@interpreter"]=anInterpreter;
  41559. return self;
  41560. },
  41561. args: ["anInterpreter"],
  41562. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41563. referencedClasses: [],
  41564. messageSends: []
  41565. }),
  41566. $globals.AIContext);
  41567. $core.addMethod(
  41568. $core.method({
  41569. selector: "isTopContext",
  41570. protocol: 'testing',
  41571. fn: function (){
  41572. var self=this;
  41573. return $core.withContext(function($ctx1) {
  41574. return $recv(self._innerContext())._isNil();
  41575. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41576. },
  41577. args: [],
  41578. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41579. referencedClasses: [],
  41580. messageSends: ["isNil", "innerContext"]
  41581. }),
  41582. $globals.AIContext);
  41583. $core.addMethod(
  41584. $core.method({
  41585. selector: "localAt:",
  41586. protocol: 'accessing',
  41587. fn: function (aString){
  41588. var self=this;
  41589. var context;
  41590. return $core.withContext(function($ctx1) {
  41591. context=self._lookupContextForLocal_(aString);
  41592. return $recv(context)._basicLocalAt_(aString);
  41593. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41594. },
  41595. args: ["aString"],
  41596. 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",
  41597. referencedClasses: [],
  41598. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41599. }),
  41600. $globals.AIContext);
  41601. $core.addMethod(
  41602. $core.method({
  41603. selector: "localAt:ifAbsent:",
  41604. protocol: 'accessing',
  41605. fn: function (aString,aBlock){
  41606. var self=this;
  41607. var context;
  41608. return $core.withContext(function($ctx1) {
  41609. var $early={};
  41610. try {
  41611. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41612. return $core.withContext(function($ctx2) {
  41613. throw $early=[$recv(aBlock)._value()];
  41614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41615. }));
  41616. return $recv(context)._basicLocalAt_(aString);
  41617. }
  41618. catch(e) {if(e===$early)return e[0]; throw e}
  41619. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41620. },
  41621. args: ["aString", "aBlock"],
  41622. 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",
  41623. referencedClasses: [],
  41624. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41625. }),
  41626. $globals.AIContext);
  41627. $core.addMethod(
  41628. $core.method({
  41629. selector: "localAt:put:",
  41630. protocol: 'accessing',
  41631. fn: function (aString,anObject){
  41632. var self=this;
  41633. var context;
  41634. return $core.withContext(function($ctx1) {
  41635. context=self._lookupContextForLocal_(aString);
  41636. $recv(context)._basicLocalAt_put_(aString,anObject);
  41637. return self;
  41638. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41639. },
  41640. args: ["aString", "anObject"],
  41641. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41642. referencedClasses: [],
  41643. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41644. }),
  41645. $globals.AIContext);
  41646. $core.addMethod(
  41647. $core.method({
  41648. selector: "locals",
  41649. protocol: 'accessing',
  41650. fn: function (){
  41651. var self=this;
  41652. return $core.withContext(function($ctx1) {
  41653. var $1,$receiver;
  41654. $1=self["@locals"];
  41655. if(($receiver = $1) == null || $receiver.isNil){
  41656. self._initializeLocals();
  41657. } else {
  41658. $1;
  41659. };
  41660. return self["@locals"];
  41661. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41662. },
  41663. args: [],
  41664. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41665. referencedClasses: [],
  41666. messageSends: ["ifNil:", "initializeLocals"]
  41667. }),
  41668. $globals.AIContext);
  41669. $core.addMethod(
  41670. $core.method({
  41671. selector: "lookupContextForLocal:",
  41672. protocol: 'private',
  41673. fn: function (aString){
  41674. var self=this;
  41675. return $core.withContext(function($ctx1) {
  41676. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41677. return $core.withContext(function($ctx2) {
  41678. return self._variableNotFound();
  41679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41680. }));
  41681. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41682. },
  41683. args: ["aString"],
  41684. 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 ]",
  41685. referencedClasses: [],
  41686. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41687. }),
  41688. $globals.AIContext);
  41689. $core.addMethod(
  41690. $core.method({
  41691. selector: "lookupContextForLocal:ifNone:",
  41692. protocol: 'private',
  41693. fn: function (aString,aBlock){
  41694. var self=this;
  41695. return $core.withContext(function($ctx1) {
  41696. var $1;
  41697. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41698. return self;
  41699. }),(function(){
  41700. return $core.withContext(function($ctx2) {
  41701. $1=self._outerContext();
  41702. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41703. return $core.withContext(function($ctx3) {
  41704. return $recv(context)._lookupContextForLocal_(aString);
  41705. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41706. }));
  41707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41708. }));
  41709. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41710. },
  41711. args: ["aString", "aBlock"],
  41712. 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 ] ]",
  41713. referencedClasses: [],
  41714. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41715. }),
  41716. $globals.AIContext);
  41717. $core.addMethod(
  41718. $core.method({
  41719. selector: "newInnerContext",
  41720. protocol: 'factory',
  41721. fn: function (){
  41722. var self=this;
  41723. return $core.withContext(function($ctx1) {
  41724. var $1;
  41725. $1=$recv(self._class())._new();
  41726. $recv($1)._outerContext_(self);
  41727. return $recv($1)._yourself();
  41728. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41729. },
  41730. args: [],
  41731. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41732. referencedClasses: [],
  41733. messageSends: ["outerContext:", "new", "class", "yourself"]
  41734. }),
  41735. $globals.AIContext);
  41736. $core.addMethod(
  41737. $core.method({
  41738. selector: "outerContext",
  41739. protocol: 'accessing',
  41740. fn: function (){
  41741. var self=this;
  41742. return self["@outerContext"];
  41743. },
  41744. args: [],
  41745. source: "outerContext\x0a\x09^ outerContext",
  41746. referencedClasses: [],
  41747. messageSends: []
  41748. }),
  41749. $globals.AIContext);
  41750. $core.addMethod(
  41751. $core.method({
  41752. selector: "outerContext:",
  41753. protocol: 'accessing',
  41754. fn: function (anAIContext){
  41755. var self=this;
  41756. return $core.withContext(function($ctx1) {
  41757. var $1,$receiver;
  41758. self["@outerContext"]=anAIContext;
  41759. $1=self["@outerContext"];
  41760. if(($receiver = $1) == null || $receiver.isNil){
  41761. $1;
  41762. } else {
  41763. var context;
  41764. context=$receiver;
  41765. $recv(context)._innerContext_(self);
  41766. };
  41767. return self;
  41768. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41769. },
  41770. args: ["anAIContext"],
  41771. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41772. referencedClasses: [],
  41773. messageSends: ["ifNotNil:", "innerContext:"]
  41774. }),
  41775. $globals.AIContext);
  41776. $core.addMethod(
  41777. $core.method({
  41778. selector: "receiver:",
  41779. protocol: 'interpreting',
  41780. fn: function (anObject){
  41781. var self=this;
  41782. return $core.withContext(function($ctx1) {
  41783. $recv(self._locals())._at_put_("self",anObject);
  41784. return self;
  41785. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41786. },
  41787. args: ["anObject"],
  41788. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41789. referencedClasses: [],
  41790. messageSends: ["at:put:", "locals"]
  41791. }),
  41792. $globals.AIContext);
  41793. $core.addMethod(
  41794. $core.method({
  41795. selector: "selector",
  41796. protocol: 'accessing',
  41797. fn: function (){
  41798. var self=this;
  41799. return self["@selector"];
  41800. },
  41801. args: [],
  41802. source: "selector\x0a\x09^ selector",
  41803. referencedClasses: [],
  41804. messageSends: []
  41805. }),
  41806. $globals.AIContext);
  41807. $core.addMethod(
  41808. $core.method({
  41809. selector: "selector:",
  41810. protocol: 'accessing',
  41811. fn: function (aString){
  41812. var self=this;
  41813. self["@selector"]=aString;
  41814. return self;
  41815. },
  41816. args: ["aString"],
  41817. source: "selector: aString\x0a\x09selector := aString",
  41818. referencedClasses: [],
  41819. messageSends: []
  41820. }),
  41821. $globals.AIContext);
  41822. $core.addMethod(
  41823. $core.method({
  41824. selector: "sendIndexAt:",
  41825. protocol: 'accessing',
  41826. fn: function (aString){
  41827. var self=this;
  41828. return $core.withContext(function($ctx1) {
  41829. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41830. return (0);
  41831. }));
  41832. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41833. },
  41834. args: ["aString"],
  41835. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41836. referencedClasses: [],
  41837. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41838. }),
  41839. $globals.AIContext);
  41840. $core.addMethod(
  41841. $core.method({
  41842. selector: "sendIndexes",
  41843. protocol: 'accessing',
  41844. fn: function (){
  41845. var self=this;
  41846. return $core.withContext(function($ctx1) {
  41847. var $1,$receiver;
  41848. $1=self["@sendIndexes"];
  41849. if(($receiver = $1) == null || $receiver.isNil){
  41850. return $recv($globals.Dictionary)._new();
  41851. } else {
  41852. return $1;
  41853. };
  41854. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41855. },
  41856. args: [],
  41857. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41858. referencedClasses: ["Dictionary"],
  41859. messageSends: ["ifNil:", "new"]
  41860. }),
  41861. $globals.AIContext);
  41862. $core.addMethod(
  41863. $core.method({
  41864. selector: "sendIndexes:",
  41865. protocol: 'accessing',
  41866. fn: function (aDictionary){
  41867. var self=this;
  41868. self["@sendIndexes"]=aDictionary;
  41869. return self;
  41870. },
  41871. args: ["aDictionary"],
  41872. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41873. referencedClasses: [],
  41874. messageSends: []
  41875. }),
  41876. $globals.AIContext);
  41877. $core.addMethod(
  41878. $core.method({
  41879. selector: "setupInterpreter:",
  41880. protocol: 'interpreting',
  41881. fn: function (anInterpreter){
  41882. var self=this;
  41883. var currentNode;
  41884. return $core.withContext(function($ctx1) {
  41885. var $1,$2,$3,$6,$5,$4,$receiver;
  41886. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41887. $recv($1)._selector_(self._evaluatedSelector());
  41888. $recv($1)._context_(self);
  41889. $2=self._ast();
  41890. $ctx1.sendIdx["ast"]=1;
  41891. $recv($1)._visit_($2);
  41892. currentNode=$recv($1)._currentNode();
  41893. $3=$recv(self._ast())._sequenceNode();
  41894. if(($receiver = $3) == null || $receiver.isNil){
  41895. $3;
  41896. } else {
  41897. var sequence;
  41898. sequence=$receiver;
  41899. $recv($recv(sequence)._temps())._do_((function(each){
  41900. return $core.withContext(function($ctx2) {
  41901. return self._defineLocal_(each);
  41902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41903. }));
  41904. $ctx1.sendIdx["do:"]=1;
  41905. };
  41906. $recv(anInterpreter)._node_(currentNode);
  41907. $6=self._innerContext();
  41908. $ctx1.sendIdx["innerContext"]=1;
  41909. $5=$recv($6)._arguments();
  41910. $4=$recv($5)._reversed();
  41911. $recv($4)._do_((function(each){
  41912. return $core.withContext(function($ctx2) {
  41913. return $recv(anInterpreter)._push_(each);
  41914. $ctx2.sendIdx["push:"]=1;
  41915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41916. }));
  41917. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41918. return self;
  41919. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41920. },
  41921. args: ["anInterpreter"],
  41922. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  41923. referencedClasses: ["ASTPCNodeVisitor"],
  41924. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41925. }),
  41926. $globals.AIContext);
  41927. $core.addMethod(
  41928. $core.method({
  41929. selector: "supercall",
  41930. protocol: 'interpreting',
  41931. fn: function (){
  41932. var self=this;
  41933. return $core.withContext(function($ctx1) {
  41934. var $1,$receiver;
  41935. $1=self["@supercall"];
  41936. if(($receiver = $1) == null || $receiver.isNil){
  41937. return false;
  41938. } else {
  41939. return $1;
  41940. };
  41941. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41942. },
  41943. args: [],
  41944. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41945. referencedClasses: [],
  41946. messageSends: ["ifNil:"]
  41947. }),
  41948. $globals.AIContext);
  41949. $core.addMethod(
  41950. $core.method({
  41951. selector: "supercall:",
  41952. protocol: 'interpreting',
  41953. fn: function (aBoolean){
  41954. var self=this;
  41955. self["@supercall"]=aBoolean;
  41956. return self;
  41957. },
  41958. args: ["aBoolean"],
  41959. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41960. referencedClasses: [],
  41961. messageSends: []
  41962. }),
  41963. $globals.AIContext);
  41964. $core.addMethod(
  41965. $core.method({
  41966. selector: "variableNotFound",
  41967. protocol: 'error handling',
  41968. fn: function (){
  41969. var self=this;
  41970. return $core.withContext(function($ctx1) {
  41971. self._error_("Variable missing");
  41972. return self;
  41973. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41974. },
  41975. args: [],
  41976. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41977. referencedClasses: [],
  41978. messageSends: ["error:"]
  41979. }),
  41980. $globals.AIContext);
  41981. $core.addMethod(
  41982. $core.method({
  41983. selector: "fromMethodContext:",
  41984. protocol: 'instance creation',
  41985. fn: function (aMethodContext){
  41986. var self=this;
  41987. return $core.withContext(function($ctx1) {
  41988. var $1;
  41989. $1=self._new();
  41990. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41991. return $recv($1)._yourself();
  41992. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41993. },
  41994. args: ["aMethodContext"],
  41995. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41996. referencedClasses: [],
  41997. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41998. }),
  41999. $globals.AIContext.klass);
  42000. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  42001. $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.";
  42002. $core.addMethod(
  42003. $core.method({
  42004. selector: "context",
  42005. protocol: 'accessing',
  42006. fn: function (){
  42007. var self=this;
  42008. return self["@context"];
  42009. },
  42010. args: [],
  42011. source: "context\x0a\x09^ context",
  42012. referencedClasses: [],
  42013. messageSends: []
  42014. }),
  42015. $globals.AISemanticAnalyzer);
  42016. $core.addMethod(
  42017. $core.method({
  42018. selector: "context:",
  42019. protocol: 'accessing',
  42020. fn: function (anAIContext){
  42021. var self=this;
  42022. self["@context"]=anAIContext;
  42023. return self;
  42024. },
  42025. args: ["anAIContext"],
  42026. source: "context: anAIContext\x0a\x09context := anAIContext",
  42027. referencedClasses: [],
  42028. messageSends: []
  42029. }),
  42030. $globals.AISemanticAnalyzer);
  42031. $core.addMethod(
  42032. $core.method({
  42033. selector: "visitVariableNode:",
  42034. protocol: 'visiting',
  42035. fn: function (aNode){
  42036. var self=this;
  42037. return $core.withContext(function($ctx1) {
  42038. var $1;
  42039. var $early={};
  42040. try {
  42041. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  42042. return $core.withContext(function($ctx2) {
  42043. $1=(
  42044. $ctx2.supercall = true,
  42045. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  42046. $ctx2.supercall = false;
  42047. throw $early=[$1];
  42048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42049. }));
  42050. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  42051. return self;
  42052. }
  42053. catch(e) {if(e===$early)return e[0]; throw e}
  42054. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  42055. },
  42056. args: ["aNode"],
  42057. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  42058. referencedClasses: ["ASTContextVar"],
  42059. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  42060. }),
  42061. $globals.AISemanticAnalyzer);
  42062. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  42063. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  42064. $core.addMethod(
  42065. $core.method({
  42066. selector: "context",
  42067. protocol: 'accessing',
  42068. fn: function (){
  42069. var self=this;
  42070. return self["@context"];
  42071. },
  42072. args: [],
  42073. source: "context\x0a\x09^ context",
  42074. referencedClasses: [],
  42075. messageSends: []
  42076. }),
  42077. $globals.ASTContextVar);
  42078. $core.addMethod(
  42079. $core.method({
  42080. selector: "context:",
  42081. protocol: 'accessing',
  42082. fn: function (anObject){
  42083. var self=this;
  42084. self["@context"]=anObject;
  42085. return self;
  42086. },
  42087. args: ["anObject"],
  42088. source: "context: anObject\x0a\x09context := anObject",
  42089. referencedClasses: [],
  42090. messageSends: []
  42091. }),
  42092. $globals.ASTContextVar);
  42093. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  42094. $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.";
  42095. $core.addMethod(
  42096. $core.method({
  42097. selector: "atEnd",
  42098. protocol: 'testing',
  42099. fn: function (){
  42100. var self=this;
  42101. return $core.withContext(function($ctx1) {
  42102. var $1,$receiver;
  42103. $1=self._context();
  42104. $ctx1.sendIdx["context"]=1;
  42105. if(($receiver = $1) == null || $receiver.isNil){
  42106. return true;
  42107. } else {
  42108. $1;
  42109. };
  42110. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  42111. return $core.withContext(function($ctx2) {
  42112. return $recv(self._context())._isTopContext();
  42113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42114. }));
  42115. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  42116. },
  42117. args: [],
  42118. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  42119. referencedClasses: [],
  42120. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  42121. }),
  42122. $globals.ASTDebugger);
  42123. $core.addMethod(
  42124. $core.method({
  42125. selector: "context",
  42126. protocol: 'accessing',
  42127. fn: function (){
  42128. var self=this;
  42129. return self["@context"];
  42130. },
  42131. args: [],
  42132. source: "context\x0a\x09^ context",
  42133. referencedClasses: [],
  42134. messageSends: []
  42135. }),
  42136. $globals.ASTDebugger);
  42137. $core.addMethod(
  42138. $core.method({
  42139. selector: "context:",
  42140. protocol: 'accessing',
  42141. fn: function (aContext){
  42142. var self=this;
  42143. self["@context"]=aContext;
  42144. return self;
  42145. },
  42146. args: ["aContext"],
  42147. source: "context: aContext\x0a\x09context := aContext",
  42148. referencedClasses: [],
  42149. messageSends: []
  42150. }),
  42151. $globals.ASTDebugger);
  42152. $core.addMethod(
  42153. $core.method({
  42154. selector: "flushInnerContexts",
  42155. protocol: 'actions',
  42156. fn: function (){
  42157. var self=this;
  42158. return $core.withContext(function($ctx1) {
  42159. var $1,$receiver;
  42160. $1=self._context();
  42161. if(($receiver = $1) == null || $receiver.isNil){
  42162. $1;
  42163. } else {
  42164. var cxt;
  42165. cxt=$receiver;
  42166. $recv(cxt)._innerContext_(nil);
  42167. };
  42168. return self;
  42169. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  42170. },
  42171. args: [],
  42172. 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 ]",
  42173. referencedClasses: [],
  42174. messageSends: ["ifNotNil:", "context", "innerContext:"]
  42175. }),
  42176. $globals.ASTDebugger);
  42177. $core.addMethod(
  42178. $core.method({
  42179. selector: "interpreter",
  42180. protocol: 'accessing',
  42181. fn: function (){
  42182. var self=this;
  42183. return $core.withContext(function($ctx1) {
  42184. var $1,$receiver;
  42185. $1=self._context();
  42186. if(($receiver = $1) == null || $receiver.isNil){
  42187. return $1;
  42188. } else {
  42189. var ctx;
  42190. ctx=$receiver;
  42191. return $recv(ctx)._interpreter();
  42192. };
  42193. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  42194. },
  42195. args: [],
  42196. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  42197. referencedClasses: [],
  42198. messageSends: ["ifNotNil:", "context", "interpreter"]
  42199. }),
  42200. $globals.ASTDebugger);
  42201. $core.addMethod(
  42202. $core.method({
  42203. selector: "method",
  42204. protocol: 'accessing',
  42205. fn: function (){
  42206. var self=this;
  42207. return $core.withContext(function($ctx1) {
  42208. return $recv(self._context())._method();
  42209. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  42210. },
  42211. args: [],
  42212. source: "method\x0a\x09^ self context method",
  42213. referencedClasses: [],
  42214. messageSends: ["method", "context"]
  42215. }),
  42216. $globals.ASTDebugger);
  42217. $core.addMethod(
  42218. $core.method({
  42219. selector: "node",
  42220. protocol: 'accessing',
  42221. fn: function (){
  42222. var self=this;
  42223. return $core.withContext(function($ctx1) {
  42224. var $1,$receiver;
  42225. $1=self._interpreter();
  42226. $ctx1.sendIdx["interpreter"]=1;
  42227. if(($receiver = $1) == null || $receiver.isNil){
  42228. return $1;
  42229. } else {
  42230. return $recv(self._interpreter())._node();
  42231. };
  42232. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42233. },
  42234. args: [],
  42235. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42236. referencedClasses: [],
  42237. messageSends: ["ifNotNil:", "interpreter", "node"]
  42238. }),
  42239. $globals.ASTDebugger);
  42240. $core.addMethod(
  42241. $core.method({
  42242. selector: "onStep",
  42243. protocol: 'private',
  42244. fn: function (){
  42245. var self=this;
  42246. return $core.withContext(function($ctx1) {
  42247. var $1,$3,$2,$4,$6,$5,$receiver;
  42248. $1=self._interpreter();
  42249. $ctx1.sendIdx["interpreter"]=1;
  42250. self["@result"]=$recv($1)._result();
  42251. $3=self._interpreter();
  42252. $ctx1.sendIdx["interpreter"]=2;
  42253. $2=$recv($3)._atEnd();
  42254. $ctx1.sendIdx["atEnd"]=1;
  42255. if($core.assert($2)){
  42256. $4=$recv(self._context())._outerContext();
  42257. if(($receiver = $4) == null || $receiver.isNil){
  42258. $4;
  42259. } else {
  42260. var outerContext;
  42261. outerContext=$receiver;
  42262. self._context_(outerContext);
  42263. };
  42264. $6=self._interpreter();
  42265. $ctx1.sendIdx["interpreter"]=3;
  42266. $5=$recv($6)._atEnd();
  42267. if(!$core.assert($5)){
  42268. $recv(self._interpreter())._skip();
  42269. };
  42270. };
  42271. self._flushInnerContexts();
  42272. return self;
  42273. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42274. },
  42275. args: [],
  42276. 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",
  42277. referencedClasses: [],
  42278. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42279. }),
  42280. $globals.ASTDebugger);
  42281. $core.addMethod(
  42282. $core.method({
  42283. selector: "proceed",
  42284. protocol: 'stepping',
  42285. fn: function (){
  42286. var self=this;
  42287. return $core.withContext(function($ctx1) {
  42288. $recv((function(){
  42289. return $core.withContext(function($ctx2) {
  42290. return self._atEnd();
  42291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42292. }))._whileFalse_((function(){
  42293. return $core.withContext(function($ctx2) {
  42294. return self._stepOver();
  42295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42296. }));
  42297. return self;
  42298. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42299. },
  42300. args: [],
  42301. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42302. referencedClasses: [],
  42303. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42304. }),
  42305. $globals.ASTDebugger);
  42306. $core.addMethod(
  42307. $core.method({
  42308. selector: "restart",
  42309. protocol: 'stepping',
  42310. fn: function (){
  42311. var self=this;
  42312. return $core.withContext(function($ctx1) {
  42313. $recv(self._interpreter())._restart();
  42314. self._flushInnerContexts();
  42315. return self;
  42316. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42317. },
  42318. args: [],
  42319. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42320. referencedClasses: [],
  42321. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42322. }),
  42323. $globals.ASTDebugger);
  42324. $core.addMethod(
  42325. $core.method({
  42326. selector: "result",
  42327. protocol: 'accessing',
  42328. fn: function (){
  42329. var self=this;
  42330. return self["@result"];
  42331. },
  42332. args: [],
  42333. source: "result\x0a\x09^ result",
  42334. referencedClasses: [],
  42335. messageSends: []
  42336. }),
  42337. $globals.ASTDebugger);
  42338. $core.addMethod(
  42339. $core.method({
  42340. selector: "stepInto",
  42341. protocol: 'stepping',
  42342. fn: function (){
  42343. var self=this;
  42344. return $core.withContext(function($ctx1) {
  42345. self._shouldBeImplemented();
  42346. return self;
  42347. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42348. },
  42349. args: [],
  42350. source: "stepInto\x0a\x09self shouldBeImplemented",
  42351. referencedClasses: [],
  42352. messageSends: ["shouldBeImplemented"]
  42353. }),
  42354. $globals.ASTDebugger);
  42355. $core.addMethod(
  42356. $core.method({
  42357. selector: "stepOver",
  42358. protocol: 'stepping',
  42359. fn: function (){
  42360. var self=this;
  42361. return $core.withContext(function($ctx1) {
  42362. var $1,$2;
  42363. $1=$recv(self._context())._isTopContext();
  42364. if($core.assert($1)){
  42365. $recv(self._interpreter())._stepOver();
  42366. } else {
  42367. $2=self._interpreter();
  42368. $ctx1.sendIdx["interpreter"]=1;
  42369. $recv($2)._skip();
  42370. };
  42371. self._onStep();
  42372. return self;
  42373. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42374. },
  42375. args: [],
  42376. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42377. referencedClasses: [],
  42378. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42379. }),
  42380. $globals.ASTDebugger);
  42381. $core.addMethod(
  42382. $core.method({
  42383. selector: "context:",
  42384. protocol: 'instance creation',
  42385. fn: function (aContext){
  42386. var self=this;
  42387. return $core.withContext(function($ctx1) {
  42388. var $1;
  42389. $1=self._new();
  42390. $recv($1)._context_(aContext);
  42391. return $recv($1)._yourself();
  42392. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42393. },
  42394. args: ["aContext"],
  42395. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42396. referencedClasses: [],
  42397. messageSends: ["context:", "new", "yourself"]
  42398. }),
  42399. $globals.ASTDebugger.klass);
  42400. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42401. $core.addMethod(
  42402. $core.method({
  42403. selector: "interpreter",
  42404. protocol: 'accessing',
  42405. fn: function (){
  42406. var self=this;
  42407. return self["@interpreter"];
  42408. },
  42409. args: [],
  42410. source: "interpreter\x0a\x09^ interpreter",
  42411. referencedClasses: [],
  42412. messageSends: []
  42413. }),
  42414. $globals.ASTEnterNode);
  42415. $core.addMethod(
  42416. $core.method({
  42417. selector: "interpreter:",
  42418. protocol: 'accessing',
  42419. fn: function (anObject){
  42420. var self=this;
  42421. self["@interpreter"]=anObject;
  42422. return self;
  42423. },
  42424. args: ["anObject"],
  42425. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42426. referencedClasses: [],
  42427. messageSends: []
  42428. }),
  42429. $globals.ASTEnterNode);
  42430. $core.addMethod(
  42431. $core.method({
  42432. selector: "visitBlockNode:",
  42433. protocol: 'visiting',
  42434. fn: function (aNode){
  42435. var self=this;
  42436. return aNode;
  42437. },
  42438. args: ["aNode"],
  42439. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42440. referencedClasses: [],
  42441. messageSends: []
  42442. }),
  42443. $globals.ASTEnterNode);
  42444. $core.addMethod(
  42445. $core.method({
  42446. selector: "visitNode:",
  42447. protocol: 'visiting',
  42448. fn: function (aNode){
  42449. var self=this;
  42450. return $core.withContext(function($ctx1) {
  42451. var $early={};
  42452. try {
  42453. $recv($recv(aNode)._nodes())._ifEmpty_ifNotEmpty_((function(){
  42454. throw $early=[aNode];
  42455. }),(function(nodes){
  42456. return $core.withContext(function($ctx2) {
  42457. throw $early=[self._visit_($recv(nodes)._first())];
  42458. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42459. }));
  42460. return self;
  42461. }
  42462. catch(e) {if(e===$early)return e[0]; throw e}
  42463. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42464. },
  42465. args: ["aNode"],
  42466. source: "visitNode: aNode\x0a\x09aNode nodes\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42467. referencedClasses: [],
  42468. messageSends: ["ifEmpty:ifNotEmpty:", "nodes", "visit:", "first"]
  42469. }),
  42470. $globals.ASTEnterNode);
  42471. $core.addMethod(
  42472. $core.method({
  42473. selector: "visitSequenceNode:",
  42474. protocol: 'visiting',
  42475. fn: function (aNode){
  42476. var self=this;
  42477. return $core.withContext(function($ctx1) {
  42478. var $1;
  42479. $recv($recv(aNode)._temps())._do_((function(each){
  42480. return $core.withContext(function($ctx2) {
  42481. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42483. }));
  42484. $1=(
  42485. $ctx1.supercall = true,
  42486. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42487. $ctx1.supercall = false;
  42488. return $1;
  42489. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42490. },
  42491. args: ["aNode"],
  42492. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42493. referencedClasses: [],
  42494. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42495. }),
  42496. $globals.ASTEnterNode);
  42497. $core.addMethod(
  42498. $core.method({
  42499. selector: "on:",
  42500. protocol: 'instance creation',
  42501. fn: function (anInterpreter){
  42502. var self=this;
  42503. return $core.withContext(function($ctx1) {
  42504. var $1;
  42505. $1=self._new();
  42506. $recv($1)._interpreter_(anInterpreter);
  42507. return $recv($1)._yourself();
  42508. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42509. },
  42510. args: ["anInterpreter"],
  42511. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42512. referencedClasses: [],
  42513. messageSends: ["interpreter:", "new", "yourself"]
  42514. }),
  42515. $globals.ASTEnterNode.klass);
  42516. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42517. $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";
  42518. $core.addMethod(
  42519. $core.method({
  42520. selector: "assign:to:",
  42521. protocol: 'private',
  42522. fn: function (aNode,anObject){
  42523. var self=this;
  42524. return $core.withContext(function($ctx1) {
  42525. var $1,$3,$2,$4;
  42526. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42527. if($core.assert($1)){
  42528. $3=self._context();
  42529. $ctx1.sendIdx["context"]=1;
  42530. $2=$recv($3)._receiver();
  42531. $4=$recv(aNode)._value();
  42532. $ctx1.sendIdx["value"]=1;
  42533. $recv($2)._instVarAt_put_($4,anObject);
  42534. } else {
  42535. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42536. };
  42537. return self;
  42538. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42539. },
  42540. args: ["aNode", "anObject"],
  42541. 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 ]",
  42542. referencedClasses: [],
  42543. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42544. }),
  42545. $globals.ASTInterpreter);
  42546. $core.addMethod(
  42547. $core.method({
  42548. selector: "atEnd",
  42549. protocol: 'testing',
  42550. fn: function (){
  42551. var self=this;
  42552. return $core.withContext(function($ctx1) {
  42553. var $1;
  42554. $1=self["@forceAtEnd"];
  42555. if($core.assert($1)){
  42556. return true;
  42557. };
  42558. return $recv(self._hasReturned())._or_((function(){
  42559. return $core.withContext(function($ctx2) {
  42560. return $recv(self._node())._isNil();
  42561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42562. }));
  42563. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42564. },
  42565. args: [],
  42566. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42567. referencedClasses: [],
  42568. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42569. }),
  42570. $globals.ASTInterpreter);
  42571. $core.addMethod(
  42572. $core.method({
  42573. selector: "context",
  42574. protocol: 'accessing',
  42575. fn: function (){
  42576. var self=this;
  42577. return self["@context"];
  42578. },
  42579. args: [],
  42580. source: "context\x0a\x09^ context",
  42581. referencedClasses: [],
  42582. messageSends: []
  42583. }),
  42584. $globals.ASTInterpreter);
  42585. $core.addMethod(
  42586. $core.method({
  42587. selector: "context:",
  42588. protocol: 'accessing',
  42589. fn: function (aContext){
  42590. var self=this;
  42591. self["@context"]=aContext;
  42592. return self;
  42593. },
  42594. args: ["aContext"],
  42595. source: "context: aContext\x0a\x09context := aContext",
  42596. referencedClasses: [],
  42597. messageSends: []
  42598. }),
  42599. $globals.ASTInterpreter);
  42600. $core.addMethod(
  42601. $core.method({
  42602. selector: "enterNode",
  42603. protocol: 'interpreting',
  42604. fn: function (){
  42605. var self=this;
  42606. return $core.withContext(function($ctx1) {
  42607. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42608. return self;
  42609. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42610. },
  42611. args: [],
  42612. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42613. referencedClasses: ["ASTEnterNode"],
  42614. messageSends: ["node:", "visit:", "on:", "node"]
  42615. }),
  42616. $globals.ASTInterpreter);
  42617. $core.addMethod(
  42618. $core.method({
  42619. selector: "eval:",
  42620. protocol: 'private',
  42621. fn: function (aString){
  42622. var self=this;
  42623. var source,function_;
  42624. return $core.withContext(function($ctx1) {
  42625. var $3,$2,$1;
  42626. source=$recv($globals.String)._streamContents_((function(str){
  42627. return $core.withContext(function($ctx2) {
  42628. $recv(str)._nextPutAll_("0,(function(");
  42629. $ctx2.sendIdx["nextPutAll:"]=1;
  42630. $3=self._context();
  42631. $ctx2.sendIdx["context"]=1;
  42632. $2=$recv($3)._locals();
  42633. $ctx2.sendIdx["locals"]=1;
  42634. $1=$recv($2)._keys();
  42635. $recv($1)._do_separatedBy_((function(each){
  42636. return $core.withContext(function($ctx3) {
  42637. return $recv(str)._nextPutAll_(each);
  42638. $ctx3.sendIdx["nextPutAll:"]=2;
  42639. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42640. }),(function(){
  42641. return $core.withContext(function($ctx3) {
  42642. return $recv(str)._nextPutAll_(",");
  42643. $ctx3.sendIdx["nextPutAll:"]=3;
  42644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42645. }));
  42646. $recv(str)._nextPutAll_("){ return (function() {");
  42647. $ctx2.sendIdx["nextPutAll:"]=4;
  42648. $recv(str)._nextPutAll_(aString);
  42649. $ctx2.sendIdx["nextPutAll:"]=5;
  42650. return $recv(str)._nextPutAll_("})()})");
  42651. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42652. }));
  42653. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42654. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42655. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42656. },
  42657. args: ["aString"],
  42658. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  42659. referencedClasses: ["String", "Compiler"],
  42660. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42661. }),
  42662. $globals.ASTInterpreter);
  42663. $core.addMethod(
  42664. $core.method({
  42665. selector: "hasReturned",
  42666. protocol: 'testing',
  42667. fn: function (){
  42668. var self=this;
  42669. return $core.withContext(function($ctx1) {
  42670. var $1,$receiver;
  42671. $1=self["@returned"];
  42672. if(($receiver = $1) == null || $receiver.isNil){
  42673. return false;
  42674. } else {
  42675. return $1;
  42676. };
  42677. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42678. },
  42679. args: [],
  42680. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42681. referencedClasses: [],
  42682. messageSends: ["ifNil:"]
  42683. }),
  42684. $globals.ASTInterpreter);
  42685. $core.addMethod(
  42686. $core.method({
  42687. selector: "initialize",
  42688. protocol: 'initialization',
  42689. fn: function (){
  42690. var self=this;
  42691. return $core.withContext(function($ctx1) {
  42692. (
  42693. $ctx1.supercall = true,
  42694. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  42695. $ctx1.supercall = false;
  42696. self["@forceAtEnd"]=false;
  42697. return self;
  42698. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42699. },
  42700. args: [],
  42701. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42702. referencedClasses: [],
  42703. messageSends: ["initialize"]
  42704. }),
  42705. $globals.ASTInterpreter);
  42706. $core.addMethod(
  42707. $core.method({
  42708. selector: "interpret",
  42709. protocol: 'interpreting',
  42710. fn: function (){
  42711. var self=this;
  42712. return $core.withContext(function($ctx1) {
  42713. self._visit_(self._node());
  42714. return self;
  42715. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42716. },
  42717. args: [],
  42718. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42719. referencedClasses: [],
  42720. messageSends: ["visit:", "node"]
  42721. }),
  42722. $globals.ASTInterpreter);
  42723. $core.addMethod(
  42724. $core.method({
  42725. selector: "messageFromSendNode:arguments:",
  42726. protocol: 'private',
  42727. fn: function (aSendNode,aCollection){
  42728. var self=this;
  42729. return $core.withContext(function($ctx1) {
  42730. var $1;
  42731. $1=$recv($globals.Message)._new();
  42732. $recv($1)._selector_($recv(aSendNode)._selector());
  42733. $recv($1)._arguments_(aCollection);
  42734. return $recv($1)._yourself();
  42735. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42736. },
  42737. args: ["aSendNode", "aCollection"],
  42738. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42739. referencedClasses: ["Message"],
  42740. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42741. }),
  42742. $globals.ASTInterpreter);
  42743. $core.addMethod(
  42744. $core.method({
  42745. selector: "messageNotUnderstood:receiver:",
  42746. protocol: 'private',
  42747. fn: function (aMessage,anObject){
  42748. var self=this;
  42749. return $core.withContext(function($ctx1) {
  42750. var $1;
  42751. $1=$recv($globals.MessageNotUnderstood)._new();
  42752. $recv($1)._message_(aMessage);
  42753. $recv($1)._receiver_(anObject);
  42754. $recv($1)._signal();
  42755. return self;
  42756. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42757. },
  42758. args: ["aMessage", "anObject"],
  42759. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42760. referencedClasses: ["MessageNotUnderstood"],
  42761. messageSends: ["message:", "new", "receiver:", "signal"]
  42762. }),
  42763. $globals.ASTInterpreter);
  42764. $core.addMethod(
  42765. $core.method({
  42766. selector: "next",
  42767. protocol: 'interpreting',
  42768. fn: function (){
  42769. var self=this;
  42770. var nd,nextNode;
  42771. return $core.withContext(function($ctx1) {
  42772. var $1,$2,$receiver;
  42773. nd=self._node();
  42774. $1=$recv(nd)._parent();
  42775. if(($receiver = $1) == null || $receiver.isNil){
  42776. nextNode=$1;
  42777. } else {
  42778. var parent;
  42779. parent=$receiver;
  42780. $2=$recv(parent)._nextSiblingNode_(nd);
  42781. if(($receiver = $2) == null || $receiver.isNil){
  42782. nextNode=parent;
  42783. } else {
  42784. var sibling;
  42785. sibling=$receiver;
  42786. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42787. };
  42788. };
  42789. self._node_(nextNode);
  42790. return self;
  42791. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42792. },
  42793. args: [],
  42794. 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",
  42795. referencedClasses: ["ASTEnterNode"],
  42796. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42797. }),
  42798. $globals.ASTInterpreter);
  42799. $core.addMethod(
  42800. $core.method({
  42801. selector: "node",
  42802. protocol: 'accessing',
  42803. fn: function (){
  42804. var self=this;
  42805. return self["@node"];
  42806. },
  42807. args: [],
  42808. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42809. referencedClasses: [],
  42810. messageSends: []
  42811. }),
  42812. $globals.ASTInterpreter);
  42813. $core.addMethod(
  42814. $core.method({
  42815. selector: "node:",
  42816. protocol: 'accessing',
  42817. fn: function (aNode){
  42818. var self=this;
  42819. self["@node"]=aNode;
  42820. return self;
  42821. },
  42822. args: ["aNode"],
  42823. source: "node: aNode\x0a\x09node := aNode",
  42824. referencedClasses: [],
  42825. messageSends: []
  42826. }),
  42827. $globals.ASTInterpreter);
  42828. $core.addMethod(
  42829. $core.method({
  42830. selector: "peek",
  42831. protocol: 'stack',
  42832. fn: function (){
  42833. var self=this;
  42834. return $core.withContext(function($ctx1) {
  42835. var $1;
  42836. var $early={};
  42837. try {
  42838. $1=self._stack();
  42839. $ctx1.sendIdx["stack"]=1;
  42840. $recv($1)._ifEmpty_((function(){
  42841. throw $early=[nil];
  42842. }));
  42843. return $recv(self._stack())._last();
  42844. }
  42845. catch(e) {if(e===$early)return e[0]; throw e}
  42846. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42847. },
  42848. args: [],
  42849. 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",
  42850. referencedClasses: [],
  42851. messageSends: ["ifEmpty:", "stack", "last"]
  42852. }),
  42853. $globals.ASTInterpreter);
  42854. $core.addMethod(
  42855. $core.method({
  42856. selector: "pop",
  42857. protocol: 'stack',
  42858. fn: function (){
  42859. var self=this;
  42860. var peekedValue;
  42861. return $core.withContext(function($ctx1) {
  42862. peekedValue=self._peek();
  42863. $recv(self._stack())._removeLast();
  42864. return peekedValue;
  42865. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42866. },
  42867. args: [],
  42868. 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",
  42869. referencedClasses: [],
  42870. messageSends: ["peek", "removeLast", "stack"]
  42871. }),
  42872. $globals.ASTInterpreter);
  42873. $core.addMethod(
  42874. $core.method({
  42875. selector: "proceed",
  42876. protocol: 'interpreting',
  42877. fn: function (){
  42878. var self=this;
  42879. return $core.withContext(function($ctx1) {
  42880. $recv((function(){
  42881. return $core.withContext(function($ctx2) {
  42882. return self._atEnd();
  42883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42884. }))._whileFalse_((function(){
  42885. return $core.withContext(function($ctx2) {
  42886. return self._step();
  42887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42888. }));
  42889. return self;
  42890. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42891. },
  42892. args: [],
  42893. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42894. referencedClasses: [],
  42895. messageSends: ["whileFalse:", "atEnd", "step"]
  42896. }),
  42897. $globals.ASTInterpreter);
  42898. $core.addMethod(
  42899. $core.method({
  42900. selector: "push:",
  42901. protocol: 'stack',
  42902. fn: function (anObject){
  42903. var self=this;
  42904. return $core.withContext(function($ctx1) {
  42905. return $recv(self._stack())._add_(anObject);
  42906. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42907. },
  42908. args: ["anObject"],
  42909. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42910. referencedClasses: [],
  42911. messageSends: ["add:", "stack"]
  42912. }),
  42913. $globals.ASTInterpreter);
  42914. $core.addMethod(
  42915. $core.method({
  42916. selector: "restart",
  42917. protocol: 'interpreting',
  42918. fn: function (){
  42919. var self=this;
  42920. return $core.withContext(function($ctx1) {
  42921. self._node_($recv(self._context())._ast());
  42922. self._enterNode();
  42923. return self;
  42924. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42925. },
  42926. args: [],
  42927. source: "restart\x0a\x09self node: self context ast; enterNode",
  42928. referencedClasses: [],
  42929. messageSends: ["node:", "ast", "context", "enterNode"]
  42930. }),
  42931. $globals.ASTInterpreter);
  42932. $core.addMethod(
  42933. $core.method({
  42934. selector: "result",
  42935. protocol: 'accessing',
  42936. fn: function (){
  42937. var self=this;
  42938. return $core.withContext(function($ctx1) {
  42939. var $1;
  42940. $1=self._hasReturned();
  42941. if($core.assert($1)){
  42942. return self._returnValue();
  42943. } else {
  42944. return $recv(self._context())._receiver();
  42945. };
  42946. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42947. },
  42948. args: [],
  42949. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42950. referencedClasses: [],
  42951. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42952. }),
  42953. $globals.ASTInterpreter);
  42954. $core.addMethod(
  42955. $core.method({
  42956. selector: "returnValue",
  42957. protocol: 'accessing',
  42958. fn: function (){
  42959. var self=this;
  42960. return self["@returnValue"];
  42961. },
  42962. args: [],
  42963. source: "returnValue\x0a\x09^ returnValue",
  42964. referencedClasses: [],
  42965. messageSends: []
  42966. }),
  42967. $globals.ASTInterpreter);
  42968. $core.addMethod(
  42969. $core.method({
  42970. selector: "returnValue:",
  42971. protocol: 'accessing',
  42972. fn: function (anObject){
  42973. var self=this;
  42974. self["@returnValue"]=anObject;
  42975. return self;
  42976. },
  42977. args: ["anObject"],
  42978. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42979. referencedClasses: [],
  42980. messageSends: []
  42981. }),
  42982. $globals.ASTInterpreter);
  42983. $core.addMethod(
  42984. $core.method({
  42985. selector: "sendMessage:to:superSend:",
  42986. protocol: 'private',
  42987. fn: function (aMessage,anObject,aBoolean){
  42988. var self=this;
  42989. var method;
  42990. return $core.withContext(function($ctx1) {
  42991. var $2,$1,$3,$receiver;
  42992. var $early={};
  42993. try {
  42994. if(!$core.assert(aBoolean)){
  42995. return $recv(aMessage)._sendTo_(anObject);
  42996. };
  42997. $2=$recv(anObject)._class();
  42998. $ctx1.sendIdx["class"]=1;
  42999. $1=$recv($2)._superclass();
  43000. $ctx1.sendIdx["superclass"]=1;
  43001. if(($receiver = $1) == null || $receiver.isNil){
  43002. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  43003. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  43004. return $3;
  43005. } else {
  43006. $1;
  43007. };
  43008. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  43009. return $core.withContext(function($ctx2) {
  43010. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  43011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43012. }));
  43013. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  43014. }
  43015. catch(e) {if(e===$early)return e[0]; throw e}
  43016. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  43017. },
  43018. args: ["aMessage", "anObject", "aBoolean"],
  43019. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  43020. referencedClasses: [],
  43021. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  43022. }),
  43023. $globals.ASTInterpreter);
  43024. $core.addMethod(
  43025. $core.method({
  43026. selector: "setNonLocalReturnFromContext:",
  43027. protocol: 'interpreting',
  43028. fn: function (aContext){
  43029. var self=this;
  43030. return $core.withContext(function($ctx1) {
  43031. var $2,$1;
  43032. $2=$recv(aContext)._interpreter();
  43033. $ctx1.sendIdx["interpreter"]=1;
  43034. $1=$recv($2)._hasReturned();
  43035. if($core.assert($1)){
  43036. self["@returned"]=true;
  43037. self["@returned"];
  43038. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  43039. };
  43040. return self;
  43041. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  43042. },
  43043. args: ["aContext"],
  43044. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  43045. referencedClasses: [],
  43046. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  43047. }),
  43048. $globals.ASTInterpreter);
  43049. $core.addMethod(
  43050. $core.method({
  43051. selector: "skip",
  43052. protocol: 'interpreting',
  43053. fn: function (){
  43054. var self=this;
  43055. return $core.withContext(function($ctx1) {
  43056. self._next();
  43057. return self;
  43058. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  43059. },
  43060. args: [],
  43061. source: "skip\x0a\x09self next",
  43062. referencedClasses: [],
  43063. messageSends: ["next"]
  43064. }),
  43065. $globals.ASTInterpreter);
  43066. $core.addMethod(
  43067. $core.method({
  43068. selector: "stack",
  43069. protocol: 'accessing',
  43070. fn: function (){
  43071. var self=this;
  43072. return $core.withContext(function($ctx1) {
  43073. var $1,$receiver;
  43074. $1=self["@stack"];
  43075. if(($receiver = $1) == null || $receiver.isNil){
  43076. self["@stack"]=$recv($globals.OrderedCollection)._new();
  43077. return self["@stack"];
  43078. } else {
  43079. return $1;
  43080. };
  43081. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  43082. },
  43083. args: [],
  43084. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  43085. referencedClasses: ["OrderedCollection"],
  43086. messageSends: ["ifNil:", "new"]
  43087. }),
  43088. $globals.ASTInterpreter);
  43089. $core.addMethod(
  43090. $core.method({
  43091. selector: "step",
  43092. protocol: 'interpreting',
  43093. fn: function (){
  43094. var self=this;
  43095. return $core.withContext(function($ctx1) {
  43096. self._interpret();
  43097. self._next();
  43098. return self;
  43099. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  43100. },
  43101. args: [],
  43102. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  43103. referencedClasses: [],
  43104. messageSends: ["interpret", "next"]
  43105. }),
  43106. $globals.ASTInterpreter);
  43107. $core.addMethod(
  43108. $core.method({
  43109. selector: "stepOver",
  43110. protocol: 'interpreting',
  43111. fn: function (){
  43112. var self=this;
  43113. return $core.withContext(function($ctx1) {
  43114. var $2,$1;
  43115. self._step();
  43116. $ctx1.sendIdx["step"]=1;
  43117. $recv((function(){
  43118. return $core.withContext(function($ctx2) {
  43119. $2=self._node();
  43120. $ctx2.sendIdx["node"]=1;
  43121. $1=$recv($2)._isNil();
  43122. return $recv($1)._or_((function(){
  43123. return $core.withContext(function($ctx3) {
  43124. return $recv(self._node())._isSteppingNode();
  43125. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43126. }));
  43127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43128. }))._whileFalse_((function(){
  43129. return $core.withContext(function($ctx2) {
  43130. return self._step();
  43131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43132. }));
  43133. return self;
  43134. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  43135. },
  43136. args: [],
  43137. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  43138. referencedClasses: [],
  43139. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  43140. }),
  43141. $globals.ASTInterpreter);
  43142. $core.addMethod(
  43143. $core.method({
  43144. selector: "visit:",
  43145. protocol: 'visiting',
  43146. fn: function (aNode){
  43147. var self=this;
  43148. return $core.withContext(function($ctx1) {
  43149. var $1;
  43150. $1=self._hasReturned();
  43151. if(!$core.assert($1)){
  43152. (
  43153. $ctx1.supercall = true,
  43154. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  43155. $ctx1.supercall = false;
  43156. };
  43157. return self;
  43158. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  43159. },
  43160. args: ["aNode"],
  43161. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  43162. referencedClasses: [],
  43163. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  43164. }),
  43165. $globals.ASTInterpreter);
  43166. $core.addMethod(
  43167. $core.method({
  43168. selector: "visitAssignmentNode:",
  43169. protocol: 'visiting',
  43170. fn: function (aNode){
  43171. var self=this;
  43172. var poppedValue;
  43173. return $core.withContext(function($ctx1) {
  43174. poppedValue=self._pop();
  43175. $ctx1.sendIdx["pop"]=1;
  43176. self._pop();
  43177. self._push_(poppedValue);
  43178. self._assign_to_($recv(aNode)._left(),poppedValue);
  43179. return self;
  43180. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  43181. },
  43182. args: ["aNode"],
  43183. 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",
  43184. referencedClasses: [],
  43185. messageSends: ["pop", "push:", "assign:to:", "left"]
  43186. }),
  43187. $globals.ASTInterpreter);
  43188. $core.addMethod(
  43189. $core.method({
  43190. selector: "visitBlockNode:",
  43191. protocol: 'visiting',
  43192. fn: function (aNode){
  43193. var self=this;
  43194. var block;
  43195. return $core.withContext(function($ctx1) {
  43196. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  43197. self._push_(block);
  43198. return self;
  43199. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  43200. },
  43201. args: ["aNode"],
  43202. 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",
  43203. referencedClasses: ["AIBlockClosure"],
  43204. messageSends: ["forContext:node:", "context", "push:"]
  43205. }),
  43206. $globals.ASTInterpreter);
  43207. $core.addMethod(
  43208. $core.method({
  43209. selector: "visitBlockSequenceNode:",
  43210. protocol: 'visiting',
  43211. fn: function (aNode){
  43212. var self=this;
  43213. return $core.withContext(function($ctx1) {
  43214. (
  43215. $ctx1.supercall = true,
  43216. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43217. $ctx1.supercall = false;
  43218. self["@forceAtEnd"]=true;
  43219. return self;
  43220. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43221. },
  43222. args: ["aNode"],
  43223. 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",
  43224. referencedClasses: [],
  43225. messageSends: ["visitBlockSequenceNode:"]
  43226. }),
  43227. $globals.ASTInterpreter);
  43228. $core.addMethod(
  43229. $core.method({
  43230. selector: "visitDynamicArrayNode:",
  43231. protocol: 'visiting',
  43232. fn: function (aNode){
  43233. var self=this;
  43234. var array;
  43235. return $core.withContext(function($ctx1) {
  43236. array=[];
  43237. $recv($recv(aNode)._nodes())._do_((function(each){
  43238. return $core.withContext(function($ctx2) {
  43239. return $recv(array)._addFirst_(self._pop());
  43240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43241. }));
  43242. self._push_(array);
  43243. return self;
  43244. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43245. },
  43246. args: ["aNode"],
  43247. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  43248. referencedClasses: [],
  43249. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  43250. }),
  43251. $globals.ASTInterpreter);
  43252. $core.addMethod(
  43253. $core.method({
  43254. selector: "visitDynamicDictionaryNode:",
  43255. protocol: 'visiting',
  43256. fn: function (aNode){
  43257. var self=this;
  43258. var keyValueList;
  43259. return $core.withContext(function($ctx1) {
  43260. keyValueList=$recv($globals.OrderedCollection)._new();
  43261. $recv($recv(aNode)._nodes())._do_((function(each){
  43262. return $core.withContext(function($ctx2) {
  43263. return $recv(keyValueList)._add_(self._pop());
  43264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43265. }));
  43266. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43267. return self;
  43268. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43269. },
  43270. args: ["aNode"],
  43271. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  43272. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43273. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43274. }),
  43275. $globals.ASTInterpreter);
  43276. $core.addMethod(
  43277. $core.method({
  43278. selector: "visitJSStatementNode:",
  43279. protocol: 'visiting',
  43280. fn: function (aNode){
  43281. var self=this;
  43282. return $core.withContext(function($ctx1) {
  43283. self["@returned"]=true;
  43284. self._returnValue_(self._eval_($recv(aNode)._source()));
  43285. return self;
  43286. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43287. },
  43288. args: ["aNode"],
  43289. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43290. referencedClasses: [],
  43291. messageSends: ["returnValue:", "eval:", "source"]
  43292. }),
  43293. $globals.ASTInterpreter);
  43294. $core.addMethod(
  43295. $core.method({
  43296. selector: "visitNode:",
  43297. protocol: 'visiting',
  43298. fn: function (aNode){
  43299. var self=this;
  43300. return self;
  43301. },
  43302. args: ["aNode"],
  43303. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43304. referencedClasses: [],
  43305. messageSends: []
  43306. }),
  43307. $globals.ASTInterpreter);
  43308. $core.addMethod(
  43309. $core.method({
  43310. selector: "visitReturnNode:",
  43311. protocol: 'visiting',
  43312. fn: function (aNode){
  43313. var self=this;
  43314. return $core.withContext(function($ctx1) {
  43315. self["@returned"]=true;
  43316. self._returnValue_(self._pop());
  43317. return self;
  43318. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43319. },
  43320. args: ["aNode"],
  43321. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43322. referencedClasses: [],
  43323. messageSends: ["returnValue:", "pop"]
  43324. }),
  43325. $globals.ASTInterpreter);
  43326. $core.addMethod(
  43327. $core.method({
  43328. selector: "visitSendNode:",
  43329. protocol: 'visiting',
  43330. fn: function (aNode){
  43331. var self=this;
  43332. var receiver,args,message,result;
  43333. return $core.withContext(function($ctx1) {
  43334. var $1;
  43335. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43336. return $core.withContext(function($ctx2) {
  43337. return self._pop();
  43338. $ctx2.sendIdx["pop"]=1;
  43339. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43340. }));
  43341. receiver=self._peek();
  43342. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43343. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43344. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43345. return $core.withContext(function($ctx2) {
  43346. return $recv($recv(aNode)._isLastChild())._not();
  43347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43348. }));
  43349. if(!$core.assert($1)){
  43350. self._pop();
  43351. self._push_(result);
  43352. };
  43353. return self;
  43354. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43355. },
  43356. args: ["aNode"],
  43357. 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 ]",
  43358. referencedClasses: [],
  43359. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43360. }),
  43361. $globals.ASTInterpreter);
  43362. $core.addMethod(
  43363. $core.method({
  43364. selector: "visitValueNode:",
  43365. protocol: 'visiting',
  43366. fn: function (aNode){
  43367. var self=this;
  43368. return $core.withContext(function($ctx1) {
  43369. self._push_($recv(aNode)._value());
  43370. return self;
  43371. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43372. },
  43373. args: ["aNode"],
  43374. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43375. referencedClasses: [],
  43376. messageSends: ["push:", "value"]
  43377. }),
  43378. $globals.ASTInterpreter);
  43379. $core.addMethod(
  43380. $core.method({
  43381. selector: "visitVariableNode:",
  43382. protocol: 'visiting',
  43383. fn: function (aNode){
  43384. var self=this;
  43385. return $core.withContext(function($ctx1) {
  43386. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43387. $2=$recv(aNode)._binding();
  43388. $ctx1.sendIdx["binding"]=1;
  43389. $1=$recv($2)._isUnknownVar();
  43390. if($core.assert($1)){
  43391. $5=$recv($globals.Platform)._globals();
  43392. $ctx1.sendIdx["globals"]=1;
  43393. $6=$recv(aNode)._value();
  43394. $ctx1.sendIdx["value"]=1;
  43395. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43396. return $core.withContext(function($ctx2) {
  43397. return self._error_("Unknown variable");
  43398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43399. }));
  43400. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43401. $3=self._push_($4);
  43402. $ctx1.sendIdx["push:"]=1;
  43403. return $3;
  43404. };
  43405. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43406. if($core.assert($8)){
  43407. $10=self._context();
  43408. $ctx1.sendIdx["context"]=1;
  43409. $9=$recv($10)._receiver();
  43410. $11=$recv(aNode)._value();
  43411. $ctx1.sendIdx["value"]=2;
  43412. $7=$recv($9)._instVarAt_($11);
  43413. } else {
  43414. $12=self._context();
  43415. $13=$recv(aNode)._value();
  43416. $ctx1.sendIdx["value"]=3;
  43417. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43418. return $core.withContext(function($ctx2) {
  43419. $15=$recv(aNode)._value();
  43420. $ctx2.sendIdx["value"]=4;
  43421. $14=$recv($15)._isCapitalized();
  43422. if($core.assert($14)){
  43423. $16=$recv($globals.Smalltalk)._globals();
  43424. $ctx2.sendIdx["globals"]=2;
  43425. $17=$recv(aNode)._value();
  43426. $ctx2.sendIdx["value"]=5;
  43427. return $recv($16)._at_ifAbsent_($17,(function(){
  43428. return $core.withContext(function($ctx3) {
  43429. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43430. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43431. }));
  43432. };
  43433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43434. }));
  43435. };
  43436. self._push_($7);
  43437. return self;
  43438. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43439. },
  43440. args: ["aNode"],
  43441. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  43442. referencedClasses: ["Platform", "Smalltalk"],
  43443. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43444. }),
  43445. $globals.ASTInterpreter);
  43446. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43447. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43448. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43449. $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`";
  43450. $core.addMethod(
  43451. $core.method({
  43452. selector: "context",
  43453. protocol: 'accessing',
  43454. fn: function (){
  43455. var self=this;
  43456. return self["@context"];
  43457. },
  43458. args: [],
  43459. source: "context\x0a\x09^ context",
  43460. referencedClasses: [],
  43461. messageSends: []
  43462. }),
  43463. $globals.ASTPCNodeVisitor);
  43464. $core.addMethod(
  43465. $core.method({
  43466. selector: "context:",
  43467. protocol: 'accessing',
  43468. fn: function (aContext){
  43469. var self=this;
  43470. self["@context"]=aContext;
  43471. return self;
  43472. },
  43473. args: ["aContext"],
  43474. source: "context: aContext\x0a\x09context := aContext",
  43475. referencedClasses: [],
  43476. messageSends: []
  43477. }),
  43478. $globals.ASTPCNodeVisitor);
  43479. $core.addMethod(
  43480. $core.method({
  43481. selector: "currentNode",
  43482. protocol: 'accessing',
  43483. fn: function (){
  43484. var self=this;
  43485. return self["@currentNode"];
  43486. },
  43487. args: [],
  43488. source: "currentNode\x0a\x09^ currentNode",
  43489. referencedClasses: [],
  43490. messageSends: []
  43491. }),
  43492. $globals.ASTPCNodeVisitor);
  43493. $core.addMethod(
  43494. $core.method({
  43495. selector: "increaseIndex",
  43496. protocol: 'accessing',
  43497. fn: function (){
  43498. var self=this;
  43499. return $core.withContext(function($ctx1) {
  43500. self["@index"]=$recv(self._index()).__plus((1));
  43501. return self;
  43502. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  43503. },
  43504. args: [],
  43505. source: "increaseIndex\x0a\x09index := self index + 1",
  43506. referencedClasses: [],
  43507. messageSends: ["+", "index"]
  43508. }),
  43509. $globals.ASTPCNodeVisitor);
  43510. $core.addMethod(
  43511. $core.method({
  43512. selector: "index",
  43513. protocol: 'accessing',
  43514. fn: function (){
  43515. var self=this;
  43516. return $core.withContext(function($ctx1) {
  43517. var $1,$receiver;
  43518. $1=self["@index"];
  43519. if(($receiver = $1) == null || $receiver.isNil){
  43520. self["@index"]=(0);
  43521. return self["@index"];
  43522. } else {
  43523. return $1;
  43524. };
  43525. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  43526. },
  43527. args: [],
  43528. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  43529. referencedClasses: [],
  43530. messageSends: ["ifNil:"]
  43531. }),
  43532. $globals.ASTPCNodeVisitor);
  43533. $core.addMethod(
  43534. $core.method({
  43535. selector: "selector",
  43536. protocol: 'accessing',
  43537. fn: function (){
  43538. var self=this;
  43539. return self["@selector"];
  43540. },
  43541. args: [],
  43542. source: "selector\x0a\x09^ selector",
  43543. referencedClasses: [],
  43544. messageSends: []
  43545. }),
  43546. $globals.ASTPCNodeVisitor);
  43547. $core.addMethod(
  43548. $core.method({
  43549. selector: "selector:",
  43550. protocol: 'accessing',
  43551. fn: function (aString){
  43552. var self=this;
  43553. self["@selector"]=aString;
  43554. return self;
  43555. },
  43556. args: ["aString"],
  43557. source: "selector: aString\x0a\x09selector := aString",
  43558. referencedClasses: [],
  43559. messageSends: []
  43560. }),
  43561. $globals.ASTPCNodeVisitor);
  43562. $core.addMethod(
  43563. $core.method({
  43564. selector: "visitJSStatementNode:",
  43565. protocol: 'visiting',
  43566. fn: function (aNode){
  43567. var self=this;
  43568. self["@currentNode"]=aNode;
  43569. return self;
  43570. },
  43571. args: ["aNode"],
  43572. 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",
  43573. referencedClasses: [],
  43574. messageSends: []
  43575. }),
  43576. $globals.ASTPCNodeVisitor);
  43577. $core.addMethod(
  43578. $core.method({
  43579. selector: "visitSendNode:",
  43580. protocol: 'visiting',
  43581. fn: function (aNode){
  43582. var self=this;
  43583. var sendIndex;
  43584. return $core.withContext(function($ctx1) {
  43585. var $1,$2,$4,$3,$5;
  43586. $1=self._context();
  43587. $2=self._selector();
  43588. $ctx1.sendIdx["selector"]=1;
  43589. sendIndex=$recv($1)._sendIndexAt_($2);
  43590. (
  43591. $ctx1.supercall = true,
  43592. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43593. $ctx1.supercall = false;
  43594. $4=self._selector();
  43595. $ctx1.sendIdx["selector"]=2;
  43596. $3=$recv($4).__eq($recv(aNode)._selector());
  43597. $ctx1.sendIdx["="]=1;
  43598. if($core.assert($3)){
  43599. $5=$recv(self._index()).__eq(sendIndex);
  43600. if($core.assert($5)){
  43601. self["@currentNode"]=aNode;
  43602. self["@currentNode"];
  43603. };
  43604. self._increaseIndex();
  43605. };
  43606. return self;
  43607. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  43608. },
  43609. args: ["aNode"],
  43610. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  43611. referencedClasses: [],
  43612. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  43613. }),
  43614. $globals.ASTPCNodeVisitor);
  43615. $core.addMethod(
  43616. $core.method({
  43617. selector: "isSteppingNode",
  43618. protocol: '*Compiler-Interpreter',
  43619. fn: function (){
  43620. var self=this;
  43621. return true;
  43622. },
  43623. args: [],
  43624. source: "isSteppingNode\x0a\x09^ true",
  43625. referencedClasses: [],
  43626. messageSends: []
  43627. }),
  43628. $globals.AssignmentNode);
  43629. $core.addMethod(
  43630. $core.method({
  43631. selector: "isSteppingNode",
  43632. protocol: '*Compiler-Interpreter',
  43633. fn: function (){
  43634. var self=this;
  43635. return true;
  43636. },
  43637. args: [],
  43638. source: "isSteppingNode\x0a\x09^ true",
  43639. referencedClasses: [],
  43640. messageSends: []
  43641. }),
  43642. $globals.BlockNode);
  43643. $core.addMethod(
  43644. $core.method({
  43645. selector: "nextSiblingNode:",
  43646. protocol: '*Compiler-Interpreter',
  43647. fn: function (aNode){
  43648. var self=this;
  43649. return nil;
  43650. },
  43651. args: ["aNode"],
  43652. 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",
  43653. referencedClasses: [],
  43654. messageSends: []
  43655. }),
  43656. $globals.BlockNode);
  43657. $core.addMethod(
  43658. $core.method({
  43659. selector: "isSteppingNode",
  43660. protocol: '*Compiler-Interpreter',
  43661. fn: function (){
  43662. var self=this;
  43663. return true;
  43664. },
  43665. args: [],
  43666. source: "isSteppingNode\x0a\x09^ true",
  43667. referencedClasses: [],
  43668. messageSends: []
  43669. }),
  43670. $globals.DynamicArrayNode);
  43671. $core.addMethod(
  43672. $core.method({
  43673. selector: "isSteppingNode",
  43674. protocol: '*Compiler-Interpreter',
  43675. fn: function (){
  43676. var self=this;
  43677. return true;
  43678. },
  43679. args: [],
  43680. source: "isSteppingNode\x0a\x09^ true",
  43681. referencedClasses: [],
  43682. messageSends: []
  43683. }),
  43684. $globals.DynamicDictionaryNode);
  43685. $core.addMethod(
  43686. $core.method({
  43687. selector: "isSteppingNode",
  43688. protocol: '*Compiler-Interpreter',
  43689. fn: function (){
  43690. var self=this;
  43691. return true;
  43692. },
  43693. args: [],
  43694. source: "isSteppingNode\x0a\x09^ true",
  43695. referencedClasses: [],
  43696. messageSends: []
  43697. }),
  43698. $globals.JSStatementNode);
  43699. $core.addMethod(
  43700. $core.method({
  43701. selector: "isSteppingNode",
  43702. protocol: '*Compiler-Interpreter',
  43703. fn: function (){
  43704. var self=this;
  43705. return false;
  43706. },
  43707. args: [],
  43708. source: "isSteppingNode\x0a\x09^ false",
  43709. referencedClasses: [],
  43710. messageSends: []
  43711. }),
  43712. $globals.Node);
  43713. $core.addMethod(
  43714. $core.method({
  43715. selector: "nextSiblingNode:",
  43716. protocol: '*Compiler-Interpreter',
  43717. fn: function (aNode){
  43718. var self=this;
  43719. return $core.withContext(function($ctx1) {
  43720. var $1;
  43721. var $early={};
  43722. try {
  43723. $1=self._nodes();
  43724. $ctx1.sendIdx["nodes"]=1;
  43725. return $recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  43726. throw $early=[nil];
  43727. }));
  43728. }
  43729. catch(e) {if(e===$early)return e[0]; throw e}
  43730. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.Node)});
  43731. },
  43732. args: ["aNode"],
  43733. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  43734. referencedClasses: [],
  43735. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:"]
  43736. }),
  43737. $globals.Node);
  43738. $core.addMethod(
  43739. $core.method({
  43740. selector: "isSteppingNode",
  43741. protocol: '*Compiler-Interpreter',
  43742. fn: function (){
  43743. var self=this;
  43744. return true;
  43745. },
  43746. args: [],
  43747. source: "isSteppingNode\x0a\x09^ true",
  43748. referencedClasses: [],
  43749. messageSends: []
  43750. }),
  43751. $globals.SendNode);
  43752. });
  43753. define('amber/lang',[
  43754. './deploy',
  43755. './compatibility', // pre-fetch, dep of ./boot
  43756. './boot', // pre-fetch, dep of ./helpers
  43757. './helpers', // pre-fetch, dep of ./deploy
  43758. './parser',
  43759. // --- packages for the Amber reflection begin here ---
  43760. 'amber_core/Platform-ImportExport',
  43761. 'amber_core/Compiler-Core',
  43762. 'amber_core/Compiler-AST',
  43763. 'amber_core/Compiler-Semantic',
  43764. 'amber_core/Compiler-IR',
  43765. 'amber_core/Compiler-Inlining',
  43766. 'amber_core/Compiler-Interpreter'
  43767. // --- packages for the Amber reflection end here ---
  43768. ], function (amber) { return amber; });
  43769. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  43770. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  43771. $core.addPackage('SUnit');
  43772. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43773. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43774. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43775. $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.";
  43776. $core.addMethod(
  43777. $core.method({
  43778. selector: "result",
  43779. protocol: 'accessing',
  43780. fn: function (){
  43781. var self=this;
  43782. return self["@result"];
  43783. },
  43784. args: [],
  43785. source: "result\x0a\x09^ result",
  43786. referencedClasses: [],
  43787. messageSends: []
  43788. }),
  43789. $globals.ResultAnnouncement);
  43790. $core.addMethod(
  43791. $core.method({
  43792. selector: "result:",
  43793. protocol: 'accessing',
  43794. fn: function (aTestResult){
  43795. var self=this;
  43796. self["@result"]=aTestResult;
  43797. return self;
  43798. },
  43799. args: ["aTestResult"],
  43800. source: "result: aTestResult\x0a\x09result := aTestResult",
  43801. referencedClasses: [],
  43802. messageSends: []
  43803. }),
  43804. $globals.ResultAnnouncement);
  43805. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43806. $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.";
  43807. $core.addMethod(
  43808. $core.method({
  43809. selector: "assert:",
  43810. protocol: 'testing',
  43811. fn: function (aBoolean){
  43812. var self=this;
  43813. return $core.withContext(function($ctx1) {
  43814. self._assert_description_(aBoolean,"Assertion failed");
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43817. },
  43818. args: ["aBoolean"],
  43819. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43820. referencedClasses: [],
  43821. messageSends: ["assert:description:"]
  43822. }),
  43823. $globals.TestCase);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "assert:description:",
  43827. protocol: 'testing',
  43828. fn: function (aBoolean,aString){
  43829. var self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. if(!$core.assert(aBoolean)){
  43832. self._signalFailure_(aString);
  43833. };
  43834. return self;
  43835. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43836. },
  43837. args: ["aBoolean", "aString"],
  43838. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43839. referencedClasses: [],
  43840. messageSends: ["ifFalse:", "signalFailure:"]
  43841. }),
  43842. $globals.TestCase);
  43843. $core.addMethod(
  43844. $core.method({
  43845. selector: "assert:equals:",
  43846. protocol: 'testing',
  43847. fn: function (actual,expected){
  43848. var self=this;
  43849. return $core.withContext(function($ctx1) {
  43850. var $1,$5,$4,$3,$2;
  43851. $1=$recv(actual).__eq(expected);
  43852. $5=$recv(expected)._printString();
  43853. $ctx1.sendIdx["printString"]=1;
  43854. $4="Expected: ".__comma($5);
  43855. $3=$recv($4).__comma(" but was: ");
  43856. $ctx1.sendIdx[","]=2;
  43857. $2=$recv($3).__comma($recv(actual)._printString());
  43858. $ctx1.sendIdx[","]=1;
  43859. return self._assert_description_($1,$2);
  43860. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43861. },
  43862. args: ["actual", "expected"],
  43863. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43864. referencedClasses: [],
  43865. messageSends: ["assert:description:", "=", ",", "printString"]
  43866. }),
  43867. $globals.TestCase);
  43868. $core.addMethod(
  43869. $core.method({
  43870. selector: "async:",
  43871. protocol: 'async',
  43872. fn: function (aBlock){
  43873. var self=this;
  43874. var c;
  43875. return $core.withContext(function($ctx1) {
  43876. var $1;
  43877. self._errorIfNotAsync_("#async");
  43878. c=self["@context"];
  43879. return (function(){
  43880. return $core.withContext(function($ctx2) {
  43881. $1=self._isAsync();
  43882. if($core.assert($1)){
  43883. return $recv(c)._execute_(aBlock);
  43884. };
  43885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43886. });
  43887. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43888. },
  43889. args: ["aBlock"],
  43890. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43891. referencedClasses: [],
  43892. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43893. }),
  43894. $globals.TestCase);
  43895. $core.addMethod(
  43896. $core.method({
  43897. selector: "context:",
  43898. protocol: 'accessing',
  43899. fn: function (aRunningTestContext){
  43900. var self=this;
  43901. self["@context"]=aRunningTestContext;
  43902. return self;
  43903. },
  43904. args: ["aRunningTestContext"],
  43905. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43906. referencedClasses: [],
  43907. messageSends: []
  43908. }),
  43909. $globals.TestCase);
  43910. $core.addMethod(
  43911. $core.method({
  43912. selector: "deny:",
  43913. protocol: 'testing',
  43914. fn: function (aBoolean){
  43915. var self=this;
  43916. return $core.withContext(function($ctx1) {
  43917. self._assert_($recv(aBoolean)._not());
  43918. return self;
  43919. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43920. },
  43921. args: ["aBoolean"],
  43922. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43923. referencedClasses: [],
  43924. messageSends: ["assert:", "not"]
  43925. }),
  43926. $globals.TestCase);
  43927. $core.addMethod(
  43928. $core.method({
  43929. selector: "errorIfNotAsync:",
  43930. protocol: 'error handling',
  43931. fn: function (aString){
  43932. var self=this;
  43933. return $core.withContext(function($ctx1) {
  43934. var $1;
  43935. $1=self._isAsync();
  43936. if(!$core.assert($1)){
  43937. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43938. };
  43939. return self;
  43940. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43941. },
  43942. args: ["aString"],
  43943. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43944. referencedClasses: [],
  43945. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43946. }),
  43947. $globals.TestCase);
  43948. $core.addMethod(
  43949. $core.method({
  43950. selector: "finished",
  43951. protocol: 'async',
  43952. fn: function (){
  43953. var self=this;
  43954. return $core.withContext(function($ctx1) {
  43955. self._errorIfNotAsync_("#finished");
  43956. self["@asyncTimeout"]=nil;
  43957. return self;
  43958. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43959. },
  43960. args: [],
  43961. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43962. referencedClasses: [],
  43963. messageSends: ["errorIfNotAsync:"]
  43964. }),
  43965. $globals.TestCase);
  43966. $core.addMethod(
  43967. $core.method({
  43968. selector: "isAsync",
  43969. protocol: 'testing',
  43970. fn: function (){
  43971. var self=this;
  43972. return $core.withContext(function($ctx1) {
  43973. return $recv(self["@asyncTimeout"])._notNil();
  43974. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43975. },
  43976. args: [],
  43977. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43978. referencedClasses: [],
  43979. messageSends: ["notNil"]
  43980. }),
  43981. $globals.TestCase);
  43982. $core.addMethod(
  43983. $core.method({
  43984. selector: "performTest",
  43985. protocol: 'running',
  43986. fn: function (){
  43987. var self=this;
  43988. return $core.withContext(function($ctx1) {
  43989. self["@asyncTimeout"]=nil;
  43990. self._perform_(self._selector());
  43991. return self;
  43992. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43993. },
  43994. args: [],
  43995. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43996. referencedClasses: [],
  43997. messageSends: ["perform:", "selector"]
  43998. }),
  43999. $globals.TestCase);
  44000. $core.addMethod(
  44001. $core.method({
  44002. selector: "runCase",
  44003. protocol: 'running',
  44004. fn: function (){
  44005. var self=this;
  44006. return $core.withContext(function($ctx1) {
  44007. $recv($recv($globals.TestContext)._testCase_(self))._start();
  44008. return self;
  44009. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  44010. },
  44011. args: [],
  44012. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  44013. referencedClasses: ["TestContext"],
  44014. messageSends: ["start", "testCase:"]
  44015. }),
  44016. $globals.TestCase);
  44017. $core.addMethod(
  44018. $core.method({
  44019. selector: "selector",
  44020. protocol: 'accessing',
  44021. fn: function (){
  44022. var self=this;
  44023. return self["@testSelector"];
  44024. },
  44025. args: [],
  44026. source: "selector\x0a\x09^ testSelector",
  44027. referencedClasses: [],
  44028. messageSends: []
  44029. }),
  44030. $globals.TestCase);
  44031. $core.addMethod(
  44032. $core.method({
  44033. selector: "setTestSelector:",
  44034. protocol: 'accessing',
  44035. fn: function (aSelector){
  44036. var self=this;
  44037. self["@testSelector"]=aSelector;
  44038. return self;
  44039. },
  44040. args: ["aSelector"],
  44041. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  44042. referencedClasses: [],
  44043. messageSends: []
  44044. }),
  44045. $globals.TestCase);
  44046. $core.addMethod(
  44047. $core.method({
  44048. selector: "setUp",
  44049. protocol: 'running',
  44050. fn: function (){
  44051. var self=this;
  44052. return self;
  44053. },
  44054. args: [],
  44055. source: "setUp",
  44056. referencedClasses: [],
  44057. messageSends: []
  44058. }),
  44059. $globals.TestCase);
  44060. $core.addMethod(
  44061. $core.method({
  44062. selector: "should:",
  44063. protocol: 'testing',
  44064. fn: function (aBlock){
  44065. var self=this;
  44066. return $core.withContext(function($ctx1) {
  44067. self._assert_($recv(aBlock)._value());
  44068. return self;
  44069. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  44070. },
  44071. args: ["aBlock"],
  44072. source: "should: aBlock\x0a\x09self assert: aBlock value",
  44073. referencedClasses: [],
  44074. messageSends: ["assert:", "value"]
  44075. }),
  44076. $globals.TestCase);
  44077. $core.addMethod(
  44078. $core.method({
  44079. selector: "should:raise:",
  44080. protocol: 'testing',
  44081. fn: function (aBlock,anExceptionClass){
  44082. var self=this;
  44083. return $core.withContext(function($ctx1) {
  44084. self._assert_($recv((function(){
  44085. return $core.withContext(function($ctx2) {
  44086. $recv(aBlock)._value();
  44087. return false;
  44088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44089. }))._on_do_(anExceptionClass,(function(ex){
  44090. return true;
  44091. })));
  44092. return self;
  44093. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44094. },
  44095. args: ["aBlock", "anExceptionClass"],
  44096. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  44097. referencedClasses: [],
  44098. messageSends: ["assert:", "on:do:", "value"]
  44099. }),
  44100. $globals.TestCase);
  44101. $core.addMethod(
  44102. $core.method({
  44103. selector: "shouldnt:raise:",
  44104. protocol: 'testing',
  44105. fn: function (aBlock,anExceptionClass){
  44106. var self=this;
  44107. return $core.withContext(function($ctx1) {
  44108. self._assert_($recv((function(){
  44109. return $core.withContext(function($ctx2) {
  44110. $recv(aBlock)._value();
  44111. return true;
  44112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44113. }))._on_do_(anExceptionClass,(function(ex){
  44114. return false;
  44115. })));
  44116. return self;
  44117. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44118. },
  44119. args: ["aBlock", "anExceptionClass"],
  44120. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  44121. referencedClasses: [],
  44122. messageSends: ["assert:", "on:do:", "value"]
  44123. }),
  44124. $globals.TestCase);
  44125. $core.addMethod(
  44126. $core.method({
  44127. selector: "signalFailure:",
  44128. protocol: 'private',
  44129. fn: function (aString){
  44130. var self=this;
  44131. return $core.withContext(function($ctx1) {
  44132. var $1;
  44133. $1=$recv($globals.TestFailure)._new();
  44134. $recv($1)._messageText_(aString);
  44135. $recv($1)._signal();
  44136. return self;
  44137. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  44138. },
  44139. args: ["aString"],
  44140. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  44141. referencedClasses: ["TestFailure"],
  44142. messageSends: ["messageText:", "new", "signal"]
  44143. }),
  44144. $globals.TestCase);
  44145. $core.addMethod(
  44146. $core.method({
  44147. selector: "tearDown",
  44148. protocol: 'running',
  44149. fn: function (){
  44150. var self=this;
  44151. return self;
  44152. },
  44153. args: [],
  44154. source: "tearDown",
  44155. referencedClasses: [],
  44156. messageSends: []
  44157. }),
  44158. $globals.TestCase);
  44159. $core.addMethod(
  44160. $core.method({
  44161. selector: "timeout:",
  44162. protocol: 'async',
  44163. fn: function (aNumber){
  44164. var self=this;
  44165. return $core.withContext(function($ctx1) {
  44166. var $1,$receiver;
  44167. $1=self["@asyncTimeout"];
  44168. if(($receiver = $1) == null || $receiver.isNil){
  44169. $1;
  44170. } else {
  44171. $recv(self["@asyncTimeout"])._clearTimeout();
  44172. };
  44173. self["@asyncTimeout"]=(0);
  44174. self["@asyncTimeout"]=$recv(self._async_((function(){
  44175. return $core.withContext(function($ctx2) {
  44176. return self._assert_description_(false,"SUnit grace time exhausted");
  44177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44178. })))._valueWithTimeout_(aNumber);
  44179. return self;
  44180. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  44181. },
  44182. args: ["aNumber"],
  44183. 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",
  44184. referencedClasses: [],
  44185. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  44186. }),
  44187. $globals.TestCase);
  44188. $core.addMethod(
  44189. $core.method({
  44190. selector: "allTestSelectors",
  44191. protocol: 'accessing',
  44192. fn: function (){
  44193. var self=this;
  44194. var selectors;
  44195. return $core.withContext(function($ctx1) {
  44196. var $1;
  44197. selectors=self._testSelectors();
  44198. $1=self._shouldInheritSelectors();
  44199. if($core.assert($1)){
  44200. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  44201. };
  44202. return selectors;
  44203. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  44204. },
  44205. args: [],
  44206. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  44207. referencedClasses: [],
  44208. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  44209. }),
  44210. $globals.TestCase.klass);
  44211. $core.addMethod(
  44212. $core.method({
  44213. selector: "buildSuite",
  44214. protocol: 'accessing',
  44215. fn: function (){
  44216. var self=this;
  44217. return $core.withContext(function($ctx1) {
  44218. return $recv(self._allTestSelectors())._collect_((function(each){
  44219. return $core.withContext(function($ctx2) {
  44220. return self._selector_(each);
  44221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44222. }));
  44223. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44224. },
  44225. args: [],
  44226. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44227. referencedClasses: [],
  44228. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44229. }),
  44230. $globals.TestCase.klass);
  44231. $core.addMethod(
  44232. $core.method({
  44233. selector: "classTag",
  44234. protocol: 'accessing',
  44235. fn: function (){
  44236. var self=this;
  44237. return "test";
  44238. },
  44239. args: [],
  44240. 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'",
  44241. referencedClasses: [],
  44242. messageSends: []
  44243. }),
  44244. $globals.TestCase.klass);
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "isAbstract",
  44248. protocol: 'testing',
  44249. fn: function (){
  44250. var self=this;
  44251. return $core.withContext(function($ctx1) {
  44252. return $recv(self._name()).__eq("TestCase");
  44253. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44254. },
  44255. args: [],
  44256. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44257. referencedClasses: [],
  44258. messageSends: ["=", "name"]
  44259. }),
  44260. $globals.TestCase.klass);
  44261. $core.addMethod(
  44262. $core.method({
  44263. selector: "lookupHierarchyRoot",
  44264. protocol: 'accessing',
  44265. fn: function (){
  44266. var self=this;
  44267. return $globals.TestCase;
  44268. },
  44269. args: [],
  44270. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44271. referencedClasses: ["TestCase"],
  44272. messageSends: []
  44273. }),
  44274. $globals.TestCase.klass);
  44275. $core.addMethod(
  44276. $core.method({
  44277. selector: "selector:",
  44278. protocol: 'accessing',
  44279. fn: function (aSelector){
  44280. var self=this;
  44281. return $core.withContext(function($ctx1) {
  44282. var $1;
  44283. $1=self._new();
  44284. $recv($1)._setTestSelector_(aSelector);
  44285. return $recv($1)._yourself();
  44286. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44287. },
  44288. args: ["aSelector"],
  44289. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44290. referencedClasses: [],
  44291. messageSends: ["setTestSelector:", "new", "yourself"]
  44292. }),
  44293. $globals.TestCase.klass);
  44294. $core.addMethod(
  44295. $core.method({
  44296. selector: "shouldInheritSelectors",
  44297. protocol: 'testing',
  44298. fn: function (){
  44299. var self=this;
  44300. return $core.withContext(function($ctx1) {
  44301. return self.__tild_eq(self._lookupHierarchyRoot());
  44302. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44303. },
  44304. args: [],
  44305. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44306. referencedClasses: [],
  44307. messageSends: ["~=", "lookupHierarchyRoot"]
  44308. }),
  44309. $globals.TestCase.klass);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "testSelectors",
  44313. protocol: 'accessing',
  44314. fn: function (){
  44315. var self=this;
  44316. return $core.withContext(function($ctx1) {
  44317. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44318. return $core.withContext(function($ctx2) {
  44319. return $recv(each)._match_("^test");
  44320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44321. }));
  44322. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44323. },
  44324. args: [],
  44325. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44326. referencedClasses: [],
  44327. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44328. }),
  44329. $globals.TestCase.klass);
  44330. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44331. $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).";
  44332. $core.addMethod(
  44333. $core.method({
  44334. selector: "execute:",
  44335. protocol: 'running',
  44336. fn: function (aBlock){
  44337. var self=this;
  44338. var failed;
  44339. return $core.withContext(function($ctx1) {
  44340. var $1,$2;
  44341. $recv(self["@testCase"])._context_(self);
  44342. $ctx1.sendIdx["context:"]=1;
  44343. $recv((function(){
  44344. return $core.withContext(function($ctx2) {
  44345. failed=true;
  44346. failed;
  44347. $recv(aBlock)._value();
  44348. failed=false;
  44349. return failed;
  44350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44351. }))._ensure_((function(){
  44352. return $core.withContext(function($ctx2) {
  44353. $recv(self["@testCase"])._context_(nil);
  44354. $1=$recv(failed)._and_((function(){
  44355. return $core.withContext(function($ctx3) {
  44356. return $recv(self["@testCase"])._isAsync();
  44357. $ctx3.sendIdx["isAsync"]=1;
  44358. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44359. }));
  44360. if($core.assert($1)){
  44361. $recv(self["@testCase"])._finished();
  44362. };
  44363. $2=$recv(self["@testCase"])._isAsync();
  44364. if(!$core.assert($2)){
  44365. return $recv(self["@testCase"])._tearDown();
  44366. };
  44367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44368. }));
  44369. return self;
  44370. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44371. },
  44372. args: ["aBlock"],
  44373. 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 ] ]",
  44374. referencedClasses: [],
  44375. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44376. }),
  44377. $globals.TestContext);
  44378. $core.addMethod(
  44379. $core.method({
  44380. selector: "start",
  44381. protocol: 'running',
  44382. fn: function (){
  44383. var self=this;
  44384. return $core.withContext(function($ctx1) {
  44385. self._execute_((function(){
  44386. return $core.withContext(function($ctx2) {
  44387. $recv(self["@testCase"])._setUp();
  44388. return $recv(self["@testCase"])._performTest();
  44389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44390. }));
  44391. return self;
  44392. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44393. },
  44394. args: [],
  44395. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44396. referencedClasses: [],
  44397. messageSends: ["execute:", "setUp", "performTest"]
  44398. }),
  44399. $globals.TestContext);
  44400. $core.addMethod(
  44401. $core.method({
  44402. selector: "testCase:",
  44403. protocol: 'accessing',
  44404. fn: function (aTestCase){
  44405. var self=this;
  44406. self["@testCase"]=aTestCase;
  44407. return self;
  44408. },
  44409. args: ["aTestCase"],
  44410. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44411. referencedClasses: [],
  44412. messageSends: []
  44413. }),
  44414. $globals.TestContext);
  44415. $core.addMethod(
  44416. $core.method({
  44417. selector: "testCase:",
  44418. protocol: 'instance creation',
  44419. fn: function (aTestCase){
  44420. var self=this;
  44421. return $core.withContext(function($ctx1) {
  44422. var $1;
  44423. $1=self._new();
  44424. $recv($1)._testCase_(aTestCase);
  44425. return $recv($1)._yourself();
  44426. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44427. },
  44428. args: ["aTestCase"],
  44429. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44430. referencedClasses: [],
  44431. messageSends: ["testCase:", "new", "yourself"]
  44432. }),
  44433. $globals.TestContext.klass);
  44434. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44435. $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`.";
  44436. $core.addMethod(
  44437. $core.method({
  44438. selector: "execute:",
  44439. protocol: 'running',
  44440. fn: function (aBlock){
  44441. var self=this;
  44442. return $core.withContext(function($ctx1) {
  44443. var $1;
  44444. $recv((function(){
  44445. return $core.withContext(function($ctx2) {
  44446. return self._withErrorReporting_((function(){
  44447. return $core.withContext(function($ctx3) {
  44448. return (
  44449. $ctx3.supercall = true,
  44450. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44451. $ctx3.supercall = false;
  44452. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44453. }));
  44454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44455. }))._ensure_((function(){
  44456. return $core.withContext(function($ctx2) {
  44457. $1=$recv(self["@testCase"])._isAsync();
  44458. if(!$core.assert($1)){
  44459. $recv(self["@result"])._increaseRuns();
  44460. return $recv(self["@finished"])._value();
  44461. };
  44462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44463. }));
  44464. return self;
  44465. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44466. },
  44467. args: ["aBlock"],
  44468. 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 ] ]",
  44469. referencedClasses: [],
  44470. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44471. }),
  44472. $globals.ReportingTestContext);
  44473. $core.addMethod(
  44474. $core.method({
  44475. selector: "finished:",
  44476. protocol: 'accessing',
  44477. fn: function (aBlock){
  44478. var self=this;
  44479. self["@finished"]=aBlock;
  44480. return self;
  44481. },
  44482. args: ["aBlock"],
  44483. source: "finished: aBlock\x0a\x09finished := aBlock",
  44484. referencedClasses: [],
  44485. messageSends: []
  44486. }),
  44487. $globals.ReportingTestContext);
  44488. $core.addMethod(
  44489. $core.method({
  44490. selector: "result:",
  44491. protocol: 'accessing',
  44492. fn: function (aTestResult){
  44493. var self=this;
  44494. self["@result"]=aTestResult;
  44495. return self;
  44496. },
  44497. args: ["aTestResult"],
  44498. source: "result: aTestResult\x0a\x09result := aTestResult",
  44499. referencedClasses: [],
  44500. messageSends: []
  44501. }),
  44502. $globals.ReportingTestContext);
  44503. $core.addMethod(
  44504. $core.method({
  44505. selector: "withErrorReporting:",
  44506. protocol: 'private',
  44507. fn: function (aBlock){
  44508. var self=this;
  44509. return $core.withContext(function($ctx1) {
  44510. $recv((function(){
  44511. return $core.withContext(function($ctx2) {
  44512. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44513. return $core.withContext(function($ctx3) {
  44514. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44515. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44516. }));
  44517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44518. }))._on_do_($globals.Error,(function(ex){
  44519. return $core.withContext(function($ctx2) {
  44520. return $recv(self["@result"])._addError_(self["@testCase"]);
  44521. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44522. }));
  44523. $ctx1.sendIdx["on:do:"]=1;
  44524. return self;
  44525. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44526. },
  44527. args: ["aBlock"],
  44528. 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 ]",
  44529. referencedClasses: ["TestFailure", "Error"],
  44530. messageSends: ["on:do:", "addFailure:", "addError:"]
  44531. }),
  44532. $globals.ReportingTestContext);
  44533. $core.addMethod(
  44534. $core.method({
  44535. selector: "testCase:result:finished:",
  44536. protocol: 'instance creation',
  44537. fn: function (aTestCase,aTestResult,aBlock){
  44538. var self=this;
  44539. return $core.withContext(function($ctx1) {
  44540. var $1;
  44541. $1=(
  44542. $ctx1.supercall = true,
  44543. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44544. $ctx1.supercall = false;
  44545. $recv($1)._result_(aTestResult);
  44546. $recv($1)._finished_(aBlock);
  44547. return $recv($1)._yourself();
  44548. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44549. },
  44550. args: ["aTestCase", "aTestResult", "aBlock"],
  44551. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44552. referencedClasses: [],
  44553. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44554. }),
  44555. $globals.ReportingTestContext.klass);
  44556. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44557. $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.";
  44558. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44559. $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";
  44560. $core.addMethod(
  44561. $core.method({
  44562. selector: "addError:",
  44563. protocol: 'accessing',
  44564. fn: function (anError){
  44565. var self=this;
  44566. return $core.withContext(function($ctx1) {
  44567. $recv(self._errors())._add_(anError);
  44568. return self;
  44569. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44570. },
  44571. args: ["anError"],
  44572. source: "addError: anError\x0a\x09self errors add: anError",
  44573. referencedClasses: [],
  44574. messageSends: ["add:", "errors"]
  44575. }),
  44576. $globals.TestResult);
  44577. $core.addMethod(
  44578. $core.method({
  44579. selector: "addFailure:",
  44580. protocol: 'accessing',
  44581. fn: function (aFailure){
  44582. var self=this;
  44583. return $core.withContext(function($ctx1) {
  44584. $recv(self._failures())._add_(aFailure);
  44585. return self;
  44586. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44587. },
  44588. args: ["aFailure"],
  44589. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44590. referencedClasses: [],
  44591. messageSends: ["add:", "failures"]
  44592. }),
  44593. $globals.TestResult);
  44594. $core.addMethod(
  44595. $core.method({
  44596. selector: "errors",
  44597. protocol: 'accessing',
  44598. fn: function (){
  44599. var self=this;
  44600. return self["@errors"];
  44601. },
  44602. args: [],
  44603. source: "errors\x0a\x09^ errors",
  44604. referencedClasses: [],
  44605. messageSends: []
  44606. }),
  44607. $globals.TestResult);
  44608. $core.addMethod(
  44609. $core.method({
  44610. selector: "failures",
  44611. protocol: 'accessing',
  44612. fn: function (){
  44613. var self=this;
  44614. return self["@failures"];
  44615. },
  44616. args: [],
  44617. source: "failures\x0a\x09^ failures",
  44618. referencedClasses: [],
  44619. messageSends: []
  44620. }),
  44621. $globals.TestResult);
  44622. $core.addMethod(
  44623. $core.method({
  44624. selector: "increaseRuns",
  44625. protocol: 'accessing',
  44626. fn: function (){
  44627. var self=this;
  44628. return $core.withContext(function($ctx1) {
  44629. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44630. return self;
  44631. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44632. },
  44633. args: [],
  44634. source: "increaseRuns\x0a\x09runs := runs + 1",
  44635. referencedClasses: [],
  44636. messageSends: ["+"]
  44637. }),
  44638. $globals.TestResult);
  44639. $core.addMethod(
  44640. $core.method({
  44641. selector: "initialize",
  44642. protocol: 'initialization',
  44643. fn: function (){
  44644. var self=this;
  44645. return $core.withContext(function($ctx1) {
  44646. (
  44647. $ctx1.supercall = true,
  44648. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44649. $ctx1.supercall = false;
  44650. self["@timestamp"]=$recv($globals.Date)._now();
  44651. self["@runs"]=(0);
  44652. self["@errors"]=$recv($globals.Array)._new();
  44653. $ctx1.sendIdx["new"]=1;
  44654. self["@failures"]=$recv($globals.Array)._new();
  44655. self["@total"]=(0);
  44656. return self;
  44657. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44658. },
  44659. args: [],
  44660. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44661. referencedClasses: ["Date", "Array"],
  44662. messageSends: ["initialize", "now", "new"]
  44663. }),
  44664. $globals.TestResult);
  44665. $core.addMethod(
  44666. $core.method({
  44667. selector: "nextRunDo:",
  44668. protocol: 'running',
  44669. fn: function (aBlock){
  44670. var self=this;
  44671. return $core.withContext(function($ctx1) {
  44672. var $2,$1;
  44673. $2=self._runs();
  44674. $ctx1.sendIdx["runs"]=1;
  44675. $1=$recv($2).__eq_eq(self._total());
  44676. if(!$core.assert($1)){
  44677. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44678. };
  44679. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44680. },
  44681. args: ["aBlock"],
  44682. 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 ]",
  44683. referencedClasses: [],
  44684. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44685. }),
  44686. $globals.TestResult);
  44687. $core.addMethod(
  44688. $core.method({
  44689. selector: "runCase:",
  44690. protocol: 'running',
  44691. fn: function (aTestCase){
  44692. var self=this;
  44693. return $core.withContext(function($ctx1) {
  44694. $recv((function(){
  44695. return $core.withContext(function($ctx2) {
  44696. return $recv((function(){
  44697. return $core.withContext(function($ctx3) {
  44698. self._increaseRuns();
  44699. return $recv(aTestCase)._runCase();
  44700. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44701. }))._on_do_($globals.TestFailure,(function(ex){
  44702. return $core.withContext(function($ctx3) {
  44703. return self._addFailure_(aTestCase);
  44704. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44705. }));
  44706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44707. }))._on_do_($globals.Error,(function(ex){
  44708. return $core.withContext(function($ctx2) {
  44709. return self._addError_(aTestCase);
  44710. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44711. }));
  44712. $ctx1.sendIdx["on:do:"]=1;
  44713. return self;
  44714. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44715. },
  44716. args: ["aTestCase"],
  44717. 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 ]",
  44718. referencedClasses: ["TestFailure", "Error"],
  44719. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44720. }),
  44721. $globals.TestResult);
  44722. $core.addMethod(
  44723. $core.method({
  44724. selector: "runs",
  44725. protocol: 'accessing',
  44726. fn: function (){
  44727. var self=this;
  44728. return self["@runs"];
  44729. },
  44730. args: [],
  44731. source: "runs\x0a\x09^ runs",
  44732. referencedClasses: [],
  44733. messageSends: []
  44734. }),
  44735. $globals.TestResult);
  44736. $core.addMethod(
  44737. $core.method({
  44738. selector: "status",
  44739. protocol: 'accessing',
  44740. fn: function (){
  44741. var self=this;
  44742. return $core.withContext(function($ctx1) {
  44743. var $2,$3,$1;
  44744. $2=$recv(self._errors())._isEmpty();
  44745. $ctx1.sendIdx["isEmpty"]=1;
  44746. if($core.assert($2)){
  44747. $3=$recv(self._failures())._isEmpty();
  44748. if($core.assert($3)){
  44749. $1="success";
  44750. } else {
  44751. $1="failure";
  44752. };
  44753. } else {
  44754. $1="error";
  44755. };
  44756. return $1;
  44757. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44758. },
  44759. args: [],
  44760. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  44761. referencedClasses: [],
  44762. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  44763. }),
  44764. $globals.TestResult);
  44765. $core.addMethod(
  44766. $core.method({
  44767. selector: "timestamp",
  44768. protocol: 'accessing',
  44769. fn: function (){
  44770. var self=this;
  44771. return self["@timestamp"];
  44772. },
  44773. args: [],
  44774. source: "timestamp\x0a\x09^ timestamp",
  44775. referencedClasses: [],
  44776. messageSends: []
  44777. }),
  44778. $globals.TestResult);
  44779. $core.addMethod(
  44780. $core.method({
  44781. selector: "total",
  44782. protocol: 'accessing',
  44783. fn: function (){
  44784. var self=this;
  44785. return self["@total"];
  44786. },
  44787. args: [],
  44788. source: "total\x0a\x09^ total",
  44789. referencedClasses: [],
  44790. messageSends: []
  44791. }),
  44792. $globals.TestResult);
  44793. $core.addMethod(
  44794. $core.method({
  44795. selector: "total:",
  44796. protocol: 'accessing',
  44797. fn: function (aNumber){
  44798. var self=this;
  44799. self["@total"]=aNumber;
  44800. return self;
  44801. },
  44802. args: ["aNumber"],
  44803. source: "total: aNumber\x0a\x09total := aNumber",
  44804. referencedClasses: [],
  44805. messageSends: []
  44806. }),
  44807. $globals.TestResult);
  44808. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44809. $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`.";
  44810. $core.addMethod(
  44811. $core.method({
  44812. selector: "announcer",
  44813. protocol: 'accessing',
  44814. fn: function (){
  44815. var self=this;
  44816. return self["@announcer"];
  44817. },
  44818. args: [],
  44819. source: "announcer\x0a\x09^ announcer",
  44820. referencedClasses: [],
  44821. messageSends: []
  44822. }),
  44823. $globals.TestSuiteRunner);
  44824. $core.addMethod(
  44825. $core.method({
  44826. selector: "contextOf:",
  44827. protocol: 'private',
  44828. fn: function (anInteger){
  44829. var self=this;
  44830. return $core.withContext(function($ctx1) {
  44831. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44832. return $core.withContext(function($ctx2) {
  44833. return self._resume();
  44834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44835. }));
  44836. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44837. },
  44838. args: ["anInteger"],
  44839. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44840. referencedClasses: ["ReportingTestContext"],
  44841. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44842. }),
  44843. $globals.TestSuiteRunner);
  44844. $core.addMethod(
  44845. $core.method({
  44846. selector: "initialize",
  44847. protocol: 'initialization',
  44848. fn: function (){
  44849. var self=this;
  44850. return $core.withContext(function($ctx1) {
  44851. var $1;
  44852. (
  44853. $ctx1.supercall = true,
  44854. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44855. $ctx1.supercall = false;
  44856. self["@announcer"]=$recv($globals.Announcer)._new();
  44857. $ctx1.sendIdx["new"]=1;
  44858. self["@result"]=$recv($globals.TestResult)._new();
  44859. self["@runNextTest"]=(function(){
  44860. var runs;
  44861. return $core.withContext(function($ctx2) {
  44862. runs=$recv(self["@result"])._runs();
  44863. runs;
  44864. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44865. if($core.assert($1)){
  44866. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44867. };
  44868. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44869. });
  44870. return self;
  44871. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44872. },
  44873. args: [],
  44874. 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 ] ].",
  44875. referencedClasses: ["Announcer", "TestResult"],
  44876. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44877. }),
  44878. $globals.TestSuiteRunner);
  44879. $core.addMethod(
  44880. $core.method({
  44881. selector: "result",
  44882. protocol: 'accessing',
  44883. fn: function (){
  44884. var self=this;
  44885. return self["@result"];
  44886. },
  44887. args: [],
  44888. source: "result\x0a\x09^ result",
  44889. referencedClasses: [],
  44890. messageSends: []
  44891. }),
  44892. $globals.TestSuiteRunner);
  44893. $core.addMethod(
  44894. $core.method({
  44895. selector: "resume",
  44896. protocol: 'actions',
  44897. fn: function (){
  44898. var self=this;
  44899. return $core.withContext(function($ctx1) {
  44900. $recv(self["@runNextTest"])._fork();
  44901. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44902. return self;
  44903. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44904. },
  44905. args: [],
  44906. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44907. referencedClasses: ["ResultAnnouncement"],
  44908. messageSends: ["fork", "announce:", "result:", "new"]
  44909. }),
  44910. $globals.TestSuiteRunner);
  44911. $core.addMethod(
  44912. $core.method({
  44913. selector: "run",
  44914. protocol: 'actions',
  44915. fn: function (){
  44916. var self=this;
  44917. return $core.withContext(function($ctx1) {
  44918. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44919. self._resume();
  44920. return self;
  44921. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44922. },
  44923. args: [],
  44924. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44925. referencedClasses: [],
  44926. messageSends: ["total:", "size", "resume"]
  44927. }),
  44928. $globals.TestSuiteRunner);
  44929. $core.addMethod(
  44930. $core.method({
  44931. selector: "suite:",
  44932. protocol: 'accessing',
  44933. fn: function (aCollection){
  44934. var self=this;
  44935. self["@suite"]=aCollection;
  44936. return self;
  44937. },
  44938. args: ["aCollection"],
  44939. source: "suite: aCollection\x0a\x09suite := aCollection",
  44940. referencedClasses: [],
  44941. messageSends: []
  44942. }),
  44943. $globals.TestSuiteRunner);
  44944. $core.addMethod(
  44945. $core.method({
  44946. selector: "new",
  44947. protocol: 'instance creation',
  44948. fn: function (){
  44949. var self=this;
  44950. return $core.withContext(function($ctx1) {
  44951. self._shouldNotImplement();
  44952. return self;
  44953. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44954. },
  44955. args: [],
  44956. source: "new\x0a\x09self shouldNotImplement",
  44957. referencedClasses: [],
  44958. messageSends: ["shouldNotImplement"]
  44959. }),
  44960. $globals.TestSuiteRunner.klass);
  44961. $core.addMethod(
  44962. $core.method({
  44963. selector: "on:",
  44964. protocol: 'instance creation',
  44965. fn: function (aCollection){
  44966. var self=this;
  44967. return $core.withContext(function($ctx1) {
  44968. var $1;
  44969. $1=(
  44970. $ctx1.supercall = true,
  44971. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  44972. $ctx1.supercall = false;
  44973. return $recv($1)._suite_(aCollection);
  44974. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44975. },
  44976. args: ["aCollection"],
  44977. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44978. referencedClasses: [],
  44979. messageSends: ["suite:", "new"]
  44980. }),
  44981. $globals.TestSuiteRunner.klass);
  44982. $core.addMethod(
  44983. $core.method({
  44984. selector: "isTestClass",
  44985. protocol: '*SUnit',
  44986. fn: function (){
  44987. var self=this;
  44988. return $core.withContext(function($ctx1) {
  44989. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  44990. return $core.withContext(function($ctx2) {
  44991. return $recv(self._isAbstract())._not();
  44992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44993. }));
  44994. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44995. },
  44996. args: [],
  44997. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44998. referencedClasses: ["TestCase"],
  44999. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  45000. }),
  45001. $globals.Behavior);
  45002. $core.addMethod(
  45003. $core.method({
  45004. selector: "isTestPackage",
  45005. protocol: '*SUnit',
  45006. fn: function (){
  45007. var self=this;
  45008. return $core.withContext(function($ctx1) {
  45009. return $recv(self._classes())._anySatisfy_((function(each){
  45010. return $core.withContext(function($ctx2) {
  45011. return $recv(each)._isTestClass();
  45012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45013. }));
  45014. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  45015. },
  45016. args: [],
  45017. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  45018. referencedClasses: [],
  45019. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  45020. }),
  45021. $globals.Package);
  45022. });
  45023. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  45024. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  45025. $core.addPackage('Compiler-Tests');
  45026. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  45027. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45028. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  45029. $core.addMethod(
  45030. $core.method({
  45031. selector: "analyze:forClass:",
  45032. protocol: 'convenience',
  45033. fn: function (aNode,aClass){
  45034. var self=this;
  45035. return $core.withContext(function($ctx1) {
  45036. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  45037. return aNode;
  45038. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  45039. },
  45040. args: ["aNode", "aClass"],
  45041. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  45042. referencedClasses: ["SemanticAnalyzer"],
  45043. messageSends: ["visit:", "on:"]
  45044. }),
  45045. $globals.ASTParsingTest);
  45046. $core.addMethod(
  45047. $core.method({
  45048. selector: "parse:",
  45049. protocol: 'parsing',
  45050. fn: function (aString){
  45051. var self=this;
  45052. return $core.withContext(function($ctx1) {
  45053. return $recv($globals.Smalltalk)._parse_(aString);
  45054. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  45055. },
  45056. args: ["aString"],
  45057. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  45058. referencedClasses: ["Smalltalk"],
  45059. messageSends: ["parse:"]
  45060. }),
  45061. $globals.ASTParsingTest);
  45062. $core.addMethod(
  45063. $core.method({
  45064. selector: "parse:forClass:",
  45065. protocol: 'parsing',
  45066. fn: function (aString,aClass){
  45067. var self=this;
  45068. return $core.withContext(function($ctx1) {
  45069. return self._analyze_forClass_(self._parse_(aString),aClass);
  45070. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  45071. },
  45072. args: ["aString", "aClass"],
  45073. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  45074. referencedClasses: [],
  45075. messageSends: ["analyze:forClass:", "parse:"]
  45076. }),
  45077. $globals.ASTParsingTest);
  45078. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45079. $core.addMethod(
  45080. $core.method({
  45081. selector: "astPCNodeVisitor",
  45082. protocol: 'factory',
  45083. fn: function (){
  45084. var self=this;
  45085. return $core.withContext(function($ctx1) {
  45086. var $1,$2;
  45087. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45088. $ctx1.sendIdx["new"]=1;
  45089. $2=$recv($recv($globals.AIContext)._new())._yourself();
  45090. $ctx1.sendIdx["yourself"]=1;
  45091. $recv($1)._context_($2);
  45092. return $recv($1)._yourself();
  45093. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  45094. },
  45095. args: [],
  45096. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  45097. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  45098. messageSends: ["context:", "new", "yourself"]
  45099. }),
  45100. $globals.ASTPCNodeVisitorTest);
  45101. $core.addMethod(
  45102. $core.method({
  45103. selector: "astPCNodeVisitorForSelector:",
  45104. protocol: 'factory',
  45105. fn: function (aString){
  45106. var self=this;
  45107. return $core.withContext(function($ctx1) {
  45108. var $1,$2;
  45109. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45110. $ctx1.sendIdx["new"]=1;
  45111. $recv($1)._selector_(aString);
  45112. $2=$recv($recv($globals.AIContext)._new())._yourself();
  45113. $ctx1.sendIdx["yourself"]=1;
  45114. $recv($1)._context_($2);
  45115. return $recv($1)._yourself();
  45116. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  45117. },
  45118. args: ["aString"],
  45119. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  45120. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  45121. messageSends: ["selector:", "new", "context:", "yourself"]
  45122. }),
  45123. $globals.ASTPCNodeVisitorTest);
  45124. $core.addMethod(
  45125. $core.method({
  45126. selector: "testJSStatementNode",
  45127. protocol: 'tests',
  45128. fn: function (){
  45129. var self=this;
  45130. var ast,visitor;
  45131. return $core.withContext(function($ctx1) {
  45132. var $3,$2,$1;
  45133. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  45134. $3=self._astPCNodeVisitor();
  45135. $recv($3)._visit_(ast);
  45136. $2=$recv($3)._currentNode();
  45137. $1=$recv($2)._isJSStatementNode();
  45138. self._assert_($1);
  45139. return self;
  45140. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45141. },
  45142. args: [],
  45143. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  45144. referencedClasses: ["Object"],
  45145. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45146. }),
  45147. $globals.ASTPCNodeVisitorTest);
  45148. $core.addMethod(
  45149. $core.method({
  45150. selector: "testMessageSend",
  45151. protocol: 'tests',
  45152. fn: function (){
  45153. var self=this;
  45154. var ast;
  45155. return $core.withContext(function($ctx1) {
  45156. var $3,$2,$1;
  45157. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  45158. $3=self._astPCNodeVisitorForSelector_("yourself");
  45159. $recv($3)._visit_(ast);
  45160. $2=$recv($3)._currentNode();
  45161. $1=$recv($2)._selector();
  45162. self._assert_equals_($1,"yourself");
  45163. return self;
  45164. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45165. },
  45166. args: [],
  45167. 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'",
  45168. referencedClasses: ["Object"],
  45169. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45170. }),
  45171. $globals.ASTPCNodeVisitorTest);
  45172. $core.addMethod(
  45173. $core.method({
  45174. selector: "testMessageSendWithBlocks",
  45175. protocol: 'tests',
  45176. fn: function (){
  45177. var self=this;
  45178. var ast;
  45179. return $core.withContext(function($ctx1) {
  45180. var $3,$2,$1;
  45181. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  45182. $3=self._astPCNodeVisitorForSelector_("yourself");
  45183. $recv($3)._visit_(ast);
  45184. $2=$recv($3)._currentNode();
  45185. $1=$recv($2)._selector();
  45186. self._assert_equals_($1,"yourself");
  45187. return self;
  45188. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45189. },
  45190. args: [],
  45191. 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'",
  45192. referencedClasses: ["Object"],
  45193. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45194. }),
  45195. $globals.ASTPCNodeVisitorTest);
  45196. $core.addMethod(
  45197. $core.method({
  45198. selector: "testMessageSendWithInlining",
  45199. protocol: 'tests',
  45200. fn: function (){
  45201. var self=this;
  45202. var ast;
  45203. return $core.withContext(function($ctx1) {
  45204. var $3,$4,$2,$1,$7,$6,$5;
  45205. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45206. $ctx1.sendIdx["parse:forClass:"]=1;
  45207. $3=self._astPCNodeVisitorForSelector_("yourself");
  45208. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  45209. $recv($3)._visit_(ast);
  45210. $ctx1.sendIdx["visit:"]=1;
  45211. $4=$recv($3)._currentNode();
  45212. $ctx1.sendIdx["currentNode"]=1;
  45213. $2=$4;
  45214. $1=$recv($2)._selector();
  45215. $ctx1.sendIdx["selector"]=1;
  45216. self._assert_equals_($1,"yourself");
  45217. $ctx1.sendIdx["assert:equals:"]=1;
  45218. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45219. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45220. $recv($7)._visit_(ast);
  45221. $6=$recv($7)._currentNode();
  45222. $5=$recv($6)._selector();
  45223. self._assert_equals_($5,"asBoolean");
  45224. return self;
  45225. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45226. },
  45227. args: [],
  45228. 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'",
  45229. referencedClasses: ["Object"],
  45230. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45231. }),
  45232. $globals.ASTPCNodeVisitorTest);
  45233. $core.addMethod(
  45234. $core.method({
  45235. selector: "testNoMessageSend",
  45236. protocol: 'tests',
  45237. fn: function (){
  45238. var self=this;
  45239. var ast;
  45240. return $core.withContext(function($ctx1) {
  45241. var $3,$2,$1;
  45242. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45243. $3=self._astPCNodeVisitor();
  45244. $recv($3)._visit_(ast);
  45245. $2=$recv($3)._currentNode();
  45246. $1=$recv($2)._isNil();
  45247. self._assert_($1);
  45248. return self;
  45249. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45250. },
  45251. args: [],
  45252. 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",
  45253. referencedClasses: ["Object"],
  45254. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45255. }),
  45256. $globals.ASTPCNodeVisitorTest);
  45257. $core.addMethod(
  45258. $core.method({
  45259. selector: "testPC",
  45260. protocol: 'tests',
  45261. fn: function (){
  45262. var self=this;
  45263. var ast,visitor;
  45264. return $core.withContext(function($ctx1) {
  45265. var $3,$2,$1;
  45266. ast=self._parse_forClass_("foo <console.log(1)>",$globals.Object);
  45267. $3=self._astPCNodeVisitor();
  45268. $recv($3)._visit_(ast);
  45269. $2=$recv($3)._currentNode();
  45270. $1=$recv($2)._isJSStatementNode();
  45271. self._assert_($1);
  45272. return self;
  45273. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45274. },
  45275. args: [],
  45276. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  45277. referencedClasses: ["Object"],
  45278. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45279. }),
  45280. $globals.ASTPCNodeVisitorTest);
  45281. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45282. $core.addMethod(
  45283. $core.method({
  45284. selector: "testNodeAtPosition",
  45285. protocol: 'tests',
  45286. fn: function (){
  45287. var self=this;
  45288. var node;
  45289. return $core.withContext(function($ctx1) {
  45290. var $3,$4,$2,$1,$7,$8,$6,$5;
  45291. node=self._parse_("yourself\x0a\x09^ self");
  45292. $ctx1.sendIdx["parse:"]=1;
  45293. $3=node;
  45294. $4=(2).__at((4));
  45295. $ctx1.sendIdx["@"]=1;
  45296. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45297. return nil;
  45298. }));
  45299. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45300. $1=$recv($2)._source();
  45301. self._assert_equals_($1,"self");
  45302. $ctx1.sendIdx["assert:equals:"]=1;
  45303. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45304. $ctx1.sendIdx["parse:"]=2;
  45305. $7=node;
  45306. $8=(2).__at((7));
  45307. $ctx1.sendIdx["@"]=2;
  45308. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45309. return nil;
  45310. }));
  45311. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45312. $5=$recv($6)._selector();
  45313. $ctx1.sendIdx["selector"]=1;
  45314. self._assert_equals_($5,"ifTrue:");
  45315. $ctx1.sendIdx["assert:equals:"]=2;
  45316. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45317. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45318. return nil;
  45319. })))._selector(),"foo");
  45320. return self;
  45321. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45322. },
  45323. args: [],
  45324. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  45325. referencedClasses: [],
  45326. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45327. }),
  45328. $globals.ASTPositionTest);
  45329. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45330. $core.addMethod(
  45331. $core.method({
  45332. selector: "codeGeneratorClass",
  45333. protocol: 'accessing',
  45334. fn: function (){
  45335. var self=this;
  45336. return $globals.CodeGenerator;
  45337. },
  45338. args: [],
  45339. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45340. referencedClasses: ["CodeGenerator"],
  45341. messageSends: []
  45342. }),
  45343. $globals.CodeGeneratorTest);
  45344. $core.addMethod(
  45345. $core.method({
  45346. selector: "compiler",
  45347. protocol: 'factory',
  45348. fn: function (){
  45349. var self=this;
  45350. return $core.withContext(function($ctx1) {
  45351. var $1;
  45352. $1=$recv($globals.Compiler)._new();
  45353. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45354. return $recv($1)._yourself();
  45355. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45356. },
  45357. args: [],
  45358. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45359. referencedClasses: ["Compiler"],
  45360. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45361. }),
  45362. $globals.CodeGeneratorTest);
  45363. $core.addMethod(
  45364. $core.method({
  45365. selector: "setUp",
  45366. protocol: 'initialization',
  45367. fn: function (){
  45368. var self=this;
  45369. return $core.withContext(function($ctx1) {
  45370. self["@receiver"]=$recv($globals.DoIt)._new();
  45371. return self;
  45372. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45373. },
  45374. args: [],
  45375. source: "setUp\x0a\x09receiver := DoIt new",
  45376. referencedClasses: ["DoIt"],
  45377. messageSends: ["new"]
  45378. }),
  45379. $globals.CodeGeneratorTest);
  45380. $core.addMethod(
  45381. $core.method({
  45382. selector: "should:receiver:raise:",
  45383. protocol: 'testing',
  45384. fn: function (aString,anObject,anErrorClass){
  45385. var self=this;
  45386. var method,result;
  45387. return $core.withContext(function($ctx1) {
  45388. var $1,$2,$3,$receiver;
  45389. self["@receiver"]=anObject;
  45390. $recv((function(){
  45391. return $core.withContext(function($ctx2) {
  45392. return self._should_raise_((function(){
  45393. return $core.withContext(function($ctx3) {
  45394. $1=self._compiler();
  45395. $2=$recv(anObject)._class();
  45396. $ctx3.sendIdx["class"]=1;
  45397. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45398. method;
  45399. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45400. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45401. }),anErrorClass);
  45402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45403. }))._ensure_((function(){
  45404. return $core.withContext(function($ctx2) {
  45405. $3=method;
  45406. if(($receiver = $3) == null || $receiver.isNil){
  45407. return $3;
  45408. } else {
  45409. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45410. };
  45411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45412. }));
  45413. return self;
  45414. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45415. },
  45416. args: ["aString", "anObject", "anErrorClass"],
  45417. 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 ] ]",
  45418. referencedClasses: [],
  45419. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45420. }),
  45421. $globals.CodeGeneratorTest);
  45422. $core.addMethod(
  45423. $core.method({
  45424. selector: "should:receiver:return:",
  45425. protocol: 'testing',
  45426. fn: function (aString,anObject,aResult){
  45427. var self=this;
  45428. var method,result;
  45429. return $core.withContext(function($ctx1) {
  45430. var $1,$2;
  45431. self["@receiver"]=anObject;
  45432. $1=self._compiler();
  45433. $2=$recv(anObject)._class();
  45434. $ctx1.sendIdx["class"]=1;
  45435. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45436. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45437. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45438. self._assert_equals_(aResult,result);
  45439. return self;
  45440. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45441. },
  45442. args: ["aString", "anObject", "aResult"],
  45443. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  45444. referencedClasses: [],
  45445. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45446. }),
  45447. $globals.CodeGeneratorTest);
  45448. $core.addMethod(
  45449. $core.method({
  45450. selector: "should:return:",
  45451. protocol: 'testing',
  45452. fn: function (aString,anObject){
  45453. var self=this;
  45454. return $core.withContext(function($ctx1) {
  45455. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45456. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45457. },
  45458. args: ["aString", "anObject"],
  45459. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45460. referencedClasses: [],
  45461. messageSends: ["should:receiver:return:"]
  45462. }),
  45463. $globals.CodeGeneratorTest);
  45464. $core.addMethod(
  45465. $core.method({
  45466. selector: "tearDown",
  45467. protocol: 'initialization',
  45468. fn: function (){
  45469. var self=this;
  45470. return self;
  45471. },
  45472. args: [],
  45473. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45474. referencedClasses: [],
  45475. messageSends: []
  45476. }),
  45477. $globals.CodeGeneratorTest);
  45478. $core.addMethod(
  45479. $core.method({
  45480. selector: "testAssignment",
  45481. protocol: 'tests',
  45482. fn: function (){
  45483. var self=this;
  45484. return $core.withContext(function($ctx1) {
  45485. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45486. $ctx1.sendIdx["should:return:"]=1;
  45487. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45488. $ctx1.sendIdx["should:return:"]=2;
  45489. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45490. return self;
  45491. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45492. },
  45493. args: [],
  45494. 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",
  45495. referencedClasses: [],
  45496. messageSends: ["should:return:"]
  45497. }),
  45498. $globals.CodeGeneratorTest);
  45499. $core.addMethod(
  45500. $core.method({
  45501. selector: "testBackslashSelectors",
  45502. protocol: 'tests',
  45503. fn: function (){
  45504. var self=this;
  45505. return $core.withContext(function($ctx1) {
  45506. self._should_return_("\x5c arg ^ 4",(4));
  45507. $ctx1.sendIdx["should:return:"]=1;
  45508. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45509. return self;
  45510. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45511. },
  45512. args: [],
  45513. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45514. referencedClasses: [],
  45515. messageSends: ["should:return:"]
  45516. }),
  45517. $globals.CodeGeneratorTest);
  45518. $core.addMethod(
  45519. $core.method({
  45520. selector: "testBlockReturn",
  45521. protocol: 'tests',
  45522. fn: function (){
  45523. var self=this;
  45524. return $core.withContext(function($ctx1) {
  45525. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45526. $ctx1.sendIdx["should:return:"]=1;
  45527. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45528. $ctx1.sendIdx["should:return:"]=2;
  45529. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45530. return self;
  45531. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45532. },
  45533. args: [],
  45534. 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).",
  45535. referencedClasses: [],
  45536. messageSends: ["should:return:"]
  45537. }),
  45538. $globals.CodeGeneratorTest);
  45539. $core.addMethod(
  45540. $core.method({
  45541. selector: "testCascades",
  45542. protocol: 'tests',
  45543. fn: function (){
  45544. var self=this;
  45545. return $core.withContext(function($ctx1) {
  45546. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45547. return self;
  45548. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45549. },
  45550. args: [],
  45551. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45552. referencedClasses: [],
  45553. messageSends: ["should:return:"]
  45554. }),
  45555. $globals.CodeGeneratorTest);
  45556. $core.addMethod(
  45557. $core.method({
  45558. selector: "testCascadesInDynamicArray",
  45559. protocol: 'tests',
  45560. fn: function (){
  45561. var self=this;
  45562. return $core.withContext(function($ctx1) {
  45563. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45564. return self;
  45565. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45566. },
  45567. args: [],
  45568. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45569. referencedClasses: [],
  45570. messageSends: ["should:return:"]
  45571. }),
  45572. $globals.CodeGeneratorTest);
  45573. $core.addMethod(
  45574. $core.method({
  45575. selector: "testCascadesInDynamicDictioary",
  45576. protocol: 'tests',
  45577. fn: function (){
  45578. var self=this;
  45579. return $core.withContext(function($ctx1) {
  45580. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45581. return self;
  45582. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45583. },
  45584. args: [],
  45585. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45586. referencedClasses: [],
  45587. messageSends: ["should:return:"]
  45588. }),
  45589. $globals.CodeGeneratorTest);
  45590. $core.addMethod(
  45591. $core.method({
  45592. selector: "testCascadesInSend",
  45593. protocol: 'tests',
  45594. fn: function (){
  45595. var self=this;
  45596. return $core.withContext(function($ctx1) {
  45597. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45598. return self;
  45599. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45600. },
  45601. args: [],
  45602. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45603. referencedClasses: [],
  45604. messageSends: ["should:return:"]
  45605. }),
  45606. $globals.CodeGeneratorTest);
  45607. $core.addMethod(
  45608. $core.method({
  45609. selector: "testCascadesWithInlining",
  45610. protocol: 'tests',
  45611. fn: function (){
  45612. var self=this;
  45613. return $core.withContext(function($ctx1) {
  45614. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45615. $ctx1.sendIdx["should:return:"]=1;
  45616. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45617. return self;
  45618. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45619. },
  45620. args: [],
  45621. 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",
  45622. referencedClasses: [],
  45623. messageSends: ["should:return:"]
  45624. }),
  45625. $globals.CodeGeneratorTest);
  45626. $core.addMethod(
  45627. $core.method({
  45628. selector: "testDynamicArrayElementsOrdered",
  45629. protocol: 'tests',
  45630. fn: function (){
  45631. var self=this;
  45632. return $core.withContext(function($ctx1) {
  45633. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45634. $ctx1.sendIdx["should:return:"]=1;
  45635. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45636. return self;
  45637. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45638. },
  45639. args: [],
  45640. 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).",
  45641. referencedClasses: [],
  45642. messageSends: ["should:return:"]
  45643. }),
  45644. $globals.CodeGeneratorTest);
  45645. $core.addMethod(
  45646. $core.method({
  45647. selector: "testDynamicDictionaryElementsOrdered",
  45648. protocol: 'tests',
  45649. fn: function (){
  45650. var self=this;
  45651. return $core.withContext(function($ctx1) {
  45652. 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)]));
  45653. return self;
  45654. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45655. },
  45656. args: [],
  45657. 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}.",
  45658. referencedClasses: [],
  45659. messageSends: ["should:return:"]
  45660. }),
  45661. $globals.CodeGeneratorTest);
  45662. $core.addMethod(
  45663. $core.method({
  45664. selector: "testDynamicDictionaryWithMoreArrows",
  45665. protocol: 'tests',
  45666. fn: function (){
  45667. var self=this;
  45668. return $core.withContext(function($ctx1) {
  45669. var $2,$1;
  45670. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45671. $ctx1.sendIdx["->"]=1;
  45672. $1=$recv($globals.HashedCollection)._with_($2);
  45673. self._should_return_("foo ^ #{1->2->3}",$1);
  45674. return self;
  45675. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45676. },
  45677. args: [],
  45678. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45679. referencedClasses: ["HashedCollection"],
  45680. messageSends: ["should:return:", "with:", "->"]
  45681. }),
  45682. $globals.CodeGeneratorTest);
  45683. $core.addMethod(
  45684. $core.method({
  45685. selector: "testGlobalVar",
  45686. protocol: 'tests',
  45687. fn: function (){
  45688. var self=this;
  45689. return $core.withContext(function($ctx1) {
  45690. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45691. $ctx1.sendIdx["should:return:"]=1;
  45692. self._should_return_("foo ^ Math cos: 0",(1));
  45693. $ctx1.sendIdx["should:return:"]=2;
  45694. self._should_return_("foo ^ NonExistingVar",nil);
  45695. return self;
  45696. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45697. },
  45698. args: [],
  45699. 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",
  45700. referencedClasses: ["BlockClosure"],
  45701. messageSends: ["should:return:"]
  45702. }),
  45703. $globals.CodeGeneratorTest);
  45704. $core.addMethod(
  45705. $core.method({
  45706. selector: "testInnerTemporalDependentElementsOrdered",
  45707. protocol: 'tests',
  45708. fn: function (){
  45709. var self=this;
  45710. return $core.withContext(function($ctx1) {
  45711. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45712. $2="foo".__minus_gt($globals.Array);
  45713. $ctx1.sendIdx["->"]=1;
  45714. $3="bar".__minus_gt((2));
  45715. $ctx1.sendIdx["->"]=2;
  45716. $1=[$2,$3];
  45717. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45718. $ctx1.sendIdx["should:return:"]=1;
  45719. $5="foo".__minus_gt($globals.Array);
  45720. $ctx1.sendIdx["->"]=3;
  45721. $6="bar".__minus_gt((2));
  45722. $ctx1.sendIdx["->"]=4;
  45723. $4=[$5,$6];
  45724. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45725. $ctx1.sendIdx["should:return:"]=2;
  45726. $8="foo".__minus_gt((1));
  45727. $ctx1.sendIdx["->"]=5;
  45728. $9="bar".__minus_gt((2));
  45729. $ctx1.sendIdx["->"]=6;
  45730. $7=[$8,$9];
  45731. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45732. $ctx1.sendIdx["should:return:"]=3;
  45733. $11="foo".__minus_gt((1));
  45734. $ctx1.sendIdx["->"]=7;
  45735. $10=[$11,"bar".__minus_gt((2))];
  45736. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45737. $ctx1.sendIdx["should:return:"]=4;
  45738. 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)]));
  45739. return self;
  45740. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45741. },
  45742. args: [],
  45743. 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}.",
  45744. referencedClasses: ["Array"],
  45745. messageSends: ["should:return:", "->"]
  45746. }),
  45747. $globals.CodeGeneratorTest);
  45748. $core.addMethod(
  45749. $core.method({
  45750. selector: "testJSStatement",
  45751. protocol: 'tests',
  45752. fn: function (){
  45753. var self=this;
  45754. return $core.withContext(function($ctx1) {
  45755. self._should_return_("foo <return 2+3>",(5));
  45756. return self;
  45757. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45758. },
  45759. args: [],
  45760. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45761. referencedClasses: [],
  45762. messageSends: ["should:return:"]
  45763. }),
  45764. $globals.CodeGeneratorTest);
  45765. $core.addMethod(
  45766. $core.method({
  45767. selector: "testLexicalScope",
  45768. protocol: 'tests',
  45769. fn: function (){
  45770. var self=this;
  45771. return $core.withContext(function($ctx1) {
  45772. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45773. return self;
  45774. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45775. },
  45776. args: [],
  45777. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45778. referencedClasses: [],
  45779. messageSends: ["should:return:"]
  45780. }),
  45781. $globals.CodeGeneratorTest);
  45782. $core.addMethod(
  45783. $core.method({
  45784. selector: "testLiterals",
  45785. protocol: 'tests',
  45786. fn: function (){
  45787. var self=this;
  45788. return $core.withContext(function($ctx1) {
  45789. self._should_return_("foo ^ 1",(1));
  45790. $ctx1.sendIdx["should:return:"]=1;
  45791. self._should_return_("foo ^ 'hello'","hello");
  45792. $ctx1.sendIdx["should:return:"]=2;
  45793. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45794. $ctx1.sendIdx["should:return:"]=3;
  45795. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45796. $ctx1.sendIdx["should:return:"]=4;
  45797. self._should_return_("foo ^ true",true);
  45798. $ctx1.sendIdx["should:return:"]=5;
  45799. self._should_return_("foo ^ false",false);
  45800. $ctx1.sendIdx["should:return:"]=6;
  45801. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45802. $ctx1.sendIdx["should:return:"]=7;
  45803. self._should_return_("foo ^ #hello","hello");
  45804. $ctx1.sendIdx["should:return:"]=8;
  45805. self._should_return_("foo ^ $h","h");
  45806. $ctx1.sendIdx["should:return:"]=9;
  45807. self._should_return_("foo ^ -123.456",(-123.456));
  45808. $ctx1.sendIdx["should:return:"]=10;
  45809. self._should_return_("foo ^ -2.5e4",(-25000));
  45810. return self;
  45811. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45812. },
  45813. args: [],
  45814. 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.",
  45815. referencedClasses: [],
  45816. messageSends: ["should:return:"]
  45817. }),
  45818. $globals.CodeGeneratorTest);
  45819. $core.addMethod(
  45820. $core.method({
  45821. selector: "testLocalReturn",
  45822. protocol: 'tests',
  45823. fn: function (){
  45824. var self=this;
  45825. return $core.withContext(function($ctx1) {
  45826. self._should_return_("foo ^ 1",(1));
  45827. $ctx1.sendIdx["should:return:"]=1;
  45828. self._should_return_("foo ^ 1 + 1",(2));
  45829. $ctx1.sendIdx["should:return:"]=2;
  45830. self._should_return_("foo ",self["@receiver"]);
  45831. $ctx1.sendIdx["should:return:"]=3;
  45832. self._should_return_("foo self asString",self["@receiver"]);
  45833. $ctx1.sendIdx["should:return:"]=4;
  45834. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45835. return self;
  45836. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45837. },
  45838. args: [],
  45839. 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",
  45840. referencedClasses: [],
  45841. messageSends: ["should:return:"]
  45842. }),
  45843. $globals.CodeGeneratorTest);
  45844. $core.addMethod(
  45845. $core.method({
  45846. selector: "testMessageSends",
  45847. protocol: 'tests',
  45848. fn: function (){
  45849. var self=this;
  45850. return $core.withContext(function($ctx1) {
  45851. self._should_return_("foo ^ 1 asString","1");
  45852. $ctx1.sendIdx["should:return:"]=1;
  45853. self._should_return_("foo ^ 1 + 1",(2));
  45854. $ctx1.sendIdx["should:return:"]=2;
  45855. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45856. $ctx1.sendIdx["should:return:"]=3;
  45857. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45858. $ctx1.sendIdx["should:return:"]=4;
  45859. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45860. return self;
  45861. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45862. },
  45863. args: [],
  45864. 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)",
  45865. referencedClasses: [],
  45866. messageSends: ["should:return:"]
  45867. }),
  45868. $globals.CodeGeneratorTest);
  45869. $core.addMethod(
  45870. $core.method({
  45871. selector: "testMultipleSequences",
  45872. protocol: 'tests',
  45873. fn: function (){
  45874. var self=this;
  45875. return $core.withContext(function($ctx1) {
  45876. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45877. return self;
  45878. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45879. },
  45880. args: [],
  45881. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45882. referencedClasses: [],
  45883. messageSends: ["should:return:"]
  45884. }),
  45885. $globals.CodeGeneratorTest);
  45886. $core.addMethod(
  45887. $core.method({
  45888. selector: "testMutableLiterals",
  45889. protocol: 'tests',
  45890. fn: function (){
  45891. var self=this;
  45892. return $core.withContext(function($ctx1) {
  45893. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45894. return self;
  45895. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45896. },
  45897. args: [],
  45898. 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)",
  45899. referencedClasses: [],
  45900. messageSends: ["should:return:"]
  45901. }),
  45902. $globals.CodeGeneratorTest);
  45903. $core.addMethod(
  45904. $core.method({
  45905. selector: "testNestedIfTrue",
  45906. protocol: 'tests',
  45907. fn: function (){
  45908. var self=this;
  45909. return $core.withContext(function($ctx1) {
  45910. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45911. $ctx1.sendIdx["should:return:"]=1;
  45912. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45913. $ctx1.sendIdx["should:return:"]=2;
  45914. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45915. $ctx1.sendIdx["should:return:"]=3;
  45916. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45917. return self;
  45918. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45919. },
  45920. args: [],
  45921. 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.",
  45922. referencedClasses: [],
  45923. messageSends: ["should:return:"]
  45924. }),
  45925. $globals.CodeGeneratorTest);
  45926. $core.addMethod(
  45927. $core.method({
  45928. selector: "testNestedSends",
  45929. protocol: 'tests',
  45930. fn: function (){
  45931. var self=this;
  45932. return $core.withContext(function($ctx1) {
  45933. 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());
  45934. return self;
  45935. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45936. },
  45937. args: [],
  45938. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45939. referencedClasses: ["Point"],
  45940. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45941. }),
  45942. $globals.CodeGeneratorTest);
  45943. $core.addMethod(
  45944. $core.method({
  45945. selector: "testNonLocalReturn",
  45946. protocol: 'tests',
  45947. fn: function (){
  45948. var self=this;
  45949. return $core.withContext(function($ctx1) {
  45950. self._should_return_("foo [ ^ 1 ] value",(1));
  45951. $ctx1.sendIdx["should:return:"]=1;
  45952. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45953. $ctx1.sendIdx["should:return:"]=2;
  45954. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45955. $ctx1.sendIdx["should:return:"]=3;
  45956. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45957. return self;
  45958. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45959. },
  45960. args: [],
  45961. 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",
  45962. referencedClasses: [],
  45963. messageSends: ["should:return:"]
  45964. }),
  45965. $globals.CodeGeneratorTest);
  45966. $core.addMethod(
  45967. $core.method({
  45968. selector: "testPascalCaseGlobal",
  45969. protocol: 'tests',
  45970. fn: function (){
  45971. var self=this;
  45972. return $core.withContext(function($ctx1) {
  45973. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  45974. $ctx1.sendIdx["should:return:"]=1;
  45975. self._should_return_("foo ^NonExistent",nil);
  45976. return self;
  45977. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45978. },
  45979. args: [],
  45980. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45981. referencedClasses: ["Smalltalk"],
  45982. messageSends: ["should:return:", "at:", "globals"]
  45983. }),
  45984. $globals.CodeGeneratorTest);
  45985. $core.addMethod(
  45986. $core.method({
  45987. selector: "testRootSuperSend",
  45988. protocol: 'tests',
  45989. fn: function (){
  45990. var self=this;
  45991. return $core.withContext(function($ctx1) {
  45992. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  45993. return self;
  45994. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45995. },
  45996. args: [],
  45997. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45998. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45999. messageSends: ["should:receiver:raise:", "new"]
  46000. }),
  46001. $globals.CodeGeneratorTest);
  46002. $core.addMethod(
  46003. $core.method({
  46004. selector: "testSendReceiverAndArgumentsOrdered",
  46005. protocol: 'tests',
  46006. fn: function (){
  46007. var self=this;
  46008. return $core.withContext(function($ctx1) {
  46009. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  46010. $ctx1.sendIdx["should:return:"]=1;
  46011. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  46012. return self;
  46013. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  46014. },
  46015. args: [],
  46016. 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}.",
  46017. referencedClasses: ["Array"],
  46018. messageSends: ["should:return:"]
  46019. }),
  46020. $globals.CodeGeneratorTest);
  46021. $core.addMethod(
  46022. $core.method({
  46023. selector: "testSuperSend",
  46024. protocol: 'tests',
  46025. fn: function (){
  46026. var self=this;
  46027. return $core.withContext(function($ctx1) {
  46028. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  46029. return self;
  46030. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  46031. },
  46032. args: [],
  46033. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  46034. referencedClasses: [],
  46035. messageSends: ["should:receiver:return:"]
  46036. }),
  46037. $globals.CodeGeneratorTest);
  46038. $core.addMethod(
  46039. $core.method({
  46040. selector: "testTempVariables",
  46041. protocol: 'tests',
  46042. fn: function (){
  46043. var self=this;
  46044. return $core.withContext(function($ctx1) {
  46045. self._should_return_("foo | a | ^ a",nil);
  46046. $ctx1.sendIdx["should:return:"]=1;
  46047. self._should_return_("foo | AVariable | ^ AVariable",nil);
  46048. $ctx1.sendIdx["should:return:"]=2;
  46049. self._should_return_("foo | a b c | ^ c",nil);
  46050. $ctx1.sendIdx["should:return:"]=3;
  46051. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  46052. $ctx1.sendIdx["should:return:"]=4;
  46053. self._should_return_("foo | a | a:= 1. ^ a",(1));
  46054. $ctx1.sendIdx["should:return:"]=5;
  46055. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  46056. return self;
  46057. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  46058. },
  46059. args: [],
  46060. 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.",
  46061. referencedClasses: [],
  46062. messageSends: ["should:return:"]
  46063. }),
  46064. $globals.CodeGeneratorTest);
  46065. $core.addMethod(
  46066. $core.method({
  46067. selector: "testThisContext",
  46068. protocol: 'tests',
  46069. fn: function (){
  46070. var self=this;
  46071. return $core.withContext(function($ctx1) {
  46072. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  46073. return self;
  46074. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  46075. },
  46076. args: [],
  46077. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  46078. referencedClasses: [],
  46079. messageSends: ["should:return:"]
  46080. }),
  46081. $globals.CodeGeneratorTest);
  46082. $core.addMethod(
  46083. $core.method({
  46084. selector: "testifFalse",
  46085. protocol: 'tests',
  46086. fn: function (){
  46087. var self=this;
  46088. return $core.withContext(function($ctx1) {
  46089. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  46090. $ctx1.sendIdx["should:return:"]=1;
  46091. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  46092. $ctx1.sendIdx["should:return:"]=2;
  46093. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  46094. $ctx1.sendIdx["should:return:"]=3;
  46095. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  46096. return self;
  46097. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  46098. },
  46099. args: [],
  46100. 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.",
  46101. referencedClasses: [],
  46102. messageSends: ["should:return:"]
  46103. }),
  46104. $globals.CodeGeneratorTest);
  46105. $core.addMethod(
  46106. $core.method({
  46107. selector: "testifFalseIfTrue",
  46108. protocol: 'tests',
  46109. fn: function (){
  46110. var self=this;
  46111. return $core.withContext(function($ctx1) {
  46112. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  46113. $ctx1.sendIdx["should:return:"]=1;
  46114. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  46115. $ctx1.sendIdx["should:return:"]=2;
  46116. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  46117. $ctx1.sendIdx["should:return:"]=3;
  46118. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  46119. return self;
  46120. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  46121. },
  46122. args: [],
  46123. 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.",
  46124. referencedClasses: [],
  46125. messageSends: ["should:return:"]
  46126. }),
  46127. $globals.CodeGeneratorTest);
  46128. $core.addMethod(
  46129. $core.method({
  46130. selector: "testifNil",
  46131. protocol: 'tests',
  46132. fn: function (){
  46133. var self=this;
  46134. return $core.withContext(function($ctx1) {
  46135. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  46136. $ctx1.sendIdx["should:return:"]=1;
  46137. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  46138. $ctx1.sendIdx["should:return:"]=2;
  46139. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  46140. $ctx1.sendIdx["should:return:"]=3;
  46141. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  46142. return self;
  46143. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  46144. },
  46145. args: [],
  46146. 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.",
  46147. referencedClasses: [],
  46148. messageSends: ["should:return:"]
  46149. }),
  46150. $globals.CodeGeneratorTest);
  46151. $core.addMethod(
  46152. $core.method({
  46153. selector: "testifNilIfNotNil",
  46154. protocol: 'tests',
  46155. fn: function (){
  46156. var self=this;
  46157. return $core.withContext(function($ctx1) {
  46158. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  46159. $ctx1.sendIdx["should:return:"]=1;
  46160. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  46161. $ctx1.sendIdx["should:return:"]=2;
  46162. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  46163. $ctx1.sendIdx["should:return:"]=3;
  46164. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  46165. return self;
  46166. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  46167. },
  46168. args: [],
  46169. 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.",
  46170. referencedClasses: [],
  46171. messageSends: ["should:return:"]
  46172. }),
  46173. $globals.CodeGeneratorTest);
  46174. $core.addMethod(
  46175. $core.method({
  46176. selector: "testifNotNil",
  46177. protocol: 'tests',
  46178. fn: function (){
  46179. var self=this;
  46180. return $core.withContext(function($ctx1) {
  46181. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  46182. $ctx1.sendIdx["should:return:"]=1;
  46183. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  46184. $ctx1.sendIdx["should:return:"]=2;
  46185. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  46186. $ctx1.sendIdx["should:return:"]=3;
  46187. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  46188. return self;
  46189. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  46190. },
  46191. args: [],
  46192. 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.",
  46193. referencedClasses: [],
  46194. messageSends: ["should:return:"]
  46195. }),
  46196. $globals.CodeGeneratorTest);
  46197. $core.addMethod(
  46198. $core.method({
  46199. selector: "testifNotNilWithArgument",
  46200. protocol: 'tests',
  46201. fn: function (){
  46202. var self=this;
  46203. return $core.withContext(function($ctx1) {
  46204. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  46205. $ctx1.sendIdx["should:return:"]=1;
  46206. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  46207. $ctx1.sendIdx["should:return:"]=2;
  46208. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  46209. $ctx1.sendIdx["should:return:"]=3;
  46210. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  46211. $ctx1.sendIdx["should:return:"]=4;
  46212. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  46213. $ctx1.sendIdx["should:return:"]=5;
  46214. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46215. return self;
  46216. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46217. },
  46218. args: [],
  46219. 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",
  46220. referencedClasses: [],
  46221. messageSends: ["should:return:"]
  46222. }),
  46223. $globals.CodeGeneratorTest);
  46224. $core.addMethod(
  46225. $core.method({
  46226. selector: "testifTrue",
  46227. protocol: 'tests',
  46228. fn: function (){
  46229. var self=this;
  46230. return $core.withContext(function($ctx1) {
  46231. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46232. $ctx1.sendIdx["should:return:"]=1;
  46233. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46234. $ctx1.sendIdx["should:return:"]=2;
  46235. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46236. $ctx1.sendIdx["should:return:"]=3;
  46237. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46238. return self;
  46239. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46240. },
  46241. args: [],
  46242. 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.",
  46243. referencedClasses: [],
  46244. messageSends: ["should:return:"]
  46245. }),
  46246. $globals.CodeGeneratorTest);
  46247. $core.addMethod(
  46248. $core.method({
  46249. selector: "testifTrueIfFalse",
  46250. protocol: 'tests',
  46251. fn: function (){
  46252. var self=this;
  46253. return $core.withContext(function($ctx1) {
  46254. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46255. $ctx1.sendIdx["should:return:"]=1;
  46256. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46257. $ctx1.sendIdx["should:return:"]=2;
  46258. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46259. $ctx1.sendIdx["should:return:"]=3;
  46260. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46261. return self;
  46262. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46263. },
  46264. args: [],
  46265. 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.",
  46266. referencedClasses: [],
  46267. messageSends: ["should:return:"]
  46268. }),
  46269. $globals.CodeGeneratorTest);
  46270. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46271. $core.addMethod(
  46272. $core.method({
  46273. selector: "analyze:forClass:",
  46274. protocol: 'parsing',
  46275. fn: function (aNode,aClass){
  46276. var self=this;
  46277. return $core.withContext(function($ctx1) {
  46278. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46279. return aNode;
  46280. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46281. },
  46282. args: ["aNode", "aClass"],
  46283. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46284. referencedClasses: ["SemanticAnalyzer"],
  46285. messageSends: ["visit:", "on:"]
  46286. }),
  46287. $globals.ASTInterpreterTest);
  46288. $core.addMethod(
  46289. $core.method({
  46290. selector: "interpret:receiver:withArguments:",
  46291. protocol: 'private',
  46292. fn: function (aString,anObject,aDictionary){
  46293. var self=this;
  46294. var ctx,ast,interpreter;
  46295. return $core.withContext(function($ctx1) {
  46296. var $1,$2,$3,$receiver;
  46297. interpreter=$recv($globals.ASTInterpreter)._new();
  46298. $ctx1.sendIdx["new"]=1;
  46299. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46300. $1=$recv($globals.AIContext)._new();
  46301. $recv($1)._receiver_(anObject);
  46302. $recv($1)._interpreter_(interpreter);
  46303. ctx=$recv($1)._yourself();
  46304. $2=$recv(ast)._sequenceNode();
  46305. if(($receiver = $2) == null || $receiver.isNil){
  46306. $2;
  46307. } else {
  46308. var sequence;
  46309. sequence=$receiver;
  46310. $recv($recv(sequence)._temps())._do_((function(each){
  46311. return $core.withContext(function($ctx2) {
  46312. return $recv(ctx)._defineLocal_(each);
  46313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46314. }));
  46315. };
  46316. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46317. return $core.withContext(function($ctx2) {
  46318. return $recv(ctx)._localAt_put_(key,value);
  46319. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46320. }));
  46321. $3=interpreter;
  46322. $recv($3)._context_(ctx);
  46323. $recv($3)._node_(ast);
  46324. $recv($3)._enterNode();
  46325. $recv($3)._proceed();
  46326. return $recv($3)._result();
  46327. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46328. },
  46329. args: ["aString", "anObject", "aDictionary"],
  46330. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  46331. referencedClasses: ["ASTInterpreter", "AIContext"],
  46332. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46333. }),
  46334. $globals.ASTInterpreterTest);
  46335. $core.addMethod(
  46336. $core.method({
  46337. selector: "parse:",
  46338. protocol: 'parsing',
  46339. fn: function (aString){
  46340. var self=this;
  46341. return $core.withContext(function($ctx1) {
  46342. return $recv($globals.Smalltalk)._parse_(aString);
  46343. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46344. },
  46345. args: ["aString"],
  46346. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46347. referencedClasses: ["Smalltalk"],
  46348. messageSends: ["parse:"]
  46349. }),
  46350. $globals.ASTInterpreterTest);
  46351. $core.addMethod(
  46352. $core.method({
  46353. selector: "parse:forClass:",
  46354. protocol: 'parsing',
  46355. fn: function (aString,aClass){
  46356. var self=this;
  46357. return $core.withContext(function($ctx1) {
  46358. return self._analyze_forClass_(self._parse_(aString),aClass);
  46359. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46360. },
  46361. args: ["aString", "aClass"],
  46362. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46363. referencedClasses: [],
  46364. messageSends: ["analyze:forClass:", "parse:"]
  46365. }),
  46366. $globals.ASTInterpreterTest);
  46367. $core.addMethod(
  46368. $core.method({
  46369. selector: "should:receiver:return:",
  46370. protocol: 'testing',
  46371. fn: function (aString,anObject,aResult){
  46372. var self=this;
  46373. return $core.withContext(function($ctx1) {
  46374. self["@receiver"]=anObject;
  46375. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46376. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46377. },
  46378. args: ["aString", "anObject", "aResult"],
  46379. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  46380. referencedClasses: [],
  46381. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46382. }),
  46383. $globals.ASTInterpreterTest);
  46384. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46385. $core.addMethod(
  46386. $core.method({
  46387. selector: "interpret:receiver:withArguments:",
  46388. protocol: 'private',
  46389. fn: function (aString,anObject,aDictionary){
  46390. var self=this;
  46391. var ctx,ast,debugger_;
  46392. return $core.withContext(function($ctx1) {
  46393. var $1,$2,$3,$4,$5,$receiver;
  46394. $1=$recv($globals.AIContext)._new();
  46395. $ctx1.sendIdx["new"]=1;
  46396. $recv($1)._receiver_(anObject);
  46397. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46398. ctx=$recv($1)._yourself();
  46399. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46400. $2=$recv(ast)._sequenceNode();
  46401. if(($receiver = $2) == null || $receiver.isNil){
  46402. $2;
  46403. } else {
  46404. var sequence;
  46405. sequence=$receiver;
  46406. $recv($recv(sequence)._temps())._do_((function(each){
  46407. return $core.withContext(function($ctx2) {
  46408. return $recv(ctx)._defineLocal_(each);
  46409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46410. }));
  46411. };
  46412. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46413. return $core.withContext(function($ctx2) {
  46414. return $recv(ctx)._localAt_put_(key,value);
  46415. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46416. }));
  46417. $3=$recv(ctx)._interpreter();
  46418. $ctx1.sendIdx["interpreter"]=1;
  46419. $recv($3)._context_(ctx);
  46420. $ctx1.sendIdx["context:"]=1;
  46421. $4=$recv(ctx)._interpreter();
  46422. $recv($4)._node_(ast);
  46423. $recv($4)._enterNode();
  46424. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46425. $5=debugger_;
  46426. $recv($5)._proceed();
  46427. return $recv($5)._result();
  46428. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46429. },
  46430. args: ["aString", "anObject", "aDictionary"],
  46431. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast; enterNode.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  46432. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46433. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46434. }),
  46435. $globals.ASTDebuggerTest);
  46436. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46437. $core.addMethod(
  46438. $core.method({
  46439. selector: "codeGeneratorClass",
  46440. protocol: 'accessing',
  46441. fn: function (){
  46442. var self=this;
  46443. return $globals.InliningCodeGenerator;
  46444. },
  46445. args: [],
  46446. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46447. referencedClasses: ["InliningCodeGenerator"],
  46448. messageSends: []
  46449. }),
  46450. $globals.InliningCodeGeneratorTest);
  46451. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46452. $core.addMethod(
  46453. $core.method({
  46454. selector: "testClassRefVar",
  46455. protocol: 'tests',
  46456. fn: function (){
  46457. var self=this;
  46458. var node;
  46459. return $core.withContext(function($ctx1) {
  46460. var $1,$2;
  46461. $1=$recv($globals.VariableNode)._new();
  46462. $ctx1.sendIdx["new"]=1;
  46463. $recv($1)._value_("Object");
  46464. node=$recv($1)._yourself();
  46465. $2=$recv($globals.SemanticAnalyzer)._new();
  46466. $ctx1.sendIdx["new"]=2;
  46467. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46468. $recv($2)._visit_(node);
  46469. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46470. return self;
  46471. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46472. },
  46473. args: [],
  46474. 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",
  46475. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46476. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46477. }),
  46478. $globals.ScopeVarTest);
  46479. $core.addMethod(
  46480. $core.method({
  46481. selector: "testInstanceVar",
  46482. protocol: 'tests',
  46483. fn: function (){
  46484. var self=this;
  46485. var node,scope;
  46486. return $core.withContext(function($ctx1) {
  46487. var $1;
  46488. $1=$recv($globals.VariableNode)._new();
  46489. $ctx1.sendIdx["new"]=1;
  46490. $recv($1)._value_("bzzz");
  46491. node=$recv($1)._yourself();
  46492. scope=$recv($globals.MethodLexicalScope)._new();
  46493. $recv(scope)._addIVar_("bzzz");
  46494. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46495. return self;
  46496. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46497. },
  46498. args: [],
  46499. 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",
  46500. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46501. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46502. }),
  46503. $globals.ScopeVarTest);
  46504. $core.addMethod(
  46505. $core.method({
  46506. selector: "testPseudoVar",
  46507. protocol: 'tests',
  46508. fn: function (){
  46509. var self=this;
  46510. var node,pseudoVars;
  46511. return $core.withContext(function($ctx1) {
  46512. var $1;
  46513. pseudoVars=["self", "super", "true", "false", "nil"];
  46514. $recv(pseudoVars)._do_((function(each){
  46515. return $core.withContext(function($ctx2) {
  46516. $1=$recv($globals.VariableNode)._new();
  46517. $ctx2.sendIdx["new"]=1;
  46518. $recv($1)._value_(each);
  46519. node=$recv($1)._yourself();
  46520. node;
  46521. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46523. }));
  46524. return self;
  46525. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46526. },
  46527. args: [],
  46528. 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]",
  46529. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46530. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46531. }),
  46532. $globals.ScopeVarTest);
  46533. $core.addMethod(
  46534. $core.method({
  46535. selector: "testTempVar",
  46536. protocol: 'tests',
  46537. fn: function (){
  46538. var self=this;
  46539. var node,scope;
  46540. return $core.withContext(function($ctx1) {
  46541. var $1;
  46542. $1=$recv($globals.VariableNode)._new();
  46543. $ctx1.sendIdx["new"]=1;
  46544. $recv($1)._value_("bzzz");
  46545. node=$recv($1)._yourself();
  46546. scope=$recv($globals.MethodLexicalScope)._new();
  46547. $recv(scope)._addTemp_("bzzz");
  46548. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46549. return self;
  46550. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46551. },
  46552. args: [],
  46553. 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",
  46554. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46555. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46556. }),
  46557. $globals.ScopeVarTest);
  46558. $core.addMethod(
  46559. $core.method({
  46560. selector: "testUnknownVar",
  46561. protocol: 'tests',
  46562. fn: function (){
  46563. var self=this;
  46564. var node;
  46565. return $core.withContext(function($ctx1) {
  46566. var $1;
  46567. $1=$recv($globals.VariableNode)._new();
  46568. $ctx1.sendIdx["new"]=1;
  46569. $recv($1)._value_("bzzz");
  46570. node=$recv($1)._yourself();
  46571. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46572. return self;
  46573. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46574. },
  46575. args: [],
  46576. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46577. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46578. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46579. }),
  46580. $globals.ScopeVarTest);
  46581. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46582. $core.addMethod(
  46583. $core.method({
  46584. selector: "setUp",
  46585. protocol: 'running',
  46586. fn: function (){
  46587. var self=this;
  46588. return $core.withContext(function($ctx1) {
  46589. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46590. return self;
  46591. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46592. },
  46593. args: [],
  46594. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46595. referencedClasses: ["SemanticAnalyzer", "Object"],
  46596. messageSends: ["on:"]
  46597. }),
  46598. $globals.SemanticAnalyzerTest);
  46599. $core.addMethod(
  46600. $core.method({
  46601. selector: "testAssignment",
  46602. protocol: 'tests',
  46603. fn: function (){
  46604. var self=this;
  46605. var src,ast;
  46606. return $core.withContext(function($ctx1) {
  46607. src="foo self := 1";
  46608. ast=$recv($globals.Smalltalk)._parse_(src);
  46609. self._should_raise_((function(){
  46610. return $core.withContext(function($ctx2) {
  46611. return $recv(self["@analyzer"])._visit_(ast);
  46612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46613. }),$globals.InvalidAssignmentError);
  46614. return self;
  46615. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46616. },
  46617. args: [],
  46618. 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",
  46619. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46620. messageSends: ["parse:", "should:raise:", "visit:"]
  46621. }),
  46622. $globals.SemanticAnalyzerTest);
  46623. $core.addMethod(
  46624. $core.method({
  46625. selector: "testNonLocalReturn",
  46626. protocol: 'tests',
  46627. fn: function (){
  46628. var self=this;
  46629. var src,ast;
  46630. return $core.withContext(function($ctx1) {
  46631. src="foo | a | a + 1. ^ a";
  46632. ast=$recv($globals.Smalltalk)._parse_(src);
  46633. $recv(self["@analyzer"])._visit_(ast);
  46634. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46635. return self;
  46636. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46637. },
  46638. args: [],
  46639. 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",
  46640. referencedClasses: ["Smalltalk"],
  46641. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46642. }),
  46643. $globals.SemanticAnalyzerTest);
  46644. $core.addMethod(
  46645. $core.method({
  46646. selector: "testNonLocalReturn2",
  46647. protocol: 'tests',
  46648. fn: function (){
  46649. var self=this;
  46650. var src,ast;
  46651. return $core.withContext(function($ctx1) {
  46652. src="foo | a | a + 1. [ [ ^ a] ]";
  46653. ast=$recv($globals.Smalltalk)._parse_(src);
  46654. $recv(self["@analyzer"])._visit_(ast);
  46655. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46656. return self;
  46657. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46658. },
  46659. args: [],
  46660. 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",
  46661. referencedClasses: ["Smalltalk"],
  46662. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46663. }),
  46664. $globals.SemanticAnalyzerTest);
  46665. $core.addMethod(
  46666. $core.method({
  46667. selector: "testScope",
  46668. protocol: 'tests',
  46669. fn: function (){
  46670. var self=this;
  46671. var src,ast;
  46672. return $core.withContext(function($ctx1) {
  46673. var $4,$3,$2,$1;
  46674. src="foo | a | a + 1. [ | b | b := a ]";
  46675. ast=$recv($globals.Smalltalk)._parse_(src);
  46676. $recv(self["@analyzer"])._visit_(ast);
  46677. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46678. $ctx1.sendIdx["nodes"]=1;
  46679. $3=$recv($4)._last();
  46680. $2=$recv($3)._scope();
  46681. $ctx1.sendIdx["scope"]=1;
  46682. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46683. self._deny_($1);
  46684. return self;
  46685. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46686. },
  46687. args: [],
  46688. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
  46689. referencedClasses: ["Smalltalk"],
  46690. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  46691. }),
  46692. $globals.SemanticAnalyzerTest);
  46693. $core.addMethod(
  46694. $core.method({
  46695. selector: "testScope2",
  46696. protocol: 'tests',
  46697. fn: function (){
  46698. var self=this;
  46699. var src,ast;
  46700. return $core.withContext(function($ctx1) {
  46701. var $8,$7,$6,$5,$4,$3,$2,$1;
  46702. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46703. ast=$recv($globals.Smalltalk)._parse_(src);
  46704. $recv(self["@analyzer"])._visit_(ast);
  46705. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46706. $ctx1.sendIdx["nodes"]=3;
  46707. $7=$recv($8)._last();
  46708. $6=$recv($7)._nodes();
  46709. $ctx1.sendIdx["nodes"]=2;
  46710. $5=$recv($6)._first();
  46711. $ctx1.sendIdx["first"]=2;
  46712. $4=$recv($5)._nodes();
  46713. $ctx1.sendIdx["nodes"]=1;
  46714. $3=$recv($4)._first();
  46715. $ctx1.sendIdx["first"]=1;
  46716. $2=$recv($3)._scope();
  46717. $ctx1.sendIdx["scope"]=1;
  46718. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46719. self._deny_($1);
  46720. return self;
  46721. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46722. },
  46723. args: [],
  46724. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
  46725. referencedClasses: ["Smalltalk"],
  46726. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  46727. }),
  46728. $globals.SemanticAnalyzerTest);
  46729. $core.addMethod(
  46730. $core.method({
  46731. selector: "testScopeLevel",
  46732. protocol: 'tests',
  46733. fn: function (){
  46734. var self=this;
  46735. var src,ast;
  46736. return $core.withContext(function($ctx1) {
  46737. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46738. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46739. ast=$recv($globals.Smalltalk)._parse_(src);
  46740. $recv(self["@analyzer"])._visit_(ast);
  46741. $2=$recv(ast)._scope();
  46742. $ctx1.sendIdx["scope"]=1;
  46743. $1=$recv($2)._scopeLevel();
  46744. $ctx1.sendIdx["scopeLevel"]=1;
  46745. self._assert_equals_($1,(1));
  46746. $ctx1.sendIdx["assert:equals:"]=1;
  46747. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46748. $ctx1.sendIdx["nodes"]=3;
  46749. $9=$recv($10)._last();
  46750. $8=$recv($9)._nodes();
  46751. $ctx1.sendIdx["nodes"]=2;
  46752. $7=$recv($8)._first();
  46753. $ctx1.sendIdx["first"]=2;
  46754. $6=$recv($7)._nodes();
  46755. $ctx1.sendIdx["nodes"]=1;
  46756. $5=$recv($6)._first();
  46757. $ctx1.sendIdx["first"]=1;
  46758. $4=$recv($5)._scope();
  46759. $3=$recv($4)._scopeLevel();
  46760. self._assert_equals_($3,(3));
  46761. return self;
  46762. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46763. },
  46764. args: [],
  46765. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  46766. referencedClasses: ["Smalltalk"],
  46767. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  46768. }),
  46769. $globals.SemanticAnalyzerTest);
  46770. $core.addMethod(
  46771. $core.method({
  46772. selector: "testUnknownVariables",
  46773. protocol: 'tests',
  46774. fn: function (){
  46775. var self=this;
  46776. var src,ast;
  46777. return $core.withContext(function($ctx1) {
  46778. src="foo | a | b + a";
  46779. ast=$recv($globals.Smalltalk)._parse_(src);
  46780. self._should_raise_((function(){
  46781. return $core.withContext(function($ctx2) {
  46782. return $recv(self["@analyzer"])._visit_(ast);
  46783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46784. }),$globals.UnknownVariableError);
  46785. return self;
  46786. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46787. },
  46788. args: [],
  46789. 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",
  46790. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46791. messageSends: ["parse:", "should:raise:", "visit:"]
  46792. }),
  46793. $globals.SemanticAnalyzerTest);
  46794. $core.addMethod(
  46795. $core.method({
  46796. selector: "testUnknownVariablesWithScope",
  46797. protocol: 'tests',
  46798. fn: function (){
  46799. var self=this;
  46800. var src,ast;
  46801. return $core.withContext(function($ctx1) {
  46802. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46803. ast=$recv($globals.Smalltalk)._parse_(src);
  46804. self._should_raise_((function(){
  46805. return $core.withContext(function($ctx2) {
  46806. return $recv(self["@analyzer"])._visit_(ast);
  46807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46808. }),$globals.UnknownVariableError);
  46809. return self;
  46810. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46811. },
  46812. args: [],
  46813. 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",
  46814. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46815. messageSends: ["parse:", "should:raise:", "visit:"]
  46816. }),
  46817. $globals.SemanticAnalyzerTest);
  46818. $core.addMethod(
  46819. $core.method({
  46820. selector: "testVariableShadowing",
  46821. protocol: 'tests',
  46822. fn: function (){
  46823. var self=this;
  46824. var src,ast;
  46825. return $core.withContext(function($ctx1) {
  46826. src="foo | a | a + 1";
  46827. ast=$recv($globals.Smalltalk)._parse_(src);
  46828. $recv(self["@analyzer"])._visit_(ast);
  46829. return self;
  46830. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46831. },
  46832. args: [],
  46833. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46834. referencedClasses: ["Smalltalk"],
  46835. messageSends: ["parse:", "visit:"]
  46836. }),
  46837. $globals.SemanticAnalyzerTest);
  46838. $core.addMethod(
  46839. $core.method({
  46840. selector: "testVariableShadowing2",
  46841. protocol: 'tests',
  46842. fn: function (){
  46843. var self=this;
  46844. var src,ast;
  46845. return $core.withContext(function($ctx1) {
  46846. src="foo | a | a + 1. [ | a | a := 2 ]";
  46847. ast=$recv($globals.Smalltalk)._parse_(src);
  46848. self._should_raise_((function(){
  46849. return $core.withContext(function($ctx2) {
  46850. return $recv(self["@analyzer"])._visit_(ast);
  46851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46852. }),$globals.ShadowingVariableError);
  46853. return self;
  46854. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46855. },
  46856. args: [],
  46857. 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",
  46858. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46859. messageSends: ["parse:", "should:raise:", "visit:"]
  46860. }),
  46861. $globals.SemanticAnalyzerTest);
  46862. $core.addMethod(
  46863. $core.method({
  46864. selector: "testVariableShadowing3",
  46865. protocol: 'tests',
  46866. fn: function (){
  46867. var self=this;
  46868. var src,ast;
  46869. return $core.withContext(function($ctx1) {
  46870. src="foo | a | a + 1. [ | b | b := 2 ]";
  46871. ast=$recv($globals.Smalltalk)._parse_(src);
  46872. $recv(self["@analyzer"])._visit_(ast);
  46873. return self;
  46874. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46875. },
  46876. args: [],
  46877. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46878. referencedClasses: ["Smalltalk"],
  46879. messageSends: ["parse:", "visit:"]
  46880. }),
  46881. $globals.SemanticAnalyzerTest);
  46882. $core.addMethod(
  46883. $core.method({
  46884. selector: "testVariableShadowing4",
  46885. protocol: 'tests',
  46886. fn: function (){
  46887. var self=this;
  46888. var src,ast;
  46889. return $core.withContext(function($ctx1) {
  46890. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46891. ast=$recv($globals.Smalltalk)._parse_(src);
  46892. $recv(self["@analyzer"])._visit_(ast);
  46893. return self;
  46894. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46895. },
  46896. args: [],
  46897. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46898. referencedClasses: ["Smalltalk"],
  46899. messageSends: ["parse:", "visit:"]
  46900. }),
  46901. $globals.SemanticAnalyzerTest);
  46902. $core.addMethod(
  46903. $core.method({
  46904. selector: "testVariableShadowing5",
  46905. protocol: 'tests',
  46906. fn: function (){
  46907. var self=this;
  46908. var src,ast;
  46909. return $core.withContext(function($ctx1) {
  46910. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46911. ast=$recv($globals.Smalltalk)._parse_(src);
  46912. self._should_raise_((function(){
  46913. return $core.withContext(function($ctx2) {
  46914. return $recv(self["@analyzer"])._visit_(ast);
  46915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46916. }),$globals.ShadowingVariableError);
  46917. return self;
  46918. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46919. },
  46920. args: [],
  46921. 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",
  46922. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46923. messageSends: ["parse:", "should:raise:", "visit:"]
  46924. }),
  46925. $globals.SemanticAnalyzerTest);
  46926. $core.addMethod(
  46927. $core.method({
  46928. selector: "testVariablesLookup",
  46929. protocol: 'tests',
  46930. fn: function (){
  46931. var self=this;
  46932. var src,ast;
  46933. return $core.withContext(function($ctx1) {
  46934. 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;
  46935. src="foo | a | a + 1. [ | b | b := a ]";
  46936. ast=$recv($globals.Smalltalk)._parse_(src);
  46937. $recv(self["@analyzer"])._visit_(ast);
  46938. $7=$recv(ast)._nodes();
  46939. $ctx1.sendIdx["nodes"]=2;
  46940. $6=$recv($7)._first();
  46941. $ctx1.sendIdx["first"]=2;
  46942. $5=$recv($6)._nodes();
  46943. $ctx1.sendIdx["nodes"]=1;
  46944. $4=$recv($5)._first();
  46945. $ctx1.sendIdx["first"]=1;
  46946. $3=$recv($4)._receiver();
  46947. $ctx1.sendIdx["receiver"]=1;
  46948. $2=$recv($3)._binding();
  46949. $ctx1.sendIdx["binding"]=1;
  46950. $1=$recv($2)._isTempVar();
  46951. $ctx1.sendIdx["isTempVar"]=1;
  46952. self._assert_($1);
  46953. $ctx1.sendIdx["assert:"]=1;
  46954. $15=$recv(ast)._nodes();
  46955. $ctx1.sendIdx["nodes"]=4;
  46956. $14=$recv($15)._first();
  46957. $ctx1.sendIdx["first"]=4;
  46958. $13=$recv($14)._nodes();
  46959. $ctx1.sendIdx["nodes"]=3;
  46960. $12=$recv($13)._first();
  46961. $ctx1.sendIdx["first"]=3;
  46962. $11=$recv($12)._receiver();
  46963. $10=$recv($11)._binding();
  46964. $ctx1.sendIdx["binding"]=2;
  46965. $9=$recv($10)._scope();
  46966. $ctx1.sendIdx["scope"]=1;
  46967. $16=$recv(ast)._scope();
  46968. $ctx1.sendIdx["scope"]=2;
  46969. $8=$recv($9).__eq_eq($16);
  46970. $ctx1.sendIdx["=="]=1;
  46971. self._assert_($8);
  46972. $ctx1.sendIdx["assert:"]=2;
  46973. $27=$recv(ast)._nodes();
  46974. $ctx1.sendIdx["nodes"]=8;
  46975. $26=$recv($27)._first();
  46976. $ctx1.sendIdx["first"]=7;
  46977. $25=$recv($26)._nodes();
  46978. $ctx1.sendIdx["nodes"]=7;
  46979. $24=$recv($25)._last();
  46980. $ctx1.sendIdx["last"]=1;
  46981. $23=$recv($24)._nodes();
  46982. $ctx1.sendIdx["nodes"]=6;
  46983. $22=$recv($23)._first();
  46984. $ctx1.sendIdx["first"]=6;
  46985. $21=$recv($22)._nodes();
  46986. $ctx1.sendIdx["nodes"]=5;
  46987. $20=$recv($21)._first();
  46988. $ctx1.sendIdx["first"]=5;
  46989. $19=$recv($20)._left();
  46990. $ctx1.sendIdx["left"]=1;
  46991. $18=$recv($19)._binding();
  46992. $ctx1.sendIdx["binding"]=3;
  46993. $17=$recv($18)._isTempVar();
  46994. self._assert_($17);
  46995. $ctx1.sendIdx["assert:"]=3;
  46996. $39=$recv(ast)._nodes();
  46997. $ctx1.sendIdx["nodes"]=12;
  46998. $38=$recv($39)._first();
  46999. $ctx1.sendIdx["first"]=10;
  47000. $37=$recv($38)._nodes();
  47001. $ctx1.sendIdx["nodes"]=11;
  47002. $36=$recv($37)._last();
  47003. $ctx1.sendIdx["last"]=2;
  47004. $35=$recv($36)._nodes();
  47005. $ctx1.sendIdx["nodes"]=10;
  47006. $34=$recv($35)._first();
  47007. $ctx1.sendIdx["first"]=9;
  47008. $33=$recv($34)._nodes();
  47009. $ctx1.sendIdx["nodes"]=9;
  47010. $32=$recv($33)._first();
  47011. $ctx1.sendIdx["first"]=8;
  47012. $31=$recv($32)._left();
  47013. $30=$recv($31)._binding();
  47014. $29=$recv($30)._scope();
  47015. $ctx1.sendIdx["scope"]=3;
  47016. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47017. $ctx1.sendIdx["nodes"]=13;
  47018. $41=$recv($42)._last();
  47019. $40=$recv($41)._scope();
  47020. $28=$recv($29).__eq_eq($40);
  47021. self._assert_($28);
  47022. return self;
  47023. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47024. },
  47025. args: [],
  47026. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  47027. referencedClasses: ["Smalltalk"],
  47028. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  47029. }),
  47030. $globals.SemanticAnalyzerTest);
  47031. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  47032. $core.addMethod(
  47033. $core.method({
  47034. selector: "setUp",
  47035. protocol: 'running',
  47036. fn: function (){
  47037. var self=this;
  47038. return $core.withContext(function($ctx1) {
  47039. var $1,$3,$4,$2;
  47040. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  47041. $3=$recv($globals.AIContext)._new();
  47042. $recv($3)._defineLocal_("local");
  47043. $recv($3)._localAt_put_("local",(3));
  47044. $4=$recv($3)._yourself();
  47045. $ctx1.sendIdx["yourself"]=1;
  47046. $2=$4;
  47047. $recv($1)._context_($2);
  47048. self["@analyzer"]=$recv($1)._yourself();
  47049. return self;
  47050. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  47051. },
  47052. args: [],
  47053. 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",
  47054. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  47055. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  47056. }),
  47057. $globals.AISemanticAnalyzerTest);
  47058. $core.addMethod(
  47059. $core.method({
  47060. selector: "testContextVariables",
  47061. protocol: 'tests',
  47062. fn: function (){
  47063. var self=this;
  47064. var src,ast;
  47065. return $core.withContext(function($ctx1) {
  47066. src="foo | a | local + a";
  47067. ast=$recv($globals.Smalltalk)._parse_(src);
  47068. self._shouldnt_raise_((function(){
  47069. return $core.withContext(function($ctx2) {
  47070. return $recv(self["@analyzer"])._visit_(ast);
  47071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47072. }),$globals.UnknownVariableError);
  47073. return self;
  47074. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  47075. },
  47076. args: [],
  47077. 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",
  47078. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47079. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  47080. }),
  47081. $globals.AISemanticAnalyzerTest);
  47082. });
  47083. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47084. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  47085. $core.addPackage('Kernel-Tests');
  47086. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  47087. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47088. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  47089. $core.addMethod(
  47090. $core.method({
  47091. selector: "testAddExtensionMethod",
  47092. protocol: 'tests',
  47093. fn: function (){
  47094. var self=this;
  47095. var method,dirty;
  47096. return $core.withContext(function($ctx1) {
  47097. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  47098. $2=self._class();
  47099. $ctx1.sendIdx["class"]=1;
  47100. $1=$recv($2)._package();
  47101. $ctx1.sendIdx["package"]=1;
  47102. dirty=$recv($1)._isDirty();
  47103. $ctx1.sendIdx["isDirty"]=1;
  47104. $4=self._class();
  47105. $ctx1.sendIdx["class"]=2;
  47106. $3=$recv($4)._package();
  47107. $ctx1.sendIdx["package"]=2;
  47108. $recv($3)._beClean();
  47109. $5=self._class();
  47110. $ctx1.sendIdx["class"]=3;
  47111. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  47112. $8=self._class();
  47113. $ctx1.sendIdx["class"]=4;
  47114. $7=$recv($8)._package();
  47115. $ctx1.sendIdx["package"]=3;
  47116. $6=$recv($7)._isDirty();
  47117. self._deny_($6);
  47118. $9=self._class();
  47119. $ctx1.sendIdx["class"]=5;
  47120. $recv($9)._removeCompiledMethod_(method);
  47121. $10=dirty;
  47122. if($core.assert($10)){
  47123. $recv($recv(self._class())._package())._beDirty();
  47124. };
  47125. return self;
  47126. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  47127. },
  47128. args: [],
  47129. 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 ]",
  47130. referencedClasses: [],
  47131. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  47132. }),
  47133. $globals.AnnouncementSubscriptionTest);
  47134. $core.addMethod(
  47135. $core.method({
  47136. selector: "testHandlesAnnouncement",
  47137. protocol: 'tests',
  47138. fn: function (){
  47139. var self=this;
  47140. var subscription,announcementClass1,announcementClass2,classBuilder;
  47141. return $core.withContext(function($ctx1) {
  47142. var $1,$2;
  47143. classBuilder=$recv($globals.ClassBuilder)._new();
  47144. $ctx1.sendIdx["new"]=1;
  47145. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  47146. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  47147. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  47148. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  47149. self._assert_equals_($1,true);
  47150. $ctx1.sendIdx["assert:equals:"]=1;
  47151. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  47152. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  47153. self._assert_equals_($2,true);
  47154. $ctx1.sendIdx["assert:equals:"]=2;
  47155. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  47156. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  47157. return self;
  47158. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  47159. },
  47160. args: [],
  47161. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  47162. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  47163. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  47164. }),
  47165. $globals.AnnouncementSubscriptionTest);
  47166. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  47167. $core.addMethod(
  47168. $core.method({
  47169. selector: "testOnDo",
  47170. protocol: 'tests',
  47171. fn: function (){
  47172. var self=this;
  47173. var counter,announcer;
  47174. return $core.withContext(function($ctx1) {
  47175. var $1,$2;
  47176. counter=(0);
  47177. announcer=$recv($globals.Announcer)._new();
  47178. $ctx1.sendIdx["new"]=1;
  47179. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  47180. return $core.withContext(function($ctx2) {
  47181. counter=$recv(counter).__plus((1));
  47182. return counter;
  47183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47184. }));
  47185. $1=announcer;
  47186. $2=$recv($globals.SystemAnnouncement)._new();
  47187. $ctx1.sendIdx["new"]=2;
  47188. $recv($1)._announce_($2);
  47189. $ctx1.sendIdx["announce:"]=1;
  47190. self._assert_equals_(counter,(1));
  47191. $ctx1.sendIdx["assert:equals:"]=1;
  47192. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47193. self._assert_equals_(counter,(2));
  47194. return self;
  47195. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47196. },
  47197. args: [],
  47198. 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.",
  47199. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47200. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  47201. }),
  47202. $globals.AnnouncerTest);
  47203. $core.addMethod(
  47204. $core.method({
  47205. selector: "testOnDoFor",
  47206. protocol: 'tests',
  47207. fn: function (){
  47208. var self=this;
  47209. var counter,announcer;
  47210. return $core.withContext(function($ctx1) {
  47211. var $1,$2,$3,$4;
  47212. counter=(0);
  47213. announcer=$recv($globals.Announcer)._new();
  47214. $ctx1.sendIdx["new"]=1;
  47215. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47216. return $core.withContext(function($ctx2) {
  47217. counter=$recv(counter).__plus((1));
  47218. return counter;
  47219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47220. }),self);
  47221. $1=announcer;
  47222. $2=$recv($globals.SystemAnnouncement)._new();
  47223. $ctx1.sendIdx["new"]=2;
  47224. $recv($1)._announce_($2);
  47225. $ctx1.sendIdx["announce:"]=1;
  47226. self._assert_equals_(counter,(1));
  47227. $ctx1.sendIdx["assert:equals:"]=1;
  47228. $3=announcer;
  47229. $4=$recv($globals.SystemAnnouncement)._new();
  47230. $ctx1.sendIdx["new"]=3;
  47231. $recv($3)._announce_($4);
  47232. $ctx1.sendIdx["announce:"]=2;
  47233. self._assert_equals_(counter,(2));
  47234. $ctx1.sendIdx["assert:equals:"]=2;
  47235. $recv(announcer)._unsubscribe_(self);
  47236. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47237. self._assert_equals_(counter,(2));
  47238. return self;
  47239. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47240. },
  47241. args: [],
  47242. 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.",
  47243. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47244. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47245. }),
  47246. $globals.AnnouncerTest);
  47247. $core.addMethod(
  47248. $core.method({
  47249. selector: "testOnDoOnce",
  47250. protocol: 'tests',
  47251. fn: function (){
  47252. var self=this;
  47253. var counter,announcer;
  47254. return $core.withContext(function($ctx1) {
  47255. var $1,$2;
  47256. counter=(0);
  47257. announcer=$recv($globals.Announcer)._new();
  47258. $ctx1.sendIdx["new"]=1;
  47259. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47260. return $core.withContext(function($ctx2) {
  47261. counter=$recv(counter).__plus((1));
  47262. return counter;
  47263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47264. }));
  47265. $1=announcer;
  47266. $2=$recv($globals.SystemAnnouncement)._new();
  47267. $ctx1.sendIdx["new"]=2;
  47268. $recv($1)._announce_($2);
  47269. $ctx1.sendIdx["announce:"]=1;
  47270. self._assert_equals_(counter,(1));
  47271. $ctx1.sendIdx["assert:equals:"]=1;
  47272. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47273. self._assert_equals_(counter,(1));
  47274. return self;
  47275. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47276. },
  47277. args: [],
  47278. 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.",
  47279. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47280. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47281. }),
  47282. $globals.AnnouncerTest);
  47283. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47284. $core.addMethod(
  47285. $core.method({
  47286. selector: "localReturnOnDoCatch",
  47287. protocol: 'fixture',
  47288. fn: function (){
  47289. var self=this;
  47290. return $core.withContext(function($ctx1) {
  47291. var $early={};
  47292. try {
  47293. $recv((function(){
  47294. throw $early=[(2)];
  47295. }))._on_do_($globals.Error,(function(){
  47296. }));
  47297. return (3);
  47298. }
  47299. catch(e) {if(e===$early)return e[0]; throw e}
  47300. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47301. },
  47302. args: [],
  47303. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47304. referencedClasses: ["Error"],
  47305. messageSends: ["on:do:"]
  47306. }),
  47307. $globals.BlockClosureTest);
  47308. $core.addMethod(
  47309. $core.method({
  47310. selector: "localReturnOnDoMiss",
  47311. protocol: 'fixture',
  47312. fn: function (){
  47313. var self=this;
  47314. return $core.withContext(function($ctx1) {
  47315. var $early={};
  47316. try {
  47317. $recv((function(){
  47318. throw $early=[(2)];
  47319. }))._on_do_($globals.Class,(function(){
  47320. }));
  47321. return (3);
  47322. }
  47323. catch(e) {if(e===$early)return e[0]; throw e}
  47324. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47325. },
  47326. args: [],
  47327. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47328. referencedClasses: ["Class"],
  47329. messageSends: ["on:do:"]
  47330. }),
  47331. $globals.BlockClosureTest);
  47332. $core.addMethod(
  47333. $core.method({
  47334. selector: "testCanClearInterval",
  47335. protocol: 'tests',
  47336. fn: function (){
  47337. var self=this;
  47338. return $core.withContext(function($ctx1) {
  47339. self._shouldnt_raise_((function(){
  47340. return $core.withContext(function($ctx2) {
  47341. return $recv($recv((function(){
  47342. return $core.withContext(function($ctx3) {
  47343. return $recv($recv($globals.Error)._new())._signal();
  47344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47345. }))._valueWithInterval_((0)))._clearInterval();
  47346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47347. }),$globals.Error);
  47348. return self;
  47349. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47350. },
  47351. args: [],
  47352. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47353. referencedClasses: ["Error"],
  47354. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47355. }),
  47356. $globals.BlockClosureTest);
  47357. $core.addMethod(
  47358. $core.method({
  47359. selector: "testCanClearTimeout",
  47360. protocol: 'tests',
  47361. fn: function (){
  47362. var self=this;
  47363. return $core.withContext(function($ctx1) {
  47364. self._shouldnt_raise_((function(){
  47365. return $core.withContext(function($ctx2) {
  47366. return $recv($recv((function(){
  47367. return $core.withContext(function($ctx3) {
  47368. return $recv($recv($globals.Error)._new())._signal();
  47369. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47370. }))._valueWithTimeout_((0)))._clearTimeout();
  47371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47372. }),$globals.Error);
  47373. return self;
  47374. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47375. },
  47376. args: [],
  47377. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47378. referencedClasses: ["Error"],
  47379. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47380. }),
  47381. $globals.BlockClosureTest);
  47382. $core.addMethod(
  47383. $core.method({
  47384. selector: "testCompiledSource",
  47385. protocol: 'tests',
  47386. fn: function (){
  47387. var self=this;
  47388. return $core.withContext(function($ctx1) {
  47389. self._assert_($recv($recv((function(){
  47390. return $core.withContext(function($ctx2) {
  47391. return (1).__plus((1));
  47392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47393. }))._compiledSource())._includesSubString_("function"));
  47394. return self;
  47395. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47396. },
  47397. args: [],
  47398. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47399. referencedClasses: [],
  47400. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47401. }),
  47402. $globals.BlockClosureTest);
  47403. $core.addMethod(
  47404. $core.method({
  47405. selector: "testCurrySelf",
  47406. protocol: 'tests',
  47407. fn: function (){
  47408. var self=this;
  47409. var curriedMethod,array;
  47410. return $core.withContext(function($ctx1) {
  47411. curriedMethod=$recv($recv((function(selfarg,x){
  47412. return $core.withContext(function($ctx2) {
  47413. return $recv(selfarg)._at_(x);
  47414. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47415. }))._currySelf())._asCompiledMethod_("foo:");
  47416. array=[(3), (1), (4)];
  47417. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47418. $recv((function(){
  47419. return $core.withContext(function($ctx2) {
  47420. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47422. }))._ensure_((function(){
  47423. return $core.withContext(function($ctx2) {
  47424. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47426. }));
  47427. return self;
  47428. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47429. },
  47430. args: [],
  47431. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  47432. referencedClasses: ["ClassBuilder", "Array"],
  47433. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47434. }),
  47435. $globals.BlockClosureTest);
  47436. $core.addMethod(
  47437. $core.method({
  47438. selector: "testEnsure",
  47439. protocol: 'tests',
  47440. fn: function (){
  47441. var self=this;
  47442. return $core.withContext(function($ctx1) {
  47443. self._assert_equals_($recv((function(){
  47444. return (3);
  47445. }))._ensure_((function(){
  47446. return (4);
  47447. })),(3));
  47448. return self;
  47449. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47450. },
  47451. args: [],
  47452. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47453. referencedClasses: [],
  47454. messageSends: ["assert:equals:", "ensure:"]
  47455. }),
  47456. $globals.BlockClosureTest);
  47457. $core.addMethod(
  47458. $core.method({
  47459. selector: "testEnsureRaises",
  47460. protocol: 'tests',
  47461. fn: function (){
  47462. var self=this;
  47463. return $core.withContext(function($ctx1) {
  47464. self._should_raise_((function(){
  47465. return $core.withContext(function($ctx2) {
  47466. return $recv((function(){
  47467. return $core.withContext(function($ctx3) {
  47468. return $recv($recv($globals.Error)._new())._signal();
  47469. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47470. }))._ensure_((function(){
  47471. return true;
  47472. }));
  47473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47474. }),$globals.Error);
  47475. return self;
  47476. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47477. },
  47478. args: [],
  47479. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47480. referencedClasses: ["Error"],
  47481. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47482. }),
  47483. $globals.BlockClosureTest);
  47484. $core.addMethod(
  47485. $core.method({
  47486. selector: "testExceptionSemantics",
  47487. protocol: 'tests',
  47488. fn: function (){
  47489. var self=this;
  47490. return $core.withContext(function($ctx1) {
  47491. self._timeout_((100));
  47492. $recv(self._async_((function(){
  47493. return $core.withContext(function($ctx2) {
  47494. return $recv((function(){
  47495. return $core.withContext(function($ctx3) {
  47496. self._assert_(true);
  47497. $recv($globals.Error)._signal();
  47498. self._deny_(true);
  47499. return self._finished();
  47500. $ctx3.sendIdx["finished"]=1;
  47501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47502. }))._on_do_($globals.Error,(function(ex){
  47503. return $core.withContext(function($ctx3) {
  47504. return self._finished();
  47505. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47506. }));
  47507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47508. })))._valueWithTimeout_((0));
  47509. return self;
  47510. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47511. },
  47512. args: [],
  47513. 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",
  47514. referencedClasses: ["Error"],
  47515. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47516. }),
  47517. $globals.BlockClosureTest);
  47518. $core.addMethod(
  47519. $core.method({
  47520. selector: "testLocalReturnOnDoCatch",
  47521. protocol: 'tests',
  47522. fn: function (){
  47523. var self=this;
  47524. return $core.withContext(function($ctx1) {
  47525. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47526. return self;
  47527. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47528. },
  47529. args: [],
  47530. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47531. referencedClasses: [],
  47532. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47533. }),
  47534. $globals.BlockClosureTest);
  47535. $core.addMethod(
  47536. $core.method({
  47537. selector: "testLocalReturnOnDoMiss",
  47538. protocol: 'tests',
  47539. fn: function (){
  47540. var self=this;
  47541. return $core.withContext(function($ctx1) {
  47542. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47543. return self;
  47544. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47545. },
  47546. args: [],
  47547. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47548. referencedClasses: [],
  47549. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47550. }),
  47551. $globals.BlockClosureTest);
  47552. $core.addMethod(
  47553. $core.method({
  47554. selector: "testNewWithValues",
  47555. protocol: 'tests',
  47556. fn: function (){
  47557. var self=this;
  47558. return $core.withContext(function($ctx1) {
  47559. function TestConstructor(arg1, arg2, arg3) {}
  47560. TestConstructor.prototype.name = 'theTestPrototype';
  47561. var wrappedConstructor = $recv(TestConstructor);
  47562. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  47563. self._assert_(result instanceof TestConstructor);
  47564. self._assert_equals_(result.name, 'theTestPrototype');
  47565. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  47566. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  47567. return self;
  47568. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47569. },
  47570. args: [],
  47571. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>",
  47572. referencedClasses: [],
  47573. messageSends: []
  47574. }),
  47575. $globals.BlockClosureTest);
  47576. $core.addMethod(
  47577. $core.method({
  47578. selector: "testNumArgs",
  47579. protocol: 'tests',
  47580. fn: function (){
  47581. var self=this;
  47582. return $core.withContext(function($ctx1) {
  47583. var $1;
  47584. $1=$recv((function(){
  47585. }))._numArgs();
  47586. $ctx1.sendIdx["numArgs"]=1;
  47587. self._assert_equals_($1,(0));
  47588. $ctx1.sendIdx["assert:equals:"]=1;
  47589. self._assert_equals_($recv((function(a,b){
  47590. }))._numArgs(),(2));
  47591. return self;
  47592. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47593. },
  47594. args: [],
  47595. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47596. referencedClasses: [],
  47597. messageSends: ["assert:equals:", "numArgs"]
  47598. }),
  47599. $globals.BlockClosureTest);
  47600. $core.addMethod(
  47601. $core.method({
  47602. selector: "testOnDo",
  47603. protocol: 'tests',
  47604. fn: function (){
  47605. var self=this;
  47606. return $core.withContext(function($ctx1) {
  47607. self._assert_($recv((function(){
  47608. return $core.withContext(function($ctx2) {
  47609. return $recv($recv($globals.Error)._new())._signal();
  47610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47611. }))._on_do_($globals.Error,(function(ex){
  47612. return true;
  47613. })));
  47614. return self;
  47615. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47616. },
  47617. args: [],
  47618. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47619. referencedClasses: ["Error"],
  47620. messageSends: ["assert:", "on:do:", "signal", "new"]
  47621. }),
  47622. $globals.BlockClosureTest);
  47623. $core.addMethod(
  47624. $core.method({
  47625. selector: "testValue",
  47626. protocol: 'tests',
  47627. fn: function (){
  47628. var self=this;
  47629. return $core.withContext(function($ctx1) {
  47630. var $1;
  47631. $1=$recv((function(){
  47632. return $core.withContext(function($ctx2) {
  47633. return (1).__plus((1));
  47634. $ctx2.sendIdx["+"]=1;
  47635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47636. }))._value();
  47637. $ctx1.sendIdx["value"]=1;
  47638. self._assert_equals_($1,(2));
  47639. $ctx1.sendIdx["assert:equals:"]=1;
  47640. self._assert_equals_($recv((function(x){
  47641. return $core.withContext(function($ctx2) {
  47642. return $recv(x).__plus((1));
  47643. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47644. }))._value_((2)),(3));
  47645. $ctx1.sendIdx["assert:equals:"]=2;
  47646. self._assert_equals_($recv((function(x,y){
  47647. return $core.withContext(function($ctx2) {
  47648. return $recv(x).__star(y);
  47649. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47650. }))._value_value_((2),(4)),(8));
  47651. $ctx1.sendIdx["assert:equals:"]=3;
  47652. self._assert_equals_($recv((function(a,b,c){
  47653. return (1);
  47654. }))._value(),(1));
  47655. return self;
  47656. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47657. },
  47658. args: [],
  47659. 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",
  47660. referencedClasses: [],
  47661. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47662. }),
  47663. $globals.BlockClosureTest);
  47664. $core.addMethod(
  47665. $core.method({
  47666. selector: "testValueWithPossibleArguments",
  47667. protocol: 'tests',
  47668. fn: function (){
  47669. var self=this;
  47670. return $core.withContext(function($ctx1) {
  47671. var $1,$2;
  47672. $1=$recv((function(){
  47673. return (1);
  47674. }))._valueWithPossibleArguments_([(3), (4)]);
  47675. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47676. self._assert_equals_($1,(1));
  47677. $ctx1.sendIdx["assert:equals:"]=1;
  47678. $2=$recv((function(a){
  47679. return $core.withContext(function($ctx2) {
  47680. return $recv(a).__plus((4));
  47681. $ctx2.sendIdx["+"]=1;
  47682. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47683. }))._valueWithPossibleArguments_([(3), (4)]);
  47684. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47685. self._assert_equals_($2,(7));
  47686. $ctx1.sendIdx["assert:equals:"]=2;
  47687. self._assert_equals_($recv((function(a,b){
  47688. return $core.withContext(function($ctx2) {
  47689. return $recv(a).__plus(b);
  47690. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47691. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47692. return self;
  47693. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47694. },
  47695. args: [],
  47696. 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.",
  47697. referencedClasses: [],
  47698. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47699. }),
  47700. $globals.BlockClosureTest);
  47701. $core.addMethod(
  47702. $core.method({
  47703. selector: "testWhileFalse",
  47704. protocol: 'tests',
  47705. fn: function (){
  47706. var self=this;
  47707. var i;
  47708. return $core.withContext(function($ctx1) {
  47709. i=(0);
  47710. $recv((function(){
  47711. return $core.withContext(function($ctx2) {
  47712. return $recv(i).__gt((5));
  47713. $ctx2.sendIdx[">"]=1;
  47714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47715. }))._whileFalse_((function(){
  47716. return $core.withContext(function($ctx2) {
  47717. i=$recv(i).__plus((1));
  47718. $ctx2.sendIdx["+"]=1;
  47719. return i;
  47720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47721. }));
  47722. self._assert_equals_(i,(6));
  47723. $ctx1.sendIdx["assert:equals:"]=1;
  47724. i=(0);
  47725. $recv((function(){
  47726. return $core.withContext(function($ctx2) {
  47727. i=$recv(i).__plus((1));
  47728. i;
  47729. return $recv(i).__gt((5));
  47730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47731. }))._whileFalse();
  47732. self._assert_equals_(i,(6));
  47733. return self;
  47734. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47735. },
  47736. args: [],
  47737. 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",
  47738. referencedClasses: [],
  47739. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47740. }),
  47741. $globals.BlockClosureTest);
  47742. $core.addMethod(
  47743. $core.method({
  47744. selector: "testWhileTrue",
  47745. protocol: 'tests',
  47746. fn: function (){
  47747. var self=this;
  47748. var i;
  47749. return $core.withContext(function($ctx1) {
  47750. i=(0);
  47751. $recv((function(){
  47752. return $core.withContext(function($ctx2) {
  47753. return $recv(i).__lt((5));
  47754. $ctx2.sendIdx["<"]=1;
  47755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47756. }))._whileTrue_((function(){
  47757. return $core.withContext(function($ctx2) {
  47758. i=$recv(i).__plus((1));
  47759. $ctx2.sendIdx["+"]=1;
  47760. return i;
  47761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47762. }));
  47763. self._assert_equals_(i,(5));
  47764. $ctx1.sendIdx["assert:equals:"]=1;
  47765. i=(0);
  47766. $recv((function(){
  47767. return $core.withContext(function($ctx2) {
  47768. i=$recv(i).__plus((1));
  47769. i;
  47770. return $recv(i).__lt((5));
  47771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47772. }))._whileTrue();
  47773. self._assert_equals_(i,(5));
  47774. return self;
  47775. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47776. },
  47777. args: [],
  47778. 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",
  47779. referencedClasses: [],
  47780. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47781. }),
  47782. $globals.BlockClosureTest);
  47783. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47784. $core.addMethod(
  47785. $core.method({
  47786. selector: "testEquality",
  47787. protocol: 'tests',
  47788. fn: function (){
  47789. var self=this;
  47790. return $core.withContext(function($ctx1) {
  47791. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47792. $1=(0).__eq(false);
  47793. $ctx1.sendIdx["="]=1;
  47794. self._deny_($1);
  47795. $ctx1.sendIdx["deny:"]=1;
  47796. $2=false.__eq((0));
  47797. $ctx1.sendIdx["="]=2;
  47798. self._deny_($2);
  47799. $ctx1.sendIdx["deny:"]=2;
  47800. $3="".__eq(false);
  47801. $ctx1.sendIdx["="]=3;
  47802. self._deny_($3);
  47803. $ctx1.sendIdx["deny:"]=3;
  47804. $4=false.__eq("");
  47805. $ctx1.sendIdx["="]=4;
  47806. self._deny_($4);
  47807. $ctx1.sendIdx["deny:"]=4;
  47808. $5=true.__eq(true);
  47809. $ctx1.sendIdx["="]=5;
  47810. self._assert_($5);
  47811. $ctx1.sendIdx["assert:"]=1;
  47812. $6=false.__eq(true);
  47813. $ctx1.sendIdx["="]=6;
  47814. self._deny_($6);
  47815. $ctx1.sendIdx["deny:"]=5;
  47816. $7=true.__eq(false);
  47817. $ctx1.sendIdx["="]=7;
  47818. self._deny_($7);
  47819. $8=false.__eq(false);
  47820. $ctx1.sendIdx["="]=8;
  47821. self._assert_($8);
  47822. $ctx1.sendIdx["assert:"]=2;
  47823. $10=true._yourself();
  47824. $ctx1.sendIdx["yourself"]=1;
  47825. $9=$recv($10).__eq(true);
  47826. $ctx1.sendIdx["="]=9;
  47827. self._assert_($9);
  47828. $ctx1.sendIdx["assert:"]=3;
  47829. $12=true._yourself();
  47830. $ctx1.sendIdx["yourself"]=2;
  47831. $11=$recv($12).__eq(true._yourself());
  47832. self._assert_($11);
  47833. return self;
  47834. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47835. },
  47836. args: [],
  47837. 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)",
  47838. referencedClasses: [],
  47839. messageSends: ["deny:", "=", "assert:", "yourself"]
  47840. }),
  47841. $globals.BooleanTest);
  47842. $core.addMethod(
  47843. $core.method({
  47844. selector: "testIdentity",
  47845. protocol: 'tests',
  47846. fn: function (){
  47847. var self=this;
  47848. return $core.withContext(function($ctx1) {
  47849. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47850. $1=(0).__eq_eq(false);
  47851. $ctx1.sendIdx["=="]=1;
  47852. self._deny_($1);
  47853. $ctx1.sendIdx["deny:"]=1;
  47854. $2=false.__eq_eq((0));
  47855. $ctx1.sendIdx["=="]=2;
  47856. self._deny_($2);
  47857. $ctx1.sendIdx["deny:"]=2;
  47858. $3="".__eq_eq(false);
  47859. $ctx1.sendIdx["=="]=3;
  47860. self._deny_($3);
  47861. $ctx1.sendIdx["deny:"]=3;
  47862. $4=false.__eq_eq("");
  47863. $ctx1.sendIdx["=="]=4;
  47864. self._deny_($4);
  47865. $ctx1.sendIdx["deny:"]=4;
  47866. $5=true.__eq_eq(true);
  47867. $ctx1.sendIdx["=="]=5;
  47868. self._assert_($5);
  47869. $ctx1.sendIdx["assert:"]=1;
  47870. $6=false.__eq_eq(true);
  47871. $ctx1.sendIdx["=="]=6;
  47872. self._deny_($6);
  47873. $ctx1.sendIdx["deny:"]=5;
  47874. $7=true.__eq_eq(false);
  47875. $ctx1.sendIdx["=="]=7;
  47876. self._deny_($7);
  47877. $8=false.__eq_eq(false);
  47878. $ctx1.sendIdx["=="]=8;
  47879. self._assert_($8);
  47880. $ctx1.sendIdx["assert:"]=2;
  47881. $10=true._yourself();
  47882. $ctx1.sendIdx["yourself"]=1;
  47883. $9=$recv($10).__eq_eq(true);
  47884. $ctx1.sendIdx["=="]=9;
  47885. self._assert_($9);
  47886. $ctx1.sendIdx["assert:"]=3;
  47887. $12=true._yourself();
  47888. $ctx1.sendIdx["yourself"]=2;
  47889. $11=$recv($12).__eq_eq(true._yourself());
  47890. self._assert_($11);
  47891. return self;
  47892. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47893. },
  47894. args: [],
  47895. 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",
  47896. referencedClasses: [],
  47897. messageSends: ["deny:", "==", "assert:", "yourself"]
  47898. }),
  47899. $globals.BooleanTest);
  47900. $core.addMethod(
  47901. $core.method({
  47902. selector: "testIfTrueIfFalse",
  47903. protocol: 'tests',
  47904. fn: function (){
  47905. var self=this;
  47906. return $core.withContext(function($ctx1) {
  47907. var $1,$2,$3,$4,$5,$6,$7,$8;
  47908. if($core.assert(true)){
  47909. $1="alternative block";
  47910. };
  47911. self._assert_equals_($1,"alternative block");
  47912. $ctx1.sendIdx["assert:equals:"]=1;
  47913. if(!$core.assert(true)){
  47914. $2="alternative block";
  47915. };
  47916. self._assert_equals_($2,nil);
  47917. $ctx1.sendIdx["assert:equals:"]=2;
  47918. if($core.assert(false)){
  47919. $3="alternative block";
  47920. };
  47921. self._assert_equals_($3,nil);
  47922. $ctx1.sendIdx["assert:equals:"]=3;
  47923. if(!$core.assert(false)){
  47924. $4="alternative block";
  47925. };
  47926. self._assert_equals_($4,"alternative block");
  47927. $ctx1.sendIdx["assert:equals:"]=4;
  47928. if($core.assert(false)){
  47929. $5="alternative block";
  47930. } else {
  47931. $5="alternative block2";
  47932. };
  47933. self._assert_equals_($5,"alternative block2");
  47934. $ctx1.sendIdx["assert:equals:"]=5;
  47935. if($core.assert(false)){
  47936. $6="alternative block2";
  47937. } else {
  47938. $6="alternative block";
  47939. };
  47940. self._assert_equals_($6,"alternative block");
  47941. $ctx1.sendIdx["assert:equals:"]=6;
  47942. if($core.assert(true)){
  47943. $7="alternative block";
  47944. } else {
  47945. $7="alternative block2";
  47946. };
  47947. self._assert_equals_($7,"alternative block");
  47948. $ctx1.sendIdx["assert:equals:"]=7;
  47949. if($core.assert(true)){
  47950. $8="alternative block2";
  47951. } else {
  47952. $8="alternative block";
  47953. };
  47954. self._assert_equals_($8,"alternative block2");
  47955. return self;
  47956. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47957. },
  47958. args: [],
  47959. 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'.",
  47960. referencedClasses: [],
  47961. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47962. }),
  47963. $globals.BooleanTest);
  47964. $core.addMethod(
  47965. $core.method({
  47966. selector: "testIfTrueIfFalseWithBoxing",
  47967. protocol: 'tests',
  47968. fn: function (){
  47969. var self=this;
  47970. return $core.withContext(function($ctx1) {
  47971. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47972. $2=true._yourself();
  47973. $ctx1.sendIdx["yourself"]=1;
  47974. if($core.assert($2)){
  47975. $1="alternative block";
  47976. };
  47977. self._assert_equals_($1,"alternative block");
  47978. $ctx1.sendIdx["assert:equals:"]=1;
  47979. $4=true._yourself();
  47980. $ctx1.sendIdx["yourself"]=2;
  47981. if(!$core.assert($4)){
  47982. $3="alternative block";
  47983. };
  47984. self._assert_equals_($3,nil);
  47985. $ctx1.sendIdx["assert:equals:"]=2;
  47986. $6=false._yourself();
  47987. $ctx1.sendIdx["yourself"]=3;
  47988. if($core.assert($6)){
  47989. $5="alternative block";
  47990. };
  47991. self._assert_equals_($5,nil);
  47992. $ctx1.sendIdx["assert:equals:"]=3;
  47993. $8=false._yourself();
  47994. $ctx1.sendIdx["yourself"]=4;
  47995. if(!$core.assert($8)){
  47996. $7="alternative block";
  47997. };
  47998. self._assert_equals_($7,"alternative block");
  47999. $ctx1.sendIdx["assert:equals:"]=4;
  48000. $10=false._yourself();
  48001. $ctx1.sendIdx["yourself"]=5;
  48002. if($core.assert($10)){
  48003. $9="alternative block";
  48004. } else {
  48005. $9="alternative block2";
  48006. };
  48007. self._assert_equals_($9,"alternative block2");
  48008. $ctx1.sendIdx["assert:equals:"]=5;
  48009. $12=false._yourself();
  48010. $ctx1.sendIdx["yourself"]=6;
  48011. if($core.assert($12)){
  48012. $11="alternative block2";
  48013. } else {
  48014. $11="alternative block";
  48015. };
  48016. self._assert_equals_($11,"alternative block");
  48017. $ctx1.sendIdx["assert:equals:"]=6;
  48018. $14=true._yourself();
  48019. $ctx1.sendIdx["yourself"]=7;
  48020. if($core.assert($14)){
  48021. $13="alternative block";
  48022. } else {
  48023. $13="alternative block2";
  48024. };
  48025. self._assert_equals_($13,"alternative block");
  48026. $ctx1.sendIdx["assert:equals:"]=7;
  48027. $16=true._yourself();
  48028. if($core.assert($16)){
  48029. $15="alternative block2";
  48030. } else {
  48031. $15="alternative block";
  48032. };
  48033. self._assert_equals_($15,"alternative block2");
  48034. return self;
  48035. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  48036. },
  48037. args: [],
  48038. 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'.",
  48039. referencedClasses: [],
  48040. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  48041. }),
  48042. $globals.BooleanTest);
  48043. $core.addMethod(
  48044. $core.method({
  48045. selector: "testLogic",
  48046. protocol: 'tests',
  48047. fn: function (){
  48048. var self=this;
  48049. return $core.withContext(function($ctx1) {
  48050. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  48051. $1=true.__and(true);
  48052. $ctx1.sendIdx["&"]=1;
  48053. self._assert_($1);
  48054. $ctx1.sendIdx["assert:"]=1;
  48055. $2=true.__and(false);
  48056. $ctx1.sendIdx["&"]=2;
  48057. self._deny_($2);
  48058. $ctx1.sendIdx["deny:"]=1;
  48059. $3=false.__and(true);
  48060. $ctx1.sendIdx["&"]=3;
  48061. self._deny_($3);
  48062. $ctx1.sendIdx["deny:"]=2;
  48063. $5=false.__and(false);
  48064. $ctx1.sendIdx["&"]=4;
  48065. $4=self._deny_($5);
  48066. $ctx1.sendIdx["deny:"]=3;
  48067. $6=true.__or(true);
  48068. $ctx1.sendIdx["|"]=1;
  48069. self._assert_($6);
  48070. $ctx1.sendIdx["assert:"]=2;
  48071. $7=true.__or(false);
  48072. $ctx1.sendIdx["|"]=2;
  48073. self._assert_($7);
  48074. $ctx1.sendIdx["assert:"]=3;
  48075. $8=false.__or(true);
  48076. $ctx1.sendIdx["|"]=3;
  48077. self._assert_($8);
  48078. $ctx1.sendIdx["assert:"]=4;
  48079. $10=false.__or(false);
  48080. $ctx1.sendIdx["|"]=4;
  48081. $9=self._deny_($10);
  48082. $ctx1.sendIdx["deny:"]=4;
  48083. $12=(1).__gt((0));
  48084. $ctx1.sendIdx[">"]=1;
  48085. $11=true.__and($12);
  48086. $ctx1.sendIdx["&"]=5;
  48087. self._assert_($11);
  48088. $ctx1.sendIdx["assert:"]=5;
  48089. $14=(1).__gt((0));
  48090. $ctx1.sendIdx[">"]=2;
  48091. $13=$recv($14).__and(false);
  48092. $ctx1.sendIdx["&"]=6;
  48093. self._deny_($13);
  48094. $ctx1.sendIdx["deny:"]=5;
  48095. $16=(1).__gt((0));
  48096. $ctx1.sendIdx[">"]=3;
  48097. $17=(1).__gt((2));
  48098. $ctx1.sendIdx[">"]=4;
  48099. $15=$recv($16).__and($17);
  48100. self._deny_($15);
  48101. $19=(1).__gt((0));
  48102. $ctx1.sendIdx[">"]=5;
  48103. $18=false.__or($19);
  48104. $ctx1.sendIdx["|"]=5;
  48105. self._assert_($18);
  48106. $ctx1.sendIdx["assert:"]=6;
  48107. $21=(1).__gt((0));
  48108. $ctx1.sendIdx[">"]=6;
  48109. $20=$recv($21).__or(false);
  48110. $ctx1.sendIdx["|"]=6;
  48111. self._assert_($20);
  48112. $ctx1.sendIdx["assert:"]=7;
  48113. $23=(1).__gt((0));
  48114. $ctx1.sendIdx[">"]=7;
  48115. $22=$recv($23).__or((1).__gt((2)));
  48116. self._assert_($22);
  48117. return self;
  48118. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  48119. },
  48120. args: [],
  48121. 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))",
  48122. referencedClasses: [],
  48123. messageSends: ["assert:", "&", "deny:", "|", ">"]
  48124. }),
  48125. $globals.BooleanTest);
  48126. $core.addMethod(
  48127. $core.method({
  48128. selector: "testLogicKeywords",
  48129. protocol: 'tests',
  48130. fn: function (){
  48131. var self=this;
  48132. return $core.withContext(function($ctx1) {
  48133. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  48134. $1=true._and_((function(){
  48135. return true;
  48136. }));
  48137. $ctx1.sendIdx["and:"]=1;
  48138. self._assert_($1);
  48139. $ctx1.sendIdx["assert:"]=1;
  48140. $2=true._and_((function(){
  48141. return false;
  48142. }));
  48143. $ctx1.sendIdx["and:"]=2;
  48144. self._deny_($2);
  48145. $ctx1.sendIdx["deny:"]=1;
  48146. $3=false._and_((function(){
  48147. return true;
  48148. }));
  48149. $ctx1.sendIdx["and:"]=3;
  48150. self._deny_($3);
  48151. $ctx1.sendIdx["deny:"]=2;
  48152. $5=false._and_((function(){
  48153. return false;
  48154. }));
  48155. $ctx1.sendIdx["and:"]=4;
  48156. $4=self._deny_($5);
  48157. $ctx1.sendIdx["deny:"]=3;
  48158. $6=true._or_((function(){
  48159. return true;
  48160. }));
  48161. $ctx1.sendIdx["or:"]=1;
  48162. self._assert_($6);
  48163. $ctx1.sendIdx["assert:"]=2;
  48164. $7=true._or_((function(){
  48165. return false;
  48166. }));
  48167. $ctx1.sendIdx["or:"]=2;
  48168. self._assert_($7);
  48169. $ctx1.sendIdx["assert:"]=3;
  48170. $8=false._or_((function(){
  48171. return true;
  48172. }));
  48173. $ctx1.sendIdx["or:"]=3;
  48174. self._assert_($8);
  48175. $ctx1.sendIdx["assert:"]=4;
  48176. $10=false._or_((function(){
  48177. return false;
  48178. }));
  48179. $ctx1.sendIdx["or:"]=4;
  48180. $9=self._deny_($10);
  48181. $ctx1.sendIdx["deny:"]=4;
  48182. $11=true._and_((function(){
  48183. return $core.withContext(function($ctx2) {
  48184. return (1).__gt((0));
  48185. $ctx2.sendIdx[">"]=1;
  48186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  48187. }));
  48188. $ctx1.sendIdx["and:"]=5;
  48189. self._assert_($11);
  48190. $ctx1.sendIdx["assert:"]=5;
  48191. $13=(1).__gt((0));
  48192. $ctx1.sendIdx[">"]=2;
  48193. $12=$recv($13)._and_((function(){
  48194. return false;
  48195. }));
  48196. $ctx1.sendIdx["and:"]=6;
  48197. self._deny_($12);
  48198. $ctx1.sendIdx["deny:"]=5;
  48199. $15=(1).__gt((0));
  48200. $ctx1.sendIdx[">"]=3;
  48201. $14=$recv($15)._and_((function(){
  48202. return $core.withContext(function($ctx2) {
  48203. return (1).__gt((2));
  48204. $ctx2.sendIdx[">"]=4;
  48205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  48206. }));
  48207. self._deny_($14);
  48208. $16=false._or_((function(){
  48209. return $core.withContext(function($ctx2) {
  48210. return (1).__gt((0));
  48211. $ctx2.sendIdx[">"]=5;
  48212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  48213. }));
  48214. $ctx1.sendIdx["or:"]=5;
  48215. self._assert_($16);
  48216. $ctx1.sendIdx["assert:"]=6;
  48217. $18=(1).__gt((0));
  48218. $ctx1.sendIdx[">"]=6;
  48219. $17=$recv($18)._or_((function(){
  48220. return false;
  48221. }));
  48222. $ctx1.sendIdx["or:"]=6;
  48223. self._assert_($17);
  48224. $ctx1.sendIdx["assert:"]=7;
  48225. $20=(1).__gt((0));
  48226. $ctx1.sendIdx[">"]=7;
  48227. $19=$recv($20)._or_((function(){
  48228. return $core.withContext(function($ctx2) {
  48229. return (1).__gt((2));
  48230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48231. }));
  48232. self._assert_($19);
  48233. return self;
  48234. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48235. },
  48236. args: [],
  48237. 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 ])",
  48238. referencedClasses: [],
  48239. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48240. }),
  48241. $globals.BooleanTest);
  48242. $core.addMethod(
  48243. $core.method({
  48244. selector: "testNonBooleanError",
  48245. protocol: 'tests',
  48246. fn: function (){
  48247. var self=this;
  48248. return $core.withContext(function($ctx1) {
  48249. self._should_raise_((function(){
  48250. return $core.withContext(function($ctx2) {
  48251. if($core.assert("")){
  48252. } else {
  48253. };
  48254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48255. }),$globals.NonBooleanReceiver);
  48256. return self;
  48257. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48258. },
  48259. args: [],
  48260. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48261. referencedClasses: ["NonBooleanReceiver"],
  48262. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48263. }),
  48264. $globals.BooleanTest);
  48265. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48266. $core.addMethod(
  48267. $core.method({
  48268. selector: "setUp",
  48269. protocol: 'running',
  48270. fn: function (){
  48271. var self=this;
  48272. return $core.withContext(function($ctx1) {
  48273. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48274. return self;
  48275. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48276. },
  48277. args: [],
  48278. source: "setUp\x0a\x09builder := ClassBuilder new",
  48279. referencedClasses: ["ClassBuilder"],
  48280. messageSends: ["new"]
  48281. }),
  48282. $globals.ClassBuilderTest);
  48283. $core.addMethod(
  48284. $core.method({
  48285. selector: "tearDown",
  48286. protocol: 'running',
  48287. fn: function (){
  48288. var self=this;
  48289. return $core.withContext(function($ctx1) {
  48290. var $1,$receiver;
  48291. $1=self["@theClass"];
  48292. if(($receiver = $1) == null || $receiver.isNil){
  48293. $1;
  48294. } else {
  48295. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48296. self["@theClass"]=nil;
  48297. self["@theClass"];
  48298. };
  48299. return self;
  48300. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48301. },
  48302. args: [],
  48303. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48304. referencedClasses: ["Smalltalk"],
  48305. messageSends: ["ifNotNil:", "removeClass:"]
  48306. }),
  48307. $globals.ClassBuilderTest);
  48308. $core.addMethod(
  48309. $core.method({
  48310. selector: "testClassCopy",
  48311. protocol: 'tests',
  48312. fn: function (){
  48313. var self=this;
  48314. return $core.withContext(function($ctx1) {
  48315. var $2,$1,$4,$3,$6,$5,$8,$7;
  48316. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48317. $2=$recv(self["@theClass"])._superclass();
  48318. $ctx1.sendIdx["superclass"]=1;
  48319. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48320. $ctx1.sendIdx["=="]=1;
  48321. self._assert_($1);
  48322. $ctx1.sendIdx["assert:"]=1;
  48323. $4=$recv(self["@theClass"])._instanceVariableNames();
  48324. $ctx1.sendIdx["instanceVariableNames"]=1;
  48325. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48326. $ctx1.sendIdx["=="]=2;
  48327. self._assert_($3);
  48328. $ctx1.sendIdx["assert:"]=2;
  48329. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48330. $ctx1.sendIdx["assert:equals:"]=1;
  48331. $6=$recv(self["@theClass"])._package();
  48332. $ctx1.sendIdx["package"]=1;
  48333. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48334. self._assert_($5);
  48335. $8=$recv(self["@theClass"])._methodDictionary();
  48336. $ctx1.sendIdx["methodDictionary"]=1;
  48337. $7=$recv($8)._keys();
  48338. $ctx1.sendIdx["keys"]=1;
  48339. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48340. return self;
  48341. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48342. },
  48343. args: [],
  48344. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  48345. referencedClasses: ["ObjectMock"],
  48346. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48347. }),
  48348. $globals.ClassBuilderTest);
  48349. $core.addMethod(
  48350. $core.method({
  48351. selector: "testClassMigration",
  48352. protocol: 'tests',
  48353. fn: function (){
  48354. var self=this;
  48355. var instance,oldClass;
  48356. return $core.withContext(function($ctx1) {
  48357. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48358. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48359. $2=$recv($globals.Smalltalk)._globals();
  48360. $ctx1.sendIdx["globals"]=1;
  48361. $1=$recv($2)._at_("ObjectMock2");
  48362. $ctx1.sendIdx["at:"]=1;
  48363. instance=$recv($1)._new();
  48364. $4=$recv($globals.Smalltalk)._globals();
  48365. $ctx1.sendIdx["globals"]=2;
  48366. $3=$recv($4)._at_("ObjectMock2");
  48367. $ctx1.sendIdx["at:"]=2;
  48368. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48369. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48370. $ctx1.sendIdx["=="]=1;
  48371. self._deny_($5);
  48372. $ctx1.sendIdx["deny:"]=1;
  48373. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48374. $ctx1.sendIdx["=="]=2;
  48375. self._assert_($6);
  48376. $ctx1.sendIdx["assert:"]=1;
  48377. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48378. $ctx1.sendIdx["assert:"]=2;
  48379. $7=$recv($globals.ObjectMock2)._selectors();
  48380. $ctx1.sendIdx["selectors"]=1;
  48381. self._assert_equals_($7,$recv(oldClass)._selectors());
  48382. $ctx1.sendIdx["assert:equals:"]=1;
  48383. $8=$recv($globals.ObjectMock2)._comment();
  48384. $ctx1.sendIdx["comment"]=1;
  48385. self._assert_equals_($8,$recv(oldClass)._comment());
  48386. $ctx1.sendIdx["assert:equals:"]=2;
  48387. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48388. $ctx1.sendIdx["name"]=1;
  48389. self._assert_equals_($9,"Kernel-Tests");
  48390. $11=$recv(instance)._class();
  48391. $ctx1.sendIdx["class"]=1;
  48392. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48393. self._deny_($10);
  48394. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48395. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48396. return self;
  48397. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48398. },
  48399. args: [],
  48400. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  48401. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48402. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48403. }),
  48404. $globals.ClassBuilderTest);
  48405. $core.addMethod(
  48406. $core.method({
  48407. selector: "testClassMigrationWithClassInstanceVariables",
  48408. protocol: 'tests',
  48409. fn: function (){
  48410. var self=this;
  48411. return $core.withContext(function($ctx1) {
  48412. var $1;
  48413. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48414. $1=$recv($globals.ObjectMock2)._class();
  48415. $ctx1.sendIdx["class"]=1;
  48416. $recv($1)._instanceVariableNames_("foo bar");
  48417. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48418. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48419. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48420. return self;
  48421. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48422. },
  48423. args: [],
  48424. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  48425. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48426. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48427. }),
  48428. $globals.ClassBuilderTest);
  48429. $core.addMethod(
  48430. $core.method({
  48431. selector: "testClassMigrationWithSubclasses",
  48432. protocol: 'tests',
  48433. fn: function (){
  48434. var self=this;
  48435. return $core.withContext(function($ctx1) {
  48436. var $2,$1,$4,$3;
  48437. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48438. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48439. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48440. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48441. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48442. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48443. $2=$recv($globals.ObjectMock)._subclasses();
  48444. $ctx1.sendIdx["subclasses"]=1;
  48445. $1=$recv($2)._includes_($globals.ObjectMock2);
  48446. $ctx1.sendIdx["includes:"]=1;
  48447. self._assert_($1);
  48448. $ctx1.sendIdx["assert:"]=1;
  48449. $4=$recv($globals.ObjectMock2)._subclasses();
  48450. $ctx1.sendIdx["subclasses"]=2;
  48451. $3=$recv($4)._includes_($globals.ObjectMock3);
  48452. $ctx1.sendIdx["includes:"]=2;
  48453. self._assert_($3);
  48454. $ctx1.sendIdx["assert:"]=2;
  48455. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48456. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48457. return $core.withContext(function($ctx2) {
  48458. return $recv($globals.Smalltalk)._removeClass_(each);
  48459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48460. }));
  48461. return self;
  48462. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48463. },
  48464. args: [],
  48465. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  48466. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48467. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48468. }),
  48469. $globals.ClassBuilderTest);
  48470. $core.addMethod(
  48471. $core.method({
  48472. selector: "testInstanceVariableNames",
  48473. protocol: 'tests',
  48474. fn: function (){
  48475. var self=this;
  48476. return $core.withContext(function($ctx1) {
  48477. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48478. return self;
  48479. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48480. },
  48481. args: [],
  48482. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48483. referencedClasses: [],
  48484. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48485. }),
  48486. $globals.ClassBuilderTest);
  48487. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48488. $core.addMethod(
  48489. $core.method({
  48490. selector: "jsConstructor",
  48491. protocol: 'running',
  48492. fn: function (){
  48493. var self=this;
  48494. return $core.withContext(function($ctx1) {
  48495. function Foo(){}
  48496. Foo.prototype.valueOf = function () {return 4;};
  48497. return Foo;
  48498. ;
  48499. return self;
  48500. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48501. },
  48502. args: [],
  48503. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  48504. referencedClasses: [],
  48505. messageSends: []
  48506. }),
  48507. $globals.ClassTest);
  48508. $core.addMethod(
  48509. $core.method({
  48510. selector: "setUp",
  48511. protocol: 'running',
  48512. fn: function (){
  48513. var self=this;
  48514. return $core.withContext(function($ctx1) {
  48515. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48516. return self;
  48517. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48518. },
  48519. args: [],
  48520. source: "setUp\x0a\x09builder := ClassBuilder new",
  48521. referencedClasses: ["ClassBuilder"],
  48522. messageSends: ["new"]
  48523. }),
  48524. $globals.ClassTest);
  48525. $core.addMethod(
  48526. $core.method({
  48527. selector: "tearDown",
  48528. protocol: 'running',
  48529. fn: function (){
  48530. var self=this;
  48531. return $core.withContext(function($ctx1) {
  48532. var $1,$receiver;
  48533. $1=self["@theClass"];
  48534. if(($receiver = $1) == null || $receiver.isNil){
  48535. $1;
  48536. } else {
  48537. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48538. self["@theClass"]=nil;
  48539. self["@theClass"];
  48540. };
  48541. return self;
  48542. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48543. },
  48544. args: [],
  48545. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48546. referencedClasses: ["Smalltalk"],
  48547. messageSends: ["ifNotNil:", "removeClass:"]
  48548. }),
  48549. $globals.ClassTest);
  48550. $core.addMethod(
  48551. $core.method({
  48552. selector: "testAllSubclasses",
  48553. protocol: 'tests',
  48554. fn: function (){
  48555. var self=this;
  48556. var subclasses,index;
  48557. return $core.withContext(function($ctx1) {
  48558. subclasses=$recv($globals.Object)._subclasses();
  48559. $ctx1.sendIdx["subclasses"]=1;
  48560. index=(1);
  48561. $recv((function(){
  48562. return $core.withContext(function($ctx2) {
  48563. return $recv(index).__gt($recv(subclasses)._size());
  48564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48565. }))._whileFalse_((function(){
  48566. return $core.withContext(function($ctx2) {
  48567. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  48568. index=$recv(index).__plus((1));
  48569. return index;
  48570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48571. }));
  48572. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  48573. return self;
  48574. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  48575. },
  48576. args: [],
  48577. 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",
  48578. referencedClasses: ["Object"],
  48579. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  48580. }),
  48581. $globals.ClassTest);
  48582. $core.addMethod(
  48583. $core.method({
  48584. selector: "testMetaclassSubclasses",
  48585. protocol: 'tests',
  48586. fn: function (){
  48587. var self=this;
  48588. var subclasses;
  48589. return $core.withContext(function($ctx1) {
  48590. var $4,$3,$2,$1;
  48591. $4=$recv($globals.Object)._class();
  48592. $ctx1.sendIdx["class"]=1;
  48593. $3=$recv($4)._instanceClass();
  48594. $2=$recv($3)._subclasses();
  48595. $ctx1.sendIdx["subclasses"]=1;
  48596. $1=$recv($2)._select_((function(each){
  48597. return $core.withContext(function($ctx2) {
  48598. return $recv($recv(each)._isMetaclass())._not();
  48599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48600. }));
  48601. subclasses=$recv($1)._collect_((function(each){
  48602. return $core.withContext(function($ctx2) {
  48603. return $recv(each)._theMetaClass();
  48604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48605. }));
  48606. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  48607. return self;
  48608. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  48609. },
  48610. args: [],
  48611. 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",
  48612. referencedClasses: ["Object"],
  48613. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  48614. }),
  48615. $globals.ClassTest);
  48616. $core.addMethod(
  48617. $core.method({
  48618. selector: "testSetJavaScriptConstructor",
  48619. protocol: 'tests',
  48620. fn: function (){
  48621. var self=this;
  48622. var instance;
  48623. return $core.withContext(function($ctx1) {
  48624. var $2,$1,$4,$3,$6,$5,$8,$7;
  48625. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48626. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48627. $2=$recv(self["@theClass"])._superclass();
  48628. $ctx1.sendIdx["superclass"]=1;
  48629. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48630. $ctx1.sendIdx["=="]=1;
  48631. self._assert_($1);
  48632. $ctx1.sendIdx["assert:"]=1;
  48633. $4=$recv(self["@theClass"])._instanceVariableNames();
  48634. $ctx1.sendIdx["instanceVariableNames"]=1;
  48635. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48636. $ctx1.sendIdx["=="]=2;
  48637. self._assert_($3);
  48638. $ctx1.sendIdx["assert:"]=2;
  48639. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48640. $ctx1.sendIdx["assert:equals:"]=1;
  48641. $6=$recv(self["@theClass"])._package();
  48642. $ctx1.sendIdx["package"]=1;
  48643. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48644. $ctx1.sendIdx["=="]=3;
  48645. self._assert_($5);
  48646. $ctx1.sendIdx["assert:"]=3;
  48647. $8=$recv(self["@theClass"])._methodDictionary();
  48648. $ctx1.sendIdx["methodDictionary"]=1;
  48649. $7=$recv($8)._keys();
  48650. $ctx1.sendIdx["keys"]=1;
  48651. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48652. $ctx1.sendIdx["assert:equals:"]=2;
  48653. instance=$recv(self["@theClass"])._new();
  48654. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48655. self._assert_equals_($recv(instance)._value(),(4));
  48656. $ctx1.sendIdx["assert:equals:"]=3;
  48657. self._shouldnt_raise_((function(){
  48658. return $core.withContext(function($ctx2) {
  48659. return $recv(instance)._foo_((9));
  48660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48661. }),$globals.Error);
  48662. self._assert_equals_($recv(instance)._foo(),(9));
  48663. return self;
  48664. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48665. },
  48666. args: [],
  48667. 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",
  48668. referencedClasses: ["ObjectMock", "Error"],
  48669. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48670. }),
  48671. $globals.ClassTest);
  48672. $core.addMethod(
  48673. $core.method({
  48674. selector: "testTrickySetJavaScriptConstructor",
  48675. protocol: 'tests',
  48676. fn: function (){
  48677. var self=this;
  48678. var instance;
  48679. return $core.withContext(function($ctx1) {
  48680. var $2,$1,$4,$3,$6,$5,$8,$7;
  48681. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48682. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  48683. $2=$recv(self["@theClass"])._superclass();
  48684. $ctx1.sendIdx["superclass"]=1;
  48685. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48686. $ctx1.sendIdx["=="]=1;
  48687. self._assert_($1);
  48688. $ctx1.sendIdx["assert:"]=1;
  48689. $4=$recv(self["@theClass"])._instanceVariableNames();
  48690. $ctx1.sendIdx["instanceVariableNames"]=1;
  48691. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48692. $ctx1.sendIdx["=="]=2;
  48693. self._assert_($3);
  48694. $ctx1.sendIdx["assert:"]=2;
  48695. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48696. $ctx1.sendIdx["assert:equals:"]=1;
  48697. $6=$recv(self["@theClass"])._package();
  48698. $ctx1.sendIdx["package"]=1;
  48699. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48700. $ctx1.sendIdx["=="]=3;
  48701. self._assert_($5);
  48702. $ctx1.sendIdx["assert:"]=3;
  48703. $8=$recv(self["@theClass"])._methodDictionary();
  48704. $ctx1.sendIdx["methodDictionary"]=1;
  48705. $7=$recv($8)._keys();
  48706. $ctx1.sendIdx["keys"]=1;
  48707. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48708. $ctx1.sendIdx["assert:equals:"]=2;
  48709. instance=$recv(self["@theClass"])._new();
  48710. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48711. self._assert_equals_($recv(instance)._value(),(4));
  48712. $ctx1.sendIdx["assert:equals:"]=3;
  48713. self._shouldnt_raise_((function(){
  48714. return $core.withContext(function($ctx2) {
  48715. return $recv(instance)._foo_((9));
  48716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48717. }),$globals.Error);
  48718. self._assert_equals_($recv(instance)._foo(),(9));
  48719. return self;
  48720. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48721. },
  48722. args: [],
  48723. 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",
  48724. referencedClasses: ["ObjectMock", "Error"],
  48725. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48726. }),
  48727. $globals.ClassTest);
  48728. $core.addMethod(
  48729. $core.method({
  48730. selector: "trickyJsConstructor",
  48731. protocol: 'running',
  48732. fn: function (){
  48733. var self=this;
  48734. return $core.withContext(function($ctx1) {
  48735. function Foo(){}
  48736. Foo.prototype.valueOf = function () {return 4;};
  48737. Foo.prototype._foo = function () {return "bar";};
  48738. return Foo;
  48739. ;
  48740. return self;
  48741. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  48742. },
  48743. args: [],
  48744. source: "trickyJsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09Foo.prototype._foo = function () {return \x22bar\x22;};\x0a\x09\x09return Foo;\x0a\x09>",
  48745. referencedClasses: [],
  48746. messageSends: []
  48747. }),
  48748. $globals.ClassTest);
  48749. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48750. $core.addMethod(
  48751. $core.method({
  48752. selector: "assertSameContents:as:",
  48753. protocol: 'convenience',
  48754. fn: function (aCollection,anotherCollection){
  48755. var self=this;
  48756. return $core.withContext(function($ctx1) {
  48757. var $2,$1,$4,$3;
  48758. $2=$recv(aCollection)._size();
  48759. $ctx1.sendIdx["size"]=1;
  48760. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48761. $ctx1.sendIdx["="]=1;
  48762. self._assert_($1);
  48763. $ctx1.sendIdx["assert:"]=1;
  48764. $recv(aCollection)._do_((function(each){
  48765. return $core.withContext(function($ctx2) {
  48766. $4=$recv(aCollection)._occurrencesOf_(each);
  48767. $ctx2.sendIdx["occurrencesOf:"]=1;
  48768. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48769. return self._assert_($3);
  48770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48771. }));
  48772. return self;
  48773. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48774. },
  48775. args: ["aCollection", "anotherCollection"],
  48776. 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)) ]",
  48777. referencedClasses: [],
  48778. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48779. }),
  48780. $globals.CollectionTest);
  48781. $core.addMethod(
  48782. $core.method({
  48783. selector: "collection",
  48784. protocol: 'fixture',
  48785. fn: function (){
  48786. var self=this;
  48787. return $core.withContext(function($ctx1) {
  48788. self._subclassResponsibility();
  48789. return self;
  48790. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48791. },
  48792. args: [],
  48793. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48794. referencedClasses: [],
  48795. messageSends: ["subclassResponsibility"]
  48796. }),
  48797. $globals.CollectionTest);
  48798. $core.addMethod(
  48799. $core.method({
  48800. selector: "collectionClass",
  48801. protocol: 'fixture',
  48802. fn: function (){
  48803. var self=this;
  48804. return $core.withContext(function($ctx1) {
  48805. return $recv(self._class())._collectionClass();
  48806. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48807. },
  48808. args: [],
  48809. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48810. referencedClasses: [],
  48811. messageSends: ["collectionClass", "class"]
  48812. }),
  48813. $globals.CollectionTest);
  48814. $core.addMethod(
  48815. $core.method({
  48816. selector: "collectionOfPrintStrings",
  48817. protocol: 'fixture',
  48818. fn: function (){
  48819. var self=this;
  48820. return $core.withContext(function($ctx1) {
  48821. self._subclassResponsibility();
  48822. return self;
  48823. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48824. },
  48825. args: [],
  48826. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48827. referencedClasses: [],
  48828. messageSends: ["subclassResponsibility"]
  48829. }),
  48830. $globals.CollectionTest);
  48831. $core.addMethod(
  48832. $core.method({
  48833. selector: "collectionSize",
  48834. protocol: 'fixture',
  48835. fn: function (){
  48836. var self=this;
  48837. return $core.withContext(function($ctx1) {
  48838. self._subclassResponsibility();
  48839. return self;
  48840. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48841. },
  48842. args: [],
  48843. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48844. referencedClasses: [],
  48845. messageSends: ["subclassResponsibility"]
  48846. }),
  48847. $globals.CollectionTest);
  48848. $core.addMethod(
  48849. $core.method({
  48850. selector: "collectionWithDuplicates",
  48851. protocol: 'fixture',
  48852. fn: function (){
  48853. var self=this;
  48854. return $core.withContext(function($ctx1) {
  48855. self._subclassResponsibility();
  48856. return self;
  48857. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48858. },
  48859. args: [],
  48860. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  48861. referencedClasses: [],
  48862. messageSends: ["subclassResponsibility"]
  48863. }),
  48864. $globals.CollectionTest);
  48865. $core.addMethod(
  48866. $core.method({
  48867. selector: "collectionWithNewValue",
  48868. protocol: 'fixture',
  48869. fn: function (){
  48870. var self=this;
  48871. return $core.withContext(function($ctx1) {
  48872. self._subclassResponsibility();
  48873. return self;
  48874. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48875. },
  48876. args: [],
  48877. 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",
  48878. referencedClasses: [],
  48879. messageSends: ["subclassResponsibility"]
  48880. }),
  48881. $globals.CollectionTest);
  48882. $core.addMethod(
  48883. $core.method({
  48884. selector: "initialize",
  48885. protocol: 'initialization',
  48886. fn: function (){
  48887. var self=this;
  48888. return $core.withContext(function($ctx1) {
  48889. (
  48890. $ctx1.supercall = true,
  48891. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  48892. $ctx1.supercall = false;
  48893. self["@sampleBlock"]=(function(){
  48894. });
  48895. return self;
  48896. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48897. },
  48898. args: [],
  48899. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48900. referencedClasses: [],
  48901. messageSends: ["initialize"]
  48902. }),
  48903. $globals.CollectionTest);
  48904. $core.addMethod(
  48905. $core.method({
  48906. selector: "isCollectionReadOnly",
  48907. protocol: 'testing',
  48908. fn: function (){
  48909. var self=this;
  48910. return false;
  48911. },
  48912. args: [],
  48913. source: "isCollectionReadOnly\x0a\x09^ false",
  48914. referencedClasses: [],
  48915. messageSends: []
  48916. }),
  48917. $globals.CollectionTest);
  48918. $core.addMethod(
  48919. $core.method({
  48920. selector: "sampleNewValue",
  48921. protocol: 'fixture',
  48922. fn: function (){
  48923. var self=this;
  48924. return "N";
  48925. },
  48926. args: [],
  48927. 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'",
  48928. referencedClasses: [],
  48929. messageSends: []
  48930. }),
  48931. $globals.CollectionTest);
  48932. $core.addMethod(
  48933. $core.method({
  48934. selector: "sampleNewValueAsCollection",
  48935. protocol: 'fixture',
  48936. fn: function (){
  48937. var self=this;
  48938. return $core.withContext(function($ctx1) {
  48939. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48940. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48941. },
  48942. args: [],
  48943. 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",
  48944. referencedClasses: [],
  48945. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48946. }),
  48947. $globals.CollectionTest);
  48948. $core.addMethod(
  48949. $core.method({
  48950. selector: "testAddAll",
  48951. protocol: 'tests',
  48952. fn: function (){
  48953. var self=this;
  48954. return $core.withContext(function($ctx1) {
  48955. 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;
  48956. $2=self._collection();
  48957. $ctx1.sendIdx["collection"]=1;
  48958. $4=self._collectionClass();
  48959. $ctx1.sendIdx["collectionClass"]=1;
  48960. $3=$recv($4)._new();
  48961. $ctx1.sendIdx["new"]=1;
  48962. $recv($2)._addAll_($3);
  48963. $ctx1.sendIdx["addAll:"]=1;
  48964. $5=$recv($2)._yourself();
  48965. $ctx1.sendIdx["yourself"]=1;
  48966. $1=$5;
  48967. $6=self._collection();
  48968. $ctx1.sendIdx["collection"]=2;
  48969. self._assert_equals_($1,$6);
  48970. $ctx1.sendIdx["assert:equals:"]=1;
  48971. $9=self._collectionClass();
  48972. $ctx1.sendIdx["collectionClass"]=2;
  48973. $8=$recv($9)._new();
  48974. $ctx1.sendIdx["new"]=2;
  48975. $10=self._collection();
  48976. $ctx1.sendIdx["collection"]=3;
  48977. $recv($8)._addAll_($10);
  48978. $ctx1.sendIdx["addAll:"]=2;
  48979. $11=$recv($8)._yourself();
  48980. $ctx1.sendIdx["yourself"]=2;
  48981. $7=$11;
  48982. $12=self._collection();
  48983. $ctx1.sendIdx["collection"]=4;
  48984. self._assert_equals_($7,$12);
  48985. $ctx1.sendIdx["assert:equals:"]=2;
  48986. $15=self._collectionClass();
  48987. $ctx1.sendIdx["collectionClass"]=3;
  48988. $14=$recv($15)._new();
  48989. $ctx1.sendIdx["new"]=3;
  48990. $17=self._collectionClass();
  48991. $ctx1.sendIdx["collectionClass"]=4;
  48992. $16=$recv($17)._new();
  48993. $ctx1.sendIdx["new"]=4;
  48994. $recv($14)._addAll_($16);
  48995. $ctx1.sendIdx["addAll:"]=3;
  48996. $18=$recv($14)._yourself();
  48997. $ctx1.sendIdx["yourself"]=3;
  48998. $13=$18;
  48999. self._assert_equals_($13,$recv(self._collectionClass())._new());
  49000. $ctx1.sendIdx["assert:equals:"]=3;
  49001. $20=self._collection();
  49002. $ctx1.sendIdx["collection"]=5;
  49003. $21=self._sampleNewValueAsCollection();
  49004. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49005. $recv($20)._addAll_($21);
  49006. $ctx1.sendIdx["addAll:"]=4;
  49007. $22=$recv($20)._yourself();
  49008. $ctx1.sendIdx["yourself"]=4;
  49009. $19=$22;
  49010. $23=self._collectionWithNewValue();
  49011. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49012. self._assert_equals_($19,$23);
  49013. $25=self._sampleNewValueAsCollection();
  49014. $recv($25)._addAll_(self._collection());
  49015. $24=$recv($25)._yourself();
  49016. self._assertSameContents_as_($24,self._collectionWithNewValue());
  49017. return self;
  49018. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  49019. },
  49020. args: [],
  49021. 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",
  49022. referencedClasses: [],
  49023. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49024. }),
  49025. $globals.CollectionTest);
  49026. $core.addMethod(
  49027. $core.method({
  49028. selector: "testAllSatisfy",
  49029. protocol: 'tests',
  49030. fn: function (){
  49031. var self=this;
  49032. var collection,anyOne;
  49033. return $core.withContext(function($ctx1) {
  49034. var $1;
  49035. collection=self._collection();
  49036. anyOne=$recv(collection)._anyOne();
  49037. $1=$recv(collection)._allSatisfy_((function(each){
  49038. return $core.withContext(function($ctx2) {
  49039. return $recv(collection)._includes_(each);
  49040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49041. }));
  49042. $ctx1.sendIdx["allSatisfy:"]=1;
  49043. self._assert_($1);
  49044. self._deny_($recv(collection)._allSatisfy_((function(each){
  49045. return $core.withContext(function($ctx2) {
  49046. return $recv(each).__tild_eq(anyOne);
  49047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49048. })));
  49049. return self;
  49050. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  49051. },
  49052. args: [],
  49053. 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 ])",
  49054. referencedClasses: [],
  49055. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  49056. }),
  49057. $globals.CollectionTest);
  49058. $core.addMethod(
  49059. $core.method({
  49060. selector: "testAnyOne",
  49061. protocol: 'tests',
  49062. fn: function (){
  49063. var self=this;
  49064. return $core.withContext(function($ctx1) {
  49065. var $2,$1;
  49066. self._should_raise_((function(){
  49067. return $core.withContext(function($ctx2) {
  49068. return $recv($recv(self._collectionClass())._new())._anyOne();
  49069. $ctx2.sendIdx["anyOne"]=1;
  49070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49071. }),$globals.Error);
  49072. $2=self._collection();
  49073. $ctx1.sendIdx["collection"]=1;
  49074. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  49075. self._assert_($1);
  49076. return self;
  49077. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  49078. },
  49079. args: [],
  49080. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  49081. referencedClasses: ["Error"],
  49082. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  49083. }),
  49084. $globals.CollectionTest);
  49085. $core.addMethod(
  49086. $core.method({
  49087. selector: "testAnySatisfy",
  49088. protocol: 'tests',
  49089. fn: function (){
  49090. var self=this;
  49091. var anyOne;
  49092. return $core.withContext(function($ctx1) {
  49093. var $1,$3,$2;
  49094. $1=self._collection();
  49095. $ctx1.sendIdx["collection"]=1;
  49096. anyOne=$recv($1)._anyOne();
  49097. $3=self._collection();
  49098. $ctx1.sendIdx["collection"]=2;
  49099. $2=$recv($3)._anySatisfy_((function(each){
  49100. return $core.withContext(function($ctx2) {
  49101. return $recv(each).__eq(anyOne);
  49102. $ctx2.sendIdx["="]=1;
  49103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49104. }));
  49105. $ctx1.sendIdx["anySatisfy:"]=1;
  49106. self._assert_($2);
  49107. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  49108. return $core.withContext(function($ctx2) {
  49109. return $recv(each).__eq($recv($globals.Object)._new());
  49110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49111. })));
  49112. return self;
  49113. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49114. },
  49115. args: [],
  49116. 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 ])",
  49117. referencedClasses: ["Object"],
  49118. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  49119. }),
  49120. $globals.CollectionTest);
  49121. $core.addMethod(
  49122. $core.method({
  49123. selector: "testAsArray",
  49124. protocol: 'tests',
  49125. fn: function (){
  49126. var self=this;
  49127. return $core.withContext(function($ctx1) {
  49128. var $1;
  49129. $1=self._collection();
  49130. $ctx1.sendIdx["collection"]=1;
  49131. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  49132. return self;
  49133. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  49134. },
  49135. args: [],
  49136. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  49137. referencedClasses: [],
  49138. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  49139. }),
  49140. $globals.CollectionTest);
  49141. $core.addMethod(
  49142. $core.method({
  49143. selector: "testAsOrderedCollection",
  49144. protocol: 'tests',
  49145. fn: function (){
  49146. var self=this;
  49147. return $core.withContext(function($ctx1) {
  49148. var $1;
  49149. $1=self._collection();
  49150. $ctx1.sendIdx["collection"]=1;
  49151. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49152. return self;
  49153. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49154. },
  49155. args: [],
  49156. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49157. referencedClasses: [],
  49158. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49159. }),
  49160. $globals.CollectionTest);
  49161. $core.addMethod(
  49162. $core.method({
  49163. selector: "testAsSet",
  49164. protocol: 'tests',
  49165. fn: function (){
  49166. var self=this;
  49167. var c,set;
  49168. return $core.withContext(function($ctx1) {
  49169. c=self._collectionWithDuplicates();
  49170. set=$recv(c)._asSet();
  49171. self._assert_equals_($recv(set)._size(),(6));
  49172. $recv(c)._do_((function(each){
  49173. return $core.withContext(function($ctx2) {
  49174. return self._assert_($recv(set)._includes_(each));
  49175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49176. }));
  49177. return self;
  49178. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49179. },
  49180. args: [],
  49181. 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) ]",
  49182. referencedClasses: [],
  49183. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49184. }),
  49185. $globals.CollectionTest);
  49186. $core.addMethod(
  49187. $core.method({
  49188. selector: "testCollect",
  49189. protocol: 'tests',
  49190. fn: function (){
  49191. var self=this;
  49192. return $core.withContext(function($ctx1) {
  49193. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49194. $2=self._collection();
  49195. $ctx1.sendIdx["collection"]=1;
  49196. $1=$recv($2)._collect_((function(each){
  49197. return each;
  49198. }));
  49199. $ctx1.sendIdx["collect:"]=1;
  49200. $3=self._collection();
  49201. $ctx1.sendIdx["collection"]=2;
  49202. self._assert_equals_($1,$3);
  49203. $ctx1.sendIdx["assert:equals:"]=1;
  49204. $5=self._collectionWithNewValue();
  49205. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49206. $4=$recv($5)._collect_((function(each){
  49207. return each;
  49208. }));
  49209. $ctx1.sendIdx["collect:"]=2;
  49210. self._assert_equals_($4,self._collectionWithNewValue());
  49211. $ctx1.sendIdx["assert:equals:"]=2;
  49212. $8=self._collectionClass();
  49213. $ctx1.sendIdx["collectionClass"]=1;
  49214. $7=$recv($8)._new();
  49215. $ctx1.sendIdx["new"]=1;
  49216. $6=$recv($7)._collect_((function(each){
  49217. return $core.withContext(function($ctx2) {
  49218. return $recv(each)._printString();
  49219. $ctx2.sendIdx["printString"]=1;
  49220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49221. }));
  49222. $ctx1.sendIdx["collect:"]=3;
  49223. self._assert_equals_($6,$recv(self._collectionClass())._new());
  49224. $ctx1.sendIdx["assert:equals:"]=3;
  49225. $11=self._collection();
  49226. $ctx1.sendIdx["collection"]=3;
  49227. $10=$recv($11)._collect_((function(){
  49228. return $core.withContext(function($ctx2) {
  49229. return self._sampleNewValue();
  49230. $ctx2.sendIdx["sampleNewValue"]=1;
  49231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  49232. }));
  49233. $ctx1.sendIdx["collect:"]=4;
  49234. $9=$recv($10)._detect_((function(){
  49235. return true;
  49236. }));
  49237. self._assert_equals_($9,self._sampleNewValue());
  49238. $ctx1.sendIdx["assert:equals:"]=4;
  49239. self._assert_equals_($recv(self._collection())._collect_((function(each){
  49240. return $core.withContext(function($ctx2) {
  49241. return $recv(each)._printString();
  49242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49243. })),self._collectionOfPrintStrings());
  49244. return self;
  49245. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  49246. },
  49247. args: [],
  49248. 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",
  49249. referencedClasses: [],
  49250. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  49251. }),
  49252. $globals.CollectionTest);
  49253. $core.addMethod(
  49254. $core.method({
  49255. selector: "testComma",
  49256. protocol: 'tests',
  49257. fn: function (){
  49258. var self=this;
  49259. return $core.withContext(function($ctx1) {
  49260. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  49261. $2=self._collection();
  49262. $ctx1.sendIdx["collection"]=1;
  49263. $4=self._collectionClass();
  49264. $ctx1.sendIdx["collectionClass"]=1;
  49265. $3=$recv($4)._new();
  49266. $ctx1.sendIdx["new"]=1;
  49267. $1=$recv($2).__comma($3);
  49268. $ctx1.sendIdx[","]=1;
  49269. $5=self._collection();
  49270. $ctx1.sendIdx["collection"]=2;
  49271. self._assert_equals_($1,$5);
  49272. $ctx1.sendIdx["assert:equals:"]=1;
  49273. $8=self._collectionClass();
  49274. $ctx1.sendIdx["collectionClass"]=2;
  49275. $7=$recv($8)._new();
  49276. $ctx1.sendIdx["new"]=2;
  49277. $9=self._collection();
  49278. $ctx1.sendIdx["collection"]=3;
  49279. $6=$recv($7).__comma($9);
  49280. $ctx1.sendIdx[","]=2;
  49281. $10=self._collection();
  49282. $ctx1.sendIdx["collection"]=4;
  49283. self._assert_equals_($6,$10);
  49284. $ctx1.sendIdx["assert:equals:"]=2;
  49285. $13=self._collectionClass();
  49286. $ctx1.sendIdx["collectionClass"]=3;
  49287. $12=$recv($13)._new();
  49288. $ctx1.sendIdx["new"]=3;
  49289. $15=self._collectionClass();
  49290. $ctx1.sendIdx["collectionClass"]=4;
  49291. $14=$recv($15)._new();
  49292. $ctx1.sendIdx["new"]=4;
  49293. $11=$recv($12).__comma($14);
  49294. $ctx1.sendIdx[","]=3;
  49295. self._assert_equals_($11,$recv(self._collectionClass())._new());
  49296. $ctx1.sendIdx["assert:equals:"]=3;
  49297. $17=self._collection();
  49298. $ctx1.sendIdx["collection"]=5;
  49299. $18=self._sampleNewValueAsCollection();
  49300. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49301. $16=$recv($17).__comma($18);
  49302. $ctx1.sendIdx[","]=4;
  49303. $19=self._collectionWithNewValue();
  49304. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49305. self._assert_equals_($16,$19);
  49306. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  49307. return self;
  49308. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  49309. },
  49310. args: [],
  49311. 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",
  49312. referencedClasses: [],
  49313. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49314. }),
  49315. $globals.CollectionTest);
  49316. $core.addMethod(
  49317. $core.method({
  49318. selector: "testCopy",
  49319. protocol: 'tests',
  49320. fn: function (){
  49321. var self=this;
  49322. return $core.withContext(function($ctx1) {
  49323. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  49324. $3=self._collectionClass();
  49325. $ctx1.sendIdx["collectionClass"]=1;
  49326. $2=$recv($3)._new();
  49327. $ctx1.sendIdx["new"]=1;
  49328. $1=$recv($2)._copy();
  49329. $ctx1.sendIdx["copy"]=1;
  49330. $5=self._collectionClass();
  49331. $ctx1.sendIdx["collectionClass"]=2;
  49332. $4=$recv($5)._new();
  49333. $ctx1.sendIdx["new"]=2;
  49334. self._assert_equals_($1,$4);
  49335. $ctx1.sendIdx["assert:equals:"]=1;
  49336. $7=self._collection();
  49337. $ctx1.sendIdx["collection"]=1;
  49338. $6=$recv($7)._copy();
  49339. $ctx1.sendIdx["copy"]=2;
  49340. $8=self._collection();
  49341. $ctx1.sendIdx["collection"]=2;
  49342. self._assert_equals_($6,$8);
  49343. $ctx1.sendIdx["assert:equals:"]=2;
  49344. $10=self._collectionWithNewValue();
  49345. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49346. $9=$recv($10)._copy();
  49347. $ctx1.sendIdx["copy"]=3;
  49348. $11=self._collectionWithNewValue();
  49349. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49350. self._assert_equals_($9,$11);
  49351. $15=self._collectionClass();
  49352. $ctx1.sendIdx["collectionClass"]=3;
  49353. $14=$recv($15)._new();
  49354. $ctx1.sendIdx["new"]=3;
  49355. $13=$recv($14)._copy();
  49356. $ctx1.sendIdx["copy"]=4;
  49357. $16=self._collection();
  49358. $ctx1.sendIdx["collection"]=3;
  49359. $12=$recv($13).__eq($16);
  49360. $ctx1.sendIdx["="]=1;
  49361. self._deny_($12);
  49362. $ctx1.sendIdx["deny:"]=1;
  49363. $19=self._collection();
  49364. $ctx1.sendIdx["collection"]=4;
  49365. $18=$recv($19)._copy();
  49366. $ctx1.sendIdx["copy"]=5;
  49367. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49368. $ctx1.sendIdx["="]=2;
  49369. self._deny_($17);
  49370. $ctx1.sendIdx["deny:"]=2;
  49371. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49372. return self;
  49373. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49374. },
  49375. args: [],
  49376. 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",
  49377. referencedClasses: [],
  49378. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49379. }),
  49380. $globals.CollectionTest);
  49381. $core.addMethod(
  49382. $core.method({
  49383. selector: "testCopySeparates",
  49384. protocol: 'tests',
  49385. fn: function (){
  49386. var self=this;
  49387. var original,copy;
  49388. return $core.withContext(function($ctx1) {
  49389. original=self._collection();
  49390. $ctx1.sendIdx["collection"]=1;
  49391. copy=$recv(original)._copy();
  49392. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49393. self._assert_($recv(original).__eq(self._collection()));
  49394. return self;
  49395. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49396. },
  49397. args: [],
  49398. 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",
  49399. referencedClasses: [],
  49400. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49401. }),
  49402. $globals.CollectionTest);
  49403. $core.addMethod(
  49404. $core.method({
  49405. selector: "testDetect",
  49406. protocol: 'tests',
  49407. fn: function (){
  49408. var self=this;
  49409. return $core.withContext(function($ctx1) {
  49410. var $1,$2,$3,$4,$6,$5,$7;
  49411. self._shouldnt_raise_((function(){
  49412. return $core.withContext(function($ctx2) {
  49413. $1=self._collection();
  49414. $ctx2.sendIdx["collection"]=1;
  49415. return $recv($1)._detect_((function(){
  49416. return true;
  49417. }));
  49418. $ctx2.sendIdx["detect:"]=1;
  49419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49420. }),$globals.Error);
  49421. self._should_raise_((function(){
  49422. return $core.withContext(function($ctx2) {
  49423. $2=self._collection();
  49424. $ctx2.sendIdx["collection"]=2;
  49425. return $recv($2)._detect_((function(){
  49426. return false;
  49427. }));
  49428. $ctx2.sendIdx["detect:"]=2;
  49429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49430. }),$globals.Error);
  49431. $ctx1.sendIdx["should:raise:"]=1;
  49432. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49433. return true;
  49434. }));
  49435. $ctx1.sendIdx["detect:"]=3;
  49436. $4=self._sampleNewValue();
  49437. $ctx1.sendIdx["sampleNewValue"]=1;
  49438. self._assert_equals_($3,$4);
  49439. $ctx1.sendIdx["assert:equals:"]=1;
  49440. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49441. return $core.withContext(function($ctx2) {
  49442. $6=self._sampleNewValue();
  49443. $ctx2.sendIdx["sampleNewValue"]=2;
  49444. return $recv(each).__eq($6);
  49445. $ctx2.sendIdx["="]=1;
  49446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49447. }));
  49448. $ctx1.sendIdx["detect:"]=4;
  49449. $7=self._sampleNewValue();
  49450. $ctx1.sendIdx["sampleNewValue"]=3;
  49451. self._assert_equals_($5,$7);
  49452. self._should_raise_((function(){
  49453. return $core.withContext(function($ctx2) {
  49454. return $recv(self._collection())._detect_((function(each){
  49455. return $core.withContext(function($ctx3) {
  49456. return $recv(each).__eq(self._sampleNewValue());
  49457. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49458. }));
  49459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49460. }),$globals.Error);
  49461. return self;
  49462. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49463. },
  49464. args: [],
  49465. 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",
  49466. referencedClasses: ["Error"],
  49467. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49468. }),
  49469. $globals.CollectionTest);
  49470. $core.addMethod(
  49471. $core.method({
  49472. selector: "testDetectIfNone",
  49473. protocol: 'tests',
  49474. fn: function (){
  49475. var self=this;
  49476. var sentinel;
  49477. return $core.withContext(function($ctx1) {
  49478. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49479. sentinel=$recv($globals.Object)._new();
  49480. $3=self._collection();
  49481. $ctx1.sendIdx["collection"]=1;
  49482. $2=$recv($3)._detect_ifNone_((function(){
  49483. return true;
  49484. }),(function(){
  49485. return sentinel;
  49486. }));
  49487. $ctx1.sendIdx["detect:ifNone:"]=1;
  49488. $1=$recv($2).__tild_eq(sentinel);
  49489. self._assert_($1);
  49490. $5=self._collection();
  49491. $ctx1.sendIdx["collection"]=2;
  49492. $4=$recv($5)._detect_ifNone_((function(){
  49493. return false;
  49494. }),(function(){
  49495. return sentinel;
  49496. }));
  49497. $ctx1.sendIdx["detect:ifNone:"]=2;
  49498. self._assert_equals_($4,sentinel);
  49499. $ctx1.sendIdx["assert:equals:"]=1;
  49500. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49501. return true;
  49502. }),(function(){
  49503. return sentinel;
  49504. }));
  49505. $ctx1.sendIdx["detect:ifNone:"]=3;
  49506. $7=self._sampleNewValue();
  49507. $ctx1.sendIdx["sampleNewValue"]=1;
  49508. self._assert_equals_($6,$7);
  49509. $ctx1.sendIdx["assert:equals:"]=2;
  49510. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49511. return $core.withContext(function($ctx2) {
  49512. $9=self._sampleNewValue();
  49513. $ctx2.sendIdx["sampleNewValue"]=2;
  49514. return $recv(each).__eq($9);
  49515. $ctx2.sendIdx["="]=1;
  49516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49517. }),(function(){
  49518. return sentinel;
  49519. }));
  49520. $ctx1.sendIdx["detect:ifNone:"]=4;
  49521. $10=self._sampleNewValue();
  49522. $ctx1.sendIdx["sampleNewValue"]=3;
  49523. self._assert_equals_($8,$10);
  49524. $ctx1.sendIdx["assert:equals:"]=3;
  49525. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49526. return $core.withContext(function($ctx2) {
  49527. return $recv(each).__eq(self._sampleNewValue());
  49528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49529. }),(function(){
  49530. return sentinel;
  49531. })),sentinel);
  49532. return self;
  49533. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49534. },
  49535. args: [],
  49536. 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",
  49537. referencedClasses: ["Object"],
  49538. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49539. }),
  49540. $globals.CollectionTest);
  49541. $core.addMethod(
  49542. $core.method({
  49543. selector: "testDo",
  49544. protocol: 'tests',
  49545. fn: function (){
  49546. var self=this;
  49547. var newCollection;
  49548. return $core.withContext(function($ctx1) {
  49549. var $1,$2;
  49550. newCollection=$recv($globals.OrderedCollection)._new();
  49551. $ctx1.sendIdx["new"]=1;
  49552. $1=self._collection();
  49553. $ctx1.sendIdx["collection"]=1;
  49554. $recv($1)._do_((function(each){
  49555. return $core.withContext(function($ctx2) {
  49556. return $recv(newCollection)._add_(each);
  49557. $ctx2.sendIdx["add:"]=1;
  49558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49559. }));
  49560. $ctx1.sendIdx["do:"]=1;
  49561. self._assertSameContents_as_(self._collection(),newCollection);
  49562. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49563. newCollection=$recv($globals.OrderedCollection)._new();
  49564. $2=self._collectionWithDuplicates();
  49565. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49566. $recv($2)._do_((function(each){
  49567. return $core.withContext(function($ctx2) {
  49568. return $recv(newCollection)._add_(each);
  49569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49570. }));
  49571. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49572. return self;
  49573. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49574. },
  49575. args: [],
  49576. 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",
  49577. referencedClasses: ["OrderedCollection"],
  49578. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49579. }),
  49580. $globals.CollectionTest);
  49581. $core.addMethod(
  49582. $core.method({
  49583. selector: "testEquality",
  49584. protocol: 'tests',
  49585. fn: function (){
  49586. var self=this;
  49587. return $core.withContext(function($ctx1) {
  49588. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49589. $2=self._collectionClass();
  49590. $ctx1.sendIdx["collectionClass"]=1;
  49591. $1=$recv($2)._new();
  49592. $ctx1.sendIdx["new"]=1;
  49593. $4=self._collectionClass();
  49594. $ctx1.sendIdx["collectionClass"]=2;
  49595. $3=$recv($4)._new();
  49596. $ctx1.sendIdx["new"]=2;
  49597. self._assert_equals_($1,$3);
  49598. $ctx1.sendIdx["assert:equals:"]=1;
  49599. $5=self._collection();
  49600. $ctx1.sendIdx["collection"]=1;
  49601. $6=self._collection();
  49602. $ctx1.sendIdx["collection"]=2;
  49603. self._assert_equals_($5,$6);
  49604. $ctx1.sendIdx["assert:equals:"]=2;
  49605. $7=self._collectionWithNewValue();
  49606. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49607. $8=self._collectionWithNewValue();
  49608. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49609. self._assert_equals_($7,$8);
  49610. $11=self._collectionClass();
  49611. $ctx1.sendIdx["collectionClass"]=3;
  49612. $10=$recv($11)._new();
  49613. $ctx1.sendIdx["new"]=3;
  49614. $12=self._collection();
  49615. $ctx1.sendIdx["collection"]=3;
  49616. $9=$recv($10).__eq($12);
  49617. $ctx1.sendIdx["="]=1;
  49618. self._deny_($9);
  49619. $ctx1.sendIdx["deny:"]=1;
  49620. $14=self._collection();
  49621. $ctx1.sendIdx["collection"]=4;
  49622. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49623. $ctx1.sendIdx["="]=2;
  49624. self._deny_($13);
  49625. $ctx1.sendIdx["deny:"]=2;
  49626. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49627. return self;
  49628. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49629. },
  49630. args: [],
  49631. 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",
  49632. referencedClasses: [],
  49633. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49634. }),
  49635. $globals.CollectionTest);
  49636. $core.addMethod(
  49637. $core.method({
  49638. selector: "testIfEmptyFamily",
  49639. protocol: 'tests',
  49640. fn: function (){
  49641. var self=this;
  49642. return $core.withContext(function($ctx1) {
  49643. 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;
  49644. $3=self._collectionClass();
  49645. $ctx1.sendIdx["collectionClass"]=1;
  49646. $2=$recv($3)._new();
  49647. $ctx1.sendIdx["new"]=1;
  49648. $1=$recv($2)._ifEmpty_((function(){
  49649. return (42);
  49650. }));
  49651. $ctx1.sendIdx["ifEmpty:"]=1;
  49652. self._assert_equals_($1,(42));
  49653. $ctx1.sendIdx["assert:equals:"]=1;
  49654. $5=self._collection();
  49655. $ctx1.sendIdx["collection"]=1;
  49656. $4=$recv($5)._ifEmpty_((function(){
  49657. return (42);
  49658. }));
  49659. $6=self._collection();
  49660. $ctx1.sendIdx["collection"]=2;
  49661. self._assert_equals_($4,$6);
  49662. $ctx1.sendIdx["assert:equals:"]=2;
  49663. $9=self._collectionClass();
  49664. $ctx1.sendIdx["collectionClass"]=2;
  49665. $8=$recv($9)._new();
  49666. $ctx1.sendIdx["new"]=2;
  49667. $7=$recv($8)._ifNotEmpty_((function(){
  49668. return (42);
  49669. }));
  49670. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49671. $11=self._collectionClass();
  49672. $ctx1.sendIdx["collectionClass"]=3;
  49673. $10=$recv($11)._new();
  49674. $ctx1.sendIdx["new"]=3;
  49675. self._assert_equals_($7,$10);
  49676. $ctx1.sendIdx["assert:equals:"]=3;
  49677. $13=self._collection();
  49678. $ctx1.sendIdx["collection"]=3;
  49679. $12=$recv($13)._ifNotEmpty_((function(){
  49680. return (42);
  49681. }));
  49682. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49683. self._assert_equals_($12,(42));
  49684. $ctx1.sendIdx["assert:equals:"]=4;
  49685. $15=self._collection();
  49686. $ctx1.sendIdx["collection"]=4;
  49687. $14=$recv($15)._ifNotEmpty_((function(col){
  49688. return col;
  49689. }));
  49690. $16=self._collection();
  49691. $ctx1.sendIdx["collection"]=5;
  49692. self._assert_equals_($14,$16);
  49693. $ctx1.sendIdx["assert:equals:"]=5;
  49694. $19=self._collectionClass();
  49695. $ctx1.sendIdx["collectionClass"]=4;
  49696. $18=$recv($19)._new();
  49697. $ctx1.sendIdx["new"]=4;
  49698. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49699. return (42);
  49700. }),(function(){
  49701. return (999);
  49702. }));
  49703. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49704. self._assert_equals_($17,(42));
  49705. $ctx1.sendIdx["assert:equals:"]=6;
  49706. $21=self._collection();
  49707. $ctx1.sendIdx["collection"]=6;
  49708. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49709. return (42);
  49710. }),(function(){
  49711. return (999);
  49712. }));
  49713. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49714. self._assert_equals_($20,(999));
  49715. $ctx1.sendIdx["assert:equals:"]=7;
  49716. $23=self._collection();
  49717. $ctx1.sendIdx["collection"]=7;
  49718. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49719. return (42);
  49720. }),(function(col){
  49721. return col;
  49722. }));
  49723. $24=self._collection();
  49724. $ctx1.sendIdx["collection"]=8;
  49725. self._assert_equals_($22,$24);
  49726. $ctx1.sendIdx["assert:equals:"]=8;
  49727. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49728. return (42);
  49729. }),(function(){
  49730. return (999);
  49731. }));
  49732. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49733. self._assert_equals_($25,(999));
  49734. $ctx1.sendIdx["assert:equals:"]=9;
  49735. $27=self._collection();
  49736. $ctx1.sendIdx["collection"]=9;
  49737. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49738. return (42);
  49739. }),(function(){
  49740. return (999);
  49741. }));
  49742. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49743. self._assert_equals_($26,(42));
  49744. $ctx1.sendIdx["assert:equals:"]=10;
  49745. $29=self._collection();
  49746. $ctx1.sendIdx["collection"]=10;
  49747. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49748. return col;
  49749. }),(function(){
  49750. return (999);
  49751. }));
  49752. self._assert_equals_($28,self._collection());
  49753. return self;
  49754. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49755. },
  49756. args: [],
  49757. 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.",
  49758. referencedClasses: [],
  49759. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49760. }),
  49761. $globals.CollectionTest);
  49762. $core.addMethod(
  49763. $core.method({
  49764. selector: "testIsEmpty",
  49765. protocol: 'tests',
  49766. fn: function (){
  49767. var self=this;
  49768. return $core.withContext(function($ctx1) {
  49769. var $1;
  49770. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49771. $ctx1.sendIdx["isEmpty"]=1;
  49772. self._assert_($1);
  49773. self._deny_($recv(self._collection())._isEmpty());
  49774. return self;
  49775. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49776. },
  49777. args: [],
  49778. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49779. referencedClasses: [],
  49780. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49781. }),
  49782. $globals.CollectionTest);
  49783. $core.addMethod(
  49784. $core.method({
  49785. selector: "testNoneSatisfy",
  49786. protocol: 'tests',
  49787. fn: function (){
  49788. var self=this;
  49789. var anyOne;
  49790. return $core.withContext(function($ctx1) {
  49791. var $1,$3,$2;
  49792. $1=self._collection();
  49793. $ctx1.sendIdx["collection"]=1;
  49794. anyOne=$recv($1)._anyOne();
  49795. $3=self._collection();
  49796. $ctx1.sendIdx["collection"]=2;
  49797. $2=$recv($3)._noneSatisfy_((function(each){
  49798. return $core.withContext(function($ctx2) {
  49799. return $recv(each).__eq(anyOne);
  49800. $ctx2.sendIdx["="]=1;
  49801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49802. }));
  49803. $ctx1.sendIdx["noneSatisfy:"]=1;
  49804. self._deny_($2);
  49805. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49806. return $core.withContext(function($ctx2) {
  49807. return $recv(each).__eq($recv($globals.Object)._new());
  49808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49809. })));
  49810. return self;
  49811. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49812. },
  49813. args: [],
  49814. 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 ])",
  49815. referencedClasses: ["Object"],
  49816. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49817. }),
  49818. $globals.CollectionTest);
  49819. $core.addMethod(
  49820. $core.method({
  49821. selector: "testRemoveAll",
  49822. protocol: 'tests',
  49823. fn: function (){
  49824. var self=this;
  49825. return $core.withContext(function($ctx1) {
  49826. var $2,$1;
  49827. $2=self._collection();
  49828. $recv($2)._removeAll();
  49829. $1=$recv($2)._yourself();
  49830. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49831. return self;
  49832. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49833. },
  49834. args: [],
  49835. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49836. referencedClasses: [],
  49837. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49838. }),
  49839. $globals.CollectionTest);
  49840. $core.addMethod(
  49841. $core.method({
  49842. selector: "testSelect",
  49843. protocol: 'tests',
  49844. fn: function (){
  49845. var self=this;
  49846. return $core.withContext(function($ctx1) {
  49847. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49848. $2=self._collection();
  49849. $ctx1.sendIdx["collection"]=1;
  49850. $1=$recv($2)._select_((function(){
  49851. return false;
  49852. }));
  49853. $ctx1.sendIdx["select:"]=1;
  49854. $4=self._collectionClass();
  49855. $ctx1.sendIdx["collectionClass"]=1;
  49856. $3=$recv($4)._new();
  49857. $ctx1.sendIdx["new"]=1;
  49858. self._assert_equals_($1,$3);
  49859. $ctx1.sendIdx["assert:equals:"]=1;
  49860. $6=self._collection();
  49861. $ctx1.sendIdx["collection"]=2;
  49862. $5=$recv($6)._select_((function(){
  49863. return true;
  49864. }));
  49865. $ctx1.sendIdx["select:"]=2;
  49866. $7=self._collection();
  49867. $ctx1.sendIdx["collection"]=3;
  49868. self._assert_equals_($5,$7);
  49869. $ctx1.sendIdx["assert:equals:"]=2;
  49870. $9=self._collectionWithNewValue();
  49871. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49872. $8=$recv($9)._select_((function(each){
  49873. return $core.withContext(function($ctx2) {
  49874. $10=self._sampleNewValue();
  49875. $ctx2.sendIdx["sampleNewValue"]=1;
  49876. return $recv(each).__eq($10);
  49877. $ctx2.sendIdx["="]=1;
  49878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49879. }));
  49880. $ctx1.sendIdx["select:"]=3;
  49881. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49882. $ctx1.sendIdx["assert:equals:"]=3;
  49883. $12=self._collectionWithNewValue();
  49884. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49885. $11=$recv($12)._select_((function(each){
  49886. return $core.withContext(function($ctx2) {
  49887. $13=self._sampleNewValue();
  49888. $ctx2.sendIdx["sampleNewValue"]=2;
  49889. return $recv(each).__tild_eq($13);
  49890. $ctx2.sendIdx["~="]=1;
  49891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49892. }));
  49893. $ctx1.sendIdx["select:"]=4;
  49894. $14=self._collection();
  49895. $ctx1.sendIdx["collection"]=4;
  49896. self._assert_equals_($11,$14);
  49897. $ctx1.sendIdx["assert:equals:"]=4;
  49898. $16=self._collection();
  49899. $ctx1.sendIdx["collection"]=5;
  49900. $15=$recv($16)._select_((function(each){
  49901. return $core.withContext(function($ctx2) {
  49902. $17=self._sampleNewValue();
  49903. $ctx2.sendIdx["sampleNewValue"]=3;
  49904. return $recv(each).__eq($17);
  49905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49906. }));
  49907. $ctx1.sendIdx["select:"]=5;
  49908. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49909. $ctx1.sendIdx["assert:equals:"]=5;
  49910. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49911. return $core.withContext(function($ctx2) {
  49912. return $recv(each).__tild_eq(self._sampleNewValue());
  49913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49914. })),self._collection());
  49915. return self;
  49916. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49917. },
  49918. args: [],
  49919. 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",
  49920. referencedClasses: [],
  49921. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49922. }),
  49923. $globals.CollectionTest);
  49924. $core.addMethod(
  49925. $core.method({
  49926. selector: "testSize",
  49927. protocol: 'tests',
  49928. fn: function (){
  49929. var self=this;
  49930. return $core.withContext(function($ctx1) {
  49931. var $1,$2;
  49932. $1=$recv($recv(self._collectionClass())._new())._size();
  49933. $ctx1.sendIdx["size"]=1;
  49934. self._assert_equals_($1,(0));
  49935. $ctx1.sendIdx["assert:equals:"]=1;
  49936. $2=$recv(self._sampleNewValueAsCollection())._size();
  49937. $ctx1.sendIdx["size"]=2;
  49938. self._assert_equals_($2,(1));
  49939. $ctx1.sendIdx["assert:equals:"]=2;
  49940. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49941. return self;
  49942. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49943. },
  49944. args: [],
  49945. 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",
  49946. referencedClasses: [],
  49947. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49948. }),
  49949. $globals.CollectionTest);
  49950. $core.addMethod(
  49951. $core.method({
  49952. selector: "collectionClass",
  49953. protocol: 'fixture',
  49954. fn: function (){
  49955. var self=this;
  49956. return nil;
  49957. },
  49958. args: [],
  49959. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49960. referencedClasses: [],
  49961. messageSends: []
  49962. }),
  49963. $globals.CollectionTest.klass);
  49964. $core.addMethod(
  49965. $core.method({
  49966. selector: "isAbstract",
  49967. protocol: 'testing',
  49968. fn: function (){
  49969. var self=this;
  49970. return $core.withContext(function($ctx1) {
  49971. return $recv(self._collectionClass())._isNil();
  49972. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49973. },
  49974. args: [],
  49975. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49976. referencedClasses: [],
  49977. messageSends: ["isNil", "collectionClass"]
  49978. }),
  49979. $globals.CollectionTest.klass);
  49980. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49981. $core.addMethod(
  49982. $core.method({
  49983. selector: "collectionWithNewValue",
  49984. protocol: 'fixture',
  49985. fn: function (){
  49986. var self=this;
  49987. return $core.withContext(function($ctx1) {
  49988. self._subclassResponsibility();
  49989. return self;
  49990. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49991. },
  49992. args: [],
  49993. 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",
  49994. referencedClasses: [],
  49995. messageSends: ["subclassResponsibility"]
  49996. }),
  49997. $globals.IndexableCollectionTest);
  49998. $core.addMethod(
  49999. $core.method({
  50000. selector: "sampleNewIndex",
  50001. protocol: 'fixture',
  50002. fn: function (){
  50003. var self=this;
  50004. return $core.withContext(function($ctx1) {
  50005. self._subclassResponsibility();
  50006. return self;
  50007. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50008. },
  50009. args: [],
  50010. 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",
  50011. referencedClasses: [],
  50012. messageSends: ["subclassResponsibility"]
  50013. }),
  50014. $globals.IndexableCollectionTest);
  50015. $core.addMethod(
  50016. $core.method({
  50017. selector: "sampleNonIndexesDo:",
  50018. protocol: 'fixture',
  50019. fn: function (aBlock){
  50020. var self=this;
  50021. return $core.withContext(function($ctx1) {
  50022. self._subclassResponsibility();
  50023. return self;
  50024. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50025. },
  50026. args: ["aBlock"],
  50027. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50028. referencedClasses: [],
  50029. messageSends: ["subclassResponsibility"]
  50030. }),
  50031. $globals.IndexableCollectionTest);
  50032. $core.addMethod(
  50033. $core.method({
  50034. selector: "samplesDo:",
  50035. protocol: 'fixture',
  50036. fn: function (aBlock){
  50037. var self=this;
  50038. return $core.withContext(function($ctx1) {
  50039. self._subclassResponsibility();
  50040. return self;
  50041. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50042. },
  50043. args: ["aBlock"],
  50044. 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",
  50045. referencedClasses: [],
  50046. messageSends: ["subclassResponsibility"]
  50047. }),
  50048. $globals.IndexableCollectionTest);
  50049. $core.addMethod(
  50050. $core.method({
  50051. selector: "testAt",
  50052. protocol: 'tests',
  50053. fn: function (){
  50054. var self=this;
  50055. return $core.withContext(function($ctx1) {
  50056. var $1;
  50057. self._nonIndexesDo_((function(each){
  50058. return $core.withContext(function($ctx2) {
  50059. return self._should_raise_((function(){
  50060. return $core.withContext(function($ctx3) {
  50061. $1=self._collection();
  50062. $ctx3.sendIdx["collection"]=1;
  50063. return $recv($1)._at_(each);
  50064. $ctx3.sendIdx["at:"]=1;
  50065. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50066. }),$globals.Error);
  50067. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50068. }));
  50069. self._samplesDo_((function(index,value){
  50070. return $core.withContext(function($ctx2) {
  50071. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50072. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50073. }));
  50074. return self;
  50075. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50076. },
  50077. args: [],
  50078. 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 ]",
  50079. referencedClasses: ["Error"],
  50080. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50081. }),
  50082. $globals.IndexableCollectionTest);
  50083. $core.addMethod(
  50084. $core.method({
  50085. selector: "testAtIfAbsent",
  50086. protocol: 'tests',
  50087. fn: function (){
  50088. var self=this;
  50089. return $core.withContext(function($ctx1) {
  50090. var $2,$1,$3;
  50091. self._nonIndexesDo_((function(each){
  50092. return $core.withContext(function($ctx2) {
  50093. $2=self._collection();
  50094. $ctx2.sendIdx["collection"]=1;
  50095. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50096. return $core.withContext(function($ctx3) {
  50097. return self._sampleNewValue();
  50098. $ctx3.sendIdx["sampleNewValue"]=1;
  50099. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50100. }));
  50101. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50102. $3=self._sampleNewValue();
  50103. $ctx2.sendIdx["sampleNewValue"]=2;
  50104. return self._assert_equals_($1,$3);
  50105. $ctx2.sendIdx["assert:equals:"]=1;
  50106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50107. }));
  50108. self._samplesDo_((function(index,value){
  50109. return $core.withContext(function($ctx2) {
  50110. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50111. return $core.withContext(function($ctx3) {
  50112. return self._sampleNewValue();
  50113. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50114. })),value);
  50115. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50116. }));
  50117. return self;
  50118. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50119. },
  50120. args: [],
  50121. 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 ].",
  50122. referencedClasses: [],
  50123. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50124. }),
  50125. $globals.IndexableCollectionTest);
  50126. $core.addMethod(
  50127. $core.method({
  50128. selector: "testAtIfAbsentPut",
  50129. protocol: 'tests',
  50130. fn: function (){
  50131. var self=this;
  50132. var newCollection;
  50133. return $core.withContext(function($ctx1) {
  50134. var $1;
  50135. newCollection=self._collection();
  50136. $ctx1.sendIdx["collection"]=1;
  50137. self._samplesDo_((function(index,value){
  50138. return $core.withContext(function($ctx2) {
  50139. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50140. return $core.withContext(function($ctx3) {
  50141. return self._sampleNewValue();
  50142. $ctx3.sendIdx["sampleNewValue"]=1;
  50143. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50144. }));
  50145. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50146. return self._assert_equals_($1,value);
  50147. $ctx2.sendIdx["assert:equals:"]=1;
  50148. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50149. }));
  50150. self._assert_equals_(newCollection,self._collection());
  50151. $ctx1.sendIdx["assert:equals:"]=2;
  50152. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50153. return $core.withContext(function($ctx2) {
  50154. return self._sampleNewValue();
  50155. $ctx2.sendIdx["sampleNewValue"]=2;
  50156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50157. })),self._sampleNewValue());
  50158. $ctx1.sendIdx["assert:equals:"]=3;
  50159. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50160. return self;
  50161. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50162. },
  50163. args: [],
  50164. 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",
  50165. referencedClasses: [],
  50166. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50167. }),
  50168. $globals.IndexableCollectionTest);
  50169. $core.addMethod(
  50170. $core.method({
  50171. selector: "testAtIfPresent",
  50172. protocol: 'tests',
  50173. fn: function (){
  50174. var self=this;
  50175. var visited,sentinel;
  50176. return $core.withContext(function($ctx1) {
  50177. var $2,$1,$4,$3;
  50178. sentinel=$recv($globals.Object)._new();
  50179. self._nonIndexesDo_((function(each){
  50180. return $core.withContext(function($ctx2) {
  50181. visited=nil;
  50182. visited;
  50183. $2=self._collection();
  50184. $ctx2.sendIdx["collection"]=1;
  50185. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50186. visited=value1;
  50187. visited;
  50188. return sentinel;
  50189. }));
  50190. $ctx2.sendIdx["at:ifPresent:"]=1;
  50191. self._assert_equals_($1,nil);
  50192. $ctx2.sendIdx["assert:equals:"]=1;
  50193. return self._assert_($recv(visited)._isNil());
  50194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50195. }));
  50196. self._samplesDo_((function(index,value){
  50197. return $core.withContext(function($ctx2) {
  50198. visited=nil;
  50199. visited;
  50200. $4=self._collection();
  50201. $ctx2.sendIdx["collection"]=2;
  50202. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50203. visited=value2;
  50204. visited;
  50205. return sentinel;
  50206. }));
  50207. self._assert_equals_($3,sentinel);
  50208. $ctx2.sendIdx["assert:equals:"]=2;
  50209. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50210. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50211. }));
  50212. return self;
  50213. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50214. },
  50215. args: [],
  50216. 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) ]",
  50217. referencedClasses: ["Object"],
  50218. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50219. }),
  50220. $globals.IndexableCollectionTest);
  50221. $core.addMethod(
  50222. $core.method({
  50223. selector: "testAtIfPresentIfAbsent",
  50224. protocol: 'tests',
  50225. fn: function (){
  50226. var self=this;
  50227. var visited,sentinel;
  50228. return $core.withContext(function($ctx1) {
  50229. var $2,$1,$3,$5,$4;
  50230. sentinel=$recv($globals.Object)._new();
  50231. self._nonIndexesDo_((function(each){
  50232. return $core.withContext(function($ctx2) {
  50233. visited=nil;
  50234. visited;
  50235. $2=self._collection();
  50236. $ctx2.sendIdx["collection"]=1;
  50237. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50238. visited=value1;
  50239. visited;
  50240. return sentinel;
  50241. }),(function(){
  50242. return $core.withContext(function($ctx3) {
  50243. return self._sampleNewValue();
  50244. $ctx3.sendIdx["sampleNewValue"]=1;
  50245. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50246. }));
  50247. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50248. $3=self._sampleNewValue();
  50249. $ctx2.sendIdx["sampleNewValue"]=2;
  50250. self._assert_equals_($1,$3);
  50251. $ctx2.sendIdx["assert:equals:"]=1;
  50252. return self._assert_($recv(visited)._isNil());
  50253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50254. }));
  50255. self._samplesDo_((function(index,value){
  50256. return $core.withContext(function($ctx2) {
  50257. visited=nil;
  50258. visited;
  50259. $5=self._collection();
  50260. $ctx2.sendIdx["collection"]=2;
  50261. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50262. visited=value2;
  50263. visited;
  50264. return sentinel;
  50265. }),(function(){
  50266. return $core.withContext(function($ctx3) {
  50267. return self._sampleNewValue();
  50268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50269. }));
  50270. self._assert_equals_($4,sentinel);
  50271. $ctx2.sendIdx["assert:equals:"]=2;
  50272. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50273. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50274. }));
  50275. return self;
  50276. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50277. },
  50278. args: [],
  50279. 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) ]",
  50280. referencedClasses: ["Object"],
  50281. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50282. }),
  50283. $globals.IndexableCollectionTest);
  50284. $core.addMethod(
  50285. $core.method({
  50286. selector: "testAtPut",
  50287. protocol: 'tests',
  50288. fn: function (){
  50289. var self=this;
  50290. var newCollection;
  50291. return $core.withContext(function($ctx1) {
  50292. newCollection=self._collection();
  50293. $ctx1.sendIdx["collection"]=1;
  50294. self._samplesDo_((function(index,value){
  50295. return $core.withContext(function($ctx2) {
  50296. return $recv(newCollection)._at_put_(index,value);
  50297. $ctx2.sendIdx["at:put:"]=1;
  50298. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50299. }));
  50300. self._assert_equals_(newCollection,self._collection());
  50301. $ctx1.sendIdx["assert:equals:"]=1;
  50302. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50303. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50304. return self;
  50305. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50306. },
  50307. args: [],
  50308. 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",
  50309. referencedClasses: [],
  50310. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50311. }),
  50312. $globals.IndexableCollectionTest);
  50313. $core.addMethod(
  50314. $core.method({
  50315. selector: "testIndexOf",
  50316. protocol: 'tests',
  50317. fn: function (){
  50318. var self=this;
  50319. return $core.withContext(function($ctx1) {
  50320. var $1;
  50321. self._should_raise_((function(){
  50322. return $core.withContext(function($ctx2) {
  50323. $1=self._collection();
  50324. $ctx2.sendIdx["collection"]=1;
  50325. return $recv($1)._indexOf_(self._sampleNewValue());
  50326. $ctx2.sendIdx["indexOf:"]=1;
  50327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50328. }),$globals.Error);
  50329. self._samplesDo_((function(index,value){
  50330. return $core.withContext(function($ctx2) {
  50331. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  50332. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  50333. }));
  50334. return self;
  50335. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  50336. },
  50337. args: [],
  50338. 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 ]",
  50339. referencedClasses: ["Error"],
  50340. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  50341. }),
  50342. $globals.IndexableCollectionTest);
  50343. $core.addMethod(
  50344. $core.method({
  50345. selector: "testIndexOfWithNull",
  50346. protocol: 'tests',
  50347. fn: function (){
  50348. var self=this;
  50349. var jsNull;
  50350. return $core.withContext(function($ctx1) {
  50351. var $2,$1;
  50352. jsNull=$recv($globals.JSON)._parse_("null");
  50353. self._samplesDo_((function(index,value){
  50354. return $core.withContext(function($ctx2) {
  50355. $2=self._collection();
  50356. $recv($2)._at_put_(index,jsNull);
  50357. $1=$recv($2)._indexOf_(jsNull);
  50358. return self._assert_equals_($1,index);
  50359. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50360. }));
  50361. return self;
  50362. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50363. },
  50364. args: [],
  50365. 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 ]",
  50366. referencedClasses: ["JSON"],
  50367. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50368. }),
  50369. $globals.IndexableCollectionTest);
  50370. $core.addMethod(
  50371. $core.method({
  50372. selector: "testWithIndexDo",
  50373. protocol: 'tests',
  50374. fn: function (){
  50375. var self=this;
  50376. var collection;
  50377. return $core.withContext(function($ctx1) {
  50378. collection=self._collection();
  50379. $ctx1.sendIdx["collection"]=1;
  50380. $recv(self._collection())._withIndexDo_((function(each,index){
  50381. return $core.withContext(function($ctx2) {
  50382. return self._assert_equals_($recv(collection)._at_(index),each);
  50383. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50384. }));
  50385. return self;
  50386. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50387. },
  50388. args: [],
  50389. 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 ]",
  50390. referencedClasses: [],
  50391. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50392. }),
  50393. $globals.IndexableCollectionTest);
  50394. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50395. $core.addMethod(
  50396. $core.method({
  50397. selector: "collectionKeys",
  50398. protocol: 'fixture',
  50399. fn: function (){
  50400. var self=this;
  50401. return $core.withContext(function($ctx1) {
  50402. self._subclassResponsibility();
  50403. return self;
  50404. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50405. },
  50406. args: [],
  50407. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50408. referencedClasses: [],
  50409. messageSends: ["subclassResponsibility"]
  50410. }),
  50411. $globals.AssociativeCollectionTest);
  50412. $core.addMethod(
  50413. $core.method({
  50414. selector: "collectionValues",
  50415. protocol: 'fixture',
  50416. fn: function (){
  50417. var self=this;
  50418. return $core.withContext(function($ctx1) {
  50419. self._subclassResponsibility();
  50420. return self;
  50421. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50422. },
  50423. args: [],
  50424. source: "collectionValues\x0a\x09self subclassResponsibility",
  50425. referencedClasses: [],
  50426. messageSends: ["subclassResponsibility"]
  50427. }),
  50428. $globals.AssociativeCollectionTest);
  50429. $core.addMethod(
  50430. $core.method({
  50431. selector: "nonIndexesDo:",
  50432. protocol: 'fixture',
  50433. fn: function (aBlock){
  50434. var self=this;
  50435. return $core.withContext(function($ctx1) {
  50436. $recv(aBlock)._value_((5));
  50437. $ctx1.sendIdx["value:"]=1;
  50438. $recv(aBlock)._value_((function(){
  50439. }));
  50440. $ctx1.sendIdx["value:"]=2;
  50441. $recv(aBlock)._value_($recv($globals.Object)._new());
  50442. $ctx1.sendIdx["value:"]=3;
  50443. $recv(aBlock)._value_("z");
  50444. return self;
  50445. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50446. },
  50447. args: ["aBlock"],
  50448. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50449. referencedClasses: ["Object"],
  50450. messageSends: ["value:", "new"]
  50451. }),
  50452. $globals.AssociativeCollectionTest);
  50453. $core.addMethod(
  50454. $core.method({
  50455. selector: "sampleNewIndex",
  50456. protocol: 'fixture',
  50457. fn: function (){
  50458. var self=this;
  50459. return "new";
  50460. },
  50461. args: [],
  50462. source: "sampleNewIndex\x0a\x09^ 'new'",
  50463. referencedClasses: [],
  50464. messageSends: []
  50465. }),
  50466. $globals.AssociativeCollectionTest);
  50467. $core.addMethod(
  50468. $core.method({
  50469. selector: "samplesDo:",
  50470. protocol: 'fixture',
  50471. fn: function (aBlock){
  50472. var self=this;
  50473. return $core.withContext(function($ctx1) {
  50474. $recv(aBlock)._value_value_("a",(2));
  50475. return self;
  50476. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50477. },
  50478. args: ["aBlock"],
  50479. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50480. referencedClasses: [],
  50481. messageSends: ["value:value:"]
  50482. }),
  50483. $globals.AssociativeCollectionTest);
  50484. $core.addMethod(
  50485. $core.method({
  50486. selector: "testAddAll",
  50487. protocol: 'tests',
  50488. fn: function (){
  50489. var self=this;
  50490. return $core.withContext(function($ctx1) {
  50491. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50492. (
  50493. $ctx1.supercall = true,
  50494. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  50495. $ctx1.supercall = false;
  50496. $2=self._collection();
  50497. $ctx1.sendIdx["collection"]=1;
  50498. $3=self._collection();
  50499. $ctx1.sendIdx["collection"]=2;
  50500. $recv($2)._addAll_($3);
  50501. $ctx1.sendIdx["addAll:"]=1;
  50502. $4=$recv($2)._yourself();
  50503. $ctx1.sendIdx["yourself"]=1;
  50504. $1=$4;
  50505. $5=self._collection();
  50506. $ctx1.sendIdx["collection"]=3;
  50507. self._assert_equals_($1,$5);
  50508. $ctx1.sendIdx["assert:equals:"]=1;
  50509. $7=self._collection();
  50510. $ctx1.sendIdx["collection"]=4;
  50511. $8=self._collectionWithNewValue();
  50512. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50513. $recv($7)._addAll_($8);
  50514. $ctx1.sendIdx["addAll:"]=2;
  50515. $9=$recv($7)._yourself();
  50516. $ctx1.sendIdx["yourself"]=2;
  50517. $6=$9;
  50518. $10=self._collectionWithNewValue();
  50519. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50520. self._assert_equals_($6,$10);
  50521. $ctx1.sendIdx["assert:equals:"]=2;
  50522. $12=self._collectionWithNewValue();
  50523. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50524. $recv($12)._addAll_(self._collection());
  50525. $11=$recv($12)._yourself();
  50526. self._assert_equals_($11,self._collectionWithNewValue());
  50527. return self;
  50528. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50529. },
  50530. args: [],
  50531. 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",
  50532. referencedClasses: [],
  50533. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50534. }),
  50535. $globals.AssociativeCollectionTest);
  50536. $core.addMethod(
  50537. $core.method({
  50538. selector: "testAsDictionary",
  50539. protocol: 'tests',
  50540. fn: function (){
  50541. var self=this;
  50542. return $core.withContext(function($ctx1) {
  50543. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50544. return self;
  50545. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50546. },
  50547. args: [],
  50548. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50549. referencedClasses: ["Dictionary"],
  50550. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50551. }),
  50552. $globals.AssociativeCollectionTest);
  50553. $core.addMethod(
  50554. $core.method({
  50555. selector: "testAsHashedCollection",
  50556. protocol: 'tests',
  50557. fn: function (){
  50558. var self=this;
  50559. return $core.withContext(function($ctx1) {
  50560. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50561. return self;
  50562. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50563. },
  50564. args: [],
  50565. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50566. referencedClasses: ["HashedCollection"],
  50567. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50568. }),
  50569. $globals.AssociativeCollectionTest);
  50570. $core.addMethod(
  50571. $core.method({
  50572. selector: "testComma",
  50573. protocol: 'tests',
  50574. fn: function (){
  50575. var self=this;
  50576. return $core.withContext(function($ctx1) {
  50577. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50578. (
  50579. $ctx1.supercall = true,
  50580. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  50581. $ctx1.supercall = false;
  50582. $2=self._collection();
  50583. $ctx1.sendIdx["collection"]=1;
  50584. $3=self._collection();
  50585. $ctx1.sendIdx["collection"]=2;
  50586. $1=$recv($2).__comma($3);
  50587. $ctx1.sendIdx[","]=1;
  50588. $4=self._collection();
  50589. $ctx1.sendIdx["collection"]=3;
  50590. self._assert_equals_($1,$4);
  50591. $ctx1.sendIdx["assert:equals:"]=1;
  50592. $6=self._collection();
  50593. $ctx1.sendIdx["collection"]=4;
  50594. $7=self._collectionWithNewValue();
  50595. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50596. $5=$recv($6).__comma($7);
  50597. $ctx1.sendIdx[","]=2;
  50598. $8=self._collectionWithNewValue();
  50599. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50600. self._assert_equals_($5,$8);
  50601. $ctx1.sendIdx["assert:equals:"]=2;
  50602. $10=self._collectionWithNewValue();
  50603. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50604. $9=$recv($10).__comma(self._collection());
  50605. self._assert_equals_($9,self._collectionWithNewValue());
  50606. return self;
  50607. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50608. },
  50609. args: [],
  50610. 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",
  50611. referencedClasses: [],
  50612. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50613. }),
  50614. $globals.AssociativeCollectionTest);
  50615. $core.addMethod(
  50616. $core.method({
  50617. selector: "testFrom",
  50618. protocol: 'tests',
  50619. fn: function (){
  50620. var self=this;
  50621. var associations;
  50622. return $core.withContext(function($ctx1) {
  50623. var $1;
  50624. $1="a".__minus_gt((1));
  50625. $ctx1.sendIdx["->"]=1;
  50626. associations=[$1,"b".__minus_gt((2))];
  50627. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50628. return self;
  50629. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50630. },
  50631. args: [],
  50632. 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 }.",
  50633. referencedClasses: [],
  50634. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50635. }),
  50636. $globals.AssociativeCollectionTest);
  50637. $core.addMethod(
  50638. $core.method({
  50639. selector: "testKeys",
  50640. protocol: 'tests',
  50641. fn: function (){
  50642. var self=this;
  50643. return $core.withContext(function($ctx1) {
  50644. var $2,$1,$3,$4;
  50645. $2=$recv($recv(self._collectionClass())._new())._keys();
  50646. $ctx1.sendIdx["keys"]=1;
  50647. $1=$recv($2)._isEmpty();
  50648. self._assert_($1);
  50649. $3=$recv(self._collection())._keys();
  50650. $ctx1.sendIdx["keys"]=2;
  50651. $4=self._collectionKeys();
  50652. $ctx1.sendIdx["collectionKeys"]=1;
  50653. self._assertSameContents_as_($3,$4);
  50654. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50655. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50656. return self;
  50657. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50658. },
  50659. args: [],
  50660. 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 }",
  50661. referencedClasses: [],
  50662. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50663. }),
  50664. $globals.AssociativeCollectionTest);
  50665. $core.addMethod(
  50666. $core.method({
  50667. selector: "testNewFromPairs",
  50668. protocol: 'tests',
  50669. fn: function (){
  50670. var self=this;
  50671. var flattenedAssociations;
  50672. return $core.withContext(function($ctx1) {
  50673. flattenedAssociations=["a",(1),"b",(2)];
  50674. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50675. return self;
  50676. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50677. },
  50678. args: [],
  50679. 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 }.",
  50680. referencedClasses: [],
  50681. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50682. }),
  50683. $globals.AssociativeCollectionTest);
  50684. $core.addMethod(
  50685. $core.method({
  50686. selector: "testPrintString",
  50687. protocol: 'tests',
  50688. fn: function (){
  50689. var self=this;
  50690. return $core.withContext(function($ctx1) {
  50691. var $3,$2,$1,$4;
  50692. $3=self._collectionClass();
  50693. $ctx1.sendIdx["collectionClass"]=1;
  50694. $2=$recv($3)._new();
  50695. $recv($2)._at_put_("firstname","James");
  50696. $ctx1.sendIdx["at:put:"]=1;
  50697. $recv($2)._at_put_("lastname","Bond");
  50698. $1=$recv($2)._printString();
  50699. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50700. $ctx1.sendIdx[","]=1;
  50701. self._assert_equals_($1,$4);
  50702. return self;
  50703. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50704. },
  50705. args: [],
  50706. 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'')'",
  50707. referencedClasses: [],
  50708. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50709. }),
  50710. $globals.AssociativeCollectionTest);
  50711. $core.addMethod(
  50712. $core.method({
  50713. selector: "testRemoveKey",
  50714. protocol: 'tests',
  50715. fn: function (){
  50716. var self=this;
  50717. return $core.withContext(function($ctx1) {
  50718. var $1,$2,$3,$5,$6,$4,$8,$7;
  50719. self._nonIndexesDo_((function(each){
  50720. var collection;
  50721. return $core.withContext(function($ctx2) {
  50722. collection=self._collection();
  50723. $ctx2.sendIdx["collection"]=1;
  50724. collection;
  50725. self._should_raise_((function(){
  50726. return $core.withContext(function($ctx3) {
  50727. return $recv(collection)._removeKey_(each);
  50728. $ctx3.sendIdx["removeKey:"]=1;
  50729. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50730. }),$globals.Error);
  50731. $1=collection;
  50732. $2=self._collection();
  50733. $ctx2.sendIdx["collection"]=2;
  50734. return self._assert_equals_($1,$2);
  50735. $ctx2.sendIdx["assert:equals:"]=1;
  50736. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50737. }));
  50738. self._samplesDo_((function(index,value){
  50739. var collection;
  50740. return $core.withContext(function($ctx2) {
  50741. collection=self._collection();
  50742. $ctx2.sendIdx["collection"]=3;
  50743. collection;
  50744. $3=$recv(collection)._removeKey_(index);
  50745. $ctx2.sendIdx["removeKey:"]=2;
  50746. self._assert_equals_($3,value);
  50747. $ctx2.sendIdx["assert:equals:"]=2;
  50748. $5=collection;
  50749. $6=self._collection();
  50750. $ctx2.sendIdx["collection"]=4;
  50751. $4=$recv($5).__eq($6);
  50752. return self._deny_($4);
  50753. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50754. }));
  50755. $8=self._collectionWithNewValue();
  50756. $recv($8)._removeKey_(self._sampleNewIndex());
  50757. $7=$recv($8)._yourself();
  50758. self._assert_equals_($7,self._collection());
  50759. return self;
  50760. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50761. },
  50762. args: [],
  50763. 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",
  50764. referencedClasses: ["Error"],
  50765. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50766. }),
  50767. $globals.AssociativeCollectionTest);
  50768. $core.addMethod(
  50769. $core.method({
  50770. selector: "testRemoveKeyIfAbsent",
  50771. protocol: 'tests',
  50772. fn: function (){
  50773. var self=this;
  50774. return $core.withContext(function($ctx1) {
  50775. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50776. self._nonIndexesDo_((function(each){
  50777. var collection;
  50778. return $core.withContext(function($ctx2) {
  50779. collection=self._collection();
  50780. $ctx2.sendIdx["collection"]=1;
  50781. collection;
  50782. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50783. return $core.withContext(function($ctx3) {
  50784. return self._sampleNewValue();
  50785. $ctx3.sendIdx["sampleNewValue"]=1;
  50786. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50787. }));
  50788. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50789. $2=self._sampleNewValue();
  50790. $ctx2.sendIdx["sampleNewValue"]=2;
  50791. self._assert_equals_($1,$2);
  50792. $ctx2.sendIdx["assert:equals:"]=1;
  50793. $3=collection;
  50794. $4=self._collection();
  50795. $ctx2.sendIdx["collection"]=2;
  50796. return self._assert_equals_($3,$4);
  50797. $ctx2.sendIdx["assert:equals:"]=2;
  50798. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50799. }));
  50800. self._samplesDo_((function(index,value){
  50801. var collection;
  50802. return $core.withContext(function($ctx2) {
  50803. collection=self._collection();
  50804. $ctx2.sendIdx["collection"]=3;
  50805. collection;
  50806. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50807. return $core.withContext(function($ctx3) {
  50808. return self._sampleNewValue();
  50809. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50810. }));
  50811. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50812. self._assert_equals_($5,value);
  50813. $ctx2.sendIdx["assert:equals:"]=3;
  50814. $7=collection;
  50815. $8=self._collection();
  50816. $ctx2.sendIdx["collection"]=4;
  50817. $6=$recv($7).__eq($8);
  50818. return self._deny_($6);
  50819. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50820. }));
  50821. $10=self._collectionWithNewValue();
  50822. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50823. return $core.withContext(function($ctx2) {
  50824. return self._assert_(false);
  50825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50826. }));
  50827. $9=$recv($10)._yourself();
  50828. self._assert_equals_($9,self._collection());
  50829. return self;
  50830. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50831. },
  50832. args: [],
  50833. 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",
  50834. referencedClasses: [],
  50835. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50836. }),
  50837. $globals.AssociativeCollectionTest);
  50838. $core.addMethod(
  50839. $core.method({
  50840. selector: "testValues",
  50841. protocol: 'tests',
  50842. fn: function (){
  50843. var self=this;
  50844. return $core.withContext(function($ctx1) {
  50845. var $2,$1,$3,$4;
  50846. $2=$recv($recv(self._collectionClass())._new())._values();
  50847. $ctx1.sendIdx["values"]=1;
  50848. $1=$recv($2)._isEmpty();
  50849. self._assert_($1);
  50850. $3=$recv(self._collection())._values();
  50851. $ctx1.sendIdx["values"]=2;
  50852. $4=self._collectionValues();
  50853. $ctx1.sendIdx["collectionValues"]=1;
  50854. self._assertSameContents_as_($3,$4);
  50855. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50856. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50857. return self;
  50858. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50859. },
  50860. args: [],
  50861. 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 }",
  50862. referencedClasses: [],
  50863. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50864. }),
  50865. $globals.AssociativeCollectionTest);
  50866. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50867. $core.addMethod(
  50868. $core.method({
  50869. selector: "collection",
  50870. protocol: 'fixture',
  50871. fn: function (){
  50872. var self=this;
  50873. return $core.withContext(function($ctx1) {
  50874. var $1;
  50875. $1=$recv($globals.Dictionary)._new();
  50876. $recv($1)._at_put_((1),(1));
  50877. $ctx1.sendIdx["at:put:"]=1;
  50878. $recv($1)._at_put_("a",(2));
  50879. $ctx1.sendIdx["at:put:"]=2;
  50880. $recv($1)._at_put_(true,(3));
  50881. $ctx1.sendIdx["at:put:"]=3;
  50882. $recv($1)._at_put_((1).__at((3)),(-4));
  50883. $ctx1.sendIdx["at:put:"]=4;
  50884. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50885. return $recv($1)._yourself();
  50886. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50887. },
  50888. args: [],
  50889. 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",
  50890. referencedClasses: ["Dictionary"],
  50891. messageSends: ["at:put:", "new", "@", "yourself"]
  50892. }),
  50893. $globals.DictionaryTest);
  50894. $core.addMethod(
  50895. $core.method({
  50896. selector: "collectionKeys",
  50897. protocol: 'fixture',
  50898. fn: function (){
  50899. var self=this;
  50900. return $core.withContext(function($ctx1) {
  50901. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50902. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50903. },
  50904. args: [],
  50905. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50906. referencedClasses: [],
  50907. messageSends: ["@"]
  50908. }),
  50909. $globals.DictionaryTest);
  50910. $core.addMethod(
  50911. $core.method({
  50912. selector: "collectionOfPrintStrings",
  50913. protocol: 'fixture',
  50914. fn: function (){
  50915. var self=this;
  50916. return $core.withContext(function($ctx1) {
  50917. var $1;
  50918. $1=$recv($globals.Dictionary)._new();
  50919. $recv($1)._at_put_((1),"1");
  50920. $ctx1.sendIdx["at:put:"]=1;
  50921. $recv($1)._at_put_("a","2");
  50922. $ctx1.sendIdx["at:put:"]=2;
  50923. $recv($1)._at_put_(true,"3");
  50924. $ctx1.sendIdx["at:put:"]=3;
  50925. $recv($1)._at_put_((1).__at((3)),"-4");
  50926. $ctx1.sendIdx["at:put:"]=4;
  50927. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50928. return $recv($1)._yourself();
  50929. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50930. },
  50931. args: [],
  50932. 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",
  50933. referencedClasses: ["Dictionary"],
  50934. messageSends: ["at:put:", "new", "@", "yourself"]
  50935. }),
  50936. $globals.DictionaryTest);
  50937. $core.addMethod(
  50938. $core.method({
  50939. selector: "collectionSize",
  50940. protocol: 'fixture',
  50941. fn: function (){
  50942. var self=this;
  50943. return (5);
  50944. },
  50945. args: [],
  50946. source: "collectionSize\x0a\x09^ 5",
  50947. referencedClasses: [],
  50948. messageSends: []
  50949. }),
  50950. $globals.DictionaryTest);
  50951. $core.addMethod(
  50952. $core.method({
  50953. selector: "collectionValues",
  50954. protocol: 'fixture',
  50955. fn: function (){
  50956. var self=this;
  50957. return [(1),(2),(3),(-4),(9)];
  50958. },
  50959. args: [],
  50960. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50961. referencedClasses: [],
  50962. messageSends: []
  50963. }),
  50964. $globals.DictionaryTest);
  50965. $core.addMethod(
  50966. $core.method({
  50967. selector: "collectionWithDuplicates",
  50968. protocol: 'fixture',
  50969. fn: function (){
  50970. var self=this;
  50971. return $core.withContext(function($ctx1) {
  50972. var $1;
  50973. $1=$recv($globals.Dictionary)._new();
  50974. $recv($1)._at_put_((1),(1));
  50975. $ctx1.sendIdx["at:put:"]=1;
  50976. $recv($1)._at_put_("a",(2));
  50977. $ctx1.sendIdx["at:put:"]=2;
  50978. $recv($1)._at_put_(true,(3));
  50979. $ctx1.sendIdx["at:put:"]=3;
  50980. $recv($1)._at_put_((4),(-4));
  50981. $ctx1.sendIdx["at:put:"]=4;
  50982. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50983. $ctx1.sendIdx["at:put:"]=5;
  50984. $recv($1)._at_put_("b",(1));
  50985. $ctx1.sendIdx["at:put:"]=6;
  50986. $recv($1)._at_put_((3),(3));
  50987. $ctx1.sendIdx["at:put:"]=7;
  50988. $recv($1)._at_put_(false,(12));
  50989. return $recv($1)._yourself();
  50990. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50991. },
  50992. args: [],
  50993. 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",
  50994. referencedClasses: ["Dictionary"],
  50995. messageSends: ["at:put:", "new", "yourself"]
  50996. }),
  50997. $globals.DictionaryTest);
  50998. $core.addMethod(
  50999. $core.method({
  51000. selector: "collectionWithNewValue",
  51001. protocol: 'fixture',
  51002. fn: function (){
  51003. var self=this;
  51004. return $core.withContext(function($ctx1) {
  51005. var $1;
  51006. $1=$recv($globals.Dictionary)._new();
  51007. $recv($1)._at_put_((1),(1));
  51008. $ctx1.sendIdx["at:put:"]=1;
  51009. $recv($1)._at_put_("a",(2));
  51010. $ctx1.sendIdx["at:put:"]=2;
  51011. $recv($1)._at_put_(true,(3));
  51012. $ctx1.sendIdx["at:put:"]=3;
  51013. $recv($1)._at_put_((1).__at((3)),(-4));
  51014. $ctx1.sendIdx["at:put:"]=4;
  51015. $recv($1)._at_put_(self["@sampleBlock"],(9));
  51016. $ctx1.sendIdx["at:put:"]=5;
  51017. $recv($1)._at_put_("new","N");
  51018. return $recv($1)._yourself();
  51019. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51020. },
  51021. args: [],
  51022. 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",
  51023. referencedClasses: ["Dictionary"],
  51024. messageSends: ["at:put:", "new", "@", "yourself"]
  51025. }),
  51026. $globals.DictionaryTest);
  51027. $core.addMethod(
  51028. $core.method({
  51029. selector: "sampleNewValueAsCollection",
  51030. protocol: 'fixture',
  51031. fn: function (){
  51032. var self=this;
  51033. return $core.withContext(function($ctx1) {
  51034. var $1;
  51035. $1=$recv($globals.Dictionary)._new();
  51036. $recv($1)._at_put_("new","N");
  51037. return $recv($1)._yourself();
  51038. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51039. },
  51040. args: [],
  51041. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51042. referencedClasses: ["Dictionary"],
  51043. messageSends: ["at:put:", "new", "yourself"]
  51044. }),
  51045. $globals.DictionaryTest);
  51046. $core.addMethod(
  51047. $core.method({
  51048. selector: "samplesDo:",
  51049. protocol: 'fixture',
  51050. fn: function (aBlock){
  51051. var self=this;
  51052. return $core.withContext(function($ctx1) {
  51053. (
  51054. $ctx1.supercall = true,
  51055. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51056. $ctx1.supercall = false;
  51057. $recv(aBlock)._value_value_(true,(3));
  51058. $ctx1.sendIdx["value:value:"]=1;
  51059. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51060. $ctx1.sendIdx["value:value:"]=2;
  51061. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  51062. return self;
  51063. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51064. },
  51065. args: ["aBlock"],
  51066. 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",
  51067. referencedClasses: [],
  51068. messageSends: ["samplesDo:", "value:value:", "@"]
  51069. }),
  51070. $globals.DictionaryTest);
  51071. $core.addMethod(
  51072. $core.method({
  51073. selector: "testAccessing",
  51074. protocol: 'tests',
  51075. fn: function (){
  51076. var self=this;
  51077. var d;
  51078. return $core.withContext(function($ctx1) {
  51079. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  51080. d=$recv($globals.Dictionary)._new();
  51081. $recv(d)._at_put_("hello","world");
  51082. $ctx1.sendIdx["at:put:"]=1;
  51083. $1=$recv(d)._at_("hello");
  51084. $ctx1.sendIdx["at:"]=1;
  51085. self._assert_equals_($1,"world");
  51086. $ctx1.sendIdx["assert:equals:"]=1;
  51087. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  51088. return nil;
  51089. }));
  51090. $ctx1.sendIdx["at:ifAbsent:"]=1;
  51091. self._assert_equals_($2,"world");
  51092. $ctx1.sendIdx["assert:equals:"]=2;
  51093. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  51094. return nil;
  51095. }))).__eq("world"));
  51096. $ctx1.sendIdx["deny:"]=1;
  51097. $3=$recv(d)._includesKey_("hello");
  51098. $ctx1.sendIdx["includesKey:"]=1;
  51099. self._assert_($3);
  51100. $ctx1.sendIdx["assert:"]=1;
  51101. $4=$recv(d)._includesKey_("foo");
  51102. $ctx1.sendIdx["includesKey:"]=2;
  51103. self._deny_($4);
  51104. $ctx1.sendIdx["deny:"]=2;
  51105. $recv(d)._at_put_((1),(2));
  51106. $ctx1.sendIdx["at:put:"]=2;
  51107. $5=$recv(d)._at_((1));
  51108. $ctx1.sendIdx["at:"]=2;
  51109. self._assert_equals_($5,(2));
  51110. $ctx1.sendIdx["assert:equals:"]=3;
  51111. $6=d;
  51112. $7=(1).__at((3));
  51113. $ctx1.sendIdx["@"]=1;
  51114. $recv($6)._at_put_($7,(3));
  51115. $9=d;
  51116. $10=(1).__at((3));
  51117. $ctx1.sendIdx["@"]=2;
  51118. $8=$recv($9)._at_($10);
  51119. self._assert_equals_($8,(3));
  51120. $12=d;
  51121. $13=(1).__at((3));
  51122. $ctx1.sendIdx["@"]=3;
  51123. $11=$recv($12)._includesKey_($13);
  51124. $ctx1.sendIdx["includesKey:"]=3;
  51125. self._assert_($11);
  51126. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51127. return self;
  51128. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51129. },
  51130. args: [],
  51131. 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)",
  51132. referencedClasses: ["Dictionary"],
  51133. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51134. }),
  51135. $globals.DictionaryTest);
  51136. $core.addMethod(
  51137. $core.method({
  51138. selector: "testDynamicDictionaries",
  51139. protocol: 'tests',
  51140. fn: function (){
  51141. var self=this;
  51142. return $core.withContext(function($ctx1) {
  51143. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  51144. return self;
  51145. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51146. },
  51147. args: [],
  51148. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51149. referencedClasses: ["Dictionary"],
  51150. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51151. }),
  51152. $globals.DictionaryTest);
  51153. $core.addMethod(
  51154. $core.method({
  51155. selector: "collectionClass",
  51156. protocol: 'fixture',
  51157. fn: function (){
  51158. var self=this;
  51159. return $globals.Dictionary;
  51160. },
  51161. args: [],
  51162. source: "collectionClass\x0a\x09^ Dictionary",
  51163. referencedClasses: ["Dictionary"],
  51164. messageSends: []
  51165. }),
  51166. $globals.DictionaryTest.klass);
  51167. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51168. $core.addMethod(
  51169. $core.method({
  51170. selector: "collection",
  51171. protocol: 'fixture',
  51172. fn: function (){
  51173. var self=this;
  51174. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51175. },
  51176. args: [],
  51177. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51178. referencedClasses: [],
  51179. messageSends: []
  51180. }),
  51181. $globals.HashedCollectionTest);
  51182. $core.addMethod(
  51183. $core.method({
  51184. selector: "collectionKeys",
  51185. protocol: 'fixture',
  51186. fn: function (){
  51187. var self=this;
  51188. return ["b","a","c","d"];
  51189. },
  51190. args: [],
  51191. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51192. referencedClasses: [],
  51193. messageSends: []
  51194. }),
  51195. $globals.HashedCollectionTest);
  51196. $core.addMethod(
  51197. $core.method({
  51198. selector: "collectionOfPrintStrings",
  51199. protocol: 'fixture',
  51200. fn: function (){
  51201. var self=this;
  51202. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51203. },
  51204. args: [],
  51205. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51206. referencedClasses: [],
  51207. messageSends: []
  51208. }),
  51209. $globals.HashedCollectionTest);
  51210. $core.addMethod(
  51211. $core.method({
  51212. selector: "collectionSize",
  51213. protocol: 'fixture',
  51214. fn: function (){
  51215. var self=this;
  51216. return (4);
  51217. },
  51218. args: [],
  51219. source: "collectionSize\x0a\x09^ 4",
  51220. referencedClasses: [],
  51221. messageSends: []
  51222. }),
  51223. $globals.HashedCollectionTest);
  51224. $core.addMethod(
  51225. $core.method({
  51226. selector: "collectionValues",
  51227. protocol: 'fixture',
  51228. fn: function (){
  51229. var self=this;
  51230. return [(1),(2),(3),(-4)];
  51231. },
  51232. args: [],
  51233. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51234. referencedClasses: [],
  51235. messageSends: []
  51236. }),
  51237. $globals.HashedCollectionTest);
  51238. $core.addMethod(
  51239. $core.method({
  51240. selector: "collectionWithDuplicates",
  51241. protocol: 'fixture',
  51242. fn: function (){
  51243. var self=this;
  51244. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  51245. },
  51246. args: [],
  51247. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  51248. referencedClasses: [],
  51249. messageSends: []
  51250. }),
  51251. $globals.HashedCollectionTest);
  51252. $core.addMethod(
  51253. $core.method({
  51254. selector: "collectionWithNewValue",
  51255. protocol: 'fixture',
  51256. fn: function (){
  51257. var self=this;
  51258. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51259. },
  51260. args: [],
  51261. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  51262. referencedClasses: [],
  51263. messageSends: []
  51264. }),
  51265. $globals.HashedCollectionTest);
  51266. $core.addMethod(
  51267. $core.method({
  51268. selector: "sampleNewValueAsCollection",
  51269. protocol: 'fixture',
  51270. fn: function (){
  51271. var self=this;
  51272. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  51273. },
  51274. args: [],
  51275. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  51276. referencedClasses: [],
  51277. messageSends: []
  51278. }),
  51279. $globals.HashedCollectionTest);
  51280. $core.addMethod(
  51281. $core.method({
  51282. selector: "testDynamicDictionaries",
  51283. protocol: 'tests',
  51284. fn: function (){
  51285. var self=this;
  51286. return $core.withContext(function($ctx1) {
  51287. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  51288. return self;
  51289. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  51290. },
  51291. args: [],
  51292. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  51293. referencedClasses: ["HashedCollection"],
  51294. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  51295. }),
  51296. $globals.HashedCollectionTest);
  51297. $core.addMethod(
  51298. $core.method({
  51299. selector: "collectionClass",
  51300. protocol: 'fixture',
  51301. fn: function (){
  51302. var self=this;
  51303. return $globals.HashedCollection;
  51304. },
  51305. args: [],
  51306. source: "collectionClass\x0a\x09^ HashedCollection",
  51307. referencedClasses: ["HashedCollection"],
  51308. messageSends: []
  51309. }),
  51310. $globals.HashedCollectionTest.klass);
  51311. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51312. $core.addMethod(
  51313. $core.method({
  51314. selector: "collectionFirst",
  51315. protocol: 'fixture',
  51316. fn: function (){
  51317. var self=this;
  51318. return $core.withContext(function($ctx1) {
  51319. self._subclassResponsibility();
  51320. return self;
  51321. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  51322. },
  51323. args: [],
  51324. source: "collectionFirst\x0a\x09self subclassResponsibility",
  51325. referencedClasses: [],
  51326. messageSends: ["subclassResponsibility"]
  51327. }),
  51328. $globals.SequenceableCollectionTest);
  51329. $core.addMethod(
  51330. $core.method({
  51331. selector: "collectionFirstTwo",
  51332. protocol: 'fixture',
  51333. fn: function (){
  51334. var self=this;
  51335. return $core.withContext(function($ctx1) {
  51336. self._subclassResponsibility();
  51337. return self;
  51338. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  51339. },
  51340. args: [],
  51341. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  51342. referencedClasses: [],
  51343. messageSends: ["subclassResponsibility"]
  51344. }),
  51345. $globals.SequenceableCollectionTest);
  51346. $core.addMethod(
  51347. $core.method({
  51348. selector: "collectionLast",
  51349. protocol: 'fixture',
  51350. fn: function (){
  51351. var self=this;
  51352. return $core.withContext(function($ctx1) {
  51353. self._subclassResponsibility();
  51354. return self;
  51355. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  51356. },
  51357. args: [],
  51358. source: "collectionLast\x0a\x09self subclassResponsibility",
  51359. referencedClasses: [],
  51360. messageSends: ["subclassResponsibility"]
  51361. }),
  51362. $globals.SequenceableCollectionTest);
  51363. $core.addMethod(
  51364. $core.method({
  51365. selector: "collectionLastTwo",
  51366. protocol: 'fixture',
  51367. fn: function (){
  51368. var self=this;
  51369. return $core.withContext(function($ctx1) {
  51370. self._subclassResponsibility();
  51371. return self;
  51372. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51373. },
  51374. args: [],
  51375. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51376. referencedClasses: [],
  51377. messageSends: ["subclassResponsibility"]
  51378. }),
  51379. $globals.SequenceableCollectionTest);
  51380. $core.addMethod(
  51381. $core.method({
  51382. selector: "nonIndexesDo:",
  51383. protocol: 'fixture',
  51384. fn: function (aBlock){
  51385. var self=this;
  51386. return $core.withContext(function($ctx1) {
  51387. $recv(aBlock)._value_((0));
  51388. $ctx1.sendIdx["value:"]=1;
  51389. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51390. $ctx1.sendIdx["value:"]=2;
  51391. $recv(aBlock)._value_("z");
  51392. return self;
  51393. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51394. },
  51395. args: ["aBlock"],
  51396. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51397. referencedClasses: [],
  51398. messageSends: ["value:", "+", "collectionSize"]
  51399. }),
  51400. $globals.SequenceableCollectionTest);
  51401. $core.addMethod(
  51402. $core.method({
  51403. selector: "samplesDo:",
  51404. protocol: 'fixture',
  51405. fn: function (aBlock){
  51406. var self=this;
  51407. return $core.withContext(function($ctx1) {
  51408. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51409. $ctx1.sendIdx["value:value:"]=1;
  51410. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51411. return self;
  51412. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51413. },
  51414. args: ["aBlock"],
  51415. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51416. referencedClasses: [],
  51417. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51418. }),
  51419. $globals.SequenceableCollectionTest);
  51420. $core.addMethod(
  51421. $core.method({
  51422. selector: "testBeginsWith",
  51423. protocol: 'tests',
  51424. fn: function (){
  51425. var self=this;
  51426. return $core.withContext(function($ctx1) {
  51427. var $2,$1,$4,$5,$3,$7,$6;
  51428. $2=self._collection();
  51429. $ctx1.sendIdx["collection"]=1;
  51430. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51431. $ctx1.sendIdx["beginsWith:"]=1;
  51432. self._assert_($1);
  51433. $ctx1.sendIdx["assert:"]=1;
  51434. $4=self._collection();
  51435. $ctx1.sendIdx["collection"]=2;
  51436. $5=self._collection();
  51437. $ctx1.sendIdx["collection"]=3;
  51438. $3=$recv($4)._beginsWith_($5);
  51439. $ctx1.sendIdx["beginsWith:"]=2;
  51440. self._assert_($3);
  51441. $ctx1.sendIdx["assert:"]=2;
  51442. $7=self._collection();
  51443. $ctx1.sendIdx["collection"]=4;
  51444. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51445. $ctx1.sendIdx["beginsWith:"]=3;
  51446. self._assert_($6);
  51447. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51448. return self;
  51449. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51450. },
  51451. args: [],
  51452. 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)",
  51453. referencedClasses: [],
  51454. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51455. }),
  51456. $globals.SequenceableCollectionTest);
  51457. $core.addMethod(
  51458. $core.method({
  51459. selector: "testEndsWith",
  51460. protocol: 'tests',
  51461. fn: function (){
  51462. var self=this;
  51463. return $core.withContext(function($ctx1) {
  51464. var $2,$1,$4,$5,$3,$7,$6;
  51465. $2=self._collection();
  51466. $ctx1.sendIdx["collection"]=1;
  51467. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51468. $ctx1.sendIdx["endsWith:"]=1;
  51469. self._assert_($1);
  51470. $ctx1.sendIdx["assert:"]=1;
  51471. $4=self._collection();
  51472. $ctx1.sendIdx["collection"]=2;
  51473. $5=self._collection();
  51474. $ctx1.sendIdx["collection"]=3;
  51475. $3=$recv($4)._endsWith_($5);
  51476. $ctx1.sendIdx["endsWith:"]=2;
  51477. self._assert_($3);
  51478. $ctx1.sendIdx["assert:"]=2;
  51479. $7=self._collection();
  51480. $ctx1.sendIdx["collection"]=4;
  51481. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51482. $ctx1.sendIdx["endsWith:"]=3;
  51483. self._assert_($6);
  51484. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51485. return self;
  51486. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51487. },
  51488. args: [],
  51489. 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)",
  51490. referencedClasses: [],
  51491. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51492. }),
  51493. $globals.SequenceableCollectionTest);
  51494. $core.addMethod(
  51495. $core.method({
  51496. selector: "testFirst",
  51497. protocol: 'tests',
  51498. fn: function (){
  51499. var self=this;
  51500. return $core.withContext(function($ctx1) {
  51501. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51502. return self;
  51503. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51504. },
  51505. args: [],
  51506. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51507. referencedClasses: [],
  51508. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51509. }),
  51510. $globals.SequenceableCollectionTest);
  51511. $core.addMethod(
  51512. $core.method({
  51513. selector: "testFirstN",
  51514. protocol: 'tests',
  51515. fn: function (){
  51516. var self=this;
  51517. return $core.withContext(function($ctx1) {
  51518. var $2,$1,$4,$3,$6,$5,$7;
  51519. $2=self._collection();
  51520. $ctx1.sendIdx["collection"]=1;
  51521. $1=$recv($2)._first_((2));
  51522. $ctx1.sendIdx["first:"]=1;
  51523. self._assert_equals_($1,self._collectionFirstTwo());
  51524. $ctx1.sendIdx["assert:equals:"]=1;
  51525. $4=self._collection();
  51526. $ctx1.sendIdx["collection"]=2;
  51527. $3=$recv($4)._first_((0));
  51528. $ctx1.sendIdx["first:"]=2;
  51529. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51530. $ctx1.sendIdx["assert:equals:"]=2;
  51531. $6=self._collection();
  51532. $ctx1.sendIdx["collection"]=3;
  51533. $5=$recv($6)._first_(self._collectionSize());
  51534. $ctx1.sendIdx["first:"]=3;
  51535. $7=self._collection();
  51536. $ctx1.sendIdx["collection"]=4;
  51537. self._assert_equals_($5,$7);
  51538. self._should_raise_((function(){
  51539. return $core.withContext(function($ctx2) {
  51540. return $recv(self._collection())._first_((33));
  51541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51542. }),$globals.Error);
  51543. return self;
  51544. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51545. },
  51546. args: [],
  51547. 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",
  51548. referencedClasses: ["Error"],
  51549. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51550. }),
  51551. $globals.SequenceableCollectionTest);
  51552. $core.addMethod(
  51553. $core.method({
  51554. selector: "testFourth",
  51555. protocol: 'tests',
  51556. fn: function (){
  51557. var self=this;
  51558. return $core.withContext(function($ctx1) {
  51559. var $2,$1;
  51560. $2=self._collection();
  51561. $ctx1.sendIdx["collection"]=1;
  51562. $1=$recv($2)._fourth();
  51563. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51564. return self;
  51565. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51566. },
  51567. args: [],
  51568. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51569. referencedClasses: [],
  51570. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51571. }),
  51572. $globals.SequenceableCollectionTest);
  51573. $core.addMethod(
  51574. $core.method({
  51575. selector: "testIndexOfStartingAt",
  51576. protocol: 'tests',
  51577. fn: function (){
  51578. var self=this;
  51579. var jsNull;
  51580. return $core.withContext(function($ctx1) {
  51581. var $2,$1,$4,$3;
  51582. jsNull=$recv($globals.JSON)._parse_("null");
  51583. self._samplesDo_((function(index,value){
  51584. return $core.withContext(function($ctx2) {
  51585. $2=self._collection();
  51586. $ctx2.sendIdx["collection"]=1;
  51587. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51588. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51589. self._assert_equals_($1,index);
  51590. $ctx2.sendIdx["assert:equals:"]=1;
  51591. $4=self._collection();
  51592. $ctx2.sendIdx["collection"]=2;
  51593. $3=$recv($4)._indexOf_startingAt_(value,index);
  51594. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51595. self._assert_equals_($3,index);
  51596. $ctx2.sendIdx["assert:equals:"]=2;
  51597. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51598. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51599. }));
  51600. return self;
  51601. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51602. },
  51603. args: [],
  51604. 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 ]",
  51605. referencedClasses: ["JSON"],
  51606. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51607. }),
  51608. $globals.SequenceableCollectionTest);
  51609. $core.addMethod(
  51610. $core.method({
  51611. selector: "testIndexOfStartingAtWithNull",
  51612. protocol: 'tests',
  51613. fn: function (){
  51614. var self=this;
  51615. var jsNull;
  51616. return $core.withContext(function($ctx1) {
  51617. var $1,$2;
  51618. jsNull=$recv($globals.JSON)._parse_("null");
  51619. self._samplesDo_((function(index,value){
  51620. var collection;
  51621. return $core.withContext(function($ctx2) {
  51622. collection=self._collection();
  51623. collection;
  51624. $recv(collection)._at_put_(index,jsNull);
  51625. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51626. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51627. self._assert_equals_($1,index);
  51628. $ctx2.sendIdx["assert:equals:"]=1;
  51629. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51630. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51631. self._assert_equals_($2,index);
  51632. $ctx2.sendIdx["assert:equals:"]=2;
  51633. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51634. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51635. }));
  51636. return self;
  51637. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51638. },
  51639. args: [],
  51640. 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 ]",
  51641. referencedClasses: ["JSON"],
  51642. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51643. }),
  51644. $globals.SequenceableCollectionTest);
  51645. $core.addMethod(
  51646. $core.method({
  51647. selector: "testLast",
  51648. protocol: 'tests',
  51649. fn: function (){
  51650. var self=this;
  51651. return $core.withContext(function($ctx1) {
  51652. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51653. return self;
  51654. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51655. },
  51656. args: [],
  51657. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51658. referencedClasses: [],
  51659. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51660. }),
  51661. $globals.SequenceableCollectionTest);
  51662. $core.addMethod(
  51663. $core.method({
  51664. selector: "testLastN",
  51665. protocol: 'tests',
  51666. fn: function (){
  51667. var self=this;
  51668. return $core.withContext(function($ctx1) {
  51669. var $2,$1,$4,$3,$6,$5,$7;
  51670. $2=self._collection();
  51671. $ctx1.sendIdx["collection"]=1;
  51672. $1=$recv($2)._last_((2));
  51673. $ctx1.sendIdx["last:"]=1;
  51674. self._assert_equals_($1,self._collectionLastTwo());
  51675. $ctx1.sendIdx["assert:equals:"]=1;
  51676. $4=self._collection();
  51677. $ctx1.sendIdx["collection"]=2;
  51678. $3=$recv($4)._last_((0));
  51679. $ctx1.sendIdx["last:"]=2;
  51680. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51681. $ctx1.sendIdx["assert:equals:"]=2;
  51682. $6=self._collection();
  51683. $ctx1.sendIdx["collection"]=3;
  51684. $5=$recv($6)._last_(self._collectionSize());
  51685. $ctx1.sendIdx["last:"]=3;
  51686. $7=self._collection();
  51687. $ctx1.sendIdx["collection"]=4;
  51688. self._assert_equals_($5,$7);
  51689. self._should_raise_((function(){
  51690. return $core.withContext(function($ctx2) {
  51691. return $recv(self._collection())._last_((33));
  51692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51693. }),$globals.Error);
  51694. return self;
  51695. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51696. },
  51697. args: [],
  51698. 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",
  51699. referencedClasses: ["Error"],
  51700. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51701. }),
  51702. $globals.SequenceableCollectionTest);
  51703. $core.addMethod(
  51704. $core.method({
  51705. selector: "testSecond",
  51706. protocol: 'tests',
  51707. fn: function (){
  51708. var self=this;
  51709. return $core.withContext(function($ctx1) {
  51710. var $2,$1;
  51711. $2=self._collection();
  51712. $ctx1.sendIdx["collection"]=1;
  51713. $1=$recv($2)._second();
  51714. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51715. return self;
  51716. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51717. },
  51718. args: [],
  51719. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51720. referencedClasses: [],
  51721. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51722. }),
  51723. $globals.SequenceableCollectionTest);
  51724. $core.addMethod(
  51725. $core.method({
  51726. selector: "testThird",
  51727. protocol: 'tests',
  51728. fn: function (){
  51729. var self=this;
  51730. return $core.withContext(function($ctx1) {
  51731. var $2,$1;
  51732. $2=self._collection();
  51733. $ctx1.sendIdx["collection"]=1;
  51734. $1=$recv($2)._third();
  51735. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51736. return self;
  51737. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51738. },
  51739. args: [],
  51740. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51741. referencedClasses: [],
  51742. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51743. }),
  51744. $globals.SequenceableCollectionTest);
  51745. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51746. $core.addMethod(
  51747. $core.method({
  51748. selector: "collection",
  51749. protocol: 'fixture',
  51750. fn: function (){
  51751. var self=this;
  51752. return [(1), (2), (3), (-4)];
  51753. },
  51754. args: [],
  51755. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51756. referencedClasses: [],
  51757. messageSends: []
  51758. }),
  51759. $globals.ArrayTest);
  51760. $core.addMethod(
  51761. $core.method({
  51762. selector: "collectionFirst",
  51763. protocol: 'fixture',
  51764. fn: function (){
  51765. var self=this;
  51766. return (1);
  51767. },
  51768. args: [],
  51769. source: "collectionFirst\x0a\x09^ 1",
  51770. referencedClasses: [],
  51771. messageSends: []
  51772. }),
  51773. $globals.ArrayTest);
  51774. $core.addMethod(
  51775. $core.method({
  51776. selector: "collectionFirstTwo",
  51777. protocol: 'fixture',
  51778. fn: function (){
  51779. var self=this;
  51780. return [(1), (2)];
  51781. },
  51782. args: [],
  51783. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51784. referencedClasses: [],
  51785. messageSends: []
  51786. }),
  51787. $globals.ArrayTest);
  51788. $core.addMethod(
  51789. $core.method({
  51790. selector: "collectionLast",
  51791. protocol: 'fixture',
  51792. fn: function (){
  51793. var self=this;
  51794. return (-4);
  51795. },
  51796. args: [],
  51797. source: "collectionLast\x0a\x09^ -4",
  51798. referencedClasses: [],
  51799. messageSends: []
  51800. }),
  51801. $globals.ArrayTest);
  51802. $core.addMethod(
  51803. $core.method({
  51804. selector: "collectionLastTwo",
  51805. protocol: 'fixture',
  51806. fn: function (){
  51807. var self=this;
  51808. return [(3), (-4)];
  51809. },
  51810. args: [],
  51811. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51812. referencedClasses: [],
  51813. messageSends: []
  51814. }),
  51815. $globals.ArrayTest);
  51816. $core.addMethod(
  51817. $core.method({
  51818. selector: "collectionOfPrintStrings",
  51819. protocol: 'fixture',
  51820. fn: function (){
  51821. var self=this;
  51822. return ["1", "2", "3", "-4"];
  51823. },
  51824. args: [],
  51825. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51826. referencedClasses: [],
  51827. messageSends: []
  51828. }),
  51829. $globals.ArrayTest);
  51830. $core.addMethod(
  51831. $core.method({
  51832. selector: "collectionSize",
  51833. protocol: 'fixture',
  51834. fn: function (){
  51835. var self=this;
  51836. return (4);
  51837. },
  51838. args: [],
  51839. source: "collectionSize\x0a\x09^ 4",
  51840. referencedClasses: [],
  51841. messageSends: []
  51842. }),
  51843. $globals.ArrayTest);
  51844. $core.addMethod(
  51845. $core.method({
  51846. selector: "collectionWithDuplicates",
  51847. protocol: 'fixture',
  51848. fn: function (){
  51849. var self=this;
  51850. return ["a", "b", "c", (1), (2), (1), "a", []];
  51851. },
  51852. args: [],
  51853. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51854. referencedClasses: [],
  51855. messageSends: []
  51856. }),
  51857. $globals.ArrayTest);
  51858. $core.addMethod(
  51859. $core.method({
  51860. selector: "collectionWithNewValue",
  51861. protocol: 'fixture',
  51862. fn: function (){
  51863. var self=this;
  51864. return [(1), (2), (3), (-4), "N"];
  51865. },
  51866. args: [],
  51867. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51868. referencedClasses: [],
  51869. messageSends: []
  51870. }),
  51871. $globals.ArrayTest);
  51872. $core.addMethod(
  51873. $core.method({
  51874. selector: "sampleNewIndex",
  51875. protocol: 'fixture',
  51876. fn: function (){
  51877. var self=this;
  51878. return (5);
  51879. },
  51880. args: [],
  51881. source: "sampleNewIndex\x0a\x09^ 5",
  51882. referencedClasses: [],
  51883. messageSends: []
  51884. }),
  51885. $globals.ArrayTest);
  51886. $core.addMethod(
  51887. $core.method({
  51888. selector: "samplesDo:",
  51889. protocol: 'fixture',
  51890. fn: function (aBlock){
  51891. var self=this;
  51892. return $core.withContext(function($ctx1) {
  51893. (
  51894. $ctx1.supercall = true,
  51895. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51896. $ctx1.supercall = false;
  51897. $recv(aBlock)._value_value_((3),(3));
  51898. return self;
  51899. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51900. },
  51901. args: ["aBlock"],
  51902. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51903. referencedClasses: [],
  51904. messageSends: ["samplesDo:", "value:value:"]
  51905. }),
  51906. $globals.ArrayTest);
  51907. $core.addMethod(
  51908. $core.method({
  51909. selector: "testAdd",
  51910. protocol: 'tests',
  51911. fn: function (){
  51912. var self=this;
  51913. var array;
  51914. return $core.withContext(function($ctx1) {
  51915. array=self._collection();
  51916. $recv(array)._add_((6));
  51917. self._assert_equals_($recv(array)._last(),(6));
  51918. return self;
  51919. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51920. },
  51921. args: [],
  51922. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51923. referencedClasses: [],
  51924. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51925. }),
  51926. $globals.ArrayTest);
  51927. $core.addMethod(
  51928. $core.method({
  51929. selector: "testAddFirst",
  51930. protocol: 'tests',
  51931. fn: function (){
  51932. var self=this;
  51933. return $core.withContext(function($ctx1) {
  51934. var $3,$2,$1;
  51935. $3=self._collection();
  51936. $recv($3)._addFirst_((0));
  51937. $2=$recv($3)._yourself();
  51938. $1=$recv($2)._first();
  51939. self._assert_equals_($1,(0));
  51940. return self;
  51941. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51942. },
  51943. args: [],
  51944. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51945. referencedClasses: [],
  51946. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51947. }),
  51948. $globals.ArrayTest);
  51949. $core.addMethod(
  51950. $core.method({
  51951. selector: "testPrintString",
  51952. protocol: 'tests',
  51953. fn: function (){
  51954. var self=this;
  51955. var array;
  51956. return $core.withContext(function($ctx1) {
  51957. var $1,$2,$3,$4,$5,$6,$7,$8;
  51958. array=$recv($globals.Array)._new();
  51959. $1=$recv(array)._printString();
  51960. $ctx1.sendIdx["printString"]=1;
  51961. self._assert_equals_($1,"an Array ()");
  51962. $ctx1.sendIdx["assert:equals:"]=1;
  51963. $2=array;
  51964. $recv($2)._add_((1));
  51965. $ctx1.sendIdx["add:"]=1;
  51966. $3=$recv($2)._add_((3));
  51967. $ctx1.sendIdx["add:"]=2;
  51968. $4=$recv(array)._printString();
  51969. $ctx1.sendIdx["printString"]=2;
  51970. self._assert_equals_($4,"an Array (1 3)");
  51971. $ctx1.sendIdx["assert:equals:"]=2;
  51972. $recv(array)._add_("foo");
  51973. $5=$recv(array)._printString();
  51974. $ctx1.sendIdx["printString"]=3;
  51975. self._assert_equals_($5,"an Array (1 3 'foo')");
  51976. $ctx1.sendIdx["assert:equals:"]=3;
  51977. $6=array;
  51978. $recv($6)._remove_((1));
  51979. $ctx1.sendIdx["remove:"]=1;
  51980. $recv($6)._remove_((3));
  51981. $7=$recv(array)._printString();
  51982. $ctx1.sendIdx["printString"]=4;
  51983. self._assert_equals_($7,"an Array ('foo')");
  51984. $ctx1.sendIdx["assert:equals:"]=4;
  51985. $recv(array)._addLast_((3));
  51986. $ctx1.sendIdx["addLast:"]=1;
  51987. $8=$recv(array)._printString();
  51988. $ctx1.sendIdx["printString"]=5;
  51989. self._assert_equals_($8,"an Array ('foo' 3)");
  51990. $ctx1.sendIdx["assert:equals:"]=5;
  51991. $recv(array)._addLast_((3));
  51992. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51993. return self;
  51994. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51995. },
  51996. args: [],
  51997. 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)'.",
  51998. referencedClasses: ["Array"],
  51999. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52000. }),
  52001. $globals.ArrayTest);
  52002. $core.addMethod(
  52003. $core.method({
  52004. selector: "testRemove",
  52005. protocol: 'tests',
  52006. fn: function (){
  52007. var self=this;
  52008. var array;
  52009. return $core.withContext(function($ctx1) {
  52010. array=[(1), (2), (3), (4), (5)];
  52011. $recv(array)._remove_((3));
  52012. $ctx1.sendIdx["remove:"]=1;
  52013. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52014. self._should_raise_((function(){
  52015. return $core.withContext(function($ctx2) {
  52016. return $recv(array)._remove_((3));
  52017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52018. }),$globals.Error);
  52019. return self;
  52020. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52021. },
  52022. args: [],
  52023. 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",
  52024. referencedClasses: ["Error"],
  52025. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52026. }),
  52027. $globals.ArrayTest);
  52028. $core.addMethod(
  52029. $core.method({
  52030. selector: "testRemoveFromTo",
  52031. protocol: 'tests',
  52032. fn: function (){
  52033. var self=this;
  52034. return $core.withContext(function($ctx1) {
  52035. var $1,$2;
  52036. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52037. $ctx1.sendIdx["removeFrom:to:"]=1;
  52038. self._assert_equals_($1,[(4)]);
  52039. $ctx1.sendIdx["assert:equals:"]=1;
  52040. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52041. $ctx1.sendIdx["removeFrom:to:"]=2;
  52042. self._assert_equals_($2,[(1), (4)]);
  52043. $ctx1.sendIdx["assert:equals:"]=2;
  52044. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  52045. return self;
  52046. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  52047. },
  52048. args: [],
  52049. 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)",
  52050. referencedClasses: [],
  52051. messageSends: ["assert:equals:", "removeFrom:to:"]
  52052. }),
  52053. $globals.ArrayTest);
  52054. $core.addMethod(
  52055. $core.method({
  52056. selector: "testRemoveIndex",
  52057. protocol: 'tests',
  52058. fn: function (){
  52059. var self=this;
  52060. return $core.withContext(function($ctx1) {
  52061. var $1,$2;
  52062. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  52063. $ctx1.sendIdx["removeIndex:"]=1;
  52064. self._assert_equals_($1,[(1), (3), (4)]);
  52065. $ctx1.sendIdx["assert:equals:"]=1;
  52066. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  52067. $ctx1.sendIdx["removeIndex:"]=2;
  52068. self._assert_equals_($2,[(2), (3), (4)]);
  52069. $ctx1.sendIdx["assert:equals:"]=2;
  52070. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  52071. return self;
  52072. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  52073. },
  52074. args: [],
  52075. 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: #()",
  52076. referencedClasses: [],
  52077. messageSends: ["assert:equals:", "removeIndex:"]
  52078. }),
  52079. $globals.ArrayTest);
  52080. $core.addMethod(
  52081. $core.method({
  52082. selector: "testRemoveLast",
  52083. protocol: 'tests',
  52084. fn: function (){
  52085. var self=this;
  52086. var array;
  52087. return $core.withContext(function($ctx1) {
  52088. array=[(1), (2)];
  52089. $recv(array)._removeLast();
  52090. self._assert_equals_($recv(array)._last(),(1));
  52091. return self;
  52092. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  52093. },
  52094. args: [],
  52095. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  52096. referencedClasses: [],
  52097. messageSends: ["removeLast", "assert:equals:", "last"]
  52098. }),
  52099. $globals.ArrayTest);
  52100. $core.addMethod(
  52101. $core.method({
  52102. selector: "testReversed",
  52103. protocol: 'tests',
  52104. fn: function (){
  52105. var self=this;
  52106. var array;
  52107. return $core.withContext(function($ctx1) {
  52108. array=[(5), (4), (3), (2), (1)];
  52109. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  52110. return self;
  52111. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  52112. },
  52113. args: [],
  52114. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52115. referencedClasses: [],
  52116. messageSends: ["assert:equals:", "reversed"]
  52117. }),
  52118. $globals.ArrayTest);
  52119. $core.addMethod(
  52120. $core.method({
  52121. selector: "testSort",
  52122. protocol: 'tests',
  52123. fn: function (){
  52124. var self=this;
  52125. var array;
  52126. return $core.withContext(function($ctx1) {
  52127. array=[(10), (1), (5)];
  52128. $recv(array)._sort();
  52129. self._assert_equals_(array,[(1), (5), (10)]);
  52130. return self;
  52131. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52132. },
  52133. args: [],
  52134. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52135. referencedClasses: [],
  52136. messageSends: ["sort", "assert:equals:"]
  52137. }),
  52138. $globals.ArrayTest);
  52139. $core.addMethod(
  52140. $core.method({
  52141. selector: "collectionClass",
  52142. protocol: 'fixture',
  52143. fn: function (){
  52144. var self=this;
  52145. return $globals.Array;
  52146. },
  52147. args: [],
  52148. source: "collectionClass\x0a\x09^ Array",
  52149. referencedClasses: ["Array"],
  52150. messageSends: []
  52151. }),
  52152. $globals.ArrayTest.klass);
  52153. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52154. $core.addMethod(
  52155. $core.method({
  52156. selector: "collection",
  52157. protocol: 'fixture',
  52158. fn: function (){
  52159. var self=this;
  52160. return "helLo";
  52161. },
  52162. args: [],
  52163. source: "collection\x0a\x09^ 'helLo'",
  52164. referencedClasses: [],
  52165. messageSends: []
  52166. }),
  52167. $globals.StringTest);
  52168. $core.addMethod(
  52169. $core.method({
  52170. selector: "collectionFirst",
  52171. protocol: 'fixture',
  52172. fn: function (){
  52173. var self=this;
  52174. return "h";
  52175. },
  52176. args: [],
  52177. source: "collectionFirst\x0a\x09^ 'h'",
  52178. referencedClasses: [],
  52179. messageSends: []
  52180. }),
  52181. $globals.StringTest);
  52182. $core.addMethod(
  52183. $core.method({
  52184. selector: "collectionFirstTwo",
  52185. protocol: 'fixture',
  52186. fn: function (){
  52187. var self=this;
  52188. return "he";
  52189. },
  52190. args: [],
  52191. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52192. referencedClasses: [],
  52193. messageSends: []
  52194. }),
  52195. $globals.StringTest);
  52196. $core.addMethod(
  52197. $core.method({
  52198. selector: "collectionLast",
  52199. protocol: 'fixture',
  52200. fn: function (){
  52201. var self=this;
  52202. return "o";
  52203. },
  52204. args: [],
  52205. source: "collectionLast\x0a\x09^ 'o'",
  52206. referencedClasses: [],
  52207. messageSends: []
  52208. }),
  52209. $globals.StringTest);
  52210. $core.addMethod(
  52211. $core.method({
  52212. selector: "collectionLastTwo",
  52213. protocol: 'fixture',
  52214. fn: function (){
  52215. var self=this;
  52216. return "Lo";
  52217. },
  52218. args: [],
  52219. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52220. referencedClasses: [],
  52221. messageSends: []
  52222. }),
  52223. $globals.StringTest);
  52224. $core.addMethod(
  52225. $core.method({
  52226. selector: "collectionOfPrintStrings",
  52227. protocol: 'fixture',
  52228. fn: function (){
  52229. var self=this;
  52230. return "'h''e''l''L''o'";
  52231. },
  52232. args: [],
  52233. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52234. referencedClasses: [],
  52235. messageSends: []
  52236. }),
  52237. $globals.StringTest);
  52238. $core.addMethod(
  52239. $core.method({
  52240. selector: "collectionSize",
  52241. protocol: 'fixture',
  52242. fn: function (){
  52243. var self=this;
  52244. return (5);
  52245. },
  52246. args: [],
  52247. source: "collectionSize\x0a\x09^ 5",
  52248. referencedClasses: [],
  52249. messageSends: []
  52250. }),
  52251. $globals.StringTest);
  52252. $core.addMethod(
  52253. $core.method({
  52254. selector: "collectionWithDuplicates",
  52255. protocol: 'fixture',
  52256. fn: function (){
  52257. var self=this;
  52258. return "abbaerten";
  52259. },
  52260. args: [],
  52261. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  52262. referencedClasses: [],
  52263. messageSends: []
  52264. }),
  52265. $globals.StringTest);
  52266. $core.addMethod(
  52267. $core.method({
  52268. selector: "collectionWithNewValue",
  52269. protocol: 'fixture',
  52270. fn: function (){
  52271. var self=this;
  52272. return "helLoN";
  52273. },
  52274. args: [],
  52275. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  52276. referencedClasses: [],
  52277. messageSends: []
  52278. }),
  52279. $globals.StringTest);
  52280. $core.addMethod(
  52281. $core.method({
  52282. selector: "sampleNewValueAsCollection",
  52283. protocol: 'fixture',
  52284. fn: function (){
  52285. var self=this;
  52286. return "N";
  52287. },
  52288. args: [],
  52289. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  52290. referencedClasses: [],
  52291. messageSends: []
  52292. }),
  52293. $globals.StringTest);
  52294. $core.addMethod(
  52295. $core.method({
  52296. selector: "samplesDo:",
  52297. protocol: 'fixture',
  52298. fn: function (aBlock){
  52299. var self=this;
  52300. return $core.withContext(function($ctx1) {
  52301. (
  52302. $ctx1.supercall = true,
  52303. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52304. $ctx1.supercall = false;
  52305. $recv(aBlock)._value_value_((3),"l");
  52306. return self;
  52307. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  52308. },
  52309. args: ["aBlock"],
  52310. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  52311. referencedClasses: [],
  52312. messageSends: ["samplesDo:", "value:value:"]
  52313. }),
  52314. $globals.StringTest);
  52315. $core.addMethod(
  52316. $core.method({
  52317. selector: "testAddAll",
  52318. protocol: 'tests',
  52319. fn: function (){
  52320. var self=this;
  52321. return $core.withContext(function($ctx1) {
  52322. var $1;
  52323. self._should_raise_((function(){
  52324. return $core.withContext(function($ctx2) {
  52325. $1=self._collection();
  52326. $ctx2.sendIdx["collection"]=1;
  52327. return $recv($1)._addAll_(self._collection());
  52328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52329. }),$globals.Error);
  52330. return self;
  52331. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  52332. },
  52333. args: [],
  52334. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  52335. referencedClasses: ["Error"],
  52336. messageSends: ["should:raise:", "addAll:", "collection"]
  52337. }),
  52338. $globals.StringTest);
  52339. $core.addMethod(
  52340. $core.method({
  52341. selector: "testAddRemove",
  52342. protocol: 'tests',
  52343. fn: function (){
  52344. var self=this;
  52345. return $core.withContext(function($ctx1) {
  52346. self._should_raise_((function(){
  52347. return $core.withContext(function($ctx2) {
  52348. return "hello"._add_("a");
  52349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52350. }),$globals.Error);
  52351. $ctx1.sendIdx["should:raise:"]=1;
  52352. self._should_raise_((function(){
  52353. return $core.withContext(function($ctx2) {
  52354. return "hello"._remove_("h");
  52355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52356. }),$globals.Error);
  52357. return self;
  52358. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52359. },
  52360. args: [],
  52361. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52362. referencedClasses: ["Error"],
  52363. messageSends: ["should:raise:", "add:", "remove:"]
  52364. }),
  52365. $globals.StringTest);
  52366. $core.addMethod(
  52367. $core.method({
  52368. selector: "testAsArray",
  52369. protocol: 'tests',
  52370. fn: function (){
  52371. var self=this;
  52372. return $core.withContext(function($ctx1) {
  52373. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52374. return self;
  52375. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52376. },
  52377. args: [],
  52378. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52379. referencedClasses: [],
  52380. messageSends: ["assert:equals:", "asArray"]
  52381. }),
  52382. $globals.StringTest);
  52383. $core.addMethod(
  52384. $core.method({
  52385. selector: "testAsLowerCase",
  52386. protocol: 'tests',
  52387. fn: function (){
  52388. var self=this;
  52389. return $core.withContext(function($ctx1) {
  52390. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52391. return self;
  52392. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52393. },
  52394. args: [],
  52395. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52396. referencedClasses: [],
  52397. messageSends: ["assert:equals:", "asLowercase"]
  52398. }),
  52399. $globals.StringTest);
  52400. $core.addMethod(
  52401. $core.method({
  52402. selector: "testAsNumber",
  52403. protocol: 'tests',
  52404. fn: function (){
  52405. var self=this;
  52406. return $core.withContext(function($ctx1) {
  52407. var $1,$2;
  52408. $1="3"._asNumber();
  52409. $ctx1.sendIdx["asNumber"]=1;
  52410. self._assert_equals_($1,(3));
  52411. $ctx1.sendIdx["assert:equals:"]=1;
  52412. $2="-3"._asNumber();
  52413. $ctx1.sendIdx["asNumber"]=2;
  52414. self._assert_equals_($2,(-3));
  52415. $ctx1.sendIdx["assert:equals:"]=2;
  52416. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52417. return self;
  52418. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52419. },
  52420. args: [],
  52421. 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.",
  52422. referencedClasses: [],
  52423. messageSends: ["assert:equals:", "asNumber"]
  52424. }),
  52425. $globals.StringTest);
  52426. $core.addMethod(
  52427. $core.method({
  52428. selector: "testAsUpperCase",
  52429. protocol: 'tests',
  52430. fn: function (){
  52431. var self=this;
  52432. return $core.withContext(function($ctx1) {
  52433. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52434. return self;
  52435. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52436. },
  52437. args: [],
  52438. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52439. referencedClasses: [],
  52440. messageSends: ["assert:equals:", "asUppercase"]
  52441. }),
  52442. $globals.StringTest);
  52443. $core.addMethod(
  52444. $core.method({
  52445. selector: "testAsciiValue",
  52446. protocol: 'tests',
  52447. fn: function (){
  52448. var self=this;
  52449. var characterA,characterU;
  52450. return $core.withContext(function($ctx1) {
  52451. var $1;
  52452. characterA="A";
  52453. characterU="U";
  52454. $1=$recv(characterA)._asciiValue();
  52455. $ctx1.sendIdx["asciiValue"]=1;
  52456. self._assert_equals_($1,(65));
  52457. $ctx1.sendIdx["assert:equals:"]=1;
  52458. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52459. return self;
  52460. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52461. },
  52462. args: [],
  52463. 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",
  52464. referencedClasses: [],
  52465. messageSends: ["assert:equals:", "asciiValue"]
  52466. }),
  52467. $globals.StringTest);
  52468. $core.addMethod(
  52469. $core.method({
  52470. selector: "testAtIfAbsentPut",
  52471. protocol: 'tests',
  52472. fn: function (){
  52473. var self=this;
  52474. return $core.withContext(function($ctx1) {
  52475. self._should_raise_((function(){
  52476. return $core.withContext(function($ctx2) {
  52477. return "hello"._at_ifAbsentPut_((6),(function(){
  52478. return "a";
  52479. }));
  52480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52481. }),$globals.Error);
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52484. },
  52485. args: [],
  52486. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52487. referencedClasses: ["Error"],
  52488. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52489. }),
  52490. $globals.StringTest);
  52491. $core.addMethod(
  52492. $core.method({
  52493. selector: "testAtPut",
  52494. protocol: 'tests',
  52495. fn: function (){
  52496. var self=this;
  52497. return $core.withContext(function($ctx1) {
  52498. self._should_raise_((function(){
  52499. return $core.withContext(function($ctx2) {
  52500. return "hello"._at_put_((1),"a");
  52501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52502. }),$globals.Error);
  52503. return self;
  52504. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52505. },
  52506. args: [],
  52507. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52508. referencedClasses: ["Error"],
  52509. messageSends: ["should:raise:", "at:put:"]
  52510. }),
  52511. $globals.StringTest);
  52512. $core.addMethod(
  52513. $core.method({
  52514. selector: "testCapitalized",
  52515. protocol: 'tests',
  52516. fn: function (){
  52517. var self=this;
  52518. return $core.withContext(function($ctx1) {
  52519. var $1,$2,$3;
  52520. $1="test"._capitalized();
  52521. $ctx1.sendIdx["capitalized"]=1;
  52522. self._assert_equals_($1,"Test");
  52523. $ctx1.sendIdx["assert:equals:"]=1;
  52524. $2="Test"._capitalized();
  52525. $ctx1.sendIdx["capitalized"]=2;
  52526. self._assert_equals_($2,"Test");
  52527. $ctx1.sendIdx["assert:equals:"]=2;
  52528. self._assert_equals_(""._capitalized(),"");
  52529. $ctx1.sendIdx["assert:equals:"]=3;
  52530. $3="Test"._isCapitalized();
  52531. $ctx1.sendIdx["isCapitalized"]=1;
  52532. self._assert_equals_($3,true);
  52533. $ctx1.sendIdx["assert:equals:"]=4;
  52534. self._assert_equals_("test"._isCapitalized(),false);
  52535. return self;
  52536. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52537. },
  52538. args: [],
  52539. 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.",
  52540. referencedClasses: [],
  52541. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52542. }),
  52543. $globals.StringTest);
  52544. $core.addMethod(
  52545. $core.method({
  52546. selector: "testCharCodeAt",
  52547. protocol: 'tests',
  52548. fn: function (){
  52549. var self=this;
  52550. return $core.withContext(function($ctx1) {
  52551. var $1,$2,$3,$4,$5;
  52552. $1="jackie"._charCodeAt_((1));
  52553. $ctx1.sendIdx["charCodeAt:"]=1;
  52554. self._assert_equals_($1,(106));
  52555. $ctx1.sendIdx["assert:equals:"]=1;
  52556. $2="jackie"._charCodeAt_((2));
  52557. $ctx1.sendIdx["charCodeAt:"]=2;
  52558. self._assert_equals_($2,(97));
  52559. $ctx1.sendIdx["assert:equals:"]=2;
  52560. $3="jackie"._charCodeAt_((3));
  52561. $ctx1.sendIdx["charCodeAt:"]=3;
  52562. self._assert_equals_($3,(99));
  52563. $ctx1.sendIdx["assert:equals:"]=3;
  52564. $4="jackie"._charCodeAt_((4));
  52565. $ctx1.sendIdx["charCodeAt:"]=4;
  52566. self._assert_equals_($4,(107));
  52567. $ctx1.sendIdx["assert:equals:"]=4;
  52568. $5="jackie"._charCodeAt_((5));
  52569. $ctx1.sendIdx["charCodeAt:"]=5;
  52570. self._assert_equals_($5,(105));
  52571. $ctx1.sendIdx["assert:equals:"]=5;
  52572. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52573. return self;
  52574. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52575. },
  52576. args: [],
  52577. 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",
  52578. referencedClasses: [],
  52579. messageSends: ["assert:equals:", "charCodeAt:"]
  52580. }),
  52581. $globals.StringTest);
  52582. $core.addMethod(
  52583. $core.method({
  52584. selector: "testCopyFromTo",
  52585. protocol: 'tests',
  52586. fn: function (){
  52587. var self=this;
  52588. return $core.withContext(function($ctx1) {
  52589. var $1;
  52590. $1="jackie"._copyFrom_to_((1),(3));
  52591. $ctx1.sendIdx["copyFrom:to:"]=1;
  52592. self._assert_equals_($1,"jac");
  52593. $ctx1.sendIdx["assert:equals:"]=1;
  52594. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52595. return self;
  52596. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52597. },
  52598. args: [],
  52599. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52600. referencedClasses: [],
  52601. messageSends: ["assert:equals:", "copyFrom:to:"]
  52602. }),
  52603. $globals.StringTest);
  52604. $core.addMethod(
  52605. $core.method({
  52606. selector: "testCopySeparates",
  52607. protocol: 'tests',
  52608. fn: function (){
  52609. var self=this;
  52610. return $core.withContext(function($ctx1) {
  52611. var $3,$2,$1;
  52612. $3=self._collection();
  52613. $ctx1.sendIdx["collection"]=1;
  52614. $2=$recv($3)._copy();
  52615. $1=$recv($2).__eq_eq(self._collection());
  52616. self._assert_($1);
  52617. return self;
  52618. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52619. },
  52620. args: [],
  52621. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52622. referencedClasses: [],
  52623. messageSends: ["assert:", "==", "copy", "collection"]
  52624. }),
  52625. $globals.StringTest);
  52626. $core.addMethod(
  52627. $core.method({
  52628. selector: "testCopyWithoutAll",
  52629. protocol: 'tests',
  52630. fn: function (){
  52631. var self=this;
  52632. return $core.withContext(function($ctx1) {
  52633. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52634. return self;
  52635. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52636. },
  52637. args: [],
  52638. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52639. referencedClasses: [],
  52640. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52641. }),
  52642. $globals.StringTest);
  52643. $core.addMethod(
  52644. $core.method({
  52645. selector: "testEquality",
  52646. protocol: 'tests',
  52647. fn: function (){
  52648. var self=this;
  52649. return $core.withContext(function($ctx1) {
  52650. var $1,$2,$3;
  52651. self._assert_equals_("hello","hello");
  52652. $ctx1.sendIdx["assert:equals:"]=1;
  52653. $1="hello".__eq("world");
  52654. $ctx1.sendIdx["="]=1;
  52655. self._deny_($1);
  52656. $ctx1.sendIdx["deny:"]=1;
  52657. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52658. })));
  52659. $ctx1.sendIdx["="]=2;
  52660. self._deny_($2);
  52661. $ctx1.sendIdx["deny:"]=2;
  52662. $3="hello"._yourself();
  52663. $ctx1.sendIdx["yourself"]=1;
  52664. self._assert_equals_("hello",$3);
  52665. $ctx1.sendIdx["assert:equals:"]=2;
  52666. self._assert_equals_("hello"._yourself(),"hello");
  52667. self._deny_("".__eq((0)));
  52668. return self;
  52669. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52670. },
  52671. args: [],
  52672. 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",
  52673. referencedClasses: [],
  52674. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52675. }),
  52676. $globals.StringTest);
  52677. $core.addMethod(
  52678. $core.method({
  52679. selector: "testIdentity",
  52680. protocol: 'tests',
  52681. fn: function (){
  52682. var self=this;
  52683. return $core.withContext(function($ctx1) {
  52684. var $1,$2,$4,$3,$5;
  52685. $1="hello".__eq_eq("hello");
  52686. $ctx1.sendIdx["=="]=1;
  52687. self._assert_($1);
  52688. $ctx1.sendIdx["assert:"]=1;
  52689. $2="hello".__eq_eq("world");
  52690. $ctx1.sendIdx["=="]=2;
  52691. self._deny_($2);
  52692. $ctx1.sendIdx["deny:"]=1;
  52693. $4="hello"._yourself();
  52694. $ctx1.sendIdx["yourself"]=1;
  52695. $3="hello".__eq_eq($4);
  52696. $ctx1.sendIdx["=="]=3;
  52697. self._assert_($3);
  52698. $ctx1.sendIdx["assert:"]=2;
  52699. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52700. $ctx1.sendIdx["=="]=4;
  52701. self._assert_($5);
  52702. self._deny_("".__eq_eq((0)));
  52703. return self;
  52704. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52705. },
  52706. args: [],
  52707. 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",
  52708. referencedClasses: [],
  52709. messageSends: ["assert:", "==", "deny:", "yourself"]
  52710. }),
  52711. $globals.StringTest);
  52712. $core.addMethod(
  52713. $core.method({
  52714. selector: "testIncludesSubString",
  52715. protocol: 'tests',
  52716. fn: function (){
  52717. var self=this;
  52718. return $core.withContext(function($ctx1) {
  52719. var $1;
  52720. $1="amber"._includesSubString_("ber");
  52721. $ctx1.sendIdx["includesSubString:"]=1;
  52722. self._assert_($1);
  52723. self._deny_("amber"._includesSubString_("zork"));
  52724. return self;
  52725. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52726. },
  52727. args: [],
  52728. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52729. referencedClasses: [],
  52730. messageSends: ["assert:", "includesSubString:", "deny:"]
  52731. }),
  52732. $globals.StringTest);
  52733. $core.addMethod(
  52734. $core.method({
  52735. selector: "testIndexOfStartingAtWithNull",
  52736. protocol: 'tests',
  52737. fn: function (){
  52738. var self=this;
  52739. return self;
  52740. },
  52741. args: [],
  52742. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52743. referencedClasses: [],
  52744. messageSends: []
  52745. }),
  52746. $globals.StringTest);
  52747. $core.addMethod(
  52748. $core.method({
  52749. selector: "testIndexOfWithNull",
  52750. protocol: 'tests',
  52751. fn: function (){
  52752. var self=this;
  52753. return self;
  52754. },
  52755. args: [],
  52756. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52757. referencedClasses: [],
  52758. messageSends: []
  52759. }),
  52760. $globals.StringTest);
  52761. $core.addMethod(
  52762. $core.method({
  52763. selector: "testIsVowel",
  52764. protocol: 'tests',
  52765. fn: function (){
  52766. var self=this;
  52767. var vowel,consonant;
  52768. return $core.withContext(function($ctx1) {
  52769. var $1;
  52770. vowel="u";
  52771. consonant="z";
  52772. $1=$recv(vowel)._isVowel();
  52773. $ctx1.sendIdx["isVowel"]=1;
  52774. self._assert_equals_($1,true);
  52775. $ctx1.sendIdx["assert:equals:"]=1;
  52776. self._assert_equals_($recv(consonant)._isVowel(),false);
  52777. return self;
  52778. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52779. },
  52780. args: [],
  52781. 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",
  52782. referencedClasses: [],
  52783. messageSends: ["assert:equals:", "isVowel"]
  52784. }),
  52785. $globals.StringTest);
  52786. $core.addMethod(
  52787. $core.method({
  52788. selector: "testJoin",
  52789. protocol: 'tests',
  52790. fn: function (){
  52791. var self=this;
  52792. return $core.withContext(function($ctx1) {
  52793. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52794. return self;
  52795. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52796. },
  52797. args: [],
  52798. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52799. referencedClasses: [],
  52800. messageSends: ["assert:equals:", "join:"]
  52801. }),
  52802. $globals.StringTest);
  52803. $core.addMethod(
  52804. $core.method({
  52805. selector: "testRemoveAll",
  52806. protocol: 'tests',
  52807. fn: function (){
  52808. var self=this;
  52809. return $core.withContext(function($ctx1) {
  52810. self._should_raise_((function(){
  52811. return $core.withContext(function($ctx2) {
  52812. return $recv(self._collection())._removeAll();
  52813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52814. }),$globals.Error);
  52815. return self;
  52816. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52817. },
  52818. args: [],
  52819. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52820. referencedClasses: ["Error"],
  52821. messageSends: ["should:raise:", "removeAll", "collection"]
  52822. }),
  52823. $globals.StringTest);
  52824. $core.addMethod(
  52825. $core.method({
  52826. selector: "testReversed",
  52827. protocol: 'tests',
  52828. fn: function (){
  52829. var self=this;
  52830. return $core.withContext(function($ctx1) {
  52831. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52832. return self;
  52833. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52834. },
  52835. args: [],
  52836. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52837. referencedClasses: [],
  52838. messageSends: ["assert:equals:", "reversed"]
  52839. }),
  52840. $globals.StringTest);
  52841. $core.addMethod(
  52842. $core.method({
  52843. selector: "testStreamContents",
  52844. protocol: 'tests',
  52845. fn: function (){
  52846. var self=this;
  52847. return $core.withContext(function($ctx1) {
  52848. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52849. return $core.withContext(function($ctx2) {
  52850. $recv(aStream)._nextPutAll_("hello");
  52851. $ctx2.sendIdx["nextPutAll:"]=1;
  52852. $recv(aStream)._space();
  52853. return $recv(aStream)._nextPutAll_("world");
  52854. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52855. })),"hello world");
  52856. return self;
  52857. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52858. },
  52859. args: [],
  52860. 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'",
  52861. referencedClasses: ["String"],
  52862. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52863. }),
  52864. $globals.StringTest);
  52865. $core.addMethod(
  52866. $core.method({
  52867. selector: "testSubStrings",
  52868. protocol: 'tests',
  52869. fn: function (){
  52870. var self=this;
  52871. return $core.withContext(function($ctx1) {
  52872. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52873. return self;
  52874. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52875. },
  52876. args: [],
  52877. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52878. referencedClasses: [],
  52879. messageSends: ["assert:equals:", "subStrings:"]
  52880. }),
  52881. $globals.StringTest);
  52882. $core.addMethod(
  52883. $core.method({
  52884. selector: "testTrim",
  52885. protocol: 'tests',
  52886. fn: function (){
  52887. var self=this;
  52888. return $core.withContext(function($ctx1) {
  52889. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52890. $ctx1.sendIdx["assert:equals:"]=1;
  52891. self._assert_equals_("jackie "._trimRight(),"jackie");
  52892. return self;
  52893. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52894. },
  52895. args: [],
  52896. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52897. referencedClasses: [],
  52898. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52899. }),
  52900. $globals.StringTest);
  52901. $core.addMethod(
  52902. $core.method({
  52903. selector: "testValue",
  52904. protocol: 'tests',
  52905. fn: function (){
  52906. var self=this;
  52907. return $core.withContext(function($ctx1) {
  52908. self._assert_equals_("asString"._value_((1)),"1");
  52909. $ctx1.sendIdx["assert:equals:"]=1;
  52910. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52911. return self;
  52912. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52913. },
  52914. args: [],
  52915. 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')",
  52916. referencedClasses: [],
  52917. messageSends: ["assert:equals:", "value:", "collect:"]
  52918. }),
  52919. $globals.StringTest);
  52920. $core.addMethod(
  52921. $core.method({
  52922. selector: "collectionClass",
  52923. protocol: 'fixture',
  52924. fn: function (){
  52925. var self=this;
  52926. return $globals.String;
  52927. },
  52928. args: [],
  52929. source: "collectionClass\x0a\x09^ String",
  52930. referencedClasses: ["String"],
  52931. messageSends: []
  52932. }),
  52933. $globals.StringTest.klass);
  52934. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52935. $core.addMethod(
  52936. $core.method({
  52937. selector: "collection",
  52938. protocol: 'fixture',
  52939. fn: function (){
  52940. var self=this;
  52941. return $core.withContext(function($ctx1) {
  52942. var $1;
  52943. $1=$recv($globals.Set)._new();
  52944. $recv($1)._add_($globals.Smalltalk);
  52945. $ctx1.sendIdx["add:"]=1;
  52946. $recv($1)._add_(nil);
  52947. $ctx1.sendIdx["add:"]=2;
  52948. $recv($1)._add_((3).__at((3)));
  52949. $ctx1.sendIdx["add:"]=3;
  52950. $recv($1)._add_(false);
  52951. $ctx1.sendIdx["add:"]=4;
  52952. $recv($1)._add_(self["@sampleBlock"]);
  52953. return $recv($1)._yourself();
  52954. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52955. },
  52956. args: [],
  52957. 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",
  52958. referencedClasses: ["Set", "Smalltalk"],
  52959. messageSends: ["add:", "new", "@", "yourself"]
  52960. }),
  52961. $globals.SetTest);
  52962. $core.addMethod(
  52963. $core.method({
  52964. selector: "collectionOfPrintStrings",
  52965. protocol: 'fixture',
  52966. fn: function (){
  52967. var self=this;
  52968. return $core.withContext(function($ctx1) {
  52969. var $1;
  52970. $1=$recv($globals.Set)._new();
  52971. $recv($1)._add_("a SmalltalkImage");
  52972. $ctx1.sendIdx["add:"]=1;
  52973. $recv($1)._add_("nil");
  52974. $ctx1.sendIdx["add:"]=2;
  52975. $recv($1)._add_("3@3");
  52976. $ctx1.sendIdx["add:"]=3;
  52977. $recv($1)._add_("false");
  52978. $ctx1.sendIdx["add:"]=4;
  52979. $recv($1)._add_("a BlockClosure");
  52980. return $recv($1)._yourself();
  52981. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52982. },
  52983. args: [],
  52984. 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",
  52985. referencedClasses: ["Set"],
  52986. messageSends: ["add:", "new", "yourself"]
  52987. }),
  52988. $globals.SetTest);
  52989. $core.addMethod(
  52990. $core.method({
  52991. selector: "collectionSize",
  52992. protocol: 'fixture',
  52993. fn: function (){
  52994. var self=this;
  52995. return (5);
  52996. },
  52997. args: [],
  52998. source: "collectionSize\x0a\x09^ 5",
  52999. referencedClasses: [],
  53000. messageSends: []
  53001. }),
  53002. $globals.SetTest);
  53003. $core.addMethod(
  53004. $core.method({
  53005. selector: "collectionWithDuplicates",
  53006. protocol: 'fixture',
  53007. fn: function (){
  53008. var self=this;
  53009. return $core.withContext(function($ctx1) {
  53010. var $1;
  53011. $1=self._collection();
  53012. $recv($1)._add_((0));
  53013. return $recv($1)._yourself();
  53014. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53015. },
  53016. args: [],
  53017. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53018. referencedClasses: [],
  53019. messageSends: ["add:", "collection", "yourself"]
  53020. }),
  53021. $globals.SetTest);
  53022. $core.addMethod(
  53023. $core.method({
  53024. selector: "collectionWithNewValue",
  53025. protocol: 'fixture',
  53026. fn: function (){
  53027. var self=this;
  53028. return $core.withContext(function($ctx1) {
  53029. var $1;
  53030. $1=$recv($globals.Set)._new();
  53031. $recv($1)._add_($globals.Smalltalk);
  53032. $ctx1.sendIdx["add:"]=1;
  53033. $recv($1)._add_(nil);
  53034. $ctx1.sendIdx["add:"]=2;
  53035. $recv($1)._add_((3).__at((3)));
  53036. $ctx1.sendIdx["add:"]=3;
  53037. $recv($1)._add_("N");
  53038. $ctx1.sendIdx["add:"]=4;
  53039. $recv($1)._add_(false);
  53040. $ctx1.sendIdx["add:"]=5;
  53041. $recv($1)._add_(self["@sampleBlock"]);
  53042. return $recv($1)._yourself();
  53043. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53044. },
  53045. args: [],
  53046. 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",
  53047. referencedClasses: ["Set", "Smalltalk"],
  53048. messageSends: ["add:", "new", "@", "yourself"]
  53049. }),
  53050. $globals.SetTest);
  53051. $core.addMethod(
  53052. $core.method({
  53053. selector: "testAddAll",
  53054. protocol: 'tests',
  53055. fn: function (){
  53056. var self=this;
  53057. return $core.withContext(function($ctx1) {
  53058. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53059. (
  53060. $ctx1.supercall = true,
  53061. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  53062. $ctx1.supercall = false;
  53063. $2=self._collection();
  53064. $ctx1.sendIdx["collection"]=1;
  53065. $3=self._collection();
  53066. $ctx1.sendIdx["collection"]=2;
  53067. $recv($2)._addAll_($3);
  53068. $ctx1.sendIdx["addAll:"]=1;
  53069. $4=$recv($2)._yourself();
  53070. $ctx1.sendIdx["yourself"]=1;
  53071. $1=$4;
  53072. $5=self._collection();
  53073. $ctx1.sendIdx["collection"]=3;
  53074. self._assert_equals_($1,$5);
  53075. $ctx1.sendIdx["assert:equals:"]=1;
  53076. $7=self._collection();
  53077. $ctx1.sendIdx["collection"]=4;
  53078. $8=self._collectionWithNewValue();
  53079. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53080. $recv($7)._addAll_($8);
  53081. $ctx1.sendIdx["addAll:"]=2;
  53082. $9=$recv($7)._yourself();
  53083. $ctx1.sendIdx["yourself"]=2;
  53084. $6=$9;
  53085. $10=self._collectionWithNewValue();
  53086. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53087. self._assert_equals_($6,$10);
  53088. $ctx1.sendIdx["assert:equals:"]=2;
  53089. $12=self._collectionWithNewValue();
  53090. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53091. $recv($12)._addAll_(self._collection());
  53092. $11=$recv($12)._yourself();
  53093. self._assert_equals_($11,self._collectionWithNewValue());
  53094. return self;
  53095. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  53096. },
  53097. args: [],
  53098. 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",
  53099. referencedClasses: [],
  53100. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53101. }),
  53102. $globals.SetTest);
  53103. $core.addMethod(
  53104. $core.method({
  53105. selector: "testAddRemove",
  53106. protocol: 'tests',
  53107. fn: function (){
  53108. var self=this;
  53109. var set;
  53110. return $core.withContext(function($ctx1) {
  53111. var $1,$2;
  53112. set=$recv($globals.Set)._new();
  53113. self._assert_($recv(set)._isEmpty());
  53114. $ctx1.sendIdx["assert:"]=1;
  53115. $recv(set)._add_((3));
  53116. $ctx1.sendIdx["add:"]=1;
  53117. $1=$recv(set)._includes_((3));
  53118. $ctx1.sendIdx["includes:"]=1;
  53119. self._assert_($1);
  53120. $ctx1.sendIdx["assert:"]=2;
  53121. $recv(set)._add_((5));
  53122. $2=$recv(set)._includes_((5));
  53123. $ctx1.sendIdx["includes:"]=2;
  53124. self._assert_($2);
  53125. $recv(set)._remove_((3));
  53126. self._deny_($recv(set)._includes_((3)));
  53127. return self;
  53128. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53129. },
  53130. args: [],
  53131. 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)",
  53132. referencedClasses: ["Set"],
  53133. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53134. }),
  53135. $globals.SetTest);
  53136. $core.addMethod(
  53137. $core.method({
  53138. selector: "testAt",
  53139. protocol: 'tests',
  53140. fn: function (){
  53141. var self=this;
  53142. return $core.withContext(function($ctx1) {
  53143. self._should_raise_((function(){
  53144. return $core.withContext(function($ctx2) {
  53145. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  53146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53147. }),$globals.Error);
  53148. return self;
  53149. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53150. },
  53151. args: [],
  53152. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53153. referencedClasses: ["Set", "Error"],
  53154. messageSends: ["should:raise:", "at:put:", "new"]
  53155. }),
  53156. $globals.SetTest);
  53157. $core.addMethod(
  53158. $core.method({
  53159. selector: "testCollect",
  53160. protocol: 'tests',
  53161. fn: function (){
  53162. var self=this;
  53163. return $core.withContext(function($ctx1) {
  53164. var $2,$1;
  53165. (
  53166. $ctx1.supercall = true,
  53167. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  53168. $ctx1.supercall = false;
  53169. $2=[(5), (6), (8)]._asSet();
  53170. $ctx1.sendIdx["asSet"]=1;
  53171. $1=$recv($2)._collect_((function(x){
  53172. return $core.withContext(function($ctx2) {
  53173. return $recv(x).__backslash_backslash((3));
  53174. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53175. }));
  53176. self._assert_equals_($1,[(0), (2)]._asSet());
  53177. return self;
  53178. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53179. },
  53180. args: [],
  53181. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53182. referencedClasses: [],
  53183. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53184. }),
  53185. $globals.SetTest);
  53186. $core.addMethod(
  53187. $core.method({
  53188. selector: "testComma",
  53189. protocol: 'tests',
  53190. fn: function (){
  53191. var self=this;
  53192. return $core.withContext(function($ctx1) {
  53193. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53194. (
  53195. $ctx1.supercall = true,
  53196. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  53197. $ctx1.supercall = false;
  53198. $2=self._collection();
  53199. $ctx1.sendIdx["collection"]=1;
  53200. $3=self._collection();
  53201. $ctx1.sendIdx["collection"]=2;
  53202. $1=$recv($2).__comma($3);
  53203. $ctx1.sendIdx[","]=1;
  53204. $4=self._collection();
  53205. $ctx1.sendIdx["collection"]=3;
  53206. self._assert_equals_($1,$4);
  53207. $ctx1.sendIdx["assert:equals:"]=1;
  53208. $6=self._collection();
  53209. $ctx1.sendIdx["collection"]=4;
  53210. $7=self._collectionWithNewValue();
  53211. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53212. $5=$recv($6).__comma($7);
  53213. $ctx1.sendIdx[","]=2;
  53214. $8=self._collectionWithNewValue();
  53215. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53216. self._assert_equals_($5,$8);
  53217. $ctx1.sendIdx["assert:equals:"]=2;
  53218. $10=self._collectionWithNewValue();
  53219. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53220. $9=$recv($10).__comma(self._collection());
  53221. self._assert_equals_($9,self._collectionWithNewValue());
  53222. return self;
  53223. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53224. },
  53225. args: [],
  53226. 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",
  53227. referencedClasses: [],
  53228. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53229. }),
  53230. $globals.SetTest);
  53231. $core.addMethod(
  53232. $core.method({
  53233. selector: "testComparing",
  53234. protocol: 'tests',
  53235. fn: function (){
  53236. var self=this;
  53237. return $core.withContext(function($ctx1) {
  53238. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53239. $1=[(0), (2)]._asSet();
  53240. $ctx1.sendIdx["asSet"]=1;
  53241. $2=[(0), (2)]._asSet();
  53242. $ctx1.sendIdx["asSet"]=2;
  53243. self._assert_equals_($1,$2);
  53244. $ctx1.sendIdx["assert:equals:"]=1;
  53245. $3=[(2), (0)]._asSet();
  53246. $ctx1.sendIdx["asSet"]=3;
  53247. $4=[(0), (2)]._asSet();
  53248. $ctx1.sendIdx["asSet"]=4;
  53249. self._assert_equals_($3,$4);
  53250. $6=[(0), (2), (3)]._asSet();
  53251. $ctx1.sendIdx["asSet"]=5;
  53252. $7=[(0), (2)]._asSet();
  53253. $ctx1.sendIdx["asSet"]=6;
  53254. $5=$recv($6).__eq($7);
  53255. $ctx1.sendIdx["="]=1;
  53256. self._deny_($5);
  53257. $ctx1.sendIdx["deny:"]=1;
  53258. $9=[(1), (2)]._asSet();
  53259. $ctx1.sendIdx["asSet"]=7;
  53260. $8=$recv($9).__eq([(0), (2)]._asSet());
  53261. self._deny_($8);
  53262. return self;
  53263. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  53264. },
  53265. args: [],
  53266. 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",
  53267. referencedClasses: [],
  53268. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  53269. }),
  53270. $globals.SetTest);
  53271. $core.addMethod(
  53272. $core.method({
  53273. selector: "testPrintString",
  53274. protocol: 'tests',
  53275. fn: function (){
  53276. var self=this;
  53277. var set;
  53278. return $core.withContext(function($ctx1) {
  53279. var $1,$2,$3,$4,$5,$6,$7,$8;
  53280. set=$recv($globals.Set)._new();
  53281. $1=$recv(set)._printString();
  53282. $ctx1.sendIdx["printString"]=1;
  53283. self._assert_equals_($1,"a Set ()");
  53284. $ctx1.sendIdx["assert:equals:"]=1;
  53285. $2=set;
  53286. $recv($2)._add_((1));
  53287. $ctx1.sendIdx["add:"]=1;
  53288. $3=$recv($2)._add_((3));
  53289. $ctx1.sendIdx["add:"]=2;
  53290. $4=$recv(set)._printString();
  53291. $ctx1.sendIdx["printString"]=2;
  53292. self._assert_equals_($4,"a Set (1 3)");
  53293. $ctx1.sendIdx["assert:equals:"]=2;
  53294. $recv(set)._add_("foo");
  53295. $ctx1.sendIdx["add:"]=3;
  53296. $5=$recv(set)._printString();
  53297. $ctx1.sendIdx["printString"]=3;
  53298. self._assert_equals_($5,"a Set (1 3 'foo')");
  53299. $ctx1.sendIdx["assert:equals:"]=3;
  53300. $6=set;
  53301. $recv($6)._remove_((1));
  53302. $ctx1.sendIdx["remove:"]=1;
  53303. $recv($6)._remove_((3));
  53304. $7=$recv(set)._printString();
  53305. $ctx1.sendIdx["printString"]=4;
  53306. self._assert_equals_($7,"a Set ('foo')");
  53307. $ctx1.sendIdx["assert:equals:"]=4;
  53308. $recv(set)._add_((3));
  53309. $ctx1.sendIdx["add:"]=4;
  53310. $8=$recv(set)._printString();
  53311. $ctx1.sendIdx["printString"]=5;
  53312. self._assert_equals_($8,"a Set (3 'foo')");
  53313. $ctx1.sendIdx["assert:equals:"]=5;
  53314. $recv(set)._add_((3));
  53315. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  53316. return self;
  53317. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  53318. },
  53319. args: [],
  53320. 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'')'",
  53321. referencedClasses: ["Set"],
  53322. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  53323. }),
  53324. $globals.SetTest);
  53325. $core.addMethod(
  53326. $core.method({
  53327. selector: "testUnboxedObjects",
  53328. protocol: 'tests',
  53329. fn: function (){
  53330. var self=this;
  53331. return $core.withContext(function($ctx1) {
  53332. var $4,$3,$2,$1;
  53333. $4="foo"._yourself();
  53334. $ctx1.sendIdx["yourself"]=1;
  53335. $3=[$4,"foo"._yourself()];
  53336. $2=$recv($3)._asSet();
  53337. $1=$recv($2)._asArray();
  53338. self._assert_equals_($1,["foo"]);
  53339. return self;
  53340. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  53341. },
  53342. args: [],
  53343. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  53344. referencedClasses: [],
  53345. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  53346. }),
  53347. $globals.SetTest);
  53348. $core.addMethod(
  53349. $core.method({
  53350. selector: "testUnicity",
  53351. protocol: 'tests',
  53352. fn: function (){
  53353. var self=this;
  53354. var set;
  53355. return $core.withContext(function($ctx1) {
  53356. var $1;
  53357. set=$recv($globals.Set)._new();
  53358. $recv(set)._add_((21));
  53359. $ctx1.sendIdx["add:"]=1;
  53360. $recv(set)._add_("hello");
  53361. $ctx1.sendIdx["add:"]=2;
  53362. $recv(set)._add_((21));
  53363. $ctx1.sendIdx["add:"]=3;
  53364. $1=$recv(set)._size();
  53365. $ctx1.sendIdx["size"]=1;
  53366. self._assert_equals_($1,(2));
  53367. $ctx1.sendIdx["assert:equals:"]=1;
  53368. $recv(set)._add_("hello");
  53369. self._assert_equals_($recv(set)._size(),(2));
  53370. $ctx1.sendIdx["assert:equals:"]=2;
  53371. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53372. return self;
  53373. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53374. },
  53375. args: [],
  53376. 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')",
  53377. referencedClasses: ["Set"],
  53378. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53379. }),
  53380. $globals.SetTest);
  53381. $core.addMethod(
  53382. $core.method({
  53383. selector: "collectionClass",
  53384. protocol: 'fixture',
  53385. fn: function (){
  53386. var self=this;
  53387. return $globals.Set;
  53388. },
  53389. args: [],
  53390. source: "collectionClass\x0a\x09^ Set",
  53391. referencedClasses: ["Set"],
  53392. messageSends: []
  53393. }),
  53394. $globals.SetTest.klass);
  53395. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53396. $core.addMethod(
  53397. $core.method({
  53398. selector: "testShow",
  53399. protocol: 'tests',
  53400. fn: function (){
  53401. var self=this;
  53402. var originalTranscript;
  53403. return $core.withContext(function($ctx1) {
  53404. originalTranscript=$recv($globals.Transcript)._current();
  53405. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53406. $ctx1.sendIdx["register:"]=1;
  53407. self._shouldnt_raise_((function(){
  53408. return $core.withContext(function($ctx2) {
  53409. return $recv($globals.Transcript)._show_("Hello console!");
  53410. $ctx2.sendIdx["show:"]=1;
  53411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53412. }),$globals.Error);
  53413. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53414. self._shouldnt_raise_((function(){
  53415. return $core.withContext(function($ctx2) {
  53416. return $recv($globals.Transcript)._show_(console);
  53417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53418. }),$globals.Error);
  53419. $recv($globals.Transcript)._register_(originalTranscript);
  53420. return self;
  53421. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53422. },
  53423. args: [],
  53424. 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.",
  53425. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53426. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53427. }),
  53428. $globals.ConsoleTranscriptTest);
  53429. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53430. $core.addMethod(
  53431. $core.method({
  53432. selector: "testEquality",
  53433. protocol: 'tests',
  53434. fn: function (){
  53435. var self=this;
  53436. var now;
  53437. return $core.withContext(function($ctx1) {
  53438. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53439. now=$recv($globals.Date)._new();
  53440. $1=$recv(now).__eq(now);
  53441. $ctx1.sendIdx["="]=1;
  53442. self._assert_($1);
  53443. $ctx1.sendIdx["assert:"]=1;
  53444. $3=now;
  53445. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53446. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53447. $2=$recv($3).__eq($4);
  53448. $ctx1.sendIdx["="]=2;
  53449. self._deny_($2);
  53450. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53451. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53452. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53453. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53454. $5=$recv($6).__eq($7);
  53455. $ctx1.sendIdx["="]=3;
  53456. self._assert_($5);
  53457. $ctx1.sendIdx["assert:"]=2;
  53458. $9=now;
  53459. $11=$recv(now)._asMilliseconds();
  53460. $ctx1.sendIdx["asMilliseconds"]=1;
  53461. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53462. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53463. $8=$recv($9).__eq($10);
  53464. $ctx1.sendIdx["="]=4;
  53465. self._assert_($8);
  53466. $ctx1.sendIdx["assert:"]=3;
  53467. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53468. return self;
  53469. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53470. },
  53471. args: [],
  53472. 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",
  53473. referencedClasses: ["Date"],
  53474. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53475. }),
  53476. $globals.DateTest);
  53477. $core.addMethod(
  53478. $core.method({
  53479. selector: "testIdentity",
  53480. protocol: 'tests',
  53481. fn: function (){
  53482. var self=this;
  53483. var now;
  53484. return $core.withContext(function($ctx1) {
  53485. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53486. now=$recv($globals.Date)._new();
  53487. $1=$recv(now).__eq_eq(now);
  53488. $ctx1.sendIdx["=="]=1;
  53489. self._assert_($1);
  53490. $3=now;
  53491. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53492. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53493. $2=$recv($3).__eq_eq($4);
  53494. $ctx1.sendIdx["=="]=2;
  53495. self._deny_($2);
  53496. $ctx1.sendIdx["deny:"]=1;
  53497. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53498. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53499. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53500. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53501. $5=$recv($6).__eq_eq($7);
  53502. $ctx1.sendIdx["=="]=3;
  53503. self._deny_($5);
  53504. $ctx1.sendIdx["deny:"]=2;
  53505. $9=now;
  53506. $11=$recv(now)._asMilliseconds();
  53507. $ctx1.sendIdx["asMilliseconds"]=1;
  53508. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53509. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53510. $8=$recv($9).__eq_eq($10);
  53511. $ctx1.sendIdx["=="]=4;
  53512. self._deny_($8);
  53513. $ctx1.sendIdx["deny:"]=3;
  53514. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53515. return self;
  53516. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53517. },
  53518. args: [],
  53519. 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",
  53520. referencedClasses: ["Date"],
  53521. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53522. }),
  53523. $globals.DateTest);
  53524. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53525. $core.addMethod(
  53526. $core.method({
  53527. selector: "jsNull",
  53528. protocol: 'accessing',
  53529. fn: function (){
  53530. var self=this;
  53531. return $core.withContext(function($ctx1) {
  53532. return null;
  53533. return self;
  53534. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53535. },
  53536. args: [],
  53537. source: "jsNull\x0a\x09<return null>",
  53538. referencedClasses: [],
  53539. messageSends: []
  53540. }),
  53541. $globals.JSObjectProxyTest);
  53542. $core.addMethod(
  53543. $core.method({
  53544. selector: "jsObject",
  53545. protocol: 'accessing',
  53546. fn: function (){
  53547. var self=this;
  53548. return $core.withContext(function($ctx1) {
  53549. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  53550. return self;
  53551. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53552. },
  53553. args: [],
  53554. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  53555. referencedClasses: [],
  53556. messageSends: []
  53557. }),
  53558. $globals.JSObjectProxyTest);
  53559. $core.addMethod(
  53560. $core.method({
  53561. selector: "jsUndefined",
  53562. protocol: 'accessing',
  53563. fn: function (){
  53564. var self=this;
  53565. return $core.withContext(function($ctx1) {
  53566. return;
  53567. return self;
  53568. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53569. },
  53570. args: [],
  53571. source: "jsUndefined\x0a\x09<return>",
  53572. referencedClasses: [],
  53573. messageSends: []
  53574. }),
  53575. $globals.JSObjectProxyTest);
  53576. $core.addMethod(
  53577. $core.method({
  53578. selector: "testAtIfAbsent",
  53579. protocol: 'tests',
  53580. fn: function (){
  53581. var self=this;
  53582. var testObject;
  53583. return $core.withContext(function($ctx1) {
  53584. var $1,$2,$3;
  53585. testObject=self._jsObject();
  53586. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53587. return "Property does not exist";
  53588. }));
  53589. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53590. self._assert_equals_($1,"Property does not exist");
  53591. $ctx1.sendIdx["assert:equals:"]=1;
  53592. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53593. return "Property does not exist";
  53594. }));
  53595. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53596. self._assert_equals_($2,nil);
  53597. $ctx1.sendIdx["assert:equals:"]=2;
  53598. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53599. return "Property does not exist";
  53600. }));
  53601. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53602. self._assert_equals_($3,(1));
  53603. $ctx1.sendIdx["assert:equals:"]=3;
  53604. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53605. return "Property does not exist";
  53606. })),nil);
  53607. return self;
  53608. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53609. },
  53610. args: [],
  53611. 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.",
  53612. referencedClasses: [],
  53613. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53614. }),
  53615. $globals.JSObjectProxyTest);
  53616. $core.addMethod(
  53617. $core.method({
  53618. selector: "testAtIfPresent",
  53619. protocol: 'tests',
  53620. fn: function (){
  53621. var self=this;
  53622. var testObject;
  53623. return $core.withContext(function($ctx1) {
  53624. var $2,$1,$4,$3,$6,$5;
  53625. testObject=self._jsObject();
  53626. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53627. return $core.withContext(function($ctx2) {
  53628. $2=$recv(x)._asString();
  53629. $ctx2.sendIdx["asString"]=1;
  53630. return "hello ".__comma($2);
  53631. $ctx2.sendIdx[","]=1;
  53632. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53633. }));
  53634. $ctx1.sendIdx["at:ifPresent:"]=1;
  53635. self._assert_equals_($1,nil);
  53636. $ctx1.sendIdx["assert:equals:"]=1;
  53637. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53638. return $core.withContext(function($ctx2) {
  53639. $4=$recv(x)._asString();
  53640. $ctx2.sendIdx["asString"]=2;
  53641. return "hello ".__comma($4);
  53642. $ctx2.sendIdx[","]=2;
  53643. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53644. }));
  53645. $ctx1.sendIdx["at:ifPresent:"]=2;
  53646. self._assert_equals_($3,"hello nil");
  53647. $ctx1.sendIdx["assert:equals:"]=2;
  53648. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53649. return $core.withContext(function($ctx2) {
  53650. $6=$recv(x)._asString();
  53651. $ctx2.sendIdx["asString"]=3;
  53652. return "hello ".__comma($6);
  53653. $ctx2.sendIdx[","]=3;
  53654. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53655. }));
  53656. $ctx1.sendIdx["at:ifPresent:"]=3;
  53657. self._assert_equals_($5,"hello 1");
  53658. $ctx1.sendIdx["assert:equals:"]=3;
  53659. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53660. return $core.withContext(function($ctx2) {
  53661. return "hello ".__comma($recv(x)._asString());
  53662. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53663. })),"hello nil");
  53664. return self;
  53665. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53666. },
  53667. args: [],
  53668. 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'.",
  53669. referencedClasses: [],
  53670. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53671. }),
  53672. $globals.JSObjectProxyTest);
  53673. $core.addMethod(
  53674. $core.method({
  53675. selector: "testAtIfPresentIfAbsent",
  53676. protocol: 'tests',
  53677. fn: function (){
  53678. var self=this;
  53679. var testObject;
  53680. return $core.withContext(function($ctx1) {
  53681. var $2,$1,$4,$3,$6,$5;
  53682. testObject=self._jsObject();
  53683. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53684. return $core.withContext(function($ctx2) {
  53685. $2=$recv(x)._asString();
  53686. $ctx2.sendIdx["asString"]=1;
  53687. return "hello ".__comma($2);
  53688. $ctx2.sendIdx[","]=1;
  53689. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53690. }),(function(){
  53691. return "not present";
  53692. }));
  53693. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53694. self._assert_equals_($1,"not present");
  53695. $ctx1.sendIdx["assert:equals:"]=1;
  53696. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53697. return $core.withContext(function($ctx2) {
  53698. $4=$recv(x)._asString();
  53699. $ctx2.sendIdx["asString"]=2;
  53700. return "hello ".__comma($4);
  53701. $ctx2.sendIdx[","]=2;
  53702. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53703. }),(function(){
  53704. return "not present";
  53705. }));
  53706. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53707. self._assert_equals_($3,"hello nil");
  53708. $ctx1.sendIdx["assert:equals:"]=2;
  53709. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53710. return $core.withContext(function($ctx2) {
  53711. $6=$recv(x)._asString();
  53712. $ctx2.sendIdx["asString"]=3;
  53713. return "hello ".__comma($6);
  53714. $ctx2.sendIdx[","]=3;
  53715. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53716. }),(function(){
  53717. return "not present";
  53718. }));
  53719. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53720. self._assert_equals_($5,"hello 1");
  53721. $ctx1.sendIdx["assert:equals:"]=3;
  53722. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53723. return $core.withContext(function($ctx2) {
  53724. return "hello ".__comma($recv(x)._asString());
  53725. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53726. }),(function(){
  53727. return "not present";
  53728. })),"hello nil");
  53729. return self;
  53730. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53731. },
  53732. args: [],
  53733. 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'.",
  53734. referencedClasses: [],
  53735. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53736. }),
  53737. $globals.JSObjectProxyTest);
  53738. $core.addMethod(
  53739. $core.method({
  53740. selector: "testAtPut",
  53741. protocol: 'tests',
  53742. fn: function (){
  53743. var self=this;
  53744. var testObject;
  53745. return $core.withContext(function($ctx1) {
  53746. var $2,$1;
  53747. testObject=self._jsObject();
  53748. $2=$recv(testObject)._at_("abc");
  53749. $ctx1.sendIdx["at:"]=1;
  53750. $1=$recv($2).__tild_eq("xyz");
  53751. self._assert_($1);
  53752. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53753. $ctx1.sendIdx["assert:equals:"]=1;
  53754. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53755. return self;
  53756. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53757. },
  53758. args: [],
  53759. 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'",
  53760. referencedClasses: [],
  53761. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53762. }),
  53763. $globals.JSObjectProxyTest);
  53764. $core.addMethod(
  53765. $core.method({
  53766. selector: "testComparison",
  53767. protocol: 'tests',
  53768. fn: function (){
  53769. var self=this;
  53770. return $core.withContext(function($ctx1) {
  53771. var $1,$2;
  53772. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53773. $1=$recv(console).__eq(console);
  53774. $ctx1.sendIdx["="]=1;
  53775. self._assert_($1);
  53776. $2=$recv(console).__eq($recv($globals.Object)._new());
  53777. $ctx1.sendIdx["="]=2;
  53778. self._deny_($2);
  53779. $ctx1.sendIdx["deny:"]=1;
  53780. self._deny_($recv(console).__eq(self._jsObject()));
  53781. return self;
  53782. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53783. },
  53784. args: [],
  53785. 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",
  53786. referencedClasses: ["Object"],
  53787. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53788. }),
  53789. $globals.JSObjectProxyTest);
  53790. $core.addMethod(
  53791. $core.method({
  53792. selector: "testDNU",
  53793. protocol: 'tests',
  53794. fn: function (){
  53795. var self=this;
  53796. return $core.withContext(function($ctx1) {
  53797. self._should_raise_((function(){
  53798. return $core.withContext(function($ctx2) {
  53799. return $recv(self._jsObject())._foo();
  53800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53801. }),$globals.MessageNotUnderstood);
  53802. return self;
  53803. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53804. },
  53805. args: [],
  53806. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53807. referencedClasses: ["MessageNotUnderstood"],
  53808. messageSends: ["should:raise:", "foo", "jsObject"]
  53809. }),
  53810. $globals.JSObjectProxyTest);
  53811. $core.addMethod(
  53812. $core.method({
  53813. selector: "testDNURegression1057",
  53814. protocol: 'tests',
  53815. fn: function (){
  53816. var self=this;
  53817. var jsObject;
  53818. return $core.withContext(function($ctx1) {
  53819. var $1;
  53820. jsObject=[];
  53821. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53822. $ctx1.sendIdx["basicAt:put:"]=1;
  53823. $recv(jsObject)._basicAt_put_("foo",(3));
  53824. self._shouldnt_raise_((function(){
  53825. return $core.withContext(function($ctx2) {
  53826. return $recv(jsObject)._foo();
  53827. $ctx2.sendIdx["foo"]=1;
  53828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53829. }),$globals.Error);
  53830. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53831. $1=$recv(jsObject)._foo();
  53832. $ctx1.sendIdx["foo"]=2;
  53833. self._assert_equals_($1,(3));
  53834. $ctx1.sendIdx["assert:equals:"]=1;
  53835. self._shouldnt_raise_((function(){
  53836. return $core.withContext(function($ctx2) {
  53837. return $recv(jsObject)._foo_((4));
  53838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53839. }),$globals.Error);
  53840. self._assert_equals_($recv(jsObject)._foo(),(4));
  53841. return self;
  53842. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53843. },
  53844. args: [],
  53845. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  53846. referencedClasses: ["Error"],
  53847. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53848. }),
  53849. $globals.JSObjectProxyTest);
  53850. $core.addMethod(
  53851. $core.method({
  53852. selector: "testDNURegression1059",
  53853. protocol: 'tests',
  53854. fn: function (){
  53855. var self=this;
  53856. var jsObject;
  53857. return $core.withContext(function($ctx1) {
  53858. jsObject=[];
  53859. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53860. $ctx1.sendIdx["basicAt:put:"]=1;
  53861. $recv(jsObject)._basicAt_put_("x",(3));
  53862. $ctx1.sendIdx["basicAt:put:"]=2;
  53863. $recv(jsObject)._basicAt_put_("x:",(function(){
  53864. return $core.withContext(function($ctx2) {
  53865. return self._error();
  53866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53867. }));
  53868. self._shouldnt_raise_((function(){
  53869. return $core.withContext(function($ctx2) {
  53870. return $recv(jsObject)._x_((4));
  53871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53872. }),$globals.Error);
  53873. self._assert_equals_($recv(jsObject)._x(),(4));
  53874. return self;
  53875. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53876. },
  53877. args: [],
  53878. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  53879. referencedClasses: ["Error"],
  53880. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53881. }),
  53882. $globals.JSObjectProxyTest);
  53883. $core.addMethod(
  53884. $core.method({
  53885. selector: "testDNURegression1062",
  53886. protocol: 'tests',
  53887. fn: function (){
  53888. var self=this;
  53889. var jsObject,stored;
  53890. return $core.withContext(function($ctx1) {
  53891. jsObject=[];
  53892. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53893. $ctx1.sendIdx["basicAt:put:"]=1;
  53894. $recv(jsObject)._basicAt_put_("x",(function(v){
  53895. stored=v;
  53896. return stored;
  53897. }));
  53898. self._shouldnt_raise_((function(){
  53899. return $core.withContext(function($ctx2) {
  53900. return $recv(jsObject)._x_((4));
  53901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53902. }),$globals.Error);
  53903. self._assert_equals_(stored,(4));
  53904. return self;
  53905. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53906. },
  53907. args: [],
  53908. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  53909. referencedClasses: ["Error"],
  53910. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53911. }),
  53912. $globals.JSObjectProxyTest);
  53913. $core.addMethod(
  53914. $core.method({
  53915. selector: "testDNUWithAllowJavaScriptCalls",
  53916. protocol: 'tests',
  53917. fn: function (){
  53918. var self=this;
  53919. var jsObject;
  53920. return $core.withContext(function($ctx1) {
  53921. jsObject=[];
  53922. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53923. self._should_raise_((function(){
  53924. return $core.withContext(function($ctx2) {
  53925. return $recv(jsObject)._foo();
  53926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53927. }),$globals.MessageNotUnderstood);
  53928. return self;
  53929. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53930. },
  53931. args: [],
  53932. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53933. referencedClasses: ["MessageNotUnderstood"],
  53934. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53935. }),
  53936. $globals.JSObjectProxyTest);
  53937. $core.addMethod(
  53938. $core.method({
  53939. selector: "testMessageSend",
  53940. protocol: 'tests',
  53941. fn: function (){
  53942. var self=this;
  53943. return $core.withContext(function($ctx1) {
  53944. var $2,$1,$4,$3;
  53945. $2=self._jsObject();
  53946. $ctx1.sendIdx["jsObject"]=1;
  53947. $1=$recv($2)._a();
  53948. self._assert_equals_($1,(1));
  53949. $ctx1.sendIdx["assert:equals:"]=1;
  53950. $4=self._jsObject();
  53951. $ctx1.sendIdx["jsObject"]=2;
  53952. $3=$recv($4)._b();
  53953. self._assert_equals_($3,(2));
  53954. $ctx1.sendIdx["assert:equals:"]=2;
  53955. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53956. return self;
  53957. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53958. },
  53959. args: [],
  53960. 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",
  53961. referencedClasses: [],
  53962. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53963. }),
  53964. $globals.JSObjectProxyTest);
  53965. $core.addMethod(
  53966. $core.method({
  53967. selector: "testMethodWithArguments",
  53968. protocol: 'tests',
  53969. fn: function (){
  53970. var self=this;
  53971. return $core.withContext(function($ctx1) {
  53972. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53973. return self;
  53974. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53975. },
  53976. args: [],
  53977. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53978. referencedClasses: [],
  53979. messageSends: ["assert:equals:", "c:", "jsObject"]
  53980. }),
  53981. $globals.JSObjectProxyTest);
  53982. $core.addMethod(
  53983. $core.method({
  53984. selector: "testPrinting",
  53985. protocol: 'tests',
  53986. fn: function (){
  53987. var self=this;
  53988. return $core.withContext(function($ctx1) {
  53989. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53990. return self;
  53991. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53992. },
  53993. args: [],
  53994. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53995. referencedClasses: [],
  53996. messageSends: ["assert:equals:", "printString", "jsObject"]
  53997. }),
  53998. $globals.JSObjectProxyTest);
  53999. $core.addMethod(
  54000. $core.method({
  54001. selector: "testPropertyThatReturnsEmptyString",
  54002. protocol: 'tests',
  54003. fn: function (){
  54004. var self=this;
  54005. var object;
  54006. return $core.withContext(function($ctx1) {
  54007. var $1;
  54008. object=self._jsObject();
  54009. $1=$recv(object)._d();
  54010. $ctx1.sendIdx["d"]=1;
  54011. self._assert_equals_($1,"");
  54012. $ctx1.sendIdx["assert:equals:"]=1;
  54013. $recv(object)._d_("hello");
  54014. self._assert_equals_($recv(object)._d(),"hello");
  54015. return self;
  54016. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54017. },
  54018. args: [],
  54019. 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'",
  54020. referencedClasses: [],
  54021. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54022. }),
  54023. $globals.JSObjectProxyTest);
  54024. $core.addMethod(
  54025. $core.method({
  54026. selector: "testPropertyThatReturnsUndefined",
  54027. protocol: 'tests',
  54028. fn: function (){
  54029. var self=this;
  54030. var object;
  54031. return $core.withContext(function($ctx1) {
  54032. object=self._jsObject();
  54033. self._shouldnt_raise_((function(){
  54034. return $core.withContext(function($ctx2) {
  54035. return $recv(object)._e();
  54036. $ctx2.sendIdx["e"]=1;
  54037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54038. }),$globals.MessageNotUnderstood);
  54039. self._assert_($recv($recv(object)._e())._isNil());
  54040. return self;
  54041. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  54042. },
  54043. args: [],
  54044. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  54045. referencedClasses: ["MessageNotUnderstood"],
  54046. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  54047. }),
  54048. $globals.JSObjectProxyTest);
  54049. $core.addMethod(
  54050. $core.method({
  54051. selector: "testSetPropertyWithFalsyValue",
  54052. protocol: 'tests',
  54053. fn: function (){
  54054. var self=this;
  54055. var jsObject;
  54056. return $core.withContext(function($ctx1) {
  54057. var $1,$2,$3,$4,$5;
  54058. jsObject=self._jsObject();
  54059. $1=$recv(jsObject)._a();
  54060. $ctx1.sendIdx["a"]=1;
  54061. self._assert_equals_($1,(1));
  54062. $ctx1.sendIdx["assert:equals:"]=1;
  54063. $recv(jsObject)._a_(self._jsNull());
  54064. $ctx1.sendIdx["a:"]=1;
  54065. $2=$recv(jsObject)._a();
  54066. $ctx1.sendIdx["a"]=2;
  54067. self._assert_equals_($2,nil);
  54068. $ctx1.sendIdx["assert:equals:"]=2;
  54069. $recv(jsObject)._a_((0));
  54070. $ctx1.sendIdx["a:"]=2;
  54071. $3=$recv(jsObject)._a();
  54072. $ctx1.sendIdx["a"]=3;
  54073. self._assert_equals_($3,(0));
  54074. $ctx1.sendIdx["assert:equals:"]=3;
  54075. $recv(jsObject)._a_(self._jsUndefined());
  54076. $ctx1.sendIdx["a:"]=3;
  54077. $4=$recv(jsObject)._a();
  54078. $ctx1.sendIdx["a"]=4;
  54079. self._assert_equals_($4,nil);
  54080. $ctx1.sendIdx["assert:equals:"]=4;
  54081. $recv(jsObject)._a_("");
  54082. $ctx1.sendIdx["a:"]=4;
  54083. $5=$recv(jsObject)._a();
  54084. $ctx1.sendIdx["a"]=5;
  54085. self._assert_equals_($5,"");
  54086. $ctx1.sendIdx["assert:equals:"]=5;
  54087. $recv(jsObject)._a_(false);
  54088. self._assert_equals_($recv(jsObject)._a(),false);
  54089. return self;
  54090. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54091. },
  54092. args: [],
  54093. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  54094. referencedClasses: [],
  54095. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  54096. }),
  54097. $globals.JSObjectProxyTest);
  54098. $core.addMethod(
  54099. $core.method({
  54100. selector: "testValue",
  54101. protocol: 'tests',
  54102. fn: function (){
  54103. var self=this;
  54104. var testObject;
  54105. return $core.withContext(function($ctx1) {
  54106. testObject=self._jsObject();
  54107. $recv(testObject)._at_put_("value","aValue");
  54108. self._assert_equals_($recv(testObject)._value(),"aValue");
  54109. return self;
  54110. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  54111. },
  54112. args: [],
  54113. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54114. referencedClasses: [],
  54115. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54116. }),
  54117. $globals.JSObjectProxyTest);
  54118. $core.addMethod(
  54119. $core.method({
  54120. selector: "testYourself",
  54121. protocol: 'tests',
  54122. fn: function (){
  54123. var self=this;
  54124. var object;
  54125. return $core.withContext(function($ctx1) {
  54126. var $1;
  54127. $1=self._jsObject();
  54128. $recv($1)._d_("test");
  54129. object=$recv($1)._yourself();
  54130. self._assert_equals_($recv(object)._d(),"test");
  54131. return self;
  54132. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54133. },
  54134. args: [],
  54135. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54136. referencedClasses: [],
  54137. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54138. }),
  54139. $globals.JSObjectProxyTest);
  54140. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54141. $core.addMethod(
  54142. $core.method({
  54143. selector: "testCatchingException",
  54144. protocol: 'tests',
  54145. fn: function (){
  54146. var self=this;
  54147. return $core.withContext(function($ctx1) {
  54148. $recv((function(){
  54149. return $core.withContext(function($ctx2) {
  54150. return self._throwException();
  54151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54152. }))._on_do_($globals.Error,(function(error){
  54153. return $core.withContext(function($ctx2) {
  54154. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54155. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54156. }));
  54157. return self;
  54158. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54159. },
  54160. args: [],
  54161. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54162. referencedClasses: ["Error"],
  54163. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54164. }),
  54165. $globals.JavaScriptExceptionTest);
  54166. $core.addMethod(
  54167. $core.method({
  54168. selector: "testRaisingException",
  54169. protocol: 'tests',
  54170. fn: function (){
  54171. var self=this;
  54172. return $core.withContext(function($ctx1) {
  54173. self._should_raise_((function(){
  54174. return $core.withContext(function($ctx2) {
  54175. return self._throwException();
  54176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54177. }),$globals.JavaScriptException);
  54178. return self;
  54179. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54180. },
  54181. args: [],
  54182. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54183. referencedClasses: ["JavaScriptException"],
  54184. messageSends: ["should:raise:", "throwException"]
  54185. }),
  54186. $globals.JavaScriptExceptionTest);
  54187. $core.addMethod(
  54188. $core.method({
  54189. selector: "throwException",
  54190. protocol: 'helpers',
  54191. fn: function (){
  54192. var self=this;
  54193. return $core.withContext(function($ctx1) {
  54194. throw 'test';
  54195. return self;
  54196. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54197. },
  54198. args: [],
  54199. source: "throwException\x0a\x09<throw 'test'>",
  54200. referencedClasses: [],
  54201. messageSends: []
  54202. }),
  54203. $globals.JavaScriptExceptionTest);
  54204. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54205. $core.addMethod(
  54206. $core.method({
  54207. selector: "testValue",
  54208. protocol: 'tests',
  54209. fn: function (){
  54210. var self=this;
  54211. var messageSend;
  54212. return $core.withContext(function($ctx1) {
  54213. var $1;
  54214. $1=$recv($globals.MessageSend)._new();
  54215. $ctx1.sendIdx["new"]=1;
  54216. $recv($1)._receiver_($recv($globals.Object)._new());
  54217. $recv($1)._selector_("asString");
  54218. messageSend=$recv($1)._yourself();
  54219. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54220. return self;
  54221. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54222. },
  54223. args: [],
  54224. 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'",
  54225. referencedClasses: ["MessageSend", "Object"],
  54226. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54227. }),
  54228. $globals.MessageSendTest);
  54229. $core.addMethod(
  54230. $core.method({
  54231. selector: "testValueWithArguments",
  54232. protocol: 'tests',
  54233. fn: function (){
  54234. var self=this;
  54235. var messageSend;
  54236. return $core.withContext(function($ctx1) {
  54237. var $1;
  54238. $1=$recv($globals.MessageSend)._new();
  54239. $recv($1)._receiver_((2));
  54240. $recv($1)._selector_("+");
  54241. messageSend=$recv($1)._yourself();
  54242. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54243. $ctx1.sendIdx["assert:equals:"]=1;
  54244. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54245. return self;
  54246. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54247. },
  54248. args: [],
  54249. 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",
  54250. referencedClasses: ["MessageSend"],
  54251. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54252. }),
  54253. $globals.MessageSendTest);
  54254. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54255. $core.addMethod(
  54256. $core.method({
  54257. selector: "codeGeneratorClass",
  54258. protocol: 'accessing',
  54259. fn: function (){
  54260. var self=this;
  54261. return $globals.CodeGenerator;
  54262. },
  54263. args: [],
  54264. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54265. referencedClasses: ["CodeGenerator"],
  54266. messageSends: []
  54267. }),
  54268. $globals.MethodInheritanceTest);
  54269. $core.addMethod(
  54270. $core.method({
  54271. selector: "compiler",
  54272. protocol: 'factory',
  54273. fn: function (){
  54274. var self=this;
  54275. return $core.withContext(function($ctx1) {
  54276. var $1;
  54277. $1=$recv($globals.Compiler)._new();
  54278. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  54279. return $recv($1)._yourself();
  54280. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54281. },
  54282. args: [],
  54283. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54284. referencedClasses: ["Compiler"],
  54285. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54286. }),
  54287. $globals.MethodInheritanceTest);
  54288. $core.addMethod(
  54289. $core.method({
  54290. selector: "deinstallBottom",
  54291. protocol: 'testing',
  54292. fn: function (){
  54293. var self=this;
  54294. return $core.withContext(function($ctx1) {
  54295. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54296. return self;
  54297. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54298. },
  54299. args: [],
  54300. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54301. referencedClasses: [],
  54302. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54303. }),
  54304. $globals.MethodInheritanceTest);
  54305. $core.addMethod(
  54306. $core.method({
  54307. selector: "deinstallMiddle",
  54308. protocol: 'testing',
  54309. fn: function (){
  54310. var self=this;
  54311. return $core.withContext(function($ctx1) {
  54312. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  54313. return self;
  54314. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  54315. },
  54316. args: [],
  54317. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  54318. referencedClasses: [],
  54319. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  54320. }),
  54321. $globals.MethodInheritanceTest);
  54322. $core.addMethod(
  54323. $core.method({
  54324. selector: "deinstallTop",
  54325. protocol: 'testing',
  54326. fn: function (){
  54327. var self=this;
  54328. return $core.withContext(function($ctx1) {
  54329. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  54330. return self;
  54331. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  54332. },
  54333. args: [],
  54334. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  54335. referencedClasses: [],
  54336. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  54337. }),
  54338. $globals.MethodInheritanceTest);
  54339. $core.addMethod(
  54340. $core.method({
  54341. selector: "installBottom:",
  54342. protocol: 'testing',
  54343. fn: function (aString){
  54344. var self=this;
  54345. return $core.withContext(function($ctx1) {
  54346. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  54347. return self;
  54348. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  54349. },
  54350. args: ["aString"],
  54351. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  54352. referencedClasses: [],
  54353. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  54354. }),
  54355. $globals.MethodInheritanceTest);
  54356. $core.addMethod(
  54357. $core.method({
  54358. selector: "installMiddle:",
  54359. protocol: 'testing',
  54360. fn: function (aString){
  54361. var self=this;
  54362. return $core.withContext(function($ctx1) {
  54363. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54364. return self;
  54365. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54366. },
  54367. args: ["aString"],
  54368. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54369. referencedClasses: [],
  54370. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54371. }),
  54372. $globals.MethodInheritanceTest);
  54373. $core.addMethod(
  54374. $core.method({
  54375. selector: "installTop:",
  54376. protocol: 'testing',
  54377. fn: function (aString){
  54378. var self=this;
  54379. return $core.withContext(function($ctx1) {
  54380. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54381. return self;
  54382. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54383. },
  54384. args: ["aString"],
  54385. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54386. referencedClasses: [],
  54387. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54388. }),
  54389. $globals.MethodInheritanceTest);
  54390. $core.addMethod(
  54391. $core.method({
  54392. selector: "setUp",
  54393. protocol: 'initialization',
  54394. fn: function (){
  54395. var self=this;
  54396. return $core.withContext(function($ctx1) {
  54397. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54398. $ctx1.sendIdx["new"]=1;
  54399. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54400. $ctx1.sendIdx["new"]=2;
  54401. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54402. self["@method"]=nil;
  54403. self["@performBlock"]=(function(){
  54404. return $core.withContext(function($ctx2) {
  54405. return self._error_("performBlock not initialized");
  54406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54407. });
  54408. return self;
  54409. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54410. },
  54411. args: [],
  54412. 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' ]",
  54413. referencedClasses: [],
  54414. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54415. }),
  54416. $globals.MethodInheritanceTest);
  54417. $core.addMethod(
  54418. $core.method({
  54419. selector: "shouldMNU",
  54420. protocol: 'testing',
  54421. fn: function (){
  54422. var self=this;
  54423. return $core.withContext(function($ctx1) {
  54424. self._shouldMNUTop();
  54425. self._shouldMNUMiddle();
  54426. self._shouldMNUBottom();
  54427. return self;
  54428. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54429. },
  54430. args: [],
  54431. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54432. referencedClasses: [],
  54433. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54434. }),
  54435. $globals.MethodInheritanceTest);
  54436. $core.addMethod(
  54437. $core.method({
  54438. selector: "shouldMNUBottom",
  54439. protocol: 'testing',
  54440. fn: function (){
  54441. var self=this;
  54442. return $core.withContext(function($ctx1) {
  54443. self._should_raise_((function(){
  54444. return $core.withContext(function($ctx2) {
  54445. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54447. }),$globals.MessageNotUnderstood);
  54448. return self;
  54449. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54450. },
  54451. args: [],
  54452. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54453. referencedClasses: ["MessageNotUnderstood"],
  54454. messageSends: ["should:raise:", "value:"]
  54455. }),
  54456. $globals.MethodInheritanceTest);
  54457. $core.addMethod(
  54458. $core.method({
  54459. selector: "shouldMNUMiddle",
  54460. protocol: 'testing',
  54461. fn: function (){
  54462. var self=this;
  54463. return $core.withContext(function($ctx1) {
  54464. self._should_raise_((function(){
  54465. return $core.withContext(function($ctx2) {
  54466. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54468. }),$globals.MessageNotUnderstood);
  54469. return self;
  54470. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54471. },
  54472. args: [],
  54473. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54474. referencedClasses: ["MessageNotUnderstood"],
  54475. messageSends: ["should:raise:", "value:"]
  54476. }),
  54477. $globals.MethodInheritanceTest);
  54478. $core.addMethod(
  54479. $core.method({
  54480. selector: "shouldMNUTop",
  54481. protocol: 'testing',
  54482. fn: function (){
  54483. var self=this;
  54484. return $core.withContext(function($ctx1) {
  54485. self._should_raise_((function(){
  54486. return $core.withContext(function($ctx2) {
  54487. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54489. }),$globals.MessageNotUnderstood);
  54490. return self;
  54491. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54492. },
  54493. args: [],
  54494. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54495. referencedClasses: ["MessageNotUnderstood"],
  54496. messageSends: ["should:raise:", "value:"]
  54497. }),
  54498. $globals.MethodInheritanceTest);
  54499. $core.addMethod(
  54500. $core.method({
  54501. selector: "shouldReturn:",
  54502. protocol: 'testing',
  54503. fn: function (anObject){
  54504. var self=this;
  54505. var result;
  54506. return $core.withContext(function($ctx1) {
  54507. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54508. $ctx1.sendIdx["value:"]=1;
  54509. self._assert_equals_(["top",anObject],["top",result]);
  54510. $ctx1.sendIdx["assert:equals:"]=1;
  54511. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54512. $ctx1.sendIdx["value:"]=2;
  54513. self._assert_equals_(["middle",anObject],["middle",result]);
  54514. $ctx1.sendIdx["assert:equals:"]=2;
  54515. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54516. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54517. return self;
  54518. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54519. },
  54520. args: ["anObject"],
  54521. 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 }",
  54522. referencedClasses: [],
  54523. messageSends: ["value:", "assert:equals:"]
  54524. }),
  54525. $globals.MethodInheritanceTest);
  54526. $core.addMethod(
  54527. $core.method({
  54528. selector: "shouldReturn:and:and:",
  54529. protocol: 'testing',
  54530. fn: function (anObject,anObject2,anObject3){
  54531. var self=this;
  54532. var result;
  54533. return $core.withContext(function($ctx1) {
  54534. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54535. $ctx1.sendIdx["value:"]=1;
  54536. self._assert_equals_(["top",anObject],["top",result]);
  54537. $ctx1.sendIdx["assert:equals:"]=1;
  54538. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54539. $ctx1.sendIdx["value:"]=2;
  54540. self._assert_equals_(["middle",anObject2],["middle",result]);
  54541. $ctx1.sendIdx["assert:equals:"]=2;
  54542. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54543. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54544. return self;
  54545. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54546. },
  54547. args: ["anObject", "anObject2", "anObject3"],
  54548. 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 }",
  54549. referencedClasses: [],
  54550. messageSends: ["value:", "assert:equals:"]
  54551. }),
  54552. $globals.MethodInheritanceTest);
  54553. $core.addMethod(
  54554. $core.method({
  54555. selector: "targetClassBottom",
  54556. protocol: 'accessing',
  54557. fn: function (){
  54558. var self=this;
  54559. return $globals.JavaScriptException;
  54560. },
  54561. args: [],
  54562. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54563. referencedClasses: ["JavaScriptException"],
  54564. messageSends: []
  54565. }),
  54566. $globals.MethodInheritanceTest);
  54567. $core.addMethod(
  54568. $core.method({
  54569. selector: "targetClassMiddle",
  54570. protocol: 'accessing',
  54571. fn: function (){
  54572. var self=this;
  54573. return $globals.Error;
  54574. },
  54575. args: [],
  54576. source: "targetClassMiddle\x0a\x09^ Error",
  54577. referencedClasses: ["Error"],
  54578. messageSends: []
  54579. }),
  54580. $globals.MethodInheritanceTest);
  54581. $core.addMethod(
  54582. $core.method({
  54583. selector: "targetClassTop",
  54584. protocol: 'accessing',
  54585. fn: function (){
  54586. var self=this;
  54587. return $globals.Object;
  54588. },
  54589. args: [],
  54590. source: "targetClassTop\x0a\x09^ Object",
  54591. referencedClasses: ["Object"],
  54592. messageSends: []
  54593. }),
  54594. $globals.MethodInheritanceTest);
  54595. $core.addMethod(
  54596. $core.method({
  54597. selector: "tearDown",
  54598. protocol: 'initialization',
  54599. fn: function (){
  54600. var self=this;
  54601. return $core.withContext(function($ctx1) {
  54602. $recv((function(){
  54603. return $core.withContext(function($ctx2) {
  54604. return self._deinstallTop();
  54605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54606. }))._on_do_($globals.Error,(function(){
  54607. }));
  54608. $ctx1.sendIdx["on:do:"]=1;
  54609. $recv((function(){
  54610. return $core.withContext(function($ctx2) {
  54611. return self._deinstallMiddle();
  54612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54613. }))._on_do_($globals.Error,(function(){
  54614. }));
  54615. $ctx1.sendIdx["on:do:"]=2;
  54616. $recv((function(){
  54617. return $core.withContext(function($ctx2) {
  54618. return self._deinstallBottom();
  54619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54620. }))._on_do_($globals.Error,(function(){
  54621. }));
  54622. return self;
  54623. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54624. },
  54625. args: [],
  54626. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54627. referencedClasses: ["Error"],
  54628. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54629. }),
  54630. $globals.MethodInheritanceTest);
  54631. $core.addMethod(
  54632. $core.method({
  54633. selector: "testMNU11",
  54634. protocol: 'tests',
  54635. fn: function (){
  54636. var self=this;
  54637. return $core.withContext(function($ctx1) {
  54638. self["@performBlock"]=(function(x){
  54639. return $core.withContext(function($ctx2) {
  54640. return $recv(x)._foo();
  54641. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54642. });
  54643. self._shouldMNU();
  54644. $ctx1.sendIdx["shouldMNU"]=1;
  54645. self._installTop_("foo ^ false");
  54646. $ctx1.sendIdx["installTop:"]=1;
  54647. self._installTop_("foo ^ true");
  54648. self._deinstallTop();
  54649. self._shouldMNU();
  54650. return self;
  54651. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54652. },
  54653. args: [],
  54654. 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",
  54655. referencedClasses: [],
  54656. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54657. }),
  54658. $globals.MethodInheritanceTest);
  54659. $core.addMethod(
  54660. $core.method({
  54661. selector: "testMNU22",
  54662. protocol: 'tests',
  54663. fn: function (){
  54664. var self=this;
  54665. return $core.withContext(function($ctx1) {
  54666. self["@performBlock"]=(function(x){
  54667. return $core.withContext(function($ctx2) {
  54668. return $recv(x)._foo();
  54669. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54670. });
  54671. self._shouldMNU();
  54672. $ctx1.sendIdx["shouldMNU"]=1;
  54673. self._installMiddle_("foo ^ false");
  54674. $ctx1.sendIdx["installMiddle:"]=1;
  54675. self._installMiddle_("foo ^ true");
  54676. self._deinstallMiddle();
  54677. self._shouldMNU();
  54678. return self;
  54679. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54680. },
  54681. args: [],
  54682. 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",
  54683. referencedClasses: [],
  54684. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54685. }),
  54686. $globals.MethodInheritanceTest);
  54687. $core.addMethod(
  54688. $core.method({
  54689. selector: "testReturns1",
  54690. protocol: 'tests',
  54691. fn: function (){
  54692. var self=this;
  54693. return $core.withContext(function($ctx1) {
  54694. self["@performBlock"]=(function(x){
  54695. return $core.withContext(function($ctx2) {
  54696. return $recv(x)._foo();
  54697. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54698. });
  54699. self._installTop_("foo ^ false");
  54700. $ctx1.sendIdx["installTop:"]=1;
  54701. self._shouldReturn_(false);
  54702. $ctx1.sendIdx["shouldReturn:"]=1;
  54703. self._installTop_("foo ^ true");
  54704. self._shouldReturn_(true);
  54705. return self;
  54706. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54707. },
  54708. args: [],
  54709. 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",
  54710. referencedClasses: [],
  54711. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54712. }),
  54713. $globals.MethodInheritanceTest);
  54714. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54715. $core.addMethod(
  54716. $core.method({
  54717. selector: "testAbs",
  54718. protocol: 'tests',
  54719. fn: function (){
  54720. var self=this;
  54721. return $core.withContext(function($ctx1) {
  54722. var $1;
  54723. $1=(4)._abs();
  54724. $ctx1.sendIdx["abs"]=1;
  54725. self._assert_equals_($1,(4));
  54726. $ctx1.sendIdx["assert:equals:"]=1;
  54727. self._assert_equals_((-4)._abs(),(4));
  54728. return self;
  54729. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54730. },
  54731. args: [],
  54732. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54733. referencedClasses: [],
  54734. messageSends: ["assert:equals:", "abs"]
  54735. }),
  54736. $globals.NumberTest);
  54737. $core.addMethod(
  54738. $core.method({
  54739. selector: "testArithmetic",
  54740. protocol: 'tests',
  54741. fn: function (){
  54742. var self=this;
  54743. return $core.withContext(function($ctx1) {
  54744. var $1,$2,$3,$5,$4;
  54745. $1=(1.5).__plus((1));
  54746. $ctx1.sendIdx["+"]=1;
  54747. self._assert_equals_($1,(2.5));
  54748. $ctx1.sendIdx["assert:equals:"]=1;
  54749. $2=(2).__minus((1));
  54750. $ctx1.sendIdx["-"]=1;
  54751. self._assert_equals_($2,(1));
  54752. $ctx1.sendIdx["assert:equals:"]=2;
  54753. self._assert_equals_((-2).__minus((1)),(-3));
  54754. $ctx1.sendIdx["assert:equals:"]=3;
  54755. self._assert_equals_((12).__slash((2)),(6));
  54756. $ctx1.sendIdx["assert:equals:"]=4;
  54757. $3=(3).__star((4));
  54758. $ctx1.sendIdx["*"]=1;
  54759. self._assert_equals_($3,(12));
  54760. $ctx1.sendIdx["assert:equals:"]=5;
  54761. self._assert_equals_((7).__slash_slash((2)),(3));
  54762. $ctx1.sendIdx["assert:equals:"]=6;
  54763. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54764. $ctx1.sendIdx["assert:equals:"]=7;
  54765. $5=(1).__plus((2));
  54766. $ctx1.sendIdx["+"]=2;
  54767. $4=$recv($5).__star((3));
  54768. $ctx1.sendIdx["*"]=2;
  54769. self._assert_equals_($4,(9));
  54770. $ctx1.sendIdx["assert:equals:"]=8;
  54771. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54772. return self;
  54773. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54774. },
  54775. args: [],
  54776. 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",
  54777. referencedClasses: [],
  54778. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54779. }),
  54780. $globals.NumberTest);
  54781. $core.addMethod(
  54782. $core.method({
  54783. selector: "testAsNumber",
  54784. protocol: 'tests',
  54785. fn: function (){
  54786. var self=this;
  54787. return $core.withContext(function($ctx1) {
  54788. self._assert_equals_((3)._asNumber(),(3));
  54789. return self;
  54790. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54791. },
  54792. args: [],
  54793. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54794. referencedClasses: [],
  54795. messageSends: ["assert:equals:", "asNumber"]
  54796. }),
  54797. $globals.NumberTest);
  54798. $core.addMethod(
  54799. $core.method({
  54800. selector: "testCeiling",
  54801. protocol: 'tests',
  54802. fn: function (){
  54803. var self=this;
  54804. return $core.withContext(function($ctx1) {
  54805. var $1,$2;
  54806. $1=(1.2)._ceiling();
  54807. $ctx1.sendIdx["ceiling"]=1;
  54808. self._assert_equals_($1,(2));
  54809. $ctx1.sendIdx["assert:equals:"]=1;
  54810. $2=(-1.2)._ceiling();
  54811. $ctx1.sendIdx["ceiling"]=2;
  54812. self._assert_equals_($2,(-1));
  54813. $ctx1.sendIdx["assert:equals:"]=2;
  54814. self._assert_equals_((1)._ceiling(),(1));
  54815. return self;
  54816. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54817. },
  54818. args: [],
  54819. 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.",
  54820. referencedClasses: [],
  54821. messageSends: ["assert:equals:", "ceiling"]
  54822. }),
  54823. $globals.NumberTest);
  54824. $core.addMethod(
  54825. $core.method({
  54826. selector: "testComparison",
  54827. protocol: 'tests',
  54828. fn: function (){
  54829. var self=this;
  54830. return $core.withContext(function($ctx1) {
  54831. var $1,$2,$3,$4;
  54832. $1=(3).__gt((2));
  54833. $ctx1.sendIdx[">"]=1;
  54834. self._assert_($1);
  54835. $ctx1.sendIdx["assert:"]=1;
  54836. $2=(2).__lt((3));
  54837. $ctx1.sendIdx["<"]=1;
  54838. self._assert_($2);
  54839. $ctx1.sendIdx["assert:"]=2;
  54840. self._deny_((3).__lt((2)));
  54841. $ctx1.sendIdx["deny:"]=1;
  54842. self._deny_((2).__gt((3)));
  54843. $3=(3).__gt_eq((3));
  54844. $ctx1.sendIdx[">="]=1;
  54845. self._assert_($3);
  54846. $ctx1.sendIdx["assert:"]=3;
  54847. self._assert_((3.1).__gt_eq((3)));
  54848. $ctx1.sendIdx["assert:"]=4;
  54849. $4=(3).__lt_eq((3));
  54850. $ctx1.sendIdx["<="]=1;
  54851. self._assert_($4);
  54852. $ctx1.sendIdx["assert:"]=5;
  54853. self._assert_((3).__lt_eq((3.1)));
  54854. return self;
  54855. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54856. },
  54857. args: [],
  54858. 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",
  54859. referencedClasses: [],
  54860. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54861. }),
  54862. $globals.NumberTest);
  54863. $core.addMethod(
  54864. $core.method({
  54865. selector: "testCopying",
  54866. protocol: 'tests',
  54867. fn: function (){
  54868. var self=this;
  54869. return $core.withContext(function($ctx1) {
  54870. var $1;
  54871. $1=$recv((1)._copy()).__eq_eq((1));
  54872. $ctx1.sendIdx["=="]=1;
  54873. self._assert_($1);
  54874. $ctx1.sendIdx["assert:"]=1;
  54875. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54876. return self;
  54877. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54878. },
  54879. args: [],
  54880. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54881. referencedClasses: [],
  54882. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54883. }),
  54884. $globals.NumberTest);
  54885. $core.addMethod(
  54886. $core.method({
  54887. selector: "testEquality",
  54888. protocol: 'tests',
  54889. fn: function (){
  54890. var self=this;
  54891. return $core.withContext(function($ctx1) {
  54892. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54893. $1=(1).__eq((1));
  54894. $ctx1.sendIdx["="]=1;
  54895. self._assert_($1);
  54896. $ctx1.sendIdx["assert:"]=1;
  54897. $2=(0).__eq((0));
  54898. $ctx1.sendIdx["="]=2;
  54899. self._assert_($2);
  54900. $ctx1.sendIdx["assert:"]=2;
  54901. $3=(1).__eq((0));
  54902. $ctx1.sendIdx["="]=3;
  54903. self._deny_($3);
  54904. $ctx1.sendIdx["deny:"]=1;
  54905. $5=(1)._yourself();
  54906. $ctx1.sendIdx["yourself"]=1;
  54907. $4=$recv($5).__eq((1));
  54908. $ctx1.sendIdx["="]=4;
  54909. self._assert_($4);
  54910. $ctx1.sendIdx["assert:"]=3;
  54911. $7=(1)._yourself();
  54912. $ctx1.sendIdx["yourself"]=2;
  54913. $6=(1).__eq($7);
  54914. $ctx1.sendIdx["="]=5;
  54915. self._assert_($6);
  54916. $ctx1.sendIdx["assert:"]=4;
  54917. $9=(1)._yourself();
  54918. $ctx1.sendIdx["yourself"]=3;
  54919. $8=$recv($9).__eq((1)._yourself());
  54920. $ctx1.sendIdx["="]=6;
  54921. self._assert_($8);
  54922. $10=(0).__eq(false);
  54923. $ctx1.sendIdx["="]=7;
  54924. self._deny_($10);
  54925. $ctx1.sendIdx["deny:"]=2;
  54926. $11=false.__eq((0));
  54927. $ctx1.sendIdx["="]=8;
  54928. self._deny_($11);
  54929. $ctx1.sendIdx["deny:"]=3;
  54930. $12="".__eq((0));
  54931. $ctx1.sendIdx["="]=9;
  54932. self._deny_($12);
  54933. $ctx1.sendIdx["deny:"]=4;
  54934. self._deny_((0).__eq(""));
  54935. return self;
  54936. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54937. },
  54938. args: [],
  54939. 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 = ''",
  54940. referencedClasses: [],
  54941. messageSends: ["assert:", "=", "deny:", "yourself"]
  54942. }),
  54943. $globals.NumberTest);
  54944. $core.addMethod(
  54945. $core.method({
  54946. selector: "testFloor",
  54947. protocol: 'tests',
  54948. fn: function (){
  54949. var self=this;
  54950. return $core.withContext(function($ctx1) {
  54951. var $1,$2;
  54952. $1=(1.2)._floor();
  54953. $ctx1.sendIdx["floor"]=1;
  54954. self._assert_equals_($1,(1));
  54955. $ctx1.sendIdx["assert:equals:"]=1;
  54956. $2=(-1.2)._floor();
  54957. $ctx1.sendIdx["floor"]=2;
  54958. self._assert_equals_($2,(-2));
  54959. $ctx1.sendIdx["assert:equals:"]=2;
  54960. self._assert_equals_((1)._floor(),(1));
  54961. return self;
  54962. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54963. },
  54964. args: [],
  54965. 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.",
  54966. referencedClasses: [],
  54967. messageSends: ["assert:equals:", "floor"]
  54968. }),
  54969. $globals.NumberTest);
  54970. $core.addMethod(
  54971. $core.method({
  54972. selector: "testHexNumbers",
  54973. protocol: 'tests',
  54974. fn: function (){
  54975. var self=this;
  54976. return $core.withContext(function($ctx1) {
  54977. var $1,$2,$3,$4,$5;
  54978. self._assert_equals_((9),(9));
  54979. $ctx1.sendIdx["assert:equals:"]=1;
  54980. $1=(10)._truncated();
  54981. $ctx1.sendIdx["truncated"]=1;
  54982. self._assert_equals_($1,(10));
  54983. $ctx1.sendIdx["assert:equals:"]=2;
  54984. $2=(11)._truncated();
  54985. $ctx1.sendIdx["truncated"]=2;
  54986. self._assert_equals_($2,(11));
  54987. $ctx1.sendIdx["assert:equals:"]=3;
  54988. $3=(12)._truncated();
  54989. $ctx1.sendIdx["truncated"]=3;
  54990. self._assert_equals_($3,(12));
  54991. $ctx1.sendIdx["assert:equals:"]=4;
  54992. $4=(13)._truncated();
  54993. $ctx1.sendIdx["truncated"]=4;
  54994. self._assert_equals_($4,(13));
  54995. $ctx1.sendIdx["assert:equals:"]=5;
  54996. $5=(14)._truncated();
  54997. $ctx1.sendIdx["truncated"]=5;
  54998. self._assert_equals_($5,(14));
  54999. $ctx1.sendIdx["assert:equals:"]=6;
  55000. self._assert_equals_((15)._truncated(),(15));
  55001. return self;
  55002. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55003. },
  55004. args: [],
  55005. 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",
  55006. referencedClasses: [],
  55007. messageSends: ["assert:equals:", "truncated"]
  55008. }),
  55009. $globals.NumberTest);
  55010. $core.addMethod(
  55011. $core.method({
  55012. selector: "testIdentity",
  55013. protocol: 'tests',
  55014. fn: function (){
  55015. var self=this;
  55016. return $core.withContext(function($ctx1) {
  55017. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  55018. $1=(1).__eq_eq((1));
  55019. $ctx1.sendIdx["=="]=1;
  55020. self._assert_($1);
  55021. $ctx1.sendIdx["assert:"]=1;
  55022. $2=(0).__eq_eq((0));
  55023. $ctx1.sendIdx["=="]=2;
  55024. self._assert_($2);
  55025. $ctx1.sendIdx["assert:"]=2;
  55026. $3=(1).__eq_eq((0));
  55027. $ctx1.sendIdx["=="]=3;
  55028. self._deny_($3);
  55029. $ctx1.sendIdx["deny:"]=1;
  55030. $5=(1)._yourself();
  55031. $ctx1.sendIdx["yourself"]=1;
  55032. $4=$recv($5).__eq_eq((1));
  55033. $ctx1.sendIdx["=="]=4;
  55034. self._assert_($4);
  55035. $ctx1.sendIdx["assert:"]=3;
  55036. $7=(1)._yourself();
  55037. $ctx1.sendIdx["yourself"]=2;
  55038. $6=(1).__eq_eq($7);
  55039. $ctx1.sendIdx["=="]=5;
  55040. self._assert_($6);
  55041. $ctx1.sendIdx["assert:"]=4;
  55042. $9=(1)._yourself();
  55043. $ctx1.sendIdx["yourself"]=3;
  55044. $8=$recv($9).__eq_eq((1)._yourself());
  55045. $ctx1.sendIdx["=="]=6;
  55046. self._assert_($8);
  55047. self._deny_((1).__eq_eq((2)));
  55048. return self;
  55049. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  55050. },
  55051. args: [],
  55052. 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",
  55053. referencedClasses: [],
  55054. messageSends: ["assert:", "==", "deny:", "yourself"]
  55055. }),
  55056. $globals.NumberTest);
  55057. $core.addMethod(
  55058. $core.method({
  55059. selector: "testInvalidHexNumbers",
  55060. protocol: 'tests',
  55061. fn: function (){
  55062. var self=this;
  55063. return $core.withContext(function($ctx1) {
  55064. self._should_raise_((function(){
  55065. return $core.withContext(function($ctx2) {
  55066. return (16)._rG();
  55067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55068. }),$globals.MessageNotUnderstood);
  55069. $ctx1.sendIdx["should:raise:"]=1;
  55070. self._should_raise_((function(){
  55071. return $core.withContext(function($ctx2) {
  55072. return (16)._rg();
  55073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55074. }),$globals.MessageNotUnderstood);
  55075. $ctx1.sendIdx["should:raise:"]=2;
  55076. self._should_raise_((function(){
  55077. return $core.withContext(function($ctx2) {
  55078. return (16)._rH();
  55079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55080. }),$globals.MessageNotUnderstood);
  55081. $ctx1.sendIdx["should:raise:"]=3;
  55082. self._should_raise_((function(){
  55083. return $core.withContext(function($ctx2) {
  55084. return (16)._rh();
  55085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55086. }),$globals.MessageNotUnderstood);
  55087. $ctx1.sendIdx["should:raise:"]=4;
  55088. self._should_raise_((function(){
  55089. return $core.withContext(function($ctx2) {
  55090. return (16)._rI();
  55091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55092. }),$globals.MessageNotUnderstood);
  55093. $ctx1.sendIdx["should:raise:"]=5;
  55094. self._should_raise_((function(){
  55095. return $core.withContext(function($ctx2) {
  55096. return (16)._ri();
  55097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  55098. }),$globals.MessageNotUnderstood);
  55099. $ctx1.sendIdx["should:raise:"]=6;
  55100. self._should_raise_((function(){
  55101. return $core.withContext(function($ctx2) {
  55102. return (16)._rJ();
  55103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55104. }),$globals.MessageNotUnderstood);
  55105. $ctx1.sendIdx["should:raise:"]=7;
  55106. self._should_raise_((function(){
  55107. return $core.withContext(function($ctx2) {
  55108. return (16)._rj();
  55109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  55110. }),$globals.MessageNotUnderstood);
  55111. $ctx1.sendIdx["should:raise:"]=8;
  55112. self._should_raise_((function(){
  55113. return $core.withContext(function($ctx2) {
  55114. return (16)._rK();
  55115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55116. }),$globals.MessageNotUnderstood);
  55117. $ctx1.sendIdx["should:raise:"]=9;
  55118. self._should_raise_((function(){
  55119. return $core.withContext(function($ctx2) {
  55120. return (16)._rk();
  55121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55122. }),$globals.MessageNotUnderstood);
  55123. $ctx1.sendIdx["should:raise:"]=10;
  55124. self._should_raise_((function(){
  55125. return $core.withContext(function($ctx2) {
  55126. return (16)._rL();
  55127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55128. }),$globals.MessageNotUnderstood);
  55129. $ctx1.sendIdx["should:raise:"]=11;
  55130. self._should_raise_((function(){
  55131. return $core.withContext(function($ctx2) {
  55132. return (16)._rl();
  55133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55134. }),$globals.MessageNotUnderstood);
  55135. $ctx1.sendIdx["should:raise:"]=12;
  55136. self._should_raise_((function(){
  55137. return $core.withContext(function($ctx2) {
  55138. return (16)._rM();
  55139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55140. }),$globals.MessageNotUnderstood);
  55141. $ctx1.sendIdx["should:raise:"]=13;
  55142. self._should_raise_((function(){
  55143. return $core.withContext(function($ctx2) {
  55144. return (16)._rm();
  55145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55146. }),$globals.MessageNotUnderstood);
  55147. $ctx1.sendIdx["should:raise:"]=14;
  55148. self._should_raise_((function(){
  55149. return $core.withContext(function($ctx2) {
  55150. return (16)._rN();
  55151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55152. }),$globals.MessageNotUnderstood);
  55153. $ctx1.sendIdx["should:raise:"]=15;
  55154. self._should_raise_((function(){
  55155. return $core.withContext(function($ctx2) {
  55156. return (16)._rn();
  55157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55158. }),$globals.MessageNotUnderstood);
  55159. $ctx1.sendIdx["should:raise:"]=16;
  55160. self._should_raise_((function(){
  55161. return $core.withContext(function($ctx2) {
  55162. return (16)._rO();
  55163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55164. }),$globals.MessageNotUnderstood);
  55165. $ctx1.sendIdx["should:raise:"]=17;
  55166. self._should_raise_((function(){
  55167. return $core.withContext(function($ctx2) {
  55168. return (16)._ro();
  55169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55170. }),$globals.MessageNotUnderstood);
  55171. $ctx1.sendIdx["should:raise:"]=18;
  55172. self._should_raise_((function(){
  55173. return $core.withContext(function($ctx2) {
  55174. return (16)._rP();
  55175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55176. }),$globals.MessageNotUnderstood);
  55177. $ctx1.sendIdx["should:raise:"]=19;
  55178. self._should_raise_((function(){
  55179. return $core.withContext(function($ctx2) {
  55180. return (16)._rp();
  55181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55182. }),$globals.MessageNotUnderstood);
  55183. $ctx1.sendIdx["should:raise:"]=20;
  55184. self._should_raise_((function(){
  55185. return $core.withContext(function($ctx2) {
  55186. return (16)._rQ();
  55187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55188. }),$globals.MessageNotUnderstood);
  55189. $ctx1.sendIdx["should:raise:"]=21;
  55190. self._should_raise_((function(){
  55191. return $core.withContext(function($ctx2) {
  55192. return (16)._rq();
  55193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55194. }),$globals.MessageNotUnderstood);
  55195. $ctx1.sendIdx["should:raise:"]=22;
  55196. self._should_raise_((function(){
  55197. return $core.withContext(function($ctx2) {
  55198. return (16)._rR();
  55199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55200. }),$globals.MessageNotUnderstood);
  55201. $ctx1.sendIdx["should:raise:"]=23;
  55202. self._should_raise_((function(){
  55203. return $core.withContext(function($ctx2) {
  55204. return (16)._rr();
  55205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55206. }),$globals.MessageNotUnderstood);
  55207. $ctx1.sendIdx["should:raise:"]=24;
  55208. self._should_raise_((function(){
  55209. return $core.withContext(function($ctx2) {
  55210. return (16)._rS();
  55211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55212. }),$globals.MessageNotUnderstood);
  55213. $ctx1.sendIdx["should:raise:"]=25;
  55214. self._should_raise_((function(){
  55215. return $core.withContext(function($ctx2) {
  55216. return (16)._rs();
  55217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55218. }),$globals.MessageNotUnderstood);
  55219. $ctx1.sendIdx["should:raise:"]=26;
  55220. self._should_raise_((function(){
  55221. return $core.withContext(function($ctx2) {
  55222. return (16)._rT();
  55223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55224. }),$globals.MessageNotUnderstood);
  55225. $ctx1.sendIdx["should:raise:"]=27;
  55226. self._should_raise_((function(){
  55227. return $core.withContext(function($ctx2) {
  55228. return (16)._rt();
  55229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55230. }),$globals.MessageNotUnderstood);
  55231. $ctx1.sendIdx["should:raise:"]=28;
  55232. self._should_raise_((function(){
  55233. return $core.withContext(function($ctx2) {
  55234. return (16)._rU();
  55235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55236. }),$globals.MessageNotUnderstood);
  55237. $ctx1.sendIdx["should:raise:"]=29;
  55238. self._should_raise_((function(){
  55239. return $core.withContext(function($ctx2) {
  55240. return (16)._ru();
  55241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55242. }),$globals.MessageNotUnderstood);
  55243. $ctx1.sendIdx["should:raise:"]=30;
  55244. self._should_raise_((function(){
  55245. return $core.withContext(function($ctx2) {
  55246. return (16)._rV();
  55247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55248. }),$globals.MessageNotUnderstood);
  55249. $ctx1.sendIdx["should:raise:"]=31;
  55250. self._should_raise_((function(){
  55251. return $core.withContext(function($ctx2) {
  55252. return (16)._rv();
  55253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55254. }),$globals.MessageNotUnderstood);
  55255. $ctx1.sendIdx["should:raise:"]=32;
  55256. self._should_raise_((function(){
  55257. return $core.withContext(function($ctx2) {
  55258. return (16)._rW();
  55259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55260. }),$globals.MessageNotUnderstood);
  55261. $ctx1.sendIdx["should:raise:"]=33;
  55262. self._should_raise_((function(){
  55263. return $core.withContext(function($ctx2) {
  55264. return (16)._rw();
  55265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55266. }),$globals.MessageNotUnderstood);
  55267. $ctx1.sendIdx["should:raise:"]=34;
  55268. self._should_raise_((function(){
  55269. return $core.withContext(function($ctx2) {
  55270. return (16)._rX();
  55271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55272. }),$globals.MessageNotUnderstood);
  55273. $ctx1.sendIdx["should:raise:"]=35;
  55274. self._should_raise_((function(){
  55275. return $core.withContext(function($ctx2) {
  55276. return (16)._rx();
  55277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55278. }),$globals.MessageNotUnderstood);
  55279. $ctx1.sendIdx["should:raise:"]=36;
  55280. self._should_raise_((function(){
  55281. return $core.withContext(function($ctx2) {
  55282. return (16)._rY();
  55283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55284. }),$globals.MessageNotUnderstood);
  55285. $ctx1.sendIdx["should:raise:"]=37;
  55286. self._should_raise_((function(){
  55287. return $core.withContext(function($ctx2) {
  55288. return (16)._ry();
  55289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55290. }),$globals.MessageNotUnderstood);
  55291. $ctx1.sendIdx["should:raise:"]=38;
  55292. self._should_raise_((function(){
  55293. return $core.withContext(function($ctx2) {
  55294. return (16)._rZ();
  55295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55296. }),$globals.MessageNotUnderstood);
  55297. $ctx1.sendIdx["should:raise:"]=39;
  55298. self._should_raise_((function(){
  55299. return $core.withContext(function($ctx2) {
  55300. return (16)._rz();
  55301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  55302. }),$globals.MessageNotUnderstood);
  55303. $ctx1.sendIdx["should:raise:"]=40;
  55304. self._should_raise_((function(){
  55305. return $core.withContext(function($ctx2) {
  55306. return (11259375)._Z();
  55307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  55308. }),$globals.MessageNotUnderstood);
  55309. return self;
  55310. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  55311. },
  55312. args: [],
  55313. 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.",
  55314. referencedClasses: ["MessageNotUnderstood"],
  55315. 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"]
  55316. }),
  55317. $globals.NumberTest);
  55318. $core.addMethod(
  55319. $core.method({
  55320. selector: "testLog",
  55321. protocol: 'tests',
  55322. fn: function (){
  55323. var self=this;
  55324. return $core.withContext(function($ctx1) {
  55325. self._assert_equals_((10000)._log(),(4));
  55326. $ctx1.sendIdx["assert:equals:"]=1;
  55327. self._assert_equals_((512)._log_((2)),(9));
  55328. $ctx1.sendIdx["assert:equals:"]=2;
  55329. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  55330. return self;
  55331. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  55332. },
  55333. args: [],
  55334. 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.",
  55335. referencedClasses: ["Number"],
  55336. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  55337. }),
  55338. $globals.NumberTest);
  55339. $core.addMethod(
  55340. $core.method({
  55341. selector: "testMinMax",
  55342. protocol: 'tests',
  55343. fn: function (){
  55344. var self=this;
  55345. return $core.withContext(function($ctx1) {
  55346. self._assert_equals_((2)._max_((5)),(5));
  55347. $ctx1.sendIdx["assert:equals:"]=1;
  55348. self._assert_equals_((2)._min_((5)),(2));
  55349. return self;
  55350. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  55351. },
  55352. args: [],
  55353. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  55354. referencedClasses: [],
  55355. messageSends: ["assert:equals:", "max:", "min:"]
  55356. }),
  55357. $globals.NumberTest);
  55358. $core.addMethod(
  55359. $core.method({
  55360. selector: "testNegated",
  55361. protocol: 'tests',
  55362. fn: function (){
  55363. var self=this;
  55364. return $core.withContext(function($ctx1) {
  55365. var $1;
  55366. $1=(3)._negated();
  55367. $ctx1.sendIdx["negated"]=1;
  55368. self._assert_equals_($1,(-3));
  55369. $ctx1.sendIdx["assert:equals:"]=1;
  55370. self._assert_equals_((-3)._negated(),(3));
  55371. return self;
  55372. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55373. },
  55374. args: [],
  55375. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55376. referencedClasses: [],
  55377. messageSends: ["assert:equals:", "negated"]
  55378. }),
  55379. $globals.NumberTest);
  55380. $core.addMethod(
  55381. $core.method({
  55382. selector: "testPrintShowingDecimalPlaces",
  55383. protocol: 'tests',
  55384. fn: function (){
  55385. var self=this;
  55386. return $core.withContext(function($ctx1) {
  55387. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55388. $1=(23)._printShowingDecimalPlaces_((2));
  55389. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55390. self._assert_equals_($1,"23.00");
  55391. $ctx1.sendIdx["assert:equals:"]=1;
  55392. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55393. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55394. self._assert_equals_($2,"23.57");
  55395. $ctx1.sendIdx["assert:equals:"]=2;
  55396. $4=(234.567)._negated();
  55397. $ctx1.sendIdx["negated"]=1;
  55398. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55399. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55400. self._assert_equals_($3,"-234.56700");
  55401. $ctx1.sendIdx["assert:equals:"]=3;
  55402. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55403. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55404. self._assert_equals_($5,"23");
  55405. $ctx1.sendIdx["assert:equals:"]=4;
  55406. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55407. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55408. self._assert_equals_($6,"24");
  55409. $ctx1.sendIdx["assert:equals:"]=5;
  55410. $8=(23.4567)._negated();
  55411. $ctx1.sendIdx["negated"]=2;
  55412. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55413. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55414. self._assert_equals_($7,"-23");
  55415. $ctx1.sendIdx["assert:equals:"]=6;
  55416. $10=(23.5567)._negated();
  55417. $ctx1.sendIdx["negated"]=3;
  55418. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55419. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55420. self._assert_equals_($9,"-24");
  55421. $ctx1.sendIdx["assert:equals:"]=7;
  55422. $11=(100000000)._printShowingDecimalPlaces_((1));
  55423. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55424. self._assert_equals_($11,"100000000.0");
  55425. $ctx1.sendIdx["assert:equals:"]=8;
  55426. $12=(0.98)._printShowingDecimalPlaces_((5));
  55427. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55428. self._assert_equals_($12,"0.98000");
  55429. $ctx1.sendIdx["assert:equals:"]=9;
  55430. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55431. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55432. self._assert_equals_($13,"-0.98");
  55433. $ctx1.sendIdx["assert:equals:"]=10;
  55434. $14=(2.567)._printShowingDecimalPlaces_((2));
  55435. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55436. self._assert_equals_($14,"2.57");
  55437. $ctx1.sendIdx["assert:equals:"]=11;
  55438. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55439. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55440. self._assert_equals_($15,"-2.57");
  55441. $ctx1.sendIdx["assert:equals:"]=12;
  55442. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55443. return self;
  55444. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55445. },
  55446. args: [],
  55447. 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'.",
  55448. referencedClasses: [],
  55449. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55450. }),
  55451. $globals.NumberTest);
  55452. $core.addMethod(
  55453. $core.method({
  55454. selector: "testRaisedTo",
  55455. protocol: 'tests',
  55456. fn: function (){
  55457. var self=this;
  55458. return $core.withContext(function($ctx1) {
  55459. var $1,$2,$3;
  55460. $1=(2)._raisedTo_((4));
  55461. $ctx1.sendIdx["raisedTo:"]=1;
  55462. self._assert_equals_($1,(16));
  55463. $ctx1.sendIdx["assert:equals:"]=1;
  55464. $2=(2)._raisedTo_((0));
  55465. $ctx1.sendIdx["raisedTo:"]=2;
  55466. self._assert_equals_($2,(1));
  55467. $ctx1.sendIdx["assert:equals:"]=2;
  55468. $3=(2)._raisedTo_((-3));
  55469. $ctx1.sendIdx["raisedTo:"]=3;
  55470. self._assert_equals_($3,(0.125));
  55471. $ctx1.sendIdx["assert:equals:"]=3;
  55472. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55473. $ctx1.sendIdx["assert:equals:"]=4;
  55474. self._assert_equals_((2).__star_star((4)),(16));
  55475. return self;
  55476. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55477. },
  55478. args: [],
  55479. 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.",
  55480. referencedClasses: [],
  55481. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55482. }),
  55483. $globals.NumberTest);
  55484. $core.addMethod(
  55485. $core.method({
  55486. selector: "testRounded",
  55487. protocol: 'tests',
  55488. fn: function (){
  55489. var self=this;
  55490. return $core.withContext(function($ctx1) {
  55491. var $1,$2;
  55492. $1=(3)._rounded();
  55493. $ctx1.sendIdx["rounded"]=1;
  55494. self._assert_equals_($1,(3));
  55495. $ctx1.sendIdx["assert:equals:"]=1;
  55496. $2=(3.212)._rounded();
  55497. $ctx1.sendIdx["rounded"]=2;
  55498. self._assert_equals_($2,(3));
  55499. $ctx1.sendIdx["assert:equals:"]=2;
  55500. self._assert_equals_((3.51)._rounded(),(4));
  55501. return self;
  55502. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55503. },
  55504. args: [],
  55505. 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",
  55506. referencedClasses: [],
  55507. messageSends: ["assert:equals:", "rounded"]
  55508. }),
  55509. $globals.NumberTest);
  55510. $core.addMethod(
  55511. $core.method({
  55512. selector: "testSign",
  55513. protocol: 'tests',
  55514. fn: function (){
  55515. var self=this;
  55516. return $core.withContext(function($ctx1) {
  55517. var $1,$2;
  55518. $1=(5)._sign();
  55519. $ctx1.sendIdx["sign"]=1;
  55520. self._assert_equals_($1,(1));
  55521. $ctx1.sendIdx["assert:equals:"]=1;
  55522. $2=(0)._sign();
  55523. $ctx1.sendIdx["sign"]=2;
  55524. self._assert_equals_($2,(0));
  55525. $ctx1.sendIdx["assert:equals:"]=2;
  55526. self._assert_equals_((-1.4)._sign(),(-1));
  55527. return self;
  55528. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55529. },
  55530. args: [],
  55531. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55532. referencedClasses: [],
  55533. messageSends: ["assert:equals:", "sign"]
  55534. }),
  55535. $globals.NumberTest);
  55536. $core.addMethod(
  55537. $core.method({
  55538. selector: "testSqrt",
  55539. protocol: 'tests',
  55540. fn: function (){
  55541. var self=this;
  55542. return $core.withContext(function($ctx1) {
  55543. var $1;
  55544. $1=(4)._sqrt();
  55545. $ctx1.sendIdx["sqrt"]=1;
  55546. self._assert_equals_($1,(2));
  55547. $ctx1.sendIdx["assert:equals:"]=1;
  55548. self._assert_equals_((16)._sqrt(),(4));
  55549. return self;
  55550. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55551. },
  55552. args: [],
  55553. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55554. referencedClasses: [],
  55555. messageSends: ["assert:equals:", "sqrt"]
  55556. }),
  55557. $globals.NumberTest);
  55558. $core.addMethod(
  55559. $core.method({
  55560. selector: "testSquared",
  55561. protocol: 'tests',
  55562. fn: function (){
  55563. var self=this;
  55564. return $core.withContext(function($ctx1) {
  55565. self._assert_equals_((4)._squared(),(16));
  55566. return self;
  55567. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55568. },
  55569. args: [],
  55570. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55571. referencedClasses: [],
  55572. messageSends: ["assert:equals:", "squared"]
  55573. }),
  55574. $globals.NumberTest);
  55575. $core.addMethod(
  55576. $core.method({
  55577. selector: "testTimesRepeat",
  55578. protocol: 'tests',
  55579. fn: function (){
  55580. var self=this;
  55581. var i;
  55582. return $core.withContext(function($ctx1) {
  55583. i=(0);
  55584. (0)._timesRepeat_((function(){
  55585. return $core.withContext(function($ctx2) {
  55586. i=$recv(i).__plus((1));
  55587. $ctx2.sendIdx["+"]=1;
  55588. return i;
  55589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55590. }));
  55591. $ctx1.sendIdx["timesRepeat:"]=1;
  55592. self._assert_equals_(i,(0));
  55593. $ctx1.sendIdx["assert:equals:"]=1;
  55594. (5)._timesRepeat_((function(){
  55595. return $core.withContext(function($ctx2) {
  55596. i=$recv(i).__plus((1));
  55597. return i;
  55598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55599. }));
  55600. self._assert_equals_(i,(5));
  55601. return self;
  55602. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55603. },
  55604. args: [],
  55605. 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",
  55606. referencedClasses: [],
  55607. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55608. }),
  55609. $globals.NumberTest);
  55610. $core.addMethod(
  55611. $core.method({
  55612. selector: "testTo",
  55613. protocol: 'tests',
  55614. fn: function (){
  55615. var self=this;
  55616. return $core.withContext(function($ctx1) {
  55617. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55618. return self;
  55619. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55620. },
  55621. args: [],
  55622. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55623. referencedClasses: [],
  55624. messageSends: ["assert:equals:", "to:"]
  55625. }),
  55626. $globals.NumberTest);
  55627. $core.addMethod(
  55628. $core.method({
  55629. selector: "testToBy",
  55630. protocol: 'tests',
  55631. fn: function (){
  55632. var self=this;
  55633. return $core.withContext(function($ctx1) {
  55634. var $1;
  55635. $1=(0)._to_by_((6),(2));
  55636. $ctx1.sendIdx["to:by:"]=1;
  55637. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55638. self._should_raise_((function(){
  55639. return $core.withContext(function($ctx2) {
  55640. return (1)._to_by_((4),(0));
  55641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55642. }),$globals.Error);
  55643. return self;
  55644. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55645. },
  55646. args: [],
  55647. 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",
  55648. referencedClasses: ["Error"],
  55649. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55650. }),
  55651. $globals.NumberTest);
  55652. $core.addMethod(
  55653. $core.method({
  55654. selector: "testTrigonometry",
  55655. protocol: 'tests',
  55656. fn: function (){
  55657. var self=this;
  55658. return $core.withContext(function($ctx1) {
  55659. self._assert_equals_((0)._cos(),(1));
  55660. $ctx1.sendIdx["assert:equals:"]=1;
  55661. self._assert_equals_((0)._sin(),(0));
  55662. $ctx1.sendIdx["assert:equals:"]=2;
  55663. self._assert_equals_((0)._tan(),(0));
  55664. $ctx1.sendIdx["assert:equals:"]=3;
  55665. self._assert_equals_((1)._arcCos(),(0));
  55666. $ctx1.sendIdx["assert:equals:"]=4;
  55667. self._assert_equals_((0)._arcSin(),(0));
  55668. $ctx1.sendIdx["assert:equals:"]=5;
  55669. self._assert_equals_((0)._arcTan(),(0));
  55670. return self;
  55671. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55672. },
  55673. args: [],
  55674. 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.",
  55675. referencedClasses: [],
  55676. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55677. }),
  55678. $globals.NumberTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "testTruncated",
  55682. protocol: 'tests',
  55683. fn: function (){
  55684. var self=this;
  55685. return $core.withContext(function($ctx1) {
  55686. var $1,$2;
  55687. $1=(3)._truncated();
  55688. $ctx1.sendIdx["truncated"]=1;
  55689. self._assert_equals_($1,(3));
  55690. $ctx1.sendIdx["assert:equals:"]=1;
  55691. $2=(3.212)._truncated();
  55692. $ctx1.sendIdx["truncated"]=2;
  55693. self._assert_equals_($2,(3));
  55694. $ctx1.sendIdx["assert:equals:"]=2;
  55695. self._assert_equals_((3.51)._truncated(),(3));
  55696. return self;
  55697. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55698. },
  55699. args: [],
  55700. 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",
  55701. referencedClasses: [],
  55702. messageSends: ["assert:equals:", "truncated"]
  55703. }),
  55704. $globals.NumberTest);
  55705. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55706. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55707. $core.addMethod(
  55708. $core.method({
  55709. selector: "foo",
  55710. protocol: 'not yet classified',
  55711. fn: function (){
  55712. var self=this;
  55713. return self["@foo"];
  55714. },
  55715. args: [],
  55716. source: "foo\x0a\x09^ foo",
  55717. referencedClasses: [],
  55718. messageSends: []
  55719. }),
  55720. $globals.ObjectMock);
  55721. $core.addMethod(
  55722. $core.method({
  55723. selector: "foo:",
  55724. protocol: 'not yet classified',
  55725. fn: function (anObject){
  55726. var self=this;
  55727. self["@foo"]=anObject;
  55728. return self;
  55729. },
  55730. args: ["anObject"],
  55731. source: "foo: anObject\x0a\x09foo := anObject",
  55732. referencedClasses: [],
  55733. messageSends: []
  55734. }),
  55735. $globals.ObjectMock);
  55736. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55737. $core.addMethod(
  55738. $core.method({
  55739. selector: "notDefined",
  55740. protocol: 'tests',
  55741. fn: function (){
  55742. var self=this;
  55743. return $core.withContext(function($ctx1) {
  55744. return void 0;;
  55745. return self;
  55746. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55747. },
  55748. args: [],
  55749. source: "notDefined\x0a\x09<return void 0;>",
  55750. referencedClasses: [],
  55751. messageSends: []
  55752. }),
  55753. $globals.ObjectTest);
  55754. $core.addMethod(
  55755. $core.method({
  55756. selector: "testBasicAccess",
  55757. protocol: 'tests',
  55758. fn: function (){
  55759. var self=this;
  55760. var o;
  55761. return $core.withContext(function($ctx1) {
  55762. var $1;
  55763. o=$recv($globals.Object)._new();
  55764. $recv(o)._basicAt_put_("a",(1));
  55765. $1=$recv(o)._basicAt_("a");
  55766. $ctx1.sendIdx["basicAt:"]=1;
  55767. self._assert_equals_($1,(1));
  55768. $ctx1.sendIdx["assert:equals:"]=1;
  55769. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55770. return self;
  55771. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55772. },
  55773. args: [],
  55774. 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",
  55775. referencedClasses: ["Object"],
  55776. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55777. }),
  55778. $globals.ObjectTest);
  55779. $core.addMethod(
  55780. $core.method({
  55781. selector: "testBasicPerform",
  55782. protocol: 'tests',
  55783. fn: function (){
  55784. var self=this;
  55785. var o;
  55786. return $core.withContext(function($ctx1) {
  55787. o=$recv($globals.Object)._new();
  55788. $recv(o)._basicAt_put_("func",(function(){
  55789. return "hello";
  55790. }));
  55791. $ctx1.sendIdx["basicAt:put:"]=1;
  55792. $recv(o)._basicAt_put_("func2",(function(a){
  55793. return $core.withContext(function($ctx2) {
  55794. return $recv(a).__plus((1));
  55795. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55796. }));
  55797. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55798. $ctx1.sendIdx["assert:equals:"]=1;
  55799. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55800. return self;
  55801. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55802. },
  55803. args: [],
  55804. 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",
  55805. referencedClasses: ["Object"],
  55806. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55807. }),
  55808. $globals.ObjectTest);
  55809. $core.addMethod(
  55810. $core.method({
  55811. selector: "testDNU",
  55812. protocol: 'tests',
  55813. fn: function (){
  55814. var self=this;
  55815. return $core.withContext(function($ctx1) {
  55816. self._should_raise_((function(){
  55817. return $core.withContext(function($ctx2) {
  55818. return $recv($recv($globals.Object)._new())._foo();
  55819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55820. }),$globals.MessageNotUnderstood);
  55821. return self;
  55822. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55823. },
  55824. args: [],
  55825. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55826. referencedClasses: ["Object", "MessageNotUnderstood"],
  55827. messageSends: ["should:raise:", "foo", "new"]
  55828. }),
  55829. $globals.ObjectTest);
  55830. $core.addMethod(
  55831. $core.method({
  55832. selector: "testEquality",
  55833. protocol: 'tests',
  55834. fn: function (){
  55835. var self=this;
  55836. var o;
  55837. return $core.withContext(function($ctx1) {
  55838. var $1,$2,$4,$3;
  55839. o=$recv($globals.Object)._new();
  55840. $ctx1.sendIdx["new"]=1;
  55841. $1=$recv(o).__eq($recv($globals.Object)._new());
  55842. $ctx1.sendIdx["="]=1;
  55843. self._deny_($1);
  55844. $2=$recv(o).__eq(o);
  55845. $ctx1.sendIdx["="]=2;
  55846. self._assert_($2);
  55847. $ctx1.sendIdx["assert:"]=1;
  55848. $4=$recv(o)._yourself();
  55849. $ctx1.sendIdx["yourself"]=1;
  55850. $3=$recv($4).__eq(o);
  55851. $ctx1.sendIdx["="]=3;
  55852. self._assert_($3);
  55853. $ctx1.sendIdx["assert:"]=2;
  55854. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55855. return self;
  55856. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55857. },
  55858. args: [],
  55859. 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)",
  55860. referencedClasses: ["Object"],
  55861. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55862. }),
  55863. $globals.ObjectTest);
  55864. $core.addMethod(
  55865. $core.method({
  55866. selector: "testHalt",
  55867. protocol: 'tests',
  55868. fn: function (){
  55869. var self=this;
  55870. return $core.withContext(function($ctx1) {
  55871. self._should_raise_((function(){
  55872. return $core.withContext(function($ctx2) {
  55873. return $recv($recv($globals.Object)._new())._halt();
  55874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55875. }),$globals.Error);
  55876. return self;
  55877. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55878. },
  55879. args: [],
  55880. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55881. referencedClasses: ["Object", "Error"],
  55882. messageSends: ["should:raise:", "halt", "new"]
  55883. }),
  55884. $globals.ObjectTest);
  55885. $core.addMethod(
  55886. $core.method({
  55887. selector: "testIdentity",
  55888. protocol: 'tests',
  55889. fn: function (){
  55890. var self=this;
  55891. var o;
  55892. return $core.withContext(function($ctx1) {
  55893. var $1,$2,$4,$3;
  55894. o=$recv($globals.Object)._new();
  55895. $ctx1.sendIdx["new"]=1;
  55896. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55897. $ctx1.sendIdx["=="]=1;
  55898. self._deny_($1);
  55899. $2=$recv(o).__eq_eq(o);
  55900. $ctx1.sendIdx["=="]=2;
  55901. self._assert_($2);
  55902. $ctx1.sendIdx["assert:"]=1;
  55903. $4=$recv(o)._yourself();
  55904. $ctx1.sendIdx["yourself"]=1;
  55905. $3=$recv($4).__eq_eq(o);
  55906. $ctx1.sendIdx["=="]=3;
  55907. self._assert_($3);
  55908. $ctx1.sendIdx["assert:"]=2;
  55909. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55910. return self;
  55911. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55912. },
  55913. args: [],
  55914. 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",
  55915. referencedClasses: ["Object"],
  55916. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55917. }),
  55918. $globals.ObjectTest);
  55919. $core.addMethod(
  55920. $core.method({
  55921. selector: "testIfNil",
  55922. protocol: 'tests',
  55923. fn: function (){
  55924. var self=this;
  55925. return $core.withContext(function($ctx1) {
  55926. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55927. $2=$recv($globals.Object)._new();
  55928. $ctx1.sendIdx["new"]=1;
  55929. $1=$recv($2)._isNil();
  55930. self._deny_($1);
  55931. $ctx1.sendIdx["deny:"]=1;
  55932. $5=$recv($globals.Object)._new();
  55933. $ctx1.sendIdx["new"]=2;
  55934. if(($receiver = $5) == null || $receiver.isNil){
  55935. $4=true;
  55936. } else {
  55937. $4=$5;
  55938. };
  55939. $3=$recv($4).__eq(true);
  55940. self._deny_($3);
  55941. $7=$recv($globals.Object)._new();
  55942. $ctx1.sendIdx["new"]=3;
  55943. if(($receiver = $7) == null || $receiver.isNil){
  55944. $6=$7;
  55945. } else {
  55946. $6=true;
  55947. };
  55948. self._assert_equals_($6,true);
  55949. $ctx1.sendIdx["assert:equals:"]=1;
  55950. $9=$recv($globals.Object)._new();
  55951. $ctx1.sendIdx["new"]=4;
  55952. if(($receiver = $9) == null || $receiver.isNil){
  55953. $8=false;
  55954. } else {
  55955. $8=true;
  55956. };
  55957. self._assert_equals_($8,true);
  55958. $ctx1.sendIdx["assert:equals:"]=2;
  55959. $11=$recv($globals.Object)._new();
  55960. if(($receiver = $11) == null || $receiver.isNil){
  55961. $10=false;
  55962. } else {
  55963. $10=true;
  55964. };
  55965. self._assert_equals_($10,true);
  55966. return self;
  55967. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55968. },
  55969. args: [],
  55970. 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",
  55971. referencedClasses: ["Object"],
  55972. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55973. }),
  55974. $globals.ObjectTest);
  55975. $core.addMethod(
  55976. $core.method({
  55977. selector: "testInstVars",
  55978. protocol: 'tests',
  55979. fn: function (){
  55980. var self=this;
  55981. var o;
  55982. return $core.withContext(function($ctx1) {
  55983. var $1,$2;
  55984. o=$recv($globals.ObjectMock)._new();
  55985. $1=$recv(o)._instVarAt_("foo");
  55986. $ctx1.sendIdx["instVarAt:"]=1;
  55987. self._assert_equals_($1,nil);
  55988. $ctx1.sendIdx["assert:equals:"]=1;
  55989. $recv(o)._instVarAt_put_("foo",(1));
  55990. $2=$recv(o)._instVarAt_("foo");
  55991. $ctx1.sendIdx["instVarAt:"]=2;
  55992. self._assert_equals_($2,(1));
  55993. $ctx1.sendIdx["assert:equals:"]=2;
  55994. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55995. return self;
  55996. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55997. },
  55998. args: [],
  55999. 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",
  56000. referencedClasses: ["ObjectMock"],
  56001. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  56002. }),
  56003. $globals.ObjectTest);
  56004. $core.addMethod(
  56005. $core.method({
  56006. selector: "testNilUndefined",
  56007. protocol: 'tests',
  56008. fn: function (){
  56009. var self=this;
  56010. return $core.withContext(function($ctx1) {
  56011. self._assert_equals_(self._notDefined(),nil);
  56012. return self;
  56013. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  56014. },
  56015. args: [],
  56016. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  56017. referencedClasses: [],
  56018. messageSends: ["assert:equals:", "notDefined"]
  56019. }),
  56020. $globals.ObjectTest);
  56021. $core.addMethod(
  56022. $core.method({
  56023. selector: "testYourself",
  56024. protocol: 'tests',
  56025. fn: function (){
  56026. var self=this;
  56027. var o;
  56028. return $core.withContext(function($ctx1) {
  56029. o=$recv($globals.ObjectMock)._new();
  56030. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  56031. return self;
  56032. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  56033. },
  56034. args: [],
  56035. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  56036. referencedClasses: ["ObjectMock"],
  56037. messageSends: ["new", "assert:", "==", "yourself"]
  56038. }),
  56039. $globals.ObjectTest);
  56040. $core.addMethod(
  56041. $core.method({
  56042. selector: "testidentityHash",
  56043. protocol: 'tests',
  56044. fn: function (){
  56045. var self=this;
  56046. var o1,o2;
  56047. return $core.withContext(function($ctx1) {
  56048. var $2,$3,$1,$5,$4;
  56049. o1=$recv($globals.Object)._new();
  56050. $ctx1.sendIdx["new"]=1;
  56051. o2=$recv($globals.Object)._new();
  56052. $2=$recv(o1)._identityHash();
  56053. $ctx1.sendIdx["identityHash"]=1;
  56054. $3=$recv(o1)._identityHash();
  56055. $ctx1.sendIdx["identityHash"]=2;
  56056. $1=$recv($2).__eq_eq($3);
  56057. $ctx1.sendIdx["=="]=1;
  56058. self._assert_($1);
  56059. $5=$recv(o1)._identityHash();
  56060. $ctx1.sendIdx["identityHash"]=3;
  56061. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  56062. self._deny_($4);
  56063. return self;
  56064. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  56065. },
  56066. args: [],
  56067. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  56068. referencedClasses: ["Object"],
  56069. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  56070. }),
  56071. $globals.ObjectTest);
  56072. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  56073. $core.addMethod(
  56074. $core.method({
  56075. selector: "testAccessing",
  56076. protocol: 'tests',
  56077. fn: function (){
  56078. var self=this;
  56079. return $core.withContext(function($ctx1) {
  56080. var $2,$1,$3,$6,$5,$4;
  56081. $2=$recv($globals.Point)._x_y_((3),(4));
  56082. $ctx1.sendIdx["x:y:"]=1;
  56083. $1=$recv($2)._x();
  56084. $ctx1.sendIdx["x"]=1;
  56085. self._assert_equals_($1,(3));
  56086. $ctx1.sendIdx["assert:equals:"]=1;
  56087. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  56088. $ctx1.sendIdx["y"]=1;
  56089. self._assert_equals_($3,(4));
  56090. $ctx1.sendIdx["assert:equals:"]=2;
  56091. $6=$recv($globals.Point)._new();
  56092. $ctx1.sendIdx["new"]=1;
  56093. $5=$recv($6)._x_((3));
  56094. $4=$recv($5)._x();
  56095. self._assert_equals_($4,(3));
  56096. $ctx1.sendIdx["assert:equals:"]=3;
  56097. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  56098. return self;
  56099. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  56100. },
  56101. args: [],
  56102. 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",
  56103. referencedClasses: ["Point"],
  56104. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  56105. }),
  56106. $globals.PointTest);
  56107. $core.addMethod(
  56108. $core.method({
  56109. selector: "testArithmetic",
  56110. protocol: 'tests',
  56111. fn: function (){
  56112. var self=this;
  56113. return $core.withContext(function($ctx1) {
  56114. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56115. $2=(3).__at((4));
  56116. $ctx1.sendIdx["@"]=1;
  56117. $3=(3).__at((4));
  56118. $ctx1.sendIdx["@"]=2;
  56119. $1=$recv($2).__star($3);
  56120. $4=$recv($globals.Point)._x_y_((9),(16));
  56121. $ctx1.sendIdx["x:y:"]=1;
  56122. self._assert_equals_($1,$4);
  56123. $ctx1.sendIdx["assert:equals:"]=1;
  56124. $6=(3).__at((4));
  56125. $ctx1.sendIdx["@"]=3;
  56126. $7=(3).__at((4));
  56127. $ctx1.sendIdx["@"]=4;
  56128. $5=$recv($6).__plus($7);
  56129. $8=$recv($globals.Point)._x_y_((6),(8));
  56130. $ctx1.sendIdx["x:y:"]=2;
  56131. self._assert_equals_($5,$8);
  56132. $ctx1.sendIdx["assert:equals:"]=2;
  56133. $10=(3).__at((4));
  56134. $ctx1.sendIdx["@"]=5;
  56135. $11=(3).__at((4));
  56136. $ctx1.sendIdx["@"]=6;
  56137. $9=$recv($10).__minus($11);
  56138. $12=$recv($globals.Point)._x_y_((0),(0));
  56139. $ctx1.sendIdx["x:y:"]=3;
  56140. self._assert_equals_($9,$12);
  56141. $ctx1.sendIdx["assert:equals:"]=3;
  56142. $14=(6).__at((8));
  56143. $ctx1.sendIdx["@"]=7;
  56144. $13=$recv($14).__slash((3).__at((4)));
  56145. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  56146. return self;
  56147. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56148. },
  56149. args: [],
  56150. 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)",
  56151. referencedClasses: ["Point"],
  56152. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56153. }),
  56154. $globals.PointTest);
  56155. $core.addMethod(
  56156. $core.method({
  56157. selector: "testAt",
  56158. protocol: 'tests',
  56159. fn: function (){
  56160. var self=this;
  56161. return $core.withContext(function($ctx1) {
  56162. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  56163. return self;
  56164. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56165. },
  56166. args: [],
  56167. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56168. referencedClasses: ["Point"],
  56169. messageSends: ["assert:equals:", "@", "x:y:"]
  56170. }),
  56171. $globals.PointTest);
  56172. $core.addMethod(
  56173. $core.method({
  56174. selector: "testComparison",
  56175. protocol: 'tests',
  56176. fn: function (){
  56177. var self=this;
  56178. return $core.withContext(function($ctx1) {
  56179. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56180. $2=(3).__at((4));
  56181. $ctx1.sendIdx["@"]=1;
  56182. $3=(4).__at((5));
  56183. $ctx1.sendIdx["@"]=2;
  56184. $1=$recv($2).__lt($3);
  56185. $ctx1.sendIdx["<"]=1;
  56186. self._assert_($1);
  56187. $ctx1.sendIdx["assert:"]=1;
  56188. $5=(3).__at((4));
  56189. $ctx1.sendIdx["@"]=3;
  56190. $6=(4).__at((4));
  56191. $ctx1.sendIdx["@"]=4;
  56192. $4=$recv($5).__lt($6);
  56193. self._deny_($4);
  56194. $ctx1.sendIdx["deny:"]=1;
  56195. $8=(4).__at((5));
  56196. $ctx1.sendIdx["@"]=5;
  56197. $9=(4).__at((5));
  56198. $ctx1.sendIdx["@"]=6;
  56199. $7=$recv($8).__lt_eq($9);
  56200. $ctx1.sendIdx["<="]=1;
  56201. self._assert_($7);
  56202. $ctx1.sendIdx["assert:"]=2;
  56203. $11=(4).__at((5));
  56204. $ctx1.sendIdx["@"]=7;
  56205. $12=(3).__at((5));
  56206. $ctx1.sendIdx["@"]=8;
  56207. $10=$recv($11).__lt_eq($12);
  56208. self._deny_($10);
  56209. $ctx1.sendIdx["deny:"]=2;
  56210. $14=(5).__at((6));
  56211. $ctx1.sendIdx["@"]=9;
  56212. $15=(4).__at((5));
  56213. $ctx1.sendIdx["@"]=10;
  56214. $13=$recv($14).__gt($15);
  56215. $ctx1.sendIdx[">"]=1;
  56216. self._assert_($13);
  56217. $ctx1.sendIdx["assert:"]=3;
  56218. $17=(5).__at((6));
  56219. $ctx1.sendIdx["@"]=11;
  56220. $18=(6).__at((6));
  56221. $ctx1.sendIdx["@"]=12;
  56222. $16=$recv($17).__gt($18);
  56223. self._deny_($16);
  56224. $ctx1.sendIdx["deny:"]=3;
  56225. $20=(4).__at((5));
  56226. $ctx1.sendIdx["@"]=13;
  56227. $21=(4).__at((5));
  56228. $ctx1.sendIdx["@"]=14;
  56229. $19=$recv($20).__gt_eq($21);
  56230. $ctx1.sendIdx[">="]=1;
  56231. self._assert_($19);
  56232. $23=(4).__at((5));
  56233. $ctx1.sendIdx["@"]=15;
  56234. $22=$recv($23).__gt_eq((5).__at((5)));
  56235. self._deny_($22);
  56236. return self;
  56237. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56238. },
  56239. args: [],
  56240. 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)",
  56241. referencedClasses: [],
  56242. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56243. }),
  56244. $globals.PointTest);
  56245. $core.addMethod(
  56246. $core.method({
  56247. selector: "testEgality",
  56248. protocol: 'tests',
  56249. fn: function (){
  56250. var self=this;
  56251. return $core.withContext(function($ctx1) {
  56252. var $2,$3,$1,$5,$4;
  56253. $2=(3).__at((4));
  56254. $ctx1.sendIdx["@"]=1;
  56255. $3=(3).__at((4));
  56256. $ctx1.sendIdx["@"]=2;
  56257. $1=$recv($2).__eq($3);
  56258. $ctx1.sendIdx["="]=1;
  56259. self._assert_($1);
  56260. $5=(3).__at((5));
  56261. $ctx1.sendIdx["@"]=3;
  56262. $4=$recv($5).__eq((3).__at((6)));
  56263. self._deny_($4);
  56264. return self;
  56265. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56266. },
  56267. args: [],
  56268. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56269. referencedClasses: [],
  56270. messageSends: ["assert:", "=", "@", "deny:"]
  56271. }),
  56272. $globals.PointTest);
  56273. $core.addMethod(
  56274. $core.method({
  56275. selector: "testNew",
  56276. protocol: 'tests',
  56277. fn: function (){
  56278. var self=this;
  56279. return $core.withContext(function($ctx1) {
  56280. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56281. $3=$recv($globals.Point)._new();
  56282. $ctx1.sendIdx["new"]=1;
  56283. $2=$recv($3)._x_((3));
  56284. $ctx1.sendIdx["x:"]=1;
  56285. $1=$recv($2)._y();
  56286. $ctx1.sendIdx["y"]=1;
  56287. self._assert_equals_($1,nil);
  56288. $ctx1.sendIdx["assert:equals:"]=1;
  56289. $7=$recv($globals.Point)._new();
  56290. $ctx1.sendIdx["new"]=2;
  56291. $6=$recv($7)._x_((3));
  56292. $5=$recv($6)._x();
  56293. $ctx1.sendIdx["x"]=1;
  56294. $4=$recv($5).__eq((0));
  56295. $ctx1.sendIdx["="]=1;
  56296. self._deny_($4);
  56297. $ctx1.sendIdx["deny:"]=1;
  56298. $10=$recv($globals.Point)._new();
  56299. $ctx1.sendIdx["new"]=3;
  56300. $9=$recv($10)._y_((4));
  56301. $ctx1.sendIdx["y:"]=1;
  56302. $8=$recv($9)._x();
  56303. self._assert_equals_($8,nil);
  56304. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  56305. return self;
  56306. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  56307. },
  56308. args: [],
  56309. 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",
  56310. referencedClasses: ["Point"],
  56311. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  56312. }),
  56313. $globals.PointTest);
  56314. $core.addMethod(
  56315. $core.method({
  56316. selector: "testTranslateBy",
  56317. protocol: 'tests',
  56318. fn: function (){
  56319. var self=this;
  56320. return $core.withContext(function($ctx1) {
  56321. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  56322. $2=(3).__at((3));
  56323. $ctx1.sendIdx["@"]=1;
  56324. $3=(0).__at((1));
  56325. $ctx1.sendIdx["@"]=2;
  56326. $1=$recv($2)._translateBy_($3);
  56327. $ctx1.sendIdx["translateBy:"]=1;
  56328. $4=(3).__at((4));
  56329. $ctx1.sendIdx["@"]=3;
  56330. self._assert_equals_($1,$4);
  56331. $ctx1.sendIdx["assert:equals:"]=1;
  56332. $6=(3).__at((3));
  56333. $ctx1.sendIdx["@"]=4;
  56334. $8=(1)._negated();
  56335. $ctx1.sendIdx["negated"]=1;
  56336. $7=(0).__at($8);
  56337. $ctx1.sendIdx["@"]=5;
  56338. $5=$recv($6)._translateBy_($7);
  56339. $ctx1.sendIdx["translateBy:"]=2;
  56340. $9=(3).__at((2));
  56341. $ctx1.sendIdx["@"]=6;
  56342. self._assert_equals_($5,$9);
  56343. $ctx1.sendIdx["assert:equals:"]=2;
  56344. $11=(3).__at((3));
  56345. $ctx1.sendIdx["@"]=7;
  56346. $12=(2).__at((3));
  56347. $ctx1.sendIdx["@"]=8;
  56348. $10=$recv($11)._translateBy_($12);
  56349. $ctx1.sendIdx["translateBy:"]=3;
  56350. $13=(5).__at((6));
  56351. $ctx1.sendIdx["@"]=9;
  56352. self._assert_equals_($10,$13);
  56353. $ctx1.sendIdx["assert:equals:"]=3;
  56354. $15=(3).__at((3));
  56355. $ctx1.sendIdx["@"]=10;
  56356. $16=$recv((3)._negated()).__at((0));
  56357. $ctx1.sendIdx["@"]=11;
  56358. $14=$recv($15)._translateBy_($16);
  56359. self._assert_equals_($14,(0).__at((3)));
  56360. return self;
  56361. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56362. },
  56363. args: [],
  56364. 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.",
  56365. referencedClasses: [],
  56366. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56367. }),
  56368. $globals.PointTest);
  56369. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56370. $core.addMethod(
  56371. $core.method({
  56372. selector: "testNextIfAbsent",
  56373. protocol: 'tests',
  56374. fn: function (){
  56375. var self=this;
  56376. var queue;
  56377. return $core.withContext(function($ctx1) {
  56378. var $2,$1;
  56379. queue=$recv($globals.Queue)._new();
  56380. $recv(queue)._nextPut_("index1");
  56381. $2=$recv(queue)._nextIfAbsent_("empty");
  56382. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56383. $1=$recv($2).__eq("index1");
  56384. $ctx1.sendIdx["="]=1;
  56385. self._assert_($1);
  56386. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56387. return self;
  56388. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56389. },
  56390. args: [],
  56391. 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'",
  56392. referencedClasses: ["Queue"],
  56393. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56394. }),
  56395. $globals.QueueTest);
  56396. $core.addMethod(
  56397. $core.method({
  56398. selector: "testQueueNext",
  56399. protocol: 'tests',
  56400. fn: function (){
  56401. var self=this;
  56402. var queue;
  56403. return $core.withContext(function($ctx1) {
  56404. var $1,$3,$2,$5,$4;
  56405. queue=$recv($globals.Queue)._new();
  56406. $1=queue;
  56407. $recv($1)._nextPut_("index1");
  56408. $ctx1.sendIdx["nextPut:"]=1;
  56409. $recv($1)._nextPut_("index2");
  56410. $3=$recv(queue)._next();
  56411. $ctx1.sendIdx["next"]=1;
  56412. $2=$recv($3).__eq("index1");
  56413. $ctx1.sendIdx["="]=1;
  56414. self._assert_($2);
  56415. $5=$recv(queue)._next();
  56416. $ctx1.sendIdx["next"]=2;
  56417. $4=$recv($5).__eq("index");
  56418. self._deny_($4);
  56419. self._should_raise_((function(){
  56420. return $core.withContext(function($ctx2) {
  56421. return $recv(queue)._next();
  56422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56423. }),$globals.Error);
  56424. return self;
  56425. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56426. },
  56427. args: [],
  56428. 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",
  56429. referencedClasses: ["Queue", "Error"],
  56430. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56431. }),
  56432. $globals.QueueTest);
  56433. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56434. $core.addMethod(
  56435. $core.method({
  56436. selector: "testAtRandomNumber",
  56437. protocol: 'tests',
  56438. fn: function (){
  56439. var self=this;
  56440. var val;
  56441. return $core.withContext(function($ctx1) {
  56442. (100)._timesRepeat_((function(){
  56443. return $core.withContext(function($ctx2) {
  56444. val=(10)._atRandom();
  56445. val;
  56446. self._assert_($recv(val).__gt((0)));
  56447. $ctx2.sendIdx["assert:"]=1;
  56448. return self._assert_($recv(val).__lt((11)));
  56449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56450. }));
  56451. return self;
  56452. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56453. },
  56454. args: [],
  56455. 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]",
  56456. referencedClasses: [],
  56457. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56458. }),
  56459. $globals.RandomTest);
  56460. $core.addMethod(
  56461. $core.method({
  56462. selector: "testAtRandomSequenceableCollection",
  56463. protocol: 'tests',
  56464. fn: function (){
  56465. var self=this;
  56466. var val;
  56467. return $core.withContext(function($ctx1) {
  56468. var $3,$4,$2,$1;
  56469. (100)._timesRepeat_((function(){
  56470. return $core.withContext(function($ctx2) {
  56471. val="abc"._atRandom();
  56472. val;
  56473. $3=$recv(val).__eq("a");
  56474. $ctx2.sendIdx["="]=1;
  56475. $4=$recv(val).__eq("b");
  56476. $ctx2.sendIdx["="]=2;
  56477. $2=$recv($3).__or($4);
  56478. $1=$recv($2).__or($recv(val).__eq("c"));
  56479. $ctx2.sendIdx["|"]=1;
  56480. return self._assert_($1);
  56481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56482. }));
  56483. return self;
  56484. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56485. },
  56486. args: [],
  56487. 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].",
  56488. referencedClasses: [],
  56489. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56490. }),
  56491. $globals.RandomTest);
  56492. $core.addMethod(
  56493. $core.method({
  56494. selector: "textNext",
  56495. protocol: 'tests',
  56496. fn: function (){
  56497. var self=this;
  56498. return $core.withContext(function($ctx1) {
  56499. var $1;
  56500. (10000)._timesRepeat_((function(){
  56501. var current,next;
  56502. return $core.withContext(function($ctx2) {
  56503. next=$recv($recv($globals.Random)._new())._next();
  56504. next;
  56505. self._assert_($recv(next).__gt_eq((0)));
  56506. $ctx2.sendIdx["assert:"]=1;
  56507. self._assert_($recv(next).__lt((1)));
  56508. $1=$recv(current).__eq(next);
  56509. $ctx2.sendIdx["="]=1;
  56510. self._deny_($1);
  56511. return $recv(next).__eq(current);
  56512. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56513. }));
  56514. return self;
  56515. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56516. },
  56517. args: [],
  56518. 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 ]",
  56519. referencedClasses: ["Random"],
  56520. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56521. }),
  56522. $globals.RandomTest);
  56523. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56524. $core.addMethod(
  56525. $core.method({
  56526. selector: "collectionClass",
  56527. protocol: 'accessing',
  56528. fn: function (){
  56529. var self=this;
  56530. return $core.withContext(function($ctx1) {
  56531. return $recv(self._class())._collectionClass();
  56532. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56533. },
  56534. args: [],
  56535. source: "collectionClass\x0a\x09^ self class collectionClass",
  56536. referencedClasses: [],
  56537. messageSends: ["collectionClass", "class"]
  56538. }),
  56539. $globals.StreamTest);
  56540. $core.addMethod(
  56541. $core.method({
  56542. selector: "newCollection",
  56543. protocol: 'accessing',
  56544. fn: function (){
  56545. var self=this;
  56546. return $core.withContext(function($ctx1) {
  56547. return $recv(self._collectionClass())._new();
  56548. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56549. },
  56550. args: [],
  56551. source: "newCollection\x0a\x09^ self collectionClass new",
  56552. referencedClasses: [],
  56553. messageSends: ["new", "collectionClass"]
  56554. }),
  56555. $globals.StreamTest);
  56556. $core.addMethod(
  56557. $core.method({
  56558. selector: "newStream",
  56559. protocol: 'accessing',
  56560. fn: function (){
  56561. var self=this;
  56562. return $core.withContext(function($ctx1) {
  56563. return $recv($recv(self._collectionClass())._new())._stream();
  56564. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56565. },
  56566. args: [],
  56567. source: "newStream\x0a\x09^ self collectionClass new stream",
  56568. referencedClasses: [],
  56569. messageSends: ["stream", "new", "collectionClass"]
  56570. }),
  56571. $globals.StreamTest);
  56572. $core.addMethod(
  56573. $core.method({
  56574. selector: "testAtStartAtEnd",
  56575. protocol: 'tests',
  56576. fn: function (){
  56577. var self=this;
  56578. var stream;
  56579. return $core.withContext(function($ctx1) {
  56580. var $1,$2,$3,$4;
  56581. stream=self._newStream();
  56582. $1=$recv(stream)._atStart();
  56583. $ctx1.sendIdx["atStart"]=1;
  56584. self._assert_($1);
  56585. $ctx1.sendIdx["assert:"]=1;
  56586. $2=$recv(stream)._atEnd();
  56587. $ctx1.sendIdx["atEnd"]=1;
  56588. self._assert_($2);
  56589. $ctx1.sendIdx["assert:"]=2;
  56590. $recv(stream)._nextPutAll_(self._newCollection());
  56591. $3=$recv(stream)._atEnd();
  56592. $ctx1.sendIdx["atEnd"]=2;
  56593. self._assert_($3);
  56594. $4=$recv(stream)._atStart();
  56595. $ctx1.sendIdx["atStart"]=2;
  56596. self._deny_($4);
  56597. $ctx1.sendIdx["deny:"]=1;
  56598. $recv(stream)._position_((1));
  56599. self._deny_($recv(stream)._atEnd());
  56600. $ctx1.sendIdx["deny:"]=2;
  56601. self._deny_($recv(stream)._atStart());
  56602. return self;
  56603. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56604. },
  56605. args: [],
  56606. 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",
  56607. referencedClasses: [],
  56608. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56609. }),
  56610. $globals.StreamTest);
  56611. $core.addMethod(
  56612. $core.method({
  56613. selector: "testContents",
  56614. protocol: 'tests',
  56615. fn: function (){
  56616. var self=this;
  56617. var stream;
  56618. return $core.withContext(function($ctx1) {
  56619. var $1,$2;
  56620. stream=self._newStream();
  56621. $1=stream;
  56622. $2=self._newCollection();
  56623. $ctx1.sendIdx["newCollection"]=1;
  56624. $recv($1)._nextPutAll_($2);
  56625. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56626. return self;
  56627. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56628. },
  56629. args: [],
  56630. 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",
  56631. referencedClasses: [],
  56632. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56633. }),
  56634. $globals.StreamTest);
  56635. $core.addMethod(
  56636. $core.method({
  56637. selector: "testIsEmpty",
  56638. protocol: 'tests',
  56639. fn: function (){
  56640. var self=this;
  56641. var stream;
  56642. return $core.withContext(function($ctx1) {
  56643. var $1;
  56644. stream=self._newStream();
  56645. $1=$recv(stream)._isEmpty();
  56646. $ctx1.sendIdx["isEmpty"]=1;
  56647. self._assert_($1);
  56648. $recv(stream)._nextPutAll_(self._newCollection());
  56649. self._deny_($recv(stream)._isEmpty());
  56650. return self;
  56651. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56652. },
  56653. args: [],
  56654. 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",
  56655. referencedClasses: [],
  56656. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56657. }),
  56658. $globals.StreamTest);
  56659. $core.addMethod(
  56660. $core.method({
  56661. selector: "testPosition",
  56662. protocol: 'tests',
  56663. fn: function (){
  56664. var self=this;
  56665. var collection,stream;
  56666. return $core.withContext(function($ctx1) {
  56667. var $1,$2,$3;
  56668. collection=self._newCollection();
  56669. stream=self._newStream();
  56670. $recv(stream)._nextPutAll_(collection);
  56671. $1=$recv(stream)._position();
  56672. $ctx1.sendIdx["position"]=1;
  56673. self._assert_equals_($1,$recv(collection)._size());
  56674. $ctx1.sendIdx["assert:equals:"]=1;
  56675. $recv(stream)._position_((0));
  56676. $2=$recv(stream)._position();
  56677. $ctx1.sendIdx["position"]=2;
  56678. self._assert_equals_($2,(0));
  56679. $ctx1.sendIdx["assert:equals:"]=2;
  56680. $recv(stream)._next();
  56681. $ctx1.sendIdx["next"]=1;
  56682. $3=$recv(stream)._position();
  56683. $ctx1.sendIdx["position"]=3;
  56684. self._assert_equals_($3,(1));
  56685. $ctx1.sendIdx["assert:equals:"]=3;
  56686. $recv(stream)._next();
  56687. self._assert_equals_($recv(stream)._position(),(2));
  56688. return self;
  56689. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56690. },
  56691. args: [],
  56692. 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",
  56693. referencedClasses: [],
  56694. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56695. }),
  56696. $globals.StreamTest);
  56697. $core.addMethod(
  56698. $core.method({
  56699. selector: "testReading",
  56700. protocol: 'tests',
  56701. fn: function (){
  56702. var self=this;
  56703. var stream,collection;
  56704. return $core.withContext(function($ctx1) {
  56705. var $1,$2;
  56706. collection=self._newCollection();
  56707. stream=self._newStream();
  56708. $1=stream;
  56709. $recv($1)._nextPutAll_(collection);
  56710. $recv($1)._position_((0));
  56711. $recv(collection)._do_((function(each){
  56712. return $core.withContext(function($ctx2) {
  56713. $2=$recv(stream)._next();
  56714. $ctx2.sendIdx["next"]=1;
  56715. return self._assert_equals_($2,each);
  56716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56717. }));
  56718. self._assert_($recv($recv(stream)._next())._isNil());
  56719. return self;
  56720. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56721. },
  56722. args: [],
  56723. 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",
  56724. referencedClasses: [],
  56725. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56726. }),
  56727. $globals.StreamTest);
  56728. $core.addMethod(
  56729. $core.method({
  56730. selector: "testStreamContents",
  56731. protocol: 'tests',
  56732. fn: function (){
  56733. var self=this;
  56734. return self;
  56735. },
  56736. args: [],
  56737. source: "testStreamContents",
  56738. referencedClasses: [],
  56739. messageSends: []
  56740. }),
  56741. $globals.StreamTest);
  56742. $core.addMethod(
  56743. $core.method({
  56744. selector: "testWrite",
  56745. protocol: 'tests',
  56746. fn: function (){
  56747. var self=this;
  56748. var stream,collection;
  56749. return $core.withContext(function($ctx1) {
  56750. collection=self._newCollection();
  56751. stream=self._newStream();
  56752. $recv(collection)._do_((function(each){
  56753. return $core.withContext(function($ctx2) {
  56754. return $recv(stream).__lt_lt(each);
  56755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56756. }));
  56757. self._assert_equals_($recv(stream)._contents(),collection);
  56758. return self;
  56759. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56760. },
  56761. args: [],
  56762. 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",
  56763. referencedClasses: [],
  56764. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56765. }),
  56766. $globals.StreamTest);
  56767. $core.addMethod(
  56768. $core.method({
  56769. selector: "testWriting",
  56770. protocol: 'tests',
  56771. fn: function (){
  56772. var self=this;
  56773. var stream,collection;
  56774. return $core.withContext(function($ctx1) {
  56775. var $1;
  56776. collection=self._newCollection();
  56777. stream=self._newStream();
  56778. $ctx1.sendIdx["newStream"]=1;
  56779. $recv(collection)._do_((function(each){
  56780. return $core.withContext(function($ctx2) {
  56781. return $recv(stream)._nextPut_(each);
  56782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56783. }));
  56784. $1=$recv(stream)._contents();
  56785. $ctx1.sendIdx["contents"]=1;
  56786. self._assert_equals_($1,collection);
  56787. $ctx1.sendIdx["assert:equals:"]=1;
  56788. stream=self._newStream();
  56789. $recv(stream)._nextPutAll_(collection);
  56790. self._assert_equals_($recv(stream)._contents(),collection);
  56791. return self;
  56792. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56793. },
  56794. args: [],
  56795. 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",
  56796. referencedClasses: [],
  56797. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56798. }),
  56799. $globals.StreamTest);
  56800. $core.addMethod(
  56801. $core.method({
  56802. selector: "collectionClass",
  56803. protocol: 'accessing',
  56804. fn: function (){
  56805. var self=this;
  56806. return nil;
  56807. },
  56808. args: [],
  56809. source: "collectionClass\x0a\x09^ nil",
  56810. referencedClasses: [],
  56811. messageSends: []
  56812. }),
  56813. $globals.StreamTest.klass);
  56814. $core.addMethod(
  56815. $core.method({
  56816. selector: "isAbstract",
  56817. protocol: 'testing',
  56818. fn: function (){
  56819. var self=this;
  56820. return $core.withContext(function($ctx1) {
  56821. return $recv(self._collectionClass())._isNil();
  56822. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56823. },
  56824. args: [],
  56825. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56826. referencedClasses: [],
  56827. messageSends: ["isNil", "collectionClass"]
  56828. }),
  56829. $globals.StreamTest.klass);
  56830. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56831. $core.addMethod(
  56832. $core.method({
  56833. selector: "newCollection",
  56834. protocol: 'accessing',
  56835. fn: function (){
  56836. var self=this;
  56837. return $core.withContext(function($ctx1) {
  56838. return [true,(1),(3).__at((4)),"foo"];
  56839. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56840. },
  56841. args: [],
  56842. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56843. referencedClasses: [],
  56844. messageSends: ["@"]
  56845. }),
  56846. $globals.ArrayStreamTest);
  56847. $core.addMethod(
  56848. $core.method({
  56849. selector: "collectionClass",
  56850. protocol: 'accessing',
  56851. fn: function (){
  56852. var self=this;
  56853. return $globals.Array;
  56854. },
  56855. args: [],
  56856. source: "collectionClass\x0a\x09^ Array",
  56857. referencedClasses: ["Array"],
  56858. messageSends: []
  56859. }),
  56860. $globals.ArrayStreamTest.klass);
  56861. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56862. $core.addMethod(
  56863. $core.method({
  56864. selector: "newCollection",
  56865. protocol: 'accessing',
  56866. fn: function (){
  56867. var self=this;
  56868. return "hello world";
  56869. },
  56870. args: [],
  56871. source: "newCollection\x0a\x09^ 'hello world'",
  56872. referencedClasses: [],
  56873. messageSends: []
  56874. }),
  56875. $globals.StringStreamTest);
  56876. $core.addMethod(
  56877. $core.method({
  56878. selector: "collectionClass",
  56879. protocol: 'accessing',
  56880. fn: function (){
  56881. var self=this;
  56882. return $globals.String;
  56883. },
  56884. args: [],
  56885. source: "collectionClass\x0a\x09^ String",
  56886. referencedClasses: ["String"],
  56887. messageSends: []
  56888. }),
  56889. $globals.StringStreamTest.klass);
  56890. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56891. $core.addMethod(
  56892. $core.method({
  56893. selector: "testCopying",
  56894. protocol: 'tests',
  56895. fn: function (){
  56896. var self=this;
  56897. return $core.withContext(function($ctx1) {
  56898. self._assert_equals_(nil._copy(),nil);
  56899. return self;
  56900. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56901. },
  56902. args: [],
  56903. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56904. referencedClasses: [],
  56905. messageSends: ["assert:equals:", "copy"]
  56906. }),
  56907. $globals.UndefinedTest);
  56908. $core.addMethod(
  56909. $core.method({
  56910. selector: "testDeepCopy",
  56911. protocol: 'tests',
  56912. fn: function (){
  56913. var self=this;
  56914. return $core.withContext(function($ctx1) {
  56915. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56916. return self;
  56917. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56918. },
  56919. args: [],
  56920. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56921. referencedClasses: [],
  56922. messageSends: ["assert:", "=", "deepCopy"]
  56923. }),
  56924. $globals.UndefinedTest);
  56925. $core.addMethod(
  56926. $core.method({
  56927. selector: "testIfNil",
  56928. protocol: 'tests',
  56929. fn: function (){
  56930. var self=this;
  56931. return $core.withContext(function($ctx1) {
  56932. var $1,$3,$2,$4,$6,$5,$receiver;
  56933. if(($receiver = nil) == null || $receiver.isNil){
  56934. $1=true;
  56935. } else {
  56936. $1=nil;
  56937. };
  56938. self._assert_equals_($1,true);
  56939. $ctx1.sendIdx["assert:equals:"]=1;
  56940. if(($receiver = nil) == null || $receiver.isNil){
  56941. $3=nil;
  56942. } else {
  56943. $3=true;
  56944. };
  56945. $2=$recv($3).__eq(true);
  56946. $ctx1.sendIdx["="]=1;
  56947. self._deny_($2);
  56948. $ctx1.sendIdx["deny:"]=1;
  56949. if(($receiver = nil) == null || $receiver.isNil){
  56950. $4=true;
  56951. } else {
  56952. $4=false;
  56953. };
  56954. self._assert_equals_($4,true);
  56955. if(($receiver = nil) == null || $receiver.isNil){
  56956. $6=false;
  56957. } else {
  56958. $6=true;
  56959. };
  56960. $5=$recv($6).__eq(true);
  56961. self._deny_($5);
  56962. return self;
  56963. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56964. },
  56965. args: [],
  56966. 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",
  56967. referencedClasses: [],
  56968. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56969. }),
  56970. $globals.UndefinedTest);
  56971. $core.addMethod(
  56972. $core.method({
  56973. selector: "testIsNil",
  56974. protocol: 'tests',
  56975. fn: function (){
  56976. var self=this;
  56977. return $core.withContext(function($ctx1) {
  56978. self._assert_(nil._isNil());
  56979. self._deny_(nil._notNil());
  56980. return self;
  56981. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56982. },
  56983. args: [],
  56984. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56985. referencedClasses: [],
  56986. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56987. }),
  56988. $globals.UndefinedTest);
  56989. });
  56990. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56991. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  56992. $core.addPackage('SUnit-Tests');
  56993. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56994. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56995. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56996. $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.";
  56997. $core.addMethod(
  56998. $core.method({
  56999. selector: "setUp",
  57000. protocol: 'running',
  57001. fn: function (){
  57002. var self=this;
  57003. return $core.withContext(function($ctx1) {
  57004. self["@empty"]=$recv($globals.Set)._new();
  57005. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  57006. return self;
  57007. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  57008. },
  57009. args: [],
  57010. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  57011. referencedClasses: ["Set"],
  57012. messageSends: ["new", "with:with:"]
  57013. }),
  57014. $globals.ExampleSetTest);
  57015. $core.addMethod(
  57016. $core.method({
  57017. selector: "testAdd",
  57018. protocol: 'tests',
  57019. fn: function (){
  57020. var self=this;
  57021. return $core.withContext(function($ctx1) {
  57022. $recv(self["@empty"])._add_((5));
  57023. self._assert_($recv(self["@empty"])._includes_((5)));
  57024. return self;
  57025. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  57026. },
  57027. args: [],
  57028. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  57029. referencedClasses: [],
  57030. messageSends: ["add:", "assert:", "includes:"]
  57031. }),
  57032. $globals.ExampleSetTest);
  57033. $core.addMethod(
  57034. $core.method({
  57035. selector: "testGrow",
  57036. protocol: 'tests',
  57037. fn: function (){
  57038. var self=this;
  57039. return $core.withContext(function($ctx1) {
  57040. $recv(self["@empty"])._addAll_((1)._to_((100)));
  57041. self._assert_equals_($recv(self["@empty"])._size(),(100));
  57042. return self;
  57043. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  57044. },
  57045. args: [],
  57046. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  57047. referencedClasses: [],
  57048. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  57049. }),
  57050. $globals.ExampleSetTest);
  57051. $core.addMethod(
  57052. $core.method({
  57053. selector: "testIllegal",
  57054. protocol: 'tests',
  57055. fn: function (){
  57056. var self=this;
  57057. return $core.withContext(function($ctx1) {
  57058. self._should_raise_((function(){
  57059. return $core.withContext(function($ctx2) {
  57060. return $recv(self["@empty"])._at_((5));
  57061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57062. }),$globals.Error);
  57063. $ctx1.sendIdx["should:raise:"]=1;
  57064. self._should_raise_((function(){
  57065. return $core.withContext(function($ctx2) {
  57066. return $recv(self["@empty"])._at_put_((5),"abc");
  57067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57068. }),$globals.Error);
  57069. return self;
  57070. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  57071. },
  57072. args: [],
  57073. 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",
  57074. referencedClasses: ["Error"],
  57075. messageSends: ["should:raise:", "at:", "at:put:"]
  57076. }),
  57077. $globals.ExampleSetTest);
  57078. $core.addMethod(
  57079. $core.method({
  57080. selector: "testIncludes",
  57081. protocol: 'tests',
  57082. fn: function (){
  57083. var self=this;
  57084. return $core.withContext(function($ctx1) {
  57085. var $1;
  57086. $1=$recv(self["@full"])._includes_((5));
  57087. $ctx1.sendIdx["includes:"]=1;
  57088. self._assert_($1);
  57089. $ctx1.sendIdx["assert:"]=1;
  57090. self._assert_($recv(self["@full"])._includes_("abc"));
  57091. return self;
  57092. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  57093. },
  57094. args: [],
  57095. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  57096. referencedClasses: [],
  57097. messageSends: ["assert:", "includes:"]
  57098. }),
  57099. $globals.ExampleSetTest);
  57100. $core.addMethod(
  57101. $core.method({
  57102. selector: "testOccurrences",
  57103. protocol: 'tests',
  57104. fn: function (){
  57105. var self=this;
  57106. return $core.withContext(function($ctx1) {
  57107. var $1,$2;
  57108. $1=$recv(self["@empty"])._occurrencesOf_((0));
  57109. $ctx1.sendIdx["occurrencesOf:"]=1;
  57110. self._assert_equals_($1,(0));
  57111. $ctx1.sendIdx["assert:equals:"]=1;
  57112. $2=$recv(self["@full"])._occurrencesOf_((5));
  57113. $ctx1.sendIdx["occurrencesOf:"]=2;
  57114. self._assert_equals_($2,(1));
  57115. $ctx1.sendIdx["assert:equals:"]=2;
  57116. $recv(self["@full"])._add_((5));
  57117. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57118. return self;
  57119. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57120. },
  57121. args: [],
  57122. 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",
  57123. referencedClasses: [],
  57124. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57125. }),
  57126. $globals.ExampleSetTest);
  57127. $core.addMethod(
  57128. $core.method({
  57129. selector: "testRemove",
  57130. protocol: 'tests',
  57131. fn: function (){
  57132. var self=this;
  57133. return $core.withContext(function($ctx1) {
  57134. var $1;
  57135. $recv(self["@full"])._remove_((5));
  57136. $1=$recv(self["@full"])._includes_("abc");
  57137. $ctx1.sendIdx["includes:"]=1;
  57138. self._assert_($1);
  57139. self._deny_($recv(self["@full"])._includes_((5)));
  57140. return self;
  57141. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57142. },
  57143. args: [],
  57144. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57145. referencedClasses: [],
  57146. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57147. }),
  57148. $globals.ExampleSetTest);
  57149. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57150. $core.addMethod(
  57151. $core.method({
  57152. selector: "fakeError",
  57153. protocol: 'helpers',
  57154. fn: function (){
  57155. var self=this;
  57156. return $core.withContext(function($ctx1) {
  57157. self["@flag"]="bad";
  57158. self._timeout_((30));
  57159. self["@flag"]=$recv(self._async_((function(){
  57160. return $core.withContext(function($ctx2) {
  57161. self["@flag"]="ok";
  57162. self["@flag"];
  57163. return self._error_("Intentional");
  57164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57165. })))._valueWithTimeout_((20));
  57166. return self;
  57167. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57168. },
  57169. args: [],
  57170. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57171. referencedClasses: [],
  57172. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57173. }),
  57174. $globals.SUnitAsyncTest);
  57175. $core.addMethod(
  57176. $core.method({
  57177. selector: "fakeErrorFailingInTearDown",
  57178. protocol: 'helpers',
  57179. fn: function (){
  57180. var self=this;
  57181. return $core.withContext(function($ctx1) {
  57182. self["@flag"]="bad";
  57183. self._timeout_((30));
  57184. self["@flag"]=$recv(self._async_((function(){
  57185. return $core.withContext(function($ctx2) {
  57186. return self._error_("Intentional");
  57187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57188. })))._valueWithTimeout_((20));
  57189. return self;
  57190. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57191. },
  57192. args: [],
  57193. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57194. referencedClasses: [],
  57195. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57196. }),
  57197. $globals.SUnitAsyncTest);
  57198. $core.addMethod(
  57199. $core.method({
  57200. selector: "fakeFailure",
  57201. protocol: 'helpers',
  57202. fn: function (){
  57203. var self=this;
  57204. return $core.withContext(function($ctx1) {
  57205. self["@flag"]="bad";
  57206. self._timeout_((30));
  57207. self["@flag"]=$recv(self._async_((function(){
  57208. return $core.withContext(function($ctx2) {
  57209. self["@flag"]="ok";
  57210. self["@flag"];
  57211. return self._assert_(false);
  57212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57213. })))._valueWithTimeout_((20));
  57214. return self;
  57215. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57216. },
  57217. args: [],
  57218. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57219. referencedClasses: [],
  57220. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57221. }),
  57222. $globals.SUnitAsyncTest);
  57223. $core.addMethod(
  57224. $core.method({
  57225. selector: "fakeMultipleTimeoutFailing",
  57226. protocol: 'helpers',
  57227. fn: function (){
  57228. var self=this;
  57229. return $core.withContext(function($ctx1) {
  57230. var $1;
  57231. self._timeout_((100));
  57232. $ctx1.sendIdx["timeout:"]=1;
  57233. $1=self._async_((function(){
  57234. return $core.withContext(function($ctx2) {
  57235. self._timeout_((20));
  57236. return $recv(self._async_((function(){
  57237. return $core.withContext(function($ctx3) {
  57238. return self._finished();
  57239. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57240. })))._valueWithTimeout_((30));
  57241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57242. }));
  57243. $ctx1.sendIdx["async:"]=1;
  57244. $recv($1)._valueWithTimeout_((20));
  57245. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57246. return self;
  57247. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57248. },
  57249. args: [],
  57250. 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",
  57251. referencedClasses: [],
  57252. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57253. }),
  57254. $globals.SUnitAsyncTest);
  57255. $core.addMethod(
  57256. $core.method({
  57257. selector: "fakeMultipleTimeoutPassing",
  57258. protocol: 'helpers',
  57259. fn: function (){
  57260. var self=this;
  57261. return $core.withContext(function($ctx1) {
  57262. var $1;
  57263. self._timeout_((20));
  57264. $ctx1.sendIdx["timeout:"]=1;
  57265. $1=self._async_((function(){
  57266. return $core.withContext(function($ctx2) {
  57267. self._timeout_((40));
  57268. return $recv(self._async_((function(){
  57269. return $core.withContext(function($ctx3) {
  57270. return self._finished();
  57271. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57272. })))._valueWithTimeout_((20));
  57273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57274. }));
  57275. $ctx1.sendIdx["async:"]=1;
  57276. $recv($1)._valueWithTimeout_((10));
  57277. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57278. return self;
  57279. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  57280. },
  57281. args: [],
  57282. 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",
  57283. referencedClasses: [],
  57284. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57285. }),
  57286. $globals.SUnitAsyncTest);
  57287. $core.addMethod(
  57288. $core.method({
  57289. selector: "fakeTimeout",
  57290. protocol: 'helpers',
  57291. fn: function (){
  57292. var self=this;
  57293. return $core.withContext(function($ctx1) {
  57294. self._timeout_((10));
  57295. $recv(self._async_((function(){
  57296. return $core.withContext(function($ctx2) {
  57297. return self._finished();
  57298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57299. })))._valueWithTimeout_((20));
  57300. return self;
  57301. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  57302. },
  57303. args: [],
  57304. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  57305. referencedClasses: [],
  57306. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57307. }),
  57308. $globals.SUnitAsyncTest);
  57309. $core.addMethod(
  57310. $core.method({
  57311. selector: "selectorSetOf:",
  57312. protocol: 'private',
  57313. fn: function (aCollection){
  57314. var self=this;
  57315. return $core.withContext(function($ctx1) {
  57316. return $recv($recv(aCollection)._collect_((function(each){
  57317. return $core.withContext(function($ctx2) {
  57318. return $recv(each)._selector();
  57319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57320. })))._asSet();
  57321. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  57322. },
  57323. args: ["aCollection"],
  57324. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  57325. referencedClasses: [],
  57326. messageSends: ["asSet", "collect:", "selector"]
  57327. }),
  57328. $globals.SUnitAsyncTest);
  57329. $core.addMethod(
  57330. $core.method({
  57331. selector: "setUp",
  57332. protocol: 'running',
  57333. fn: function (){
  57334. var self=this;
  57335. self["@flag"]="ok";
  57336. return self;
  57337. },
  57338. args: [],
  57339. source: "setUp\x0a\x09flag := 'ok'",
  57340. referencedClasses: [],
  57341. messageSends: []
  57342. }),
  57343. $globals.SUnitAsyncTest);
  57344. $core.addMethod(
  57345. $core.method({
  57346. selector: "tearDown",
  57347. protocol: 'running',
  57348. fn: function (){
  57349. var self=this;
  57350. return $core.withContext(function($ctx1) {
  57351. self._assert_equals_("ok",self["@flag"]);
  57352. return self;
  57353. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  57354. },
  57355. args: [],
  57356. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  57357. referencedClasses: [],
  57358. messageSends: ["assert:equals:"]
  57359. }),
  57360. $globals.SUnitAsyncTest);
  57361. $core.addMethod(
  57362. $core.method({
  57363. selector: "testAsyncErrorsAndFailures",
  57364. protocol: 'tests',
  57365. fn: function (){
  57366. var self=this;
  57367. var suite,runner,result,assertBlock;
  57368. return $core.withContext(function($ctx1) {
  57369. var $1,$2,$3,$4;
  57370. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57371. return $core.withContext(function($ctx2) {
  57372. return $recv(self._class())._selector_(each);
  57373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57374. }));
  57375. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57376. self._timeout_((200));
  57377. result=$recv(runner)._result();
  57378. $ctx1.sendIdx["result"]=1;
  57379. assertBlock=self._async_((function(){
  57380. return $core.withContext(function($ctx2) {
  57381. $1=self._selectorSetOf_($recv(result)._errors());
  57382. $ctx2.sendIdx["selectorSetOf:"]=1;
  57383. $2=["fakeError"]._asSet();
  57384. $ctx2.sendIdx["asSet"]=1;
  57385. self._assert_equals_($1,$2);
  57386. $ctx2.sendIdx["assert:equals:"]=1;
  57387. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57388. return self._finished();
  57389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57390. }));
  57391. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57392. return $core.withContext(function($ctx2) {
  57393. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57394. if($core.assert($3)){
  57395. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57396. return $recv($4)._ifTrue_(assertBlock);
  57397. };
  57398. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57399. }));
  57400. $recv(runner)._run();
  57401. return self;
  57402. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57403. },
  57404. args: [],
  57405. 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",
  57406. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57407. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57408. }),
  57409. $globals.SUnitAsyncTest);
  57410. $core.addMethod(
  57411. $core.method({
  57412. selector: "testAsyncNeedsTimeout",
  57413. protocol: 'tests',
  57414. fn: function (){
  57415. var self=this;
  57416. return $core.withContext(function($ctx1) {
  57417. self._should_raise_((function(){
  57418. return $core.withContext(function($ctx2) {
  57419. return self._async_((function(){
  57420. }));
  57421. $ctx2.sendIdx["async:"]=1;
  57422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57423. }),$globals.Error);
  57424. self._timeout_((0));
  57425. self._shouldnt_raise_((function(){
  57426. return $core.withContext(function($ctx2) {
  57427. return self._async_((function(){
  57428. }));
  57429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57430. }),$globals.Error);
  57431. self._finished();
  57432. return self;
  57433. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57434. },
  57435. args: [],
  57436. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57437. referencedClasses: ["Error"],
  57438. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57439. }),
  57440. $globals.SUnitAsyncTest);
  57441. $core.addMethod(
  57442. $core.method({
  57443. selector: "testFinishedNeedsTimeout",
  57444. protocol: 'tests',
  57445. fn: function (){
  57446. var self=this;
  57447. return $core.withContext(function($ctx1) {
  57448. self._should_raise_((function(){
  57449. return $core.withContext(function($ctx2) {
  57450. return self._finished();
  57451. $ctx2.sendIdx["finished"]=1;
  57452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57453. }),$globals.Error);
  57454. self._timeout_((0));
  57455. self._shouldnt_raise_((function(){
  57456. return $core.withContext(function($ctx2) {
  57457. return self._finished();
  57458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57459. }),$globals.Error);
  57460. return self;
  57461. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57462. },
  57463. args: [],
  57464. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57465. referencedClasses: ["Error"],
  57466. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57467. }),
  57468. $globals.SUnitAsyncTest);
  57469. $core.addMethod(
  57470. $core.method({
  57471. selector: "testIsAsyncReturnsCorrectValues",
  57472. protocol: 'tests',
  57473. fn: function (){
  57474. var self=this;
  57475. return $core.withContext(function($ctx1) {
  57476. var $1,$2;
  57477. $1=self._isAsync();
  57478. $ctx1.sendIdx["isAsync"]=1;
  57479. self._deny_($1);
  57480. $ctx1.sendIdx["deny:"]=1;
  57481. self._timeout_((0));
  57482. $2=self._isAsync();
  57483. $ctx1.sendIdx["isAsync"]=2;
  57484. self._assert_($2);
  57485. self._finished();
  57486. self._deny_(self._isAsync());
  57487. return self;
  57488. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57489. },
  57490. args: [],
  57491. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57492. referencedClasses: [],
  57493. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57494. }),
  57495. $globals.SUnitAsyncTest);
  57496. $core.addMethod(
  57497. $core.method({
  57498. selector: "testPass",
  57499. protocol: 'tests',
  57500. fn: function (){
  57501. var self=this;
  57502. return $core.withContext(function($ctx1) {
  57503. self["@flag"]="bad";
  57504. self._timeout_((10));
  57505. self["@flag"]=$recv(self._async_((function(){
  57506. return $core.withContext(function($ctx2) {
  57507. self._assert_(true);
  57508. self._finished();
  57509. self["@flag"]="ok";
  57510. return self["@flag"];
  57511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57512. })))._valueWithTimeout_((5));
  57513. return self;
  57514. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57515. },
  57516. args: [],
  57517. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57518. referencedClasses: [],
  57519. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57520. }),
  57521. $globals.SUnitAsyncTest);
  57522. $core.addMethod(
  57523. $core.method({
  57524. selector: "testTimeouts",
  57525. protocol: 'tests',
  57526. fn: function (){
  57527. var self=this;
  57528. var suite,runner,result,assertBlock;
  57529. return $core.withContext(function($ctx1) {
  57530. var $1,$2,$3;
  57531. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57532. return $core.withContext(function($ctx2) {
  57533. return $recv(self._class())._selector_(each);
  57534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57535. }));
  57536. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57537. self._timeout_((200));
  57538. result=$recv(runner)._result();
  57539. $ctx1.sendIdx["result"]=1;
  57540. assertBlock=self._async_((function(){
  57541. return $core.withContext(function($ctx2) {
  57542. $1=self._selectorSetOf_($recv(result)._errors());
  57543. $ctx2.sendIdx["selectorSetOf:"]=1;
  57544. self._assert_equals_($1,$recv($globals.Set)._new());
  57545. $ctx2.sendIdx["assert:equals:"]=1;
  57546. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57547. return self._finished();
  57548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57549. }));
  57550. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57551. return $core.withContext(function($ctx2) {
  57552. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57553. if($core.assert($2)){
  57554. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57555. return $recv($3)._ifTrue_(assertBlock);
  57556. };
  57557. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57558. }));
  57559. $recv(runner)._run();
  57560. return self;
  57561. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57562. },
  57563. args: [],
  57564. 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",
  57565. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57566. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57567. }),
  57568. $globals.SUnitAsyncTest);
  57569. $core.addMethod(
  57570. $core.method({
  57571. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57572. protocol: 'tests',
  57573. fn: function (){
  57574. var self=this;
  57575. var x;
  57576. return $core.withContext(function($ctx1) {
  57577. var $1;
  57578. self["@flag"]="bad";
  57579. self._timeout_((10));
  57580. x=(0);
  57581. $1=self._async_((function(){
  57582. return $core.withContext(function($ctx2) {
  57583. self._finished();
  57584. $ctx2.sendIdx["finished"]=1;
  57585. self["@flag"]="ok";
  57586. self["@flag"];
  57587. x=$recv(x).__plus((1));
  57588. $ctx2.sendIdx["+"]=1;
  57589. x;
  57590. return self._assert_equals_(x,(1));
  57591. $ctx2.sendIdx["assert:equals:"]=1;
  57592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57593. }));
  57594. $ctx1.sendIdx["async:"]=1;
  57595. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57596. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57597. self["@flag"]=$recv(self._async_((function(){
  57598. return $core.withContext(function($ctx2) {
  57599. self._finished();
  57600. self["@flag"]="ok";
  57601. self["@flag"];
  57602. x=$recv(x).__plus((1));
  57603. x;
  57604. return self._assert_equals_(x,(1));
  57605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57606. })))._valueWithTimeout_((0));
  57607. return self;
  57608. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57609. },
  57610. args: [],
  57611. 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.",
  57612. referencedClasses: [],
  57613. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57614. }),
  57615. $globals.SUnitAsyncTest);
  57616. });
  57617. define('amber/devel',[
  57618. './lang',
  57619. './compatibility', // pre-fetch, dep of ./boot
  57620. './boot', // pre-fetch, dep of ./helpers
  57621. './helpers', // pre-fetch, dep of ./deploy
  57622. './deploy', // pre-fetch, dep of ./lang
  57623. // --- packages of the development only Amber begin here ---
  57624. 'amber_core/SUnit',
  57625. 'amber_core/Compiler-Tests',
  57626. 'amber_core/Kernel-Tests',
  57627. 'amber_core/SUnit-Tests'
  57628. // --- packages of the development only Amber end here ---
  57629. ], function (amber) { return amber; });
  57630. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57631. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  57632. $core.addPackage('AmberCli');
  57633. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57634. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57635. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57636. $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.";
  57637. $core.addMethod(
  57638. $core.method({
  57639. selector: "commandLineSwitches",
  57640. protocol: 'commandline',
  57641. fn: function (){
  57642. var self=this;
  57643. var switches;
  57644. return $core.withContext(function($ctx1) {
  57645. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57646. return $core.withContext(function($ctx2) {
  57647. return $recv(each)._selector();
  57648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57649. }));
  57650. $ctx1.sendIdx["collect:"]=1;
  57651. switches=$recv(switches)._select_((function(each){
  57652. return $core.withContext(function($ctx2) {
  57653. return $recv(each)._match_("^[^:]*:$");
  57654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57655. }));
  57656. switches=$recv(switches)._collect_((function(each){
  57657. return $core.withContext(function($ctx2) {
  57658. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57660. }));
  57661. return switches;
  57662. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57663. },
  57664. args: [],
  57665. 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",
  57666. referencedClasses: [],
  57667. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57668. }),
  57669. $globals.AmberCli.klass);
  57670. $core.addMethod(
  57671. $core.method({
  57672. selector: "config:",
  57673. protocol: 'commands',
  57674. fn: function (args){
  57675. var self=this;
  57676. return $core.withContext(function($ctx1) {
  57677. $recv($recv($globals.Configurator)._new())._start();
  57678. return self;
  57679. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57680. },
  57681. args: ["args"],
  57682. source: "config: args\x0a\x09Configurator new start",
  57683. referencedClasses: ["Configurator"],
  57684. messageSends: ["start", "new"]
  57685. }),
  57686. $globals.AmberCli.klass);
  57687. $core.addMethod(
  57688. $core.method({
  57689. selector: "handleArguments:",
  57690. protocol: 'commandline',
  57691. fn: function (args){
  57692. var self=this;
  57693. var selector;
  57694. return $core.withContext(function($ctx1) {
  57695. var $1;
  57696. $1=$recv(args)._first();
  57697. $ctx1.sendIdx["first"]=1;
  57698. selector=self._selectorForCommandLineSwitch_($1);
  57699. $recv(args)._remove_($recv(args)._first());
  57700. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57701. return self;
  57702. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57703. },
  57704. args: ["args"],
  57705. 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)",
  57706. referencedClasses: ["Array"],
  57707. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57708. }),
  57709. $globals.AmberCli.klass);
  57710. $core.addMethod(
  57711. $core.method({
  57712. selector: "help:",
  57713. protocol: 'commands',
  57714. fn: function (args){
  57715. var self=this;
  57716. return $core.withContext(function($ctx1) {
  57717. $recv($globals.Transcript)._show_("Available commands");
  57718. $recv(self._commandLineSwitches())._do_((function(each){
  57719. return $core.withContext(function($ctx2) {
  57720. return $recv(console)._log_(each);
  57721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57722. }));
  57723. return self;
  57724. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57725. },
  57726. args: ["args"],
  57727. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57728. referencedClasses: ["Transcript"],
  57729. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57730. }),
  57731. $globals.AmberCli.klass);
  57732. $core.addMethod(
  57733. $core.method({
  57734. selector: "init:",
  57735. protocol: 'commands',
  57736. fn: function (args){
  57737. var self=this;
  57738. return $core.withContext(function($ctx1) {
  57739. $recv($recv($globals.Initer)._new())._start();
  57740. return self;
  57741. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57742. },
  57743. args: ["args"],
  57744. source: "init: args\x0a\x09Initer new start",
  57745. referencedClasses: ["Initer"],
  57746. messageSends: ["start", "new"]
  57747. }),
  57748. $globals.AmberCli.klass);
  57749. $core.addMethod(
  57750. $core.method({
  57751. selector: "main",
  57752. protocol: 'startup',
  57753. fn: function (){
  57754. var self=this;
  57755. var args;
  57756. return $core.withContext(function($ctx1) {
  57757. var $3,$2,$1,$4;
  57758. $3=$recv("Welcome to Amber version ".__comma($recv($globals.Smalltalk)._version())).__comma(" (NodeJS ");
  57759. $ctx1.sendIdx[","]=3;
  57760. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57761. $ctx1.sendIdx[","]=2;
  57762. $1=$recv($2).__comma(").");
  57763. $ctx1.sendIdx[","]=1;
  57764. $recv($globals.Transcript)._show_($1);
  57765. args=$recv(process)._argv();
  57766. $recv(args)._removeFrom_to_((1),(2));
  57767. $4=$recv(args)._isEmpty();
  57768. if($core.assert($4)){
  57769. self._help_(nil);
  57770. } else {
  57771. return self._handleArguments_(args);
  57772. };
  57773. return self;
  57774. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  57775. },
  57776. args: [],
  57777. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  57778. referencedClasses: ["Transcript", "Smalltalk"],
  57779. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  57780. }),
  57781. $globals.AmberCli.klass);
  57782. $core.addMethod(
  57783. $core.method({
  57784. selector: "repl:",
  57785. protocol: 'commands',
  57786. fn: function (args){
  57787. var self=this;
  57788. return $core.withContext(function($ctx1) {
  57789. return $recv($recv($globals.Repl)._new())._createInterface();
  57790. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57791. },
  57792. args: ["args"],
  57793. source: "repl: args\x0a\x09^ Repl new createInterface",
  57794. referencedClasses: ["Repl"],
  57795. messageSends: ["createInterface", "new"]
  57796. }),
  57797. $globals.AmberCli.klass);
  57798. $core.addMethod(
  57799. $core.method({
  57800. selector: "selectorForCommandLineSwitch:",
  57801. protocol: 'commandline',
  57802. fn: function (aSwitch){
  57803. var self=this;
  57804. var command,selector;
  57805. return $core.withContext(function($ctx1) {
  57806. var $1;
  57807. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57808. if($core.assert($1)){
  57809. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57810. return $core.withContext(function($ctx2) {
  57811. return $recv($recv(each)._second())._asUppercase();
  57812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57813. }))).__comma(":");
  57814. selector;
  57815. } else {
  57816. selector="help:";
  57817. selector;
  57818. };
  57819. return selector;
  57820. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57821. },
  57822. args: ["aSwitch"],
  57823. 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",
  57824. referencedClasses: [],
  57825. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57826. }),
  57827. $globals.AmberCli.klass);
  57828. $core.addMethod(
  57829. $core.method({
  57830. selector: "serve:",
  57831. protocol: 'commands',
  57832. fn: function (args){
  57833. var self=this;
  57834. return $core.withContext(function($ctx1) {
  57835. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  57836. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57837. },
  57838. args: ["args"],
  57839. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57840. referencedClasses: ["FileServer"],
  57841. messageSends: ["start", "createServerWithArguments:"]
  57842. }),
  57843. $globals.AmberCli.klass);
  57844. $core.addMethod(
  57845. $core.method({
  57846. selector: "version:",
  57847. protocol: 'commands',
  57848. fn: function (arguments_){
  57849. var self=this;
  57850. return self;
  57851. },
  57852. args: ["arguments"],
  57853. source: "version: arguments",
  57854. referencedClasses: [],
  57855. messageSends: []
  57856. }),
  57857. $globals.AmberCli.klass);
  57858. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57859. $core.addMethod(
  57860. $core.method({
  57861. selector: "dirname",
  57862. protocol: 'private',
  57863. fn: function (){
  57864. var self=this;
  57865. return $core.withContext(function($ctx1) {
  57866. return __dirname;
  57867. return self;
  57868. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57869. },
  57870. args: [],
  57871. source: "dirname\x0a\x09<return __dirname>",
  57872. referencedClasses: [],
  57873. messageSends: []
  57874. }),
  57875. $globals.BaseFileManipulator);
  57876. $core.addMethod(
  57877. $core.method({
  57878. selector: "initialize",
  57879. protocol: 'initialization',
  57880. fn: function (){
  57881. var self=this;
  57882. return $core.withContext(function($ctx1) {
  57883. (
  57884. $ctx1.supercall = true,
  57885. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57886. $ctx1.supercall = false;
  57887. self["@path"]=$recv(require)._value_("path");
  57888. $ctx1.sendIdx["value:"]=1;
  57889. self["@fs"]=$recv(require)._value_("fs");
  57890. return self;
  57891. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57892. },
  57893. args: [],
  57894. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57895. referencedClasses: [],
  57896. messageSends: ["initialize", "value:"]
  57897. }),
  57898. $globals.BaseFileManipulator);
  57899. $core.addMethod(
  57900. $core.method({
  57901. selector: "rootDirname",
  57902. protocol: 'private',
  57903. fn: function (){
  57904. var self=this;
  57905. return $core.withContext(function($ctx1) {
  57906. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57907. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57908. },
  57909. args: [],
  57910. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57911. referencedClasses: [],
  57912. messageSends: ["join:with:", "dirname"]
  57913. }),
  57914. $globals.BaseFileManipulator);
  57915. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57916. $core.addMethod(
  57917. $core.method({
  57918. selector: "initialize",
  57919. protocol: 'initialization',
  57920. fn: function (){
  57921. var self=this;
  57922. return $core.withContext(function($ctx1) {
  57923. (
  57924. $ctx1.supercall = true,
  57925. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57926. $ctx1.supercall = false;
  57927. return self;
  57928. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57929. },
  57930. args: [],
  57931. source: "initialize\x0a\x09super initialize",
  57932. referencedClasses: [],
  57933. messageSends: ["initialize"]
  57934. }),
  57935. $globals.Configurator);
  57936. $core.addMethod(
  57937. $core.method({
  57938. selector: "start",
  57939. protocol: 'action',
  57940. fn: function (){
  57941. var self=this;
  57942. return $core.withContext(function($ctx1) {
  57943. var $receiver;
  57944. self._writeConfigThenDo_((function(err){
  57945. return $core.withContext(function($ctx2) {
  57946. if(($receiver = err) == null || $receiver.isNil){
  57947. return $recv(process)._exit();
  57948. } else {
  57949. return $recv(process)._exit_((111));
  57950. };
  57951. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57952. }));
  57953. return self;
  57954. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57955. },
  57956. args: [],
  57957. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57958. referencedClasses: [],
  57959. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57960. }),
  57961. $globals.Configurator);
  57962. $core.addMethod(
  57963. $core.method({
  57964. selector: "writeConfigThenDo:",
  57965. protocol: 'action',
  57966. fn: function (aBlock){
  57967. var self=this;
  57968. return $core.withContext(function($ctx1) {
  57969. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57970. return self;
  57971. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57972. },
  57973. args: ["aBlock"],
  57974. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  57975. referencedClasses: [],
  57976. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  57977. }),
  57978. $globals.Configurator);
  57979. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57980. $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.";
  57981. $core.addMethod(
  57982. $core.method({
  57983. selector: "base64Decode:",
  57984. protocol: 'private',
  57985. fn: function (aString){
  57986. var self=this;
  57987. return $core.withContext(function($ctx1) {
  57988. return (new Buffer(aString, 'base64').toString());
  57989. return self;
  57990. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57991. },
  57992. args: ["aString"],
  57993. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  57994. referencedClasses: [],
  57995. messageSends: []
  57996. }),
  57997. $globals.FileServer);
  57998. $core.addMethod(
  57999. $core.method({
  58000. selector: "basePath",
  58001. protocol: 'accessing',
  58002. fn: function (){
  58003. var self=this;
  58004. return $core.withContext(function($ctx1) {
  58005. var $1,$receiver;
  58006. $1=self["@basePath"];
  58007. if(($receiver = $1) == null || $receiver.isNil){
  58008. return $recv(self._class())._defaultBasePath();
  58009. } else {
  58010. return $1;
  58011. };
  58012. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  58013. },
  58014. args: [],
  58015. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  58016. referencedClasses: [],
  58017. messageSends: ["ifNil:", "defaultBasePath", "class"]
  58018. }),
  58019. $globals.FileServer);
  58020. $core.addMethod(
  58021. $core.method({
  58022. selector: "basePath:",
  58023. protocol: 'accessing',
  58024. fn: function (aString){
  58025. var self=this;
  58026. return $core.withContext(function($ctx1) {
  58027. self["@basePath"]=aString;
  58028. self._validateBasePath();
  58029. return self;
  58030. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  58031. },
  58032. args: ["aString"],
  58033. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  58034. referencedClasses: [],
  58035. messageSends: ["validateBasePath"]
  58036. }),
  58037. $globals.FileServer);
  58038. $core.addMethod(
  58039. $core.method({
  58040. selector: "checkDirectoryLayout",
  58041. protocol: 'initialization',
  58042. fn: function (){
  58043. var self=this;
  58044. return $core.withContext(function($ctx1) {
  58045. var $1;
  58046. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  58047. if(!$core.assert($1)){
  58048. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  58049. $ctx1.sendIdx["warn:"]=1;
  58050. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  58051. $ctx1.sendIdx["warn:"]=2;
  58052. $recv(console)._warn_(" You can also specify a page to be served by default,");
  58053. $ctx1.sendIdx["warn:"]=3;
  58054. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  58055. };
  58056. return self;
  58057. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  58058. },
  58059. args: [],
  58060. 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.'].",
  58061. referencedClasses: [],
  58062. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  58063. }),
  58064. $globals.FileServer);
  58065. $core.addMethod(
  58066. $core.method({
  58067. selector: "fallbackPage",
  58068. protocol: 'accessing',
  58069. fn: function (){
  58070. var self=this;
  58071. return self["@fallbackPage"];
  58072. },
  58073. args: [],
  58074. source: "fallbackPage\x0a\x09^ fallbackPage",
  58075. referencedClasses: [],
  58076. messageSends: []
  58077. }),
  58078. $globals.FileServer);
  58079. $core.addMethod(
  58080. $core.method({
  58081. selector: "fallbackPage:",
  58082. protocol: 'accessing',
  58083. fn: function (aString){
  58084. var self=this;
  58085. self["@fallbackPage"]=aString;
  58086. return self;
  58087. },
  58088. args: ["aString"],
  58089. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  58090. referencedClasses: [],
  58091. messageSends: []
  58092. }),
  58093. $globals.FileServer);
  58094. $core.addMethod(
  58095. $core.method({
  58096. selector: "handleGETRequest:respondTo:",
  58097. protocol: 'request handling',
  58098. fn: function (aRequest,aResponse){
  58099. var self=this;
  58100. var uri,filename;
  58101. return $core.withContext(function($ctx1) {
  58102. var $1;
  58103. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58104. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58105. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58106. return $core.withContext(function($ctx2) {
  58107. if($core.assert(aBoolean)){
  58108. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58109. if($core.assert($1)){
  58110. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58111. } else {
  58112. return self._respondFileNamed_to_(filename,aResponse);
  58113. };
  58114. } else {
  58115. return self._respondNotFoundTo_(aResponse);
  58116. };
  58117. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58118. }));
  58119. return self;
  58120. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58121. },
  58122. args: ["aRequest", "aResponse"],
  58123. 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]]]",
  58124. referencedClasses: [],
  58125. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58126. }),
  58127. $globals.FileServer);
  58128. $core.addMethod(
  58129. $core.method({
  58130. selector: "handleOPTIONSRequest:respondTo:",
  58131. protocol: 'request handling',
  58132. fn: function (aRequest,aResponse){
  58133. var self=this;
  58134. return $core.withContext(function($ctx1) {
  58135. $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)]));
  58136. $recv(aResponse)._end();
  58137. return self;
  58138. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58139. },
  58140. args: ["aRequest", "aResponse"],
  58141. 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",
  58142. referencedClasses: [],
  58143. messageSends: ["writeHead:options:", "end"]
  58144. }),
  58145. $globals.FileServer);
  58146. $core.addMethod(
  58147. $core.method({
  58148. selector: "handlePUTRequest:respondTo:",
  58149. protocol: 'request handling',
  58150. fn: function (aRequest,aResponse){
  58151. var self=this;
  58152. var file,stream;
  58153. return $core.withContext(function($ctx1) {
  58154. var $1,$2,$3,$4;
  58155. $1=self._isAuthenticated_(aRequest);
  58156. if(!$core.assert($1)){
  58157. self._respondAuthenticationRequiredTo_(aResponse);
  58158. return nil;
  58159. };
  58160. file=".".__comma($recv(aRequest)._url());
  58161. $ctx1.sendIdx[","]=1;
  58162. stream=$recv(self["@fs"])._createWriteStream_(file);
  58163. $recv(stream)._on_do_("error",(function(error){
  58164. return $core.withContext(function($ctx2) {
  58165. $2=console;
  58166. $3="Error creating WriteStream for file ".__comma(file);
  58167. $ctx2.sendIdx[","]=2;
  58168. $recv($2)._warn_($3);
  58169. $ctx2.sendIdx["warn:"]=1;
  58170. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58171. $ctx2.sendIdx["warn:"]=2;
  58172. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58173. return self._respondNotCreatedTo_(aResponse);
  58174. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58175. }));
  58176. $ctx1.sendIdx["on:do:"]=1;
  58177. $recv(stream)._on_do_("close",(function(){
  58178. return $core.withContext(function($ctx2) {
  58179. return self._respondCreatedTo_(aResponse);
  58180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58181. }));
  58182. $ctx1.sendIdx["on:do:"]=2;
  58183. $recv(aRequest)._setEncoding_("utf8");
  58184. $recv(aRequest)._on_do_("data",(function(data){
  58185. return $core.withContext(function($ctx2) {
  58186. return $recv(stream)._write_(data);
  58187. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58188. }));
  58189. $ctx1.sendIdx["on:do:"]=3;
  58190. $recv(aRequest)._on_do_("end",(function(){
  58191. return $core.withContext(function($ctx2) {
  58192. $4=$recv(stream)._writable();
  58193. if($core.assert($4)){
  58194. return $recv(stream)._end();
  58195. };
  58196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58197. }));
  58198. return self;
  58199. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58200. },
  58201. args: ["aRequest", "aResponse"],
  58202. 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]]",
  58203. referencedClasses: [],
  58204. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58205. }),
  58206. $globals.FileServer);
  58207. $core.addMethod(
  58208. $core.method({
  58209. selector: "handleRequest:respondTo:",
  58210. protocol: 'request handling',
  58211. fn: function (aRequest,aResponse){
  58212. var self=this;
  58213. return $core.withContext(function($ctx1) {
  58214. var $2,$1,$4,$3,$5;
  58215. $2=$recv(aRequest)._method();
  58216. $ctx1.sendIdx["method"]=1;
  58217. $1=$recv($2).__eq("PUT");
  58218. $ctx1.sendIdx["="]=1;
  58219. if($core.assert($1)){
  58220. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  58221. };
  58222. $4=$recv(aRequest)._method();
  58223. $ctx1.sendIdx["method"]=2;
  58224. $3=$recv($4).__eq("GET");
  58225. $ctx1.sendIdx["="]=2;
  58226. if($core.assert($3)){
  58227. self._handleGETRequest_respondTo_(aRequest,aResponse);
  58228. };
  58229. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  58230. if($core.assert($5)){
  58231. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  58232. };
  58233. return self;
  58234. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58235. },
  58236. args: ["aRequest", "aResponse"],
  58237. 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]",
  58238. referencedClasses: [],
  58239. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  58240. }),
  58241. $globals.FileServer);
  58242. $core.addMethod(
  58243. $core.method({
  58244. selector: "host",
  58245. protocol: 'accessing',
  58246. fn: function (){
  58247. var self=this;
  58248. return self["@host"];
  58249. },
  58250. args: [],
  58251. source: "host\x0a\x09^ host",
  58252. referencedClasses: [],
  58253. messageSends: []
  58254. }),
  58255. $globals.FileServer);
  58256. $core.addMethod(
  58257. $core.method({
  58258. selector: "host:",
  58259. protocol: 'accessing',
  58260. fn: function (hostname){
  58261. var self=this;
  58262. self["@host"]=hostname;
  58263. return self;
  58264. },
  58265. args: ["hostname"],
  58266. source: "host: hostname\x0a\x09host := hostname",
  58267. referencedClasses: [],
  58268. messageSends: []
  58269. }),
  58270. $globals.FileServer);
  58271. $core.addMethod(
  58272. $core.method({
  58273. selector: "initialize",
  58274. protocol: 'initialization',
  58275. fn: function (){
  58276. var self=this;
  58277. return $core.withContext(function($ctx1) {
  58278. var $1;
  58279. (
  58280. $ctx1.supercall = true,
  58281. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58282. $ctx1.supercall = false;
  58283. self["@http"]=self._require_("http");
  58284. $ctx1.sendIdx["require:"]=1;
  58285. self["@util"]=self._require_("util");
  58286. $ctx1.sendIdx["require:"]=2;
  58287. self["@url"]=self._require_("url");
  58288. $1=self._class();
  58289. $ctx1.sendIdx["class"]=1;
  58290. self["@host"]=$recv($1)._defaultHost();
  58291. self["@port"]=$recv(self._class())._defaultPort();
  58292. self["@username"]=nil;
  58293. self["@password"]=nil;
  58294. self["@fallbackPage"]=nil;
  58295. return self;
  58296. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  58297. },
  58298. args: [],
  58299. 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.",
  58300. referencedClasses: [],
  58301. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  58302. }),
  58303. $globals.FileServer);
  58304. $core.addMethod(
  58305. $core.method({
  58306. selector: "isAuthenticated:",
  58307. protocol: 'private',
  58308. fn: function (aRequest){
  58309. var self=this;
  58310. var header,token,auth,parts;
  58311. return $core.withContext(function($ctx1) {
  58312. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  58313. $2=$recv(self["@username"])._isNil();
  58314. $ctx1.sendIdx["isNil"]=1;
  58315. $1=$recv($2)._and_((function(){
  58316. return $core.withContext(function($ctx2) {
  58317. return $recv(self["@password"])._isNil();
  58318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58319. }));
  58320. $ctx1.sendIdx["and:"]=1;
  58321. if($core.assert($1)){
  58322. return true;
  58323. };
  58324. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  58325. $ctx1.sendIdx["at:"]=1;
  58326. if(($receiver = $3) == null || $receiver.isNil){
  58327. header="";
  58328. } else {
  58329. header=$3;
  58330. };
  58331. $4=$recv(header)._isEmpty();
  58332. if($core.assert($4)){
  58333. return false;
  58334. } else {
  58335. $5=$recv(header)._tokenize_(" ");
  58336. $ctx1.sendIdx["tokenize:"]=1;
  58337. if(($receiver = $5) == null || $receiver.isNil){
  58338. token="";
  58339. } else {
  58340. token=$5;
  58341. };
  58342. token;
  58343. $6=$recv(token)._at_((2));
  58344. $ctx1.sendIdx["at:"]=2;
  58345. auth=self._base64Decode_($6);
  58346. auth;
  58347. parts=$recv(auth)._tokenize_(":");
  58348. parts;
  58349. $9=self["@username"];
  58350. $10=$recv(parts)._at_((1));
  58351. $ctx1.sendIdx["at:"]=3;
  58352. $8=$recv($9).__eq($10);
  58353. $ctx1.sendIdx["="]=1;
  58354. $7=$recv($8)._and_((function(){
  58355. return $core.withContext(function($ctx2) {
  58356. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  58357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58358. }));
  58359. if($core.assert($7)){
  58360. return true;
  58361. } else {
  58362. return false;
  58363. };
  58364. };
  58365. return self;
  58366. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58367. },
  58368. args: ["aRequest"],
  58369. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^ true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^ false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^ true]\x0a\x09\x09\x09ifFalse: [^ false]\x0a\x09].",
  58370. referencedClasses: [],
  58371. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  58372. }),
  58373. $globals.FileServer);
  58374. $core.addMethod(
  58375. $core.method({
  58376. selector: "password:",
  58377. protocol: 'accessing',
  58378. fn: function (aPassword){
  58379. var self=this;
  58380. self["@password"]=aPassword;
  58381. return self;
  58382. },
  58383. args: ["aPassword"],
  58384. source: "password: aPassword\x0a\x09password := aPassword.",
  58385. referencedClasses: [],
  58386. messageSends: []
  58387. }),
  58388. $globals.FileServer);
  58389. $core.addMethod(
  58390. $core.method({
  58391. selector: "port",
  58392. protocol: 'accessing',
  58393. fn: function (){
  58394. var self=this;
  58395. return self["@port"];
  58396. },
  58397. args: [],
  58398. source: "port\x0a\x09^ port",
  58399. referencedClasses: [],
  58400. messageSends: []
  58401. }),
  58402. $globals.FileServer);
  58403. $core.addMethod(
  58404. $core.method({
  58405. selector: "port:",
  58406. protocol: 'accessing',
  58407. fn: function (aNumber){
  58408. var self=this;
  58409. self["@port"]=aNumber;
  58410. return self;
  58411. },
  58412. args: ["aNumber"],
  58413. source: "port: aNumber\x0a\x09port := aNumber",
  58414. referencedClasses: [],
  58415. messageSends: []
  58416. }),
  58417. $globals.FileServer);
  58418. $core.addMethod(
  58419. $core.method({
  58420. selector: "require:",
  58421. protocol: 'private',
  58422. fn: function (aModuleString){
  58423. var self=this;
  58424. return $core.withContext(function($ctx1) {
  58425. return $recv(require)._value_(aModuleString);
  58426. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58427. },
  58428. args: ["aModuleString"],
  58429. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58430. referencedClasses: [],
  58431. messageSends: ["value:"]
  58432. }),
  58433. $globals.FileServer);
  58434. $core.addMethod(
  58435. $core.method({
  58436. selector: "respondAuthenticationRequiredTo:",
  58437. protocol: 'request handling',
  58438. fn: function (aResponse){
  58439. var self=this;
  58440. return $core.withContext(function($ctx1) {
  58441. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58442. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58443. $recv(aResponse)._end();
  58444. return self;
  58445. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58446. },
  58447. args: ["aResponse"],
  58448. 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.",
  58449. referencedClasses: [],
  58450. messageSends: ["writeHead:options:", "write:", "end"]
  58451. }),
  58452. $globals.FileServer);
  58453. $core.addMethod(
  58454. $core.method({
  58455. selector: "respondCreatedTo:",
  58456. protocol: 'request handling',
  58457. fn: function (aResponse){
  58458. var self=this;
  58459. return $core.withContext(function($ctx1) {
  58460. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58461. $recv(aResponse)._end();
  58462. return self;
  58463. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58464. },
  58465. args: ["aResponse"],
  58466. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58467. referencedClasses: [],
  58468. messageSends: ["writeHead:options:", "end"]
  58469. }),
  58470. $globals.FileServer);
  58471. $core.addMethod(
  58472. $core.method({
  58473. selector: "respondDirectoryNamed:from:to:",
  58474. protocol: 'request handling',
  58475. fn: function (aDirname,aUrl,aResponse){
  58476. var self=this;
  58477. return $core.withContext(function($ctx1) {
  58478. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58479. $2=$recv(aUrl)._pathname();
  58480. $ctx1.sendIdx["pathname"]=1;
  58481. $1=$recv($2)._endsWith_("/");
  58482. if($core.assert($1)){
  58483. $3=$recv(aDirname).__comma("index.html");
  58484. $ctx1.sendIdx[","]=1;
  58485. self._respondFileNamed_to_($3,aResponse);
  58486. } else {
  58487. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58488. $7=$recv(aUrl)._search();
  58489. if(($receiver = $7) == null || $receiver.isNil){
  58490. $6="";
  58491. } else {
  58492. $6=$7;
  58493. };
  58494. $4=$recv($5).__comma($6);
  58495. $ctx1.sendIdx[","]=2;
  58496. self._respondRedirect_to_($4,aResponse);
  58497. };
  58498. return self;
  58499. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58500. },
  58501. args: ["aDirname", "aUrl", "aResponse"],
  58502. 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]",
  58503. referencedClasses: [],
  58504. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58505. }),
  58506. $globals.FileServer);
  58507. $core.addMethod(
  58508. $core.method({
  58509. selector: "respondFileNamed:to:",
  58510. protocol: 'request handling',
  58511. fn: function (aFilename,aResponse){
  58512. var self=this;
  58513. var type,filename;
  58514. return $core.withContext(function($ctx1) {
  58515. var $1,$2,$3,$4;
  58516. filename=aFilename;
  58517. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58518. return $core.withContext(function($ctx2) {
  58519. $1=$recv(ex)._notNil();
  58520. if($core.assert($1)){
  58521. $2=console;
  58522. $3=$recv(filename).__comma(" does not exist");
  58523. $ctx2.sendIdx[","]=1;
  58524. $recv($2)._log_($3);
  58525. return self._respondNotFoundTo_(aResponse);
  58526. } else {
  58527. type=$recv(self._class())._mimeTypeFor_(filename);
  58528. type;
  58529. $4=$recv(type).__eq("application/javascript");
  58530. if($core.assert($4)){
  58531. type=$recv(type).__comma(";charset=utf-8");
  58532. type;
  58533. };
  58534. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58535. $recv(aResponse)._write_encoding_(file,"binary");
  58536. return $recv(aResponse)._end();
  58537. };
  58538. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58539. }));
  58540. return self;
  58541. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58542. },
  58543. args: ["aFilename", "aResponse"],
  58544. 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]]",
  58545. referencedClasses: [],
  58546. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58547. }),
  58548. $globals.FileServer);
  58549. $core.addMethod(
  58550. $core.method({
  58551. selector: "respondInternalErrorTo:",
  58552. protocol: 'request handling',
  58553. fn: function (aResponse){
  58554. var self=this;
  58555. return $core.withContext(function($ctx1) {
  58556. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58557. $recv(aResponse)._write_("500 Internal server error");
  58558. $recv(aResponse)._end();
  58559. return self;
  58560. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58561. },
  58562. args: ["aResponse"],
  58563. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58564. referencedClasses: [],
  58565. messageSends: ["writeHead:options:", "write:", "end"]
  58566. }),
  58567. $globals.FileServer);
  58568. $core.addMethod(
  58569. $core.method({
  58570. selector: "respondNotCreatedTo:",
  58571. protocol: 'request handling',
  58572. fn: function (aResponse){
  58573. var self=this;
  58574. return $core.withContext(function($ctx1) {
  58575. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58576. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58577. $recv(aResponse)._end();
  58578. return self;
  58579. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58580. },
  58581. args: ["aResponse"],
  58582. 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.",
  58583. referencedClasses: [],
  58584. messageSends: ["writeHead:options:", "write:", "end"]
  58585. }),
  58586. $globals.FileServer);
  58587. $core.addMethod(
  58588. $core.method({
  58589. selector: "respondNotFoundTo:",
  58590. protocol: 'request handling',
  58591. fn: function (aResponse){
  58592. var self=this;
  58593. return $core.withContext(function($ctx1) {
  58594. var $2,$1;
  58595. $2=self._fallbackPage();
  58596. $ctx1.sendIdx["fallbackPage"]=1;
  58597. $1=$recv($2)._isNil();
  58598. if(!$core.assert($1)){
  58599. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58600. };
  58601. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58602. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58603. $ctx1.sendIdx["write:"]=1;
  58604. $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>");
  58605. $ctx1.sendIdx["write:"]=2;
  58606. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58607. $ctx1.sendIdx["write:"]=3;
  58608. $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>");
  58609. $ctx1.sendIdx["write:"]=4;
  58610. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58611. $ctx1.sendIdx["write:"]=5;
  58612. $recv(aResponse)._write_("</ul></p></body></html>");
  58613. $recv(aResponse)._end();
  58614. return self;
  58615. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58616. },
  58617. args: ["aResponse"],
  58618. 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",
  58619. referencedClasses: [],
  58620. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58621. }),
  58622. $globals.FileServer);
  58623. $core.addMethod(
  58624. $core.method({
  58625. selector: "respondOKTo:",
  58626. protocol: 'request handling',
  58627. fn: function (aResponse){
  58628. var self=this;
  58629. return $core.withContext(function($ctx1) {
  58630. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58631. $recv(aResponse)._end();
  58632. return self;
  58633. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58634. },
  58635. args: ["aResponse"],
  58636. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58637. referencedClasses: [],
  58638. messageSends: ["writeHead:options:", "end"]
  58639. }),
  58640. $globals.FileServer);
  58641. $core.addMethod(
  58642. $core.method({
  58643. selector: "respondRedirect:to:",
  58644. protocol: 'request handling',
  58645. fn: function (aString,aResponse){
  58646. var self=this;
  58647. return $core.withContext(function($ctx1) {
  58648. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58649. $recv(aResponse)._end();
  58650. return self;
  58651. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58652. },
  58653. args: ["aString", "aResponse"],
  58654. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58655. referencedClasses: [],
  58656. messageSends: ["writeHead:options:", "end"]
  58657. }),
  58658. $globals.FileServer);
  58659. $core.addMethod(
  58660. $core.method({
  58661. selector: "start",
  58662. protocol: 'starting',
  58663. fn: function (){
  58664. var self=this;
  58665. return $core.withContext(function($ctx1) {
  58666. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58667. self._checkDirectoryLayout();
  58668. $1=$recv(self["@http"])._createServer_((function(request,response){
  58669. return $core.withContext(function($ctx2) {
  58670. return self._handleRequest_respondTo_(request,response);
  58671. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58672. }));
  58673. $recv($1)._on_do_("error",(function(error){
  58674. return $core.withContext(function($ctx2) {
  58675. $2=console;
  58676. $3="Error starting server: ".__comma(error);
  58677. $ctx2.sendIdx[","]=1;
  58678. return $recv($2)._log_($3);
  58679. $ctx2.sendIdx["log:"]=1;
  58680. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58681. }));
  58682. $ctx1.sendIdx["on:do:"]=1;
  58683. $recv($1)._on_do_("listening",(function(){
  58684. return $core.withContext(function($ctx2) {
  58685. $4=console;
  58686. $8=self._host();
  58687. $ctx2.sendIdx["host"]=1;
  58688. $7="Starting file server on http://".__comma($8);
  58689. $6=$recv($7).__comma(":");
  58690. $ctx2.sendIdx[","]=3;
  58691. $10=self._port();
  58692. $ctx2.sendIdx["port"]=1;
  58693. $9=$recv($10)._asString();
  58694. $5=$recv($6).__comma($9);
  58695. $ctx2.sendIdx[","]=2;
  58696. return $recv($4)._log_($5);
  58697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58698. }));
  58699. $recv($1)._listen_host_(self._port(),self._host());
  58700. return self;
  58701. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58702. },
  58703. args: [],
  58704. 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.",
  58705. referencedClasses: [],
  58706. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58707. }),
  58708. $globals.FileServer);
  58709. $core.addMethod(
  58710. $core.method({
  58711. selector: "startOn:",
  58712. protocol: 'starting',
  58713. fn: function (aPort){
  58714. var self=this;
  58715. return $core.withContext(function($ctx1) {
  58716. self._port_(aPort);
  58717. self._start();
  58718. return self;
  58719. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58720. },
  58721. args: ["aPort"],
  58722. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58723. referencedClasses: [],
  58724. messageSends: ["port:", "start"]
  58725. }),
  58726. $globals.FileServer);
  58727. $core.addMethod(
  58728. $core.method({
  58729. selector: "username:",
  58730. protocol: 'accessing',
  58731. fn: function (aUsername){
  58732. var self=this;
  58733. self["@username"]=aUsername;
  58734. return self;
  58735. },
  58736. args: ["aUsername"],
  58737. source: "username: aUsername\x0a\x09username := aUsername.",
  58738. referencedClasses: [],
  58739. messageSends: []
  58740. }),
  58741. $globals.FileServer);
  58742. $core.addMethod(
  58743. $core.method({
  58744. selector: "validateBasePath",
  58745. protocol: 'private',
  58746. fn: function (){
  58747. var self=this;
  58748. return $core.withContext(function($ctx1) {
  58749. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58750. $1=self["@fs"];
  58751. $2=self._basePath();
  58752. $ctx1.sendIdx["basePath"]=1;
  58753. $recv($1)._stat_then_($2,(function(err,stat){
  58754. return $core.withContext(function($ctx2) {
  58755. if(($receiver = err) == null || $receiver.isNil){
  58756. $3=$recv(stat)._isDirectory();
  58757. if(!$core.assert($3)){
  58758. $4=console;
  58759. $7=self._basePath();
  58760. $ctx2.sendIdx["basePath"]=2;
  58761. $6="Warning: --base-path parameter ".__comma($7);
  58762. $ctx2.sendIdx[","]=2;
  58763. $5=$recv($6).__comma(" is not a directory.");
  58764. $ctx2.sendIdx[","]=1;
  58765. return $recv($4)._warn_($5);
  58766. $ctx2.sendIdx["warn:"]=1;
  58767. };
  58768. } else {
  58769. $8=console;
  58770. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58771. $ctx2.sendIdx[","]=3;
  58772. return $recv($8)._warn_($9);
  58773. };
  58774. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58775. }));
  58776. return self;
  58777. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58778. },
  58779. args: [],
  58780. 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.' ]].",
  58781. referencedClasses: [],
  58782. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58783. }),
  58784. $globals.FileServer);
  58785. $core.addMethod(
  58786. $core.method({
  58787. selector: "withBasePath:",
  58788. protocol: 'private',
  58789. fn: function (aBaseRelativePath){
  58790. var self=this;
  58791. return $core.withContext(function($ctx1) {
  58792. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58793. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58794. },
  58795. args: ["aBaseRelativePath"],
  58796. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58797. referencedClasses: [],
  58798. messageSends: ["join:with:", "basePath"]
  58799. }),
  58800. $globals.FileServer);
  58801. $core.addMethod(
  58802. $core.method({
  58803. selector: "writeData:toFileNamed:",
  58804. protocol: 'private',
  58805. fn: function (data,aFilename){
  58806. var self=this;
  58807. return $core.withContext(function($ctx1) {
  58808. $recv(console)._log_(aFilename);
  58809. return self;
  58810. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58811. },
  58812. args: ["data", "aFilename"],
  58813. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58814. referencedClasses: [],
  58815. messageSends: ["log:"]
  58816. }),
  58817. $globals.FileServer);
  58818. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58819. $core.addMethod(
  58820. $core.method({
  58821. selector: "commandLineSwitches",
  58822. protocol: 'accessing',
  58823. fn: function (){
  58824. var self=this;
  58825. var switches;
  58826. return $core.withContext(function($ctx1) {
  58827. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58828. return $core.withContext(function($ctx2) {
  58829. return $recv(each)._selector();
  58830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58831. }));
  58832. $ctx1.sendIdx["collect:"]=1;
  58833. switches=$recv(switches)._select_((function(each){
  58834. return $core.withContext(function($ctx2) {
  58835. return $recv(each)._match_("^[^:]*:$");
  58836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58837. }));
  58838. switches=$recv(switches)._collect_((function(each){
  58839. return $core.withContext(function($ctx2) {
  58840. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58841. $ctx2.sendIdx["replace:with:"]=1;
  58842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58843. }));
  58844. return switches;
  58845. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58846. },
  58847. args: [],
  58848. 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",
  58849. referencedClasses: [],
  58850. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58851. }),
  58852. $globals.FileServer.klass);
  58853. $core.addMethod(
  58854. $core.method({
  58855. selector: "createServerWithArguments:",
  58856. protocol: 'initialization',
  58857. fn: function (options){
  58858. var self=this;
  58859. var server,popFront,front,optionName,optionValue,switches;
  58860. return $core.withContext(function($ctx1) {
  58861. var $1,$2,$3,$4,$5,$6,$7,$8;
  58862. var $early={};
  58863. try {
  58864. switches=self._commandLineSwitches();
  58865. server=self._new();
  58866. $recv(options)._ifEmpty_((function(){
  58867. throw $early=[server];
  58868. }));
  58869. $1=$recv($recv(options)._size())._even();
  58870. if(!$core.assert($1)){
  58871. $recv(console)._log_("Using default parameters.");
  58872. $ctx1.sendIdx["log:"]=1;
  58873. $2=console;
  58874. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58875. $ctx1.sendIdx[","]=1;
  58876. $recv($2)._log_($3);
  58877. $ctx1.sendIdx["log:"]=2;
  58878. $4=console;
  58879. $5="Use any of the following ones: ".__comma(switches);
  58880. $ctx1.sendIdx[","]=2;
  58881. $recv($4)._log_($5);
  58882. $ctx1.sendIdx["log:"]=3;
  58883. return server;
  58884. };
  58885. popFront=(function(args){
  58886. return $core.withContext(function($ctx2) {
  58887. front=$recv(args)._first();
  58888. front;
  58889. $recv(args)._remove_(front);
  58890. return front;
  58891. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58892. });
  58893. $recv((function(){
  58894. return $core.withContext(function($ctx2) {
  58895. return $recv(options)._notEmpty();
  58896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58897. }))._whileTrue_((function(){
  58898. return $core.withContext(function($ctx2) {
  58899. optionName=$recv(popFront)._value_(options);
  58900. $ctx2.sendIdx["value:"]=1;
  58901. optionName;
  58902. optionValue=$recv(popFront)._value_(options);
  58903. optionValue;
  58904. $6=$recv(switches)._includes_(optionName);
  58905. if($core.assert($6)){
  58906. optionName=self._selectorForCommandLineSwitch_(optionName);
  58907. optionName;
  58908. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  58909. } else {
  58910. $7=console;
  58911. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58912. $ctx2.sendIdx[","]=3;
  58913. $recv($7)._log_($8);
  58914. $ctx2.sendIdx["log:"]=4;
  58915. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58916. };
  58917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58918. }));
  58919. return server;
  58920. }
  58921. catch(e) {if(e===$early)return e[0]; throw e}
  58922. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58923. },
  58924. args: ["options"],
  58925. 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.",
  58926. referencedClasses: ["Array"],
  58927. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58928. }),
  58929. $globals.FileServer.klass);
  58930. $core.addMethod(
  58931. $core.method({
  58932. selector: "defaultBasePath",
  58933. protocol: 'accessing',
  58934. fn: function (){
  58935. var self=this;
  58936. return "./";
  58937. },
  58938. args: [],
  58939. source: "defaultBasePath\x0a\x09^ './'",
  58940. referencedClasses: [],
  58941. messageSends: []
  58942. }),
  58943. $globals.FileServer.klass);
  58944. $core.addMethod(
  58945. $core.method({
  58946. selector: "defaultHost",
  58947. protocol: 'accessing',
  58948. fn: function (){
  58949. var self=this;
  58950. return "127.0.0.1";
  58951. },
  58952. args: [],
  58953. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58954. referencedClasses: [],
  58955. messageSends: []
  58956. }),
  58957. $globals.FileServer.klass);
  58958. $core.addMethod(
  58959. $core.method({
  58960. selector: "defaultMimeTypes",
  58961. protocol: 'accessing',
  58962. fn: function (){
  58963. var self=this;
  58964. 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"]);
  58965. },
  58966. args: [],
  58967. 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}",
  58968. referencedClasses: [],
  58969. messageSends: []
  58970. }),
  58971. $globals.FileServer.klass);
  58972. $core.addMethod(
  58973. $core.method({
  58974. selector: "defaultPort",
  58975. protocol: 'accessing',
  58976. fn: function (){
  58977. var self=this;
  58978. return (4000);
  58979. },
  58980. args: [],
  58981. source: "defaultPort\x0a\x09^ 4000",
  58982. referencedClasses: [],
  58983. messageSends: []
  58984. }),
  58985. $globals.FileServer.klass);
  58986. $core.addMethod(
  58987. $core.method({
  58988. selector: "main",
  58989. protocol: 'initialization',
  58990. fn: function (){
  58991. var self=this;
  58992. var fileServer,args;
  58993. return $core.withContext(function($ctx1) {
  58994. var $1;
  58995. var $early={};
  58996. try {
  58997. args=$recv(process)._argv();
  58998. $recv(args)._removeFrom_to_((1),(3));
  58999. $recv(args)._detect_ifNone_((function(each){
  59000. return $core.withContext(function($ctx2) {
  59001. $1=$recv(each).__eq("--help");
  59002. if($core.assert($1)){
  59003. return $recv($globals.FileServer)._printHelp();
  59004. };
  59005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59006. }),(function(){
  59007. return $core.withContext(function($ctx2) {
  59008. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  59009. fileServer;
  59010. throw $early=[$recv(fileServer)._start()];
  59011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59012. }));
  59013. return self;
  59014. }
  59015. catch(e) {if(e===$early)return e[0]; throw e}
  59016. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  59017. },
  59018. args: [],
  59019. 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]",
  59020. referencedClasses: ["FileServer"],
  59021. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  59022. }),
  59023. $globals.FileServer.klass);
  59024. $core.addMethod(
  59025. $core.method({
  59026. selector: "mimeTypeFor:",
  59027. protocol: 'accessing',
  59028. fn: function (aString){
  59029. var self=this;
  59030. return $core.withContext(function($ctx1) {
  59031. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  59032. return "text/plain";
  59033. }));
  59034. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  59035. },
  59036. args: ["aString"],
  59037. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  59038. referencedClasses: [],
  59039. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  59040. }),
  59041. $globals.FileServer.klass);
  59042. $core.addMethod(
  59043. $core.method({
  59044. selector: "mimeTypes",
  59045. protocol: 'accessing',
  59046. fn: function (){
  59047. var self=this;
  59048. return $core.withContext(function($ctx1) {
  59049. var $1,$receiver;
  59050. $1=self["@mimeTypes"];
  59051. if(($receiver = $1) == null || $receiver.isNil){
  59052. self["@mimeTypes"]=self._defaultMimeTypes();
  59053. return self["@mimeTypes"];
  59054. } else {
  59055. return $1;
  59056. };
  59057. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  59058. },
  59059. args: [],
  59060. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  59061. referencedClasses: [],
  59062. messageSends: ["ifNil:", "defaultMimeTypes"]
  59063. }),
  59064. $globals.FileServer.klass);
  59065. $core.addMethod(
  59066. $core.method({
  59067. selector: "printHelp",
  59068. protocol: 'accessing',
  59069. fn: function (){
  59070. var self=this;
  59071. return $core.withContext(function($ctx1) {
  59072. $recv(console)._log_("Available commandline options are:");
  59073. $ctx1.sendIdx["log:"]=1;
  59074. $recv(console)._log_("--help");
  59075. $ctx1.sendIdx["log:"]=2;
  59076. $recv(self._commandLineSwitches())._do_((function(each){
  59077. return $core.withContext(function($ctx2) {
  59078. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  59079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59080. }));
  59081. return self;
  59082. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  59083. },
  59084. args: [],
  59085. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  59086. referencedClasses: [],
  59087. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  59088. }),
  59089. $globals.FileServer.klass);
  59090. $core.addMethod(
  59091. $core.method({
  59092. selector: "selectorForCommandLineSwitch:",
  59093. protocol: 'accessing',
  59094. fn: function (aSwitch){
  59095. var self=this;
  59096. return $core.withContext(function($ctx1) {
  59097. var $1;
  59098. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59099. return $core.withContext(function($ctx2) {
  59100. return $recv($recv(each)._second())._asUppercase();
  59101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59102. }));
  59103. $ctx1.sendIdx["replace:with:"]=1;
  59104. return $recv($1).__comma(":");
  59105. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59106. },
  59107. args: ["aSwitch"],
  59108. 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 ]), ':'",
  59109. referencedClasses: [],
  59110. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59111. }),
  59112. $globals.FileServer.klass);
  59113. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59114. $core.addMethod(
  59115. $core.method({
  59116. selector: "bowerInstallThenDo:",
  59117. protocol: 'action',
  59118. fn: function (aBlock){
  59119. var self=this;
  59120. var child;
  59121. return $core.withContext(function($ctx1) {
  59122. var $1,$3,$2;
  59123. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59124. $1=child;
  59125. $recv($1)._on_do_("error",aBlock);
  59126. $ctx1.sendIdx["on:do:"]=1;
  59127. $recv($1)._on_do_("close",(function(code){
  59128. return $core.withContext(function($ctx2) {
  59129. $3=$recv(code).__eq((0));
  59130. if($core.assert($3)){
  59131. $2=nil;
  59132. } else {
  59133. $2=code;
  59134. };
  59135. return $recv(aBlock)._value_($2);
  59136. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59137. }));
  59138. return self;
  59139. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59140. },
  59141. args: ["aBlock"],
  59142. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59143. referencedClasses: [],
  59144. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59145. }),
  59146. $globals.Initer);
  59147. $core.addMethod(
  59148. $core.method({
  59149. selector: "finishMessage",
  59150. protocol: 'action',
  59151. fn: function (){
  59152. var self=this;
  59153. return $core.withContext(function($ctx1) {
  59154. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  59155. $recv((function(){
  59156. }))._valueWithTimeout_((600));
  59157. return self;
  59158. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59159. },
  59160. args: [],
  59161. 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",
  59162. referencedClasses: ["String"],
  59163. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59164. }),
  59165. $globals.Initer);
  59166. $core.addMethod(
  59167. $core.method({
  59168. selector: "gruntInitThenDo:",
  59169. protocol: 'action',
  59170. fn: function (aBlock){
  59171. var self=this;
  59172. var child,sanitizedTemplatePath;
  59173. return $core.withContext(function($ctx1) {
  59174. var $1,$3,$2;
  59175. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59176. $ctx1.sendIdx["replace:with:"]=1;
  59177. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59178. $1=child;
  59179. $recv($1)._on_do_("error",aBlock);
  59180. $ctx1.sendIdx["on:do:"]=1;
  59181. $recv($1)._on_do_("close",(function(code){
  59182. return $core.withContext(function($ctx2) {
  59183. $3=$recv(code).__eq((0));
  59184. if($core.assert($3)){
  59185. $2=nil;
  59186. } else {
  59187. $2=code;
  59188. };
  59189. return $recv(aBlock)._value_($2);
  59190. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59191. }));
  59192. return self;
  59193. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  59194. },
  59195. args: ["aBlock"],
  59196. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59197. referencedClasses: [],
  59198. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59199. }),
  59200. $globals.Initer);
  59201. $core.addMethod(
  59202. $core.method({
  59203. selector: "gruntThenDo:",
  59204. protocol: 'action',
  59205. fn: function (aBlock){
  59206. var self=this;
  59207. var child;
  59208. return $core.withContext(function($ctx1) {
  59209. var $1,$3,$2;
  59210. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  59211. $1=child;
  59212. $recv($1)._on_do_("error",aBlock);
  59213. $ctx1.sendIdx["on:do:"]=1;
  59214. $recv($1)._on_do_("close",(function(code){
  59215. return $core.withContext(function($ctx2) {
  59216. $3=$recv(code).__eq((0));
  59217. if($core.assert($3)){
  59218. $2=nil;
  59219. } else {
  59220. $2=code;
  59221. };
  59222. return $recv(aBlock)._value_($2);
  59223. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59224. }));
  59225. return self;
  59226. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59227. },
  59228. args: ["aBlock"],
  59229. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  59230. referencedClasses: [],
  59231. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59232. }),
  59233. $globals.Initer);
  59234. $core.addMethod(
  59235. $core.method({
  59236. selector: "initialize",
  59237. protocol: 'initialization',
  59238. fn: function (){
  59239. var self=this;
  59240. return $core.withContext(function($ctx1) {
  59241. (
  59242. $ctx1.supercall = true,
  59243. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59244. $ctx1.supercall = false;
  59245. self["@childProcess"]=$recv(require)._value_("child_process");
  59246. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  59247. return self;
  59248. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  59249. },
  59250. args: [],
  59251. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  59252. referencedClasses: [],
  59253. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  59254. }),
  59255. $globals.Initer);
  59256. $core.addMethod(
  59257. $core.method({
  59258. selector: "npmInstallThenDo:",
  59259. protocol: 'action',
  59260. fn: function (aBlock){
  59261. var self=this;
  59262. var child;
  59263. return $core.withContext(function($ctx1) {
  59264. var $1;
  59265. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  59266. $1=$recv(child)._stdout();
  59267. $ctx1.sendIdx["stdout"]=1;
  59268. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  59269. return self;
  59270. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59271. },
  59272. args: ["aBlock"],
  59273. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  59274. referencedClasses: [],
  59275. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  59276. }),
  59277. $globals.Initer);
  59278. $core.addMethod(
  59279. $core.method({
  59280. selector: "npmScriptForModule:named:",
  59281. protocol: 'npm',
  59282. fn: function (aString,anotherString){
  59283. var self=this;
  59284. var modulePath,packageJson,binSection,scriptPath;
  59285. return $core.withContext(function($ctx1) {
  59286. var $1,$3,$4,$2,$5;
  59287. $1=self["@path"];
  59288. $3=$recv($globals.JSObjectProxy)._on_(require);
  59289. $4=$recv(aString).__comma("/package.json");
  59290. $ctx1.sendIdx[","]=1;
  59291. $2=$recv($3)._resolve_($4);
  59292. modulePath=$recv($1)._dirname_($2);
  59293. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  59294. binSection=$recv(packageJson)._at_("bin");
  59295. $ctx1.sendIdx["at:"]=1;
  59296. $5=$recv(binSection)._isString();
  59297. if($core.assert($5)){
  59298. scriptPath=binSection;
  59299. } else {
  59300. scriptPath=$recv(binSection)._at_(anotherString);
  59301. };
  59302. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  59303. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  59304. },
  59305. args: ["aString", "anotherString"],
  59306. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  59307. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  59308. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  59309. }),
  59310. $globals.Initer);
  59311. $core.addMethod(
  59312. $core.method({
  59313. selector: "start",
  59314. protocol: 'action',
  59315. fn: function (){
  59316. var self=this;
  59317. return $core.withContext(function($ctx1) {
  59318. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  59319. self._gruntInitThenDo_((function(error){
  59320. return $core.withContext(function($ctx2) {
  59321. if(($receiver = error) == null || $receiver.isNil){
  59322. return self._bowerInstallThenDo_((function(error2){
  59323. return $core.withContext(function($ctx3) {
  59324. if(($receiver = error2) == null || $receiver.isNil){
  59325. return self._npmInstallThenDo_((function(error3){
  59326. return $core.withContext(function($ctx4) {
  59327. if(($receiver = error3) == null || $receiver.isNil){
  59328. return self._gruntThenDo_((function(error4){
  59329. return $core.withContext(function($ctx5) {
  59330. if(($receiver = error4) == null || $receiver.isNil){
  59331. self._finishMessage();
  59332. return $recv(process)._exit();
  59333. } else {
  59334. $7=console;
  59335. $recv($7)._log_("grunt exec error:");
  59336. $ctx5.sendIdx["log:"]=7;
  59337. $recv($7)._log_(error4);
  59338. return $recv(process)._exit_((104));
  59339. };
  59340. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  59341. }));
  59342. } else {
  59343. $5=console;
  59344. $recv($5)._log_("npm install exec error:");
  59345. $ctx4.sendIdx["log:"]=5;
  59346. $6=$recv($5)._log_(error3);
  59347. $ctx4.sendIdx["log:"]=6;
  59348. $6;
  59349. return $recv(process)._exit_((103));
  59350. $ctx4.sendIdx["exit:"]=3;
  59351. };
  59352. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  59353. }));
  59354. } else {
  59355. $3=console;
  59356. $recv($3)._log_("bower install exec error:");
  59357. $ctx3.sendIdx["log:"]=3;
  59358. $4=$recv($3)._log_(error2);
  59359. $ctx3.sendIdx["log:"]=4;
  59360. $4;
  59361. return $recv(process)._exit_((102));
  59362. $ctx3.sendIdx["exit:"]=2;
  59363. };
  59364. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59365. }));
  59366. } else {
  59367. $1=console;
  59368. $recv($1)._log_("grunt-init exec error:");
  59369. $ctx2.sendIdx["log:"]=1;
  59370. $2=$recv($1)._log_(error);
  59371. $ctx2.sendIdx["log:"]=2;
  59372. $2;
  59373. return $recv(process)._exit_((101));
  59374. $ctx2.sendIdx["exit:"]=1;
  59375. };
  59376. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59377. }));
  59378. return self;
  59379. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59380. },
  59381. args: [],
  59382. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  59383. referencedClasses: [],
  59384. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59385. }),
  59386. $globals.Initer);
  59387. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59388. $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.";
  59389. $core.addMethod(
  59390. $core.method({
  59391. selector: "addVariableNamed:to:",
  59392. protocol: 'private',
  59393. fn: function (aString,anObject){
  59394. var self=this;
  59395. var newClass,newObject;
  59396. return $core.withContext(function($ctx1) {
  59397. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59398. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59399. newObject=$recv(newClass)._new();
  59400. self._setPreviousVariablesFor_from_(newObject,anObject);
  59401. return newObject;
  59402. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59403. },
  59404. args: ["aString", "anObject"],
  59405. 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",
  59406. referencedClasses: [],
  59407. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59408. }),
  59409. $globals.Repl);
  59410. $core.addMethod(
  59411. $core.method({
  59412. selector: "assignNewVariable:do:",
  59413. protocol: 'private',
  59414. fn: function (buffer,aBlock){
  59415. var self=this;
  59416. return $core.withContext(function($ctx1) {
  59417. var $2,$3,$1,$receiver;
  59418. return self._parseAssignment_do_(buffer,(function(name,expr){
  59419. var varName,value;
  59420. return $core.withContext(function($ctx2) {
  59421. if(($receiver = name) == null || $receiver.isNil){
  59422. varName=self._nextResultName();
  59423. } else {
  59424. varName=name;
  59425. };
  59426. varName;
  59427. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59428. self["@session"];
  59429. $recv((function(){
  59430. return $core.withContext(function($ctx3) {
  59431. $2=$recv(varName).__comma(" := ");
  59432. if(($receiver = expr) == null || $receiver.isNil){
  59433. $3=buffer;
  59434. } else {
  59435. $3=expr;
  59436. };
  59437. $1=$recv($2).__comma($3);
  59438. $ctx3.sendIdx[","]=1;
  59439. value=self._eval_on_($1,self["@session"]);
  59440. return value;
  59441. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59442. }))._on_do_($globals.Error,(function(e){
  59443. return $core.withContext(function($ctx3) {
  59444. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59445. value=nil;
  59446. return value;
  59447. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59448. }));
  59449. return $recv(aBlock)._value_value_(varName,value);
  59450. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59451. }));
  59452. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59453. },
  59454. args: ["buffer", "aBlock"],
  59455. 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]",
  59456. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59457. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59458. }),
  59459. $globals.Repl);
  59460. $core.addMethod(
  59461. $core.method({
  59462. selector: "clearScreen",
  59463. protocol: 'actions',
  59464. fn: function (){
  59465. var self=this;
  59466. var esc,cls;
  59467. return $core.withContext(function($ctx1) {
  59468. var $1;
  59469. esc=$recv($globals.String)._fromCharCode_((27));
  59470. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59471. $ctx1.sendIdx[","]=2;
  59472. cls=$recv($1).__comma("[0;0f");
  59473. $ctx1.sendIdx[","]=1;
  59474. $recv($recv(process)._stdout())._write_(cls);
  59475. $recv(self["@interface"])._prompt();
  59476. return self;
  59477. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59478. },
  59479. args: [],
  59480. 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",
  59481. referencedClasses: ["String"],
  59482. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59483. }),
  59484. $globals.Repl);
  59485. $core.addMethod(
  59486. $core.method({
  59487. selector: "close",
  59488. protocol: 'actions',
  59489. fn: function (){
  59490. var self=this;
  59491. return $core.withContext(function($ctx1) {
  59492. $recv($recv(process)._stdin())._destroy();
  59493. return self;
  59494. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59495. },
  59496. args: [],
  59497. source: "close\x0a\x09process stdin destroy",
  59498. referencedClasses: [],
  59499. messageSends: ["destroy", "stdin"]
  59500. }),
  59501. $globals.Repl);
  59502. $core.addMethod(
  59503. $core.method({
  59504. selector: "commands",
  59505. protocol: 'accessing',
  59506. fn: function (){
  59507. var self=this;
  59508. return self["@commands"];
  59509. },
  59510. args: [],
  59511. source: "commands\x0a\x09^ commands",
  59512. referencedClasses: [],
  59513. messageSends: []
  59514. }),
  59515. $globals.Repl);
  59516. $core.addMethod(
  59517. $core.method({
  59518. selector: "createInterface",
  59519. protocol: 'actions',
  59520. fn: function (){
  59521. var self=this;
  59522. return $core.withContext(function($ctx1) {
  59523. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59524. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59525. return $core.withContext(function($ctx2) {
  59526. return self._processLine_(buffer);
  59527. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59528. }));
  59529. $ctx1.sendIdx["on:do:"]=1;
  59530. $recv(self["@interface"])._on_do_("close",(function(){
  59531. return $core.withContext(function($ctx2) {
  59532. return self._close();
  59533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59534. }));
  59535. self._printWelcome();
  59536. self._setupHotkeys();
  59537. self._setPrompt();
  59538. $recv(self["@interface"])._prompt();
  59539. return self;
  59540. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59541. },
  59542. args: [],
  59543. 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",
  59544. referencedClasses: [],
  59545. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59546. }),
  59547. $globals.Repl);
  59548. $core.addMethod(
  59549. $core.method({
  59550. selector: "encapsulateVariable:withValue:in:",
  59551. protocol: 'private',
  59552. fn: function (aString,anObject,aClass){
  59553. var self=this;
  59554. var compiler;
  59555. return $core.withContext(function($ctx1) {
  59556. var $1,$4,$3,$2,$5,$6;
  59557. compiler=$recv($globals.Compiler)._new();
  59558. $1=compiler;
  59559. $4=$recv(aString).__comma(": anObject ^ ");
  59560. $ctx1.sendIdx[","]=3;
  59561. $3=$recv($4).__comma(aString);
  59562. $ctx1.sendIdx[","]=2;
  59563. $2=$recv($3).__comma(" := anObject");
  59564. $ctx1.sendIdx[","]=1;
  59565. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59566. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59567. $5=compiler;
  59568. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59569. $ctx1.sendIdx[","]=4;
  59570. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59571. return self;
  59572. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59573. },
  59574. args: ["aString", "anObject", "aClass"],
  59575. 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'.",
  59576. referencedClasses: ["Compiler"],
  59577. messageSends: ["new", "install:forClass:protocol:", ","]
  59578. }),
  59579. $globals.Repl);
  59580. $core.addMethod(
  59581. $core.method({
  59582. selector: "eval:",
  59583. protocol: 'actions',
  59584. fn: function (buffer){
  59585. var self=this;
  59586. return $core.withContext(function($ctx1) {
  59587. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59588. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59589. },
  59590. args: ["buffer"],
  59591. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59592. referencedClasses: ["DoIt"],
  59593. messageSends: ["eval:on:", "new"]
  59594. }),
  59595. $globals.Repl);
  59596. $core.addMethod(
  59597. $core.method({
  59598. selector: "eval:on:",
  59599. protocol: 'actions',
  59600. fn: function (buffer,anObject){
  59601. var self=this;
  59602. var result;
  59603. return $core.withContext(function($ctx1) {
  59604. var $1,$2;
  59605. $1=$recv(buffer)._isEmpty();
  59606. if(!$core.assert($1)){
  59607. $recv((function(){
  59608. return $core.withContext(function($ctx2) {
  59609. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59610. return result;
  59611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59612. }))._tryCatch_((function(e){
  59613. return $core.withContext(function($ctx2) {
  59614. $2=$recv(e)._isSmalltalkError();
  59615. if($core.assert($2)){
  59616. return $recv(e)._resignal();
  59617. } else {
  59618. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59619. };
  59620. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  59621. }));
  59622. };
  59623. return result;
  59624. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59625. },
  59626. args: ["buffer", "anObject"],
  59627. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  59628. referencedClasses: ["Compiler"],
  59629. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59630. }),
  59631. $globals.Repl);
  59632. $core.addMethod(
  59633. $core.method({
  59634. selector: "executeCommand:",
  59635. protocol: 'private',
  59636. fn: function (aString){
  59637. var self=this;
  59638. return $core.withContext(function($ctx1) {
  59639. var $1;
  59640. var $early={};
  59641. try {
  59642. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59643. return $core.withContext(function($ctx2) {
  59644. $1=$recv(names)._includes_(aString);
  59645. if($core.assert($1)){
  59646. $recv(cmd)._value();
  59647. throw $early=[true];
  59648. };
  59649. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59650. }));
  59651. return false;
  59652. }
  59653. catch(e) {if(e===$early)return e[0]; throw e}
  59654. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59655. },
  59656. args: ["aString"],
  59657. 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",
  59658. referencedClasses: [],
  59659. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59660. }),
  59661. $globals.Repl);
  59662. $core.addMethod(
  59663. $core.method({
  59664. selector: "initialize",
  59665. protocol: 'initialization',
  59666. fn: function (){
  59667. var self=this;
  59668. return $core.withContext(function($ctx1) {
  59669. (
  59670. $ctx1.supercall = true,
  59671. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59672. $ctx1.supercall = false;
  59673. self["@session"]=$recv($globals.DoIt)._new();
  59674. self["@readline"]=$recv(require)._value_("readline");
  59675. $ctx1.sendIdx["value:"]=1;
  59676. self["@util"]=$recv(require)._value_("util");
  59677. self._setupCommands();
  59678. return self;
  59679. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59680. },
  59681. args: [],
  59682. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59683. referencedClasses: ["DoIt"],
  59684. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59685. }),
  59686. $globals.Repl);
  59687. $core.addMethod(
  59688. $core.method({
  59689. selector: "instanceVariableNamesFor:",
  59690. protocol: 'private',
  59691. fn: function (aClass){
  59692. var self=this;
  59693. return $core.withContext(function($ctx1) {
  59694. var $1,$2,$receiver;
  59695. $1=$recv(aClass)._superclass();
  59696. $ctx1.sendIdx["superclass"]=1;
  59697. if(($receiver = $1) == null || $receiver.isNil){
  59698. return $recv(aClass)._instanceVariableNames();
  59699. } else {
  59700. $2=$recv(aClass)._instanceVariableNames();
  59701. $ctx1.sendIdx["instanceVariableNames"]=1;
  59702. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59703. };
  59704. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59705. },
  59706. args: ["aClass"],
  59707. 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]",
  59708. referencedClasses: [],
  59709. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59710. }),
  59711. $globals.Repl);
  59712. $core.addMethod(
  59713. $core.method({
  59714. selector: "isIdentifier:",
  59715. protocol: 'private',
  59716. fn: function (aString){
  59717. var self=this;
  59718. return $core.withContext(function($ctx1) {
  59719. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59720. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59721. },
  59722. args: ["aString"],
  59723. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59724. referencedClasses: [],
  59725. messageSends: ["match:", "asRegexp"]
  59726. }),
  59727. $globals.Repl);
  59728. $core.addMethod(
  59729. $core.method({
  59730. selector: "isVariableDefined:",
  59731. protocol: 'private',
  59732. fn: function (aString){
  59733. var self=this;
  59734. return $core.withContext(function($ctx1) {
  59735. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59736. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59737. },
  59738. args: ["aString"],
  59739. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59740. referencedClasses: [],
  59741. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59742. }),
  59743. $globals.Repl);
  59744. $core.addMethod(
  59745. $core.method({
  59746. selector: "nextResultName",
  59747. protocol: 'private',
  59748. fn: function (){
  59749. var self=this;
  59750. return $core.withContext(function($ctx1) {
  59751. var $1,$receiver;
  59752. $1=self["@resultCount"];
  59753. if(($receiver = $1) == null || $receiver.isNil){
  59754. self["@resultCount"]=(1);
  59755. } else {
  59756. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59757. };
  59758. return "res".__comma($recv(self["@resultCount"])._asString());
  59759. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59760. },
  59761. args: [],
  59762. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59763. referencedClasses: [],
  59764. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59765. }),
  59766. $globals.Repl);
  59767. $core.addMethod(
  59768. $core.method({
  59769. selector: "onKeyPress:",
  59770. protocol: 'private',
  59771. fn: function (key){
  59772. var self=this;
  59773. return $core.withContext(function($ctx1) {
  59774. var $1;
  59775. $1=$recv($recv(key)._ctrl())._and_((function(){
  59776. return $core.withContext(function($ctx2) {
  59777. return $recv($recv(key)._name()).__eq("l");
  59778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59779. }));
  59780. if($core.assert($1)){
  59781. self._clearScreen();
  59782. };
  59783. return self;
  59784. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59785. },
  59786. args: ["key"],
  59787. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59788. referencedClasses: [],
  59789. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59790. }),
  59791. $globals.Repl);
  59792. $core.addMethod(
  59793. $core.method({
  59794. selector: "parseAssignment:do:",
  59795. protocol: 'private',
  59796. fn: function (aString,aBlock){
  59797. var self=this;
  59798. var assignment;
  59799. return $core.withContext(function($ctx1) {
  59800. var $2,$1;
  59801. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59802. return $core.withContext(function($ctx2) {
  59803. return $recv(s)._trimBoth();
  59804. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59805. }));
  59806. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59807. return $core.withContext(function($ctx2) {
  59808. $2=$recv(assignment)._first();
  59809. $ctx2.sendIdx["first"]=1;
  59810. return self._isIdentifier_($2);
  59811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59812. }));
  59813. if($core.assert($1)){
  59814. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59815. $ctx1.sendIdx["value:value:"]=1;
  59816. } else {
  59817. return $recv(aBlock)._value_value_(nil,nil);
  59818. };
  59819. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59820. },
  59821. args: ["aString", "aBlock"],
  59822. 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 ]",
  59823. referencedClasses: [],
  59824. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59825. }),
  59826. $globals.Repl);
  59827. $core.addMethod(
  59828. $core.method({
  59829. selector: "presentResultNamed:withValue:",
  59830. protocol: 'private',
  59831. fn: function (varName,value){
  59832. var self=this;
  59833. return $core.withContext(function($ctx1) {
  59834. var $3,$2,$1;
  59835. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59836. $ctx1.sendIdx[","]=3;
  59837. $2=$recv($3).__comma(" = ");
  59838. $ctx1.sendIdx[","]=2;
  59839. $1=$recv($2).__comma($recv(value)._asString());
  59840. $ctx1.sendIdx[","]=1;
  59841. $recv($globals.Transcript)._show_($1);
  59842. $recv($globals.Transcript)._cr();
  59843. $recv(self["@interface"])._prompt();
  59844. return self;
  59845. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59846. },
  59847. args: ["varName", "value"],
  59848. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59849. referencedClasses: ["Transcript"],
  59850. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59851. }),
  59852. $globals.Repl);
  59853. $core.addMethod(
  59854. $core.method({
  59855. selector: "printWelcome",
  59856. protocol: 'actions',
  59857. fn: function (){
  59858. var self=this;
  59859. return $core.withContext(function($ctx1) {
  59860. $recv($globals.Transcript)._show_("Type :q to exit.");
  59861. $recv($globals.Transcript)._cr();
  59862. return self;
  59863. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59864. },
  59865. args: [],
  59866. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59867. referencedClasses: ["Transcript"],
  59868. messageSends: ["show:", "cr"]
  59869. }),
  59870. $globals.Repl);
  59871. $core.addMethod(
  59872. $core.method({
  59873. selector: "processLine:",
  59874. protocol: 'private',
  59875. fn: function (buffer){
  59876. var self=this;
  59877. var show;
  59878. return $core.withContext(function($ctx1) {
  59879. var $1,$2;
  59880. show=(function(varName,value){
  59881. return $core.withContext(function($ctx2) {
  59882. return self._presentResultNamed_withValue_(varName,value);
  59883. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59884. });
  59885. $1=self._executeCommand_(buffer);
  59886. if(!$core.assert($1)){
  59887. $2=self._isVariableDefined_(buffer);
  59888. if($core.assert($2)){
  59889. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59890. } else {
  59891. self._assignNewVariable_do_(buffer,show);
  59892. };
  59893. };
  59894. return self;
  59895. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59896. },
  59897. args: ["buffer"],
  59898. 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]]",
  59899. referencedClasses: [],
  59900. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59901. }),
  59902. $globals.Repl);
  59903. $core.addMethod(
  59904. $core.method({
  59905. selector: "prompt",
  59906. protocol: 'accessing',
  59907. fn: function (){
  59908. var self=this;
  59909. return "amber >> ";
  59910. },
  59911. args: [],
  59912. source: "prompt\x0a\x09^ 'amber >> '",
  59913. referencedClasses: [],
  59914. messageSends: []
  59915. }),
  59916. $globals.Repl);
  59917. $core.addMethod(
  59918. $core.method({
  59919. selector: "setPreviousVariablesFor:from:",
  59920. protocol: 'private',
  59921. fn: function (newObject,oldObject){
  59922. var self=this;
  59923. return $core.withContext(function($ctx1) {
  59924. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59925. return $core.withContext(function($ctx2) {
  59926. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59928. }));
  59929. return self;
  59930. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59931. },
  59932. args: ["newObject", "oldObject"],
  59933. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59934. referencedClasses: [],
  59935. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59936. }),
  59937. $globals.Repl);
  59938. $core.addMethod(
  59939. $core.method({
  59940. selector: "setPrompt",
  59941. protocol: 'actions',
  59942. fn: function (){
  59943. var self=this;
  59944. return $core.withContext(function($ctx1) {
  59945. $recv(self["@interface"])._setPrompt_(self._prompt());
  59946. return self;
  59947. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59948. },
  59949. args: [],
  59950. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59951. referencedClasses: [],
  59952. messageSends: ["setPrompt:", "prompt"]
  59953. }),
  59954. $globals.Repl);
  59955. $core.addMethod(
  59956. $core.method({
  59957. selector: "setupCommands",
  59958. protocol: 'initialization',
  59959. fn: function (){
  59960. var self=this;
  59961. return $core.withContext(function($ctx1) {
  59962. var $2,$1;
  59963. $2=$recv([":q"]).__minus_gt((function(){
  59964. return $core.withContext(function($ctx2) {
  59965. return $recv(process)._exit();
  59966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59967. }));
  59968. $ctx1.sendIdx["->"]=1;
  59969. $1=[$2,$recv([""]).__minus_gt((function(){
  59970. return $core.withContext(function($ctx2) {
  59971. return $recv(self["@interface"])._prompt();
  59972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59973. }))];
  59974. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  59975. return self;
  59976. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59977. },
  59978. args: [],
  59979. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59980. referencedClasses: ["Dictionary"],
  59981. messageSends: ["from:", "->", "exit", "prompt"]
  59982. }),
  59983. $globals.Repl);
  59984. $core.addMethod(
  59985. $core.method({
  59986. selector: "setupHotkeys",
  59987. protocol: 'initialization',
  59988. fn: function (){
  59989. var self=this;
  59990. return $core.withContext(function($ctx1) {
  59991. var $receiver;
  59992. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59993. return $core.withContext(function($ctx2) {
  59994. if(($receiver = key) == null || $receiver.isNil){
  59995. return key;
  59996. } else {
  59997. return self._onKeyPress_(key);
  59998. };
  59999. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  60000. }));
  60001. return self;
  60002. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  60003. },
  60004. args: [],
  60005. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  60006. referencedClasses: [],
  60007. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  60008. }),
  60009. $globals.Repl);
  60010. $core.addMethod(
  60011. $core.method({
  60012. selector: "subclass:withVariable:",
  60013. protocol: 'private',
  60014. fn: function (aClass,varName){
  60015. var self=this;
  60016. return $core.withContext(function($ctx1) {
  60017. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  60018. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  60019. },
  60020. args: ["aClass", "varName"],
  60021. 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'",
  60022. referencedClasses: ["ClassBuilder"],
  60023. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  60024. }),
  60025. $globals.Repl);
  60026. $core.addMethod(
  60027. $core.method({
  60028. selector: "subclassNameFor:",
  60029. protocol: 'private',
  60030. fn: function (aClass){
  60031. var self=this;
  60032. return $core.withContext(function($ctx1) {
  60033. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  60034. $2=$recv(aClass)._name();
  60035. $ctx1.sendIdx["name"]=1;
  60036. $1=$recv($2)._matchesOf_("\x5cd+$");
  60037. $ctx1.sendIdx["matchesOf:"]=1;
  60038. if(($receiver = $1) == null || $receiver.isNil){
  60039. return $recv($recv(aClass)._name()).__comma("2");
  60040. } else {
  60041. var counter;
  60042. $6=$recv(aClass)._name();
  60043. $ctx1.sendIdx["name"]=2;
  60044. $5=$recv($6)._matchesOf_("\x5cd+$");
  60045. $4=$recv($5)._first();
  60046. $3=$recv($4)._asNumber();
  60047. counter=$recv($3).__plus((1));
  60048. counter;
  60049. $7=$recv(aClass)._name();
  60050. $ctx1.sendIdx["name"]=3;
  60051. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  60052. };
  60053. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  60054. },
  60055. args: ["aClass"],
  60056. 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'].",
  60057. referencedClasses: [],
  60058. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  60059. }),
  60060. $globals.Repl);
  60061. $core.addMethod(
  60062. $core.method({
  60063. selector: "main",
  60064. protocol: 'initialization',
  60065. fn: function (){
  60066. var self=this;
  60067. return $core.withContext(function($ctx1) {
  60068. $recv(self._new())._createInterface();
  60069. return self;
  60070. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  60071. },
  60072. args: [],
  60073. source: "main\x0a\x09self new createInterface",
  60074. referencedClasses: [],
  60075. messageSends: ["createInterface", "new"]
  60076. }),
  60077. $globals.Repl.klass);
  60078. });
  60079. (function () {
  60080. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  60081. amber.initialize().then(function () {
  60082. amber.globals.AmberCli._main();
  60083. });
  60084. });
  60085. }());
  60086. //jshint eqnull:true
  60087. define('amber/kernel-runtime',[],function () {
  60088. "use strict";
  60089. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "root"];
  60090. function DNUBrik(brikz, st) {
  60091. var selectorsBrik = brikz.selectors;
  60092. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  60093. var installJSMethod = brikz.manipulation.installJSMethod;
  60094. var nilAsClass = brikz.root.nilAsClass;
  60095. /* Method not implemented handlers */
  60096. function makeDnuHandler(pair, targetClasses) {
  60097. var jsSelector = pair.js;
  60098. var fn = createHandler(pair.st);
  60099. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  60100. targetClasses.forEach(function (target) {
  60101. installJSMethod(target.fn.prototype, jsSelector, fn);
  60102. });
  60103. }
  60104. this.makeDnuHandler = makeDnuHandler;
  60105. /* Dnu handler method */
  60106. function createHandler(stSelector) {
  60107. return function () {
  60108. return messageNotUnderstood(this, stSelector, arguments);
  60109. };
  60110. }
  60111. selectorsBrik.selectorPairs.forEach(function (pair) {
  60112. makeDnuHandler(pair, []);
  60113. });
  60114. }
  60115. function ManipulationBrik(brikz, st) {
  60116. function installJSMethod(obj, jsSelector, fn) {
  60117. Object.defineProperty(obj, jsSelector, {
  60118. value: fn,
  60119. enumerable: false, configurable: true, writable: true
  60120. });
  60121. }
  60122. function installMethod(method, klass) {
  60123. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  60124. }
  60125. this.installMethod = installMethod;
  60126. this.installJSMethod = installJSMethod;
  60127. }
  60128. RuntimeClassesBrik.deps = ["selectors", "dnu", "classes", "manipulation"];
  60129. function RuntimeClassesBrik(brikz, st) {
  60130. var selectors = brikz.selectors;
  60131. var classes = brikz.classes.classes;
  60132. var wireKlass = brikz.classes.wireKlass;
  60133. var installMethod = brikz.manipulation.installMethod;
  60134. var installJSMethod = brikz.manipulation.installJSMethod;
  60135. /* Initialize a class in its class hierarchy. Handle both classes and
  60136. metaclasses. */
  60137. var detachedRootClasses = [];
  60138. function markClassDetachedRoot(klass) {
  60139. detachedRootClasses.addElement(klass);
  60140. klass.detachedRoot = true;
  60141. }
  60142. this.detachedRootClasses = function () {
  60143. return detachedRootClasses;
  60144. };
  60145. function initClassAndMetaclass(klass) {
  60146. initClass(klass);
  60147. if (klass.klass && !klass.meta) {
  60148. initClass(klass.klass);
  60149. }
  60150. }
  60151. classes().forEach(initClassAndMetaclass);
  60152. st._classAdded = initClassAndMetaclass;
  60153. function initClass(klass) {
  60154. wireKlass(klass);
  60155. if (klass.detachedRoot) {
  60156. copySuperclass(klass);
  60157. }
  60158. installMethods(klass);
  60159. }
  60160. function copySuperclass(klass) {
  60161. var myproto = klass.fn.prototype,
  60162. superproto = klass.superclass.fn.prototype;
  60163. selectors.selectorPairs.forEach(function (selectorPair) {
  60164. var jsSelector = selectorPair.js;
  60165. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  60166. });
  60167. }
  60168. function installMethods(klass) {
  60169. var methods = klass.methods;
  60170. Object.keys(methods).forEach(function (selector) {
  60171. installMethod(methods[selector], klass);
  60172. });
  60173. }
  60174. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  60175. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  60176. markClassDetachedRoot(klass);
  60177. klass.fn = constructor;
  60178. initClass(klass);
  60179. };
  60180. }
  60181. FrameBindingBrik.deps=["globals", "runtimeClasses"];
  60182. function FrameBindingBrik(brikz, st) {
  60183. var globals = brikz.smalltalkGlobals.globals;
  60184. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60185. setClassConstructor(globals.Number, Number);
  60186. setClassConstructor(globals.BlockClosure, Function);
  60187. setClassConstructor(globals.Boolean, Boolean);
  60188. setClassConstructor(globals.Date, Date);
  60189. setClassConstructor(globals.String, String);
  60190. setClassConstructor(globals.Array, Array);
  60191. setClassConstructor(globals.RegularExpression, RegExp);
  60192. setClassConstructor(globals.Error, Error);
  60193. setClassConstructor(globals.Promise, Promise);
  60194. }
  60195. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  60196. function RuntimeMethodsBrik(brikz, st) {
  60197. var installMethod = brikz.manipulation.installMethod;
  60198. var installJSMethod = brikz.manipulation.installJSMethod;
  60199. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  60200. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  60201. st._methodAdded = function (method, klass) {
  60202. installMethod(method, klass);
  60203. propagateMethodChange(klass, method, klass);
  60204. };
  60205. st._selectorsAdded = function (newSelectors) {
  60206. var targetClasses = detachedRootClasses();
  60207. newSelectors.forEach(function (pair) {
  60208. makeDnuHandler(pair, targetClasses);
  60209. });
  60210. };
  60211. st._methodRemoved = function (method, klass) {
  60212. delete klass.fn.prototype[method.jsSelector];
  60213. propagateMethodChange(klass, method, null);
  60214. };
  60215. function propagateMethodChange(klass, method, exclude) {
  60216. var selector = method.selector;
  60217. var jsSelector = method.jsSelector;
  60218. st.traverseClassTree(klass, function (subclass) {
  60219. if (subclass != exclude) {
  60220. initMethodInClass(subclass, selector, jsSelector);
  60221. }
  60222. });
  60223. }
  60224. function initMethodInClass(klass, selector, jsSelector) {
  60225. if (klass.detachedRoot && !klass.methods[selector]) {
  60226. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  60227. }
  60228. }
  60229. }
  60230. PrimitivesBrik.deps = ["smalltalkGlobals"];
  60231. function PrimitivesBrik(brikz, st) {
  60232. var globals = brikz.smalltalkGlobals.globals;
  60233. var oid = 0;
  60234. /* Unique ID number generator */
  60235. st.nextId = function () {
  60236. oid += 1;
  60237. return oid;
  60238. };
  60239. /* Converts a JavaScript object to valid Smalltalk Object */
  60240. st.readJSObject = function (js) {
  60241. if (js == null)
  60242. return null;
  60243. var readObject = js.constructor === Object;
  60244. var readArray = js.constructor === Array;
  60245. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  60246. for (var i in js) {
  60247. if (readObject) {
  60248. object._at_put_(i, st.readJSObject(js[i]));
  60249. }
  60250. if (readArray) {
  60251. object[i] = st.readJSObject(js[i]);
  60252. }
  60253. }
  60254. return object;
  60255. };
  60256. /* Boolean assertion */
  60257. st.assert = function (shouldBeBoolean) {
  60258. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60259. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  60260. shouldBeBoolean = shouldBeBoolean.valueOf();
  60261. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60262. }
  60263. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  60264. };
  60265. /* List of all reserved words in JavaScript. They may not be used as variables
  60266. in Smalltalk. */
  60267. // list of reserved JavaScript keywords as of
  60268. // http://es5.github.com/#x7.6.1.1
  60269. // and
  60270. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  60271. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  60272. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  60273. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  60274. 'try', 'typeof', 'var', 'void', 'while', 'with',
  60275. // Amber protected words: these should not be compiled as-is when in code
  60276. 'arguments',
  60277. // ES5: future use: http://es5.github.com/#x7.6.1.2
  60278. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  60279. // ES5: future use in strict mode
  60280. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  60281. 'public', 'static', 'yield'];
  60282. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  60283. }
  60284. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  60285. function RuntimeBrik(brikz, st) {
  60286. var globals = brikz.smalltalkGlobals.globals;
  60287. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60288. function SmalltalkMethodContext(home, setup) {
  60289. this.sendIdx = {};
  60290. this.homeContext = home;
  60291. this.setup = setup || function () {
  60292. };
  60293. this.supercall = false;
  60294. }
  60295. // Fallbacks
  60296. SmalltalkMethodContext.prototype.locals = {};
  60297. SmalltalkMethodContext.prototype.receiver = null;
  60298. SmalltalkMethodContext.prototype.selector = null;
  60299. SmalltalkMethodContext.prototype.lookupClass = null;
  60300. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  60301. this.receiver = receiver;
  60302. this.selector = selector;
  60303. this.locals = locals || {};
  60304. this.lookupClass = lookupClass;
  60305. if (this.homeContext) {
  60306. this.homeContext.evaluatedSelector = selector;
  60307. }
  60308. };
  60309. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  60310. this.locals = locals || {};
  60311. this.outerContext = ctx;
  60312. this.index = index || 0;
  60313. };
  60314. SmalltalkMethodContext.prototype.init = function () {
  60315. var home = this.homeContext;
  60316. if (home) {
  60317. home.init();
  60318. }
  60319. this.setup(this);
  60320. };
  60321. SmalltalkMethodContext.prototype.method = function () {
  60322. var method;
  60323. var lookup = this.lookupClass || this.receiver.klass;
  60324. while (!method && lookup) {
  60325. method = lookup.methods[st.js2st(this.selector)];
  60326. lookup = lookup.superclass;
  60327. }
  60328. return method;
  60329. };
  60330. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  60331. /* This is the current call context object. While it is publicly available,
  60332. Use smalltalk.getThisContext() instead which will answer a safe copy of
  60333. the current context */
  60334. var thisContext = null;
  60335. st.withContext = function (worker, setup) {
  60336. if (thisContext) {
  60337. return inContext(worker, setup);
  60338. } else {
  60339. return inContextWithErrorHandling(worker, setup);
  60340. }
  60341. };
  60342. /*
  60343. Runs worker function so that error handler is not set up
  60344. if there isn't one. This is accomplished by unconditional
  60345. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  60346. which then stops error handler setup (see st.withContext above).
  60347. The effect is, $core.seamless(fn)'s exceptions are not
  60348. handed into ST error handler and caller should process them.
  60349. */
  60350. st.seamless = function (worker) {
  60351. return inContext(worker, function (ctx) {
  60352. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  60353. });
  60354. };
  60355. function inContextWithErrorHandling(worker, setup) {
  60356. try {
  60357. return inContext(worker, setup);
  60358. } catch (error) {
  60359. handleError(error);
  60360. thisContext = null;
  60361. // Rethrow the error in any case.
  60362. error.amberHandled = true;
  60363. throw error;
  60364. }
  60365. }
  60366. function inContext(worker, setup) {
  60367. var oldContext = thisContext;
  60368. thisContext = new SmalltalkMethodContext(thisContext, setup);
  60369. var result = worker(thisContext);
  60370. thisContext = oldContext;
  60371. return result;
  60372. }
  60373. /* Wrap a JavaScript exception in a Smalltalk Exception.
  60374. In case of a RangeError, stub the stack after 100 contexts to
  60375. avoid another RangeError later when the stack is manipulated. */
  60376. function wrappedError(error) {
  60377. var errorWrapper = globals.JavaScriptException._on_(error);
  60378. // Add the error to the context, so it is visible in the stack
  60379. try {
  60380. errorWrapper._signal();
  60381. } catch (ex) {
  60382. }
  60383. var context = st.getThisContext();
  60384. if (isRangeError(error)) {
  60385. stubContextStack(context);
  60386. }
  60387. errorWrapper._context_(context);
  60388. return errorWrapper;
  60389. }
  60390. /* Stub the context stack after 100 contexts */
  60391. function stubContextStack(context) {
  60392. var currentContext = context;
  60393. var contexts = 0;
  60394. while (contexts < 100) {
  60395. if (currentContext) {
  60396. currentContext = currentContext.homeContext;
  60397. }
  60398. contexts++;
  60399. }
  60400. if (currentContext) {
  60401. currentContext.homeContext = undefined;
  60402. }
  60403. }
  60404. function isRangeError(error) {
  60405. return error instanceof RangeError;
  60406. }
  60407. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  60408. (See the Smalltalk class ErrorHandler and its subclasses */
  60409. function handleError(error) {
  60410. if (!error.smalltalkError) {
  60411. error = wrappedError(error);
  60412. }
  60413. globals.ErrorHandler._handleError_(error);
  60414. }
  60415. /* Handle thisContext pseudo variable */
  60416. st.getThisContext = function () {
  60417. if (thisContext) {
  60418. thisContext.init();
  60419. return thisContext;
  60420. } else {
  60421. return null;
  60422. }
  60423. };
  60424. }
  60425. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  60426. function MessageSendBrik(brikz, st) {
  60427. var globals = brikz.smalltalkGlobals.globals;
  60428. var nil = brikz.root.nil;
  60429. /* Handles unhandled errors during message sends */
  60430. // simply send the message and handle #dnu:
  60431. st.send2 = function (receiver, selector, args, klass) {
  60432. var method, jsSelector = st.st2js(selector);
  60433. if (receiver == null) {
  60434. receiver = nil;
  60435. }
  60436. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  60437. if (method) {
  60438. return method.apply(receiver, args || []);
  60439. } else {
  60440. return messageNotUnderstood(receiver, selector, args);
  60441. }
  60442. };
  60443. function invokeDnuMethod(receiver, stSelector, args) {
  60444. return receiver._doesNotUnderstand_(
  60445. globals.Message._new()
  60446. ._selector_(stSelector)
  60447. ._arguments_([].slice.call(args))
  60448. );
  60449. }
  60450. /* Handles #dnu: *and* JavaScript method calls.
  60451. if the receiver has no klass, we consider it a JS object (outside of the
  60452. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  60453. function messageNotUnderstood(receiver, stSelector, args) {
  60454. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  60455. return invokeDnuMethod(receiver, stSelector, args);
  60456. }
  60457. /* Call a method of a JS object, or answer a property if it exists.
  60458. Else try wrapping a JSObjectProxy around the receiver. */
  60459. var propertyName = st.st2prop(stSelector);
  60460. if (!(propertyName in receiver)) {
  60461. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  60462. }
  60463. return accessJavaScript(receiver, propertyName, args);
  60464. }
  60465. /* If the object property is a function, then call it, except if it starts with
  60466. an uppercase character (we probably want to answer the function itself in this
  60467. case and send it #new from Amber).
  60468. Converts keyword-based selectors by using the first
  60469. keyword only, but keeping all message arguments.
  60470. Example:
  60471. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  60472. function accessJavaScript(receiver, propertyName, args) {
  60473. var propertyValue = receiver[propertyName];
  60474. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  60475. return propertyValue.apply(receiver, args || []);
  60476. } else if (args.length > 0) {
  60477. receiver[propertyName] = args[0];
  60478. return receiver;
  60479. } else {
  60480. return propertyValue;
  60481. }
  60482. }
  60483. st.accessJavaScript = accessJavaScript;
  60484. this.messageNotUnderstood = messageNotUnderstood;
  60485. }
  60486. /* Making smalltalk that can run */
  60487. function configureWithRuntime(brikz) {
  60488. brikz.dnu = DNUBrik;
  60489. brikz.manipulation = ManipulationBrik;
  60490. brikz.runtimeClasses = RuntimeClassesBrik;
  60491. brikz.frameBinding = FrameBindingBrik;
  60492. brikz.runtimeMethods = RuntimeMethodsBrik;
  60493. brikz.messageSend = MessageSendBrik;
  60494. brikz.runtime = RuntimeBrik;
  60495. brikz.primitives = PrimitivesBrik;
  60496. brikz.rebuild();
  60497. }
  60498. return configureWithRuntime;
  60499. });
  60500. // Depend on each module that is loaded lazily.
  60501. // Add to packager tasks as dependency,
  60502. // so the lazy-loaded modules are included.
  60503. define('amber/lazypack',['./kernel-runtime'], {});
  60504. require(["app"]);
  60505. });
  60506. define.require('__wrap__');
  60507. }((function amdefine(module, requireFn) {
  60508. 'use strict';
  60509. var defineCache = {},
  60510. loaderCache = {},
  60511. alreadyCalled = false,
  60512. path = require('path'),
  60513. makeRequire, stringRequire;
  60514. /**
  60515. * Trims the . and .. from an array of path segments.
  60516. * It will keep a leading path segment if a .. will become
  60517. * the first path segment, to help with module name lookups,
  60518. * which act like paths, but can be remapped. But the end result,
  60519. * all paths that use this function should look normalized.
  60520. * NOTE: this method MODIFIES the input array.
  60521. * @param {Array} ary the array of path segments.
  60522. */
  60523. function trimDots(ary) {
  60524. var i, part;
  60525. for (i = 0; ary[i]; i+= 1) {
  60526. part = ary[i];
  60527. if (part === '.') {
  60528. ary.splice(i, 1);
  60529. i -= 1;
  60530. } else if (part === '..') {
  60531. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60532. //End of the line. Keep at least one non-dot
  60533. //path segment at the front so it can be mapped
  60534. //correctly to disk. Otherwise, there is likely
  60535. //no path mapping for a path starting with '..'.
  60536. //This can still fail, but catches the most reasonable
  60537. //uses of ..
  60538. break;
  60539. } else if (i > 0) {
  60540. ary.splice(i - 1, 2);
  60541. i -= 2;
  60542. }
  60543. }
  60544. }
  60545. }
  60546. function normalize(name, baseName) {
  60547. var baseParts;
  60548. //Adjust any relative paths.
  60549. if (name && name.charAt(0) === '.') {
  60550. //If have a base name, try to normalize against it,
  60551. //otherwise, assume it is a top-level require that will
  60552. //be relative to baseUrl in the end.
  60553. if (baseName) {
  60554. baseParts = baseName.split('/');
  60555. baseParts = baseParts.slice(0, baseParts.length - 1);
  60556. baseParts = baseParts.concat(name.split('/'));
  60557. trimDots(baseParts);
  60558. name = baseParts.join('/');
  60559. }
  60560. }
  60561. return name;
  60562. }
  60563. /**
  60564. * Create the normalize() function passed to a loader plugin's
  60565. * normalize method.
  60566. */
  60567. function makeNormalize(relName) {
  60568. return function (name) {
  60569. return normalize(name, relName);
  60570. };
  60571. }
  60572. function makeLoad(id) {
  60573. function load(value) {
  60574. loaderCache[id] = value;
  60575. }
  60576. load.fromText = function (id, text) {
  60577. //This one is difficult because the text can/probably uses
  60578. //define, and any relative paths and requires should be relative
  60579. //to that id was it would be found on disk. But this would require
  60580. //bootstrapping a module/require fairly deeply from node core.
  60581. //Not sure how best to go about that yet.
  60582. throw new Error('amdefine does not implement load.fromText');
  60583. };
  60584. return load;
  60585. }
  60586. makeRequire = function (systemRequire, exports, module, relId) {
  60587. function amdRequire(deps, callback) {
  60588. if (typeof deps === 'string') {
  60589. //Synchronous, single module require('')
  60590. return stringRequire(systemRequire, exports, module, deps, relId);
  60591. } else {
  60592. //Array of dependencies with a callback.
  60593. //Convert the dependencies to modules.
  60594. deps = deps.map(function (depName) {
  60595. return stringRequire(systemRequire, exports, module, depName, relId);
  60596. });
  60597. //Wait for next tick to call back the require call.
  60598. if (callback) {
  60599. process.nextTick(function () {
  60600. callback.apply(null, deps);
  60601. });
  60602. }
  60603. }
  60604. }
  60605. amdRequire.toUrl = function (filePath) {
  60606. if (filePath.indexOf('.') === 0) {
  60607. return normalize(filePath, path.dirname(module.filename));
  60608. } else {
  60609. return filePath;
  60610. }
  60611. };
  60612. return amdRequire;
  60613. };
  60614. //Favor explicit value, passed in if the module wants to support Node 0.4.
  60615. requireFn = requireFn || function req() {
  60616. return module.require.apply(module, arguments);
  60617. };
  60618. function runFactory(id, deps, factory) {
  60619. var r, e, m, result;
  60620. if (id) {
  60621. e = loaderCache[id] = {};
  60622. m = {
  60623. id: id,
  60624. uri: __filename,
  60625. exports: e
  60626. };
  60627. r = makeRequire(requireFn, e, m, id);
  60628. } else {
  60629. //Only support one define call per file
  60630. if (alreadyCalled) {
  60631. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  60632. }
  60633. alreadyCalled = true;
  60634. //Use the real variables from node
  60635. //Use module.exports for exports, since
  60636. //the exports in here is amdefine exports.
  60637. e = module.exports;
  60638. m = module;
  60639. r = makeRequire(requireFn, e, m, module.id);
  60640. }
  60641. //If there are dependencies, they are strings, so need
  60642. //to convert them to dependency values.
  60643. if (deps) {
  60644. deps = deps.map(function (depName) {
  60645. return r(depName);
  60646. });
  60647. }
  60648. //Call the factory with the right dependencies.
  60649. if (typeof factory === 'function') {
  60650. result = factory.apply(m.exports, deps);
  60651. } else {
  60652. result = factory;
  60653. }
  60654. if (result !== undefined) {
  60655. m.exports = result;
  60656. if (id) {
  60657. loaderCache[id] = m.exports;
  60658. }
  60659. }
  60660. }
  60661. stringRequire = function (systemRequire, exports, module, id, relId) {
  60662. //Split the ID by a ! so that
  60663. var index = id.indexOf('!'),
  60664. originalId = id,
  60665. prefix, plugin;
  60666. if (index === -1) {
  60667. id = normalize(id, relId);
  60668. //Straight module lookup. If it is one of the special dependencies,
  60669. //deal with it, otherwise, delegate to node.
  60670. if (id === 'require') {
  60671. return makeRequire(systemRequire, exports, module, relId);
  60672. } else if (id === 'exports') {
  60673. return exports;
  60674. } else if (id === 'module') {
  60675. return module;
  60676. } else if (loaderCache.hasOwnProperty(id)) {
  60677. return loaderCache[id];
  60678. } else if (defineCache[id]) {
  60679. runFactory.apply(null, defineCache[id]);
  60680. return loaderCache[id];
  60681. } else {
  60682. if(systemRequire) {
  60683. return systemRequire(originalId);
  60684. } else {
  60685. throw new Error('No module with ID: ' + id);
  60686. }
  60687. }
  60688. } else {
  60689. //There is a plugin in play.
  60690. prefix = id.substring(0, index);
  60691. id = id.substring(index + 1, id.length);
  60692. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  60693. if (plugin.normalize) {
  60694. id = plugin.normalize(id, makeNormalize(relId));
  60695. } else {
  60696. //Normalize the ID normally.
  60697. id = normalize(id, relId);
  60698. }
  60699. if (loaderCache[id]) {
  60700. return loaderCache[id];
  60701. } else {
  60702. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  60703. return loaderCache[id];
  60704. }
  60705. }
  60706. };
  60707. //Create a define function specific to the module asking for amdefine.
  60708. function define(id, deps, factory) {
  60709. if (Array.isArray(id)) {
  60710. factory = deps;
  60711. deps = id;
  60712. id = undefined;
  60713. } else if (typeof id !== 'string') {
  60714. factory = id;
  60715. id = deps = undefined;
  60716. }
  60717. if (deps && !Array.isArray(deps)) {
  60718. factory = deps;
  60719. deps = undefined;
  60720. }
  60721. if (!deps) {
  60722. deps = ['require', 'exports', 'module'];
  60723. }
  60724. //Set up properties for this module. If an ID, then use
  60725. //internal cache. If no ID, then use the external variables
  60726. //for this node module.
  60727. if (id) {
  60728. //Put the module in deep freeze until there is a
  60729. //require call for it.
  60730. defineCache[id] = [id, deps, factory];
  60731. } else {
  60732. runFactory(id, deps, factory);
  60733. }
  60734. }
  60735. //define.require, which has access to all the values in the
  60736. //cache. Useful for AMD modules that all have IDs in the file,
  60737. //but need to finally export a value to node based on one of those
  60738. //IDs.
  60739. define.require = function (id) {
  60740. if (loaderCache[id]) {
  60741. return loaderCache[id];
  60742. }
  60743. if (defineCache[id]) {
  60744. runFactory.apply(null, defineCache[id]);
  60745. return loaderCache[id];
  60746. }
  60747. };
  60748. define.amd = {};
  60749. return define;
  60750. }(module)), require));